@volcengine/veplayer-plugin 2.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/esm/flv.d.ts +3 -0
- package/esm/hls.d.ts +3 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.development.css +63 -0
- package/esm/index.development.js +83150 -0
- package/esm/index.production.css +1 -0
- package/esm/index.production.js +26 -0
- package/esm/mp4.d.ts +3 -0
- package/esm/rtm.d.ts +3 -0
- package/esm/shaka.d.ts +3 -0
- package/esm/veplayer.plugin.flv.development.js +17622 -0
- package/esm/veplayer.plugin.flv.production.js +2 -0
- package/esm/veplayer.plugin.hls.development.js +21398 -0
- package/esm/veplayer.plugin.hls.production.js +2 -0
- package/esm/veplayer.plugin.mp4.development.js +33148 -0
- package/esm/veplayer.plugin.mp4.production.js +2 -0
- package/esm/veplayer.plugin.rtm.development.js +5469 -0
- package/esm/veplayer.plugin.rtm.production.js +2 -0
- package/esm/veplayer.plugin.shaka.development.js +15890 -0
- package/esm/veplayer.plugin.shaka.production.js +20 -0
- package/esm/veplayer.plugin.time.shift.development.css +63 -0
- package/esm/veplayer.plugin.time.shift.development.js +339 -0
- package/esm/veplayer.plugin.time.shift.production.css +1 -0
- package/esm/veplayer.plugin.time.shift.production.js +2 -0
- package/esm/veplayer.plugin.xgvideo.development.js +19094 -0
- package/esm/veplayer.plugin.xgvideo.production.js +2 -0
- package/esm/xgvideo.d.ts +3 -0
- package/package.json +155 -0
- package/umd/flv.d.ts +3 -0
- package/umd/hls.d.ts +3 -0
- package/umd/index.d.ts +6 -0
- package/umd/index.development.js +82776 -0
- package/umd/index.production.js +1 -0
- package/umd/mp4.d.ts +3 -0
- package/umd/rtm.d.ts +3 -0
- package/umd/shaka.d.ts +3 -0
- package/umd/veplayer.plugin.flv.development.js +17625 -0
- package/umd/veplayer.plugin.flv.production.js +1 -0
- package/umd/veplayer.plugin.hls.development.js +21402 -0
- package/umd/veplayer.plugin.hls.production.js +1 -0
- package/umd/veplayer.plugin.mp4.development.js +33152 -0
- package/umd/veplayer.plugin.mp4.production.js +1 -0
- package/umd/veplayer.plugin.rtm.development.js +5473 -0
- package/umd/veplayer.plugin.rtm.production.js +1 -0
- package/umd/veplayer.plugin.shaka.development.js +15894 -0
- package/umd/veplayer.plugin.shaka.production.js +1 -0
- package/umd/veplayer.plugin.time.shift.development.css +63 -0
- package/umd/veplayer.plugin.time.shift.development.js +342 -0
- package/umd/veplayer.plugin.time.shift.production.css +1 -0
- package/umd/veplayer.plugin.time.shift.production.js +1 -0
- package/umd/veplayer.plugin.xgvideo.development.js +19098 -0
- package/umd/veplayer.plugin.xgvideo.production.js +1 -0
- package/umd/xgvideo.d.ts +3 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp=Object.defineProperty,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__publicField=(e,t,r)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,r),r);function ownKeys$b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$9(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$b(Object(r),!0).forEach((function(t){_defineProperty$f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$9(){_regeneratorRuntime$9=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function asyncGeneratorStep$9(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator$9(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep$9(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep$9(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck$h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$5(n.key),n)}}function _createClass$h(e,t,r){return t&&_defineProperties$h(e.prototype,t),r&&_defineProperties$h(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$f(e,t,r){return(t=_toPropertyKey$5(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$d(e,t)}function _getPrototypeOf$d(e){return(_getPrototypeOf$d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$d(e,t){return(_setPrototypeOf$d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized$d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$d(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$d(e)}function _createSuper$d(e){var t=_isNativeReflectConstruct$d();return function(){var r,n=_getPrototypeOf$d(e);if(t){var i=_getPrototypeOf$d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$d(this,r)}}function _toPrimitive$5(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey$5(e){var t=_toPrimitive$5(e,"string");return"symbol"==typeof t?t:String(t)}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var check=function(e){return e&&e.Math==Math&&e},global$M=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal&&commonjsGlobal)||function(){return this}()||Function("return this")(),objectGetOwnPropertyDescriptor={},fails$V=function(e){try{return!!e()}catch(e){return!0}},fails$U=fails$V,descriptors=!fails$U((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),fails$T=fails$V,functionBindNative=!fails$T((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),NATIVE_BIND$4=functionBindNative,call$u=Function.prototype.call,functionCall=NATIVE_BIND$4?call$u.bind(call$u):function(){return call$u.apply(call$u,arguments)},objectPropertyIsEnumerable={},$propertyIsEnumerable$2={}.propertyIsEnumerable,getOwnPropertyDescriptor$6=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor$6&&!$propertyIsEnumerable$2.call({1:2},1);objectPropertyIsEnumerable.f=NASHORN_BUG?function(e){var t=getOwnPropertyDescriptor$6(this,e);return!!t&&t.enumerable}:$propertyIsEnumerable$2;var match,version$2,createPropertyDescriptor$7=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},NATIVE_BIND$3=functionBindNative,FunctionPrototype$3=Function.prototype,call$t=FunctionPrototype$3.call,uncurryThisWithBind=NATIVE_BIND$3&&FunctionPrototype$3.bind.bind(call$t,call$t),functionUncurryThis=NATIVE_BIND$3?uncurryThisWithBind:function(e){return function(){return call$t.apply(e,arguments)}},uncurryThis$T=functionUncurryThis,toString$o=uncurryThis$T({}.toString),stringSlice$c=uncurryThis$T("".slice),classofRaw$2=function(e){return stringSlice$c(toString$o(e),8,-1)},uncurryThis$S=functionUncurryThis,fails$S=fails$V,classof$h=classofRaw$2,$Object$4=Object,split$3=uncurryThis$S("".split),indexedObject=fails$S((function(){return!$Object$4("z").propertyIsEnumerable(0)}))?function(e){return"String"==classof$h(e)?split$3(e,""):$Object$4(e)}:$Object$4,isNullOrUndefined$9=function(e){return null==e},isNullOrUndefined$8=isNullOrUndefined$9,$TypeError$k=TypeError,requireObjectCoercible$b=function(e){if(isNullOrUndefined$8(e))throw $TypeError$k("Can't call method on "+e);return e},IndexedObject$5=indexedObject,requireObjectCoercible$a=requireObjectCoercible$b,toIndexedObject$d=function(e){return IndexedObject$5(requireObjectCoercible$a(e))},documentAll$2="object"==typeof document&&document.all,IS_HTMLDDA=void 0===documentAll$2&&void 0!==documentAll$2,documentAll_1={all:documentAll$2,IS_HTMLDDA:IS_HTMLDDA},$documentAll$1=documentAll_1,documentAll$1=$documentAll$1.all,isCallable$v=$documentAll$1.IS_HTMLDDA?function(e){return"function"==typeof e||e===documentAll$1}:function(e){return"function"==typeof e},isCallable$u=isCallable$v,$documentAll=documentAll_1,documentAll=$documentAll.all,isObject$t=$documentAll.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:isCallable$u(e)||e===documentAll}:function(e){return"object"==typeof e?null!==e:isCallable$u(e)},global$L=global$M,isCallable$t=isCallable$v,aFunction=function(e){return isCallable$t(e)?e:void 0},getBuiltIn$d=function(e,t){return arguments.length<2?aFunction(global$L[e]):global$L[e]&&global$L[e][t]},uncurryThis$R=functionUncurryThis,objectIsPrototypeOf=uncurryThis$R({}.isPrototypeOf),getBuiltIn$c=getBuiltIn$d,engineUserAgent=getBuiltIn$c("navigator","userAgent")||"",global$K=global$M,userAgent$7=engineUserAgent,process$4=global$K.process,Deno$1=global$K.Deno,versions=process$4&&process$4.versions||Deno$1&&Deno$1.version,v8=versions&&versions.v8;v8&&(version$2=(match=v8.split("."))[0]>0&&match[0]<4?1:+(match[0]+match[1])),!version$2&&userAgent$7&&(!(match=userAgent$7.match(/Edge\/(\d+)/))||match[1]>=74)&&(match=userAgent$7.match(/Chrome\/(\d+)/))&&(version$2=+match[1]);var engineV8Version=version$2,V8_VERSION$3=engineV8Version,fails$R=fails$V,symbolConstructorDetection=!!Object.getOwnPropertySymbols&&!fails$R((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&V8_VERSION$3&&V8_VERSION$3<41})),NATIVE_SYMBOL$6=symbolConstructorDetection,useSymbolAsUid=NATIVE_SYMBOL$6&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,getBuiltIn$b=getBuiltIn$d,isCallable$s=isCallable$v,isPrototypeOf$9=objectIsPrototypeOf,USE_SYMBOL_AS_UID$1=useSymbolAsUid,$Object$3=Object,isSymbol$6=USE_SYMBOL_AS_UID$1?function(e){return"symbol"==typeof e}:function(e){var t=getBuiltIn$b("Symbol");return isCallable$s(t)&&isPrototypeOf$9(t.prototype,$Object$3(e))},$String$4=String,tryToString$7=function(e){try{return $String$4(e)}catch(e){return"Object"}},isCallable$r=isCallable$v,tryToString$6=tryToString$7,$TypeError$j=TypeError,aCallable$b=function(e){if(isCallable$r(e))return e;throw $TypeError$j(tryToString$6(e)+" is not a function")},aCallable$a=aCallable$b,isNullOrUndefined$7=isNullOrUndefined$9,getMethod$6=function(e,t){var r=e[t];return isNullOrUndefined$7(r)?void 0:aCallable$a(r)},call$s=functionCall,isCallable$q=isCallable$v,isObject$s=isObject$t,$TypeError$i=TypeError,ordinaryToPrimitive$1=function(e,t){var r,n;if("string"===t&&isCallable$q(r=e.toString)&&!isObject$s(n=call$s(r,e)))return n;if(isCallable$q(r=e.valueOf)&&!isObject$s(n=call$s(r,e)))return n;if("string"!==t&&isCallable$q(r=e.toString)&&!isObject$s(n=call$s(r,e)))return n;throw $TypeError$i("Can't convert object to primitive value")},shared$7={exports:{}},isPure=!1,global$J=global$M,defineProperty$g=Object.defineProperty,defineGlobalProperty$3=function(e,t){try{defineProperty$g(global$J,e,{value:t,configurable:!0,writable:!0})}catch(r){global$J[e]=t}return t},global$I=global$M,defineGlobalProperty$2=defineGlobalProperty$3,SHARED="__core-js_shared__",store$3=global$I[SHARED]||defineGlobalProperty$2(SHARED,{}),sharedStore=store$3,store$2=sharedStore;(shared$7.exports=function(e,t){return store$2[e]||(store$2[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"});var sharedExports=shared$7.exports,requireObjectCoercible$9=requireObjectCoercible$b,$Object$2=Object,toObject$h=function(e){return $Object$2(requireObjectCoercible$9(e))},uncurryThis$Q=functionUncurryThis,toObject$g=toObject$h,hasOwnProperty$2=uncurryThis$Q({}.hasOwnProperty),hasOwnProperty_1=Object.hasOwn||function(e,t){return hasOwnProperty$2(toObject$g(e),t)},uncurryThis$P=functionUncurryThis,id$1=0,postfix=Math.random(),toString$n=uncurryThis$P(1..toString),uid$5=function(e){return"Symbol("+(void 0===e?"":e)+")_"+toString$n(++id$1+postfix,36)},global$H=global$M,shared$6=sharedExports,hasOwn$n=hasOwnProperty_1,uid$4=uid$5,NATIVE_SYMBOL$5=symbolConstructorDetection,USE_SYMBOL_AS_UID=useSymbolAsUid,WellKnownSymbolsStore$1=shared$6("wks"),Symbol$3=global$H.Symbol,symbolFor=Symbol$3&&Symbol$3.for,createWellKnownSymbol=USE_SYMBOL_AS_UID?Symbol$3:Symbol$3&&Symbol$3.withoutSetter||uid$4,wellKnownSymbol$u=function(e){if(!hasOwn$n(WellKnownSymbolsStore$1,e)||!NATIVE_SYMBOL$5&&"string"!=typeof WellKnownSymbolsStore$1[e]){var t="Symbol."+e;NATIVE_SYMBOL$5&&hasOwn$n(Symbol$3,e)?WellKnownSymbolsStore$1[e]=Symbol$3[e]:WellKnownSymbolsStore$1[e]=USE_SYMBOL_AS_UID&&symbolFor?symbolFor(t):createWellKnownSymbol(t)}return WellKnownSymbolsStore$1[e]},call$r=functionCall,isObject$r=isObject$t,isSymbol$5=isSymbol$6,getMethod$5=getMethod$6,ordinaryToPrimitive=ordinaryToPrimitive$1,wellKnownSymbol$t=wellKnownSymbol$u,$TypeError$h=TypeError,TO_PRIMITIVE=wellKnownSymbol$t("toPrimitive"),toPrimitive$3=function(e,t){if(!isObject$r(e)||isSymbol$5(e))return e;var r,n=getMethod$5(e,TO_PRIMITIVE);if(n){if(void 0===t&&(t="default"),r=call$r(n,e,t),!isObject$r(r)||isSymbol$5(r))return r;throw $TypeError$h("Can't convert object to primitive value")}return void 0===t&&(t="number"),ordinaryToPrimitive(e,t)},toPrimitive$2=toPrimitive$3,isSymbol$4=isSymbol$6,toPropertyKey$5=function(e){var t=toPrimitive$2(e,"string");return isSymbol$4(t)?t:t+""},global$G=global$M,isObject$q=isObject$t,document$3=global$G.document,EXISTS$1=isObject$q(document$3)&&isObject$q(document$3.createElement),documentCreateElement$2=function(e){return EXISTS$1?document$3.createElement(e):{}},DESCRIPTORS$r=descriptors,fails$Q=fails$V,createElement$1=documentCreateElement$2,ie8DomDefine=!DESCRIPTORS$r&&!fails$Q((function(){return 7!=Object.defineProperty(createElement$1("div"),"a",{get:function(){return 7}}).a})),DESCRIPTORS$q=descriptors,call$q=functionCall,propertyIsEnumerableModule$2=objectPropertyIsEnumerable,createPropertyDescriptor$6=createPropertyDescriptor$7,toIndexedObject$c=toIndexedObject$d,toPropertyKey$4=toPropertyKey$5,hasOwn$m=hasOwnProperty_1,IE8_DOM_DEFINE$1=ie8DomDefine,$getOwnPropertyDescriptor$2=Object.getOwnPropertyDescriptor;objectGetOwnPropertyDescriptor.f=DESCRIPTORS$q?$getOwnPropertyDescriptor$2:function(e,t){if(e=toIndexedObject$c(e),t=toPropertyKey$4(t),IE8_DOM_DEFINE$1)try{return $getOwnPropertyDescriptor$2(e,t)}catch(e){}if(hasOwn$m(e,t))return createPropertyDescriptor$6(!call$q(propertyIsEnumerableModule$2.f,e,t),e[t])};var objectDefineProperty={},DESCRIPTORS$p=descriptors,fails$P=fails$V,v8PrototypeDefineBug=DESCRIPTORS$p&&fails$P((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),isObject$p=isObject$t,$String$3=String,$TypeError$g=TypeError,anObject$m=function(e){if(isObject$p(e))return e;throw $TypeError$g($String$3(e)+" is not an object")},DESCRIPTORS$o=descriptors,IE8_DOM_DEFINE=ie8DomDefine,V8_PROTOTYPE_DEFINE_BUG$1=v8PrototypeDefineBug,anObject$l=anObject$m,toPropertyKey$3=toPropertyKey$5,$TypeError$f=TypeError,$defineProperty$1=Object.defineProperty,$getOwnPropertyDescriptor$1=Object.getOwnPropertyDescriptor,ENUMERABLE="enumerable",CONFIGURABLE$1="configurable",WRITABLE="writable";objectDefineProperty.f=DESCRIPTORS$o?V8_PROTOTYPE_DEFINE_BUG$1?function(e,t,r){if(anObject$l(e),t=toPropertyKey$3(t),anObject$l(r),"function"==typeof e&&"prototype"===t&&"value"in r&&WRITABLE in r&&!r[WRITABLE]){var n=$getOwnPropertyDescriptor$1(e,t);n&&n[WRITABLE]&&(e[t]=r.value,r={configurable:CONFIGURABLE$1 in r?r[CONFIGURABLE$1]:n[CONFIGURABLE$1],enumerable:ENUMERABLE in r?r[ENUMERABLE]:n[ENUMERABLE],writable:!1})}return $defineProperty$1(e,t,r)}:$defineProperty$1:function(e,t,r){if(anObject$l(e),t=toPropertyKey$3(t),anObject$l(r),IE8_DOM_DEFINE)try{return $defineProperty$1(e,t,r)}catch(e){}if("get"in r||"set"in r)throw $TypeError$f("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var DESCRIPTORS$n=descriptors,definePropertyModule$7=objectDefineProperty,createPropertyDescriptor$5=createPropertyDescriptor$7,createNonEnumerableProperty$a=DESCRIPTORS$n?function(e,t,r){return definePropertyModule$7.f(e,t,createPropertyDescriptor$5(1,r))}:function(e,t,r){return e[t]=r,e},makeBuiltIn$3={exports:{}},DESCRIPTORS$m=descriptors,hasOwn$l=hasOwnProperty_1,FunctionPrototype$2=Function.prototype,getDescriptor=DESCRIPTORS$m&&Object.getOwnPropertyDescriptor,EXISTS=hasOwn$l(FunctionPrototype$2,"name"),PROPER=EXISTS&&"something"===function(){}.name,CONFIGURABLE=EXISTS&&(!DESCRIPTORS$m||DESCRIPTORS$m&&getDescriptor(FunctionPrototype$2,"name").configurable),functionName={EXISTS:EXISTS,PROPER:PROPER,CONFIGURABLE:CONFIGURABLE},uncurryThis$O=functionUncurryThis,isCallable$p=isCallable$v,store$1=sharedStore,functionToString$2=uncurryThis$O(Function.toString);isCallable$p(store$1.inspectSource)||(store$1.inspectSource=function(e){return functionToString$2(e)});var set$2,get$1,has,inspectSource$3=store$1.inspectSource,global$F=global$M,isCallable$o=isCallable$v,WeakMap$2=global$F.WeakMap,weakMapBasicDetection=isCallable$o(WeakMap$2)&&/native code/.test(String(WeakMap$2)),shared$5=sharedExports,uid$3=uid$5,keys$4=shared$5("keys"),sharedKey$4=function(e){return keys$4[e]||(keys$4[e]=uid$3(e))},hiddenKeys$6={},NATIVE_WEAK_MAP=weakMapBasicDetection,global$E=global$M,isObject$o=isObject$t,createNonEnumerableProperty$9=createNonEnumerableProperty$a,hasOwn$k=hasOwnProperty_1,shared$4=sharedStore,sharedKey$3=sharedKey$4,hiddenKeys$5=hiddenKeys$6,OBJECT_ALREADY_INITIALIZED="Object already initialized",TypeError$7=global$E.TypeError,WeakMap$1=global$E.WeakMap,enforce=function(e){return has(e)?get$1(e):set$2(e,{})},getterFor=function(e){return function(t){var r;if(!isObject$o(t)||(r=get$1(t)).type!==e)throw TypeError$7("Incompatible receiver, "+e+" required");return r}};if(NATIVE_WEAK_MAP||shared$4.state){var store=shared$4.state||(shared$4.state=new WeakMap$1);store.get=store.get,store.has=store.has,store.set=store.set,set$2=function(e,t){if(store.has(e))throw TypeError$7(OBJECT_ALREADY_INITIALIZED);return t.facade=e,store.set(e,t),t},get$1=function(e){return store.get(e)||{}},has=function(e){return store.has(e)}}else{var STATE=sharedKey$3("state");hiddenKeys$5[STATE]=!0,set$2=function(e,t){if(hasOwn$k(e,STATE))throw TypeError$7(OBJECT_ALREADY_INITIALIZED);return t.facade=e,createNonEnumerableProperty$9(e,STATE,t),t},get$1=function(e){return hasOwn$k(e,STATE)?e[STATE]:{}},has=function(e){return hasOwn$k(e,STATE)}}var internalState={set:set$2,get:get$1,has:has,enforce:enforce,getterFor:getterFor},fails$O=fails$V,isCallable$n=isCallable$v,hasOwn$j=hasOwnProperty_1,DESCRIPTORS$l=descriptors,CONFIGURABLE_FUNCTION_NAME$2=functionName.CONFIGURABLE,inspectSource$2=inspectSource$3,InternalStateModule$a=internalState,enforceInternalState$3=InternalStateModule$a.enforce,getInternalState$8=InternalStateModule$a.get,defineProperty$f=Object.defineProperty,CONFIGURABLE_LENGTH=DESCRIPTORS$l&&!fails$O((function(){return 8!==defineProperty$f((function(){}),"length",{value:8}).length})),TEMPLATE=String(String).split("String"),makeBuiltIn$2=makeBuiltIn$3.exports=function(e,t,r){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!hasOwn$j(e,"name")||CONFIGURABLE_FUNCTION_NAME$2&&e.name!==t)&&(DESCRIPTORS$l?defineProperty$f(e,"name",{value:t,configurable:!0}):e.name=t),CONFIGURABLE_LENGTH&&r&&hasOwn$j(r,"arity")&&e.length!==r.arity&&defineProperty$f(e,"length",{value:r.arity});try{r&&hasOwn$j(r,"constructor")&&r.constructor?DESCRIPTORS$l&&defineProperty$f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=enforceInternalState$3(e);return hasOwn$j(n,"source")||(n.source=TEMPLATE.join("string"==typeof t?t:"")),e};Function.prototype.toString=makeBuiltIn$2((function(){return isCallable$n(this)&&getInternalState$8(this).source||inspectSource$2(this)}),"toString");var makeBuiltInExports=makeBuiltIn$3.exports,isCallable$m=isCallable$v,definePropertyModule$6=objectDefineProperty,makeBuiltIn$1=makeBuiltInExports,defineGlobalProperty$1=defineGlobalProperty$3,defineBuiltIn$j=function(e,t,r,n){n||(n={});var i=n.enumerable,a=void 0!==n.name?n.name:t;if(isCallable$m(r)&&makeBuiltIn$1(r,a,n),n.global)i?e[t]=r:defineGlobalProperty$1(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(e){}i?e[t]=r:definePropertyModule$6.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},objectGetOwnPropertyNames={},ceil$1=Math.ceil,floor$9=Math.floor,mathTrunc=Math.trunc||function(e){var t=+e;return(t>0?floor$9:ceil$1)(t)},trunc$1=mathTrunc,toIntegerOrInfinity$c=function(e){var t=+e;return t!=t||0===t?0:trunc$1(t)},toIntegerOrInfinity$b=toIntegerOrInfinity$c,max$4=Math.max,min$7=Math.min,toAbsoluteIndex$8=function(e,t){var r=toIntegerOrInfinity$b(e);return r<0?max$4(r+t,0):min$7(r,t)},toIntegerOrInfinity$a=toIntegerOrInfinity$c,min$6=Math.min,toLength$b=function(e){return e>0?min$6(toIntegerOrInfinity$a(e),9007199254740991):0},toLength$a=toLength$b,lengthOfArrayLike$i=function(e){return toLength$a(e.length)},toIndexedObject$b=toIndexedObject$d,toAbsoluteIndex$7=toAbsoluteIndex$8,lengthOfArrayLike$h=lengthOfArrayLike$i,createMethod$7=function(e){return function(t,r,n){var i,a=toIndexedObject$b(t),o=lengthOfArrayLike$h(a),s=toAbsoluteIndex$7(n,o);if(e&&r!=r){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===r)return e||s||0;return!e&&-1}},arrayIncludes={includes:createMethod$7(!0),indexOf:createMethod$7(!1)},uncurryThis$N=functionUncurryThis,hasOwn$i=hasOwnProperty_1,toIndexedObject$a=toIndexedObject$d,indexOf$1=arrayIncludes.indexOf,hiddenKeys$4=hiddenKeys$6,push$a=uncurryThis$N([].push),objectKeysInternal=function(e,t){var r,n=toIndexedObject$a(e),i=0,a=[];for(r in n)!hasOwn$i(hiddenKeys$4,r)&&hasOwn$i(n,r)&&push$a(a,r);for(;t.length>i;)hasOwn$i(n,r=t[i++])&&(~indexOf$1(a,r)||push$a(a,r));return a},enumBugKeys$3=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],internalObjectKeys$1=objectKeysInternal,enumBugKeys$2=enumBugKeys$3,hiddenKeys$3=enumBugKeys$2.concat("length","prototype");objectGetOwnPropertyNames.f=Object.getOwnPropertyNames||function(e){return internalObjectKeys$1(e,hiddenKeys$3)};var objectGetOwnPropertySymbols={};objectGetOwnPropertySymbols.f=Object.getOwnPropertySymbols;var getBuiltIn$a=getBuiltIn$d,uncurryThis$M=functionUncurryThis,getOwnPropertyNamesModule$2=objectGetOwnPropertyNames,getOwnPropertySymbolsModule$3=objectGetOwnPropertySymbols,anObject$k=anObject$m,concat$4=uncurryThis$M([].concat),ownKeys$a=getBuiltIn$a("Reflect","ownKeys")||function(e){var t=getOwnPropertyNamesModule$2.f(anObject$k(e)),r=getOwnPropertySymbolsModule$3.f;return r?concat$4(t,r(e)):t},hasOwn$h=hasOwnProperty_1,ownKeys$9=ownKeys$a,getOwnPropertyDescriptorModule$2=objectGetOwnPropertyDescriptor,definePropertyModule$5=objectDefineProperty,copyConstructorProperties$2=function(e,t,r){for(var n=ownKeys$9(t),i=definePropertyModule$5.f,a=getOwnPropertyDescriptorModule$2.f,o=0;o<n.length;o++){var s=n[o];hasOwn$h(e,s)||r&&hasOwn$h(r,s)||i(e,s,a(t,s))}},fails$N=fails$V,isCallable$l=isCallable$v,replacement=/#|\.prototype\./,isForced$5=function(e,t){var r=data[normalize(e)];return r==POLYFILL||r!=NATIVE&&(isCallable$l(t)?fails$N(t):!!t)},normalize=isForced$5.normalize=function(e){return String(e).replace(replacement,".").toLowerCase()},data=isForced$5.data={},NATIVE=isForced$5.NATIVE="N",POLYFILL=isForced$5.POLYFILL="P",isForced_1=isForced$5,global$D=global$M,getOwnPropertyDescriptor$5=objectGetOwnPropertyDescriptor.f,createNonEnumerableProperty$8=createNonEnumerableProperty$a,defineBuiltIn$i=defineBuiltIn$j,defineGlobalProperty=defineGlobalProperty$3,copyConstructorProperties$1=copyConstructorProperties$2,isForced$4=isForced_1,_export=function(e,t){var r,n,i,a,o,s=e.target,u=e.global,c=e.stat;if(r=u?global$D:c?global$D[s]||defineGlobalProperty(s,{}):(global$D[s]||{}).prototype)for(n in t){if(a=t[n],i=e.dontCallGetSet?(o=getOwnPropertyDescriptor$5(r,n))&&o.value:r[n],!isForced$4(u?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof a==typeof i)continue;copyConstructorProperties$1(a,i)}(e.sham||i&&i.sham)&&createNonEnumerableProperty$8(a,"sham",!0),defineBuiltIn$i(r,n,a,e)}},classof$g=classofRaw$2,isArray$6=Array.isArray||function(e){return"Array"==classof$g(e)},$TypeError$e=TypeError,MAX_SAFE_INTEGER=9007199254740991,doesNotExceedSafeInteger$2=function(e){if(e>MAX_SAFE_INTEGER)throw $TypeError$e("Maximum allowed index exceeded");return e},toPropertyKey$2=toPropertyKey$5,definePropertyModule$4=objectDefineProperty,createPropertyDescriptor$4=createPropertyDescriptor$7,createProperty$5=function(e,t,r){var n=toPropertyKey$2(t);n in e?definePropertyModule$4.f(e,n,createPropertyDescriptor$4(0,r)):e[n]=r},wellKnownSymbol$s=wellKnownSymbol$u,TO_STRING_TAG$4=wellKnownSymbol$s("toStringTag"),test$1={};test$1[TO_STRING_TAG$4]="z";var toStringTagSupport="[object z]"===String(test$1),TO_STRING_TAG_SUPPORT$2=toStringTagSupport,isCallable$k=isCallable$v,classofRaw$1=classofRaw$2,wellKnownSymbol$r=wellKnownSymbol$u,TO_STRING_TAG$3=wellKnownSymbol$r("toStringTag"),$Object$1=Object,CORRECT_ARGUMENTS="Arguments"==classofRaw$1(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(e){}},classof$f=TO_STRING_TAG_SUPPORT$2?classofRaw$1:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=tryGet(t=$Object$1(e),TO_STRING_TAG$3))?r:CORRECT_ARGUMENTS?classofRaw$1(t):"Object"==(n=classofRaw$1(t))&&isCallable$k(t.callee)?"Arguments":n},uncurryThis$L=functionUncurryThis,fails$M=fails$V,isCallable$j=isCallable$v,classof$e=classof$f,getBuiltIn$9=getBuiltIn$d,inspectSource$1=inspectSource$3,noop$1=function(){},empty=[],construct$1=getBuiltIn$9("Reflect","construct"),constructorRegExp=/^\s*(?:class|function)\b/,exec$7=uncurryThis$L(constructorRegExp.exec),INCORRECT_TO_STRING=!constructorRegExp.exec(noop$1),isConstructorModern=function(e){if(!isCallable$j(e))return!1;try{return construct$1(noop$1,empty,e),!0}catch(e){return!1}},isConstructorLegacy=function(e){if(!isCallable$j(e))return!1;switch(classof$e(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return INCORRECT_TO_STRING||!!exec$7(constructorRegExp,inspectSource$1(e))}catch(e){return!0}};isConstructorLegacy.sham=!0;var isConstructor$4=!construct$1||fails$M((function(){var e;return isConstructorModern(isConstructorModern.call)||!isConstructorModern(Object)||!isConstructorModern((function(){e=!0}))||e}))?isConstructorLegacy:isConstructorModern,isArray$5=isArray$6,isConstructor$3=isConstructor$4,isObject$n=isObject$t,wellKnownSymbol$q=wellKnownSymbol$u,SPECIES$6=wellKnownSymbol$q("species"),$Array$4=Array,arraySpeciesConstructor$1=function(e){var t;return isArray$5(e)&&(t=e.constructor,(isConstructor$3(t)&&(t===$Array$4||isArray$5(t.prototype))||isObject$n(t)&&null===(t=t[SPECIES$6]))&&(t=void 0)),void 0===t?$Array$4:t},arraySpeciesConstructor=arraySpeciesConstructor$1,arraySpeciesCreate$3=function(e,t){return new(arraySpeciesConstructor(e))(0===t?0:t)},fails$L=fails$V,wellKnownSymbol$p=wellKnownSymbol$u,V8_VERSION$2=engineV8Version,SPECIES$5=wellKnownSymbol$p("species"),arrayMethodHasSpeciesSupport$5=function(e){return V8_VERSION$2>=51||!fails$L((function(){var t=[];return(t.constructor={})[SPECIES$5]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},$$14=_export,fails$K=fails$V,isArray$4=isArray$6,isObject$m=isObject$t,toObject$f=toObject$h,lengthOfArrayLike$g=lengthOfArrayLike$i,doesNotExceedSafeInteger$1=doesNotExceedSafeInteger$2,createProperty$4=createProperty$5,arraySpeciesCreate$2=arraySpeciesCreate$3,arrayMethodHasSpeciesSupport$4=arrayMethodHasSpeciesSupport$5,wellKnownSymbol$o=wellKnownSymbol$u,V8_VERSION$1=engineV8Version,IS_CONCAT_SPREADABLE=wellKnownSymbol$o("isConcatSpreadable"),IS_CONCAT_SPREADABLE_SUPPORT=V8_VERSION$1>=51||!fails$K((function(){var e=[];return e[IS_CONCAT_SPREADABLE]=!1,e.concat()[0]!==e})),SPECIES_SUPPORT=arrayMethodHasSpeciesSupport$4("concat"),isConcatSpreadable=function(e){if(!isObject$m(e))return!1;var t=e[IS_CONCAT_SPREADABLE];return void 0!==t?!!t:isArray$4(e)},FORCED$c=!IS_CONCAT_SPREADABLE_SUPPORT||!SPECIES_SUPPORT;function ownKeys$8(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$8(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$8(Object(r),!0).forEach((function(t){_defineProperty$e(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$8(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _typeof$7(e){return(_typeof$7="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck$g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$4(n.key),n)}}function _createClass$g(e,t,r){return t&&_defineProperties$g(e.prototype,t),r&&_defineProperties$g(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$e(e,t,r){return(t=_toPropertyKey$4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toConsumableArray$9(e){return _arrayWithoutHoles$9(e)||_iterableToArray$9(e)||_unsupportedIterableToArray$c(e)||_nonIterableSpread$9()}function _arrayWithoutHoles$9(e){if(Array.isArray(e))return _arrayLikeToArray$c(e)}function _iterableToArray$9(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray$c(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$c(e,t):void 0}}function _arrayLikeToArray$c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread$9(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toPrimitive$4(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey$4(e){var t=_toPrimitive$4(e,"string");return"symbol"==typeof t?t:String(t)}$$14({target:"Array",proto:!0,arity:1,forced:FORCED$c},{concat:function(e){var t,r,n,i,a,o=toObject$f(this),s=arraySpeciesCreate$2(o,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(isConcatSpreadable(a=-1===t?o:arguments[t]))for(i=lengthOfArrayLike$g(a),doesNotExceedSafeInteger$1(u+i),r=0;r<i;r++,u++)r in a&&createProperty$4(s,u,a[r]);else doesNotExceedSafeInteger$1(u+1),createProperty$4(s,u++,a);return s.length=u,s}});var eventemitter3={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,n,a,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,a||e,o),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=new Array(a);i<a;i++)o[i]=n[i].fn;return o},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,a),!0;case 6:return l.fn.call(l.context,t,n,i,a,o),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(d-1);h<d;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||o(this,a);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[a]=1===c.length?c[0]:c:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(eventemitter3);var eventemitter3Exports=eventemitter3.exports,EventEmitter$1=getDefaultExportFromCjs(eventemitter3Exports),XG_DEBUG_OPEN="undefined"!=typeof window&&window.location&&window.location.href.indexOf("xgplayerdebugger=1")>-1,STYLE={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},XGTAG="%c[xgplayer]",XG_DEBUG={config:{debug:XG_DEBUG_OPEN?3:0},logInfo:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this.config.debug>=3&&(t=console).log.apply(t,[XGTAG,STYLE.info,e].concat(n))},logWarn:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this.config.debug>=1&&(t=console).warn.apply(t,[XGTAG,STYLE.warn,e].concat(n))},logError:function(e){var t;if(!(this.config.debug<1)){for(var r=this.config.debug>=2?"trace":"error",n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];(t=console)[r].apply(t,[XGTAG,STYLE.error,e].concat(i))}}},XgplayerTimeRange=function(){function e(t){_classCallCheck$g(this,e),this.bufferedList=t}return _createClass$g(e,[{key:"start",value:function(e){return this.bufferedList[e].start}},{key:"end",value:function(e){return this.bufferedList[e].end}},{key:"length",get:function(){return this.bufferedList.length}}]),e}(),util$2={};function checkIsIn(e,t){for(var r=0,n=t.length;r<n;r++)if(e.indexOf(t[r])>-1)return!0;return!1}util$2.createDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(e);return i.className=n,i.innerHTML=t,Object.keys(r).forEach((function(t){var n=t,a=r[t];"video"===e||"audio"===e||"live-video"===e?a&&i.setAttribute(n,a):i.setAttribute(n,a)})),i},util$2.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var n=document.createElement("div");n.innerHTML=e;var i=n.children;return n=null,i.length>0?(i=i[0],r&&util$2.addClass(i,r),t&&Object.keys(t).forEach((function(e){i.setAttribute(e,t[e])})),i):null}catch(e){return XG_DEBUG.logError("util.createDomFromHtml",e),null}},util$2.hasClass=function(e,t){if(!e||!t)return!1;try{return Array.prototype.some.call(e.classList,(function(e){return e===t}))}catch(n){var r=e.className&&"object"===_typeof$7(e.className)?e.getAttribute("class"):e.className;return r&&!!r.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},util$2.addClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.add(t)}))}catch(r){util$2.hasClass(e,t)||(e.className&&"object"===_typeof$7(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},util$2.removeClass=function(e,t){if(e&&t)try{t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach((function(t){t&&e.classList.remove(t)}))}catch(r){util$2.hasClass(e,t)&&t.split(/\s+/g).forEach((function(t){var r=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===_typeof$7(e.className)?e.setAttribute("class",e.getAttribute("class").replace(r," ")):e.className=e.className.replace(r," ")}))}},util$2.toggleClass=function(e,t){e&&t.split(/\s+/g).forEach((function(t){util$2.hasClass(e,t)?util$2.removeClass(e,t):util$2.addClass(e,t)}))},util$2.classNames=function(){for(var e=arguments,t=[],r=function(r){"String"===util$2.typeOf(e[r])?t.push(e[r]):"Object"===util$2.typeOf(e[r])&&Object.keys(e[r]).map((function(n){e[r][n]&&t.push(n)}))},n=0;n<arguments.length;n++)r(n);return t.join(" ")},util$2.findDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,r=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(r)}catch(n){XG_DEBUG.logError("util.findDom",n),0===r.indexOf("#")&&(e=t.getElementById(r.slice(1)))}return e},util$2.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},util$2.padStart=function(e,t,r){for(var n=String(r),i=t>>0,a=Math.ceil(i/n.length),o=[],s=String(e);a--;)o.push(n);return o.join("").substring(0,i-s.length)+s},util$2.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=util$2.padStart(Math.floor(e/3600),2,0),r=util$2.padStart(Math.floor((e-3600*t)/60),2,0),n=util$2.padStart(Math.floor(e-3600*t-60*r),2,0);return("00"===t?[r,n]:[t,r,n]).join(":")},util$2.event=function(e){if(e.touches){var t=e.touches[0]||e.changedTouches[0];e.clientX=t.clientX||0,e.clientY=t.clientY||0,e.offsetX=t.pageX-t.target.offsetLeft,e.offsetY=t.pageY-t.target.offsetTop}e._target=e.target||e.srcElement},util$2.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},util$2.deepCopy=function(e,t){if("Object"===util$2.typeOf(t)&&"Object"===util$2.typeOf(e))return Object.keys(t).forEach((function(r){"Object"!==util$2.typeOf(t[r])||t[r]instanceof Node?"Array"===util$2.typeOf(t[r])?e[r]="Array"===util$2.typeOf(e[r])?e[r].concat(t[r]):t[r]:e[r]=t[r]:void 0===e[r]||void 0===e[r]?e[r]=t[r]:util$2.deepCopy(e[r],t[r])})),e},util$2.deepMerge=function(e,t){return Object.keys(t).map((function(r){var n;"Array"===util$2.typeOf(t[r])&&"Array"===util$2.typeOf(e[r])?"Array"===util$2.typeOf(e[r])&&(n=e[r]).push.apply(n,_toConsumableArray$9(t[r])):util$2.typeOf(e[r])!==util$2.typeOf(t[r])||null===e[r]||"Object"!==util$2.typeOf(e[r])||t[r]instanceof window.Node?null!==t[r]&&(e[r]=t[r]):util$2.deepMerge(e[r],t[r])})),e},util$2.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var r=document.createElement("a");return r.href=t.replace(/url\("|"\)/g,""),r.href},util$2.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},util$2.setInterval=function(e,t,r,n){e._interval[t]||(e._interval[t]=window.setInterval(r.bind(e),n))},util$2.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},util$2.setTimeout=function(e,t,r){e._timers||(e._timers=[]);var n=setTimeout((function(){t(),util$2.clearTimeout(e,n)}),r);return e._timers.push(n),n},util$2.clearTimeout=function(e,t){var r=e._timers;if("Array"===util$2.typeOf(r)){for(var n=0;n<r.length;n++)if(r[n]===t){r.splice(n,1),clearTimeout(t);break}}else clearTimeout(t)},util$2.clearAllTimers=function(e){var t=e._timers;"Array"===util$2.typeOf(t)&&(t.map((function(e){clearTimeout(e)})),e._timerIds=[])},util$2.createImgBtn=function(e,t,r,n){var i,a,o,s=util$2.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));(s.style.backgroundImage='url("'.concat(t,'")'),r&&n)&&(["px","rem","em","pt","dp","vw","vh","vm","%"].every((function(e){return!(r.indexOf(e)>-1&&n.indexOf(e)>-1)||(i=parseFloat(r.slice(0,r.indexOf(e)).trim()),a=parseFloat(n.slice(0,n.indexOf(e)).trim()),o=e,!1)})),s.style.width="".concat(i).concat(o),s.style.height="".concat(a).concat(o),s.style.backgroundSize="".concat(i).concat(o," ").concat(a).concat(o),s.style.margin="start"===e?"-".concat(a/2).concat(o," auto auto -").concat(i/2).concat(o):"auto 5px auto 5px");return s},util$2.Hex2RGBA=function(e,t){var r=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var n="#";e.replace(/[0-9A-F]/gi,(function(e){n+=e+e})),e=n}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){r.push(parseInt(e,16))})),"rgba(".concat(r.join(","),", ").concat(t,")")):"rgba(255, 255, 255, 0.1)"},util$2.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},util$2.checkIsFunction=function(e){return e&&"function"==typeof e},util$2.checkIsObject=function(e){return null!==e&&"object"===_typeof$7(e)},util$2.hide=function(e){e.style.display="none"},util$2.show=function(e,t){e.style.display=t||"block"},util$2.isUndefined=function(e){if(null==e)return!0},util$2.isNotNull=function(e){return!(null==e)},util$2.setStyleFromCsstext=function(e,t){t&&("String"===util$2.typeOf(t)?t.replace(/\s+/g,"").split(";").map((function(t){if(t){var r=t.split(":");r.length>1&&(e.style[r[0]]=r[1])}})):Object.keys(t).map((function(r){e.style[r]=t[r]})))},util$2.filterStyleFromText=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],r=e.style.cssText;if(!r)return{};var n=r.replace(/\s+/g,"").split(";"),i={},a={};return n.map((function(e){if(e){var r=e.split(":");r.length>1&&(checkIsIn(r[0],t)?i[r[0]]=r[1]:a[r[0]]=r[1])}})),e.setAttribute("style",""),Object.keys(a).map((function(t){e.style[t]=a[t]})),i},util$2.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var r=t.replace(/\s+/g,"").split(";"),n={};return r.map((function(e){if(e){var t=e.split(":");t.length>1&&(n[t[0]]=t[1])}})),n},util$2.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){var n=new window.Image;n.onload=function(e){n=null,t&&t(e)},n.onerror=function(e){n=null,r&&r(e)},n.src=e}},util$2.stopPropagation=function(e){e&&e.stopPropagation()},util$2.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},util$2.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},util$2.checkTouchSupport=function(){return"ontouchstart"in window},util$2.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,r=[],n=0;n<e.length;n++)r.push({start:e.start(n)<.5?0:e.start(n),end:e.end(n)});r.sort((function(e,t){var r=e.start-t.start;return r||t.end-e.end}));var i=[];if(t)for(var a=0;a<r.length;a++){var o=i.length;if(o){var s=i[o-1].end;r[a].start-s<t?r[a].end>s&&(i[o-1].end=r[a].end):i.push(r[a])}else i.push(r[a])}else i=r;return new XgplayerTimeRange(i)},util$2.getEventPos=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e.touches&&e.touches.length>0&&(e=e.touches[0]),{x:e.x/t,y:e.y/t,clientX:e.clientX/t,clientY:e.clientY/t,offsetX:e.offsetX/t,offsetY:e.offsetY/t,pageX:e.pageX/t,pageY:e.pageY/t}},util$2.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},util$2.getHostFromUrl=function(e){if("String"!==util$2.typeOf(e))return"";var t=e.split("/"),r="";return t.length>3&&t[2]&&(r=t[2]),r},util$2.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},util$2.isMSE=function(e){return!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},util$2.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=parseInt(e)}catch(t){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=parseInt(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)}))},util$2.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},util$2.adjustTimeByDuration=function(e,t,r){return t&&e&&(e>t||r&&e<t)?t:e},util$2.createPositionBar=function(e,t){var r=util$2.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(r),r},util$2.getTransformStyle=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0};return"scale(".concat(e.scale||1,") translate(").concat(e.x||0,"%, ").concat(e.y||0,"%) rotate(").concat(e.rotate||0,"deg)")},util$2.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360};var VERSION_REG={android:/(Android)\s([\d.]+)/,ios:/(Version)\/([\d.]+)/},H264_MIMETYPES=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],sniffer={get device(){return sniffer.os.isPc?"pc":"mobile"},get browser(){if("undefined"==typeof navigator)return"";var e=navigator.userAgent.toLowerCase(),t={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return[].concat(Object.keys(t).filter((function(r){return t[r].test(e)})))[0]},get os(){if("undefined"==typeof navigator)return{};var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),r=/(?:SymbianOS)/.test(e)||t,n=/(?:Android)/.test(e),i=/(?:Firefox)/.test(e),a=/(?:iPad|PlayBook)/.test(e)||n&&!/(?:Mobile)/.test(e)||i&&/(?:Tablet)/.test(e),o=/(?:iPhone)/.test(e)&&!a,s=!(o||n||r||a),u=/(?:iPad|PlayBook)/.test(e);return{isTablet:a,isPhone:o,isIpad:u,isIos:o||u,isAndroid:n,isPc:s,isSymbian:r,isWindowsPhone:t,isFireFox:i}},get osVersion(){if("undefined"==typeof navigator)return 0;var e=navigator.userAgent,t="",r=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?VERSION_REG.ios:VERSION_REG.android)?t.exec(e):[];if(r&&r.length>=3){var n=r[2].split(".");return n.length>0?parseInt(n[0]):0}return 0},get isWeixin(){if("undefined"==typeof navigator)return!1;return!!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase())},isSupportMP4:function(){var e={isSupport:!1,mime:""};if("undefined"==typeof document)return e;if(this.supportResult)return this.supportResult;var t=document.createElement("video");return"function"==typeof t.canPlayType&&H264_MIMETYPES.map((function(r){"probably"===t.canPlayType('video/mp4; codecs="'.concat(r,'"'))&&(e.isSupport=!0,e.mime+="||".concat(r))})),this.supportResult=e,t=null,e},isMSESupport:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if("undefined"==typeof MediaSource||!MediaSource)return!1;try{return MediaSource.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}},isHevcSupported:function(){return!("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return Promise.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var r=e.video||{},n=e.audio||{};try{var i=MediaSource.isTypeSupported(r.contentType),a=MediaSource.isTypeSupported(n.contentType);return Promise.resolve({supported:i&&a,smooth:!1,powerEfficient:!1})}catch(e){return Promise.resolve(t)}}},version$1="3.0.7",ERROR_MAP={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},Errors=_createClass$g((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};_classCallCheck$g(this,e);var n=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var i=r.mediaError?r.mediaError:t.media.error||{},a=t.duration,o=t.currentTime,s=t.ended,u=t.src,c=t.currentSrc,l=t.media,d=l.readyState,h=l.networkState,f=r.errorCode||i.code;ERROR_MAP[f]&&(f=ERROR_MAP[f]);var p={playerVersion:version$1,currentTime:o,duration:a,ended:s,readyState:d,networkState:h,src:u||c,errorType:r.errorType,errorCode:f,message:r.errorMessage||i.message,mediaError:i,originError:r.originError?r.originError.stack:"",host:util$2.getHostFromUrl(u||c)};return r.ext&&Object.keys(r.ext).map((function(e){p[e]=r.ext[e]})),p}if(arguments.length>1){for(var m={playerVersion:version$1,domain:document.domain},y=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],g=0;g<arguments.length;g++)m[y[g]]=arguments[g];return m.ex=n?(n[arguments[0]]||{}).msg:"",m}})),ERROR="error",TIME_UPDATE="timeupdate",WAITING="waiting",LOADED_DATA="loadeddata",LOAD_START="loadstart",DESTROY="destroy",URL_CHANGE="urlchange",DEFINITION_CHANGE="definition_change",AFTER_DEFINITION_CHANGE="after_definition_change",SWITCH_SUBTITLE="switch_subtitle";function callHandler(e,t,r){for(var n=arguments.length,i=new Array(n>3?n-3:0),a=3;a<n;a++)i[a-3]=arguments[a];var o=t.call.apply(t,[e].concat(i));r&&"function"==typeof r&&(o&&o.then?o.then((function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];r.call.apply(r,[e].concat(n))})):r.call.apply(r,[e].concat(i)))}function hook(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{pre:null,next:null};return this.__hooks||(this.__hooks={}),!this.__hooks[e]&&(this.__hooks[e]=null),function(){var n=arguments,i=this;if(r.pre)try{var a;(a=r.pre).call.apply(a,[this].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,":pre error] >> ").concat(t.message),t}if(this.__hooks&&this.__hooks[e])try{var o,s=(o=this.__hooks[e]).call.apply(o,[this,this].concat(Array.prototype.slice.call(arguments)));s?s.then?s.then((function(e){!1!==e&&callHandler.apply(void 0,[i,t,r.next].concat(_toConsumableArray$9(n)))})).catch((function(e){throw e})):callHandler.apply(void 0,[this,t,r.next].concat(Array.prototype.slice.call(arguments))):void 0===s&&callHandler.apply(void 0,[this,t,r.next].concat(Array.prototype.slice.call(arguments)))}catch(t){throw t.message="[pluginName: ".concat(this.pluginName,":").concat(e,"] >> ").concat(t.message),t}else callHandler.apply(void 0,[this,t,r.next].concat(Array.prototype.slice.call(arguments)))}.bind(this)}function useHooks(e,t){var r=this.__hooks;if(r)return r.hasOwnProperty(e)?(r&&(r[e]=t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function removeHooks(e,t){var r=this.__hooks;r&&delete r[e]}function hooksDescriptor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&t.map((function(t){e.__hooks[t]=null})),Object.defineProperty(e,"hooks",{get:function(){return e.__hooks&&Object.keys(e.__hooks).map((function(t){if(e.__hooks[t])return t}))}})}function delHooksDescriptor(e){e.__hooks=null}function showErrorMsg(e,t){XG_DEBUG.logError("[".concat(e,"] event or callback cant be undefined or null when call ").concat(t))}var BasePlugin=function(){function e(t){_classCallCheck$g(this,e),util$2.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),hooksDescriptor(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}return _createClass$g(e,[{key:"beforeCreate",value:function(e){}},{key:"afterCreate",value:function(){}},{key:"beforePlayerInit",value:function(){}},{key:"onPluginsReady",value:function(){}},{key:"afterPlayerInit",value:function(){}},{key:"destroy",value:function(){}},{key:"__init",value:function(e){this.player=e.player,this.playerConfig=e.player&&e.player.config,this.pluginName=e.pluginName?e.pluginName.toLowerCase():this.constructor.pluginName.toLowerCase(),this.logger=e.player&&e.player.logger}},{key:"updateLang",value:function(e){e||(e=this.lang)}},{key:"lang",get:function(){return this.player.lang}},{key:"i18n",get:function(){return this.player.i18n}},{key:"i18nKeys",get:function(){return this.player.i18nKeys}},{key:"domEventType",get:function(){var e=util$2.checkTouchSupport()?"touch":"mouse";return!this.playerConfig||"touch"!==this.playerConfig.domEventType&&"mouse"!==this.playerConfig.domEventType||(e=this.playerConfig.domEventType),e}},{key:"on",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):Array.isArray(e)&&e.forEach((function(e){r.__events[e]=t,r.player.on(e,t)})):showErrorMsg(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):Array.isArray(e)&&e.forEach((function(n){r.__onceEvents[n]=t,r.player.once(e,t)})):showErrorMsg(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var r=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):Array.isArray(e)&&e.forEach((function(n){delete r.__events[e],r.player.off(n,t)})):showErrorMsg(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e=this;["__events","__onceEvents"].forEach((function(t){Object.keys(e[t]).forEach((function(r){e[t][r]&&e.off(r,e[t][r]),r&&delete e[t][r]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];(t=this.player).emit.apply(t,[e].concat(n))}}},{key:"emitUserAction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var n=_objectSpread2$8(_objectSpread2$8({},r),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,n)}}},{key:"hook",value:function(e,t){return hook.call.apply(hook,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"useHooks",value:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return useHooks.call.apply(useHooks,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return removeHooks.call.apply(removeHooks,[this].concat(Array.prototype.slice.call(arguments)))}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return r&&(t.pluginName=r),this.player.registerPlugin({plugin:e,options:t})}},{key:"getPlugin",value:function(e){return this.player?this.player.getPlugin(e):null}},{key:"__destroy",value:function(){var e=this,t=this.player,r=this.pluginName;this.offAll(),util$2.clearAllTimers(this),util$2.checkIsFunction(this.destroy)&&this.destroy(),["player","playerConfig","pluginName","logger","__args","__hooks"].map((function(t){e[t]=null})),t.unRegisterPlugin(r),delHooksDescriptor(this)}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&Object.defineProperty(e,r,t[r])}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}();function ownKeys$7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$7(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$7(Object(r),!0).forEach((function(t){_defineProperty$d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$7(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$8(){_regeneratorRuntime$8=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function _typeof$6(e){return(_typeof$6="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function asyncGeneratorStep$8(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator$8(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep$8(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep$8(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck$f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$3(n.key),n)}}function _createClass$f(e,t,r){return t&&_defineProperties$f(e.prototype,t),r&&_defineProperties$f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$d(e,t,r){return(t=_toPropertyKey$3(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$c(e,t)}function _getPrototypeOf$c(e){return(_getPrototypeOf$c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$c(e,t){return(_setPrototypeOf$c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _construct$3(e,t,r){return(_construct$3=_isNativeReflectConstruct$c()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&_setPrototypeOf$c(i,r.prototype),i}).apply(null,arguments)}function _isNativeFunction$3(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _wrapNativeSuper$3(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper$3=function(e){if(null===e||!_isNativeFunction$3(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct$3(e,arguments,_getPrototypeOf$c(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf$c(r,e)},_wrapNativeSuper$3(e)}function _objectWithoutPropertiesLoose$3(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}function _objectWithoutProperties$3(e,t){if(null==e)return{};var r,n,i=_objectWithoutPropertiesLoose$3(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _assertThisInitialized$c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$c(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$c(e)}function _createSuper$c(e){var t=_isNativeReflectConstruct$c();return function(){var r,n=_getPrototypeOf$c(e);if(t){var i=_getPrototypeOf$c(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$c(this,r)}}function _superPropBase$3(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf$c(e)););return e}function _get$3(){return _get$3="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=_superPropBase$3(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},_get$3.apply(this,arguments)}function _unsupportedIterableToArray$b(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$b(e,t):void 0}}function _arrayLikeToArray$b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _createForOfIteratorHelper$2(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray$b(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function _toPrimitive$3(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey$3(e){var t=_toPrimitive$3(e,"string");return"symbol"==typeof t?t:String(t)}var internalObjectKeys=objectKeysInternal,enumBugKeys$1=enumBugKeys$3,objectKeys$4=Object.keys||function(e){return internalObjectKeys(e,enumBugKeys$1)},DESCRIPTORS$k=descriptors,uncurryThis$K=functionUncurryThis,call$p=functionCall,fails$J=fails$V,objectKeys$3=objectKeys$4,getOwnPropertySymbolsModule$2=objectGetOwnPropertySymbols,propertyIsEnumerableModule$1=objectPropertyIsEnumerable,toObject$e=toObject$h,IndexedObject$4=indexedObject,$assign=Object.assign,defineProperty$e=Object.defineProperty,concat$3=uncurryThis$K([].concat),objectAssign=!$assign||fails$J((function(){if(DESCRIPTORS$k&&1!==$assign({b:1},$assign(defineProperty$e({},"a",{enumerable:!0,get:function(){defineProperty$e(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=$assign({},e)[r]||objectKeys$3($assign({},t)).join("")!=n}))?function(e,t){for(var r=toObject$e(e),n=arguments.length,i=1,a=getOwnPropertySymbolsModule$2.f,o=propertyIsEnumerableModule$1.f;n>i;)for(var s,u=IndexedObject$4(arguments[i++]),c=a?concat$3(objectKeys$3(u),a(u)):objectKeys$3(u),l=c.length,d=0;l>d;)s=c[d++],DESCRIPTORS$k&&!call$p(o,u,s)||(r[s]=u[s]);return r}:$assign,$$13=_export,assign$3=objectAssign;$$13({target:"Object",stat:!0,arity:2,forced:Object.assign!==assign$3},{assign:assign$3});var TO_STRING_TAG_SUPPORT$1=toStringTagSupport,classof$d=classof$f,objectToString=TO_STRING_TAG_SUPPORT$1?{}.toString:function(){return"[object "+classof$d(this)+"]"},TO_STRING_TAG_SUPPORT=toStringTagSupport,defineBuiltIn$h=defineBuiltIn$j,toString$m=objectToString;TO_STRING_TAG_SUPPORT||defineBuiltIn$h(Object.prototype,"toString",toString$m,{unsafe:!0});var $location,defer,channel,port,classof$c=classofRaw$2,global$C=global$M,engineIsNode="process"==classof$c(global$C.process),isCallable$i=isCallable$v,$String$2=String,$TypeError$d=TypeError,aPossiblePrototype$1=function(e){if("object"==typeof e||isCallable$i(e))return e;throw $TypeError$d("Can't set "+$String$2(e)+" as a prototype")},uncurryThis$J=functionUncurryThis,anObject$j=anObject$m,aPossiblePrototype=aPossiblePrototype$1,objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=uncurryThis$J(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return anObject$j(r),aPossiblePrototype(n),t?e(r,n):r.__proto__=n,r}}():void 0),defineProperty$d=objectDefineProperty.f,hasOwn$g=hasOwnProperty_1,wellKnownSymbol$n=wellKnownSymbol$u,TO_STRING_TAG$2=wellKnownSymbol$n("toStringTag"),setToStringTag$8=function(e,t,r){e&&!r&&(e=e.prototype),e&&!hasOwn$g(e,TO_STRING_TAG$2)&&defineProperty$d(e,TO_STRING_TAG$2,{configurable:!0,value:t})},getBuiltIn$8=getBuiltIn$d,definePropertyModule$3=objectDefineProperty,wellKnownSymbol$m=wellKnownSymbol$u,DESCRIPTORS$j=descriptors,SPECIES$4=wellKnownSymbol$m("species"),setSpecies$5=function(e){var t=getBuiltIn$8(e),r=definePropertyModule$3.f;DESCRIPTORS$j&&t&&!t[SPECIES$4]&&r(t,SPECIES$4,{configurable:!0,get:function(){return this}})},isPrototypeOf$8=objectIsPrototypeOf,$TypeError$c=TypeError,anInstance$7=function(e,t){if(isPrototypeOf$8(t,e))return e;throw $TypeError$c("Incorrect invocation")},isConstructor$2=isConstructor$4,tryToString$5=tryToString$7,$TypeError$b=TypeError,aConstructor$3=function(e){if(isConstructor$2(e))return e;throw $TypeError$b(tryToString$5(e)+" is not a constructor")},anObject$i=anObject$m,aConstructor$2=aConstructor$3,isNullOrUndefined$6=isNullOrUndefined$9,wellKnownSymbol$l=wellKnownSymbol$u,SPECIES$3=wellKnownSymbol$l("species"),speciesConstructor$5=function(e,t){var r,n=anObject$i(e).constructor;return void 0===n||isNullOrUndefined$6(r=anObject$i(n)[SPECIES$3])?t:aConstructor$2(r)},NATIVE_BIND$2=functionBindNative,FunctionPrototype$1=Function.prototype,apply$9=FunctionPrototype$1.apply,call$o=FunctionPrototype$1.call,functionApply="object"==typeof Reflect&&Reflect.apply||(NATIVE_BIND$2?call$o.bind(apply$9):function(){return call$o.apply(apply$9,arguments)}),classofRaw=classofRaw$2,uncurryThis$I=functionUncurryThis,functionUncurryThisClause=function(e){if("Function"===classofRaw(e))return uncurryThis$I(e)},uncurryThis$H=functionUncurryThisClause,aCallable$9=aCallable$b,NATIVE_BIND$1=functionBindNative,bind$d=functionUncurryThisClause(functionUncurryThisClause.bind),functionBindContext=function(e,t){return aCallable$9(e),void 0===t?e:NATIVE_BIND$1?bind$d(e,t):function(){return e.apply(t,arguments)}},getBuiltIn$7=getBuiltIn$d,html$2=getBuiltIn$7("document","documentElement"),uncurryThis$G=functionUncurryThis,arraySlice$c=uncurryThis$G([].slice),$TypeError$a=TypeError,validateArgumentsLength$4=function(e,t){if(e<t)throw $TypeError$a("Not enough arguments");return e},userAgent$6=engineUserAgent,engineIsIos=/(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$6),global$B=global$M,apply$8=functionApply,bind$c=functionBindContext,isCallable$h=isCallable$v,hasOwn$f=hasOwnProperty_1,fails$I=fails$V,html$1=html$2,arraySlice$b=arraySlice$c,createElement=documentCreateElement$2,validateArgumentsLength$3=validateArgumentsLength$4,IS_IOS$1=engineIsIos,IS_NODE$4=engineIsNode,set$1=global$B.setImmediate,clear=global$B.clearImmediate,process$3=global$B.process,Dispatch=global$B.Dispatch,Function$2=global$B.Function,MessageChannel=global$B.MessageChannel,String$1=global$B.String,counter=0,queue$1={},ONREADYSTATECHANGE="onreadystatechange";try{$location=global$B.location}catch(e){}var run=function(e){if(hasOwn$f(queue$1,e)){var t=queue$1[e];delete queue$1[e],t()}},runner=function(e){return function(){run(e)}},listener=function(e){run(e.data)},post=function(e){global$B.postMessage(String$1(e),$location.protocol+"//"+$location.host)};set$1&&clear||(set$1=function(e){validateArgumentsLength$3(arguments.length,1);var t=isCallable$h(e)?e:Function$2(e),r=arraySlice$b(arguments,1);return queue$1[++counter]=function(){apply$8(t,void 0,r)},defer(counter),counter},clear=function(e){delete queue$1[e]},IS_NODE$4?defer=function(e){process$3.nextTick(runner(e))}:Dispatch&&Dispatch.now?defer=function(e){Dispatch.now(runner(e))}:MessageChannel&&!IS_IOS$1?(port=(channel=new MessageChannel).port2,channel.port1.onmessage=listener,defer=bind$c(port.postMessage,port)):global$B.addEventListener&&isCallable$h(global$B.postMessage)&&!global$B.importScripts&&$location&&"file:"!==$location.protocol&&!fails$I(post)?(defer=post,global$B.addEventListener("message",listener,!1)):defer=ONREADYSTATECHANGE in createElement("script")?function(e){html$1.appendChild(createElement("script"))[ONREADYSTATECHANGE]=function(){html$1.removeChild(this),run(e)}}:function(e){setTimeout(runner(e),0)});var flush,head,last,notify$1,toggle,node,promise,then,task$1={set:set$1,clear:clear},userAgent$5=engineUserAgent,global$A=global$M,engineIsIosPebble=/ipad|iphone|ipod/i.test(userAgent$5)&&void 0!==global$A.Pebble,userAgent$4=engineUserAgent,engineIsWebosWebkit=/web0s(?!.*chrome)/i.test(userAgent$4),global$z=global$M,bind$b=functionBindContext,getOwnPropertyDescriptor$4=objectGetOwnPropertyDescriptor.f,macrotask=task$1.set,IS_IOS=engineIsIos,IS_IOS_PEBBLE=engineIsIosPebble,IS_WEBOS_WEBKIT=engineIsWebosWebkit,IS_NODE$3=engineIsNode,MutationObserver=global$z.MutationObserver||global$z.WebKitMutationObserver,document$2=global$z.document,process$2=global$z.process,Promise$1=global$z.Promise,queueMicrotaskDescriptor=getOwnPropertyDescriptor$4(global$z,"queueMicrotask"),queueMicrotask=queueMicrotaskDescriptor&&queueMicrotaskDescriptor.value;queueMicrotask||(flush=function(){var e,t;for(IS_NODE$3&&(e=process$2.domain)&&e.exit();head;){t=head.fn,head=head.next;try{t()}catch(e){throw head?notify$1():last=void 0,e}}last=void 0,e&&e.enter()},IS_IOS||IS_NODE$3||IS_WEBOS_WEBKIT||!MutationObserver||!document$2?!IS_IOS_PEBBLE&&Promise$1&&Promise$1.resolve?((promise=Promise$1.resolve(void 0)).constructor=Promise$1,then=bind$b(promise.then,promise),notify$1=function(){then(flush)}):IS_NODE$3?notify$1=function(){process$2.nextTick(flush)}:(macrotask=bind$b(macrotask,global$z),notify$1=function(){macrotask(flush)}):(toggle=!0,node=document$2.createTextNode(""),new MutationObserver(flush).observe(node,{characterData:!0}),notify$1=function(){node.data=toggle=!toggle}));var microtask$1=queueMicrotask||function(e){var t={fn:e,next:void 0};last&&(last.next=t),head||(head=t,notify$1()),last=t},global$y=global$M,hostReportErrors$1=function(e,t){var r=global$y.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},perform$3=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Queue$1=function(){this.head=null,this.tail=null};Queue$1.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var queue=Queue$1,global$x=global$M,promiseNativeConstructor=global$x.Promise,engineIsDeno="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,IS_DENO$1=engineIsDeno,IS_NODE$2=engineIsNode,engineIsBrowser=!IS_DENO$1&&!IS_NODE$2&&"object"==typeof window&&"object"==typeof document,global$w=global$M,NativePromiseConstructor$4=promiseNativeConstructor,isCallable$g=isCallable$v,isForced$3=isForced_1,inspectSource=inspectSource$3,wellKnownSymbol$k=wellKnownSymbol$u,IS_BROWSER=engineIsBrowser,IS_DENO=engineIsDeno,V8_VERSION=engineV8Version;NativePromiseConstructor$4&&NativePromiseConstructor$4.prototype;var SPECIES$2=wellKnownSymbol$k("species"),SUBCLASSING=!1,NATIVE_PROMISE_REJECTION_EVENT$1=isCallable$g(global$w.PromiseRejectionEvent),FORCED_PROMISE_CONSTRUCTOR$5=isForced$3("Promise",(function(){var e=inspectSource(NativePromiseConstructor$4),t=e!==String(NativePromiseConstructor$4);if(!t&&66===V8_VERSION)return!0;if(!V8_VERSION||V8_VERSION<51||!/native code/.test(e)){var r=new NativePromiseConstructor$4((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[SPECIES$2]=n,!(SUBCLASSING=r.then((function(){}))instanceof n))return!0}return!t&&(IS_BROWSER||IS_DENO)&&!NATIVE_PROMISE_REJECTION_EVENT$1})),promiseConstructorDetection={CONSTRUCTOR:FORCED_PROMISE_CONSTRUCTOR$5,REJECTION_EVENT:NATIVE_PROMISE_REJECTION_EVENT$1,SUBCLASSING:SUBCLASSING},newPromiseCapability$2={},aCallable$8=aCallable$b,$TypeError$9=TypeError,PromiseCapability=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw $TypeError$9("Bad Promise constructor");t=e,r=n})),this.resolve=aCallable$8(t),this.reject=aCallable$8(r)};newPromiseCapability$2.f=function(e){return new PromiseCapability(e)};var Internal,OwnPromiseCapability,PromiseWrapper,nativeThen,$$12=_export,IS_NODE$1=engineIsNode,global$v=global$M,call$n=functionCall,defineBuiltIn$g=defineBuiltIn$j,setPrototypeOf$5=objectSetPrototypeOf,setToStringTag$7=setToStringTag$8,setSpecies$4=setSpecies$5,aCallable$7=aCallable$b,isCallable$f=isCallable$v,isObject$l=isObject$t,anInstance$6=anInstance$7,speciesConstructor$4=speciesConstructor$5,task=task$1.set,microtask=microtask$1,hostReportErrors=hostReportErrors$1,perform$2=perform$3,Queue=queue,InternalStateModule$9=internalState,NativePromiseConstructor$3=promiseNativeConstructor,PromiseConstructorDetection=promiseConstructorDetection,newPromiseCapabilityModule$3=newPromiseCapability$2,PROMISE="Promise",FORCED_PROMISE_CONSTRUCTOR$4=PromiseConstructorDetection.CONSTRUCTOR,NATIVE_PROMISE_REJECTION_EVENT=PromiseConstructorDetection.REJECTION_EVENT,NATIVE_PROMISE_SUBCLASSING=PromiseConstructorDetection.SUBCLASSING,getInternalPromiseState=InternalStateModule$9.getterFor(PROMISE),setInternalState$8=InternalStateModule$9.set,NativePromisePrototype$2=NativePromiseConstructor$3&&NativePromiseConstructor$3.prototype,PromiseConstructor=NativePromiseConstructor$3,PromisePrototype=NativePromisePrototype$2,TypeError$6=global$v.TypeError,document$1=global$v.document,process$1=global$v.process,newPromiseCapability$1=newPromiseCapabilityModule$3.f,newGenericPromiseCapability=newPromiseCapability$1,DISPATCH_EVENT=!!(document$1&&document$1.createEvent&&global$v.dispatchEvent),UNHANDLED_REJECTION="unhandledrejection",REJECTION_HANDLED="rejectionhandled",PENDING=0,FULFILLED=1,REJECTED=2,HANDLED=1,UNHANDLED=2,isThenable=function(e){var t;return!(!isObject$l(e)||!isCallable$f(t=e.then))&&t},callReaction=function(e,t){var r,n,i,a=t.value,o=t.state==FULFILLED,s=o?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(o||(t.rejection===UNHANDLED&&onHandleUnhandled(t),t.rejection=HANDLED),!0===s?r=a:(l&&l.enter(),r=s(a),l&&(l.exit(),i=!0)),r===e.promise?c(TypeError$6("Promise-chain cycle")):(n=isThenable(r))?call$n(n,r,u,c):u(r)):c(a)}catch(e){l&&!i&&l.exit(),c(e)}},notify=function(e,t){e.notified||(e.notified=!0,microtask((function(){for(var r,n=e.reactions;r=n.get();)callReaction(r,e);e.notified=!1,t&&!e.rejection&&onUnhandled(e)})))},dispatchEvent=function(e,t,r){var n,i;DISPATCH_EVENT?((n=document$1.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),global$v.dispatchEvent(n)):n={promise:t,reason:r},!NATIVE_PROMISE_REJECTION_EVENT&&(i=global$v["on"+e])?i(n):e===UNHANDLED_REJECTION&&hostReportErrors("Unhandled promise rejection",r)},onUnhandled=function(e){call$n(task,global$v,(function(){var t,r=e.facade,n=e.value;if(isUnhandled(e)&&(t=perform$2((function(){IS_NODE$1?process$1.emit("unhandledRejection",n,r):dispatchEvent(UNHANDLED_REJECTION,r,n)})),e.rejection=IS_NODE$1||isUnhandled(e)?UNHANDLED:HANDLED,t.error))throw t.value}))},isUnhandled=function(e){return e.rejection!==HANDLED&&!e.parent},onHandleUnhandled=function(e){call$n(task,global$v,(function(){var t=e.facade;IS_NODE$1?process$1.emit("rejectionHandled",t):dispatchEvent(REJECTION_HANDLED,t,e.value)}))},bind$a=function(e,t,r){return function(n){e(t,n,r)}},internalReject=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=REJECTED,notify(e,!0))},internalResolve=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw TypeError$6("Promise can't be resolved itself");var n=isThenable(t);n?microtask((function(){var r={done:!1};try{call$n(n,t,bind$a(internalResolve,r,e),bind$a(internalReject,r,e))}catch(t){internalReject(r,t,e)}})):(e.value=t,e.state=FULFILLED,notify(e,!1))}catch(t){internalReject({done:!1},t,e)}}};if(FORCED_PROMISE_CONSTRUCTOR$4&&(PromisePrototype=(PromiseConstructor=function(e){anInstance$6(this,PromisePrototype),aCallable$7(e),call$n(Internal,this);var t=getInternalPromiseState(this);try{e(bind$a(internalResolve,t),bind$a(internalReject,t))}catch(e){internalReject(t,e)}}).prototype,(Internal=function(e){setInternalState$8(this,{type:PROMISE,done:!1,notified:!1,parent:!1,reactions:new Queue,rejection:!1,state:PENDING,value:void 0})}).prototype=defineBuiltIn$g(PromisePrototype,"then",(function(e,t){var r=getInternalPromiseState(this),n=newPromiseCapability$1(speciesConstructor$4(this,PromiseConstructor));return r.parent=!0,n.ok=!isCallable$f(e)||e,n.fail=isCallable$f(t)&&t,n.domain=IS_NODE$1?process$1.domain:void 0,r.state==PENDING?r.reactions.add(n):microtask((function(){callReaction(n,r)})),n.promise})),OwnPromiseCapability=function(){var e=new Internal,t=getInternalPromiseState(e);this.promise=e,this.resolve=bind$a(internalResolve,t),this.reject=bind$a(internalReject,t)},newPromiseCapabilityModule$3.f=newPromiseCapability$1=function(e){return e===PromiseConstructor||e===PromiseWrapper?new OwnPromiseCapability(e):newGenericPromiseCapability(e)},isCallable$f(NativePromiseConstructor$3)&&NativePromisePrototype$2!==Object.prototype)){nativeThen=NativePromisePrototype$2.then,NATIVE_PROMISE_SUBCLASSING||defineBuiltIn$g(NativePromisePrototype$2,"then",(function(e,t){var r=this;return new PromiseConstructor((function(e,t){call$n(nativeThen,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete NativePromisePrototype$2.constructor}catch(e){}setPrototypeOf$5&&setPrototypeOf$5(NativePromisePrototype$2,PromisePrototype)}$$12({global:!0,constructor:!0,wrap:!0,forced:FORCED_PROMISE_CONSTRUCTOR$4},{Promise:PromiseConstructor}),setToStringTag$7(PromiseConstructor,PROMISE,!1),setSpecies$4(PROMISE);var iterators={},wellKnownSymbol$j=wellKnownSymbol$u,Iterators$4=iterators,ITERATOR$a=wellKnownSymbol$j("iterator"),ArrayPrototype$1=Array.prototype,isArrayIteratorMethod$3=function(e){return void 0!==e&&(Iterators$4.Array===e||ArrayPrototype$1[ITERATOR$a]===e)},classof$b=classof$f,getMethod$4=getMethod$6,isNullOrUndefined$5=isNullOrUndefined$9,Iterators$3=iterators,wellKnownSymbol$i=wellKnownSymbol$u,ITERATOR$9=wellKnownSymbol$i("iterator"),getIteratorMethod$5=function(e){if(!isNullOrUndefined$5(e))return getMethod$4(e,ITERATOR$9)||getMethod$4(e,"@@iterator")||Iterators$3[classof$b(e)]},call$m=functionCall,aCallable$6=aCallable$b,anObject$h=anObject$m,tryToString$4=tryToString$7,getIteratorMethod$4=getIteratorMethod$5,$TypeError$8=TypeError,getIterator$4=function(e,t){var r=arguments.length<2?getIteratorMethod$4(e):t;if(aCallable$6(r))return anObject$h(call$m(r,e));throw $TypeError$8(tryToString$4(e)+" is not iterable")},call$l=functionCall,anObject$g=anObject$m,getMethod$3=getMethod$6,iteratorClose$2=function(e,t,r){var n,i;anObject$g(e);try{if(!(n=getMethod$3(e,"return"))){if("throw"===t)throw r;return r}n=call$l(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return anObject$g(n),r},bind$9=functionBindContext,call$k=functionCall,anObject$f=anObject$m,tryToString$3=tryToString$7,isArrayIteratorMethod$2=isArrayIteratorMethod$3,lengthOfArrayLike$f=lengthOfArrayLike$i,isPrototypeOf$7=objectIsPrototypeOf,getIterator$3=getIterator$4,getIteratorMethod$3=getIteratorMethod$5,iteratorClose$1=iteratorClose$2,$TypeError$7=TypeError,Result=function(e,t){this.stopped=e,this.result=t},ResultPrototype=Result.prototype,iterate$4=function(e,t,r){var n,i,a,o,s,u,c,l=r&&r.that,d=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),m=bind$9(t,l),y=function(e){return n&&iteratorClose$1(n,"normal",e),new Result(!0,e)},g=function(e){return d?(anObject$f(e),p?m(e[0],e[1],y):m(e[0],e[1])):p?m(e,y):m(e)};if(h)n=e.iterator;else if(f)n=e;else{if(!(i=getIteratorMethod$3(e)))throw $TypeError$7(tryToString$3(e)+" is not iterable");if(isArrayIteratorMethod$2(i)){for(a=0,o=lengthOfArrayLike$f(e);o>a;a++)if((s=g(e[a]))&&isPrototypeOf$7(ResultPrototype,s))return s;return new Result(!1)}n=getIterator$3(e,i)}for(u=h?e.next:n.next;!(c=call$k(u,n)).done;){try{s=g(c.value)}catch(e){iteratorClose$1(n,"throw",e)}if("object"==typeof s&&s&&isPrototypeOf$7(ResultPrototype,s))return s}return new Result(!1)},wellKnownSymbol$h=wellKnownSymbol$u,ITERATOR$8=wellKnownSymbol$h("iterator"),SAFE_CLOSING=!1;try{var called=0,iteratorWithReturn={next:function(){return{done:!!called++}},return:function(){SAFE_CLOSING=!0}};iteratorWithReturn[ITERATOR$8]=function(){return this},Array.from(iteratorWithReturn,(function(){throw 2}))}catch(e){}var checkCorrectnessOfIteration$4=function(e,t){if(!t&&!SAFE_CLOSING)return!1;var r=!1;try{var n={};n[ITERATOR$8]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},NativePromiseConstructor$2=promiseNativeConstructor,checkCorrectnessOfIteration$3=checkCorrectnessOfIteration$4,FORCED_PROMISE_CONSTRUCTOR$3=promiseConstructorDetection.CONSTRUCTOR,promiseStaticsIncorrectIteration=FORCED_PROMISE_CONSTRUCTOR$3||!checkCorrectnessOfIteration$3((function(e){NativePromiseConstructor$2.all(e).then(void 0,(function(){}))})),$$11=_export,call$j=functionCall,aCallable$5=aCallable$b,newPromiseCapabilityModule$2=newPromiseCapability$2,perform$1=perform$3,iterate$3=iterate$4,PROMISE_STATICS_INCORRECT_ITERATION$1=promiseStaticsIncorrectIteration;$$11({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION$1},{all:function(e){var t=this,r=newPromiseCapabilityModule$2.f(t),n=r.resolve,i=r.reject,a=perform$1((function(){var r=aCallable$5(t.resolve),a=[],o=0,s=1;iterate$3(e,(function(e){var u=o++,c=!1;s++,call$j(r,t,e).then((function(e){c||(c=!0,a[u]=e,--s||n(a))}),i)})),--s||n(a)}));return a.error&&i(a.value),r.promise}});var $$10=_export,FORCED_PROMISE_CONSTRUCTOR$2=promiseConstructorDetection.CONSTRUCTOR,NativePromiseConstructor$1=promiseNativeConstructor,getBuiltIn$6=getBuiltIn$d,isCallable$e=isCallable$v,defineBuiltIn$f=defineBuiltIn$j,NativePromisePrototype$1=NativePromiseConstructor$1&&NativePromiseConstructor$1.prototype;if($$10({target:"Promise",proto:!0,forced:FORCED_PROMISE_CONSTRUCTOR$2,real:!0},{catch:function(e){return this.then(void 0,e)}}),isCallable$e(NativePromiseConstructor$1)){var method$1=getBuiltIn$6("Promise").prototype.catch;NativePromisePrototype$1.catch!==method$1&&defineBuiltIn$f(NativePromisePrototype$1,"catch",method$1,{unsafe:!0})}var $$$=_export,call$i=functionCall,aCallable$4=aCallable$b,newPromiseCapabilityModule$1=newPromiseCapability$2,perform=perform$3,iterate$2=iterate$4,PROMISE_STATICS_INCORRECT_ITERATION=promiseStaticsIncorrectIteration;$$$({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION},{race:function(e){var t=this,r=newPromiseCapabilityModule$1.f(t),n=r.reject,i=perform((function(){var i=aCallable$4(t.resolve);iterate$2(e,(function(e){call$i(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var $$_=_export,call$h=functionCall,newPromiseCapabilityModule=newPromiseCapability$2,FORCED_PROMISE_CONSTRUCTOR$1=promiseConstructorDetection.CONSTRUCTOR;$$_({target:"Promise",stat:!0,forced:FORCED_PROMISE_CONSTRUCTOR$1},{reject:function(e){var t=newPromiseCapabilityModule.f(this);return call$h(t.reject,void 0,e),t.promise}});var anObject$e=anObject$m,isObject$k=isObject$t,newPromiseCapability=newPromiseCapability$2,promiseResolve$2=function(e,t){if(anObject$e(e),isObject$k(t)&&t.constructor===e)return t;var r=newPromiseCapability.f(e);return(0,r.resolve)(t),r.promise},$$Z=_export,getBuiltIn$5=getBuiltIn$d,FORCED_PROMISE_CONSTRUCTOR=promiseConstructorDetection.CONSTRUCTOR,promiseResolve$1=promiseResolve$2;getBuiltIn$5("Promise"),$$Z({target:"Promise",stat:!0,forced:FORCED_PROMISE_CONSTRUCTOR},{resolve:function(e){return promiseResolve$1(this,e)}});var objectDefineProperties={},DESCRIPTORS$i=descriptors,V8_PROTOTYPE_DEFINE_BUG=v8PrototypeDefineBug,definePropertyModule$2=objectDefineProperty,anObject$d=anObject$m,toIndexedObject$9=toIndexedObject$d,objectKeys$2=objectKeys$4;objectDefineProperties.f=DESCRIPTORS$i&&!V8_PROTOTYPE_DEFINE_BUG?Object.defineProperties:function(e,t){anObject$d(e);for(var r,n=toIndexedObject$9(t),i=objectKeys$2(t),a=i.length,o=0;a>o;)definePropertyModule$2.f(e,r=i[o++],n[r]);return e};var activeXDocument,anObject$c=anObject$m,definePropertiesModule$1=objectDefineProperties,enumBugKeys=enumBugKeys$3,hiddenKeys$2=hiddenKeys$6,html=html$2,documentCreateElement$1=documentCreateElement$2,sharedKey$2=sharedKey$4,GT=">",LT="<",PROTOTYPE$2="prototype",SCRIPT="script",IE_PROTO$1=sharedKey$2("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return LT+SCRIPT+GT+e+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(e){e.write(scriptTag("")),e.close();var t=e.parentWindow.Object;return e=null,t},NullProtoObjectViaIFrame=function(){var e,t=documentCreateElement$1("iframe"),r="java"+SCRIPT+":";return t.style.display="none",html.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(scriptTag("document.F=Object")),e.close(),e.F},NullProtoObject=function(){try{activeXDocument=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject="undefined"!=typeof document?document.domain&&activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame():NullProtoObjectViaActiveX(activeXDocument);for(var e=enumBugKeys.length;e--;)delete NullProtoObject[PROTOTYPE$2][enumBugKeys[e]];return NullProtoObject()};hiddenKeys$2[IE_PROTO$1]=!0;var objectCreate=Object.create||function(e,t){var r;return null!==e?(EmptyConstructor[PROTOTYPE$2]=anObject$c(e),r=new EmptyConstructor,EmptyConstructor[PROTOTYPE$2]=null,r[IE_PROTO$1]=e):r=NullProtoObject(),void 0===t?r:definePropertiesModule$1.f(r,t)},wellKnownSymbol$g=wellKnownSymbol$u,create$7=objectCreate,defineProperty$c=objectDefineProperty.f,UNSCOPABLES=wellKnownSymbol$g("unscopables"),ArrayPrototype=Array.prototype;null==ArrayPrototype[UNSCOPABLES]&&defineProperty$c(ArrayPrototype,UNSCOPABLES,{configurable:!0,value:create$7(null)});var IteratorPrototype$2,PrototypeOfArrayIteratorPrototype,arrayIterator,addToUnscopables$5=function(e){ArrayPrototype[UNSCOPABLES][e]=!0},fails$H=fails$V,correctPrototypeGetter=!fails$H((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),hasOwn$e=hasOwnProperty_1,isCallable$d=isCallable$v,toObject$d=toObject$h,sharedKey$1=sharedKey$4,CORRECT_PROTOTYPE_GETTER$1=correctPrototypeGetter,IE_PROTO=sharedKey$1("IE_PROTO"),$Object=Object,ObjectPrototype$4=$Object.prototype,objectGetPrototypeOf=CORRECT_PROTOTYPE_GETTER$1?$Object.getPrototypeOf:function(e){var t=toObject$d(e);if(hasOwn$e(t,IE_PROTO))return t[IE_PROTO];var r=t.constructor;return isCallable$d(r)&&t instanceof r?r.prototype:t instanceof $Object?ObjectPrototype$4:null},fails$G=fails$V,isCallable$c=isCallable$v,isObject$j=isObject$t,getPrototypeOf$3=objectGetPrototypeOf,defineBuiltIn$e=defineBuiltIn$j,wellKnownSymbol$f=wellKnownSymbol$u,ITERATOR$7=wellKnownSymbol$f("iterator"),BUGGY_SAFARI_ITERATORS$1=!1;[].keys&&("next"in(arrayIterator=[].keys())?(PrototypeOfArrayIteratorPrototype=getPrototypeOf$3(getPrototypeOf$3(arrayIterator)))!==Object.prototype&&(IteratorPrototype$2=PrototypeOfArrayIteratorPrototype):BUGGY_SAFARI_ITERATORS$1=!0);var NEW_ITERATOR_PROTOTYPE=!isObject$j(IteratorPrototype$2)||fails$G((function(){var e={};return IteratorPrototype$2[ITERATOR$7].call(e)!==e}));NEW_ITERATOR_PROTOTYPE&&(IteratorPrototype$2={}),isCallable$c(IteratorPrototype$2[ITERATOR$7])||defineBuiltIn$e(IteratorPrototype$2,ITERATOR$7,(function(){return this}));var iteratorsCore={IteratorPrototype:IteratorPrototype$2,BUGGY_SAFARI_ITERATORS:BUGGY_SAFARI_ITERATORS$1},IteratorPrototype$1=iteratorsCore.IteratorPrototype,create$6=objectCreate,createPropertyDescriptor$3=createPropertyDescriptor$7,setToStringTag$6=setToStringTag$8,Iterators$2=iterators,returnThis$1=function(){return this},iteratorCreateConstructor=function(e,t,r,n){var i=t+" Iterator";return e.prototype=create$6(IteratorPrototype$1,{next:createPropertyDescriptor$3(+!n,r)}),setToStringTag$6(e,i,!1),Iterators$2[i]=returnThis$1,e},$$Y=_export,call$g=functionCall,FunctionName$1=functionName,isCallable$b=isCallable$v,createIteratorConstructor$1=iteratorCreateConstructor,getPrototypeOf$2=objectGetPrototypeOf,setPrototypeOf$4=objectSetPrototypeOf,setToStringTag$5=setToStringTag$8,createNonEnumerableProperty$7=createNonEnumerableProperty$a,defineBuiltIn$d=defineBuiltIn$j,wellKnownSymbol$e=wellKnownSymbol$u,Iterators$1=iterators,IteratorsCore=iteratorsCore,PROPER_FUNCTION_NAME$3=FunctionName$1.PROPER,CONFIGURABLE_FUNCTION_NAME$1=FunctionName$1.CONFIGURABLE,IteratorPrototype=IteratorsCore.IteratorPrototype,BUGGY_SAFARI_ITERATORS=IteratorsCore.BUGGY_SAFARI_ITERATORS,ITERATOR$6=wellKnownSymbol$e("iterator"),KEYS="keys",VALUES="values",ENTRIES="entries",returnThis=function(){return this},iteratorDefine=function(e,t,r,n,i,a,o){createIteratorConstructor$1(r,t,n);var s,u,c,l=function(e){if(e===i&&m)return m;if(!BUGGY_SAFARI_ITERATORS&&e in f)return f[e];switch(e){case KEYS:case VALUES:case ENTRIES:return function(){return new r(this,e)}}return function(){return new r(this)}},d=t+" Iterator",h=!1,f=e.prototype,p=f[ITERATOR$6]||f["@@iterator"]||i&&f[i],m=!BUGGY_SAFARI_ITERATORS&&p||l(i),y="Array"==t&&f.entries||p;if(y&&(s=getPrototypeOf$2(y.call(new e)))!==Object.prototype&&s.next&&(getPrototypeOf$2(s)!==IteratorPrototype&&(setPrototypeOf$4?setPrototypeOf$4(s,IteratorPrototype):isCallable$b(s[ITERATOR$6])||defineBuiltIn$d(s,ITERATOR$6,returnThis)),setToStringTag$5(s,d,!0)),PROPER_FUNCTION_NAME$3&&i==VALUES&&p&&p.name!==VALUES&&(CONFIGURABLE_FUNCTION_NAME$1?createNonEnumerableProperty$7(f,"name",VALUES):(h=!0,m=function(){return call$g(p,this)})),i)if(u={values:l(VALUES),keys:a?m:l(KEYS),entries:l(ENTRIES)},o)for(c in u)(BUGGY_SAFARI_ITERATORS||h||!(c in f))&&defineBuiltIn$d(f,c,u[c]);else $$Y({target:t,proto:!0,forced:BUGGY_SAFARI_ITERATORS||h},u);return f[ITERATOR$6]!==m&&defineBuiltIn$d(f,ITERATOR$6,m,{name:i}),Iterators$1[t]=m,u},createIterResultObject$3=function(e,t){return{value:e,done:t}},toIndexedObject$8=toIndexedObject$d,addToUnscopables$4=addToUnscopables$5,Iterators=iterators,InternalStateModule$8=internalState,defineProperty$b=objectDefineProperty.f,defineIterator$2=iteratorDefine,createIterResultObject$2=createIterResultObject$3,DESCRIPTORS$h=descriptors,ARRAY_ITERATOR="Array Iterator",setInternalState$7=InternalStateModule$8.set,getInternalState$7=InternalStateModule$8.getterFor(ARRAY_ITERATOR),es_array_iterator=defineIterator$2(Array,"Array",(function(e,t){setInternalState$7(this,{type:ARRAY_ITERATOR,target:toIndexedObject$8(e),index:0,kind:t})}),(function(){var e=getInternalState$7(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,createIterResultObject$2(void 0,!0)):createIterResultObject$2("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),values=Iterators.Arguments=Iterators.Array;if(addToUnscopables$4("keys"),addToUnscopables$4("values"),addToUnscopables$4("entries"),DESCRIPTORS$h&&"values"!==values.name)try{defineProperty$b(values,"name",{value:"values"})}catch(e){}var classof$a=classof$f,$String$1=String,toString$l=function(e){if("Symbol"===classof$a(e))throw TypeError("Cannot convert a Symbol value to a string");return $String$1(e)},uncurryThis$F=functionUncurryThis,toIntegerOrInfinity$9=toIntegerOrInfinity$c,toString$k=toString$l,requireObjectCoercible$8=requireObjectCoercible$b,charAt$9=uncurryThis$F("".charAt),charCodeAt$3=uncurryThis$F("".charCodeAt),stringSlice$b=uncurryThis$F("".slice),createMethod$6=function(e){return function(t,r){var n,i,a=toString$k(requireObjectCoercible$8(t)),o=toIntegerOrInfinity$9(r),s=a.length;return o<0||o>=s?e?"":void 0:(n=charCodeAt$3(a,o))<55296||n>56319||o+1===s||(i=charCodeAt$3(a,o+1))<56320||i>57343?e?charAt$9(a,o):n:e?stringSlice$b(a,o,o+2):i-56320+(n-55296<<10)+65536}},stringMultibyte={codeAt:createMethod$6(!1),charAt:createMethod$6(!0)},charAt$8=stringMultibyte.charAt,toString$j=toString$l,InternalStateModule$7=internalState,defineIterator$1=iteratorDefine,createIterResultObject$1=createIterResultObject$3,STRING_ITERATOR="String Iterator",setInternalState$6=InternalStateModule$7.set,getInternalState$6=InternalStateModule$7.getterFor(STRING_ITERATOR);defineIterator$1(String,"String",(function(e){setInternalState$6(this,{type:STRING_ITERATOR,string:toString$j(e),index:0})}),(function(){var e,t=getInternalState$6(this),r=t.string,n=t.index;return n>=r.length?createIterResultObject$1(void 0,!0):(e=charAt$8(r,n),t.index+=e.length,createIterResultObject$1(e,!1))}));var domIterables={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},documentCreateElement=documentCreateElement$2,classList=documentCreateElement("span").classList,DOMTokenListPrototype$2=classList&&classList.constructor&&classList.constructor.prototype,domTokenListPrototype=DOMTokenListPrototype$2===Object.prototype?void 0:DOMTokenListPrototype$2,global$u=global$M,DOMIterables$1=domIterables,DOMTokenListPrototype$1=domTokenListPrototype,ArrayIteratorMethods=es_array_iterator,createNonEnumerableProperty$6=createNonEnumerableProperty$a,wellKnownSymbol$d=wellKnownSymbol$u,ITERATOR$5=wellKnownSymbol$d("iterator"),TO_STRING_TAG$1=wellKnownSymbol$d("toStringTag"),ArrayValues=ArrayIteratorMethods.values,handlePrototype$1=function(e,t){if(e){if(e[ITERATOR$5]!==ArrayValues)try{createNonEnumerableProperty$6(e,ITERATOR$5,ArrayValues)}catch(t){e[ITERATOR$5]=ArrayValues}if(e[TO_STRING_TAG$1]||createNonEnumerableProperty$6(e,TO_STRING_TAG$1,t),DOMIterables$1[t])for(var r in ArrayIteratorMethods)if(e[r]!==ArrayIteratorMethods[r])try{createNonEnumerableProperty$6(e,r,ArrayIteratorMethods[r])}catch(t){e[r]=ArrayIteratorMethods[r]}}};for(var COLLECTION_NAME$1 in DOMIterables$1)handlePrototype$1(global$u[COLLECTION_NAME$1]&&global$u[COLLECTION_NAME$1].prototype,COLLECTION_NAME$1);handlePrototype$1(DOMTokenListPrototype$1,"DOMTokenList");var fails$F=fails$V,wellKnownSymbol$c=wellKnownSymbol$u,IS_PURE=isPure,ITERATOR$4=wellKnownSymbol$c("iterator"),urlConstructorDetection=!fails$F((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),IS_PURE&&!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[ITERATOR$4]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),makeBuiltIn=makeBuiltInExports,defineProperty$a=objectDefineProperty,defineBuiltInAccessor$3=function(e,t,r){return r.get&&makeBuiltIn(r.get,t,{getter:!0}),r.set&&makeBuiltIn(r.set,t,{setter:!0}),defineProperty$a.f(e,t,r)},anObject$b=anObject$m,iteratorClose=iteratorClose$2,callWithSafeIterationClosing$1=function(e,t,r,n){try{return n?t(anObject$b(r)[0],r[1]):t(r)}catch(t){iteratorClose(e,"throw",t)}},bind$8=functionBindContext,call$f=functionCall,toObject$c=toObject$h,callWithSafeIterationClosing=callWithSafeIterationClosing$1,isArrayIteratorMethod$1=isArrayIteratorMethod$3,isConstructor$1=isConstructor$4,lengthOfArrayLike$e=lengthOfArrayLike$i,createProperty$3=createProperty$5,getIterator$2=getIterator$4,getIteratorMethod$2=getIteratorMethod$5,$Array$3=Array,arrayFrom$1=function(e){var t=toObject$c(e),r=isConstructor$1(this),n=arguments.length,i=n>1?arguments[1]:void 0,a=void 0!==i;a&&(i=bind$8(i,n>2?arguments[2]:void 0));var o,s,u,c,l,d,h=getIteratorMethod$2(t),f=0;if(!h||this===$Array$3&&isArrayIteratorMethod$1(h))for(o=lengthOfArrayLike$e(t),s=r?new this(o):$Array$3(o);o>f;f++)d=a?i(t[f],f):t[f],createProperty$3(s,f,d);else for(l=(c=getIterator$2(t,h)).next,s=r?new this:[];!(u=call$f(l,c)).done;f++)d=a?callWithSafeIterationClosing(c,i,[u.value,f],!0):u.value,createProperty$3(s,f,d);return s.length=f,s},toAbsoluteIndex$6=toAbsoluteIndex$8,lengthOfArrayLike$d=lengthOfArrayLike$i,createProperty$2=createProperty$5,$Array$2=Array,max$3=Math.max,arraySliceSimple=function(e,t,r){for(var n=lengthOfArrayLike$d(e),i=toAbsoluteIndex$6(t,n),a=toAbsoluteIndex$6(void 0===r?n:r,n),o=$Array$2(max$3(a-i,0)),s=0;i<a;i++,s++)createProperty$2(o,s,e[i]);return o.length=s,o},uncurryThis$E=functionUncurryThis,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexNonASCII=/[^\0-\u007E]/,regexSeparators=/[.\u3002\uFF0E\uFF61]/g,OVERFLOW_ERROR="Overflow: input needs wider integers to process",baseMinusTMin=base-tMin,$RangeError$5=RangeError,exec$6=uncurryThis$E(regexSeparators.exec),floor$8=Math.floor,fromCharCode=String.fromCharCode,charCodeAt$2=uncurryThis$E("".charCodeAt),join$4=uncurryThis$E([].join),push$9=uncurryThis$E([].push),replace$8=uncurryThis$E("".replace),split$2=uncurryThis$E("".split),toLowerCase$1=uncurryThis$E("".toLowerCase),ucs2decode=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=charCodeAt$2(e,r++);if(i>=55296&&i<=56319&&r<n){var a=charCodeAt$2(e,r++);56320==(64512&a)?push$9(t,((1023&i)<<10)+(1023&a)+65536):(push$9(t,i),r--)}else push$9(t,i)}return t},digitToBasic=function(e){return e+22+75*(e<26)},adapt=function(e,t,r){var n=0;for(e=r?floor$8(e/damp):e>>1,e+=floor$8(e/t);e>baseMinusTMin*tMax>>1;)e=floor$8(e/baseMinusTMin),n+=base;return floor$8(n+(baseMinusTMin+1)*e/(e+skew))},encode$3=function(e){var t,r,n=[],i=(e=ucs2decode(e)).length,a=initialN,o=0,s=initialBias;for(t=0;t<e.length;t++)(r=e[t])<128&&push$9(n,fromCharCode(r));var u=n.length,c=u;for(u&&push$9(n,delimiter);c<i;){var l=maxInt;for(t=0;t<e.length;t++)(r=e[t])>=a&&r<l&&(l=r);var d=c+1;if(l-a>floor$8((maxInt-o)/d))throw $RangeError$5(OVERFLOW_ERROR);for(o+=(l-a)*d,a=l,t=0;t<e.length;t++){if((r=e[t])<a&&++o>maxInt)throw $RangeError$5(OVERFLOW_ERROR);if(r==a){for(var h=o,f=base;;){var p=f<=s?tMin:f>=s+tMax?tMax:f-s;if(h<p)break;var m=h-p,y=base-p;push$9(n,fromCharCode(digitToBasic(p+m%y))),h=floor$8(m/y),f+=base}push$9(n,fromCharCode(digitToBasic(h))),s=adapt(o,d,c==u),o=0,c++}}o++,a++}return join$4(n,"")},stringPunycodeToAscii=function(e){var t,r,n=[],i=split$2(replace$8(toLowerCase$1(e),regexSeparators,"."),".");for(t=0;t<i.length;t++)r=i[t],push$9(n,exec$6(regexNonASCII,r)?"xn--"+encode$3(r):r);return join$4(n,".")},defineBuiltIn$c=defineBuiltIn$j,defineBuiltIns$3=function(e,t,r){for(var n in t)defineBuiltIn$c(e,n,t[n],r);return e},arraySlice$a=arraySliceSimple,floor$7=Math.floor,mergeSort=function(e,t){var r=e.length,n=floor$7(r/2);return r<8?insertionSort(e,t):merge(e,mergeSort(arraySlice$a(e,0,n),t),mergeSort(arraySlice$a(e,n),t),t)},insertionSort=function(e,t){for(var r,n,i=e.length,a=1;a<i;){for(n=a,r=e[a];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==a++&&(e[n]=r)}return e},merge=function(e,t,r,n){for(var i=t.length,a=r.length,o=0,s=0;o<i||s<a;)e[o+s]=o<i&&s<a?n(t[o],r[s])<=0?t[o++]:r[s++]:o<i?t[o++]:r[s++];return e},arraySort$1=mergeSort,$$X=_export,global$t=global$M,call$e=functionCall,uncurryThis$D=functionUncurryThis,DESCRIPTORS$g=descriptors,USE_NATIVE_URL$1=urlConstructorDetection,defineBuiltIn$b=defineBuiltIn$j,defineBuiltIns$2=defineBuiltIns$3,setToStringTag$4=setToStringTag$8,createIteratorConstructor=iteratorCreateConstructor,InternalStateModule$6=internalState,anInstance$5=anInstance$7,isCallable$a=isCallable$v,hasOwn$d=hasOwnProperty_1,bind$7=functionBindContext,classof$9=classof$f,anObject$a=anObject$m,isObject$i=isObject$t,$toString$3=toString$l,create$5=objectCreate,createPropertyDescriptor$2=createPropertyDescriptor$7,getIterator$1=getIterator$4,getIteratorMethod$1=getIteratorMethod$5,validateArgumentsLength$2=validateArgumentsLength$4,wellKnownSymbol$b=wellKnownSymbol$u,arraySort=arraySort$1,ITERATOR$3=wellKnownSymbol$b("iterator"),URL_SEARCH_PARAMS="URLSearchParams",URL_SEARCH_PARAMS_ITERATOR=URL_SEARCH_PARAMS+"Iterator",setInternalState$5=InternalStateModule$6.set,getInternalParamsState=InternalStateModule$6.getterFor(URL_SEARCH_PARAMS),getInternalIteratorState=InternalStateModule$6.getterFor(URL_SEARCH_PARAMS_ITERATOR),getOwnPropertyDescriptor$3=Object.getOwnPropertyDescriptor,safeGetBuiltIn=function(e){if(!DESCRIPTORS$g)return global$t[e];var t=getOwnPropertyDescriptor$3(global$t,e);return t&&t.value},nativeFetch=safeGetBuiltIn("fetch"),NativeRequest=safeGetBuiltIn("Request"),Headers$1=safeGetBuiltIn("Headers"),RequestPrototype=NativeRequest&&NativeRequest.prototype,HeadersPrototype=Headers$1&&Headers$1.prototype,RegExp$2=global$t.RegExp,TypeError$5=global$t.TypeError,decodeURIComponent$1=global$t.decodeURIComponent,encodeURIComponent$1=global$t.encodeURIComponent,charAt$7=uncurryThis$D("".charAt),join$3=uncurryThis$D([].join),push$8=uncurryThis$D([].push),replace$7=uncurryThis$D("".replace),shift$1=uncurryThis$D([].shift),splice=uncurryThis$D([].splice),split$1=uncurryThis$D("".split),stringSlice$a=uncurryThis$D("".slice),plus=/\+/g,sequences=Array(4),percentSequence=function(e){return sequences[e-1]||(sequences[e-1]=RegExp$2("((?:%[\\da-f]{2}){"+e+"})","gi"))},percentDecode=function(e){try{return decodeURIComponent$1(e)}catch(t){return e}},deserialize=function(e){var t=replace$7(e,plus," "),r=4;try{return decodeURIComponent$1(t)}catch(e){for(;r;)t=replace$7(t,percentSequence(r--),percentDecode);return t}},find=/[!'()~]|%20/g,replacements={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},replacer=function(e){return replacements[e]},serialize=function(e){return replace$7(encodeURIComponent$1(e),find,replacer)},URLSearchParamsIterator=createIteratorConstructor((function(e,t){setInternalState$5(this,{type:URL_SEARCH_PARAMS_ITERATOR,iterator:getIterator$1(getInternalParamsState(e).entries),kind:t})}),"Iterator",(function(){var e=getInternalIteratorState(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),URLSearchParamsState=function(e){this.entries=[],this.url=null,void 0!==e&&(isObject$i(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===charAt$7(e,0)?stringSlice$a(e,1):e:$toString$3(e)))};URLSearchParamsState.prototype={type:URL_SEARCH_PARAMS,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,a,o,s,u=getIteratorMethod$1(e);if(u)for(r=(t=getIterator$1(e,u)).next;!(n=call$e(r,t)).done;){if(a=(i=getIterator$1(anObject$a(n.value))).next,(o=call$e(a,i)).done||(s=call$e(a,i)).done||!call$e(a,i).done)throw TypeError$5("Expected sequence with length 2");push$8(this.entries,{key:$toString$3(o.value),value:$toString$3(s.value)})}else for(var c in e)hasOwn$d(e,c)&&push$8(this.entries,{key:c,value:$toString$3(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=split$1(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=split$1(t,"="),push$8(this.entries,{key:deserialize(shift$1(r)),value:deserialize(join$3(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],push$8(r,serialize(e.key)+"="+serialize(e.value));return join$3(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var URLSearchParamsConstructor=function(){anInstance$5(this,URLSearchParamsPrototype),setInternalState$5(this,new URLSearchParamsState(arguments.length>0?arguments[0]:void 0))},URLSearchParamsPrototype=URLSearchParamsConstructor.prototype;if(defineBuiltIns$2(URLSearchParamsPrototype,{append:function(e,t){validateArgumentsLength$2(arguments.length,2);var r=getInternalParamsState(this);push$8(r.entries,{key:$toString$3(e),value:$toString$3(t)}),r.updateURL()},delete:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this),r=t.entries,n=$toString$3(e),i=0;i<r.length;)r[i].key===n?splice(r,i,1):i++;t.updateURL()},get:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$3(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$3(e),n=[],i=0;i<t.length;i++)t[i].key===r&&push$8(n,t[i].value);return n},has:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$3(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){validateArgumentsLength$2(arguments.length,1);for(var r,n=getInternalParamsState(this),i=n.entries,a=!1,o=$toString$3(e),s=$toString$3(t),u=0;u<i.length;u++)(r=i[u]).key===o&&(a?splice(i,u--,1):(a=!0,r.value=s));a||push$8(i,{key:o,value:s}),n.updateURL()},sort:function(){var e=getInternalParamsState(this);arraySort(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=getInternalParamsState(this).entries,n=bind$7(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new URLSearchParamsIterator(this,"keys")},values:function(){return new URLSearchParamsIterator(this,"values")},entries:function(){return new URLSearchParamsIterator(this,"entries")}},{enumerable:!0}),defineBuiltIn$b(URLSearchParamsPrototype,ITERATOR$3,URLSearchParamsPrototype.entries,{name:"entries"}),defineBuiltIn$b(URLSearchParamsPrototype,"toString",(function(){return getInternalParamsState(this).serialize()}),{enumerable:!0}),setToStringTag$4(URLSearchParamsConstructor,URL_SEARCH_PARAMS),$$X({global:!0,constructor:!0,forced:!USE_NATIVE_URL$1},{URLSearchParams:URLSearchParamsConstructor}),!USE_NATIVE_URL$1&&isCallable$a(Headers$1)){var headersHas=uncurryThis$D(HeadersPrototype.has),headersSet=uncurryThis$D(HeadersPrototype.set),wrapRequestOptions=function(e){if(isObject$i(e)){var t,r=e.body;if(classof$9(r)===URL_SEARCH_PARAMS)return t=e.headers?new Headers$1(e.headers):new Headers$1,headersHas(t,"content-type")||headersSet(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),create$5(e,{body:createPropertyDescriptor$2(0,$toString$3(r)),headers:createPropertyDescriptor$2(0,t)})}return e};if(isCallable$a(nativeFetch)&&$$X({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return nativeFetch(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})}}),isCallable$a(NativeRequest)){var RequestConstructor=function(e){return anInstance$5(this,RequestPrototype),new NativeRequest(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})};RequestPrototype.constructor=RequestConstructor,RequestConstructor.prototype=RequestPrototype,$$X({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:RequestConstructor})}}var EOF,web_urlSearchParams_constructor={URLSearchParams:URLSearchParamsConstructor,getState:getInternalParamsState},$$W=_export,DESCRIPTORS$f=descriptors,USE_NATIVE_URL=urlConstructorDetection,global$s=global$M,bind$6=functionBindContext,uncurryThis$C=functionUncurryThis,defineBuiltIn$a=defineBuiltIn$j,defineBuiltInAccessor$2=defineBuiltInAccessor$3,anInstance$4=anInstance$7,hasOwn$c=hasOwnProperty_1,assign$2=objectAssign,arrayFrom=arrayFrom$1,arraySlice$9=arraySliceSimple,codeAt=stringMultibyte.codeAt,toASCII=stringPunycodeToAscii,$toString$2=toString$l,setToStringTag$3=setToStringTag$8,validateArgumentsLength$1=validateArgumentsLength$4,URLSearchParamsModule=web_urlSearchParams_constructor,InternalStateModule$5=internalState,setInternalState$4=InternalStateModule$5.set,getInternalURLState=InternalStateModule$5.getterFor("URL"),URLSearchParams$1=URLSearchParamsModule.URLSearchParams,getInternalSearchParamsState=URLSearchParamsModule.getState,NativeURL=global$s.URL,TypeError$4=global$s.TypeError,parseInt$1=global$s.parseInt,floor$6=Math.floor,pow$3=Math.pow,charAt$6=uncurryThis$C("".charAt),exec$5=uncurryThis$C(/./.exec),join$2=uncurryThis$C([].join),numberToString$1=uncurryThis$C(1..toString),pop=uncurryThis$C([].pop),push$7=uncurryThis$C([].push),replace$6=uncurryThis$C("".replace),shift=uncurryThis$C([].shift),split=uncurryThis$C("".split),stringSlice$9=uncurryThis$C("".slice),toLowerCase=uncurryThis$C("".toLowerCase),unshift=uncurryThis$C([].unshift),INVALID_AUTHORITY="Invalid authority",INVALID_SCHEME="Invalid scheme",INVALID_HOST="Invalid host",INVALID_PORT="Invalid port",ALPHA=/[a-z]/i,ALPHANUMERIC=/[\d+-.a-z]/i,DIGIT=/\d/,HEX_START=/^0x/i,OCT=/^[0-7]+$/,DEC=/^\d+$/,HEX=/^[\da-f]+$/i,FORBIDDEN_HOST_CODE_POINT=/[\0\t\n\r #%/:<>?@[\\\]^|]/,FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT=/[\0\t\n\r #/:<>?@[\\\]^|]/,LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,TAB_AND_NEW_LINE=/[\t\n\r]/g,parseIPv4=function(e){var t,r,n,i,a,o,s,u=split(e,".");if(u.length&&""==u[u.length-1]&&u.length--,(t=u.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=u[n]))return e;if(a=10,i.length>1&&"0"==charAt$6(i,0)&&(a=exec$5(HEX_START,i)?16:8,i=stringSlice$9(i,8==a?1:2)),""===i)o=0;else{if(!exec$5(10==a?DEC:8==a?OCT:HEX,i))return e;o=parseInt$1(i,a)}push$7(r,o)}for(n=0;n<t;n++)if(o=r[n],n==t-1){if(o>=pow$3(256,5-t))return null}else if(o>255)return null;for(s=pop(r),n=0;n<r.length;n++)s+=r[n]*pow$3(256,3-n);return s},parseIPv6=function(e){var t,r,n,i,a,o,s,u=[0,0,0,0,0,0,0,0],c=0,l=null,d=0,h=function(){return charAt$6(e,d)};if(":"==h()){if(":"!=charAt$6(e,1))return;d+=2,l=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=r=0;r<4&&exec$5(HEX,h());)t=16*t+parseInt$1(h(),16),d++,r++;if("."==h()){if(0==r)return;if(d-=r,c>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;d++}if(!exec$5(DIGIT,h()))return;for(;exec$5(DIGIT,h());){if(a=parseInt$1(h(),10),null===i)i=a;else{if(0==i)return;i=10*i+a}if(i>255)return;d++}u[c]=256*u[c]+i,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==h()){if(d++,!h())return}else if(h())return;u[c++]=t}else{if(null!==l)return;d++,l=++c}}if(null!==l)for(o=c-l,c=7;0!=c&&o>0;)s=u[c],u[c--]=u[l+o-1],u[l+--o]=s;else if(8!=c)return;return u},findLongestZeroSequence=function(e){for(var t=null,r=1,n=null,i=0,a=0;a<8;a++)0!==e[a]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=a),++i);return i>r&&(t=n,r=i),t},serializeHost=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)unshift(t,e%256),e=floor$6(e/256);return join$2(t,".")}if("object"==typeof e){for(t="",n=findLongestZeroSequence(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=numberToString$1(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},C0ControlPercentEncodeSet={},fragmentPercentEncodeSet=assign$2({},C0ControlPercentEncodeSet,{" ":1,'"':1,"<":1,">":1,"`":1}),pathPercentEncodeSet=assign$2({},fragmentPercentEncodeSet,{"#":1,"?":1,"{":1,"}":1}),userinfoPercentEncodeSet=assign$2({},pathPercentEncodeSet,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),percentEncode=function(e,t){var r=codeAt(e,0);return r>32&&r<127&&!hasOwn$c(t,e)?e:encodeURIComponent(e)},specialSchemes={ftp:21,file:null,http:80,https:443,ws:80,wss:443},isWindowsDriveLetter=function(e,t){var r;return 2==e.length&&exec$5(ALPHA,charAt$6(e,0))&&(":"==(r=charAt$6(e,1))||!t&&"|"==r)},startsWithWindowsDriveLetter=function(e){var t;return e.length>1&&isWindowsDriveLetter(stringSlice$9(e,0,2))&&(2==e.length||"/"===(t=charAt$6(e,2))||"\\"===t||"?"===t||"#"===t)},isSingleDot=function(e){return"."===e||"%2e"===toLowerCase(e)},isDoubleDot=function(e){return".."===(e=toLowerCase(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},SCHEME_START={},SCHEME={},NO_SCHEME={},SPECIAL_RELATIVE_OR_AUTHORITY={},PATH_OR_AUTHORITY={},RELATIVE={},RELATIVE_SLASH={},SPECIAL_AUTHORITY_SLASHES={},SPECIAL_AUTHORITY_IGNORE_SLASHES={},AUTHORITY={},HOST={},HOSTNAME={},PORT={},FILE={},FILE_SLASH={},FILE_HOST={},PATH_START={},PATH={},CANNOT_BE_A_BASE_URL_PATH={},QUERY={},FRAGMENT={},URLState=function(e,t,r){var n,i,a,o=$toString$2(e);if(t){if(i=this.parse(o))throw TypeError$4(i);this.searchParams=null}else{if(void 0!==r&&(n=new URLState(r,!0)),i=this.parse(o,null,n))throw TypeError$4(i);(a=getInternalSearchParamsState(new URLSearchParams$1)).bindURL(this),this.searchParams=a}};URLState.prototype={type:"URL",parse:function(e,t,r){var n,i,a,o,s=this,u=t||SCHEME_START,c=0,l="",d=!1,h=!1,f=!1;for(e=$toString$2(e),t||(s.scheme="",s.username="",s.password="",s.host=null,s.port=null,s.path=[],s.query=null,s.fragment=null,s.cannotBeABaseURL=!1,e=replace$6(e,LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE,"")),e=replace$6(e,TAB_AND_NEW_LINE,""),n=arrayFrom(e);c<=n.length;){switch(i=n[c],u){case SCHEME_START:if(!i||!exec$5(ALPHA,i)){if(t)return INVALID_SCHEME;u=NO_SCHEME;continue}l+=toLowerCase(i),u=SCHEME;break;case SCHEME:if(i&&(exec$5(ALPHANUMERIC,i)||"+"==i||"-"==i||"."==i))l+=toLowerCase(i);else{if(":"!=i){if(t)return INVALID_SCHEME;l="",u=NO_SCHEME,c=0;continue}if(t&&(s.isSpecial()!=hasOwn$c(specialSchemes,l)||"file"==l&&(s.includesCredentials()||null!==s.port)||"file"==s.scheme&&!s.host))return;if(s.scheme=l,t)return void(s.isSpecial()&&specialSchemes[s.scheme]==s.port&&(s.port=null));l="","file"==s.scheme?u=FILE:s.isSpecial()&&r&&r.scheme==s.scheme?u=SPECIAL_RELATIVE_OR_AUTHORITY:s.isSpecial()?u=SPECIAL_AUTHORITY_SLASHES:"/"==n[c+1]?(u=PATH_OR_AUTHORITY,c++):(s.cannotBeABaseURL=!0,push$7(s.path,""),u=CANNOT_BE_A_BASE_URL_PATH)}break;case NO_SCHEME:if(!r||r.cannotBeABaseURL&&"#"!=i)return INVALID_SCHEME;if(r.cannotBeABaseURL&&"#"==i){s.scheme=r.scheme,s.path=arraySlice$9(r.path),s.query=r.query,s.fragment="",s.cannotBeABaseURL=!0,u=FRAGMENT;break}u="file"==r.scheme?FILE:RELATIVE;continue;case SPECIAL_RELATIVE_OR_AUTHORITY:if("/"!=i||"/"!=n[c+1]){u=RELATIVE;continue}u=SPECIAL_AUTHORITY_IGNORE_SLASHES,c++;break;case PATH_OR_AUTHORITY:if("/"==i){u=AUTHORITY;break}u=PATH;continue;case RELATIVE:if(s.scheme=r.scheme,i==EOF)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=arraySlice$9(r.path),s.query=r.query;else if("/"==i||"\\"==i&&s.isSpecial())u=RELATIVE_SLASH;else if("?"==i)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=arraySlice$9(r.path),s.query="",u=QUERY;else{if("#"!=i){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=arraySlice$9(r.path),s.path.length--,u=PATH;continue}s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=arraySlice$9(r.path),s.query=r.query,s.fragment="",u=FRAGMENT}break;case RELATIVE_SLASH:if(!s.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,u=PATH;continue}u=AUTHORITY}else u=SPECIAL_AUTHORITY_IGNORE_SLASHES;break;case SPECIAL_AUTHORITY_SLASHES:if(u=SPECIAL_AUTHORITY_IGNORE_SLASHES,"/"!=i||"/"!=charAt$6(l,c+1))continue;c++;break;case SPECIAL_AUTHORITY_IGNORE_SLASHES:if("/"!=i&&"\\"!=i){u=AUTHORITY;continue}break;case AUTHORITY:if("@"==i){d&&(l="%40"+l),d=!0,a=arrayFrom(l);for(var p=0;p<a.length;p++){var m=a[p];if(":"!=m||f){var y=percentEncode(m,userinfoPercentEncodeSet);f?s.password+=y:s.username+=y}else f=!0}l=""}else if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&s.isSpecial()){if(d&&""==l)return INVALID_AUTHORITY;c-=arrayFrom(l).length+1,l="",u=HOST}else l+=i;break;case HOST:case HOSTNAME:if(t&&"file"==s.scheme){u=FILE_HOST;continue}if(":"!=i||h){if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&s.isSpecial()){if(s.isSpecial()&&""==l)return INVALID_HOST;if(t&&""==l&&(s.includesCredentials()||null!==s.port))return;if(o=s.parseHost(l))return o;if(l="",u=PATH_START,t)return;continue}"["==i?h=!0:"]"==i&&(h=!1),l+=i}else{if(""==l)return INVALID_HOST;if(o=s.parseHost(l))return o;if(l="",u=PORT,t==HOSTNAME)return}break;case PORT:if(!exec$5(DIGIT,i)){if(i==EOF||"/"==i||"?"==i||"#"==i||"\\"==i&&s.isSpecial()||t){if(""!=l){var g=parseInt$1(l,10);if(g>65535)return INVALID_PORT;s.port=s.isSpecial()&&g===specialSchemes[s.scheme]?null:g,l=""}if(t)return;u=PATH_START;continue}return INVALID_PORT}l+=i;break;case FILE:if(s.scheme="file","/"==i||"\\"==i)u=FILE_SLASH;else{if(!r||"file"!=r.scheme){u=PATH;continue}if(i==EOF)s.host=r.host,s.path=arraySlice$9(r.path),s.query=r.query;else if("?"==i)s.host=r.host,s.path=arraySlice$9(r.path),s.query="",u=QUERY;else{if("#"!=i){startsWithWindowsDriveLetter(join$2(arraySlice$9(n,c),""))||(s.host=r.host,s.path=arraySlice$9(r.path),s.shortenPath()),u=PATH;continue}s.host=r.host,s.path=arraySlice$9(r.path),s.query=r.query,s.fragment="",u=FRAGMENT}}break;case FILE_SLASH:if("/"==i||"\\"==i){u=FILE_HOST;break}r&&"file"==r.scheme&&!startsWithWindowsDriveLetter(join$2(arraySlice$9(n,c),""))&&(isWindowsDriveLetter(r.path[0],!0)?push$7(s.path,r.path[0]):s.host=r.host),u=PATH;continue;case FILE_HOST:if(i==EOF||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&isWindowsDriveLetter(l))u=PATH;else if(""==l){if(s.host="",t)return;u=PATH_START}else{if(o=s.parseHost(l))return o;if("localhost"==s.host&&(s.host=""),t)return;l="",u=PATH_START}continue}l+=i;break;case PATH_START:if(s.isSpecial()){if(u=PATH,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=EOF&&(u=PATH,"/"!=i))continue}else s.fragment="",u=FRAGMENT;else s.query="",u=QUERY;break;case PATH:if(i==EOF||"/"==i||"\\"==i&&s.isSpecial()||!t&&("?"==i||"#"==i)){if(isDoubleDot(l)?(s.shortenPath(),"/"==i||"\\"==i&&s.isSpecial()||push$7(s.path,"")):isSingleDot(l)?"/"==i||"\\"==i&&s.isSpecial()||push$7(s.path,""):("file"==s.scheme&&!s.path.length&&isWindowsDriveLetter(l)&&(s.host&&(s.host=""),l=charAt$6(l,0)+":"),push$7(s.path,l)),l="","file"==s.scheme&&(i==EOF||"?"==i||"#"==i))for(;s.path.length>1&&""===s.path[0];)shift(s.path);"?"==i?(s.query="",u=QUERY):"#"==i&&(s.fragment="",u=FRAGMENT)}else l+=percentEncode(i,pathPercentEncodeSet);break;case CANNOT_BE_A_BASE_URL_PATH:"?"==i?(s.query="",u=QUERY):"#"==i?(s.fragment="",u=FRAGMENT):i!=EOF&&(s.path[0]+=percentEncode(i,C0ControlPercentEncodeSet));break;case QUERY:t||"#"!=i?i!=EOF&&("'"==i&&s.isSpecial()?s.query+="%27":s.query+="#"==i?"%23":percentEncode(i,C0ControlPercentEncodeSet)):(s.fragment="",u=FRAGMENT);break;case FRAGMENT:i!=EOF&&(s.fragment+=percentEncode(i,fragmentPercentEncodeSet))}c++}},parseHost:function(e){var t,r,n;if("["==charAt$6(e,0)){if("]"!=charAt$6(e,e.length-1))return INVALID_HOST;if(!(t=parseIPv6(stringSlice$9(e,1,-1))))return INVALID_HOST;this.host=t}else if(this.isSpecial()){if(e=toASCII(e),exec$5(FORBIDDEN_HOST_CODE_POINT,e))return INVALID_HOST;if(null===(t=parseIPv4(e)))return INVALID_HOST;this.host=t}else{if(exec$5(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT,e))return INVALID_HOST;for(t="",r=arrayFrom(e),n=0;n<r.length;n++)t+=percentEncode(r[n],C0ControlPercentEncodeSet);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return hasOwn$c(specialSchemes,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&isWindowsDriveLetter(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,a=e.port,o=e.path,s=e.query,u=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=serializeHost(i),null!==a&&(c+=":"+a)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?o[0]:o.length?"/"+join$2(o,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw TypeError$4(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new URLConstructor(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+serializeHost(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse($toString$2(e)+":",SCHEME_START)},getUsername:function(){return this.username},setUsername:function(e){var t=arrayFrom($toString$2(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=percentEncode(t[r],userinfoPercentEncodeSet)}},getPassword:function(){return this.password},setPassword:function(e){var t=arrayFrom($toString$2(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=percentEncode(t[r],userinfoPercentEncodeSet)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?serializeHost(e):serializeHost(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,HOST)},getHostname:function(){var e=this.host;return null===e?"":serializeHost(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,HOSTNAME)},getPort:function(){var e=this.port;return null===e?"":$toString$2(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=$toString$2(e))?this.port=null:this.parse(e,PORT))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+join$2(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,PATH_START))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=$toString$2(e))?this.query=null:("?"==charAt$6(e,0)&&(e=stringSlice$9(e,1)),this.query="",this.parse(e,QUERY)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=$toString$2(e))?("#"==charAt$6(e,0)&&(e=stringSlice$9(e,1)),this.fragment="",this.parse(e,FRAGMENT)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var URLConstructor=function(e){var t=anInstance$4(this,URLPrototype),r=validateArgumentsLength$1(arguments.length,1)>1?arguments[1]:void 0,n=setInternalState$4(t,new URLState(e,!1,r));DESCRIPTORS$f||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},URLPrototype=URLConstructor.prototype,accessorDescriptor=function(e,t){return{get:function(){return getInternalURLState(this)[e]()},set:t&&function(e){return getInternalURLState(this)[t](e)},configurable:!0,enumerable:!0}};if(DESCRIPTORS$f&&(defineBuiltInAccessor$2(URLPrototype,"href",accessorDescriptor("serialize","setHref")),defineBuiltInAccessor$2(URLPrototype,"origin",accessorDescriptor("getOrigin")),defineBuiltInAccessor$2(URLPrototype,"protocol",accessorDescriptor("getProtocol","setProtocol")),defineBuiltInAccessor$2(URLPrototype,"username",accessorDescriptor("getUsername","setUsername")),defineBuiltInAccessor$2(URLPrototype,"password",accessorDescriptor("getPassword","setPassword")),defineBuiltInAccessor$2(URLPrototype,"host",accessorDescriptor("getHost","setHost")),defineBuiltInAccessor$2(URLPrototype,"hostname",accessorDescriptor("getHostname","setHostname")),defineBuiltInAccessor$2(URLPrototype,"port",accessorDescriptor("getPort","setPort")),defineBuiltInAccessor$2(URLPrototype,"pathname",accessorDescriptor("getPathname","setPathname")),defineBuiltInAccessor$2(URLPrototype,"search",accessorDescriptor("getSearch","setSearch")),defineBuiltInAccessor$2(URLPrototype,"searchParams",accessorDescriptor("getSearchParams")),defineBuiltInAccessor$2(URLPrototype,"hash",accessorDescriptor("getHash","setHash"))),defineBuiltIn$a(URLPrototype,"toJSON",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),defineBuiltIn$a(URLPrototype,"toString",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),NativeURL){var nativeCreateObjectURL=NativeURL.createObjectURL,nativeRevokeObjectURL=NativeURL.revokeObjectURL;nativeCreateObjectURL&&defineBuiltIn$a(URLConstructor,"createObjectURL",bind$6(nativeCreateObjectURL,NativeURL)),nativeRevokeObjectURL&&defineBuiltIn$a(URLConstructor,"revokeObjectURL",bind$6(nativeRevokeObjectURL,NativeURL))}setToStringTag$3(URLConstructor,"URL"),$$W({global:!0,constructor:!0,forced:!USE_NATIVE_URL,sham:!DESCRIPTORS$f},{URL:URLConstructor});var bind$5=functionBindContext,uncurryThis$B=functionUncurryThis,IndexedObject$3=indexedObject,toObject$b=toObject$h,lengthOfArrayLike$c=lengthOfArrayLike$i,arraySpeciesCreate$1=arraySpeciesCreate$3,push$6=uncurryThis$B([].push),createMethod$5=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,a=6==e,o=7==e,s=5==e||a;return function(u,c,l,d){for(var h,f,p=toObject$b(u),m=IndexedObject$3(p),y=bind$5(c,l),g=lengthOfArrayLike$c(m),v=0,b=d||arraySpeciesCreate$1,_=t?b(u,g):r||o?b(u,0):void 0;g>v;v++)if((s||v in m)&&(f=y(h=m[v],v,p),e))if(t)_[v]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return v;case 2:push$6(_,h)}else switch(e){case 4:return!1;case 7:push$6(_,h)}return a?-1:n||i?i:_}},arrayIteration={forEach:createMethod$5(0),map:createMethod$5(1),filter:createMethod$5(2),some:createMethod$5(3),every:createMethod$5(4),find:createMethod$5(5),findIndex:createMethod$5(6),filterReject:createMethod$5(7)},fails$E=fails$V,arrayMethodIsStrict$8=function(e,t){var r=[][e];return!!r&&fails$E((function(){r.call(null,t||function(){return 1},1)}))},$forEach$2=arrayIteration.forEach,arrayMethodIsStrict$7=arrayMethodIsStrict$8,STRICT_METHOD$7=arrayMethodIsStrict$7("forEach"),arrayForEach=STRICT_METHOD$7?[].forEach:function(e){return $forEach$2(this,e,arguments.length>1?arguments[1]:void 0)},global$r=global$M,DOMIterables=domIterables,DOMTokenListPrototype=domTokenListPrototype,forEach$3=arrayForEach,createNonEnumerableProperty$5=createNonEnumerableProperty$a,handlePrototype=function(e){if(e&&e.forEach!==forEach$3)try{createNonEnumerableProperty$5(e,"forEach",forEach$3)}catch(t){e.forEach=forEach$3}};for(var COLLECTION_NAME in DOMIterables)DOMIterables[COLLECTION_NAME]&&handlePrototype(global$r[COLLECTION_NAME]&&global$r[COLLECTION_NAME].prototype);handlePrototype(DOMTokenListPrototype);var $$V=_export,toObject$a=toObject$h,nativeKeys=objectKeys$4,fails$D=fails$V,FAILS_ON_PRIMITIVES$4=fails$D((function(){nativeKeys(1)}));$$V({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES$4},{keys:function(e){return nativeKeys(toObject$a(e))}});var $$U=_export,isArray$3=isArray$6,isConstructor3=isConstructor$4,isObject$h=isObject$t,toAbsoluteIndex$5=toAbsoluteIndex$8,lengthOfArrayLike$b=lengthOfArrayLike$i,toIndexedObject$7=toIndexedObject$d,createProperty$1=createProperty$5,wellKnownSymbol$a=wellKnownSymbol$u,arrayMethodHasSpeciesSupport$3=arrayMethodHasSpeciesSupport$5,nativeSlice=arraySlice$c,HAS_SPECIES_SUPPORT$3=arrayMethodHasSpeciesSupport$3("slice"),SPECIES$1=wellKnownSymbol$a("species"),$Array$1=Array,max$2=Math.max;$$U({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$3},{slice:function(e,t){var r,n,i,a=toIndexedObject$7(this),o=lengthOfArrayLike$b(a),s=toAbsoluteIndex$5(e,o),u=toAbsoluteIndex$5(void 0===t?o:t,o);if(isArray$3(a)&&(r=a.constructor,(isConstructor3(r)&&(r===$Array$1||isArray$3(r.prototype))||isObject$h(r)&&null===(r=r[SPECIES$1]))&&(r=void 0),r===$Array$1||void 0===r))return nativeSlice(a,s,u);for(n=new(void 0===r?$Array$1:r)(max$2(u-s,0)),i=0;s<u;s++,i++)s in a&&createProperty$1(n,i,a[s]);return n.length=i,n}});var DESCRIPTORS$e=descriptors,isArray$2=isArray$6,$TypeError$6=TypeError,getOwnPropertyDescriptor$2=Object.getOwnPropertyDescriptor,SILENT_ON_NON_WRITABLE_LENGTH_SET=DESCRIPTORS$e&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}(),arraySetLength=SILENT_ON_NON_WRITABLE_LENGTH_SET?function(e,t){if(isArray$2(e)&&!getOwnPropertyDescriptor$2(e,"length").writable)throw $TypeError$6("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},tryToString$2=tryToString$7,$TypeError$5=TypeError,deletePropertyOrThrow$3=function(e,t){if(!delete e[t])throw $TypeError$5("Cannot delete property "+tryToString$2(t)+" of "+tryToString$2(e))},$$T=_export,toObject$9=toObject$h,toAbsoluteIndex$4=toAbsoluteIndex$8,toIntegerOrInfinity$8=toIntegerOrInfinity$c,lengthOfArrayLike$a=lengthOfArrayLike$i,setArrayLength=arraySetLength,doesNotExceedSafeInteger=doesNotExceedSafeInteger$2,arraySpeciesCreate=arraySpeciesCreate$3,createProperty=createProperty$5,deletePropertyOrThrow$2=deletePropertyOrThrow$3,arrayMethodHasSpeciesSupport$2=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT$2=arrayMethodHasSpeciesSupport$2("splice"),max$1=Math.max,min$5=Math.min;$$T({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$2},{splice:function(e,t){var r,n,i,a,o,s,u=toObject$9(this),c=lengthOfArrayLike$a(u),l=toAbsoluteIndex$4(e,c),d=arguments.length;for(0===d?r=n=0:1===d?(r=0,n=c-l):(r=d-2,n=min$5(max$1(toIntegerOrInfinity$8(t),0),c-l)),doesNotExceedSafeInteger(c+r-n),i=arraySpeciesCreate(u,n),a=0;a<n;a++)(o=l+a)in u&&createProperty(i,a,u[o]);if(i.length=n,r<n){for(a=l;a<c-n;a++)s=a+r,(o=a+n)in u?u[s]=u[o]:deletePropertyOrThrow$2(u,s);for(a=c;a>c-n+r;a--)deletePropertyOrThrow$2(u,a-1)}else if(r>n)for(a=c-n;a>l;a--)s=a+r-1,(o=a+n-1)in u?u[s]=u[o]:deletePropertyOrThrow$2(u,s);for(a=0;a<r;a++)u[a+l]=arguments[a+2];return setArrayLength(u,c-n+r),i}});var anObject$9=anObject$m,regexpFlags$1=function(){var e=anObject$9(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},fails$C=fails$V,global$q=global$M,$RegExp$2=global$q.RegExp,UNSUPPORTED_Y$3=fails$C((function(){var e=$RegExp$2("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),MISSED_STICKY$2=UNSUPPORTED_Y$3||fails$C((function(){return!$RegExp$2("a","y").sticky})),BROKEN_CARET=UNSUPPORTED_Y$3||fails$C((function(){var e=$RegExp$2("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),regexpStickyHelpers={BROKEN_CARET:BROKEN_CARET,MISSED_STICKY:MISSED_STICKY$2,UNSUPPORTED_Y:UNSUPPORTED_Y$3},fails$B=fails$V,global$p=global$M,$RegExp$1=global$p.RegExp,regexpUnsupportedDotAll=fails$B((function(){var e=$RegExp$1(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),fails$A=fails$V,global$o=global$M,$RegExp=global$o.RegExp,regexpUnsupportedNcg=fails$A((function(){var e=$RegExp("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),call$d=functionCall,uncurryThis$A=functionUncurryThis,toString$i=toString$l,regexpFlags=regexpFlags$1,stickyHelpers$2=regexpStickyHelpers,shared$3=sharedExports,create$4=objectCreate,getInternalState$5=internalState.get,UNSUPPORTED_DOT_ALL$1=regexpUnsupportedDotAll,UNSUPPORTED_NCG$1=regexpUnsupportedNcg,nativeReplace=shared$3("native-string-replace",String.prototype.replace),nativeExec=RegExp.prototype.exec,patchedExec=nativeExec,charAt$5=uncurryThis$A("".charAt),indexOf=uncurryThis$A("".indexOf),replace$5=uncurryThis$A("".replace),stringSlice$8=uncurryThis$A("".slice),UPDATES_LAST_INDEX_WRONG=function(){var e=/a/,t=/b*/g;return call$d(nativeExec,e,"a"),call$d(nativeExec,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),UNSUPPORTED_Y$2=stickyHelpers$2.BROKEN_CARET,NPCG_INCLUDED=void 0!==/()??/.exec("")[1],PATCH=UPDATES_LAST_INDEX_WRONG||NPCG_INCLUDED||UNSUPPORTED_Y$2||UNSUPPORTED_DOT_ALL$1||UNSUPPORTED_NCG$1;PATCH&&(patchedExec=function(e){var t,r,n,i,a,o,s,u=this,c=getInternalState$5(u),l=toString$i(e),d=c.raw;if(d)return d.lastIndex=u.lastIndex,t=call$d(patchedExec,d,l),u.lastIndex=d.lastIndex,t;var h=c.groups,f=UNSUPPORTED_Y$2&&u.sticky,p=call$d(regexpFlags,u),m=u.source,y=0,g=l;if(f&&(p=replace$5(p,"y",""),-1===indexOf(p,"g")&&(p+="g"),g=stringSlice$8(l,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==charAt$5(l,u.lastIndex-1))&&(m="(?: "+m+")",g=" "+g,y++),r=new RegExp("^(?:"+m+")",p)),NPCG_INCLUDED&&(r=new RegExp("^"+m+"$(?!\\s)",p)),UPDATES_LAST_INDEX_WRONG&&(n=u.lastIndex),i=call$d(nativeExec,f?r:u,g),f?i?(i.input=stringSlice$8(i.input,y),i[0]=stringSlice$8(i[0],y),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:UPDATES_LAST_INDEX_WRONG&&i&&(u.lastIndex=u.global?i.index+i[0].length:n),NPCG_INCLUDED&&i&&i.length>1&&call$d(nativeReplace,i[0],r,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&h)for(i.groups=o=create$4(null),a=0;a<h.length;a++)o[(s=h[a])[0]]=i[s[1]];return i});var regexpExec$3=patchedExec,$$S=_export,exec$4=regexpExec$3;function createPublicPromise$3(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}function nowTime$5(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}$$S({target:"RegExp",proto:!0,forced:/./.exec!==regexpExec$3},{exec:regexpExec$3});var _ERR_CODE$2,Buffer$5=function(){function e(){_classCallCheck$f(this,e)}return _createClass$f(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(e){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var r=[],n=0,i=e.length;n<i;n++){var a=r.length;if(a&&t){var o=r[a-1],s=o[1];if(e.start(n)-s<=t){var u=e.end(n);u>s&&(o[1]=u)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,a=0,o=0,s=0,u=0,c=0,l=0,d=e.buffers(t,n),h=0,f=d.length;h<f;h++){var p=d[h];if(r+n>=p[0]&&r<p[1])i=p[0],a=p[1],o=h;else{if(r+n<p[0]){s=p[0],u=p[1];break}r+n>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:a,index:o,buffers:d,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:r,behind:r-i,remaining:a?a-r:0,length:e.totalLength&&e.totalLength(d)}}}]),e}(),ERR$2={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION"}},ERR_CODE$2=(_defineProperty$d(_ERR_CODE$2={},ERR$2.MANIFEST,{HLS:1100}),_defineProperty$d(_ERR_CODE$2,ERR$2.NETWORK,2100),_defineProperty$d(_ERR_CODE$2,ERR$2.NETWORK_TIMEOUT,2101),_defineProperty$d(_ERR_CODE$2,ERR$2.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400}),_defineProperty$d(_ERR_CODE$2,ERR$2.REMUX,{FMP4:4100,MP4:4200}),_defineProperty$d(_ERR_CODE$2,ERR$2.MEDIA,{MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203}),_defineProperty$d(_ERR_CODE$2,ERR$2.OTHER,8e3),_ERR_CODE$2),StreamingError$2=function(e){_inherits$c(r,_wrapNativeSuper$3(Error));var t=_createSuper$c(r);function r(e,n,i,a,o){var s;return _classCallCheck$f(this,r),(s=t.call(this,o||(null==i?void 0:i.message))).errorType=e===ERR$2.NETWORK_TIMEOUT?ERR$2.NETWORK:e,s.originError=i,s.ext=a,s.errorCode=ERR_CODE$2[e][n]||ERR_CODE$2[e],s.errorMessage=s.message,s.errorCode||(s.errorType=ERR$2.OTHER,s.errorCode=ERR_CODE$2[s.errorType]),s}return _createClass$f(r,null,[{key:"create",value:function(e,t,n,i,a){return e instanceof r?e:(e instanceof Error&&(n=e,e=""),e||(e=ERR$2.OTHER),new r(e,t,n,i,a))}},{key:"network",value:function(e){var t;return new r(null!=e&&e.isTimeout?ERR$2.NETWORK_TIMEOUT:ERR$2.NETWORK,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})}}]),r}(),isBrowser$4="undefined"!=typeof window,DESCRIPTORS$d=descriptors,FUNCTION_NAME_EXISTS=functionName.EXISTS,uncurryThis$z=functionUncurryThis,defineProperty$9=objectDefineProperty.f,FunctionPrototype=Function.prototype,functionToString$1=uncurryThis$z(FunctionPrototype.toString),nameRE=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,regExpExec$2=uncurryThis$z(nameRE.exec),NAME$1="name";DESCRIPTORS$d&&!FUNCTION_NAME_EXISTS&&defineProperty$9(FunctionPrototype,NAME$1,{configurable:!0,get:function(){try{return regExpExec$2(nameRE,functionToString$1(this))[1]}catch(e){return""}}});var $$R=_export,$map$1=arrayIteration.map,arrayMethodHasSpeciesSupport$1=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT$1=arrayMethodHasSpeciesSupport$1("map");$$R({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$1},{map:function(e){return $map$1(this,e,arguments.length>1?arguments[1]:void 0)}});var $$Q=_export,getBuiltIn$4=getBuiltIn$d,apply$7=functionApply,call$c=functionCall,uncurryThis$y=functionUncurryThis,fails$z=fails$V,isArray$1=isArray$6,isCallable$9=isCallable$v,isObject$g=isObject$t,isSymbol$3=isSymbol$6,arraySlice$8=arraySlice$c,NATIVE_SYMBOL$4=symbolConstructorDetection,$stringify=getBuiltIn$4("JSON","stringify"),exec$3=uncurryThis$y(/./.exec),charAt$4=uncurryThis$y("".charAt),charCodeAt$1=uncurryThis$y("".charCodeAt),replace$4=uncurryThis$y("".replace),numberToString=uncurryThis$y(1..toString),tester=/[\uD800-\uDFFF]/g,low=/^[\uD800-\uDBFF]$/,hi=/^[\uDC00-\uDFFF]$/,WRONG_SYMBOLS_CONVERSION=!NATIVE_SYMBOL$4||fails$z((function(){var e=getBuiltIn$4("Symbol")();return"[null]"!=$stringify([e])||"{}"!=$stringify({a:e})||"{}"!=$stringify(Object(e))})),ILL_FORMED_UNICODE=fails$z((function(){return'"\\udf06\\ud834"'!==$stringify("\udf06\ud834")||'"\\udead"'!==$stringify("\udead")})),stringifyWithSymbolsFix=function(e,t){var r=arraySlice$8(arguments),n=t;if((isObject$g(t)||void 0!==e)&&!isSymbol$3(e))return isArray$1(t)||(t=function(e,t){if(isCallable$9(n)&&(t=call$c(n,this,e,t)),!isSymbol$3(t))return t}),r[1]=t,apply$7($stringify,null,r)},fixIllFormed=function(e,t,r){var n=charAt$4(r,t-1),i=charAt$4(r,t+1);return exec$3(low,e)&&!exec$3(hi,i)||exec$3(hi,e)&&!exec$3(low,n)?"\\u"+numberToString(charCodeAt$1(e,0),16):e};$stringify&&$$Q({target:"JSON",stat:!0,arity:3,forced:WRONG_SYMBOLS_CONVERSION||ILL_FORMED_UNICODE},{stringify:function(e,t,r){var n=arraySlice$8(arguments),i=apply$7(WRONG_SYMBOLS_CONVERSION?stringifyWithSymbolsFix:$stringify,null,n);return ILL_FORMED_UNICODE&&"string"==typeof i?replace$4(i,tester,fixIllFormed):i}});var $$P=_export,uncurryThis$x=functionUncurryThis,IndexedObject$2=indexedObject,toIndexedObject$6=toIndexedObject$d,arrayMethodIsStrict$6=arrayMethodIsStrict$8,nativeJoin=uncurryThis$x([].join),ES3_STRINGS=IndexedObject$2!=Object,STRICT_METHOD$6=arrayMethodIsStrict$6("join",",");$$P({target:"Array",proto:!0,forced:ES3_STRINGS||!STRICT_METHOD$6},{join:function(e){return nativeJoin(toIndexedObject$6(this),void 0===e?",":e)}});var $$O=_export,$includes$1=arrayIncludes.includes,fails$y=fails$V,addToUnscopables$3=addToUnscopables$5,BROKEN_ON_SPARSE=fails$y((function(){return!Array(1).includes()}));$$O({target:"Array",proto:!0,forced:BROKEN_ON_SPARSE},{includes:function(e){return $includes$1(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables$3("includes");var LogCacheLevel$1={DEBUG:1,LOG:2,WARN:3,ERROR:4},LOG_MAX_SIZE$1=204800,SIMPLE_TYPE$1=["Boolean","Number","String","Undefined","Null","Date","Object"],Logger$9=function(){function e(t,r){_classCallCheck$f(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=(null==r?void 0:r.disabled)||!0,this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||LOG_MAX_SIZE$1,this.logSize=0,this.logTextArray=[]}return _createClass$f(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel$1.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,[this._prefix,nowTime$4()].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel$1.LOG].concat(n)),e.disabled||(t=console).log.apply(t,[this._prefix,nowTime$4()].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel$1.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,[this._prefix,nowTime$4()].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel$1.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,[this._prefix,nowTime$4()].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var a=n.map((function(e){return logable$1(e)}));t=this._prefix+nowTime$4()+JSON.stringify(a)}catch(e){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var o=this.logTextArray.shift();this.logSize-=o.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function nowTime$4(){return(new Date).toLocaleString()}function reduceDepth$1(e){if("object"!==_typeof$6(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function logable$1(e,t,r){r||(r=1),t||(t=2);var n={};if(!e||"object"!==_typeof$6(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!SIMPLE_TYPE$1.includes(i))return i;if(!(r>t)){for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r===t?n[a]=reduceDepth$1(e[a]):"object"===_typeof$6(e[a])?n[a]=logable$1(e[a],t,r+1):n[a]=e[a]);return n}}function getMediaSource$1(){try{return isBrowser$4?window.MediaSource:null}catch(e){}}_defineProperty$d(Logger$9,"disabled",!0);var MediaSource$2=getMediaSource$1(),OP_NAME$2={APPEND:"appendBuffer",REMOVE:"removeBuffer"},MSE$2=function(){function e(t,r){var n=this;_classCallCheck$f(this,e),_defineProperty$d(this,"media",null),_defineProperty$d(this,"mediaSource",null),_defineProperty$d(this,"_openPromise",createPublicPromise$3()),_defineProperty$d(this,"_queue",Object.create(null)),_defineProperty$d(this,"_sourceBuffer",Object.create(null)),_defineProperty$d(this,"_mseFullFlag",{}),_defineProperty$d(this,"_st",0),_defineProperty$d(this,"_opst",0),_defineProperty$d(this,"_logger",null),_defineProperty$d(this,"_config",null),_defineProperty$d(this,"_url",null),_defineProperty$d(this,"_onSBUpdateEnd",(function(e){var t=n._queue[e];if(t){var r=t.shift();if(r){var i=nowTime$5()-n._opst;n._logger.debug("UpdateEnd",r.opName,i,r.context),r.promise.resolve({name:r.opName,context:r.context,costtime:i}),n._startQueue(e)}}})),_defineProperty$d(this,"_onSBUpdateError",(function(e,t){var r=n._queue[e];if(r){var i=r[0];i&&(n._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new StreamingError$2(ERR$2.MEDIA,ERR$2.SUB_TYPES.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),r),t&&this.bindMedia(t),this._logger=new Logger$9("MSE"),this._config.openLog&&Logger$9.enable()}var t,r,n;return _createClass$f(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this;return this.mediaSource&&this.mediaSource.duration>e?Promise.resolve():this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("[debug mse] setDuration ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("[debug mse] setDuration"))}),"updateDuration")}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function r(){var n=nowTime$5()-e._st;e._logger.debug("MSE OPEN",n),t.removeEventListener("sourceopen",r),e._openPromise.resolve({costtime:n})})),this._openPromise=createPublicPromise$3()}return this._openPromise}},{key:"bindMedia",value:(n=_asyncToGenerator$8(_regeneratorRuntime$8().mark((function e(t){var r,n,i=this;return _regeneratorRuntime$8().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(t&&MediaSource$2){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,r=this.mediaSource=new MediaSource$2,this._st=nowTime$5(),n=function e(){var n=nowTime$5()-i._st;i._logger.debug("MSE OPEN"),r.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),i._openPromise.resolve({costtime:n})},r.addEventListener("sourceopen",n),this._url=URL.createObjectURL(r),t.src=this._url,e.abrupt("return",this._openPromise);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unbindMedia",value:(r=_asyncToGenerator$8(_regeneratorRuntime$8().mark((function e(){var t,r,n,i=this;return _regeneratorRuntime$8().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){return e.promise.resolve}))})),r=!!this.media&&this.media.readyState>=1,n="open"===t.readyState,r&&n)try{t.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(e){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(e){}this.media=null}this.mediaSource=null,this._openPromise=createPublicPromise$3(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(e){throw new StreamingError$2(ERR$2.MEDIA,ERR$2.SUB_TYPES.MSE_ADD_SB,e)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var r=this,n=this._sourceBuffer[e];return this.mediaSource&&n&&n.mimeType!==t&&"function"==typeof n.changeType?this._enqueueOp(e,(function(){n.changeType(t),n.mimeType=t,r._onSBUpdateEnd(e)})):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,r){var n=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;n.mediaSource&&(n._logger.debug("MSE APPEND START",r),n._opst=nowTime$5(),null===(i=n._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),OP_NAME$2.APPEND,r):Promise.resolve()}},{key:"remove",value:function(e,t,r,n){var i=this,a=!1;return this._mseFullFlag[e]&&(a=!0),this._enqueueOp(e,(function(){if(i.mediaSource){var a=i._sourceBuffer[e];t>=r||!a?i._onSBUpdateEnd(e):(i._opst=nowTime$5(),i._logger.debug("MSE REMOVE START",e,t,r,n),a.remove(t,r))}}),OP_NAME$2.REMOVE,n,a)}},{key:"clearBuffer",value:function(e,t){var r,n=this;return Object.keys(this._sourceBuffer).forEach((function(i){r=n._enqueueOp(i,(function(){if(n.mediaSource){var r=n._sourceBuffer[i];n._logger.debug("MSE clearBuffer START",i,e,t),r.remove(e,t)}}))})),r}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(r){e=t._enqueueOp(r,(function(){if(t.mediaSource){var e=t._sourceBuffer[r];t._logger.debug("MSE clearAllBuffer START",r),e.remove(0,Buffer$5.end(Buffer$5.get(e)))}}))})),e}},{key:"clearOpQueues",value:function(e){var t;this._logger.debug("MSE clearOpQueue START");var r=this._queue[e];if(r&&r[e]&&!(r.length<5)){var n=[];r.forEach((function(e){e.context&&e.context.isinit&&n.push(e)})),this._queue[e]=r.slice(0,2),n.length>0&&(t=this._queue[e]).push.apply(t,n)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var r=t.mediaSource;r&&"open"===r.readyState&&(t._logger.debug("MSE endOfStream START"),e?r.endOfStream(e):r.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var r=this.mediaSource;e<0||t<e||null==r||!r.setLiveSeekableRange||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return Buffer$5.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return Buffer$5.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return Buffer$5.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,r,n,i){var a=this;if(!this.mediaSource)return Promise.resolve();var o=this._queue[e]=this._queue[e]||[],s={exec:t,promise:createPublicPromise$3(),opName:r,context:n};return i?(o.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):o.push(s),this.isOpened?1===o.length&&this._startQueue(e):this._openPromise.then((function(){1===o.length&&a._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=_asyncToGenerator$8(_regeneratorRuntime$8().mark((function e(t,r){var n,i,a=this;return _regeneratorRuntime$8().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((n=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return i=[],n.forEach((function(e){var t=a._queue[e],n=createPublicPromise$3();i.push(n),t.push({exec:function(){return n.resolve()},promise:n,opName:r}),1===t.length&&a._startQueue(e)})),e.abrupt("return",Promise.all(i).then((function(){try{return t()}finally{n.forEach((function(e){var t=a._queue[e],r=a._sourceBuffer[e];null==t||t.shift(),r&&r.updating||a._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var r=t[0];if(r&&!this._mseFullFlag[e])try{r.exec()}catch(n){n&&n.message&&n.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,this._logger.error("[MSE error], context,",r.context," ,name,",r.opName,",err,SourceBuffer is full"),r.promise.reject(new StreamingError$2(ERR$2.MEDIA,ERR$2.SUB_TYPES.MSE_FULL,n))):(this._logger.error(n),r.promise.reject(new StreamingError$2(ERR$2.MEDIA,ERR$2.SUB_TYPES.MSE_OTHER,n)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,r){var n=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),n._sourceBuffer[e].timestampOffset=t,n._onSBUpdateEnd(e)}),"setTimeoffset",r)}},{key:"abort",value:function(e,t){var r=this;return this.isOpened?this._enqueueOp(e,(function(){r._sourceBuffer[e].abort(),r._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"getDefaultConfig",value:function(){return{openLog:!1}}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(!MediaSource$2)return!1;try{return MediaSource$2.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}}]),e}();_defineProperty$d(MSE$2,"VIDEO","video"),_defineProperty$d(MSE$2,"AUDIO","audio");var $$N=_export,NativePromiseConstructor=promiseNativeConstructor,fails$x=fails$V,getBuiltIn$3=getBuiltIn$d,isCallable$8=isCallable$v,speciesConstructor$3=speciesConstructor$5,promiseResolve=promiseResolve$2,defineBuiltIn$9=defineBuiltIn$j,NativePromisePrototype=NativePromiseConstructor&&NativePromiseConstructor.prototype,NON_GENERIC=!!NativePromiseConstructor&&fails$x((function(){NativePromisePrototype.finally.call({then:function(){}},(function(){}))}));if($$N({target:"Promise",proto:!0,real:!0,forced:NON_GENERIC},{finally:function(e){var t=speciesConstructor$3(this,getBuiltIn$3("Promise")),r=isCallable$8(e);return this.then(r?function(r){return promiseResolve(t,e()).then((function(){return r}))}:e,r?function(r){return promiseResolve(t,e()).then((function(){throw r}))}:e)}}),isCallable$8(NativePromiseConstructor)){var method=getBuiltIn$3("Promise").prototype.finally;NativePromisePrototype.finally!==method&&defineBuiltIn$9(NativePromisePrototype,"finally",method,{unsafe:!0})}var $$M=_export,$filter$1=arrayIteration.filter,arrayMethodHasSpeciesSupport=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT=arrayMethodHasSpeciesSupport("filter");$$M({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT},{filter:function(e){return $filter$1(this,e,arguments.length>1?arguments[1]:void 0)}});var NAME,Constructor,Prototype,typedArrayConstructor={exports:{}},arrayBufferBasicDetection="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,NATIVE_ARRAY_BUFFER$1=arrayBufferBasicDetection,DESCRIPTORS$c=descriptors,global$n=global$M,isCallable$7=isCallable$v,isObject$f=isObject$t,hasOwn$b=hasOwnProperty_1,classof$8=classof$f,tryToString$1=tryToString$7,createNonEnumerableProperty$4=createNonEnumerableProperty$a,defineBuiltIn$8=defineBuiltIn$j,defineProperty$8=objectDefineProperty.f,isPrototypeOf$6=objectIsPrototypeOf,getPrototypeOf$1=objectGetPrototypeOf,setPrototypeOf$3=objectSetPrototypeOf,wellKnownSymbol$9=wellKnownSymbol$u,uid$2=uid$5,InternalStateModule$4=internalState,enforceInternalState$2=InternalStateModule$4.enforce,getInternalState$4=InternalStateModule$4.get,Int8Array$4=global$n.Int8Array,Int8ArrayPrototype$1=Int8Array$4&&Int8Array$4.prototype,Uint8ClampedArray$1=global$n.Uint8ClampedArray,Uint8ClampedArrayPrototype=Uint8ClampedArray$1&&Uint8ClampedArray$1.prototype,TypedArray$1=Int8Array$4&&getPrototypeOf$1(Int8Array$4),TypedArrayPrototype$2=Int8ArrayPrototype$1&&getPrototypeOf$1(Int8ArrayPrototype$1),ObjectPrototype$3=Object.prototype,TypeError$3=global$n.TypeError,TO_STRING_TAG=wellKnownSymbol$9("toStringTag"),TYPED_ARRAY_TAG$1=uid$2("TYPED_ARRAY_TAG"),TYPED_ARRAY_CONSTRUCTOR="TypedArrayConstructor",NATIVE_ARRAY_BUFFER_VIEWS$2=NATIVE_ARRAY_BUFFER$1&&!!setPrototypeOf$3&&"Opera"!==classof$8(global$n.opera),TYPED_ARRAY_TAG_REQUIRED=!1,TypedArrayConstructorsList={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},BigIntArrayConstructorsList={BigInt64Array:8,BigUint64Array:8},isView=function(e){if(!isObject$f(e))return!1;var t=classof$8(e);return"DataView"===t||hasOwn$b(TypedArrayConstructorsList,t)||hasOwn$b(BigIntArrayConstructorsList,t)},getTypedArrayConstructor$1=function(e){var t=getPrototypeOf$1(e);if(isObject$f(t)){var r=getInternalState$4(t);return r&&hasOwn$b(r,TYPED_ARRAY_CONSTRUCTOR)?r[TYPED_ARRAY_CONSTRUCTOR]:getTypedArrayConstructor$1(t)}},isTypedArray$1=function(e){if(!isObject$f(e))return!1;var t=classof$8(e);return hasOwn$b(TypedArrayConstructorsList,t)||hasOwn$b(BigIntArrayConstructorsList,t)},aTypedArray$p=function(e){if(isTypedArray$1(e))return e;throw TypeError$3("Target is not a typed array")},aTypedArrayConstructor$4=function(e){if(isCallable$7(e)&&(!setPrototypeOf$3||isPrototypeOf$6(TypedArray$1,e)))return e;throw TypeError$3(tryToString$1(e)+" is not a typed array constructor")},exportTypedArrayMethod$q=function(e,t,r,n){if(DESCRIPTORS$c){if(r)for(var i in TypedArrayConstructorsList){var a=global$n[i];if(a&&hasOwn$b(a.prototype,e))try{delete a.prototype[e]}catch(r){try{a.prototype[e]=t}catch(e){}}}TypedArrayPrototype$2[e]&&!r||defineBuiltIn$8(TypedArrayPrototype$2,e,r?t:NATIVE_ARRAY_BUFFER_VIEWS$2&&Int8ArrayPrototype$1[e]||t,n)}},exportTypedArrayStaticMethod$1=function(e,t,r){var n,i;if(DESCRIPTORS$c){if(setPrototypeOf$3){if(r)for(n in TypedArrayConstructorsList)if((i=global$n[n])&&hasOwn$b(i,e))try{delete i[e]}catch(e){}if(TypedArray$1[e]&&!r)return;try{return defineBuiltIn$8(TypedArray$1,e,r?t:NATIVE_ARRAY_BUFFER_VIEWS$2&&TypedArray$1[e]||t)}catch(e){}}for(n in TypedArrayConstructorsList)!(i=global$n[n])||i[e]&&!r||defineBuiltIn$8(i,e,t)}};for(NAME in TypedArrayConstructorsList)(Prototype=(Constructor=global$n[NAME])&&Constructor.prototype)?enforceInternalState$2(Prototype)[TYPED_ARRAY_CONSTRUCTOR]=Constructor:NATIVE_ARRAY_BUFFER_VIEWS$2=!1;for(NAME in BigIntArrayConstructorsList)(Prototype=(Constructor=global$n[NAME])&&Constructor.prototype)&&(enforceInternalState$2(Prototype)[TYPED_ARRAY_CONSTRUCTOR]=Constructor);if((!NATIVE_ARRAY_BUFFER_VIEWS$2||!isCallable$7(TypedArray$1)||TypedArray$1===Function.prototype)&&(TypedArray$1=function(){throw TypeError$3("Incorrect invocation")},NATIVE_ARRAY_BUFFER_VIEWS$2))for(NAME in TypedArrayConstructorsList)global$n[NAME]&&setPrototypeOf$3(global$n[NAME],TypedArray$1);if((!NATIVE_ARRAY_BUFFER_VIEWS$2||!TypedArrayPrototype$2||TypedArrayPrototype$2===ObjectPrototype$3)&&(TypedArrayPrototype$2=TypedArray$1.prototype,NATIVE_ARRAY_BUFFER_VIEWS$2))for(NAME in TypedArrayConstructorsList)global$n[NAME]&&setPrototypeOf$3(global$n[NAME].prototype,TypedArrayPrototype$2);if(NATIVE_ARRAY_BUFFER_VIEWS$2&&getPrototypeOf$1(Uint8ClampedArrayPrototype)!==TypedArrayPrototype$2&&setPrototypeOf$3(Uint8ClampedArrayPrototype,TypedArrayPrototype$2),DESCRIPTORS$c&&!hasOwn$b(TypedArrayPrototype$2,TO_STRING_TAG))for(NAME in TYPED_ARRAY_TAG_REQUIRED=!0,defineProperty$8(TypedArrayPrototype$2,TO_STRING_TAG,{get:function(){return isObject$f(this)?this[TYPED_ARRAY_TAG$1]:void 0}}),TypedArrayConstructorsList)global$n[NAME]&&createNonEnumerableProperty$4(global$n[NAME],TYPED_ARRAY_TAG$1,NAME);var arrayBufferViewCore={NATIVE_ARRAY_BUFFER_VIEWS:NATIVE_ARRAY_BUFFER_VIEWS$2,TYPED_ARRAY_TAG:TYPED_ARRAY_TAG_REQUIRED&&TYPED_ARRAY_TAG$1,aTypedArray:aTypedArray$p,aTypedArrayConstructor:aTypedArrayConstructor$4,exportTypedArrayMethod:exportTypedArrayMethod$q,exportTypedArrayStaticMethod:exportTypedArrayStaticMethod$1,getTypedArrayConstructor:getTypedArrayConstructor$1,isView:isView,isTypedArray:isTypedArray$1,TypedArray:TypedArray$1,TypedArrayPrototype:TypedArrayPrototype$2},global$m=global$M,fails$w=fails$V,checkCorrectnessOfIteration$2=checkCorrectnessOfIteration$4,NATIVE_ARRAY_BUFFER_VIEWS$1=arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS,ArrayBuffer$4=global$m.ArrayBuffer,Int8Array$3=global$m.Int8Array,typedArrayConstructorsRequireWrappers=!NATIVE_ARRAY_BUFFER_VIEWS$1||!fails$w((function(){Int8Array$3(1)}))||!fails$w((function(){new Int8Array$3(-1)}))||!checkCorrectnessOfIteration$2((function(e){new Int8Array$3,new Int8Array$3(null),new Int8Array$3(1.5),new Int8Array$3(e)}),!0)||fails$w((function(){return 1!==new Int8Array$3(new ArrayBuffer$4(2),1,void 0).length})),toIntegerOrInfinity$7=toIntegerOrInfinity$c,toLength$9=toLength$b,$RangeError$4=RangeError,toIndex$2=function(e){if(void 0===e)return 0;var t=toIntegerOrInfinity$7(e),r=toLength$9(t);if(t!==r)throw $RangeError$4("Wrong length or index");return r},$Array=Array,abs$1=Math.abs,pow$2=Math.pow,floor$5=Math.floor,log$3=Math.log,LN2=Math.LN2,pack=function(e,t,r){var n,i,a,o=$Array(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,l=23===t?pow$2(2,-24)-pow$2(2,-77):0,d=e<0||0===e&&1/e<0?1:0,h=0;for((e=abs$1(e))!=e||e===1/0?(i=e!=e?1:0,n=u):(n=floor$5(log$3(e)/LN2),e*(a=pow$2(2,-n))<1&&(n--,a*=2),(e+=n+c>=1?l/a:l*pow$2(2,1-c))*a>=2&&(n++,a/=2),n+c>=u?(i=0,n=u):n+c>=1?(i=(e*a-1)*pow$2(2,t),n+=c):(i=e*pow$2(2,c-1)*pow$2(2,t),n=0));t>=8;)o[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)o[h++]=255&n,n/=256,s-=8;return o[--h]|=128*d,o},unpack=function(e,t){var r,n=e.length,i=8*n-t-1,a=(1<<i)-1,o=a>>1,s=i-7,u=n-1,c=e[u--],l=127&c;for(c>>=7;s>0;)l=256*l+e[u--],s-=8;for(r=l&(1<<-s)-1,l>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===l)l=1-o;else{if(l===a)return r?NaN:c?-1/0:1/0;r+=pow$2(2,t),l-=o}return(c?-1:1)*r*pow$2(2,l-t)},ieee754={pack:pack,unpack:unpack},toObject$8=toObject$h,toAbsoluteIndex$3=toAbsoluteIndex$8,lengthOfArrayLike$9=lengthOfArrayLike$i,arrayFill$1=function(e){for(var t=toObject$8(this),r=lengthOfArrayLike$9(t),n=arguments.length,i=toAbsoluteIndex$3(n>1?arguments[1]:void 0,r),a=n>2?arguments[2]:void 0,o=void 0===a?r:toAbsoluteIndex$3(a,r);o>i;)t[i++]=e;return t},global$l=global$M,uncurryThis$w=functionUncurryThis,DESCRIPTORS$b=descriptors,NATIVE_ARRAY_BUFFER=arrayBufferBasicDetection,FunctionName=functionName,createNonEnumerableProperty$3=createNonEnumerableProperty$a,defineBuiltIns$1=defineBuiltIns$3,fails$v=fails$V,anInstance$3=anInstance$7,toIntegerOrInfinity$6=toIntegerOrInfinity$c,toLength$8=toLength$b,toIndex$1=toIndex$2,IEEE754=ieee754,getPrototypeOf=objectGetPrototypeOf,setPrototypeOf$2=objectSetPrototypeOf,getOwnPropertyNames$4=objectGetOwnPropertyNames.f,defineProperty$7=objectDefineProperty.f,arrayFill=arrayFill$1,arraySlice$7=arraySliceSimple,setToStringTag$2=setToStringTag$8,InternalStateModule$3=internalState,PROPER_FUNCTION_NAME$2=FunctionName.PROPER,CONFIGURABLE_FUNCTION_NAME=FunctionName.CONFIGURABLE,getInternalState$3=InternalStateModule$3.get,setInternalState$3=InternalStateModule$3.set,ARRAY_BUFFER$1="ArrayBuffer",DATA_VIEW="DataView",PROTOTYPE$1="prototype",WRONG_LENGTH$1="Wrong length",WRONG_INDEX="Wrong index",NativeArrayBuffer$1=global$l[ARRAY_BUFFER$1],$ArrayBuffer=NativeArrayBuffer$1,ArrayBufferPrototype$1=$ArrayBuffer&&$ArrayBuffer[PROTOTYPE$1],$DataView=global$l[DATA_VIEW],DataViewPrototype$1=$DataView&&$DataView[PROTOTYPE$1],ObjectPrototype$2=Object.prototype,Array$1=global$l.Array,RangeError$3=global$l.RangeError,fill$1=uncurryThis$w(arrayFill),reverse=uncurryThis$w([].reverse),packIEEE754=IEEE754.pack,unpackIEEE754=IEEE754.unpack,packInt8=function(e){return[255&e]},packInt16=function(e){return[255&e,e>>8&255]},packInt32=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},unpackInt32=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},packFloat32=function(e){return packIEEE754(e,23,4)},packFloat64=function(e){return packIEEE754(e,52,8)},addGetter$1=function(e,t){defineProperty$7(e[PROTOTYPE$1],t,{get:function(){return getInternalState$3(this)[t]}})},get2=function(e,t,r,n){var i=toIndex$1(r),a=getInternalState$3(e);if(i+t>a.byteLength)throw RangeError$3(WRONG_INDEX);var o=getInternalState$3(a.buffer).bytes,s=i+a.byteOffset,u=arraySlice$7(o,s,s+t);return n?u:reverse(u)},set2=function(e,t,r,n,i,a){var o=toIndex$1(r),s=getInternalState$3(e);if(o+t>s.byteLength)throw RangeError$3(WRONG_INDEX);for(var u=getInternalState$3(s.buffer).bytes,c=o+s.byteOffset,l=n(+i),d=0;d<t;d++)u[c+d]=l[a?d:t-d-1]};if(NATIVE_ARRAY_BUFFER){var INCORRECT_ARRAY_BUFFER_NAME=PROPER_FUNCTION_NAME$2&&NativeArrayBuffer$1.name!==ARRAY_BUFFER$1;if(fails$v((function(){NativeArrayBuffer$1(1)}))&&fails$v((function(){new NativeArrayBuffer$1(-1)}))&&!fails$v((function(){return new NativeArrayBuffer$1,new NativeArrayBuffer$1(1.5),new NativeArrayBuffer$1(NaN),1!=NativeArrayBuffer$1.length||INCORRECT_ARRAY_BUFFER_NAME&&!CONFIGURABLE_FUNCTION_NAME})))INCORRECT_ARRAY_BUFFER_NAME&&CONFIGURABLE_FUNCTION_NAME&&createNonEnumerableProperty$3(NativeArrayBuffer$1,"name",ARRAY_BUFFER$1);else{($ArrayBuffer=function(e){return anInstance$3(this,ArrayBufferPrototype$1),new NativeArrayBuffer$1(toIndex$1(e))})[PROTOTYPE$1]=ArrayBufferPrototype$1;for(var key$1,keys$3=getOwnPropertyNames$4(NativeArrayBuffer$1),j$1=0;keys$3.length>j$1;)(key$1=keys$3[j$1++])in $ArrayBuffer||createNonEnumerableProperty$3($ArrayBuffer,key$1,NativeArrayBuffer$1[key$1]);ArrayBufferPrototype$1.constructor=$ArrayBuffer}setPrototypeOf$2&&getPrototypeOf(DataViewPrototype$1)!==ObjectPrototype$2&&setPrototypeOf$2(DataViewPrototype$1,ObjectPrototype$2);var testView=new $DataView(new $ArrayBuffer(2)),$setInt8=uncurryThis$w(DataViewPrototype$1.setInt8);testView.setInt8(0,2147483648),testView.setInt8(1,2147483649),!testView.getInt8(0)&&testView.getInt8(1)||defineBuiltIns$1(DataViewPrototype$1,{setInt8:function(e,t){$setInt8(this,e,t<<24>>24)},setUint8:function(e,t){$setInt8(this,e,t<<24>>24)}},{unsafe:!0})}else ArrayBufferPrototype$1=($ArrayBuffer=function(e){anInstance$3(this,ArrayBufferPrototype$1);var t=toIndex$1(e);setInternalState$3(this,{bytes:fill$1(Array$1(t),0),byteLength:t}),DESCRIPTORS$b||(this.byteLength=t)})[PROTOTYPE$1],DataViewPrototype$1=($DataView=function(e,t,r){anInstance$3(this,DataViewPrototype$1),anInstance$3(e,ArrayBufferPrototype$1);var n=getInternalState$3(e).byteLength,i=toIntegerOrInfinity$6(t);if(i<0||i>n)throw RangeError$3("Wrong offset");if(i+(r=void 0===r?n-i:toLength$8(r))>n)throw RangeError$3(WRONG_LENGTH$1);setInternalState$3(this,{buffer:e,byteLength:r,byteOffset:i}),DESCRIPTORS$b||(this.buffer=e,this.byteLength=r,this.byteOffset=i)})[PROTOTYPE$1],DESCRIPTORS$b&&(addGetter$1($ArrayBuffer,"byteLength"),addGetter$1($DataView,"buffer"),addGetter$1($DataView,"byteLength"),addGetter$1($DataView,"byteOffset")),defineBuiltIns$1(DataViewPrototype$1,{getInt8:function(e){return get2(this,1,e)[0]<<24>>24},getUint8:function(e){return get2(this,1,e)[0]},getInt16:function(e){var t=get2(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=get2(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return unpackInt32(get2(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return unpackInt32(get2(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return unpackIEEE754(get2(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return unpackIEEE754(get2(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){set2(this,1,e,packInt8,t)},setUint8:function(e,t){set2(this,1,e,packInt8,t)},setInt16:function(e,t){set2(this,2,e,packInt16,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){set2(this,2,e,packInt16,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){set2(this,4,e,packInt32,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){set2(this,4,e,packInt32,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){set2(this,4,e,packFloat32,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){set2(this,8,e,packFloat64,t,arguments.length>2?arguments[2]:void 0)}});setToStringTag$2($ArrayBuffer,ARRAY_BUFFER$1),setToStringTag$2($DataView,DATA_VIEW);var arrayBuffer={ArrayBuffer:$ArrayBuffer,DataView:$DataView},isObject$e=isObject$t,floor$4=Math.floor,isIntegralNumber$1=Number.isInteger||function(e){return!isObject$e(e)&&isFinite(e)&&floor$4(e)===e},toIntegerOrInfinity$5=toIntegerOrInfinity$c,$RangeError$3=RangeError,toPositiveInteger$1=function(e){var t=toIntegerOrInfinity$5(e);if(t<0)throw $RangeError$3("The argument can't be less than 0");return t},toPositiveInteger=toPositiveInteger$1,$RangeError$2=RangeError,toOffset$2=function(e,t){var r=toPositiveInteger(e);if(r%t)throw $RangeError$2("Wrong offset");return r},classof$7=classof$f,uncurryThis$v=functionUncurryThis,slice$1=uncurryThis$v("".slice),isBigIntArray$1=function(e){return"Big"===slice$1(classof$7(e),0,3)},toPrimitive$1=toPrimitive$3,$TypeError$4=TypeError,toBigInt$2=function(e){var t=toPrimitive$1(e,"number");if("number"==typeof t)throw $TypeError$4("Can't convert number to bigint");return BigInt(t)},bind$4=functionBindContext,call$b=functionCall,aConstructor$1=aConstructor$3,toObject$7=toObject$h,lengthOfArrayLike$8=lengthOfArrayLike$i,getIterator=getIterator$4,getIteratorMethod=getIteratorMethod$5,isArrayIteratorMethod=isArrayIteratorMethod$3,isBigIntArray=isBigIntArray$1,aTypedArrayConstructor$3=arrayBufferViewCore.aTypedArrayConstructor,toBigInt$1=toBigInt$2,typedArrayFrom$1=function(e){var t,r,n,i,a,o,s,u,c=aConstructor$1(this),l=toObject$7(e),d=arguments.length,h=d>1?arguments[1]:void 0,f=void 0!==h,p=getIteratorMethod(l);if(p&&!isArrayIteratorMethod(p))for(u=(s=getIterator(l,p)).next,l=[];!(o=call$b(u,s)).done;)l.push(o.value);for(f&&d>2&&(h=bind$4(h,arguments[2])),r=lengthOfArrayLike$8(l),n=new(aTypedArrayConstructor$3(c))(r),i=isBigIntArray(n),t=0;r>t;t++)a=f?h(l[t],t):l[t],n[t]=i?toBigInt$1(a):+a;return n},isCallable$6=isCallable$v,isObject$d=isObject$t,setPrototypeOf$1=objectSetPrototypeOf,inheritIfRequired$4=function(e,t,r){var n,i;return setPrototypeOf$1&&isCallable$6(n=t.constructor)&&n!==r&&isObject$d(i=n.prototype)&&i!==r.prototype&&setPrototypeOf$1(e,i),e},$$L=_export,global$k=global$M,call$a=functionCall,DESCRIPTORS$a=descriptors,TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS$1=typedArrayConstructorsRequireWrappers,ArrayBufferViewCore$r=arrayBufferViewCore,ArrayBufferModule$1=arrayBuffer,anInstance$2=anInstance$7,createPropertyDescriptor$1=createPropertyDescriptor$7,createNonEnumerableProperty$2=createNonEnumerableProperty$a,isIntegralNumber=isIntegralNumber$1,toLength$7=toLength$b,toIndex=toIndex$2,toOffset$1=toOffset$2,toPropertyKey$1=toPropertyKey$5,hasOwn$a=hasOwnProperty_1,classof$6=classof$f,isObject$c=isObject$t,isSymbol$2=isSymbol$6,create$3=objectCreate,isPrototypeOf$5=objectIsPrototypeOf,setPrototypeOf=objectSetPrototypeOf,getOwnPropertyNames$3=objectGetOwnPropertyNames.f,typedArrayFrom=typedArrayFrom$1,forEach$2=arrayIteration.forEach,setSpecies$3=setSpecies$5,definePropertyModule$1=objectDefineProperty,getOwnPropertyDescriptorModule$1=objectGetOwnPropertyDescriptor,InternalStateModule$2=internalState,inheritIfRequired$3=inheritIfRequired$4,getInternalState$2=InternalStateModule$2.get,setInternalState$2=InternalStateModule$2.set,enforceInternalState$1=InternalStateModule$2.enforce,nativeDefineProperty$1=definePropertyModule$1.f,nativeGetOwnPropertyDescriptor$2=getOwnPropertyDescriptorModule$1.f,round=Math.round,RangeError$2=global$k.RangeError,ArrayBuffer$3=ArrayBufferModule$1.ArrayBuffer,ArrayBufferPrototype=ArrayBuffer$3.prototype,DataView$2=ArrayBufferModule$1.DataView,NATIVE_ARRAY_BUFFER_VIEWS=ArrayBufferViewCore$r.NATIVE_ARRAY_BUFFER_VIEWS,TYPED_ARRAY_TAG=ArrayBufferViewCore$r.TYPED_ARRAY_TAG,TypedArray=ArrayBufferViewCore$r.TypedArray,TypedArrayPrototype$1=ArrayBufferViewCore$r.TypedArrayPrototype,aTypedArrayConstructor$2=ArrayBufferViewCore$r.aTypedArrayConstructor,isTypedArray=ArrayBufferViewCore$r.isTypedArray,BYTES_PER_ELEMENT="BYTES_PER_ELEMENT",WRONG_LENGTH="Wrong length",fromList=function(e,t){aTypedArrayConstructor$2(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},addGetter=function(e,t){nativeDefineProperty$1(e,t,{get:function(){return getInternalState$2(this)[t]}})},isArrayBuffer=function(e){var t;return isPrototypeOf$5(ArrayBufferPrototype,e)||"ArrayBuffer"==(t=classof$6(e))||"SharedArrayBuffer"==t},isTypedArrayIndex=function(e,t){return isTypedArray(e)&&!isSymbol$2(t)&&t in e&&isIntegralNumber(+t)&&t>=0},wrappedGetOwnPropertyDescriptor=function(e,t){return t=toPropertyKey$1(t),isTypedArrayIndex(e,t)?createPropertyDescriptor$1(2,e[t]):nativeGetOwnPropertyDescriptor$2(e,t)},wrappedDefineProperty=function(e,t,r){return t=toPropertyKey$1(t),!(isTypedArrayIndex(e,t)&&isObject$c(r)&&hasOwn$a(r,"value"))||hasOwn$a(r,"get")||hasOwn$a(r,"set")||r.configurable||hasOwn$a(r,"writable")&&!r.writable||hasOwn$a(r,"enumerable")&&!r.enumerable?nativeDefineProperty$1(e,t,r):(e[t]=r.value,e)};DESCRIPTORS$a?(NATIVE_ARRAY_BUFFER_VIEWS||(getOwnPropertyDescriptorModule$1.f=wrappedGetOwnPropertyDescriptor,definePropertyModule$1.f=wrappedDefineProperty,addGetter(TypedArrayPrototype$1,"buffer"),addGetter(TypedArrayPrototype$1,"byteOffset"),addGetter(TypedArrayPrototype$1,"byteLength"),addGetter(TypedArrayPrototype$1,"length")),$$L({target:"Object",stat:!0,forced:!NATIVE_ARRAY_BUFFER_VIEWS},{getOwnPropertyDescriptor:wrappedGetOwnPropertyDescriptor,defineProperty:wrappedDefineProperty}),typedArrayConstructor.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",a="get"+e,o="set"+e,s=global$k[i],u=s,c=u&&u.prototype,l={},d=function(e,t){nativeDefineProperty$1(e,t,{get:function(){return function(e,t){var r=getInternalState$2(e);return r.view[a](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var a=getInternalState$2(e);r&&(i=(i=round(i))<0?0:i>255?255:255&i),a.view[o](t*n+a.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};NATIVE_ARRAY_BUFFER_VIEWS?TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS$1&&(u=t((function(e,t,r,i){return anInstance$2(e,c),inheritIfRequired$3(isObject$c(t)?isArrayBuffer(t)?void 0!==i?new s(t,toOffset$1(r,n),i):void 0!==r?new s(t,toOffset$1(r,n)):new s(t):isTypedArray(t)?fromList(u,t):call$a(typedArrayFrom,u,t):new s(toIndex(t)),e,u)})),setPrototypeOf&&setPrototypeOf(u,TypedArray),forEach$2(getOwnPropertyNames$3(s),(function(e){e in u||createNonEnumerableProperty$2(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,i){anInstance$2(e,c);var a,o,s,l=0,h=0;if(isObject$c(t)){if(!isArrayBuffer(t))return isTypedArray(t)?fromList(u,t):call$a(typedArrayFrom,u,t);a=t,h=toOffset$1(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw RangeError$2(WRONG_LENGTH);if((o=f-h)<0)throw RangeError$2(WRONG_LENGTH)}else if((o=toLength$7(i)*n)+h>f)throw RangeError$2(WRONG_LENGTH);s=o/n}else s=toIndex(t),a=new ArrayBuffer$3(o=s*n);for(setInternalState$2(e,{buffer:a,byteOffset:h,byteLength:o,length:s,view:new DataView$2(a)});l<s;)d(e,l++)})),setPrototypeOf&&setPrototypeOf(u,TypedArray),c=u.prototype=create$3(TypedArrayPrototype$1)),c.constructor!==u&&createNonEnumerableProperty$2(c,"constructor",u),enforceInternalState$1(c).TypedArrayConstructor=u,TYPED_ARRAY_TAG&&createNonEnumerableProperty$2(c,TYPED_ARRAY_TAG,i);var h=u!=s;l[i]=u,$$L({global:!0,constructor:!0,forced:h,sham:!NATIVE_ARRAY_BUFFER_VIEWS},l),BYTES_PER_ELEMENT in u||createNonEnumerableProperty$2(u,BYTES_PER_ELEMENT,n),BYTES_PER_ELEMENT in c||createNonEnumerableProperty$2(c,BYTES_PER_ELEMENT,n),setSpecies$3(i)}):typedArrayConstructor.exports=function(){};var typedArrayConstructorExports=typedArrayConstructor.exports,createTypedArrayConstructor$7=typedArrayConstructorExports;createTypedArrayConstructor$7("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var ArrayBufferViewCore$q=arrayBufferViewCore,lengthOfArrayLike$7=lengthOfArrayLike$i,toIntegerOrInfinity$4=toIntegerOrInfinity$c,aTypedArray$o=ArrayBufferViewCore$q.aTypedArray,exportTypedArrayMethod$p=ArrayBufferViewCore$q.exportTypedArrayMethod;exportTypedArrayMethod$p("at",(function(e){var t=aTypedArray$o(this),r=lengthOfArrayLike$7(t),n=toIntegerOrInfinity$4(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var toObject$6=toObject$h,toAbsoluteIndex$2=toAbsoluteIndex$8,lengthOfArrayLike$6=lengthOfArrayLike$i,deletePropertyOrThrow$1=deletePropertyOrThrow$3,min$4=Math.min,arrayCopyWithin=[].copyWithin||function(e,t){var r=toObject$6(this),n=lengthOfArrayLike$6(r),i=toAbsoluteIndex$2(e,n),a=toAbsoluteIndex$2(t,n),o=arguments.length>2?arguments[2]:void 0,s=min$4((void 0===o?n:toAbsoluteIndex$2(o,n))-a,n-i),u=1;for(a<i&&i<a+s&&(u=-1,a+=s-1,i+=s-1);s-- >0;)a in r?r[i]=r[a]:deletePropertyOrThrow$1(r,i),i+=u,a+=u;return r},uncurryThis$u=functionUncurryThis,ArrayBufferViewCore$p=arrayBufferViewCore,$ArrayCopyWithin=arrayCopyWithin,u$ArrayCopyWithin=uncurryThis$u($ArrayCopyWithin),aTypedArray$n=ArrayBufferViewCore$p.aTypedArray,exportTypedArrayMethod$o=ArrayBufferViewCore$p.exportTypedArrayMethod;exportTypedArrayMethod$o("copyWithin",(function(e,t){return u$ArrayCopyWithin(aTypedArray$n(this),e,t,arguments.length>2?arguments[2]:void 0)}));var ArrayBufferViewCore$o=arrayBufferViewCore,$every$1=arrayIteration.every,aTypedArray$m=ArrayBufferViewCore$o.aTypedArray,exportTypedArrayMethod$n=ArrayBufferViewCore$o.exportTypedArrayMethod;exportTypedArrayMethod$n("every",(function(e){return $every$1(aTypedArray$m(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$n=arrayBufferViewCore,$fill=arrayFill$1,toBigInt=toBigInt$2,classof$5=classof$f,call$9=functionCall,uncurryThis$t=functionUncurryThis,fails$u=fails$V,aTypedArray$l=ArrayBufferViewCore$n.aTypedArray,exportTypedArrayMethod$m=ArrayBufferViewCore$n.exportTypedArrayMethod,slice2=uncurryThis$t("".slice),CONVERSION_BUG=fails$u((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}));exportTypedArrayMethod$m("fill",(function(e){var t=arguments.length;aTypedArray$l(this);var r="Big"===slice2(classof$5(this),0,3)?toBigInt(e):+e;return call$9($fill,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),CONVERSION_BUG);var lengthOfArrayLike$5=lengthOfArrayLike$i,arrayFromConstructorAndList$1=function(e,t){for(var r=0,n=lengthOfArrayLike$5(t),i=new e(n);n>r;)i[r]=t[r++];return i},ArrayBufferViewCore$m=arrayBufferViewCore,speciesConstructor$2=speciesConstructor$5,aTypedArrayConstructor$1=ArrayBufferViewCore$m.aTypedArrayConstructor,getTypedArrayConstructor=ArrayBufferViewCore$m.getTypedArrayConstructor,typedArraySpeciesConstructor$4=function(e){return aTypedArrayConstructor$1(speciesConstructor$2(e,getTypedArrayConstructor(e)))},arrayFromConstructorAndList=arrayFromConstructorAndList$1,typedArraySpeciesConstructor$3=typedArraySpeciesConstructor$4,typedArrayFromSpeciesAndList=function(e,t){return arrayFromConstructorAndList(typedArraySpeciesConstructor$3(e),t)},ArrayBufferViewCore$l=arrayBufferViewCore,$filter=arrayIteration.filter,fromSpeciesAndList=typedArrayFromSpeciesAndList,aTypedArray$k=ArrayBufferViewCore$l.aTypedArray,exportTypedArrayMethod$l=ArrayBufferViewCore$l.exportTypedArrayMethod;exportTypedArrayMethod$l("filter",(function(e){var t=$filter(aTypedArray$k(this),e,arguments.length>1?arguments[1]:void 0);return fromSpeciesAndList(this,t)}));var ArrayBufferViewCore$k=arrayBufferViewCore,$find$1=arrayIteration.find,aTypedArray$j=ArrayBufferViewCore$k.aTypedArray,exportTypedArrayMethod$k=ArrayBufferViewCore$k.exportTypedArrayMethod;exportTypedArrayMethod$k("find",(function(e){return $find$1(aTypedArray$j(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$j=arrayBufferViewCore,$findIndex$1=arrayIteration.findIndex,aTypedArray$i=ArrayBufferViewCore$j.aTypedArray,exportTypedArrayMethod$j=ArrayBufferViewCore$j.exportTypedArrayMethod;exportTypedArrayMethod$j("findIndex",(function(e){return $findIndex$1(aTypedArray$i(this),e,arguments.length>1?arguments[1]:void 0)}));var bind$3=functionBindContext,IndexedObject$1=indexedObject,toObject$5=toObject$h,lengthOfArrayLike$4=lengthOfArrayLike$i,createMethod$4=function(e){var t=1==e;return function(r,n,i){for(var a,o=toObject$5(r),s=IndexedObject$1(o),u=bind$3(n,i),c=lengthOfArrayLike$4(s);c-- >0;)if(u(a=s[c],c,o))switch(e){case 0:return a;case 1:return c}return t?-1:void 0}},arrayIterationFromLast={findLast:createMethod$4(0),findLastIndex:createMethod$4(1)},ArrayBufferViewCore$i=arrayBufferViewCore,$findLast=arrayIterationFromLast.findLast,aTypedArray$h=ArrayBufferViewCore$i.aTypedArray,exportTypedArrayMethod$i=ArrayBufferViewCore$i.exportTypedArrayMethod;exportTypedArrayMethod$i("findLast",(function(e){return $findLast(aTypedArray$h(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$h=arrayBufferViewCore,$findLastIndex=arrayIterationFromLast.findLastIndex,aTypedArray$g=ArrayBufferViewCore$h.aTypedArray,exportTypedArrayMethod$h=ArrayBufferViewCore$h.exportTypedArrayMethod;exportTypedArrayMethod$h("findLastIndex",(function(e){return $findLastIndex(aTypedArray$g(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$g=arrayBufferViewCore,$forEach$1=arrayIteration.forEach,aTypedArray$f=ArrayBufferViewCore$g.aTypedArray,exportTypedArrayMethod$g=ArrayBufferViewCore$g.exportTypedArrayMethod;exportTypedArrayMethod$g("forEach",(function(e){$forEach$1(aTypedArray$f(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$f=arrayBufferViewCore,$includes=arrayIncludes.includes,aTypedArray$e=ArrayBufferViewCore$f.aTypedArray,exportTypedArrayMethod$f=ArrayBufferViewCore$f.exportTypedArrayMethod;exportTypedArrayMethod$f("includes",(function(e){return $includes(aTypedArray$e(this),e,arguments.length>1?arguments[1]:void 0)}));var ArrayBufferViewCore$e=arrayBufferViewCore,$indexOf$1=arrayIncludes.indexOf,aTypedArray$d=ArrayBufferViewCore$e.aTypedArray,exportTypedArrayMethod$e=ArrayBufferViewCore$e.exportTypedArrayMethod;exportTypedArrayMethod$e("indexOf",(function(e){return $indexOf$1(aTypedArray$d(this),e,arguments.length>1?arguments[1]:void 0)}));var global$j=global$M,fails$t=fails$V,uncurryThis$s=functionUncurryThis,ArrayBufferViewCore$d=arrayBufferViewCore,ArrayIterators=es_array_iterator,wellKnownSymbol$8=wellKnownSymbol$u,ITERATOR$2=wellKnownSymbol$8("iterator"),Uint8Array$2=global$j.Uint8Array,arrayValues=uncurryThis$s(ArrayIterators.values),arrayKeys=uncurryThis$s(ArrayIterators.keys),arrayEntries=uncurryThis$s(ArrayIterators.entries),aTypedArray$c=ArrayBufferViewCore$d.aTypedArray,exportTypedArrayMethod$d=ArrayBufferViewCore$d.exportTypedArrayMethod,TypedArrayPrototype=Uint8Array$2&&Uint8Array$2.prototype,GENERIC=!fails$t((function(){TypedArrayPrototype[ITERATOR$2].call([1])})),ITERATOR_IS_VALUES=!!TypedArrayPrototype&&TypedArrayPrototype.values&&TypedArrayPrototype[ITERATOR$2]===TypedArrayPrototype.values&&"values"===TypedArrayPrototype.values.name,typedArrayValues=function(){return arrayValues(aTypedArray$c(this))};exportTypedArrayMethod$d("entries",(function(){return arrayEntries(aTypedArray$c(this))}),GENERIC),exportTypedArrayMethod$d("keys",(function(){return arrayKeys(aTypedArray$c(this))}),GENERIC),exportTypedArrayMethod$d("values",typedArrayValues,GENERIC||!ITERATOR_IS_VALUES,{name:"values"}),exportTypedArrayMethod$d(ITERATOR$2,typedArrayValues,GENERIC||!ITERATOR_IS_VALUES,{name:"values"});var ArrayBufferViewCore$c=arrayBufferViewCore,uncurryThis$r=functionUncurryThis,aTypedArray$b=ArrayBufferViewCore$c.aTypedArray,exportTypedArrayMethod$c=ArrayBufferViewCore$c.exportTypedArrayMethod,$join=uncurryThis$r([].join);exportTypedArrayMethod$c("join",(function(e){return $join(aTypedArray$b(this),e)}));var apply$6=functionApply,toIndexedObject$5=toIndexedObject$d,toIntegerOrInfinity$3=toIntegerOrInfinity$c,lengthOfArrayLike$3=lengthOfArrayLike$i,arrayMethodIsStrict$5=arrayMethodIsStrict$8,min$3=Math.min,$lastIndexOf$1=[].lastIndexOf,NEGATIVE_ZERO$1=!!$lastIndexOf$1&&1/[1].lastIndexOf(1,-0)<0,STRICT_METHOD$5=arrayMethodIsStrict$5("lastIndexOf"),FORCED$b=NEGATIVE_ZERO$1||!STRICT_METHOD$5,arrayLastIndexOf=FORCED$b?function(e){if(NEGATIVE_ZERO$1)return apply$6($lastIndexOf$1,this,arguments)||0;var t=toIndexedObject$5(this),r=lengthOfArrayLike$3(t),n=r-1;for(arguments.length>1&&(n=min$3(n,toIntegerOrInfinity$3(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:$lastIndexOf$1,ArrayBufferViewCore$b=arrayBufferViewCore,apply$5=functionApply,$lastIndexOf=arrayLastIndexOf,aTypedArray$a=ArrayBufferViewCore$b.aTypedArray,exportTypedArrayMethod$b=ArrayBufferViewCore$b.exportTypedArrayMethod;exportTypedArrayMethod$b("lastIndexOf",(function(e){var t=arguments.length;return apply$5($lastIndexOf,aTypedArray$a(this),t>1?[e,arguments[1]]:[e])}));var ArrayBufferViewCore$a=arrayBufferViewCore,$map=arrayIteration.map,typedArraySpeciesConstructor$2=typedArraySpeciesConstructor$4,aTypedArray$9=ArrayBufferViewCore$a.aTypedArray,exportTypedArrayMethod$a=ArrayBufferViewCore$a.exportTypedArrayMethod;exportTypedArrayMethod$a("map",(function(e){return $map(aTypedArray$9(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(typedArraySpeciesConstructor$2(e))(t)}))}));var aCallable$3=aCallable$b,toObject$4=toObject$h,IndexedObject=indexedObject,lengthOfArrayLike$2=lengthOfArrayLike$i,$TypeError$3=TypeError,createMethod$3=function(e){return function(t,r,n,i){aCallable$3(r);var a=toObject$4(t),o=IndexedObject(a),s=lengthOfArrayLike$2(a),u=e?s-1:0,c=e?-1:1;if(n<2)for(;;){if(u in o){i=o[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw $TypeError$3("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in o&&(i=r(i,o[u],u,a));return i}},arrayReduce={left:createMethod$3(!1),right:createMethod$3(!0)},ArrayBufferViewCore$9=arrayBufferViewCore,$reduce$1=arrayReduce.left,aTypedArray$8=ArrayBufferViewCore$9.aTypedArray,exportTypedArrayMethod$9=ArrayBufferViewCore$9.exportTypedArrayMethod;exportTypedArrayMethod$9("reduce",(function(e){var t=arguments.length;return $reduce$1(aTypedArray$8(this),e,t,t>1?arguments[1]:void 0)}));var ArrayBufferViewCore$8=arrayBufferViewCore,$reduceRight=arrayReduce.right,aTypedArray$7=ArrayBufferViewCore$8.aTypedArray,exportTypedArrayMethod$8=ArrayBufferViewCore$8.exportTypedArrayMethod;exportTypedArrayMethod$8("reduceRight",(function(e){var t=arguments.length;return $reduceRight(aTypedArray$7(this),e,t,t>1?arguments[1]:void 0)}));var ArrayBufferViewCore$7=arrayBufferViewCore,aTypedArray$6=ArrayBufferViewCore$7.aTypedArray,exportTypedArrayMethod$7=ArrayBufferViewCore$7.exportTypedArrayMethod,floor$3=Math.floor;exportTypedArrayMethod$7("reverse",(function(){for(var e,t=this,r=aTypedArray$6(t).length,n=floor$3(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var global$i=global$M,call$8=functionCall,ArrayBufferViewCore$6=arrayBufferViewCore,lengthOfArrayLike$1=lengthOfArrayLike$i,toOffset=toOffset$2,toIndexedObject$4=toObject$h,fails$s=fails$V,RangeError$1=global$i.RangeError,Int8Array$2=global$i.Int8Array,Int8ArrayPrototype=Int8Array$2&&Int8Array$2.prototype,$set=Int8ArrayPrototype&&Int8ArrayPrototype.set,aTypedArray$5=ArrayBufferViewCore$6.aTypedArray,exportTypedArrayMethod$6=ArrayBufferViewCore$6.exportTypedArrayMethod,WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS=!fails$s((function(){var e=new Uint8ClampedArray(2);return call$8($set,e,{length:1,0:3},1),3!==e[1]})),TO_OBJECT_BUG=WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS&&ArrayBufferViewCore$6.NATIVE_ARRAY_BUFFER_VIEWS&&fails$s((function(){var e=new Int8Array$2(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));exportTypedArrayMethod$6("set",(function(e){aTypedArray$5(this);var t=toOffset(arguments.length>1?arguments[1]:void 0,1),r=toIndexedObject$4(e);if(WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS)return call$8($set,this,r,t);var n=this.length,i=lengthOfArrayLike$1(r),a=0;if(i+t>n)throw RangeError$1("Wrong length");for(;a<i;)this[t+a]=r[a++]}),!WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS||TO_OBJECT_BUG);var ArrayBufferViewCore$5=arrayBufferViewCore,typedArraySpeciesConstructor$1=typedArraySpeciesConstructor$4,fails$r=fails$V,arraySlice$6=arraySlice$c,aTypedArray$4=ArrayBufferViewCore$5.aTypedArray,exportTypedArrayMethod$5=ArrayBufferViewCore$5.exportTypedArrayMethod,FORCED$a=fails$r((function(){new Int8Array(1).slice()}));exportTypedArrayMethod$5("slice",(function(e,t){for(var r=arraySlice$6(aTypedArray$4(this),e,t),n=typedArraySpeciesConstructor$1(this),i=0,a=r.length,o=new n(a);a>i;)o[i]=r[i++];return o}),FORCED$a);var ArrayBufferViewCore$4=arrayBufferViewCore,$some$1=arrayIteration.some,aTypedArray$3=ArrayBufferViewCore$4.aTypedArray,exportTypedArrayMethod$4=ArrayBufferViewCore$4.exportTypedArrayMethod;exportTypedArrayMethod$4("some",(function(e){return $some$1(aTypedArray$3(this),e,arguments.length>1?arguments[1]:void 0)}));var userAgent$3=engineUserAgent,firefox=userAgent$3.match(/firefox\/(\d+)/i),engineFfVersion=!!firefox&&+firefox[1],UA=engineUserAgent,engineIsIeOrEdge=/MSIE|Trident/.test(UA),userAgent$2=engineUserAgent,webkit=userAgent$2.match(/AppleWebKit\/(\d+)\./),engineWebkitVersion=!!webkit&&+webkit[1],global$h=global$M,uncurryThis$q=functionUncurryThisClause,fails$q=fails$V,aCallable$2=aCallable$b,internalSort$1=arraySort$1,ArrayBufferViewCore$3=arrayBufferViewCore,FF$2=engineFfVersion,IE_OR_EDGE$1=engineIsIeOrEdge,V8$1=engineV8Version,WEBKIT$1=engineWebkitVersion,aTypedArray$2=ArrayBufferViewCore$3.aTypedArray,exportTypedArrayMethod$3=ArrayBufferViewCore$3.exportTypedArrayMethod,Uint16Array$1=global$h.Uint16Array,nativeSort$1=Uint16Array$1&&uncurryThis$q(Uint16Array$1.prototype.sort),ACCEPT_INCORRECT_ARGUMENTS=!(!nativeSort$1||fails$q((function(){nativeSort$1(new Uint16Array$1(2),null)}))&&fails$q((function(){nativeSort$1(new Uint16Array$1(2),{})}))),STABLE_SORT$1=!!nativeSort$1&&!fails$q((function(){if(V8$1)return V8$1<74;if(FF$2)return FF$2<67;if(IE_OR_EDGE$1)return!0;if(WEBKIT$1)return WEBKIT$1<602;var e,t,r=new Uint16Array$1(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(nativeSort$1(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0})),getSortCompare$1=function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}};exportTypedArrayMethod$3("sort",(function(e){return void 0!==e&&aCallable$2(e),STABLE_SORT$1?nativeSort$1(this,e):internalSort$1(aTypedArray$2(this),getSortCompare$1(e))}),!STABLE_SORT$1||ACCEPT_INCORRECT_ARGUMENTS);var ArrayBufferViewCore$2=arrayBufferViewCore,toLength$6=toLength$b,toAbsoluteIndex$1=toAbsoluteIndex$8,typedArraySpeciesConstructor=typedArraySpeciesConstructor$4,aTypedArray$1=ArrayBufferViewCore$2.aTypedArray,exportTypedArrayMethod$2=ArrayBufferViewCore$2.exportTypedArrayMethod;exportTypedArrayMethod$2("subarray",(function(e,t){var r=aTypedArray$1(this),n=r.length,i=toAbsoluteIndex$1(e,n);return new(typedArraySpeciesConstructor(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,toLength$6((void 0===t?n:toAbsoluteIndex$1(t,n))-i))}));var global$g=global$M,apply$4=functionApply,ArrayBufferViewCore$1=arrayBufferViewCore,fails$p=fails$V,arraySlice$5=arraySlice$c,Int8Array$1=global$g.Int8Array,aTypedArray=ArrayBufferViewCore$1.aTypedArray,exportTypedArrayMethod$1=ArrayBufferViewCore$1.exportTypedArrayMethod,$toLocaleString=[].toLocaleString,TO_LOCALE_STRING_BUG=!!Int8Array$1&&fails$p((function(){$toLocaleString.call(new Int8Array$1(1))})),FORCED$9=fails$p((function(){return[1,2].toLocaleString()!=new Int8Array$1([1,2]).toLocaleString()}))||!fails$p((function(){Int8Array$1.prototype.toLocaleString.call([1,2])}));exportTypedArrayMethod$1("toLocaleString",(function(){return apply$4($toLocaleString,TO_LOCALE_STRING_BUG?arraySlice$5(aTypedArray(this)):aTypedArray(this),arraySlice$5(arguments))}),FORCED$9);var exportTypedArrayMethod=arrayBufferViewCore.exportTypedArrayMethod,fails$o=fails$V,global$f=global$M,uncurryThis$p=functionUncurryThis,Uint8Array$1=global$f.Uint8Array,Uint8ArrayPrototype=Uint8Array$1&&Uint8Array$1.prototype||{},arrayToString=[].toString,join$1=uncurryThis$p([].join);fails$o((function(){arrayToString.call({})}))&&(arrayToString=function(){return join$1(this)});var IS_NOT_ARRAY_METHOD=Uint8ArrayPrototype.toString!=arrayToString;exportTypedArrayMethod("toString",arrayToString,IS_NOT_ARRAY_METHOD);var LoaderType$2={FETCH:"fetch",XHR:"xhr"},ResponseType$2={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"},NetError$2=function(e){_inherits$c(r,_wrapNativeSuper$3(Error));var t=_createSuper$c(r);function r(e,n,i,a){var o;return _classCallCheck$f(this,r),_defineProperty$d(_assertThisInitialized$c(o=t.call(this,a)),"retryCount",0),_defineProperty$d(_assertThisInitialized$c(o),"isTimeout",!1),_defineProperty$d(_assertThisInitialized$c(o),"loaderType",LoaderType$2.FETCH),_defineProperty$d(_assertThisInitialized$c(o),"startTime",0),_defineProperty$d(_assertThisInitialized$c(o),"endTime",0),_defineProperty$d(_assertThisInitialized$c(o),"options",{}),o.url=e,o.request=n,o.response=i,o}return _createClass$f(r)}(),uncurryThis$o=functionUncurryThisClause,defineBuiltIn$7=defineBuiltIn$j,regexpExec$2=regexpExec$3,fails$n=fails$V,wellKnownSymbol$7=wellKnownSymbol$u,createNonEnumerableProperty$1=createNonEnumerableProperty$a,SPECIES=wellKnownSymbol$7("species"),RegExpPrototype$5=RegExp.prototype,fixRegexpWellKnownSymbolLogic=function(e,t,r,n){var i=wellKnownSymbol$7(e),a=!fails$n((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),o=a&&!fails$n((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[SPECIES]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!a||!o||r){var s=uncurryThis$o(/./[i]),u=t(i,""[e],(function(e,t,r,n,i){var o=uncurryThis$o(e),u=t.exec;return u===regexpExec$2||u===RegExpPrototype$5.exec?a&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:o(r,t,n)}:{done:!1}}));defineBuiltIn$7(String.prototype,e,u[0]),defineBuiltIn$7(RegExpPrototype$5,i,u[1])}n&&createNonEnumerableProperty$1(RegExpPrototype$5[i],"sham",!0)},charAt$3=stringMultibyte.charAt,advanceStringIndex$3=function(e,t,r){return t+(r?charAt$3(e,t).length:1)},uncurryThis$n=functionUncurryThis,toObject$3=toObject$h,floor$2=Math.floor,charAt$2=uncurryThis$n("".charAt),replace$3=uncurryThis$n("".replace),stringSlice$7=uncurryThis$n("".slice),SUBSTITUTION_SYMBOLS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,SUBSTITUTION_SYMBOLS_NO_NAMED=/\$([$&'`]|\d{1,2})/g,getSubstitution$1=function(e,t,r,n,i,a){var o=r+e.length,s=n.length,u=SUBSTITUTION_SYMBOLS_NO_NAMED;return void 0!==i&&(i=toObject$3(i),u=SUBSTITUTION_SYMBOLS),replace$3(a,u,(function(a,u){var c;switch(charAt$2(u,0)){case"$":return"$";case"&":return e;case"`":return stringSlice$7(t,0,r);case"'":return stringSlice$7(t,o);case"<":c=i[stringSlice$7(u,1,-1)];break;default:var l=+u;if(0===l)return a;if(l>s){var d=floor$2(l/10);return 0===d?a:d<=s?void 0===n[d-1]?charAt$2(u,1):n[d-1]+charAt$2(u,1):a}c=n[l-1]}return void 0===c?"":c}))},call$7=functionCall,anObject$8=anObject$m,isCallable$5=isCallable$v,classof$4=classofRaw$2,regexpExec$1=regexpExec$3,$TypeError$2=TypeError,regexpExecAbstract=function(e,t){var r=e.exec;if(isCallable$5(r)){var n=call$7(r,e,t);return null!==n&&anObject$8(n),n}if("RegExp"===classof$4(e))return call$7(regexpExec$1,e,t);throw $TypeError$2("RegExp#exec called on incompatible receiver")},apply$3=functionApply,call$6=functionCall,uncurryThis$m=functionUncurryThis,fixRegExpWellKnownSymbolLogic$2=fixRegexpWellKnownSymbolLogic,fails$m=fails$V,anObject$7=anObject$m,isCallable$4=isCallable$v,isNullOrUndefined$4=isNullOrUndefined$9,toIntegerOrInfinity$2=toIntegerOrInfinity$c,toLength$5=toLength$b,toString$h=toString$l,requireObjectCoercible$7=requireObjectCoercible$b,advanceStringIndex$2=advanceStringIndex$3,getMethod$2=getMethod$6,getSubstitution=getSubstitution$1,regExpExec$1=regexpExecAbstract,wellKnownSymbol$6=wellKnownSymbol$u,REPLACE=wellKnownSymbol$6("replace"),max=Math.max,min$2=Math.min,concat$2=uncurryThis$m([].concat),push$5=uncurryThis$m([].push),stringIndexOf$2=uncurryThis$m("".indexOf),stringSlice$6=uncurryThis$m("".slice),maybeToString=function(e){return void 0===e?e:String(e)},REPLACE_KEEPS_$0="$0"==="a".replace(/./,"$0"),REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE=!!/./[REPLACE]&&""===/./[REPLACE]("a","$0"),REPLACE_SUPPORTS_NAMED_GROUPS=!fails$m((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));fixRegExpWellKnownSymbolLogic$2("replace",(function(e,t,r){var n=REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE?"$":"$0";return[function(e,r){var n=requireObjectCoercible$7(this),i=isNullOrUndefined$4(e)?void 0:getMethod$2(e,REPLACE);return i?call$6(i,e,n,r):call$6(t,toString$h(n),e,r)},function(e,i){var a=anObject$7(this),o=toString$h(e);if("string"==typeof i&&-1===stringIndexOf$2(i,n)&&-1===stringIndexOf$2(i,"$<")){var s=r(t,a,o,i);if(s.done)return s.value}var u=isCallable$4(i);u||(i=toString$h(i));var c=a.global;if(c){var l=a.unicode;a.lastIndex=0}for(var d=[];;){var h=regExpExec$1(a,o);if(null===h)break;if(push$5(d,h),!c)break;""===toString$h(h[0])&&(a.lastIndex=advanceStringIndex$2(o,toLength$5(a.lastIndex),l))}for(var f="",p=0,m=0;m<d.length;m++){for(var y=toString$h((h=d[m])[0]),g=max(min$2(toIntegerOrInfinity$2(h.index),o.length),0),v=[],b=1;b<h.length;b++)push$5(v,maybeToString(h[b]));var _=h.groups;if(u){var A=concat$2([y],v,g,o);void 0!==_&&push$5(A,_);var T=toString$h(apply$3(i,void 0,A))}else T=getSubstitution(y,o,g,v,_,i);g>=p&&(f+=stringSlice$6(o,p,g)+T,p=g+y.length)}return f+stringSlice$6(o,p)}]}),!REPLACE_SUPPORTS_NAMED_GROUPS||!REPLACE_KEEPS_$0||REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);var $$K=_export;$$K({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var uncurryThis$l=functionUncurryThis,thisNumberValue$2=uncurryThis$l(1..valueOf),whitespaces$4="\t\n\v\f\r \u2028\u2029\ufeff",uncurryThis$k=functionUncurryThis,requireObjectCoercible$6=requireObjectCoercible$b,toString$g=toString$l,whitespaces$3=whitespaces$4,replace$2=uncurryThis$k("".replace),whitespace="["+whitespaces$3+"]",ltrim=RegExp("^"+whitespace+whitespace+"*"),rtrim=RegExp(whitespace+whitespace+"*$"),createMethod$2=function(e){return function(t){var r=toString$g(requireObjectCoercible$6(t));return 1&e&&(r=replace$2(r,ltrim,"")),2&e&&(r=replace$2(r,rtrim,"")),r}},stringTrim={start:createMethod$2(1),end:createMethod$2(2),trim:createMethod$2(3)},DESCRIPTORS$9=descriptors,global$e=global$M,uncurryThis$j=functionUncurryThis,isForced$2=isForced_1,defineBuiltIn$6=defineBuiltIn$j,hasOwn$9=hasOwnProperty_1,inheritIfRequired$2=inheritIfRequired$4,isPrototypeOf$4=objectIsPrototypeOf,isSymbol$1=isSymbol$6,toPrimitive=toPrimitive$3,fails$l=fails$V,getOwnPropertyNames$2=objectGetOwnPropertyNames.f,getOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,defineProperty$6=objectDefineProperty.f,thisNumberValue$1=thisNumberValue$2,trim$2=stringTrim.trim,NUMBER="Number",NativeNumber=global$e[NUMBER],NumberPrototype=NativeNumber.prototype,TypeError$2=global$e.TypeError,arraySlice$4=uncurryThis$j("".slice),charCodeAt=uncurryThis$j("".charCodeAt),toNumeric=function(e){var t=toPrimitive(e,"number");return"bigint"==typeof t?t:toNumber(t)},toNumber=function(e){var t,r,n,i,a,o,s,u,c=toPrimitive(e,"number");if(isSymbol$1(c))throw TypeError$2("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=trim$2(c),43===(t=charCodeAt(c,0))||45===t){if(88===(r=charCodeAt(c,2))||120===r)return NaN}else if(48===t){switch(charCodeAt(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(o=(a=arraySlice$4(c,2)).length,s=0;s<o;s++)if((u=charCodeAt(a,s))<48||u>i)return NaN;return parseInt(a,n)}return+c};if(isForced$2(NUMBER,!NativeNumber(" 0o1")||!NativeNumber("0b1")||NativeNumber("+0x1"))){for(var key2,NumberWrapper=function(e){var t=arguments.length<1?0:NativeNumber(toNumeric(e)),r=this;return isPrototypeOf$4(NumberPrototype,r)&&fails$l((function(){thisNumberValue$1(r)}))?inheritIfRequired$2(Object(t),r,NumberWrapper):t},keys$2=DESCRIPTORS$9?getOwnPropertyNames$2(NativeNumber):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),j=0;keys$2.length>j;j++)hasOwn$9(NativeNumber,key2=keys$2[j])&&!hasOwn$9(NumberWrapper,key2)&&defineProperty$6(NumberWrapper,key2,getOwnPropertyDescriptor$1(NativeNumber,key2));NumberWrapper.prototype=NumberPrototype,NumberPrototype.constructor=NumberWrapper,defineBuiltIn$6(global$e,NUMBER,NumberWrapper,{constructor:!0})}var $$J=_export,fails$k=fails$V,toObject$2=toObject$h,nativeGetPrototypeOf=objectGetPrototypeOf,CORRECT_PROTOTYPE_GETTER=correctPrototypeGetter,FAILS_ON_PRIMITIVES$3=fails$k((function(){nativeGetPrototypeOf(1)}));$$J({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES$3,sham:!CORRECT_PROTOTYPE_GETTER},{getPrototypeOf:function(e){return nativeGetPrototypeOf(toObject$2(e))}});var toString$f=Object.prototype.toString;function isObject$b(e){return null!==e&&"object"===_typeof$6(e)}function isPlainObject$2(e){if("[object Object]"!==toString$f.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function isDate$2(e){return"[object Date]"===toString$f.call(e)}function getRangeValue$2(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function encode$2(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function setUrlParams$2(e,t){if(e){if(!t)return e;var r,n=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){return isDate$2(t)?t=t.toISOString():isObject$b(t)&&(t=JSON.stringify(t)),"".concat(encode$2(e),"=").concat(encode$2(t))})).join("&")})).filter(Boolean).join("&");if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}}function createResponse$2(e,t,r,n,i,a,o,s,u,c,l){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,option:{range:u,vid:c,index:s,contentLength:n,age:i,startTime:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:r}}function calculateSpeed$2(e,t){return Math.round(8*e*1e3/t/1024)}var EVENT$2={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",SPEED:"core.speed",HLS_MANIFEST_LOADED:"core.hlsmanifestloaded",HLS_LEVEL_LOADED:"core.hlslevelloaded",DEMUXED_TRACK:"demuxedtrack",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT",REAL_TIME_SPEED:"real_time_speed"},CACHESIZE$2=2097152,FetchLoader$2=function(e){_inherits$c(n,EventEmitter$1);var t,r=_createSuper$c(n);function n(){var e;return _classCallCheck$f(this,n),_defineProperty$d(_assertThisInitialized$c(e=r.call(this)),"_abortController",null),_defineProperty$d(_assertThisInitialized$c(e),"_timeoutTimer",null),_defineProperty$d(_assertThisInitialized$c(e),"_reader",null),_defineProperty$d(_assertThisInitialized$c(e),"_response",null),_defineProperty$d(_assertThisInitialized$c(e),"_aborted",!1),_defineProperty$d(_assertThisInitialized$c(e),"_index",-1),_defineProperty$d(_assertThisInitialized$c(e),"_range",null),_defineProperty$d(_assertThisInitialized$c(e),"_receivedLength",0),_defineProperty$d(_assertThisInitialized$c(e),"_running",!1),_defineProperty$d(_assertThisInitialized$c(e),"_logger",null),_defineProperty$d(_assertThisInitialized$c(e),"_vid",""),_defineProperty$d(_assertThisInitialized$c(e),"_onProcessMinLen",0),_defineProperty$d(_assertThisInitialized$c(e),"_onCancel",null),_defineProperty$d(_assertThisInitialized$c(e),"_priOptions",null),e}return _createClass$f(n,[{key:"load",value:function(e){var t,r=this,n=e.url,i=e.vid,a=e.timeout,o=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,d=e.range,h=e.transformResponse,f=e.request,p=e.params,m=e.logger,y=e.method,g=e.headers,v=e.body,b=e.mode,_=e.credentials,A=e.cache,T=e.redirect,E=e.referrer,S=e.referrerPolicy,$=e.onProcessMinLen,I=e.priOptions;this._logger=m,this._aborted=!1,this._onProcessMinLen=$,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=d||[0,0],this._vid=i||n,this._priOptions=I||{};var w={method:y,headers:g,body:v,mode:b,credentials:_,cache:A,redirect:T,referrer:E,referrerPolicy:S,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},R=!1;clearTimeout(this._timeoutTimer),n=setUrlParams$2(n,p);var k=getRangeValue$2(d);k&&(g=f?f.headers:w.headers=w.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",k):g.Range=k),a&&(this._timeoutTimer=setTimeout((function(){if(R=!0,r.cancel(),c){var e=new NetError$2(n,w,null,"timeout");e.isTimeout=!0,c(e,{index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions})}}),a));var P=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",d),new Promise((function(e,t){fetch(f||n,f?void 0:w).then(function(){var i=_asyncToGenerator$8(_regeneratorRuntime$8().mark((function i(a){var c,l,f,p;return _regeneratorRuntime$8().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(r._timeoutTimer),r._response=a,!r._aborted&&r._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(a=h(a,n)||a),a.ok){i.next=7;break}throw new NetError$2(n,w,a,"bad network response");case 7:if(c=Date.now(),o!==ResponseType$2.TEXT){i.next=15;break}return i.next=11,a.text();case 11:l=i.sent,r._running=!1,i.next=37;break;case 15:if(o!==ResponseType$2.JSON){i.next=22;break}return i.next=18,a.json();case 18:l=i.sent,r._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return r.resolve=e,r.reject=t,r._loadChunk(a,s,P,c),i.abrupt("return");case 29:return i.next=31,a.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),r._running=!1,f=Date.now()-P,p=calculateSpeed$2(l.byteLength,f),r.emit(EVENT$2.REAL_TIME_SPEED,{speed:p,len:l.byteLength,time:f,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions});case 37:r._logger.debug("[fetch load end], index,",u,",range,",d),e(createResponse$2(l,!0,a,a.headers.get("Content-Length"),a.headers.get("age"),P,c,u,d,r._vid,r._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(r._timeoutTimer),r._running=!1,r._aborted&&!R||((e=e instanceof NetError$2?e:new NetError$2(n,w,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=P,e.endTime=Date.now(),e.isTimeout=R,e.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},t(e))}))}))}},{key:"cancel",value:(t=_asyncToGenerator$8(_regeneratorRuntime$8().mark((function e(){return _regeneratorRuntime$8().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14: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});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,r,n){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var a=new NetError$2(e.url,"",e,"onProgress of bad response.body.getReader");return a.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(a)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(CACHESIZE$2),this._writeIdx=0);var o,s,u,c=this._reader=e.body.getReader(),l=function(){var a=_asyncToGenerator$8(_regeneratorRuntime$8().mark((function a(){var d,h,f,p,m,y,g,v;return _regeneratorRuntime$8().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s=Date.now(),a.prev=1,a.next=4,c.read();case 4:o=a.sent,u=Date.now(),a.next=13;break;case 8:return a.prev=8,a.t0=a.catch(1),u=Date.now(),i._aborted||(i._running=!1,a.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(a.t0)),a.abrupt("return");case 13:if(h=(null===(d=i._range)||void 0===d?void 0:d.length)>0?i._range[0]:0,f=h+i._receivedLength,!i._aborted){a.next=19;break}return i._running=!1,t(void 0,!1,{range:[f,f],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),a.abrupt("return");case 19:p=o.value?o.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",f,", end,",h+i._receivedLength,", done,",o.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||o.done?((m=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(o.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",o.done,",len,",m.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<CACHESIZE$2?(i._cache.set(o.value,i._writeIdx),i._writeIdx+=p,i._logger.debug("【fetchLoader,onProgress cache】,len,",p,", writeIdx,",i._writeIdx)):p>0&&(y=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),y.set(i._cache.slice(0,i._writeIdx),0),p>0&&y.set(o.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=y,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):m=o.value,(m&&m.byteLength>0||o.done)&&t(m,o.done,{range:[i._range[0]+i._receivedLength-(m?m.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),o.done?(g=Date.now()-r,v=calculateSpeed$2(i._receivedLength,g),i.emit(EVENT$2.REAL_TIME_SPEED,{speed:v,len:i._receivedLength,time:g,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",o.done),i.resolve(createResponse$2(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),r,n,i._index,i._range,i._vid,i._priOptions))):l();case 25:case"end":return a.stop()}}),a,null,[[1,8]])})));return function(){return a.apply(this,arguments)}}();l()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),n}();function getConfig$4(e){return _objectSpread2$7({loaderType:LoaderType$2.FETCH,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:ResponseType$2.TEXT,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)}var PROPER_FUNCTION_NAME$1=functionName.PROPER,fails$j=fails$V,whitespaces$2=whitespaces$4,non="
",stringTrimForced=function(e){return fails$j((function(){return!!whitespaces$2[e]()||non[e]()!==non||PROPER_FUNCTION_NAME$1&&whitespaces$2[e].name!==e}))},$$I=_export,$trim=stringTrim.trim,forcedStringTrimMethod=stringTrimForced;$$I({target:"String",proto:!0,forced:forcedStringTrimMethod("trim")},{trim:function(){return $trim(this)}});var XhrLoader$2=function(e){_inherits$c(r,EventEmitter$1);var t=_createSuper$c(r);function r(){var e;return _classCallCheck$f(this,r),_defineProperty$d(_assertThisInitialized$c(e=t.call(this)),"_xhr",null),_defineProperty$d(_assertThisInitialized$c(e),"_aborted",!1),_defineProperty$d(_assertThisInitialized$c(e),"_timeoutTimer",null),_defineProperty$d(_assertThisInitialized$c(e),"_range",null),_defineProperty$d(_assertThisInitialized$c(e),"_receivedLength",0),_defineProperty$d(_assertThisInitialized$c(e),"_url",null),_defineProperty$d(_assertThisInitialized$c(e),"_onProgress",null),_defineProperty$d(_assertThisInitialized$c(e),"_index",-1),_defineProperty$d(_assertThisInitialized$c(e),"_headers",null),_defineProperty$d(_assertThisInitialized$c(e),"_currentChunkSizeKB",384),_defineProperty$d(_assertThisInitialized$c(e),"_timeout",null),_defineProperty$d(_assertThisInitialized$c(e),"_xhr",null),_defineProperty$d(_assertThisInitialized$c(e),"_withCredentials",null),_defineProperty$d(_assertThisInitialized$c(e),"_startTime",-1),_defineProperty$d(_assertThisInitialized$c(e),"_loadCompleteResolve",null),_defineProperty$d(_assertThisInitialized$c(e),"_loadCompleteReject",null),_defineProperty$d(_assertThisInitialized$c(e),"_runing",!1),_defineProperty$d(_assertThisInitialized$c(e),"_logger",!1),_defineProperty$d(_assertThisInitialized$c(e),"_vid",""),_defineProperty$d(_assertThisInitialized$c(e),"_responseType",void 0),_defineProperty$d(_assertThisInitialized$c(e),"_credentials",void 0),_defineProperty$d(_assertThisInitialized$c(e),"_method",void 0),_defineProperty$d(_assertThisInitialized$c(e),"_transformResponse",void 0),_defineProperty$d(_assertThisInitialized$c(e),"_firstRtt",void 0),_defineProperty$d(_assertThisInitialized$c(e),"_onCancel",null),_defineProperty$d(_assertThisInitialized$c(e),"_priOptions",null),e}return _createClass$f(r,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,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._logger.debug("【xhrLoader task】, range",this._range),this._url=setUrlParams$2(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof NetError$2?e:new NetError$2(t._url,t._request)).startTime=r,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===ResponseType$2.ARRAY_BUFFER&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._withCredentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){var r,n,i;t._running=!1;var a=new NetError$2(t._url,t._request,null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.response,"xhr.onerror.status:"+(null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));a.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(a)},r.ontimeout=function(e){t.cancel();var r=new NetError$2(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),r.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(r)};var n=this._headers||{},i=getRangeValue$2(e);i&&(n.Range=i),n&&Object.keys(n).forEach((function(e){r.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,r=e.target.status;if(r<200||r>299){var n=new NetError$2(this._url,null,_objectSpread2$7(_objectSpread2$7({},e.target.response),{},{status:r}),"bad response,status:"+r);return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(n)}var i,a=null,o=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===ResponseType$2.ARRAY_BUFFER){var u,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var l=Date.now()-this._startTime,d=calculateSpeed$2(this._receivedLength,l);this.emit(EVENT$2.REAL_TIME_SPEED,{speed:d,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}a=c,o=!((null===(u=this._range)||void 0===u?void 0:u.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,a=e.target.response;var h={ok:r>=200&&r<300,status:r,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(a,o,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(createResponse$2(this._onProgress?null:a,o,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,_get$3(_getPrototypeOf$c(r.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r={},n=_createForOfIteratorHelper$2(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(e){n.e(e)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),r}(),_excluded$3=["retry","retryDelay","onRetryError","transformError"],Task$2=function(){function e(t,r){_classCallCheck$f(this,e),this.promise=createPublicPromise$3(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new Logger$9("Loader")),this._loaderType=t,this._loader=t===LoaderType$2.FETCH&&window.fetch?new FetchLoader$2:new XhrLoader$2,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}var t;return _createClass$f(e,[{key:"exec",value:function(){var e=this,t=this._config,r=t.retry,n=t.retryDelay,i=t.onRetryError,a=t.transformError,o=_objectWithoutProperties$3(t,_excluded$3),s=function(){var t=_asyncToGenerator$8(_regeneratorRuntime$8().mark((function t(){var u,c,l;return _regeneratorRuntime$8().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(o);case 3:u=t.sent,e.promise.resolve(u),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,a&&(c=a(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:o.index,vid:o.vid,range:o.range,priOptions:o.priOptions}),e._retryCount++,l=!0,e._retryCheckFunc&&(l=e._retryCheckFunc(t.t0)),!(l&&e._retryCount<=r)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",o.range),e._retryTimer=setTimeout(s,n),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=_asyncToGenerator$8(_regeneratorRuntime$8().mark((function e(){return _regeneratorRuntime$8().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function isMediaPlaying(e){return e&&!e.paused&&!e.ended&&0!==e.playbackRate&&0!==e.readyState}function getVideoPlaybackQuality(e){if(!e)return{};if("function"==typeof e.getVideoPlaybackQuality){var t=e.getVideoPlaybackQuality();return{droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}return{droppedVideoFrames:e.webkitDroppedFrameCount,totalVideoFrames:e.webkitDecodedFrameCount,creationTime:performance.now()}}function concatUint8Array$5(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if((t=t.filter(Boolean)).length<2)return t[0];var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}function sleep$2(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var NetLoader$2=function(e){_inherits$c(n,EventEmitter$1);var t,r=_createSuper$c(n);function n(e){var t;return _classCallCheck$f(this,n),_defineProperty$d(_assertThisInitialized$c(t=r.call(this,e)),"type",LoaderType$2.FETCH),_defineProperty$d(_assertThisInitialized$c(t),"_queue",[]),_defineProperty$d(_assertThisInitialized$c(t),"_alive",[]),_defineProperty$d(_assertThisInitialized$c(t),"_currentTask",null),_defineProperty$d(_assertThisInitialized$c(t),"_config",void 0),t._config=getConfig$4(e),t._config.loaderType!==LoaderType$2.XHR&&FetchLoader$2.isSupported()||(t.type=LoaderType$2.XHR),t.log=e.logger,t}return _createClass$f(n,[{key:"isFetch",value:function(){return this.type===LoaderType$2.FETCH}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&isPlainObject$2(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&isPlainObject$2(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new Task$2(this.type,r);return n.loader.on(EVENT$2.REAL_TIME_SPEED,(function(e){t.emit(EVENT$2.REAL_TIME_SPEED,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(t=_asyncToGenerator$8(_regeneratorRuntime$8().mark((function e(){var t;return _regeneratorRuntime$8().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,sleep$2();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return FetchLoader$2.isSupported()}}]),n}(),GapService=function(){function e(){_classCallCheck$f(this,e),_defineProperty$d(this,"_prevCurrentTime",0)}return _createClass$f(e,[{key:"do",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(e){var i=e.currentTime,a=0;if(this._prevCurrentTime===i){var o=Buffer$5.info(Buffer$5.get(e),i);if(!o.buffers.length)return;r&&o.nextStart||o.nextStart&&o.nextStart-i<t?a=o.nextStart+.1:o.end&&o.end-i>n&&!e.seeking&&(a=i+.1)}this._prevCurrentTime=i,a&&i!==a&&(e.currentTime=a)}}}]),e}(),internalMetadata={exports:{}},objectGetOwnPropertyNamesExternal={},classof$3=classofRaw$2,toIndexedObject$3=toIndexedObject$d,$getOwnPropertyNames$1=objectGetOwnPropertyNames.f,arraySlice$3=arraySliceSimple,windowNames="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],getWindowNames=function(e){try{return $getOwnPropertyNames$1(e)}catch(e){return arraySlice$3(windowNames)}};objectGetOwnPropertyNamesExternal.f=function(e){return windowNames&&"Window"==classof$3(e)?getWindowNames(e):$getOwnPropertyNames$1(toIndexedObject$3(e))};var fails$i=fails$V,arrayBufferNonExtensible=fails$i((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),fails$h=fails$V,isObject$a=isObject$t,classof$2=classofRaw$2,ARRAY_BUFFER_NON_EXTENSIBLE=arrayBufferNonExtensible,$isExtensible=Object.isExtensible,FAILS_ON_PRIMITIVES$2=fails$h((function(){$isExtensible(1)})),objectIsExtensible=FAILS_ON_PRIMITIVES$2||ARRAY_BUFFER_NON_EXTENSIBLE?function(e){return!!isObject$a(e)&&((!ARRAY_BUFFER_NON_EXTENSIBLE||"ArrayBuffer"!=classof$2(e))&&(!$isExtensible||$isExtensible(e)))}:$isExtensible,fails$g=fails$V,freezing=!fails$g((function(){return Object.isExtensible(Object.preventExtensions({}))})),$$H=_export,uncurryThis$i=functionUncurryThis,hiddenKeys$1=hiddenKeys$6,isObject$9=isObject$t,hasOwn$8=hasOwnProperty_1,defineProperty$5=objectDefineProperty.f,getOwnPropertyNamesModule$1=objectGetOwnPropertyNames,getOwnPropertyNamesExternalModule=objectGetOwnPropertyNamesExternal,isExtensible2=objectIsExtensible,uid$1=uid$5,FREEZING=freezing,REQUIRED=!1,METADATA=uid$1("meta"),id=0,setMetadata=function(e){defineProperty$5(e,METADATA,{value:{objectID:"O"+id++,weakData:{}}})},fastKey$1=function(e,t){if(!isObject$9(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!hasOwn$8(e,METADATA)){if(!isExtensible2(e))return"F";if(!t)return"E";setMetadata(e)}return e[METADATA].objectID},getWeakData=function(e,t){if(!hasOwn$8(e,METADATA)){if(!isExtensible2(e))return!0;if(!t)return!1;setMetadata(e)}return e[METADATA].weakData},onFreeze=function(e){return FREEZING&&REQUIRED&&isExtensible2(e)&&!hasOwn$8(e,METADATA)&&setMetadata(e),e},enable=function(){meta.enable=function(){},REQUIRED=!0;var e=getOwnPropertyNamesModule$1.f,t=uncurryThis$i([].splice),r={};r[METADATA]=1,e(r).length&&(getOwnPropertyNamesModule$1.f=function(r){for(var n=e(r),i=0,a=n.length;i<a;i++)if(n[i]===METADATA){t(n,i,1);break}return n},$$H({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:getOwnPropertyNamesExternalModule.f}))},meta=internalMetadata.exports={enable:enable,fastKey:fastKey$1,getWeakData:getWeakData,onFreeze:onFreeze};hiddenKeys$1[METADATA]=!0;var internalMetadataExports=internalMetadata.exports,$$G=_export,global$d=global$M,uncurryThis$h=functionUncurryThis,isForced$1=isForced_1,defineBuiltIn$5=defineBuiltIn$j,InternalMetadataModule=internalMetadataExports,iterate$1=iterate$4,anInstance$1=anInstance$7,isCallable$3=isCallable$v,isNullOrUndefined$3=isNullOrUndefined$9,isObject$8=isObject$t,fails$f=fails$V,checkCorrectnessOfIteration$1=checkCorrectnessOfIteration$4,setToStringTag$1=setToStringTag$8,inheritIfRequired$1=inheritIfRequired$4,collection$2=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),a=n?"set":"add",o=global$d[e],s=o&&o.prototype,u=o,c={},l=function(e){var t=uncurryThis$h(s[e]);defineBuiltIn$5(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!isObject$8(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!isObject$8(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!isObject$8(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(isForced$1(e,!isCallable$3(o)||!(i||s.forEach&&!fails$f((function(){(new o).entries().next()})))))u=r.getConstructor(t,e,n,a),InternalMetadataModule.enable();else if(isForced$1(e,!0)){var d=new u,h=d[a](i?{}:-0,1)!=d,f=fails$f((function(){d.has(1)})),p=checkCorrectnessOfIteration$1((function(e){new o(e)})),m=!i&&fails$f((function(){for(var e=new o,t=5;t--;)e[a](t,t);return!e.has(-0)}));p||((u=t((function(e,t){anInstance$1(e,s);var r=inheritIfRequired$1(new o,e,u);return isNullOrUndefined$3(t)||iterate$1(t,r[a],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=u),(f||m)&&(l("delete"),l("has"),n&&l("get")),(m||h)&&l(a),i&&s.clear&&delete s.clear}return c[e]=u,$$G({global:!0,constructor:!0,forced:u!=o},c),setToStringTag$1(u,e),i||r.setStrong(u,e,n),u},defineProperty$4=objectDefineProperty.f,create$2=objectCreate,defineBuiltIns=defineBuiltIns$3,bind$2=functionBindContext,anInstance=anInstance$7,isNullOrUndefined$2=isNullOrUndefined$9,iterate=iterate$4,defineIterator=iteratorDefine,createIterResultObject=createIterResultObject$3,setSpecies$2=setSpecies$5,DESCRIPTORS$8=descriptors,fastKey=internalMetadataExports.fastKey,InternalStateModule$1=internalState,setInternalState$1=InternalStateModule$1.set,internalStateGetterFor=InternalStateModule$1.getterFor,collectionStrong$2={getConstructor:function(e,t,r,n){var i=e((function(e,i){anInstance(e,a),setInternalState$1(e,{type:t,index:create$2(null),first:void 0,last:void 0,size:0}),DESCRIPTORS$8||(e.size=0),isNullOrUndefined$2(i)||iterate(i,e[n],{that:e,AS_ENTRIES:r})})),a=i.prototype,o=internalStateGetterFor(t),s=function(e,t,r){var n,i,a=o(e),s=u(e,t);return s?s.value=r:(a.last=s={index:i=fastKey(t,!0),key:t,value:r,previous:n=a.last,next:void 0,removed:!1},a.first||(a.first=s),n&&(n.next=s),DESCRIPTORS$8?a.size++:e.size++,"F"!==i&&(a.index[i]=s)),e},u=function(e,t){var r,n=o(e),i=fastKey(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return defineBuiltIns(a,{clear:function(){for(var e=o(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,DESCRIPTORS$8?e.size=0:this.size=0},delete:function(e){var t=this,r=o(t),n=u(t,e);if(n){var i=n.next,a=n.previous;delete r.index[n.index],n.removed=!0,a&&(a.next=i),i&&(i.previous=a),r.first==n&&(r.first=i),r.last==n&&(r.last=a),DESCRIPTORS$8?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=o(this),n=bind$2(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),defineBuiltIns(a,r?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),DESCRIPTORS$8&&defineProperty$4(a,"size",{get:function(){return o(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=internalStateGetterFor(t),a=internalStateGetterFor(n);defineIterator(e,t,(function(e,t){setInternalState$1(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?createIterResultObject("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,createIterResultObject(void 0,!0))}),r?"entries":"values",!r,!0),setSpecies$2(t)}},collection$1=collection$2,collectionStrong$1=collectionStrong$2;collection$1("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),collectionStrong$1);var SeiService=function(){function e(t){var r=this;_classCallCheck$f(this,e),_defineProperty$d(this,"_seiSet",new Set),this.emitter=t,t.on(EVENT$2.SEI,(function(e){e&&r._seiSet.add(e)}))}return _createClass$f(e,[{key:"throw",value:function(e){var t=this;if(null!=e&&this._seiSet.size){var r=e-.2,n=e+.2,i=[];this._seiSet.forEach((function(e){e.time>=r&&e.time<=n&&i.push(e)})),i.forEach((function(e){t._seiSet.delete(e),t.emitter.emit(EVENT$2.SEI_IN_TIME,e)}))}}},{key:"reset",value:function(){this._seiSet.clear()}}]),e}(),BandwidthService=function(){function e(){_classCallCheck$f(this,e),_defineProperty$d(this,"_chunkSpeeds",[]),_defineProperty$d(this,"_speeds",[])}return _createClass$f(e,[{key:"addRecord",value:function(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}},{key:"addChunkRecord",value:function(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}},{key:"getAvgSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce((function(e,t){return e+t}))/this._speeds.length:this._chunkSpeeds.reduce((function(e,t){return e+t}))/this._chunkSpeeds.length:0}},{key:"getLatestSpeed",value:function(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}},{key:"reset",value:function(){this._chunkSpeeds=[],this._speeds=[]}}]),e}(),Stats=function(){function e(t){_classCallCheck$f(this,e),_defineProperty$d(this,"encodeType",""),_defineProperty$d(this,"audioCodec",""),_defineProperty$d(this,"videoCodec",""),_defineProperty$d(this,"domain",""),_defineProperty$d(this,"fps",0),_defineProperty$d(this,"bitrate",0),_defineProperty$d(this,"width",0),_defineProperty$d(this,"height",0),_defineProperty$d(this,"samplerate",0),_defineProperty$d(this,"channelCount",0),_defineProperty$d(this,"gop",0),_defineProperty$d(this,"_bitsAccumulateSize",0),_defineProperty$d(this,"_bitsAccumulateDuration",0),this._timescale=t}return _createClass$f(e,[{key:"getStats",value:function(){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}}},{key:"setEncodeType",value:function(e){this.encodeType=e}},{key:"setVideoMeta",value:function(e){this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen&&(this.fps=e.fpsNum/e.fpsDen)}},{key:"setAudioMeta",value:function(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}},{key:"setDomain",value:function(e){this.domain=e.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function(e){var t=this;if(!this.fps||this.fps>=100){var r=e[0];null!=r&&r.duration&&(this.fps=Math.round(this._timescale/r.duration))}e.forEach((function(e){1===e.gopId&&t.gop++,t._bitsAccumulateDuration+=e.duration/(t._timescale/1e3),t._bitsAccumulateSize+=e.units.reduce((function(e,t){return e+t.length}),0),t._bitsAccumulateDuration>=1e3&&(t.bitrate=8*t._bitsAccumulateSize,t._bitsAccumulateDuration=0,t._bitsAccumulateSize=0)}))}}]),e}(),MediaStatsService=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;_classCallCheck$f(this,e),_defineProperty$d(this,"_core",null),_defineProperty$d(this,"_samples",[]),this._core=t,this._timescale=r,this._stats=new Stats(r),this._bindEvents()}return _createClass$f(e,[{key:"getStats",value:function(){var e,t,r,n,i,a,o,s=(null===(e=this._core)||void 0===e?void 0:e.media)||{},u=s.currentTime,c=void 0===u?0:u,l=s.decodeFps,d=void 0===l?0:l;return _objectSpread2$7(_objectSpread2$7({},this._stats.getStats()),{},{downloadSpeed:(null===(t=this._core)||void 0===t||null===(r=t.speedInfo)||void 0===r?void 0:r.call(t).speed)||0,avgSpeed:(null===(n=this._core)||void 0===n||null===(i=n.speedInfo)||void 0===i?void 0:i.call(n).avgSpeed)||0,currentTime:c,bufferEnd:(null===(a=this._core)||void 0===a||null===(o=a.bufferInfo())||void 0===o?void 0:o.remaining)||0,decodeFps:d})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(EVENT$2.DEMUXED_TRACK,(function(t){return e._stats.updateBitrate(t.samples)})),this._core.on(EVENT$2.METADATA_PARSED,(function(t){"video"===t.type?e._stats.setVideoMeta(t.track):e._stats.setAudioMeta(t.track)})),this._core.on(EVENT$2.TTFB,(function(t){e._stats.setDomain(t.responseUrl)}))}},{key:"reset",value:function(){this._samples=[],this._stats=new Stats(this._timescale)}}]),e}();function _classCallCheck$e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$e(e,t,r){return t&&_defineProperties$e(e.prototype,t),r&&_defineProperties$e(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$b(e,t)}function _getPrototypeOf$b(e){return(_getPrototypeOf$b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$b(e,t){return(_setPrototypeOf$b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized$b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$b(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$b(e)}function _createSuper$b(e){var t=_isNativeReflectConstruct$b();return function(){var r,n=_getPrototypeOf$b(e);if(t){var i=_getPrototypeOf$b(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$b(this,r)}}function _slicedToArray$6(e,t){return _arrayWithHoles$6(e)||_iterableToArrayLimit$6(e,t)||_unsupportedIterableToArray$a(e,t)||_nonIterableRest$6()}function _toConsumableArray$8(e){return _arrayWithoutHoles$8(e)||_iterableToArray$8(e)||_unsupportedIterableToArray$a(e)||_nonIterableSpread$8()}function _arrayWithoutHoles$8(e){if(Array.isArray(e))return _arrayLikeToArray$a(e)}function _arrayWithHoles$6(e){if(Array.isArray(e))return e}function _iterableToArray$8(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit$6(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}function _unsupportedIterableToArray$a(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$a(e,t):void 0}}function _arrayLikeToArray$a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread$8(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest$6(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var isObject$7=isObject$t,classof$1=classofRaw$2,wellKnownSymbol$5=wellKnownSymbol$u,MATCH$2=wellKnownSymbol$5("match"),isRegexp=function(e){var t;return isObject$7(e)&&(void 0!==(t=e[MATCH$2])?!!t:"RegExp"==classof$1(e))},isRegExp$2=isRegexp,$TypeError$1=TypeError,notARegexp=function(e){if(isRegExp$2(e))throw $TypeError$1("The method doesn't accept regular expressions");return e},wellKnownSymbol$4=wellKnownSymbol$u,MATCH$1=wellKnownSymbol$4("match"),correctIsRegexpLogic=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[MATCH$1]=!1,"/./"[e](t)}catch(e){}}return!1},$$F=_export,uncurryThis$g=functionUncurryThis,notARegExp$1=notARegexp,requireObjectCoercible$5=requireObjectCoercible$b,toString$e=toString$l,correctIsRegExpLogic$1=correctIsRegexpLogic,stringIndexOf$1=uncurryThis$g("".indexOf);$$F({target:"String",proto:!0,forced:!correctIsRegExpLogic$1("includes")},{includes:function(e){return!!~stringIndexOf$1(toString$e(requireObjectCoercible$5(this)),toString$e(notARegExp$1(e)),arguments.length>1?arguments[1]:void 0)}});var TrackType$3={VIDEO:"video",AUDIO:"audio",METADATA:"metadata"},VideoCodecType$3={AVC:"avc",HEVC:"hevc"},AudioCodecType$2={AAC:"aac",G711PCMA:"g7110a",G711PCMU:"g7110m"},WarningType$1={LARGE_AV_SHIFT:"LARGE_AV_SHIFT",LARGE_VIDEO_GAP:"LARGE_VIDEO_GAP",LARGE_VIDEO_GAP_BETWEEN_CHUNK:"LARGE_VIDEO_GAP_BETWEEN_CHUNK",LARGE_AUDIO_GAP:"LARGE_AUDIO_GAP",AUDIO_FILLED:"AUDIO_FILLED",AUDIO_DROPPED:"AUDIO_DROPPED"},VideoTrack$2=function(){function e(){_classCallCheck$e(this,e),_defineProperty$c(this,"id",1),_defineProperty$c(this,"type",TrackType$3.VIDEO),_defineProperty$c(this,"codecType",VideoCodecType$3.AVC),_defineProperty$c(this,"pid",-1),_defineProperty$c(this,"hvcC",void 0),_defineProperty$c(this,"codec",""),_defineProperty$c(this,"timescale",0),_defineProperty$c(this,"formatTimescale",0),_defineProperty$c(this,"sequenceNumber",0),_defineProperty$c(this,"baseMediaDecodeTime",0),_defineProperty$c(this,"baseDts",0),_defineProperty$c(this,"duration",0),_defineProperty$c(this,"warnings",[]),_defineProperty$c(this,"samples",[]),_defineProperty$c(this,"pps",[]),_defineProperty$c(this,"sps",[]),_defineProperty$c(this,"vps",[]),_defineProperty$c(this,"fpsNum",0),_defineProperty$c(this,"fpsDen",0),_defineProperty$c(this,"sarRatio",[]),_defineProperty$c(this,"width",0),_defineProperty$c(this,"height",0),_defineProperty$c(this,"nalUnitSize",4),_defineProperty$c(this,"present",!1),_defineProperty$c(this,"isVideoEncryption",!1),_defineProperty$c(this,"isAudioEncryption",!1),_defineProperty$c(this,"isVideo",!0),_defineProperty$c(this,"kid",null),_defineProperty$c(this,"pssh",null),_defineProperty$c(this,"ext",void 0)}return _createClass$e(e,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"exist",value:function(){return!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),e}(),AudioTrack$2=function(){function e(){_classCallCheck$e(this,e),_defineProperty$c(this,"id",2),_defineProperty$c(this,"type",TrackType$3.AUDIO),_defineProperty$c(this,"codecType",AudioCodecType$2.AAC),_defineProperty$c(this,"pid",-1),_defineProperty$c(this,"codec",""),_defineProperty$c(this,"sequenceNumber",0),_defineProperty$c(this,"sampleDuration",0),_defineProperty$c(this,"timescale",0),_defineProperty$c(this,"formatTimescale",0),_defineProperty$c(this,"baseMediaDecodeTime",0),_defineProperty$c(this,"duration",0),_defineProperty$c(this,"warnings",[]),_defineProperty$c(this,"samples",[]),_defineProperty$c(this,"baseDts",0),_defineProperty$c(this,"sampleSize",16),_defineProperty$c(this,"sampleRate",0),_defineProperty$c(this,"channelCount",0),_defineProperty$c(this,"objectType",0),_defineProperty$c(this,"sampleRateIndex",0),_defineProperty$c(this,"config",[]),_defineProperty$c(this,"present",!1),_defineProperty$c(this,"isVideoEncryption",!1),_defineProperty$c(this,"isAudioEncryption",!1),_defineProperty$c(this,"kid",null),_defineProperty$c(this,"ext",void 0)}return _createClass$e(e,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&this.codec&&this.codecType===AudioCodecType$2.AAC)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}}]),e}(),VideoSample$2=function(){function e(t,r,n){_classCallCheck$e(this,e),_defineProperty$c(this,"flag",{}),_defineProperty$c(this,"keyframe",!1),_defineProperty$c(this,"gopId",0),_defineProperty$c(this,"duration",0),_defineProperty$c(this,"size",0),_defineProperty$c(this,"units",[]),_defineProperty$c(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=r,n&&(this.units=n)}return _createClass$e(e,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),e}(),AudioSample$2=_createClass$e((function e(t,r,n,i){_classCallCheck$e(this,e),_defineProperty$c(this,"duration",1024),_defineProperty$c(this,"flag",{dependsOn:2,isNonSyncSample:0}),_defineProperty$c(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=r,this.size=r.byteLength,this.sampleOffset=i,n&&(this.duration=n)})),Sample$1=_createClass$e((function e(t,r){_classCallCheck$e(this,e),_defineProperty$c(this,"time",0),this.data=t,this.originPts=this.pts=r})),FlvScriptSample=function(e){_inherits$b(r,Sample$1);var t=_createSuper$b(r);function r(){return _classCallCheck$e(this,r),t.apply(this,arguments)}return _createClass$e(r)}(),SeiSample$1=function(e){_inherits$b(r,Sample$1);var t=_createSuper$b(r);function r(){return _classCallCheck$e(this,r),t.apply(this,arguments)}return _createClass$e(r)}(),MetadataTrack$2=function(){function e(){_classCallCheck$e(this,e),_defineProperty$c(this,"id",3),_defineProperty$c(this,"type",TrackType$3.METADATA),_defineProperty$c(this,"timescale",0),_defineProperty$c(this,"flvScriptSamples",[]),_defineProperty$c(this,"seiSamples",[])}return _createClass$e(e,[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}]),e}(),global$c=global$M,globalIsFinite=global$c.isFinite,numberIsFinite$1=Number.isFinite||function(e){return"number"==typeof e&&globalIsFinite(e)},$$E=_export,numberIsFinite=numberIsFinite$1;$$E({target:"Number",stat:!0},{isFinite:numberIsFinite});var call$5=functionCall,hasOwn$7=hasOwnProperty_1,isPrototypeOf$3=objectIsPrototypeOf,regExpFlags$1=regexpFlags$1,RegExpPrototype$4=RegExp.prototype,regexpGetFlags=function(e){var t=e.flags;return void 0!==t||"flags"in RegExpPrototype$4||hasOwn$7(e,"flags")||!isPrototypeOf$3(RegExpPrototype$4,e)?t:call$5(regExpFlags$1,e)},PROPER_FUNCTION_NAME=functionName.PROPER,defineBuiltIn$4=defineBuiltIn$j,anObject$6=anObject$m,$toString$1=toString$l,fails$e=fails$V,getRegExpFlags$1=regexpGetFlags,TO_STRING$1="toString",RegExpPrototype$3=RegExp.prototype,nativeToString=RegExpPrototype$3[TO_STRING$1],NOT_GENERIC=fails$e((function(){return"/a/b"!=nativeToString.call({source:"a",flags:"b"})})),INCORRECT_NAME=PROPER_FUNCTION_NAME&&nativeToString.name!=TO_STRING$1;(NOT_GENERIC||INCORRECT_NAME)&&defineBuiltIn$4(RegExp.prototype,TO_STRING$1,(function(){var e=anObject$6(this);return"/"+$toString$1(e.source)+"/"+$toString$1(getRegExpFlags$1(e))}),{unsafe:!0});var Logger$8=function(){function e(t){_classCallCheck$e(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return _createClass$e(e,[{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();_defineProperty$c(Logger$8,"disabled",!0);var $$D=_export,call$4=functionCall,isCallable$2=isCallable$v,anObject$5=anObject$m,toString$d=toString$l,DELEGATES_TO_EXEC=function(){var e=!1,t=/[ac]/;return t.exec=function(){return e=!0,/./.exec.apply(this,arguments)},!0===t.test("abc")&&e}(),nativeTest=/./.test;$$D({target:"RegExp",proto:!0,forced:!DELEGATES_TO_EXEC},{test:function(e){var t=anObject$5(this),r=toString$d(e),n=t.exec;if(!isCallable$2(n))return call$4(nativeTest,t,r);var i=call$4(n,t,r);return null!==i&&(anObject$5(i),!0)}});var isBrowser$3="undefined"!=typeof window,ua$2=isBrowser$3&&navigator.userAgent.toLocaleLowerCase(),isSafari$1=isBrowser$3&&/^((?!chrome|android).)*safari/.test(ua$2),isFirefox$2=isBrowser$3&&ua$2.includes("firefox"),isAndroid$2=isBrowser$3&&ua$2.includes("android"),AAC$2=function(){function e(){_classCallCheck$e(this,e)}return _createClass$e(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var a=i,o=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,d=1+((192&t[i+2])>>>6),h=(1&t[i+2])<<2|(192&t[i+3])>>>6,f=e._getConfig(s,h,d),p=f.config,m=f.codec,y=0,g=e.getFrameDuration(u);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(n-i<(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]),o.push({pts:r+y*g,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:a,remaining:i>=n?void 0:t.subarray(i),frames:o,samplingFrequencyIndex:s,sampleRate:u,objectType:d,channelCount:h,codec:m,config:p,originCodec:"mp4a.40.".concat(d)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,a=e.FREQ[n];if(a){var o=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:a,objectType:r,channelCount:i,config:o.config,codec:o.codec,originCodec:"mp4a.40.".concat(r)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,a=[];return isFirefox$2?e>=6?(n=5,i=e-3):(n=2,i=e):isAndroid$2?(n=2,i=e):(n=2===r||5===r?r:5,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),a[0]=n<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=t<<3,5===n&&(a[1]|=(14&i)>>1,a[2]=(1&i)<<7,a[2]|=8,a[3]=0),{config:a,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(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])}}}]),e}();_defineProperty$c(AAC$2,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var LARGE_AV_FIRST_FRAME_GAP$1=500,AUDIO_GAP_OVERLAP_THRESHOLD_COUNT$1=3,MAX_SILENT_FRAME_DURATION$1=1e3,AUDIO_EXCETION_LOG_EMIT_DURATION$1=5e3,MAX_VIDEO_FRAME_DURATION$1=1e3,MAX_DTS_DELTA_WITH_NEXT_CHUNK$1=200,VIDEO_EXCETION_LOG_EMIT_DURATION=5e3,TRACK_BREACKED_CHECK_TIME=5,FlvFixer=function(){function e(t,r,n){_classCallCheck$e(this,e),this.videoTrack=t,this.audioTrack=r,this.metadataTrack=n,this._baseDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastVideoDuration=0,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0}return _createClass$e(e,[{key:"fix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=Math.round(1e3*t);var i=this.videoTrack,a=this.audioTrack;if(!r&&n||(this._videoLastSample=null,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=0,this._videoTimestampBreak=0,this._lastAudioExceptionGapDot=-1/0,this._lastAudioExceptionOverlapDot=-1/0,this._lastAudioExceptionLargeGapDot=-1/0,this._lastVideoExceptionLargeGapDot=-1/0,this._lastVideoExceptionChunkFirstDtsDot=-1/0),r&&!n&&(this._baseDtsInited=!1),this._baseDtsInited||this._calculateBaseDts(a,i),!n&&t&&(this._audioNextPts=this._videoNextDts=t),this._baseDtsInited&&(this._videoTimestampBreak||!this.videoTrack.exist())&&(this._audioTimestampBreak||!this.audioTrack.exist())&&this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(a),this._fixVideo(i),this.metadataTrack.exist()){var o=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/o})),this.metadataTrack.flvScriptSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/o}))}i.samples.length&&(i.baseMediaDecodeTime=i.samples[0].dts),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts*a.timescale/1e3)}},{key:"_fixVideo",value:function(e){var t=this,r=e.samples;if(r.length){var n;if(r.forEach((function(e){e.dts-=t._baseDts,e.pts-=t._baseDts})),e.fpsNum&&e.fpsDen)n=e.timescale*(e.fpsDen/e.fpsNum);else if(e.length>1){var i=e.samples[0],a=e.samples[r.length-1];n=Math.floor((a.dts-i.dts)/(r.length-1))}else n=this._lastVideoDuration||40;var o=r.pop();if(this._videoLastSample&&r.unshift(this._videoLastSample),this._videoLastSample=o,r.length){if(void 0===this._videoNextDts){var s=r[0];this._videoNextDts=s.dts}var u=r.length,c=0,l=r[0],d=this._videoNextDts-l.dts;if(Math.abs(d)>MAX_DTS_DELTA_WITH_NEXT_CHUNK$1){var h;if(Math.abs(l.dts-this._lastVideoExceptionChunkFirstDtsDot)>VIDEO_EXCETION_LOG_EMIT_DURATION)this._lastVideoExceptionChunkFirstDtsDot=l.dts,e.warnings.push({type:WarningType$1.LARGE_VIDEO_GAP_BETWEEN_CHUNK,nextDts:this._videoNextDts,firstSampleDts:l.dts,nextSampleDts:null===(h=r[1])||void 0===h?void 0:h.dts,sampleDuration:d});this._videoTimestampBreak>=TRACK_BREACKED_CHECK_TIME?(this._videoNextDts=l.dts,this._videoTimestampBreak=0):(l.dts+=d,l.pts+=d,this.audioTrack.exist()||(this._videoTimestampBreak=1))}for(var f=0;f<u;f++){var p=r[f].dts,m=r[f+1];((c=f<u-1?m.dts-p:o?o.dts-p:n)>MAX_VIDEO_FRAME_DURATION$1||c<0)&&(this._videoTimestampBreak++,Math.abs(p-this._lastVideoExceptionLargeGapDot)>VIDEO_EXCETION_LOG_EMIT_DURATION&&(this._lastVideoExceptionLargeGapDot=p,e.warnings.push({type:WarningType$1.LARGE_VIDEO_GAP,time:p/e.timescale,dts:p,originDts:r[f].originDts,nextDts:this._videoNextDts,sampleDuration:c,refSampleDuration:n})),c=n),r[f].duration=c,this._videoNextDts+=c,this._lastVideoDuration=c}}}}},{key:"_fixAudio",value:function(e){var t=this,r=e.samples;r.length&&(r.forEach((function(e){e.dts=e.pts-=t._baseDts})),this._doFixAudioInternal(e,r,1e3))}},{key:"_calculateBaseDts",value:function(e,t){var r=e.samples,n=t.samples;if(!r.length&&!n.length)return!1;var i=1/0,a=1/0;r.length&&(e.baseDts=i=r[0].pts),n.length&&(t.baseDts=a=n[0].dts),this._baseDts=Math.min(i,a);var o=a-i;return Number.isFinite(o)&&Math.abs(o)>LARGE_AV_FIRST_FRAME_GAP$1&&t.warnings.push({type:WarningType$1.LARGE_AV_SHIFT,videoBaseDts:a,audioBasePts:i,baseDts:this._baseDts,delta:o}),this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){this._calculateBaseDts(this.audioTrack,this.videoTrack)&&(this.audioTrack.exist()?this.videoTrack.exist()?this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts):this._baseDts-=this._audioNextPts:this._baseDts-=this._videoNextDts,this._videoTimestampBreak=0,this._audioTimestampBreak=0)}},{key:"_doFixAudioInternal",value:function(e,t,r){e.sampleDuration||(e.sampleDuration=e.codecType===AudioCodecType$2.AAC?AAC$2.getFrameDuration(e.timescale,r):this._getG711Duration(e));var n=e.sampleDuration,i=e.codecType===AudioCodecType$2.AAC?1024:n*e.timescale/1e3;if(void 0===this._audioNextPts){var a=t[0];this._audioNextPts=a.pts}for(var o=0;o<t.length;o++){var s=this._audioNextPts,u=t[o],c=u.pts-s;if(0===o&&this._audioTimestampBreak>=TRACK_BREACKED_CHECK_TIME&&(s=this._audioNextPts=u.dts,c=0,this._audioTimestampBreak=0),!this._audioTimestampBreak&&c>=AUDIO_GAP_OVERLAP_THRESHOLD_COUNT$1*n&&c<=MAX_SILENT_FRAME_DURATION$1&&!isSafari$1){var l=this._getSilentFrame(e)||t[0].data.subarray(),d=Math.floor(c/n);Math.abs(u.pts-this._lastAudioExceptionGapDot)>AUDIO_EXCETION_LOG_EMIT_DURATION$1&&(this._lastAudioExceptionGapDot=u.pts,e.warnings.push({type:WarningType$1.AUDIO_FILLED,pts:u.pts,originPts:u.originPts,count:d,nextPts:s,refSampleDuration:n}));for(var h=0;h<d;h++){var f=new AudioSample$2(Math.floor(this._audioNextPts+n)-Math.floor(this._audioNextPts),l,i);f.originPts=Math.floor(this._baseDts+s),t.splice(o,0,f),this._audioNextPts+=n,o++}o--}else c<=-AUDIO_GAP_OVERLAP_THRESHOLD_COUNT$1*n&&c>=-1*MAX_SILENT_FRAME_DURATION$1?(Math.abs(u.pts-this._lastAudioExceptionOverlapDot)>AUDIO_EXCETION_LOG_EMIT_DURATION$1&&(this._lastAudioExceptionOverlapDot=u.pts,e.warnings.push({type:WarningType$1.AUDIO_DROPPED,pts:u.pts,originPts:u.originPts,nextPts:s,refSampleDuration:n})),t.splice(o,1),o--):(Math.abs(c)>MAX_SILENT_FRAME_DURATION$1&&(this._audioTimestampBreak++,Math.abs(u.pts-this._lastAudioExceptionLargeGapDot)>AUDIO_EXCETION_LOG_EMIT_DURATION$1&&(this._lastAudioExceptionLargeGapDot=u.pts,e.warnings.push({type:WarningType$1.LARGE_AUDIO_GAP,time:u.pts/1e3,pts:u.pts,originPts:u.originPts,nextPts:s,sampleDuration:c,refSampleDuration:n}))),u.dts=u.pts=s,u.duration=i,this._audioNextPts+=n)}}},{key:"_getG711Duration",value:function(e){var t=e.sampleSize,r=e.channelCount,n=e.sampleRate,i=e.samples[0];if(i)return 2*i.data.byteLength/r/(t/8)/n*1e3}},{key:"_getSilentFrame",value:function(e){return e.codecType===AudioCodecType$2.AAC?AAC$2.getSilentFrame(e.codec,e.channelCount):new Uint8Array(8*e.sampleDuration*e.channelCount)}}]),e}();function concatUint8Array$4(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t.filter(Boolean);var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}function readBig32$2(e){var 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 getAvcCodec$2(e){for(var t,r="avc1.",n=0;n<3;n++)(t=e[n].toString(16)).length<2&&(t="0".concat(t)),r+=t;return r}function parse$3(e){if(!Array.isArray(e)){for(var t=[],r="",n=0;n<e.length;n++)n%2&&(r=e[n-1]+e[n],t.push(parseInt(r,16)),r="");return t}return e.map((function(e){return parseInt(e,16)}))}var NALu$1=function(){function e(){_classCallCheck$e(this,e)}return _createClass$e(e,null,[{key:"parseAnnexB",value:function(e){for(var t=e.length,r=2,n=0;null!==e[r]&&void 0!==e[r]&&1!==e[r];)r++;if((n=++r+2)>=t)return[];for(var i=[];n<t;)switch(e[n]){case 0:if(0!==e[n-1]){n+=2;break}if(0!==e[n-2]){n++;break}r!==n-2&&i.push(e.subarray(r,n-2));do{n++}while(1!==e[n]&&n<t);n=(r=n+1)+2;break;case 1:if(0!==e[n-1]||0!==e[n-2]){n+=3;break}r!==n-2&&i.push(e.subarray(r,n-2)),n=(r=n+1)+2;break;default:n+=3}return r<t&&i.push(e.subarray(r)),i}},{key:"parseAvcC",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var r,n=e.length,i=[],a=0;a+t<n;)if(r=readBig32$2(e,a),3===t&&(r>>>=8),a+=t,r){if(a+r>n)break;i.push(e.subarray(a,a+r)),a+=r}return i}}},{key:"parseSEI",value:function(e,t){for(var r=e.length,n=t?2:1,i=0,a=0,o="";255===e[n];)i+=255,n++;for(i+=e[n++];255===e[n];)a+=255,n++;if(a+=e[n++],5===i&&r>n+16)for(var s=0;s<16;s++)o+=e[n].toString(16),n++;return{payload:e.subarray(n),type:i,size:a,uuid:o}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(!r.length)return e;var i=t-r.length,a=new Uint8Array(i),o=0;for(n=0;n<i;o++,n++)o===r[0]&&(o++,r.shift()),a[n]=e[o];return a}}]),e}(),ExpGolomb$1=function(){function e(t){if(_classCallCheck$e(this,e),_defineProperty$c(this,"_bytesAvailable",void 0),_defineProperty$c(this,"_bitsAvailable",0),_defineProperty$c(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return _createClass$e(e,[{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var r=new Uint8Array(4);r.set(this._data.subarray(e,e+t)),this._word=new DataView(r.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),r=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if(0!=(this._word&2147483648>>>e))return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r}}]),e}(),AVC$1=function(){function e(){_classCallCheck$e(this,e)}return _createClass$e(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var r,n,i=1+(3&t[4]),a=[],o=[],s=6,u=31&t[5],c=0;c<u;c++)if(n=t[s]<<8|t[s+1],s+=2,n){var l=t.subarray(s,s+n);s+=n,a.push(l),r||(r=e.parseSPS(NALu$1.removeEPB(l)))}var d,h=t[s];s++;for(var f=0;f<h;f++)d=t[s]<<8|t[s+1],s+=2,d&&(o.push(t.subarray(s,s+d)),s+=d);return{sps:r,spsArr:a,ppsArr:o,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new ExpGolomb$1(e);t.readUByte();var r=t.readUByte(),n=t.readUByte(),i=t.readUByte();t.skipUEG();var a=420;if(100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r){var o=t.readUEG();if(o<=3&&(a=[0,420,422,444][o]),3===o&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==o?8:12,u=0;u<s;u++)t.readBool()&&(u<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();var c=t.readUEG();if(0===c)t.readUEG();else if(1===c){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var l=t.readUEG(),d=0;d<l;d++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var h=t.readUEG(),f=t.readUEG(),p=t.readBits(1);0===p&&t.skipBits(1),t.skipBits(1);var m,y,g,v,b,_=0,A=0,T=0,E=0;if(t.readBool()&&(_=t.readUEG(),A=t.readUEG(),T=t.readUEG(),E=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:m=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()]}if(t.readBool()&&t.readBool(),t.readBool()&&(t.readBits(4),t.readBool()&&t.readBits(24)),t.readBool()&&(t.readUEG(),t.readUEG()),t.readBool()){var S=t.readBits(32),$=t.readBits(32);y=t.readBool(),b=(g=$)/(v=2*S)}}return{codec:getAvcCodec$2(e.subarray(1,4)),profileIdc:r,profileCompatibility:n,levelIdc:i,chromaFormat:a,width:Math.ceil(16*(h+1)-2*(_+A)),height:(2-p)*(f+1)*16-(p?2:4)*(T+E),sarRatio:m,fpsNum:g,fpsDen:v,fps:b,fixedFrame:y}}}]),e}(),HEVC$1=function(){function e(){_classCallCheck$e(this,e)}return _createClass$e(e,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t.length<23)){r=r||{};for(var n,i,a,o,s,u=1+(3&t[21]),c=[],l=[],d=[],h=23,f=t[22],p=0;p<f;p++){a=63&t[h],o=t[h+1]<<8|t[h+2],h+=3;for(var m=0;m<o;m++)if(s=t[h]<<8|t[h+1],h+=2,s){switch(a){case 32:var y=t.subarray(h,h+s);n||(n=e.parseVPS(NALu$1.removeEPB(y),r)),d.push(y);break;case 33:var g=t.subarray(h,h+s);i||(i=e.parseSPS(NALu$1.removeEPB(g),r)),c.push(g);break;case 34:l.push(t.subarray(h,h+s))}h+=s}}return{hvcC:r,sps:i,spsArr:c,ppsArr:l,vpsArr:d,nalUnitSize:u}}}},{key:"parseVPS",value:function(t,r){r=r||{};var n=new ExpGolomb$1(t);n.readUByte(),n.readUByte(),n.readBits(12);var i=n.readBits(3);return r.numTemporalLayers=Math.max(r.numTemporalLayers||0,i+1),n.readBits(17),e._parseProfileTierLevel(n,i,r),r}},{key:"parseSPS",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r=r||{};var n=new ExpGolomb$1(t);n.readUByte(),n.readUByte(),n.readBits(4);var i=n.readBits(3);r.numTemporalLayers=Math.max(i+1,r.numTemporalLayers||0),r.temporalIdNested=n.readBits(1),e._parseProfileTierLevel(n,i,r),n.readUEG();var a=r.chromaFormatIdc=n.readUEG(),o=420;a<=3&&(o=[0,420,422,444][a]);var s=0;3===a&&(s=n.readBits(1));var u,c,l,d,h=n.readUEG(),f=n.readUEG(),p=n.readBits(1);(1===p&&(u=n.readUEG(),c=n.readUEG(),l=n.readUEG(),d=n.readUEG()),r.bitDepthLumaMinus8=n.readUEG(),r.bitDepthChromaMinus8=n.readUEG(),1===p)&&(h-=(1!==a&&2!==a||0!==s?1:2)*(c+u),f-=(1===a&&0===s?2:1)*(d+l));return{codec:"hev1.1.6.L93.B0",width:h,height:f,chromaFormat:o,hvcC:r}}},{key:"_parseProfileTierLevel",value:function(e,t,r){var n=r.generalTierFlag||0;r.generalProfileSpace=e.readBits(2),r.generalTierFlag=Math.max(e.readBits(1),n),r.generalProfileIdc=Math.max(e.readBits(5),r.generalProfileIdc||0),r.generalProfileCompatibilityFlags=e.readBits(32),r.generalConstraintIndicatorFlags=[e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)];var i=e.readBits(8);n<r.generalTierFlag?r.generalLevelIdc=i:r.generalLevelIdc=Math.max(i,r.generalLevelIdc||0);for(var a=[],o=[],s=0;s<t;s++)a[s]=e.readBits(1),o[s]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var u=0;u<t;u++)0!==a[u]&&(e.readBits(2),e.readBits(1),e.readBits(5),e.readBits(16),e.readBits(16),e.readBits(4),e.readBits(16),e.readBits(16),e.readBits(12)),0!==o[u]&&e.readBits(8)}}]),e}(),UTF8=function(){function e(){_classCallCheck$e(this,e)}return _createClass$e(e,null,[{key:"decode",value:function(t){for(var r=[],n=t,i=0,a=t.length;i<a;)if(n[i]<128)r.push(String.fromCharCode(n[i])),++i;else{if(n[i]<192);else if(n[i]<224){if(e._checkContinuation(n,i,1)){var o=(31&n[i])<<6|63&n[i+1];if(o>=128){r.push(String.fromCharCode(65535&o)),i+=2;continue}}}else if(n[i]<240){if(e._checkContinuation(n,i,2)){var s=(15&n[i])<<12|(63&n[i+1])<<6|63&n[i+2];if(s>=2048&&55296!=(63488&s)){r.push(String.fromCharCode(65535&s)),i+=3;continue}}}else if(n[i]<248&&e._checkContinuation(n,i,3)){var u=(7&n[i])<<18|(63&n[i+1])<<12|(63&n[i+2])<<6|63&n[i+3];if(u>65536&&u<1114112){u-=65536,r.push(String.fromCharCode(u>>>10|55296)),r.push(String.fromCharCode(1023&u|56320)),i+=4;continue}}r.push(String.fromCharCode(65533)),++i}return r.join("")}},{key:"_checkContinuation",value:function(e,t,r){var n=e;if(t+r<n.length){for(;r--;)if(128!=(192&n[++t]))return!1;return!0}return!1}}]),e}(),AMF=function(){function e(){_classCallCheck$e(this,e)}return _createClass$e(e,null,[{key:"parse",value:function(t){if(!(t.length<3)){var r={},n=e._parseValue(new DataView(t.buffer,t.byteOffset,t.byteLength)),i=e._parseValue(new DataView(t.buffer,t.byteOffset+n.size,t.byteLength-n.size));return r[n.data]=i.data,r}}},{key:"_parseValue",value:function(t){var r,n=t.byteLength,i=1,a=!1;switch(t.getUint8(0)){case 0:r=t.getFloat64(1),i+=8;break;case 1:r=!!t.getUint8(1),i+=1;break;case 2:var o=e._parseString(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i));r=o.data,i+=o.size;break;case 3:r={};var s=0;for(9==(16777215&t.getUint32(n-4))&&(s=3);i<n-4;){var u=e._parseObject(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i-s)),c=u.size,l=u.data;if(u.isEnd)break;r[l.name]=l.value,i+=c}if(i<=n-3)9===(16777215&t.getUint32(i-1))&&(i+=3);break;case 8:r={},i+=4;var d=0;for(9==(16777215&t.getUint32(n-4))&&(d=3);i<n-8;){var h=e._parseObject(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i-d)),f=h.size,p=h.data;if(h.isEnd)break;r[p.name]=p.value,i+=f}if(i<=n-3)9===(16777215&t.getUint32(i-1))&&(i+=3);break;case 9:r=void 0,i=1,a=!0;break;case 10:r=[];var m=t.getUint32(1);i+=4;for(var y=0;y<m;y++){var g=e._parseValue(new DataView(t.buffer,t.byteOffset+i,t.byteLength-i)),v=g.data,b=g.size;r.push(v),i+=b}break;case 11:var _=t.getFloat64(i)+6e4*t.getInt16(i+8);r=new Date(_),i+=10;break;case 12:var A=t.getUint32(1);i+=4,r="",A>0&&(r=UTF8.decode(new Uint8Array(t.buffer,t.byteOffset+i,A))),i+=A;break;default:i=n}return{data:r,size:i,isEnd:a}}},{key:"_parseString",value:function(e){var t=e.getUint16(0),r="";return t>0&&(r=UTF8.decode(new Uint8Array(e.buffer,e.byteOffset+2,t))),{data:r,size:2+t}}},{key:"_parseObject",value:function(t){if(!(t.byteLength<3)){var r=e._parseString(t),n=e._parseValue(new DataView(t.buffer,t.byteOffset+r.size,t.byteLength-r.size));return{data:{name:r.data,value:n.data},size:r.size+n.size,isEnd:n.isEnd}}}}]),e}(),logger$8=new Logger$8("FlvDemuxer"),FlvDemuxer=function(){function e(t,r,n){_classCallCheck$e(this,e),_defineProperty$c(this,"_headerParsed",!1),_defineProperty$c(this,"_remainingData",null),_defineProperty$c(this,"_gopId",0),_defineProperty$c(this,"_needAddMetaBeforeKeyFrameNal",!0),this.videoTrack=t||new VideoTrack$2,this.audioTrack=r||new AudioTrack$2,this.metadataTrack=n||new MetadataTrack$2,this._fixer=new FlvFixer(this.videoTrack,this.audioTrack,this.metadataTrack)}return _createClass$e(e,[{key:"demux",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this.audioTrack,a=this.videoTrack,o=this.metadataTrack;if(!r&&n||(this._remainingData=null,this._headerParsed=!1),r?(a.reset(),i.reset(),o.reset()):(a.samples=[],i.samples=[],o.seiSamples=[],o.flvScriptSamples=[],a.warnings=[],i.warnings=[],this._remainingData&&(t=concatUint8Array$4(this._remainingData,t),this._remainingData=null)),!t.length)return{videoTrack:a,audioTrack:i,metadataTrack:o};var s=0;if(!this._headerParsed){if(!e.probe(t))throw new Error("Invalid flv file");i.present=(4&t[4])>>>2!=0,a.present=0!=(1&t[4]),this._headerParsed=!0,s=readBig32$2(t,5)+4}for(var u,c,l,d,h,f=t.length;s+15<f&&(u=t[s],!(s+15+(c=t[s+1]<<16|t[s+2]<<8|t[s+3])>f));)l=(t[s+7]<<24>>>0)+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6],s+=11,d=t.subarray(s,s+c),8===u?this._parseAudio(d,l):9===u?this._parseVideo(d,l):18===u?this._parseScript(d,l):logger$8.warn("Invalid tag type: ".concat(u)),(h=readBig32$2(t,s+=c))!==11+c&&logger$8.warn("Invalid PrevTagSize ".concat(h," (").concat(11+c,")")),s+=4;return s<f&&(this._remainingData=t.subarray(s)),i.formatTimescale=a.formatTimescale=a.timescale=o.timescale=1e3,i.timescale=i.sampleRate||0,!i.exist()&&i.hasSample()&&i.reset(),!a.exist()&&a.hasSample()&&a.reset(),{videoTrack:a,audioTrack:i,metadataTrack:o}}},{key:"fix",value:function(e,t,r){return this._fixer.fix(e,t,r),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function(e,t,r,n){return this.demux(e,t,r),this.fix(n,t,r)}},{key:"_parseAudio",value:function(t,r){if(t.length){var n=(240&t[0])>>>4,i=this.audioTrack;if(10!==n&&7!==n&&8!==n)return logger$8.warn("Unsupported sound format: ".concat(n)),void i.reset();if(10!==n){var a=(12&t[0])>>2,o=(2&t[0])>>1,s=1&t[0];i.sampleRate=e.AUDIO_RATE[a],i.sampleSize=o?16:8,i.channelCount=s+1}10===n?this._parseAac(t,r):this._parseG711(t,r,n)}}},{key:"_parseG711",value:function(e,t,r){var n=this.audioTrack;n.codecType=7===r?AudioCodecType$2.G711PCMA:AudioCodecType$2.G711PCMU,n.sampleRate=8e3,n.codec=n.codecType,n.samples.push(new AudioSample$2(t,e.subarray(1)))}},{key:"_parseAac",value:function(e,t){var r=this.audioTrack;if(r.codecType=AudioCodecType$2.AAC,0===e[1]){var n=AAC$2.parseAudioSpecificConfig(e.subarray(2));n?(r.codec=n.codec,r.channelCount=n.channelCount,r.sampleRate=n.sampleRate,r.config=n.config,r.objectType=n.objectType,r.sampleRateIndex=n.samplingFrequencyIndex):(r.reset(),logger$8.warn("Cannot parse AudioSpecificConfig",e))}else if(1===e[1]){if(null==t)return;r.samples.push(new AudioSample$2(t,e.subarray(2)))}else logger$8.warn("Unknown AACPacketType: ".concat(e[1]))}},{key:"_parseVideo",value:function(e,t){var r=this;if(!(e.length<6)){var n=(240&e[0])>>>4,i=15&e[0],a=this.videoTrack;if(7!==i&&12!==i)return a.reset(),void logger$8.warn("Unsupported codecId: ".concat(i));var o=12===i;a.codecType=o?VideoCodecType$3.HEVC:VideoCodecType$3.AVC;var s=e[1],u=(e[2]<<16|e[3]<<8|e[4])<<8>>8;if(0===s){var c=e.subarray(5),l=o?HEVC$1.parseHEVCDecoderConfigurationRecord(c):AVC$1.parseAVCDecoderConfigurationRecord(c);if(l){var d=l.hvcC,h=l.sps,f=l.ppsArr,p=l.spsArr,m=l.vpsArr,y=l.nalUnitSize;d&&(a.hvcC=a.hvcC||d),h&&(a.codec=h.codec,a.width=h.width,a.height=h.height,a.sarRatio=h.sarRatio,a.fpsNum=h.fpsNum,a.fpsDen=h.fpsDen),p.length&&(a.sps=p),f.length&&(a.pps=f),m&&m.length&&(a.vps=m),y&&(a.nalUnitSize=y)}else logger$8.warn("Cannot parse ".concat(o?"HEVC":"AVC","DecoderConfigurationRecord"),e)}else if(1===s){var g=NALu$1.parseAvcC(e.subarray(5),a.nalUnitSize);if((g=this._checkAddMetaNalToUnits(o,g,a))&&g.length){var v=new VideoSample$2(t+u,t,g);1===n&&v.setToKeyframe(),a.samples.push(v),g.forEach((function(e){var n=o?e[0]>>>1&63:31&e[0];switch(n){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!o&&5!==n||o&&5===n)break;v.setToKeyframe();break;case 6:case 39:case 40:if(!o&&6!==n||o&&6===n)break;r.metadataTrack.seiSamples.push(new SeiSample$1(NALu$1.parseSEI(NALu$1.removeEPB(e),o),t+u))}})),v.keyframe&&this._gopId++,v.gopId=this._gopId}else logger$8.warn("Cannot parse NALUs",e)}else 2===s||logger$8.warn("Unknown AVCPacketType: ".concat(s))}}},{key:"_checkAddMetaNalToUnits",value:function(e,t,r){return e&&this._needAddMetaBeforeKeyFrameNal?t.map((function(e){return e[0]>>>1&63})).includes(32)?(this._needAddMetaBeforeKeyFrameNal=!1,t):(t.unshift(r.pps[0]),t.unshift(r.sps[0]),t.unshift(r.vps[0]),t.filter(Boolean)):(this._needAddMetaBeforeKeyFrameNal=!1,t)}},{key:"_parseScript",value:function(e,t){this.metadataTrack.flvScriptSamples.push(new FlvScriptSample(AMF.parse(e),t))}}],[{key:"probe",value:function(e){return 70===e[0]&&76===e[1]&&86===e[2]&&1===e[3]&&readBig32$2(e,5)>=9}}]),e}();_defineProperty$c(FlvDemuxer,"AUDIO_RATE",[5500,11e3,22e3,44e3]);var global$b=global$M,DESCRIPTORS$7=descriptors,defineBuiltInAccessor$1=defineBuiltInAccessor$3,regExpFlags=regexpFlags$1,fails$d=fails$V,RegExp$1=global$b.RegExp,RegExpPrototype$2=RegExp$1.prototype,FORCED$8=DESCRIPTORS$7&&fails$d((function(){var e=!0;try{RegExp$1(".","d")}catch(t){e=!1}var t={},r="",n=e?"dgimsy":"gimsy",i=function(e,n){Object.defineProperty(t,e,{get:function(){return r+=n,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in e&&(a.hasIndices="d"),a)i(o,a[o]);return Object.getOwnPropertyDescriptor(RegExpPrototype$2,"flags").get.call(t)!==n||r!==n}));FORCED$8&&defineBuiltInAccessor$1(RegExpPrototype$2,"flags",{configurable:!0,get:regExpFlags});var toIntegerOrInfinity$1=toIntegerOrInfinity$c,toString$c=toString$l,requireObjectCoercible$4=requireObjectCoercible$b,$RangeError$1=RangeError,stringRepeat=function(e){var t=toString$c(requireObjectCoercible$4(this)),r="",n=toIntegerOrInfinity$1(e);if(n<0||n==1/0)throw $RangeError$1("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},uncurryThis$f=functionUncurryThis,toLength$4=toLength$b,toString$b=toString$l,$repeat$1=stringRepeat,requireObjectCoercible$3=requireObjectCoercible$b,repeat$1=uncurryThis$f($repeat$1),stringSlice$5=uncurryThis$f("".slice),ceil=Math.ceil,createMethod$1=function(e){return function(t,r,n){var i,a,o=toString$b(requireObjectCoercible$3(t)),s=toLength$4(r),u=o.length,c=void 0===n?" ":toString$b(n);return s<=u||""==c?o:((a=repeat$1(c,ceil((i=s-u)/c.length))).length>i&&(a=stringSlice$5(a,0,i)),e?o+a:a+o)}},stringPad={start:createMethod$1(!1),end:createMethod$1(!0)},userAgent$1=engineUserAgent,stringPadWebkitBug=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent$1),$$C=_export,$padStart=stringPad.start,WEBKIT_BUG=stringPadWebkitBug;$$C({target:"String",proto:!0,forced:WEBKIT_BUG},{padStart:function(e){return $padStart(this,e,arguments.length>1?arguments[1]:void 0)}});var $$B=_export,$find=arrayIteration.find,addToUnscopables$2=addToUnscopables$5,FIND="find",SKIPS_HOLES$1=!0;FIND in[]&&Array(1)[FIND]((function(){SKIPS_HOLES$1=!1})),$$B({target:"Array",proto:!0,forced:SKIPS_HOLES$1},{find:function(e){return $find(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables$2(FIND);var $$A=_export,from3=arrayFrom$1,checkCorrectnessOfIteration=checkCorrectnessOfIteration$4,INCORRECT_ITERATION=!checkCorrectnessOfIteration((function(e){Array.from(e)}));$$A({target:"Array",stat:!0,forced:INCORRECT_ITERATION},{from:from3});var $$z=_export,global$a=global$M,arrayBufferModule=arrayBuffer,setSpecies$1=setSpecies$5,ARRAY_BUFFER="ArrayBuffer",ArrayBuffer$2=arrayBufferModule[ARRAY_BUFFER],NativeArrayBuffer=global$a[ARRAY_BUFFER];function Concat$3(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.forEach((function(e){t+=e.length}));var a=new e(t),o=0;return n.forEach((function(e){a.set(e,o),o+=e.length})),a}$$z({global:!0,constructor:!0,forced:NativeArrayBuffer!==ArrayBuffer$2},{ArrayBuffer:ArrayBuffer$2}),setSpecies$1(ARRAY_BUFFER);var Buffer$4=function(){function e(){_classCallCheck$e(this,e),this.buffer=new Uint8Array(0)}return _createClass$e(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach((function(t){t?e.buffer=Concat$3(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),UINT32_MAX$3=Math.pow(2,32)-1,MP4$4=function(){function e(){_classCallCheck$e(this,e)}return _createClass$e(e,null,[{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=8+(r=r.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return r.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===TrackType$3.VIDEO&&e.codecType===VideoCodecType$3.HEVC}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return concatUint8Array$4(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var r=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],parse$3(t.kid),[0,0,0,0]));return e.box(e.types.pssh,r)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var r=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(_toConsumableArray$8(t.map((function(t){return e.trak(t)}))),[r]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(_toConsumableArray$8(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.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,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,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===TrackType$3.VIDEO?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var r=[];return t&&t.ext&&t.ext.stss&&r.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,r[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var r;return r="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r)}},{key:"enca",value:function(t){var r=t.enca.channelCount,n=t.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,n>>8&255,255&n,0,0]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var r,n,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=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,o>>8&255,255&o,s>>8&255,255&s,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]),d=new Uint8Array((r=(n=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(n,_toConsumableArray$8(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(r,_toConsumableArray$8(a))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),f=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,d),e.box(e.types.btrt,h),f,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var r=new Uint8Array([]),n=e.tenc(t);return e.box(e.types.schi,r,n)}},{key:"tenc",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(parse$3(t.default_KID)));return e.box(e.types.tenc,r)}},{key:"sinf",value:function(t){var r=new Uint8Array([]),n=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),a=e.schi(t);return e.box(e.types.sinf,r,e.box(e.types.frma,n),e.box(e.types.schm,i),a)}},{key:"avc1hev1",value:function(t){var r=t.codecType===VideoCodecType$3.HEVC,n=r?e.types.hvc1:e.types.avc1,i=r?e.hvcC(t):e.avcC(t),a=[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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,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,17,17]),i];return r?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[n].concat(a))}},{key:"avcC",value:function(t){var r,n,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,_toConsumableArray$8(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,_toConsumableArray$8(e))})),e.box(e.types.avcC,new Uint8Array((r=(n=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(n,a).concat([t.pps.length])).concat.apply(r,o)))}},{key:"hvcC",value:function(t){var r=t.hvcC;if(r instanceof ArrayBuffer||r instanceof Uint8Array)return r;var n,i=t.vps,a=t.sps,o=t.pps;if(r){var s=r.generalProfileCompatibilityFlags,u=r.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.length&&1);n=[1,r.generalProfileSpace<<6|r.generalTierFlag<<5|r.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],r.generalLevelIdc,240,0,252,252|r.chromaFormatIdc,248|r.bitDepthLumaMinus8,248|r.bitDepthChromaMinus8,0,0,r.numTemporalLayers<<3|r.temporalIdNested<<2|3,c];var l=function(e){var t;n.push(e.length>>8,e.length),(t=n).push.apply(t,_toConsumableArray$8(e))};i.length&&(n.push(160,0,i.length),i.forEach(l)),a.length&&(n.push(161,0,a.length),a.forEach(l)),o.length&&(n.push(162,0,o.length),o.forEach(l))}else n=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(n))}},{key:"pasp",value:function(t){var r=_slicedToArray$6(t,2),n=r[0],i=r[1];return e.box(e.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var r=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+r,0,0,0,4,15+r,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([r]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(_toConsumableArray$8(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.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]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(_toConsumableArray$8(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var r=e.tfhd(t.id),n=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var a=e.saiz(t),o=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,r,n,a,o,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),l=e.saiz(t),d=e.saio(t),h=e.senc(t),f=e.trun1(t);return e.box(e.types.traf,r,n,c,l,d,h,f)}var p=e.sbgp(),m=e.trun1(t);return e.box(e.types.traf,r,n,p,m)}if(t.isVideo){var y=e.trun1(t);return e.box(e.types.traf,r,n,y)}var g=e.sbgp(),v=e.saiz(t),b=e.saio(t),_=e.senc(t),A=e.trun1(t);return e.box(e.types.traf,r,n,g,v,b,_,A)}var T=e.sdtp(t);return e.box(e.types.traf,r,n,T,e.trun(t.samples,T.byteLength+76))}},{key:"sdtp",value:function(t){var r=new Buffer$4;return t.samples.forEach((function(e){r.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),r.buffer)}},{key:"trun1",value:function(t){var r=new Buffer$4,n=Buffer$4.writeUint32(t.samples.length),i=null;if(t.isVideo){var a=t.videoSencLength;i=Buffer$4.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=Buffer$4.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=Buffer$4.writeUint32(o)}return t.samples.forEach((function(e){r.write(Buffer$4.writeUint32(e.duration)),r.write(Buffer$4.writeUint32(e.size)),r.write(Buffer$4.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&r.write(Buffer$4.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),n,i,r.buffer)}},{key:"senc",value:function(t){var r=new Buffer$4,n=t.samples.length,i=t.isVideo?16:8,a=t.isVideo?2:0,o=[],s=0;return t.isVideo?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*n,r.write(Buffer$4.writeUint32(16+s),e.types.senc,this.extension(0,a)),r.write(Buffer$4.writeUint32(n)),o.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)r.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(r.write(Buffer$4.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){r.write(Buffer$4.writeUint16(e.BytesOfClearData)),r.write(Buffer$4.writeUint32(e.BytesOfProtectedData))})))})),r.buffer}},{key:"saio",value:function(t){var r=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(r=149);var n=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saio,n)}},{key:"saiz",value:function(t){var r=t.samples.length,n=new Uint8Array([0,0,0,0,16,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saiz,n)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,r){var n=Math.floor(r/(UINT32_MAX$3+1)),i=Math.floor(r%(UINT32_MAX$3+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,r){var n=t.length,i=12+16*n;r+=8+i;var a=new Uint8Array(i);a.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var o=0;o<n;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;a.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|(null===d.dependsOn||void 0===d.dependsOn?1:d.dependsOn),d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|(null===d.isNonSyncSample||void 0===d.isNonSyncSample?1:d.isNonSyncSample),61440&d.degradationPriority,15&d.degradationPriority,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(_toConsumableArray$8(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===TrackType$3.VIDEO?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var r=t.ext,n=[e.stsd(t),e.stts(r.stts),e.stsc(r.stsc),e.stsz(r.stsz),e.stco(r.stco)];return r.stss.length&&n.push(e.stss(r.stss)),r.ctts.length&&n.push(e.ctts(r.ctts)),e.box.apply(e,[e.types.stbl].concat(n))}},{key:"stts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,concatUint8Array$4(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsc",value:function(t){var r=t.length,n=new Uint8Array(12*r),i=0;return t.forEach((function(e){var t=e.firstChunk,r=e.samplesPerChunk,a=e.sampleDescIndex;n.set([t>>24,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,concatUint8Array$4(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsz",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,concatUint8Array$4(new Uint8Array([0,0,0,0,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stco",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,concatUint8Array$4(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stss",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,concatUint8Array$4(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"ctts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,concatUint8Array$4(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var r=t.timescale,n=t.samples[0].duration,i=n*t.samples.length,a=t.samples[0].sampleOffset*n,o=8;t.samples.forEach((function(e){o+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,r>>24&255,r>>16&255,r>>8&255,255&r,a>>24&255,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();_defineProperty$c(MP4$4,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),_defineProperty$c(MP4$4,"HDLR_TYPES",{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]),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])}),_defineProperty$c(MP4$4,"FTYPAVC1",MP4$4.box(MP4$4.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),_defineProperty$c(MP4$4,"FTYPHEV1",MP4$4.box(MP4$4.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),_defineProperty$c(MP4$4,"DINF",MP4$4.box(MP4$4.types.dinf,MP4$4.box(MP4$4.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),_defineProperty$c(MP4$4,"VMHD",MP4$4.box(MP4$4.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),_defineProperty$c(MP4$4,"SMHD",MP4$4.box(MP4$4.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),_defineProperty$c(MP4$4,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),_defineProperty$c(MP4$4,"STTS",MP4$4.box(MP4$4.types.stts,MP4$4.StblTable)),_defineProperty$c(MP4$4,"STSC",MP4$4.box(MP4$4.types.stsc,MP4$4.StblTable)),_defineProperty$c(MP4$4,"STSZ",MP4$4.box(MP4$4.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),_defineProperty$c(MP4$4,"STCO",MP4$4.box(MP4$4.types.stco,MP4$4.StblTable));var Logger$7=function(){function e(t,r){_classCallCheck$e(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=r}return _createClass$e(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();_defineProperty$c(Logger$7,"disabled",!0);var FMP4Remuxer$3=function(){function e(t,r,n){_classCallCheck$e(this,e),this.videoTrack=t,this.audioTrack=r;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new Logger$7("FMP4Remuxer",!n||!n.openLog||!n.openLog)}return _createClass$e(e,[{key:"remux",value:function(){var e,t,r,n,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return a&&(o&&o.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),r=MP4$4.initSegment(d)):(c&&(e=MP4$4.initSegment([this.videoTrack])),l&&(t=MP4$4.initSegment([this.audioTrack])))),c&&s.hasSample()&&(n=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:r,videoInitSegment:e,audioInitSegment:t,videoSegment:n,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,r=0;t.forEach((function(e){r+=e.units.reduce((function(e,t){return e+t.byteLength}),0),r+=4*e.units.length}));for(var n,i=new Uint8Array(r),a=new DataView(i.buffer),o=function(e,r,o,s){s=t[e];var u=0;s.units.forEach((function(e){a.setUint32(o,e.byteLength),o+=4,i.set(e,o),o+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=o,n=s},s=0,u=t.length,c=0;s<u;s++)o(s,0,c,n);var l=MP4$4.mdat(i);return concatUint8Array$4(MP4$4.moof([e]),l)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,r){return t.set(r.data,e),e+r.size}),0);var r=MP4$4.mdat(t);return concatUint8Array$4(MP4$4.moof([e]),r)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}();class Base{static create(...e){return new this(...e)}mixIn(e){return Object.assign(this,e)}clone(){const e=new this.constructor;return Object.assign(e,this),e}}class WordArray extends Base{constructor(e=[],t=4*e.length){super();let r=e;if(r instanceof ArrayBuffer&&(r=new Uint8Array(r)),(r instanceof Int8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(r=new Uint8Array(r.buffer,r.byteOffset,r.byteLength)),r instanceof Uint8Array){const e=r.byteLength,t=[];for(let n=0;n<e;n+=1)t[n>>>2]|=r[n]<<24-n%4*8;this.words=t,this.sigBytes=e}else this.words=e,this.sigBytes=t}static random(e){const t=[],r=e=>{let t=e,r=987654321;const n=4294967295;return()=>{r=36969*(65535&r)+(r>>16)&n,t=18e3*(65535&t)+(t>>16)&n;let e=(r<<16)+t&n;return e/=4294967296,e+=.5,e*(Math.random()>.5?1:-1)}};for(let n,i=0;i<e;i+=4){const e=r(4294967296*(n||Math.random()));n=987654071*e(),t.push(4294967296*e()|0)}return new WordArray(t,e)}toString(e=Hex){return e.stringify(this)}concat(e){const t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(let e=0;e<i;e+=1){const i=r[e>>>2]>>>24-e%4*8&255;t[n+e>>>2]|=i<<24-(n+e)%4*8}else for(let e=0;e<i;e+=4)t[n+e>>>2]=r[e>>>2];return this.sigBytes+=i,this}clamp(){const{words:e,sigBytes:t}=this;e[t>>>2]&=4294967295<<32-t%4*8,e.length=Math.ceil(t/4)}clone(){const e=super.clone.call(this);return e.words=this.words.slice(0),e}}const Hex={stringify(e){const{words:t,sigBytes:r}=e,n=[];for(let e=0;e<r;e+=1){const r=t[e>>>2]>>>24-e%4*8&255;n.push((r>>>4).toString(16)),n.push((15&r).toString(16))}return n.join("")},parse(e){const t=e.length,r=[];for(let n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new WordArray(r,t/2)}},Latin1={stringify(e){const{words:t,sigBytes:r}=e,n=[];for(let e=0;e<r;e+=1){const r=t[e>>>2]>>>24-e%4*8&255;n.push(String.fromCharCode(r))}return n.join("")},parse(e){const t=e.length,r=[];for(let n=0;n<t;n+=1)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new WordArray(r,t)}},Utf8={stringify(e){try{return decodeURIComponent(escape(Latin1.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:e=>Latin1.parse(unescape(encodeURIComponent(e)))};class BufferedBlockAlgorithm extends Base{constructor(){super(),this._minBufferSize=0}reset(){this._data=new WordArray,this._nDataBytes=0}_append(e){let t=e;"string"==typeof t&&(t=Utf8.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_process(e){let t;const{_data:r,blockSize:n}=this,i=r.words,a=r.sigBytes;let o=a/(4*n);o=e?Math.ceil(o):Math.max((0|o)-this._minBufferSize,0);const s=o*n,u=Math.min(4*s,a);if(s){for(let e=0;e<s;e+=n)this._doProcessBlock(i,e);t=i.splice(0,s),r.sigBytes-=u}return new WordArray(t,u)}clone(){const e=super.clone.call(this);return e._data=this._data.clone(),e}}class Hasher extends BufferedBlockAlgorithm{constructor(e){super(),this.blockSize=16,this.cfg=Object.assign(new Base,e),this.reset()}static _createHelper(e){return(t,r)=>new e(r).finalize(t)}static _createHmacHelper(e){return(t,r)=>new HMAC(e,r).finalize(t)}reset(){super.reset.call(this),this._doReset()}update(e){return this._append(e),this._process(),this}finalize(e){e&&this._append(e);return this._doFinalize()}}class HMAC extends Base{constructor(e,t){super();const r=new e;this._hasher=r;let n=t;"string"==typeof n&&(n=Utf8.parse(n));const i=r.blockSize,a=4*i;n.sigBytes>a&&(n=r.finalize(t)),n.clamp();const o=n.clone();this._oKey=o;const s=n.clone();this._iKey=s;const u=o.words,c=s.words;for(let e=0;e<i;e+=1)u[e]^=1549556828,c[e]^=909522486;o.sigBytes=a,s.sigBytes=a,this.reset()}reset(){const e=this._hasher;e.reset(),e.update(this._iKey)}update(e){return this._hasher.update(e),this}finalize(e){const t=this._hasher,r=t.finalize(e);t.reset();return t.finalize(this._oKey.clone().concat(r))}}const parseLoop=(e,t,r)=>{const n=[];let i=0;for(let a=0;a<t;a+=1)if(a%4){const t=r[e.charCodeAt(a-1)]<<a%4*2|r[e.charCodeAt(a)]>>>6-a%4*2;n[i>>>2]|=t<<24-i%4*8,i+=1}return WordArray.create(n,i)},Base64={stringify(e){const{words:t,sigBytes:r}=e,n=this._map;e.clamp();const i=[];for(let e=0;e<r;e+=3){const a=(t[e>>>2]>>>24-e%4*8&255)<<16|(t[e+1>>>2]>>>24-(e+1)%4*8&255)<<8|t[e+2>>>2]>>>24-(e+2)%4*8&255;for(let t=0;t<4&&e+.75*t<r;t+=1)i.push(n.charAt(a>>>6*(3-t)&63))}const a=n.charAt(64);if(a)for(;i.length%4;)i.push(a);return i.join("")},parse(e){let t=e.length;const r=this._map;let n=this._reverseMap;if(!n){this._reverseMap=[],n=this._reverseMap;for(let e=0;e<r.length;e+=1)n[r.charCodeAt(e)]=e}const i=r.charAt(64);if(i){const r=e.indexOf(i);-1!==r&&(t=r)}return parseLoop(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},T=[];for(let e=0;e<64;e+=1)T[e]=4294967296*Math.abs(Math.sin(e+1))|0;const FF$1=(e,t,r,n,i,a,o)=>{const s=e+(t&r|~t&n)+i+o;return(s<<a|s>>>32-a)+t},GG=(e,t,r,n,i,a,o)=>{const s=e+(t&n|r&~n)+i+o;return(s<<a|s>>>32-a)+t},HH=(e,t,r,n,i,a,o)=>{const s=e+(t^r^n)+i+o;return(s<<a|s>>>32-a)+t},II=(e,t,r,n,i,a,o)=>{const s=e+(r^(t|~n))+i+o;return(s<<a|s>>>32-a)+t};class MD5Algo extends Hasher{_doReset(){this._hash=new WordArray([1732584193,4023233417,2562383102,271733878])}_doProcessBlock(e,t){const r=e;for(let n=0;n<16;n+=1){const i=t+n,a=e[i];r[i]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}const n=this._hash.words,i=r[t+0],a=r[t+1],o=r[t+2],s=r[t+3],u=r[t+4],c=r[t+5],l=r[t+6],d=r[t+7],h=r[t+8],f=r[t+9],p=r[t+10],m=r[t+11],y=r[t+12],g=r[t+13],v=r[t+14],b=r[t+15];let _=n[0],A=n[1],E=n[2],S=n[3];_=FF$1(_,A,E,S,i,7,T[0]),S=FF$1(S,_,A,E,a,12,T[1]),E=FF$1(E,S,_,A,o,17,T[2]),A=FF$1(A,E,S,_,s,22,T[3]),_=FF$1(_,A,E,S,u,7,T[4]),S=FF$1(S,_,A,E,c,12,T[5]),E=FF$1(E,S,_,A,l,17,T[6]),A=FF$1(A,E,S,_,d,22,T[7]),_=FF$1(_,A,E,S,h,7,T[8]),S=FF$1(S,_,A,E,f,12,T[9]),E=FF$1(E,S,_,A,p,17,T[10]),A=FF$1(A,E,S,_,m,22,T[11]),_=FF$1(_,A,E,S,y,7,T[12]),S=FF$1(S,_,A,E,g,12,T[13]),E=FF$1(E,S,_,A,v,17,T[14]),A=FF$1(A,E,S,_,b,22,T[15]),_=GG(_,A,E,S,a,5,T[16]),S=GG(S,_,A,E,l,9,T[17]),E=GG(E,S,_,A,m,14,T[18]),A=GG(A,E,S,_,i,20,T[19]),_=GG(_,A,E,S,c,5,T[20]),S=GG(S,_,A,E,p,9,T[21]),E=GG(E,S,_,A,b,14,T[22]),A=GG(A,E,S,_,u,20,T[23]),_=GG(_,A,E,S,f,5,T[24]),S=GG(S,_,A,E,v,9,T[25]),E=GG(E,S,_,A,s,14,T[26]),A=GG(A,E,S,_,h,20,T[27]),_=GG(_,A,E,S,g,5,T[28]),S=GG(S,_,A,E,o,9,T[29]),E=GG(E,S,_,A,d,14,T[30]),A=GG(A,E,S,_,y,20,T[31]),_=HH(_,A,E,S,c,4,T[32]),S=HH(S,_,A,E,h,11,T[33]),E=HH(E,S,_,A,m,16,T[34]),A=HH(A,E,S,_,v,23,T[35]),_=HH(_,A,E,S,a,4,T[36]),S=HH(S,_,A,E,u,11,T[37]),E=HH(E,S,_,A,d,16,T[38]),A=HH(A,E,S,_,p,23,T[39]),_=HH(_,A,E,S,g,4,T[40]),S=HH(S,_,A,E,i,11,T[41]),E=HH(E,S,_,A,s,16,T[42]),A=HH(A,E,S,_,l,23,T[43]),_=HH(_,A,E,S,f,4,T[44]),S=HH(S,_,A,E,y,11,T[45]),E=HH(E,S,_,A,b,16,T[46]),A=HH(A,E,S,_,o,23,T[47]),_=II(_,A,E,S,i,6,T[48]),S=II(S,_,A,E,d,10,T[49]),E=II(E,S,_,A,v,15,T[50]),A=II(A,E,S,_,c,21,T[51]),_=II(_,A,E,S,y,6,T[52]),S=II(S,_,A,E,s,10,T[53]),E=II(E,S,_,A,p,15,T[54]),A=II(A,E,S,_,a,21,T[55]),_=II(_,A,E,S,h,6,T[56]),S=II(S,_,A,E,b,10,T[57]),E=II(E,S,_,A,l,15,T[58]),A=II(A,E,S,_,g,21,T[59]),_=II(_,A,E,S,u,6,T[60]),S=II(S,_,A,E,m,10,T[61]),E=II(E,S,_,A,o,15,T[62]),A=II(A,E,S,_,f,21,T[63]),n[0]=n[0]+_|0,n[1]=n[1]+A|0,n[2]=n[2]+E|0,n[3]=n[3]+S|0}_doFinalize(){const e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32;const i=Math.floor(r/4294967296),a=r;t[15+(n+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(t.length+1),this._process();const o=this._hash,s=o.words;for(let e=0;e<4;e+=1){const t=s[e];s[e]=16711935&(t<<8|t>>>24)|4278255360&(t<<24|t>>>8)}return o}clone(){const e=super.clone.call(this);return e._hash=this._hash.clone(),e}}class EvpKDFAlgo extends Base{constructor(e){super(),this.cfg=Object.assign(new Base,{keySize:4,hasher:MD5Algo,iterations:1},e)}compute(e,t){let r;const{cfg:n}=this,i=n.hasher.create(),a=WordArray.create(),o=a.words,{keySize:s,iterations:u}=n;for(;o.length<s;){r&&i.update(r),r=i.update(e).finalize(t),i.reset();for(let e=1;e<u;e+=1)r=i.finalize(r),i.reset();a.concat(r)}return a.sigBytes=4*s,a}}class Cipher extends BufferedBlockAlgorithm{constructor(e,t,r){super(),this.cfg=Object.assign(new Base,r),this._xformMode=e,this._key=t,this.reset()}static createEncryptor(e,t){return this.create(this._ENC_XFORM_MODE,e,t)}static createDecryptor(e,t){return this.create(this._DEC_XFORM_MODE,e,t)}static _createHelper(e){const t=e=>"string"==typeof e?PasswordBasedCipher:SerializableCipher;return{encrypt:(r,n,i)=>t(n).encrypt(e,r,n,i),decrypt:(r,n,i)=>t(n).decrypt(e,r,n,i)}}reset(){super.reset.call(this),this._doReset()}process(e){return this._append(e),this._process()}finalize(e){e&&this._append(e);return this._doFinalize()}}Cipher._ENC_XFORM_MODE=1,Cipher._DEC_XFORM_MODE=2,Cipher.keySize=4,Cipher.ivSize=4;class BlockCipherMode extends Base{constructor(e,t){super(),this._cipher=e,this._iv=t}static createEncryptor(e,t){return this.Encryptor.create(e,t)}static createDecryptor(e,t){return this.Decryptor.create(e,t)}}function xorBlock(e,t,r){const n=e;let i;const a=this._iv;a?(i=a,this._iv=void 0):i=this._prevBlock;for(let e=0;e<r;e+=1)n[t+e]^=i[e]}class CBC extends BlockCipherMode{}CBC.Encryptor=class extends CBC{processBlock(e,t){const r=this._cipher,{blockSize:n}=r;xorBlock.call(this,e,t,n),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}},CBC.Decryptor=class extends CBC{processBlock(e,t){const r=this._cipher,{blockSize:n}=r,i=e.slice(t,t+n);r.decryptBlock(e,t),xorBlock.call(this,e,t,n),this._prevBlock=i}};const Pkcs7={pad(e,t){const r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,a=[];for(let e=0;e<n;e+=4)a.push(i);const o=WordArray.create(a,n);e.concat(o)},unpad(e){const t=e,r=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=r}};class BlockCipher extends Cipher{constructor(e,t,r){super(e,t,Object.assign({mode:CBC,padding:Pkcs7},r)),this.blockSize=4}reset(){let e;super.reset.call(this);const{cfg:t}=this,{iv:r,mode:n}=t;this._xformMode===this.constructor._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e}_doProcessBlock(e,t){this._mode.processBlock(e,t)}_doFinalize(){let e;const{padding:t}=this.cfg;return this._xformMode===this.constructor._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e}}class CipherParams extends Base{constructor(e){super(),this.mixIn(e)}toString(e){return(e||this.formatter).stringify(this)}}const OpenSSLFormatter={stringify(e){let t;const{ciphertext:r,salt:n}=e;return t=n?WordArray.create([1398893684,1701076831]).concat(n).concat(r):r,t.toString(Base64)},parse(e){let t;const r=Base64.parse(e),n=r.words;return 1398893684===n[0]&&1701076831===n[1]&&(t=WordArray.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),CipherParams.create({ciphertext:r,salt:t})}};class SerializableCipher extends Base{static encrypt(e,t,r,n){const i=Object.assign(new Base,this.cfg,n),a=e.createEncryptor(r,i),o=a.finalize(t),s=a.cfg;return CipherParams.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:a.blockSize,formatter:i.format})}static decrypt(e,t,r,n){let i=t;const a=Object.assign(new Base,this.cfg,n);i=this._parse(i,a.format);return e.createDecryptor(r,a).finalize(i.ciphertext)}static _parse(e,t){return"string"==typeof e?t.parse(e,this):e}}SerializableCipher.cfg=Object.assign(new Base,{format:OpenSSLFormatter});const OpenSSLKdf={execute(e,t,r,n){let i=n;i||(i=WordArray.random(8));const a=EvpKDFAlgo.create({keySize:t+r}).compute(e,i),o=WordArray.create(a.words.slice(t),4*r);return a.sigBytes=4*t,CipherParams.create({key:a,iv:o,salt:i})}};class PasswordBasedCipher extends SerializableCipher{static encrypt(e,t,r,n){const i=Object.assign(new Base,this.cfg,n),a=i.kdf.execute(r,e.keySize,e.ivSize);i.iv=a.iv;const o=SerializableCipher.encrypt.call(this,e,t,a.key,i);return o.mixIn(a),o}static decrypt(e,t,r,n){let i=t;const a=Object.assign(new Base,this.cfg,n);i=this._parse(i,a.format);const o=a.kdf.execute(r,e.keySize,e.ivSize,i.salt);a.iv=o.iv;return SerializableCipher.decrypt.call(this,e,i,o.key,a)}}PasswordBasedCipher.cfg=Object.assign(SerializableCipher.cfg,{kdf:OpenSSLKdf});const _SBOX=[],INV_SBOX=[],_SUB_MIX_0=[],_SUB_MIX_1=[],_SUB_MIX_2=[],_SUB_MIX_3=[],INV_SUB_MIX_0=[],INV_SUB_MIX_1=[],INV_SUB_MIX_2=[],INV_SUB_MIX_3=[],d$2=[];for(let e=0;e<256;e+=1)d$2[e]=e<128?e<<1:e<<1^283;let x=0,xi=0;for(let e=0;e<256;e+=1){let e=xi^xi<<1^xi<<2^xi<<3^xi<<4;e=e>>>8^255&e^99,_SBOX[x]=e,INV_SBOX[e]=x;const t=d$2[x],r=d$2[t],n=d$2[r];let i=257*d$2[e]^16843008*e;_SUB_MIX_0[x]=i<<24|i>>>8,_SUB_MIX_1[x]=i<<16|i>>>16,_SUB_MIX_2[x]=i<<8|i>>>24,_SUB_MIX_3[x]=i,i=16843009*n^65537*r^257*t^16843008*x,INV_SUB_MIX_0[e]=i<<24|i>>>8,INV_SUB_MIX_1[e]=i<<16|i>>>16,INV_SUB_MIX_2[e]=i<<8|i>>>24,INV_SUB_MIX_3[e]=i,x?(x=t^d$2[d$2[d$2[n^t]]],xi^=d$2[d$2[xi]]):(xi=1,x=xi)}const RCON=[0,1,2,4,8,16,32,64,128,27,54];class AESAlgo extends BlockCipher{_doReset(){let e;if(this._nRounds&&this._keyPriorReset===this._key)return;this._keyPriorReset=this._key;const t=this._keyPriorReset,r=t.words,n=t.sigBytes/4;this._nRounds=n+6;const i=4*(this._nRounds+1);this._keySchedule=[];const a=this._keySchedule;for(let t=0;t<i;t+=1)t<n?a[t]=r[t]:(e=a[t-1],t%n?n>6&&t%n==4&&(e=_SBOX[e>>>24]<<24|_SBOX[e>>>16&255]<<16|_SBOX[e>>>8&255]<<8|_SBOX[255&e]):(e=e<<8|e>>>24,e=_SBOX[e>>>24]<<24|_SBOX[e>>>16&255]<<16|_SBOX[e>>>8&255]<<8|_SBOX[255&e],e^=RCON[t/n|0]<<24),a[t]=a[t-n]^e);this._invKeySchedule=[];const o=this._invKeySchedule;for(let t=0;t<i;t+=1){const r=i-t;e=t%4?a[r]:a[r-4],o[t]=t<4||r<=4?e:INV_SUB_MIX_0[_SBOX[e>>>24]]^INV_SUB_MIX_1[_SBOX[e>>>16&255]]^INV_SUB_MIX_2[_SBOX[e>>>8&255]]^INV_SUB_MIX_3[_SBOX[255&e]]}}encryptBlock(e,t){this._doCryptBlock(e,t,this._keySchedule,_SUB_MIX_0,_SUB_MIX_1,_SUB_MIX_2,_SUB_MIX_3,_SBOX)}decryptBlock(e,t){const r=e;let n=r[t+1];r[t+1]=r[t+3],r[t+3]=n,this._doCryptBlock(r,t,this._invKeySchedule,INV_SUB_MIX_0,INV_SUB_MIX_1,INV_SUB_MIX_2,INV_SUB_MIX_3,INV_SBOX),n=r[t+1],r[t+1]=r[t+3],r[t+3]=n}_doCryptBlock(e,t,r,n,i,a,o,s){const u=e,c=this._nRounds;let l=u[t]^r[0],d=u[t+1]^r[1],h=u[t+2]^r[2],f=u[t+3]^r[3],p=4;for(let e=1;e<c;e+=1){const e=n[l>>>24]^i[d>>>16&255]^a[h>>>8&255]^o[255&f]^r[p];p+=1;const t=n[d>>>24]^i[h>>>16&255]^a[f>>>8&255]^o[255&l]^r[p];p+=1;const s=n[h>>>24]^i[f>>>16&255]^a[l>>>8&255]^o[255&d]^r[p];p+=1;const u=n[f>>>24]^i[l>>>16&255]^a[d>>>8&255]^o[255&h]^r[p];p+=1,l=e,d=t,h=s,f=u}const m=(s[l>>>24]<<24|s[d>>>16&255]<<16|s[h>>>8&255]<<8|s[255&f])^r[p];p+=1;const y=(s[d>>>24]<<24|s[h>>>16&255]<<16|s[f>>>8&255]<<8|s[255&l])^r[p];p+=1;const g=(s[h>>>24]<<24|s[f>>>16&255]<<16|s[l>>>8&255]<<8|s[255&d])^r[p];p+=1;const v=(s[f>>>24]<<24|s[l>>>16&255]<<16|s[d>>>8&255]<<8|s[255&h])^r[p];p+=1,u[t]=m,u[t+1]=y,u[t+2]=g,u[t+3]=v}}AESAlgo.keySize=8;const AES=BlockCipher._createHelper(AESAlgo);class CTR extends BlockCipherMode{}CTR.Encryptor=class extends CTR{processBlock(e,t){const r=e,n=this._cipher,{blockSize:i}=n,a=this._iv;let o=this._counter;a&&(this._counter=a.slice(0),o=this._counter,this._iv=void 0);const s=o.slice(0);n.encryptBlock(s,0),o[i-1]=o[i-1]+1|0;for(let e=0;e<i;e+=1)r[t+e]^=s[e]}},CTR.Decryptor=CTR.Encryptor;const NoPadding={pad(){},unpad(){}};var logger$7=new Logger$9("BufferService"),BufferService$1=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2e4;_classCallCheck$h(this,e),_defineProperty$f(this,"flv",null),_defineProperty$f(this,"_demuxer",new FlvDemuxer),_defineProperty$f(this,"_remuxer",null),_defineProperty$f(this,"_mse",null),_defineProperty$f(this,"_softVideo",null),_defineProperty$f(this,"_sourceCreated",!1),_defineProperty$f(this,"_needInitSegment",!0),_defineProperty$f(this,"_discontinuity",!0),_defineProperty$f(this,"_contiguous",!1),_defineProperty$f(this,"_initSegmentId",""),_defineProperty$f(this,"_cachedBuffer",null),_defineProperty$f(this,"_demuxStartTime",0),_defineProperty$f(this,"_analyzeDuration",0),this.flv=t,this._analyzeDuration=n,r?this._softVideo=r:(this._remuxer=new FMP4Remuxer$3(this._demuxer.videoTrack,this._demuxer.audioTrack),this._mse=new MSE$2,this._mse.bindMedia(t.media))}var t,r,n,i,a,o;return _createClass$h(e,[{key:"baseDts",get:function(){var e,t;return null===(e=this._demuxer)||void 0===e||null===(t=e._fixer)||void 0===t?void 0:t._baseDts}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!0,this._initSegmentId=""}},{key:"unContiguous",value:function(e){this._contiguous=!1,this._demuxStartTime=e}},{key:"reset",value:(o=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(){var t,r=arguments;return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=r.length>0&&void 0!==r[0]&&r[0],!this._mse||t){e.next=6;break}return e.next=4,this._mse.unbindMedia();case 4:return e.next=6,this._mse.bindMedia(this.flv.media);case 6:this._needInitSegment=!0,this._discontinuity=!0,this._contiguous=!1,this._sourceCreated=!1,this._initSegmentId="";case 11:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"endOfStream",value:(a=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(){return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=7;break}if(!this._sourceCreated){e.next=5;break}return e.next=4,this._mse.endOfStream();case 4:this.flv.emit(EVENT$2.BUFFEREOS);case 5:e.next=8;break;case 7:this._softVideo&&this._softVideo.endOfStream();case 8:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"updateDuration",value:(i=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(t){return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=7;break}if(this._mse.isOpened){e.next=4;break}return e.next=4,this._mse.open();case 4:return logger$7.debug("update duration",t),e.next=7,this._mse.updateDuration(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"destroy",value:(n=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(){return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=3;break}return e.next=3,this._mse.unbindMedia();case 3:this._mse=null,this._softVideo=null,this._demuxer=null,this._remuxer=null;case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"appendBuffer",value:(r=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(t){var r,n,i,a,o,s,u,c,l,d,h,f,p,m;return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._cachedBuffer&&(t=concatUint8Array$5(this._cachedBuffer,t),this._cachedBuffer=null),r=this._demuxer,t&&t.length&&r){e.next=4;break}return e.abrupt("return");case 4:e.prev=4,r.demuxAndFix(t,this._discontinuity,this._contiguous,this._demuxStartTime),e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(4),new StreamingError$2(ERR$2.DEMUX,ERR$2.SUB_TYPES.FLV,e.t0);case 11:if(n=r.videoTrack,i=r.audioTrack,a=r.metadataTrack,o=n.exist(),s=i.exist(),!(!o&&n.present||!s&&i.present)){e.next=27;break}if(u=0,(c=o?n:s?i:void 0)&&c.samples.length&&(u=(c.samples[c.samples.length-1].originPts-c.samples[0].originPts)/c.timescale*1e3),!(u>this._analyzeDuration)){e.next=25;break}logger$7.warn("analyze duration exceeded, ".concat(u,"ms"),c),n.present=o,i.present=s,this.flv.emit(EVENT$2.ANALYZE_DURATION_EXCEEDED,{duration:u}),e.next=27;break;case 25:return this._cachedBuffer=t,e.abrupt("return");case 27:if(l=n.type,d=i.type,this._fireEvents(n,i,a),this._discontinuity=!1,this._contiguous=!0,this._demuxStartTime=0,h=this._mse,this.flv.emit(EVENT$2.DEMUXED_TRACK,n),(f="".concat(n.codec,"/").concat(n.width,"/").concat(n.height,"/").concat(i.codec,"/").concat(i.config))!==this._initSegmentId&&(this._needInitSegment=!0,this._initSegmentId=f,this._emitMetaParsedEvent(n,i)),!h){e.next=63;break}if(this._sourceCreated){e.next=45;break}return e.next=41,h.open();case 41:o&&(logger$7.log("codec: video/mp4;codecs=".concat(n.codec)),h.createSource(l,"video/mp4;codecs=".concat(n.codec))),s&&(logger$7.log("codec: audio/mp4;codecs=".concat(i.codec)),h.createSource(d,"audio/mp4;codecs=".concat(i.codec))),this._sourceCreated=!0,this.flv.emit(EVENT$2.SOURCEBUFFER_CREATED);case 45:e.prev=45,p=this._remuxer.remux(this._needInitSegment),e.next=52;break;case 49:throw e.prev=49,e.t1=e.catch(45),new StreamingError$2(ERR$2.REMUX,ERR$2.SUB_TYPES.FMP4,e.t1);case 52:if(!this._needInitSegment||p.videoInitSegment||p.audioInitSegment){e.next=54;break}return e.abrupt("return");case 54:return this._needInitSegment=!1,m=[],p.videoInitSegment&&m.push(h.append(l,p.videoInitSegment)),p.audioInitSegment&&m.push(h.append(d,p.audioInitSegment)),p.videoSegment&&m.push(h.append(l,p.videoSegment)),p.audioSegment&&m.push(h.append(d,p.audioSegment)),e.abrupt("return",Promise.all(m));case 63:this._softVideo&&this._softVideo.appendBuffer(n,i);case 64:case"end":return e.stop()}}),e,this,[[4,8],[45,49]])}))),function(e){return r.apply(this,arguments)})},{key:"evictBuffer",value:(t=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(t){var r,n,i,a=this;return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.flv.media,this._mse&&this._demuxer&&r&&t&&!(t<0)){e.next=3;break}return e.abrupt("return");case 3:if(n=r.currentTime,!((i=n-t)<=0)){e.next=7;break}return e.abrupt("return");case 7:if(!(Buffer$5.start(Buffer$5.get(r))+1>=i)){e.next=10;break}return e.abrupt("return");case 10:return e.abrupt("return",this._mse.clearBuffer(0,i).then((function(){return a.flv.emit(EVENT$2.REMOVE_BUFFER,{removeEnd:i})})));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_emitMetaParsedEvent",value:function(e,t){e.exist()&&this.flv.emit(EVENT$2.METADATA_PARSED,{type:"video",track:e,meta:{codec:e.codec,timescale:e.timescale,width:e.width,height:e.height,sarRatio:e.sarRatio,baseDts:e.baseDts}}),t.exist()&&this.flv.emit(EVENT$2.METADATA_PARSED,{type:"audio",track:t,meta:{codec:t.codec,channelCount:t.channelCount,sampleRate:t.sampleRate,timescale:t.timescale,baseDts:t.baseDts}}),logger$7.debug("track parsed",e,t)}},{key:"_fireEvents",value:function(e,t,r){var n=this;logger$7.debug(e.samples,t.samples),r.flvScriptSamples.forEach((function(e){n.flv.emit(EVENT$2.FLV_SCRIPT_DATA,e),logger$7.debug("flvScriptData",e)})),e.samples.forEach((function(e){e.keyframe&&n.flv.emit(EVENT$2.KEYFRAME,{pts:e.pts})})),e.warnings.forEach((function(e){var t;switch(e.type){case WarningType$1.LARGE_AV_SHIFT:t=EVENT$2.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case WarningType$1.LARGE_VIDEO_GAP:t=EVENT$2.LARGE_VIDEO_DTS_GAP_DETECT;break;case WarningType$1.LARGE_VIDEO_GAP_BETWEEN_CHUNK:t=EVENT$2.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT}t&&n.flv.emit(EVENT$2.STREAM_EXCEPTION,_objectSpread2$9(_objectSpread2$9({},e),{},{type:t})),logger$7.warn("video exception",e)})),t.warnings.forEach((function(e){var t;switch(e.type){case WarningType$1.LARGE_AUDIO_GAP:t=EVENT$2.LARGE_AUDIO_DTS_GAP_DETECT;break;case WarningType$1.AUDIO_FILLED:t=EVENT$2.AUDIO_GAP_DETECT;break;case WarningType$1.AUDIO_DROPPED:t=EVENT$2.AUDIO_OVERLAP_DETECT}t&&n.flv.emit(EVENT$2.STREAM_EXCEPTION,_objectSpread2$9(_objectSpread2$9({},e),{},{type:t})),logger$7.warn("audio exception",e)})),r.seiSamples.forEach((function(e){n.flv.emit(EVENT$2.SEI,_objectSpread2$9(_objectSpread2$9({},e),{},{sei:{code:e.data.type,content:e.data.payload,dts:e.pts}}))}))}}]),e}();function getOption$1(e){var t=_objectSpread2$9({retryCount:3,retryDelay:1e3,loadTimeout:1e4,maxReaderInterval:5e3,preloadTime:5,isLive:!1,softDecode:!1,bufferBehind:10,maxJumpDistance:3,analyzeDuration:2e4,seamlesslyReload:!1},e);return t.isLive&&t.preloadTime&&(t.maxLatency||(t.maxLatency=2*t.preloadTime),t.targetLatency||(t.targetLatency=t.preloadTime),null!==t.disconnectTime&&void 0!==t.disconnectTime||(t.disconnectTime=t.maxLatency)),t}function searchKeyframeIndex(e,t){var r=0,n=e.length-1,i=0,a=0,o=n;for(t<e[0]&&(r=0,a=o+1);a<=o;){if((i=a+Math.floor((o-a)/2))===n||t>=e[i]&&t<e[i+1]){r=i;break}e[i]<t?a=i+1:o=i-1}return r}var logger$6=new Logger$9("flv"),Flv=function(e){_inherits$d(c,EventEmitter$1);var t,r,n,i,a,o,s,u=_createSuper$d(c);function c(e){var t;return _classCallCheck$h(this,c),_defineProperty$f(_assertThisInitialized$d(t=u.call(this)),"media",null),_defineProperty$f(_assertThisInitialized$d(t),"_loading",!1),_defineProperty$f(_assertThisInitialized$d(t),"_opts",null),_defineProperty$f(_assertThisInitialized$d(t),"_bufferService",null),_defineProperty$f(_assertThisInitialized$d(t),"_gapService",null),_defineProperty$f(_assertThisInitialized$d(t),"_stats",null),_defineProperty$f(_assertThisInitialized$d(t),"_mediaLoader",null),_defineProperty$f(_assertThisInitialized$d(t),"_maxChunkWaitTimer",null),_defineProperty$f(_assertThisInitialized$d(t),"_tickTimer",null),_defineProperty$f(_assertThisInitialized$d(t),"_tickInterval",500),_defineProperty$f(_assertThisInitialized$d(t),"_urlSwitching",!1),_defineProperty$f(_assertThisInitialized$d(t),"_seamlessSwitching",!1),_defineProperty$f(_assertThisInitialized$d(t),"_keyframes",null),_defineProperty$f(_assertThisInitialized$d(t),"_acceptRanges",!0),_defineProperty$f(_assertThisInitialized$d(t),"_onProgress",function(){var e=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(r,n,i,a){var o,s,u,c,l,d,h,f;return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=i.startTime,s=i.endTime,u=i.st,c=i.firstByteTime,t._loading=!n,t._firstProgressEmit){e.next=11;break}if(t.media){e.next=6;break}return null===(l=t._mediaLoader)||void 0===l||l.cancel(),e.abrupt("return");case 6:d=a.headers,t.emit(EVENT$2.TTFB,{url:t._opts.url,responseUrl:a.url,elapsed:u?c-u:s-o}),t.emit(EVENT$2.LOAD_RESPONSE_HEADERS,{headers:d}),t._acceptRanges=!(null==d||!d.get("Accept-Ranges"))||!(null==d||!d.get("Content-Range")),t._firstProgressEmit=!0;case 11:if(t._bufferService){e.next=13;break}return e.abrupt("return");case 13:return clearTimeout(t._maxChunkWaitTimer),t._bandwidthService.addChunkRecord(null==r?void 0:r.byteLength,s-o),e.prev=15,e.next=18,t._bufferService.appendBuffer(r);case 18:t.isLive&&(null===(h=t._bufferService)||void 0===h||h.evictBuffer(t._opts.bufferBehind)),e.next=24;break;case 21:return e.prev=21,e.t0=e.catch(15),e.abrupt("return",t._emitError(StreamingError$2.create(e.t0)));case 24:if(t._urlSwitching&&(t._urlSwitching=!1,t.emit(EVENT$2.SWITCH_URL_SUCCESS,{url:t._opts.url})),t._seamlessSwitching&&(t._seamlessSwitching=!1,t.media.play().catch((function(){})),t._tick()),!n||t.media.seeking){e.next=32;break}return t.emit(EVENT$2.LOAD_COMPLETE),logger$6.debug("load done"),e.abrupt("return",t._end());case 32:(f=t._opts.maxReaderInterval)&&(clearTimeout(t._maxChunkWaitTimer),t._maxChunkWaitTimer=setTimeout((function(){logger$6.debug("onMaxChunkWait",f),t._end()}),f));case 34:case"end":return e.stop()}}),e,null,[[15,21]])})));return function(t,r,n,i){return e.apply(this,arguments)}}()),_defineProperty$f(_assertThisInitialized$d(t),"_onRetryError",(function(e,r){logger$6.debug("load retry",e,r),t.emit(EVENT$2.LOAD_RETRY,{error:StreamingError$2.network(e),retryTime:r})})),_defineProperty$f(_assertThisInitialized$d(t),"_end",(function(){t._clear(),t._bufferService&&t._bufferService.endOfStream(),logger$6.debug("end stream")})),_defineProperty$f(_assertThisInitialized$d(t),"_tick",(function(){clearTimeout(t._tickTimer);var e=_assertThisInitialized$d(t).media;if(e){t._tickTimer=setTimeout(t._tick,t._tickInterval);var r=Buffer$5.end(Buffer$5.get(e));if(!(r<.1)&&e.readyState){var n=t._opts;if(isMediaPlaying(e))t._gapService&&t._gapService.do(e,n.maxJumpDistance,t.isLive,3);else{if(!e.currentTime&&t._gapService)return void t._gapService.do(e,n.maxJumpDistance,t.isLive,3);n.isLive&&r>n.disconnectTime&&t.disconnect()}}}})),_defineProperty$f(_assertThisInitialized$d(t),"_onPlay",(function(){var e,r,n=t._opts.softDecode||(null===(e=t.media)||void 0===e||null===(r=e.buffered)||void 0===r?void 0:r.length);t.isLive&&!t._loading&&n&&t.replay(void 0,!0)})),_defineProperty$f(_assertThisInitialized$d(t),"_onSeeking",_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(){var r,n,i,a,o;return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.isLive||!t.seekable){e.next=14;break}if(r=t._keyframes.times,n=t._keyframes.filepositions,null!=r&&r.length&&null!=n&&n.length){e.next=5;break}return e.abrupt("return");case 5:if(i=t.media.currentTime,a=searchKeyframeIndex(t._keyframes.times,i),null!=(o=n[a])){e.next=10;break}return e.abrupt("return");case 10:return e.next=12,t._mediaLoader.cancel();case 12:t._loadData(null,[o]),t._bufferService.unContiguous(r[a]);case 14:case"end":return e.stop()}}),e)})))),_defineProperty$f(_assertThisInitialized$d(t),"_onTimeupdate",(function(){if(t.media){var e=t._opts,r=t.media.currentTime;if(e.isLive&&e.maxLatency&&e.targetLatency){var n=Buffer$5.end(Buffer$5.get(t.media));n-r>=e.maxLatency&&(t.media.currentTime=n-e.targetLatency)}t._seiService.throw(r)}})),_defineProperty$f(_assertThisInitialized$d(t),"_onFlvScriptData",(function(e){var r,n,i,a,o=null===(r=e.data)||void 0===r||null===(n=r.onMetaData)||void 0===n?void 0:n.keyframes,s=null===(i=e.data)||void 0===i||null===(a=i.onMetaData)||void 0===a?void 0:a.duration;o&&(t._keyframes=o),!t._opts.isLive&&s&&t._bufferService.updateDuration(s)})),t._opts=getOption$1(e),t.media=t._opts.media||document.createElement("video"),t._opts.media=null,t._firstProgressEmit=!1,t._mediaLoader=new NetLoader$2(_objectSpread2$9(_objectSpread2$9({},t._opts.fetchOptions),{},{retry:t._opts.retryCount,retryDelay:t._opts.retryDelay,timeout:t._opts.loadTimeout,onRetryError:t._onRetryError,onProgress:t._onProgress,responseType:"arraybuffer"})),t._bufferService=new BufferService$1(_assertThisInitialized$d(t),t._opts.softDecode?t.media:void 0,t._opts.analyzeDuration),t._seiService=new SeiService(_assertThisInitialized$d(t)),t._bandwidthService=new BandwidthService,t._stats=new MediaStatsService(_assertThisInitialized$d(t)),t._opts.softDecode||(t._gapService=new GapService),t.media.addEventListener("play",t._onPlay),t.media.addEventListener("seeking",t._onSeeking),t.media.addEventListener("timeupdate",t._onTimeupdate),t.on(EVENT$2.FLV_SCRIPT_DATA,t._onFlvScriptData),t}return _createClass$h(c,[{key:"version",get:function(){return"3.0.0-next.23"}},{key:"isLive",get:function(){return this._opts.isLive}},{key:"baseDts",get:function(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}},{key:"seekable",get:function(){return!!this._keyframes&&this._acceptRanges}},{key:"speedInfo",value:function(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}},{key:"getStats",value:function(){return this._stats.getStats()}},{key:"bufferInfo",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1;return Buffer$5.info(Buffer$5.get(this.media),null===(e=this.media)||void 0===e?void 0:e.currentTime,t)}},{key:"playbackQuality",value:function(){return getVideoPlaybackQuality(this.media)}},{key:"load",value:(s=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(t){var r,n=arguments;return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.length>1&&void 0!==n[1]&&n[1],this._bufferService){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this._reset(r);case 5:this._loadData(t),clearTimeout(this._tickTimer),this._tickTimer=setTimeout(this._tick,this._tickInterval);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"replay",value:(o=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(){var t,r,n=this,i=arguments;return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:this._opts.seamlesslyReload,r=i.length>1?i[1]:void 0,this.media){e.next=4;break}return e.abrupt("return");case 4:if(!t){e.next=10;break}return e.next=7,this._clear();case 7:setTimeout((function(){n._loadData(n._opts.url),n._bufferService.seamlessSwitch(),n._seamlessSwitching=!0})),e.next=12;break;case 10:return e.next=12,this.load();case 12:return e.abrupt("return",this.media.play(!r).catch((function(){})));case 13:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"disconnect",value:function(){return logger$6.debug("disconnect!"),this._clear()}},{key:"switchURL",value:(a=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(t,r){var n=this;return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._bufferService){e.next=2;break}return e.abrupt("return");case 2:if(r&&this._opts.isLive){e.next=7;break}return e.next=5,this.load(t);case 5:return this._urlSwitching=!0,e.abrupt("return",this.media.play(!0).catch((function(){})));case 7:return e.next=9,this._clear();case 9:setTimeout((function(){n._loadData(t),n._bufferService.seamlessSwitch(),n._urlSwitching=!0,n._seamlessSwitching=!0}));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"destroy",value:(i=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(){return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.media){e.next=2;break}return e.abrupt("return");case 2:return this.removeAllListeners(),this._seiService.reset(),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),e.next=9,Promise.all([this._clear(),this._bufferService.destroy()]);case 9:this.media=null,this._bufferService=null;case 11:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"_emitError",value:function(e){var t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];logger$6.table(e),logger$6.error(e),logger$6.error(null===(t=this.media)||void 0===t?void 0:t.error),this._urlSwitching&&(this._urlSwitching=!1,this._seamlessSwitching=!1,this.emit(EVENT$2.SWITCH_URL_FAILED,e)),this.emit(EVENT$2.ERROR,e),r&&(this._seiService.reset(),this._end())}},{key:"_reset",value:(n=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(){var t,r=arguments;return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]&&r[0],this._seiService.reset(),this._bandwidthService.reset(),this._stats.reset(),e.next=6,this._clear();case 6:return e.next=8,this._bufferService.reset(t);case 8:this._firstProgressEmit=!1;case 9:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_loadData",value:(r=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(t,r){return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&(this._opts.url=t),t=this._opts.url){e.next=4;break}throw new Error("Source url is missing");case 4:if(this.emit(EVENT$2.LOAD_START,{url:t}),logger$6.debug("load data, loading:",this._loading,t),!this._loading){e.next=9;break}return e.next=9,this._mediaLoader.cancel();case 9:return this._loading=!0,e.prev=10,e.next=13,this._mediaLoader.load({url:t,range:r});case 13:e.next=18;break;case 15:return e.prev=15,e.t0=e.catch(10),e.abrupt("return",this._emitError(StreamingError$2.network(e.t0)));case 18:case"end":return e.stop()}}),e,this,[[10,15]])}))),function(e,t){return r.apply(this,arguments)})},{key:"_clear",value:(t=_asyncToGenerator$9(_regeneratorRuntime$9().mark((function e(){return _regeneratorRuntime$9().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(clearTimeout(this._maxChunkWaitTimer),clearTimeout(this._tickTimer),!this._mediaLoader){e.next=5;break}return e.next=5,this._mediaLoader.cancel();case 5:this._loading=!1;case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}],[{key:"isSupported",value:function(e){return e&&"video"!==e&&"audio"!==e?"undefined"!=typeof WebAssembly:MSE$2.isSupported()}},{key:"enableLogger",value:function(){Logger$9.enable(),Logger$8.enable()}},{key:"disableLogger",value:function(){Logger$9.disable(),Logger$8.disable()}}]),c}();try{localStorage.getItem("xgd")?Flv.enableLogger():Flv.disableLogger()}catch(e){}var PluginExtension$1=function(){function e(t,r){var n=this;_classCallCheck$h(this,e),_defineProperty$f(this,"_onLowDecode",(function(){var e,t,r,i,a=n._opts,o=a.media,s=a.innerDegrade,u=a.backupURL;null===(e=n._plugin)||void 0===e||null===(t=e.player)||void 0===t||t.emit("lowdecode",o.degradeInfo),null===(r=n._plugin)||void 0===r||null===(i=r.player)||void 0===i||i.emit("core_event",_objectSpread2$9(_objectSpread2$9({},o.degradeInfo),{},{eventName:EVENT$2.LOWDECODE})),1!==s&&3!==s||!u||n._degrade(u)})),_defineProperty$f(this,"_degrade",(function(e){var t=n._plugin.player,r=t.video;if("MVideo"===(null==r?void 0:r.TAG)){var i=t.video.degradeVideo;t.video=i,r.degrade(e),e&&(t.config.url=e);var a=t.root.firstChild;"MVideo"===a.TAG&&t.root.replaceChild(i,a);var o=n._plugin.constructor.pluginName.toLowerCase();t.unRegisterPlugin(o),t.once("canplay",(function(){t.play()}))}})),_defineProperty$f(this,"forceDegradeToVideo",(function(e){var t=n._opts.innerDegrade;1!==t&&3!==t||n._degrade(e)})),this._opts=t,this._plugin=r,this._init()}return _createClass$h(e,[{key:"_init",value:function(){var e=this._opts,t=e.media,r=e.preloadTime,n=e.innerDegrade,i=e.decodeMode;t&&(n&&t.setAttribute("innerdegrade",n),r&&t.setAttribute("preloadtime",r),t.setDecodeMode&&t.setDecodeMode(i),this._bindEvents())}},{key:"_bindEvents",value:function(){this._opts.media.addEventListener("lowdecode",this._onLowDecode)}},{key:"destroy",value:function(){var e,t;null===(e=this._opts)||void 0===e||null===(t=e.media)||void 0===t||t.removeEventListener("lowdecode",this._onLowDecode),this._plugin=null}}]),e}(),FlvPlugin=function(e){_inherits$d(r,BasePlugin);var t=_createSuper$d(r);function r(){var e;_classCallCheck$h(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return _defineProperty$f(_assertThisInitialized$d(e=t.call.apply(t,[this].concat(i))),"flv",null),_defineProperty$f(_assertThisInitialized$d(e),"pluginExtension",null),_defineProperty$f(_assertThisInitialized$d(e),"getStats",(function(){var t;return null===(t=e.flv)||void 0===t?void 0:t.getStats()})),_defineProperty$f(_assertThisInitialized$d(e),"destroy",(function(){var t;e.flv&&(e.flv.destroy(),e.flv=null),null===(t=e.pluginExtension)||void 0===t||t.destroy(),e.pluginExtension=null})),_defineProperty$f(_assertThisInitialized$d(e),"_onSwitchURL",(function(t,r){e.flv&&(e.player.config.url=t,e.flv.switchURL(t,r))})),_defineProperty$f(_assertThisInitialized$d(e),"_onDefinitionChange",(function(t){var r=t.to;e.flv&&e.flv.switchURL(r)})),e}return _createClass$h(r,[{key:"core",get:function(){return this.flv}},{key:"version",get:function(){var e;return null===(e=this.flv)||void 0===e?void 0:e.version}},{key:"softDecode",get:function(){var e,t,r=null===(e=this.player)||void 0===e||null===(t=e.config)||void 0===t?void 0:t.mediaType;return!!r&&"video"!==r&&"audio"!==r}},{key:"beforePlayerInit",value:function(){var e=this,t=this.player.config;if(t.url){this.flv&&this.flv.destroy(),this.player.switchURL=this._onSwitchURL;var r,n=t.flv||{};if(null!==n.disconnectTime&&void 0!==n.disconnectTime||(n.disconnectTime=0),this.flv=new Flv(_objectSpread2$9({softDecode:this.softDecode,isLive:t.isLive,media:this.player.video},n)),this.softDecode||BasePlugin.defineGetterOrSetter(this.player,{url:{get:function(){var t,r;return null===(t=e.flv)||void 0===t||null===(r=t.media)||void 0===r?void 0:r.src},configurable:!0}}),this.softDecode&&(this.pluginExtension=new PluginExtension$1(_objectSpread2$9({media:this.player.video},t.flv),this),this.player.forceDegradeToVideo=function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return null===(t=e.pluginExtension)||void 0===t?void 0:t.forceDegradeToVideo.apply(t,n)}),t.isLive)null===(r=this.player)||void 0===r||r.useHooks("replay",(function(){var t;return null===(t=e.flv)||void 0===t?void 0:t.replay()}));this.on(URL_CHANGE,this._onSwitchURL),this.on(DESTROY,this.destroy),this._transError(),this._transCoreEvent(EVENT$2.TTFB),this._transCoreEvent(EVENT$2.LOAD_START),this._transCoreEvent(EVENT$2.LOAD_RESPONSE_HEADERS),this._transCoreEvent(EVENT$2.LOAD_COMPLETE),this._transCoreEvent(EVENT$2.LOAD_RETRY),this._transCoreEvent(EVENT$2.SOURCEBUFFER_CREATED),this._transCoreEvent(EVENT$2.ANALYZE_DURATION_EXCEEDED),this._transCoreEvent(EVENT$2.REMOVE_BUFFER),this._transCoreEvent(EVENT$2.BUFFEREOS),this._transCoreEvent(EVENT$2.KEYFRAME),this._transCoreEvent(EVENT$2.METADATA_PARSED),this._transCoreEvent(EVENT$2.SEI),this._transCoreEvent(EVENT$2.SEI_IN_TIME),this._transCoreEvent(EVENT$2.FLV_SCRIPT_DATA),this._transCoreEvent(EVENT$2.STREAM_EXCEPTION),this._transCoreEvent(EVENT$2.SWITCH_URL_SUCCESS),this._transCoreEvent(EVENT$2.SWITCH_URL_FAILED),this.flv.load(t.url,!0)}}},{key:"_transError",value:function(){var e=this;this.flv.on(EVENT$2.ERROR,(function(t){e.player&&e.player.emit(ERROR,new Errors(e.player,t))}))}},{key:"_transCoreEvent",value:function(e){var t=this;this.flv.on(e,(function(r){t.player&&t.player.emit("core_event",_objectSpread2$9(_objectSpread2$9({},r),{},{eventName:e}))}))}}],[{key:"pluginName",get:function(){return"flv"}},{key:"isSupported",value:function(e,t){return Flv.isSupported(e,t)}}]),r}();function ownKeys$6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$6(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$6(Object(r),!0).forEach((function(t){_defineProperty$b(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$6(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$7(){_regeneratorRuntime$7=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,d;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function _typeof$5(e){return(_typeof$5="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function asyncGeneratorStep$7(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator$7(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep$7(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep$7(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck$d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$d(e,t,r){return t&&_defineProperties$d(e.prototype,t),r&&_defineProperties$d(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$a(e,t)}function _getPrototypeOf$a(e){return(_getPrototypeOf$a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$a(e,t){return(_setPrototypeOf$a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized$a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$a(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$a(e)}function _createSuper$a(e){var t=_isNativeReflectConstruct$a();return function(){var r,n=_getPrototypeOf$a(e);if(t){var i=_getPrototypeOf$a(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$a(this,r)}}function _toConsumableArray$7(e){return _arrayWithoutHoles$7(e)||_iterableToArray$7(e)||_unsupportedIterableToArray$9(e)||_nonIterableSpread$7()}function _arrayWithoutHoles$7(e){if(Array.isArray(e))return _arrayLikeToArray$9(e)}function _iterableToArray$7(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray$9(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$9(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$9(e,t):void 0}}function _arrayLikeToArray$9(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread$7(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}_defineProperty$f(FlvPlugin,"Flv",Flv);var global$9=global$M,apply$2=functionApply,isCallable$1=isCallable$v,userAgent=engineUserAgent,arraySlice$2=arraySlice$c,validateArgumentsLength=validateArgumentsLength$4,MSIE=/MSIE .\./.test(userAgent),Function$1=global$9.Function,wrap$1=function(e){return MSIE?function(t,r){var n=validateArgumentsLength(arguments.length,1)>2,i=isCallable$1(t)?t:Function$1(t),a=n?arraySlice$2(arguments,2):void 0;return e(n?function(){apply$2(i,this,a)}:i,r)}:e},schedulersFix={setTimeout:wrap$1(global$9.setTimeout),setInterval:wrap$1(global$9.setInterval)},$$y=_export,global$8=global$M,setInterval$1=schedulersFix.setInterval;$$y({global:!0,bind:!0,forced:global$8.setInterval!==setInterval$1},{setInterval:setInterval$1});var $$x=_export,global$7=global$M,setTimeout$1=schedulersFix.setTimeout;$$x({global:!0,bind:!0,forced:global$7.setTimeout!==setTimeout$1},{setTimeout:setTimeout$1});var $$w=_export,$every=arrayIteration.every,arrayMethodIsStrict$4=arrayMethodIsStrict$8,STRICT_METHOD$4=arrayMethodIsStrict$4("every");$$w({target:"Array",proto:!0,forced:!STRICT_METHOD$4},{every:function(e){return $every(this,e,arguments.length>1?arguments[1]:void 0)}});var $$v=_export,uncurryThis$e=functionUncurryThisClause,$indexOf=arrayIncludes.indexOf,arrayMethodIsStrict$3=arrayMethodIsStrict$8,nativeIndexOf=uncurryThis$e([].indexOf),NEGATIVE_ZERO=!!nativeIndexOf&&1/nativeIndexOf([1],1,-0)<0,STRICT_METHOD$3=arrayMethodIsStrict$3("indexOf");$$v({target:"Array",proto:!0,forced:NEGATIVE_ZERO||!STRICT_METHOD$3},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return NEGATIVE_ZERO?nativeIndexOf(this,e,t)||0:$indexOf(this,e,t)}});var uncurryThis$d=functionUncurryThis,aCallable$1=aCallable$b,isObject$6=isObject$t,hasOwn$6=hasOwnProperty_1,arraySlice$1=arraySlice$c,NATIVE_BIND=functionBindNative,$Function=Function,concat$1=uncurryThis$d([].concat),join3=uncurryThis$d([].join),factories={},construct=function(e,t,r){if(!hasOwn$6(factories,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";factories[t]=$Function("C,a","return new C("+join3(n,",")+")")}return factories[t](e,r)},functionBind=NATIVE_BIND?$Function.bind:function(e){var t=aCallable$1(this),r=t.prototype,n=arraySlice$1(arguments,1),i=function(){var r=concat$1(n,arraySlice$1(arguments));return this instanceof i?construct(t,r.length,r):t.apply(e,r)};return isObject$6(r)&&(i.prototype=r),i},$$u=_export,bind$1=functionBind;$$u({target:"Function",proto:!0,forced:Function.bind!==bind$1},{bind:bind$1});var $$t=_export,forEach$1=arrayForEach;$$t({target:"Array",proto:!0,forced:[].forEach!=arrayForEach},{forEach:arrayForEach});var uncurryThis$c=functionUncurryThis,defineBuiltIn$3=defineBuiltIn$j,DatePrototype=Date.prototype,INVALID_DATE="Invalid Date",TO_STRING="toString",nativeDateToString=uncurryThis$c(DatePrototype[TO_STRING]),thisTimeValue$1=uncurryThis$c(DatePrototype.getTime);String(new Date(NaN))!=INVALID_DATE&&defineBuiltIn$3(DatePrototype,TO_STRING,(function(){var e=thisTimeValue$1(this);return e==e?nativeDateToString(this):INVALID_DATE}));var global$6=global$M,fails$c=fails$V,uncurryThis$b=functionUncurryThis,toString$a=toString$l,trim$1=stringTrim.trim,whitespaces$1=whitespaces$4,$parseInt$1=global$6.parseInt,Symbol$2=global$6.Symbol,ITERATOR$1=Symbol$2&&Symbol$2.iterator,hex=/^[+-]?0x/i,exec$2=uncurryThis$b(hex.exec),FORCED$7=8!==$parseInt$1(whitespaces$1+"08")||22!==$parseInt$1(whitespaces$1+"0x16")||ITERATOR$1&&!fails$c((function(){$parseInt$1(Object(ITERATOR$1))})),numberParseInt=FORCED$7?function(e,t){var r=trim$1(toString$a(e));return $parseInt$1(r,t>>>0||(exec$2(hex,r)?16:10))}:$parseInt$1,$$s=_export,$parseInt=numberParseInt;function _classCallCheck$c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$c(e,t,r){return t&&_defineProperties$c(e.prototype,t),r&&_defineProperties$c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$9(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$9(e,t)}function _getPrototypeOf$9(e){return(_getPrototypeOf$9=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$9(e,t){return(_setPrototypeOf$9=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$9(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized$9(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$9(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$9(e)}function _createSuper$9(e){var t=_isNativeReflectConstruct$9();return function(){var r,n=_getPrototypeOf$9(e);if(t){var i=_getPrototypeOf$9(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$9(this,r)}}function debounce$1(e,t,r){var n;return function(){var i=this,a=arguments,o=r&&!n;clearTimeout(n),n=setTimeout((function(){n=null,r||e.apply(i,a)}),t),o&&e.apply(i,a)}}function _classCallCheck$b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$b(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$b(e,t,r){return t&&_defineProperties$b(e.prototype,t),r&&_defineProperties$b(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}$$s({global:!0,forced:parseInt!=numberParseInt},{parseInt:numberParseInt});var ProxyPromise$1=function(){function e(){var t,r;_classCallCheck$b(this,e);var n=new Promise((function(e,n){t=e,r=n}));return n.resolve=t,n.reject=r,n}return _createClass$b(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}(),$$r=_export,uncurryThis$a=functionUncurryThis,$Date=Date,thisTimeValue=uncurryThis$a($Date.prototype.getTime);$$r({target:"Date",stat:!0},{now:function(){return thisTimeValue(new $Date)}});var Raf=function(){function e(){_classCallCheck$b(this,e)}return _createClass$b(e,null,[{key:"install",value:function(){if(window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,window.cancelAnimationFrame=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame,!window.requestAnimationFrame){var e=Date.now();window.requestAnimationFrame=function(t){var r=Date.now(),n=Math.max(16.7-(r-e),0),i=setTimeout(t,n);return e=r+n,i}}window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}}]),e}(),FpsDetection=function(){function e(){_classCallCheck$b(this,e),this.fps=0,this.isStoped=!0,this.ticks=[],this.isSupport=!0,this.maxFps=0,this.step=this._step.bind(this),this.rafId=null}return _createClass$b(e,[{key:"_step",value:function(e){var t=this.ticks;if(t.unshift(e),t.length>10){var r=t.pop();r&&(this.fps=Math.floor(1e4/(e-r)),this.updateFpsInfo())}this.isStoped||(this.rafId=window.requestAnimationFrame(this.step))}},{key:"updateFpsInfo",value:function(){this.fps>this.maxFps&&(this.maxFps=this.fps)}},{key:"start",value:function(){void 0!==window.requestAnimationFrame&&(this.isStoped=!1,this.rafId=window.requestAnimationFrame(this.step))}},{key:"stop",value:function(){window.cancelAnimationFrame(this.rafId),this.isStoped=!0}}],[{key:"install",value:function(){Raf.install()}}]),e}(),$$q=_export,uncurryThis$9=functionUncurryThisClause,fails$b=fails$V,ArrayBufferModule=arrayBuffer,anObject$4=anObject$m,toAbsoluteIndex=toAbsoluteIndex$8,toLength$3=toLength$b,speciesConstructor$1=speciesConstructor$5,ArrayBuffer$1=ArrayBufferModule.ArrayBuffer,DataView$1=ArrayBufferModule.DataView,DataViewPrototype=DataView$1.prototype,nativeArrayBufferSlice=uncurryThis$9(ArrayBuffer$1.prototype.slice),getUint8=uncurryThis$9(DataViewPrototype.getUint8),setUint8=uncurryThis$9(DataViewPrototype.setUint8),INCORRECT_SLICE=fails$b((function(){return!new ArrayBuffer$1(2).slice(1,void 0).byteLength}));$$q({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:INCORRECT_SLICE},{slice:function(e,t){if(nativeArrayBufferSlice&&void 0===t)return nativeArrayBufferSlice(anObject$4(this),e);for(var r=anObject$4(this).byteLength,n=toAbsoluteIndex(e,r),i=toAbsoluteIndex(void 0===t?r:t,r),a=new(speciesConstructor$1(this,ArrayBuffer$1))(toLength$3(i-n)),o=new DataView$1(this),s=new DataView$1(a),u=0;n<i;)setUint8(s,u++,getUint8(o,n++));return a}});var apply$1=functionApply,call$3=functionCall,uncurryThis$8=functionUncurryThis,fixRegExpWellKnownSymbolLogic$1=fixRegexpWellKnownSymbolLogic,anObject$3=anObject$m,isNullOrUndefined$1=isNullOrUndefined$9,isRegExp$1=isRegexp,requireObjectCoercible$2=requireObjectCoercible$b,speciesConstructor=speciesConstructor$5,advanceStringIndex$1=advanceStringIndex$3,toLength$2=toLength$b,toString$9=toString$l,getMethod$1=getMethod$6,arraySlice=arraySliceSimple,callRegExpExec=regexpExecAbstract,regexpExec=regexpExec$3,stickyHelpers$1=regexpStickyHelpers,fails$a=fails$V,UNSUPPORTED_Y$1=stickyHelpers$1.UNSUPPORTED_Y,MAX_UINT32=4294967295,min$1=Math.min,$push=[].push,exec$1=uncurryThis$8(/./.exec),push$4=uncurryThis$8($push),stringSlice$4=uncurryThis$8("".slice),SPLIT_WORKS_WITH_OVERWRITTEN_EXEC=!fails$a((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));fixRegExpWellKnownSymbolLogic$1("split",(function(e,t,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var n=toString$9(requireObjectCoercible$2(this)),i=void 0===r?MAX_UINT32:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!isRegExp$1(e))return call$3(t,n,e,i);for(var a,o,s,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,d=new RegExp(e.source,c+"g");(a=call$3(regexpExec,d,n))&&!((o=d.lastIndex)>l&&(push$4(u,stringSlice$4(n,l,a.index)),a.length>1&&a.index<n.length&&apply$1($push,u,arraySlice(a,1)),s=a[0].length,l=o,u.length>=i));)d.lastIndex===a.index&&d.lastIndex++;return l===n.length?!s&&exec$1(d,"")||push$4(u,""):push$4(u,stringSlice$4(n,l)),u.length>i?arraySlice(u,0,i):u}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:call$3(t,this,e,r)}:t,[function(t,r){var i=requireObjectCoercible$2(this),a=isNullOrUndefined$1(t)?void 0:getMethod$1(t,e);return a?call$3(a,t,i,r):call$3(n,toString$9(i),t,r)},function(e,i){var a=anObject$3(this),o=toString$9(e),s=r(n,a,o,i,n!==t);if(s.done)return s.value;var u=speciesConstructor(a,RegExp),c=a.unicode,l=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(UNSUPPORTED_Y$1?"g":"y"),d=new u(UNSUPPORTED_Y$1?"^(?:"+a.source+")":a,l),h=void 0===i?MAX_UINT32:i>>>0;if(0===h)return[];if(0===o.length)return null===callRegExpExec(d,o)?[o]:[];for(var f=0,p=0,m=[];p<o.length;){d.lastIndex=UNSUPPORTED_Y$1?0:p;var y,g=callRegExpExec(d,UNSUPPORTED_Y$1?stringSlice$4(o,p):o);if(null===g||(y=min$1(toLength$2(d.lastIndex+(UNSUPPORTED_Y$1?p:0)),o.length))===f)p=advanceStringIndex$1(o,p,c);else{if(push$4(m,stringSlice$4(o,f,p)),m.length===h)return m;for(var v=1;v<=g.length-1;v++)if(push$4(m,g[v]),m.length===h)return m;p=f=y}}return push$4(m,stringSlice$4(o,f)),m}]}),!SPLIT_WORKS_WITH_OVERWRITTEN_EXEC,UNSUPPORTED_Y$1);var IntervalTimer=function(){function e(){_classCallCheck$b(this,e),this.timeID=null,this.func=null}return _createClass$b(e,[{key:"repeat",value:function(e,t){this.timeID=1,this.repeatInterval(e,t)}},{key:"repeatInterval",value:function(e,t){var r=this;this.timeID&&(null===this.func&&(this.func=e),this.func===e&&(this.timeID&&clearTimeout(this.timeID),this.timeID=null,this.timeID=setTimeout((function(){e(),r.repeatInterval(e,t)}),t)))}},{key:"clear",value:function(){clearTimeout(this.timeID),this.timeID=null}}]),e}(),IntervalTimer$1=IntervalTimer,isSupport$1=_isLocalStorageUsable$1();function probeSupport$1(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function checkIfLocalStorageThrows$1(){var e="_localstorage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function _isLocalStorageUsable$1(){return probeSupport$1&&!checkIfLocalStorageThrows$1()}var proxyLocalStorage={length:isSupport$1?localStorage.length:0,clear:function(e){try{for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}catch(e){}},getItem:function(e){try{return localStorage.getItem(e)}catch(e){return null}},key:function(e){try{return localStorage.key(e)}catch(e){return null}},setItem:function(e,t){try{localStorage.setItem(e,t)}catch(e){}},removeItem:function(e){try{localStorage.removeItem(e)}catch(e){}},isSupport:isSupport$1},proxyLocalStorage$1=proxyLocalStorage,CONTENT_TYPES={VIDEO:"video",AUDIO:"audio"},OP_NAME$1={APPEND:"appendBuffer",REMOVE:"removeBuffer"},MSE_EVENTS={MSE_ERROR:"mse_error",UPDATE_END:"updateend",MSE_OPEN:"mse_open",MSE_OPEN_DONE:"mse_open_done"},MSE$1=function(e){_inherits$9(r,EventEmitter$1);var t=_createSuper$9(r);function r(e,n){var i;return _classCallCheck$c(this,r),(i=t.call(this)).mediaSource=new window.MediaSource(e),i.url=window.URL.createObjectURL(i.mediaSource),i.queue=[],i._hasDestroyed=!1,i._onSourceOpen=i._onSourceOpen.bind(_assertThisInitialized$9(i)),i._onSourceBufferError=i._onSourceBufferError.bind(_assertThisInitialized$9(i)),i._onSourceBufferUpdateEnd=i._onSourceBufferUpdateEnd.bind(_assertThisInitialized$9(i)),i._mseStart=nowTime$3(),i._appendStart=-1,i.mediaSource.addEventListener("sourceopen",i._onSourceOpen),i.opQueues={},i.sourceBuffers={},i.updateHanders={},i.errorHandlers={},i.logger=n||function(){},i._sourceOpenDonePromise=new ProxyPromise$1,i._mseAppendFlag=!1,i._mseOpenTime=-1,i.mseFullFlag={},i}return _createClass$c(r,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_defineProperty$a({},CONTENT_TYPES.VIDEO,{mimeType:"video/mp4",codec:'video/mp4; codecs="avc1.64001E, mp4a.40.5"'});return this.contentTypes=e,this._sourceOpenDonePromise}},{key:"_onSourceOpen",value:function(){var e=this;this._mseOpenTime=nowTime$3()-this._mseStart,console.log("[mseOpen]==> costtime",this._mseOpenTime),this.mediaSource.removeEventListener("sourceopen",this._onSourceOpen),this.emit(MSE_EVENTS.MSE_OPEN,{costtime:this._mseOpenTime});for(var t=Object.keys(this.contentTypes),r=0;r<t.length;r++)try{!function(){var n=t[r],i=e.contentTypes[n].codec,a=e.mediaSource.addSourceBuffer(i),o=function(){return e._onSourceBufferError(n)};a.addEventListener("error",o);var s=function(){return e._onSourceBufferUpdateEnd(n)};a.addEventListener("updateend",s),e.updateHanders={},e.sourceBuffers[n]=a,e.opQueues[n]=[],e.updateHanders[n]=s,e.errorHandlers[n]=o}()}catch(e){e.errtype="open_error",this.emit(MSE_EVENTS.MSE_ERROR,e)}this.logger("[debug mse] mse init ready, readyState",this.mediaSource.readyState),this._mseAppendFlag=!0,this.emit(MSE_EVENTS.MSE_OPEN_DONE,{costtime:nowTime$3()-this._mseStart}),this._sourceOpenDonePromise.resolve()}},{key:"ready",get:function(){return this._mseAppendFlag}},{key:"_onSourceBufferError",value:function(e){if(!this._hasDestroyed){this.logger("[debug mse] sourceBuffer error, contentType",e,"readyState",this.mediaSource.readyState);var t=this.opQueues[e][0];this.emit(MSE_EVENTS.MSE_ERROR,{errtype:"append_error",name:t.name,context:t.context})}}},{key:"_onSourceBufferUpdateEnd",value:function(e){if(!this._hasDestroyed){var t=this.opQueues[e][0];t&&(this.emit(MSE_EVENTS.UPDATE_END,{name:t.name,context:t.context,costtime:nowTime$3()-this._appendStart}),this.pop(e))}}},{key:"state",get:function(){return this.mediaSource.readyState}},{key:"duration",get:function(){return this.mediaSource.duration}},{key:"setDuration",value:function(e){var t=this;this.mediaSource.duration>e||this.enqueueBlockOp((function(){t.ended()?t.logger("[debug mse] setDuration ended"):(t.logger("[debug mse] setDuration"),t.mediaSource.duration=e)}),"setDuration")}},{key:"appendBuffer",value:function(e,t,r){var n=this;return this.enqueueOp(e,(function(){return n._append(e,t,r)}),OP_NAME$1.APPEND,r)}},{key:"_append",value:function(e,t,r){this._appendStart=nowTime$3(),this.logger("[real appendBuffer], context,",r),this.sourceBuffers[e].appendBuffer(t)}},{key:"enqueueOp",value:function(e,t,r,n){var i=this;if(!this._hasDestroyed){var a={handler:t,context:n,name:r};return this._mseAppendFlag?this._enQueue(e,a):this._sourceOpenDonePromise.then((function(){i._hasDestroyed||i._enQueue(e,a)})),a.p}}},{key:"_enQueue",value:function(e,t){this.opQueues[e]||(this.opQueues[e]=[]),this.mseFullFlag[e]&&t.name===OP_NAME$1.REMOVE?(this.opQueues[e].splice(0,0,t),this.mseFullFlag[e]=!1,this.handleOp(e)):(this.opQueues[e].push(t),1===this.opQueues[e].length&&this.handleOp(e))}},{key:"enqueueBlockOp",value:function(e,t){var r=this;this._hasDestroyed||this._sourceOpenDonePromise.then((function(){if(!r._hasDestroyed){for(var n=[],i=Object.keys(r.contentTypes),a=function(e){var a=i[e],o=new ProxyPromise$1,s={handler:function(){return o.resolve()},p:o,name:t};r.opQueues[a]||(r.opQueues[a]=[]),r.opQueues[a].push(s),n.push(o),1===r.opQueues[a].length&&s.handler()},o=0;o<i.length;o++)a(o);Promise.all(n).then((function(){try{e()}catch(e){console.log(e)}finally{for(var t=0;t<i.length;t++){var n=i[t];r.pop(n)}}})).catch((function(e){console.log("waiting cath",e)}))}}))}},{key:"isFull",value:function(e){return e?this.mseFullFlag[e]:this.mseFullFlag[CONTENT_TYPES.VIDEO]}},{key:"handleOp",value:function(e){if(!this._hasDestroyed){var t=this.opQueues[e][0];if(t&&!this.mseFullFlag[e])try{t.handler()}catch(r){r&&r.message.indexOf("SourceBuffer is full")>=0?(this.mseFullFlag[e]=!0,this.logger("[MSE error], context,",t.context,",name,",t.name,",err,SourceBuffer is full")):this.pop(e),this.emit(MSE_EVENTS.MSE_ERROR,{errtype:"append_error",context:t.context,errMsg:r?r.message:null})}}}},{key:"pop",value:function(e){this._hasDestroyed||(this.opQueues[e].shift(),this.handleOp(e))}},{key:"clearOpqueues",value:function(e){var t,r=[];if(this.opQueues[e].map((function(e){e.context.isinit&&r.push(e)})),this.opQueues&&this.opQueues[e]&&this.opQueues[e].length>1)if(this.opQueues[e][0].name===OP_NAME$1.APPEND||this.opQueues[e][0].name===OP_NAME$1.REMOVE)this.logger("[debug mse] clearOpqueues, left:",1,", len,",this.opQueues[e].length),this.opQueues[e]=this.opQueues[e].slice(0,1);else{var n=Math.min(this.opQueues[e].length,Object.keys(this.contentTypes).length);this.logger("[debug mse] clearOpqueues, left:",n,", len,",this.opQueues[e].length),this.opQueues[e]=this.opQueues[e].slice(0,n)}r.length>0&&(t=this.opQueues[e]).push.apply(t,r)}},{key:"removeBuffer",value:function(e,t,r,n){var i=this;return this.enqueueOp(e,(function(){return i._remove(e,t,r,n)}),OP_NAME$1.REMOVE,n)}},{key:"_remove",value:function(e,t,r,n){r<=t?this._onSourceBufferUpdateEnd(e):(this.logger("[debug mse],real removeBuffer, context,",n),this._appendStart=nowTime$3(),this.sourceBuffers[e].remove(t,r))}},{key:"endOfStream",value:function(){var e=this;this._hasDestroyed||this.ended()||this.enqueueBlockOp((function(){e._hasDestroyed||e.ended()||(e.logger("[debug mse] endOfStream"),e.mediaSource.endOfStream())}),"endOfStream")}},{key:"ended",value:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isMediaSourceOpen",value:function(){return!!this.mediaSource&&"open"===this.mediaSource.readyState}},{key:"abort",value:function(e){var t=this;return this.isMediaSourceOpen()?this.enqueueOp(e,(function(){t.sourceBuffers[e].abort(),t._onSourceBufferUpdateEnd(e)}),"abort"):Promise.resolve()}},{key:"reuse",value:function(e,t){for(var r=Object.keys(this.contentTypes),n=0;n<r.length;n++){var i=r[n];this.removeBuffer(i,e,t,{start:e,end:t})}}},{key:"_forceAbort",value:function(){try{for(var e=Object.keys(this.contentTypes),t=0;t<e.length;t++){var r=e[t];this.sourceBuffers[r].abort()}}catch(e){console.log("forceAbort error")}}},{key:"destroy",value:function(){if(this.logger("[debug mse] destroy execute"),!this._hasDestroyed){this._forceAbort(),this._hasDestroyed=!0,window.URL.revokeObjectURL(this.url),this.mediaSource&&(this.mediaSource.removeEventListener("sourceclose",this._onMediaSourceClose),this.mediaSource.removeEventListener("sourceopen",this._onSourceOpen));for(var e=Object.keys(this.contentTypes),t=0;t<e.length;t++){var r=e[t],n=this.sourceBuffers[r];if(n){var i=this.errorHandlers[r];n.removeEventListener("error",i);var a=this.updateHanders[r];n.removeEventListener("updateend",a)}}this.opQueues={},this.sourceBuffers={}}}},{key:"buffered",value:function(e){return this.sourceBuffers[e]&&this.sourceBuffers[e].buffered}},{key:"sourceBuffer",value:function(e){return this.sourceBuffers[e]}},{key:"removeSourceBuffer",value:function(e){var t=this.sourceBuffer(e);if(t){this.mediaSource.removeSourceBuffer(t);var r=this.errorHandlers[e];t.removeEventListener("error",r);var n=this.updateHanders[e];t.removeEventListener("updateend",n),delete this.errorHandlers[e],delete this.sourceBuffers[e],delete this.updateHanders[e]}}},{key:"setTimeoffset",value:function(e,t){var r=this;return this.enqueueOp(e,(function(){t<0&&(t+=.001),r.sourceBuffers[e].timestampOffset=t,r._onSourceBufferUpdateEnd(e)}),"setTimeoffset")}}],[{key:"isSupported",value:function(e){return window.MediaSource&&window.MediaSource.isTypeSupported(e)}}]),r}(),nowTime$3=function(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}},collection=collection$2,collectionStrong=collectionStrong$2;collection("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),collectionStrong);var concat2={};Object.defineProperty(concat2,"__esModule",{value:!0}),concat2.default=function(e){for(var t=0,r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var a=!0,o=!1,s=void 0;try{for(var u,c=n[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){t+=u.value.length}}catch(e){o=!0,s=e}finally{try{!a&&c.return&&c.return()}finally{if(o)throw s}}var l=new e(t),d=0,h=!0,f=!1,p=void 0;try{for(var m,y=n[Symbol.iterator]();!(h=(m=y.next()).done);h=!0){var g=m.value;l.set(g,d),d+=g.length}}catch(e){f=!0,p=e}finally{try{!h&&y.return&&y.return()}finally{if(f)throw p}}return l};var _concat=concat2,_concat2=_interopRequireDefault(_concat);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var lib$1=_concat2.default,Concat$2=getDefaultExportFromCjs(lib$1);function _classCallCheck$a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$a(e,t,r){return t&&_defineProperties$a(e.prototype,t),r&&_defineProperties$a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$9(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray$5(e,t){return _arrayWithHoles$5(e)||_iterableToArrayLimit$5(e,t)||_unsupportedIterableToArray$8(e,t)||_nonIterableRest$5()}function _toConsumableArray$6(e){return _arrayWithoutHoles$6(e)||_iterableToArray$6(e)||_unsupportedIterableToArray$8(e)||_nonIterableSpread$6()}function _arrayWithoutHoles$6(e){if(Array.isArray(e))return _arrayLikeToArray$8(e)}function _arrayWithHoles$5(e){if(Array.isArray(e))return e}function _iterableToArray$6(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit$5(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}function _unsupportedIterableToArray$8(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$8(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$8(e,t):void 0}}function _arrayLikeToArray$8(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread$6(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest$5(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var TrackType$2={VIDEO:"video",AUDIO:"audio",METADATA:"metadata"},VideoCodecType$2={AVC:"avc",HEVC:"hevc"},AudioCodecType$1={AAC:"aac",G711PCMA:"g7110a",G711PCMU:"g7110m"},VideoTrack$1=function(){function e(){_classCallCheck$a(this,e),_defineProperty$9(this,"id",1),_defineProperty$9(this,"type",TrackType$2.VIDEO),_defineProperty$9(this,"codecType",VideoCodecType$2.AVC),_defineProperty$9(this,"pid",-1),_defineProperty$9(this,"hvcC",void 0),_defineProperty$9(this,"codec",""),_defineProperty$9(this,"timescale",0),_defineProperty$9(this,"formatTimescale",0),_defineProperty$9(this,"sequenceNumber",0),_defineProperty$9(this,"baseMediaDecodeTime",0),_defineProperty$9(this,"baseDts",0),_defineProperty$9(this,"duration",0),_defineProperty$9(this,"warnings",[]),_defineProperty$9(this,"samples",[]),_defineProperty$9(this,"pps",[]),_defineProperty$9(this,"sps",[]),_defineProperty$9(this,"vps",[]),_defineProperty$9(this,"fpsNum",0),_defineProperty$9(this,"fpsDen",0),_defineProperty$9(this,"sarRatio",[]),_defineProperty$9(this,"width",0),_defineProperty$9(this,"height",0),_defineProperty$9(this,"nalUnitSize",4),_defineProperty$9(this,"present",!1),_defineProperty$9(this,"isVideoEncryption",!1),_defineProperty$9(this,"isAudioEncryption",!1),_defineProperty$9(this,"kid",null),_defineProperty$9(this,"pssh",null),_defineProperty$9(this,"ext",void 0)}return _createClass$a(e,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"exist",value:function(){return!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}}]),e}(),AudioTrack$1=function(){function e(){_classCallCheck$a(this,e),_defineProperty$9(this,"id",2),_defineProperty$9(this,"type",TrackType$2.AUDIO),_defineProperty$9(this,"codecType",AudioCodecType$1.AAC),_defineProperty$9(this,"pid",-1),_defineProperty$9(this,"codec",""),_defineProperty$9(this,"sequenceNumber",0),_defineProperty$9(this,"sampleDuration",0),_defineProperty$9(this,"timescale",0),_defineProperty$9(this,"formatTimescale",0),_defineProperty$9(this,"baseMediaDecodeTime",0),_defineProperty$9(this,"duration",0),_defineProperty$9(this,"warnings",[]),_defineProperty$9(this,"samples",[]),_defineProperty$9(this,"baseDts",0),_defineProperty$9(this,"sampleSize",16),_defineProperty$9(this,"sampleRate",0),_defineProperty$9(this,"channelCount",0),_defineProperty$9(this,"objectType",0),_defineProperty$9(this,"sampleRateIndex",0),_defineProperty$9(this,"config",[]),_defineProperty$9(this,"present",!1),_defineProperty$9(this,"isVideoEncryption",!1),_defineProperty$9(this,"isAudioEncryption",!1),_defineProperty$9(this,"kid",null),_defineProperty$9(this,"ext",void 0)}return _createClass$a(e,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&this.codec&&this.codecType===AudioCodecType$1.AAC)}},{key:"hasSample",value:function(){return!!this.samples.length}}]),e}(),VideoSample$1=function(){function e(t,r,n){_classCallCheck$a(this,e),_defineProperty$9(this,"flag",{}),_defineProperty$9(this,"keyframe",!1),_defineProperty$9(this,"gopId",0),_defineProperty$9(this,"duration",0),_defineProperty$9(this,"size",0),_defineProperty$9(this,"units",[]),_defineProperty$9(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=r,n&&(this.units=n)}return _createClass$a(e,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),e}(),AudioSample$1=_createClass$a((function e(t,r,n,i){_classCallCheck$a(this,e),_defineProperty$9(this,"duration",1024),_defineProperty$9(this,"flag",{dependsOn:2,isNonSyncSample:0}),_defineProperty$9(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=r,this.size=r.byteLength,this.sampleOffset=i,n&&(this.duration=n)})),MetadataTrack$1=function(){function e(){_classCallCheck$a(this,e),_defineProperty$9(this,"id",3),_defineProperty$9(this,"type",TrackType$2.METADATA),_defineProperty$9(this,"timescale",0),_defineProperty$9(this,"flvScriptSamples",[]),_defineProperty$9(this,"seiSamples",[])}return _createClass$a(e,[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}]),e}(),isBrowser$2="undefined"!=typeof window,ua$1=isBrowser$2&&navigator.userAgent.toLocaleLowerCase(),isFirefox$1=isBrowser$2&&ua$1.includes("firefox"),isAndroid$1=isBrowser$2&&ua$1.includes("android"),AAC$1=function(){function e(){_classCallCheck$a(this,e)}return _createClass$a(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var a=i,o=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,d=1+((192&t[i+2])>>>6),h=(1&t[i+2])<<2|(192&t[i+3])>>>6,f=e._getConfig(s,h,d),p=f.config,m=f.codec,y=0,g=e.getFrameDuration(u);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(n-i<(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]),o.push({pts:r+y*g,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:a,remaining:i>=n?void 0:t.subarray(i),frames:o,samplingFrequencyIndex:s,sampleRate:u,objectType:d,channelCount:h,codec:m,config:p,originCodec:"mp4a.40.".concat(d)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,a=e.FREQ[n];if(!a)throw new Error("Invalid sampling index: ".concat(n));var o=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:a,objectType:r,channelCount:i,config:o.config,codec:o.codec,originCodec:"mp4a.40.".concat(r)}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,a=[];return isFirefox$1?e>=6?(n=5,i=e-3):(n=2,i=e):isAndroid$1?(n=2,i=e):(n=2===r||5===r?r:5,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),a[0]=n<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=t<<3,5===n&&(a[1]|=(14&i)>>1,a[2]=(1&i)<<7,a[2]|=8,a[3]=0),{config:a,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(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])}}}]),e}();function concatUint8Array$3(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t.filter(Boolean);var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}_defineProperty$9(AAC$1,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var MAX_SIZE$1=Math.pow(2,32);function readBig16$1(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function readBig24$1(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}function readBig32$1(e){var 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 readBig64$1(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return readBig32$1(e,t)*MAX_SIZE$1+readBig32$1(e,t+4)}function getAvcCodec$1(e){for(var t,r="avc1.",n=0;n<3;n++)(t=e[n].toString(16)).length<2&&(t="0".concat(t)),r+=t;return r}function formatIV(e){var t="";if(e.forEach((function(e){t+=bufferToString(e)})),t.length<=32)for(var r=32-t.length,n=0;n<r;n++)t+="0";return t}function parse$2(e){if(!Array.isArray(e)){for(var t=[],r="",n=0;n<e.length;n++)n%2&&(r=e[n-1]+e[n],t.push(parseInt(r,16)),r="");return t}return e.map((function(e){return parseInt(e,16)}))}function bufferToString(e){return("0"+Number(e).toString(16)).slice(-2).toUpperCase()}var MP4Parser$1=function(){function e(){_classCallCheck$a(this,e)}return _createClass$a(e,null,[{key:"findBox",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var a=0,o="",s=0;t.length>7;){if(a=readBig32$1(t),o=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===a?(a=readBig64$1(t,8),s+=8):a||(a=t.length),!r[0]||o===r[0]){var u=t.subarray(0,a);if(!(r.length<2))return e.findBox(u.subarray(s),r.slice(1),n+s);i.push({start:n,size:a,headerSize:s,type:o,data:u})}n+=a,t=t.subarray(a)}return i}},{key:"tfhd",value:function(e){return parseBox$1(e,!0,(function(e,t){e.trackId=readBig32$1(t);var r=4,n=1&e.flags,i=2&e.flags,a=8&e.flags,o=16&e.flags,s=32&e.flags;n&&(r+=4,e.baseDataOffset=readBig32$1(t,r),r+=4),i&&(e.sampleDescriptionIndex=readBig32$1(t,r),r+=4),a&&(e.defaultSampleDuration=readBig32$1(t,r),r+=4),o&&(e.defaultSampleSize=readBig32$1(t,r),r+=4),s&&(e.defaultSampleFlags=readBig32$1(t,r))}))}},{key:"sidx",value:function(e){return parseBox$1(e,!0,(function(e,t){var r=0;e.reference_ID=readBig32$1(t,r),r+=4,e.timescale=readBig32$1(t,r),r+=4,0===e.version?(e.earliest_presentation_time=readBig32$1(t,r),r+=4,e.first_offset=readBig32$1(t,r),r+=4):(e.earliest_presentation_time=readBig64$1(t,r),r+=8,e.first_offset=readBig64$1(t,r),r+=8),r+=2,e.references=[];var n=readBig16$1(t,r);r+=2;for(var i=0;i<n;i++){var a={};e.references.push(a);var o=readBig32$1(t,r);r+=4,a.reference_type=o>>31&1,a.referenced_size=2147483647&o,a.subsegment_duration=readBig32$1(t,r),o=readBig32$1(t,r+=4),r+=4,a.starts_with_SAP=o>>31&1,a.SAP_type=o>>28&7,a.SAP_delta_time=268435455&o}}))}},{key:"moov",value:function(t){return parseBox$1(t,!1,(function(t,r,n){t.mvhd=e.mvhd(e.findBox(r,["mvhd"],n)[0]),t.trak=e.findBox(r,["trak"],n).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(r,["pssh"],n)[0])}))}},{key:"mvhd",value:function(e){return parseBox$1(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=readBig32$1(t,16),e.duration=readBig64$1(t,20),r+=28):(e.timescale=readBig32$1(t,8),e.duration=readBig32$1(t,12),r+=16),e.nextTrackId=readBig32$1(t,r+76)}))}},{key:"trak",value:function(t){return parseBox$1(t,!1,(function(t,r,n){t.tkhd=e.tkhd(e.findBox(r,["tkhd"],n)[0]),t.mdia=e.mdia(e.findBox(r,["mdia"],n)[0])}))}},{key:"tkhd",value:function(e){return parseBox$1(e,!0,(function(e,t){var r=0;1===e.version?(e.trackId=readBig32$1(t,16),e.duration=readBig64$1(t,24),r+=32):(e.trackId=readBig32$1(t,8),e.duration=readBig32$1(t,16),r+=20),e.width=readBig32$1(t,r+52),e.height=readBig32$1(t,r+56)}))}},{key:"mdia",value:function(t){return parseBox$1(t,!1,(function(t,r,n){t.mdhd=e.mdhd(e.findBox(r,["mdhd"],n)[0]),t.hdlr=e.hdlr(e.findBox(r,["hdlr"],n)[0]),t.minf=e.minf(e.findBox(r,["minf"],n)[0])}))}},{key:"mdhd",value:function(e){return parseBox$1(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=readBig32$1(t,16),e.duration=readBig64$1(t,20),r+=28):(e.timescale=readBig32$1(t,8),e.duration=readBig32$1(t,12),r+=16);var n=readBig16$1(t,r);e.language=String.fromCharCode(96+(n>>10&31),96+(n>>5&31),96+(31&n))}))}},{key:"hdlr",value:function(e){return parseBox$1(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return parseBox$1(t,!1,(function(t,r,n){t.vmhd=e.vmhd(e.findBox(r,["vmhd"],n)[0]),t.smhd=e.smhd(e.findBox(r,["smhd"],n)[0]),t.stbl=e.stbl(e.findBox(r,["stbl"],n)[0])}))}},{key:"vmhd",value:function(e){return parseBox$1(e,!0,(function(e,t){e.graphicsmode=readBig16$1(t),e.opcolor=[readBig16$1(t,2),readBig16$1(t,4),readBig16$1(t,6)]}))}},{key:"smhd",value:function(e){return parseBox$1(e,!0,(function(e,t){e.balance=readBig16$1(t)}))}},{key:"stbl",value:function(t){return parseBox$1(t,!1,(function(t,r,n){t.stsd=e.stsd(e.findBox(r,["stsd"],n)[0]),t.stts=e.stts(e.findBox(r,["stts"],n)[0]),t.ctts=e.ctts(e.findBox(r,["ctts"],n)[0]),t.stsc=e.stsc(e.findBox(r,["stsc"],n)[0]),t.stsz=e.stsz(e.findBox(r,["stsz"],n)[0]),t.stco=e.stco(e.findBox(r,["stco"],n)[0]),t.stco||(t.co64=e.co64(e.findBox(r,["co64"],n)[0]),t.stco=t.co64),t.stss=e.stss(e.findBox(r,["stss"],n)[0]),t.senc=e.senc(e.findBox(r,["senc"],n)[0])}))}},{key:"senc",value:function(e){return parseBox$1(e,!0,(function(e,t){var r=0,n=readBig32$1(t,r);r+=4,e.samples=[];for(var i=0;i<n;i++){var a={};if(a.InitializationVector=[t[r],t[r+1],t[r+2],t[r+3],t[r+4],t[r+5],t[r+6],t[r+7]],r+=8,2&e.flags){a.subsamples=[];var o=readBig16$1(t,r);r+=2;for(var s=0;s<o;s++){var u={};u.BytesOfClearData=readBig16$1(t,r),r+=2,u.BytesOfProtectedData=readBig32$1(t,r),r+=4,a.subsamples.push(u)}}e.samples.push(a)}}))}},{key:"pssh",value:function(e){return parseBox$1(e,!0,(function(e,t){for(var r=[],n=[],i=0,a=0;a<16;a++)n.push(toHex$1(t[i+a]));if(i+=16,e.version>0){var o=readBig32$1(t,i);i+=4;for(var s=0;s<(""+o).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,r.push(toHex$1(c))}}var l=readBig32$1(t,i);e.data_size=l,i+=4,e.kid=r,e.system_id=n,e.buffer=t}))}},{key:"stsd",value:function(t){return parseBox$1(t,!0,(function(t,r,n){t.entryCount=readBig32$1(r),t.entries=e.findBox(r.subarray(4),[],n+4).map((function(t){switch(t.type){case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return parseBox$1(t,!1,(function(t,r,n){t.channelCount=readBig16$1(r,16),t.samplesize=readBig16$1(r,18),t.sampleRate=readBig32$1(r,24)/65536,r=r.subarray(28),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.esds=e.esds(e.findBox(r,["esds"],n)[0])}));case"encv":return parseBox$1(t,!1,(function(t,r,n){t.width=readBig16$1(r,24),t.height=readBig16$1(r,26),t.horizresolution=readBig32$1(r,28),t.vertresolution=readBig32$1(r,32),r=r.subarray(78),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.avcC=e.avcC(e.findBox(r,["avcC"],n)[0]),t.hvcC=e.hvcC(e.findBox(r,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(r,["pasp"],n)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return parseBox$1(e,!1,(function(e,t){var r=6;e.default_IsEncrypted=t[r],r+=1,e.default_IV_size=t[r],r+=1,e.default_KID=[];for(var n=0;n<16;n++)e.default_KID.push(toHex$1(t[r])),r+=1}))}},{key:"schi",value:function(t){return parseBox$1(t,!1,(function(t,r,n){t.tenc=e.tenc(e.findBox(r,["tenc"],n)[0])}))}},{key:"sinf",value:function(t){return parseBox$1(t,!1,(function(t,r,n){t.schi=e.schi(e.findBox(r,["schi"],n)[0]),t.frma=e.frma(e.findBox(r,["frma"],n)[0])}))}},{key:"frma",value:function(e){return parseBox$1(e,!1,(function(e,t){e.data_format="";for(var r=0;r<4;r++)e.data_format+=String.fromCharCode(t[r])}))}},{key:"avc1",value:function(t){return parseBox$1(t,!1,(function(t,r,n){var i=parseVisualSampleEntry$1(t,r),a=r.subarray(i);n+=i,t.avcC=e.avcC(e.findBox(a,["avcC"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])}))}},{key:"avcC",value:function(e){return parseBox$1(e,!1,(function(e,t){e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=getAvcCodec$1([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];for(var r=6,n=0;n<e.spsLength;n++){var i=readBig16$1(t,r);r+=2,e.sps.push(t.subarray(r,r+i)),r+=i}e.ppsLength=t[r],r+=1,e.pps=[];for(var a=0;a<e.ppsLength;a++){var o=readBig16$1(t,r);r+=2,e.pps.push(t.subarray(r,r+=o)),r+=o}}))}},{key:"hvc1",value:function(t){return parseBox$1(t,!1,(function(t,r,n){var i=parseVisualSampleEntry$1(t,r),a=r.subarray(i);n+=i,t.hvcC=e.hvcC(e.findBox(a,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])}))}},{key:"hvcC",value:function(e){return parseBox$1(e,!1,(function(t,r){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=r[0];var n=r[1];t.generalProfileSpace=n>>6,t.generalTierFlag=(32&n)>>5,t.generalProfileIdc=31&n,t.generalProfileCompatibility=readBig32$1(r,2),t.generalConstraintIndicatorFlags=r.subarray(6,12),t.generalLevelIdc=r[12],t.avgFrameRate=readBig16$1(r,19),t.numOfArrays=r[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,a=0,o=0,s=0,u=0;u<t.numOfArrays;u++){a=63&r[i],o=readBig16$1(r,i+1),i+=3;for(var c,l=[],d=0;d<o;d++)s=readBig16$1(r,i),i+=2,l.push(r.subarray(i,i+s)),i+=s;if(32===a)(c=t.vps).push.apply(c,l);else if(33===a){var h;(h=t.sps).push.apply(h,l)}else if(34===a){var f;(f=t.pps).push.apply(f,l)}}}))}},{key:"pasp",value:function(e){return parseBox$1(e,!1,(function(e,t){e.hSpacing=readBig32$1(t),e.vSpacing=readBig32$1(t,4)}))}},{key:"mp4a",value:function(t){return parseBox$1(t,!1,(function(t,r,n){var i=parseAudioSampleEntry$1(t,r);t.esds=e.esds(e.findBox(r.subarray(i),["esds"],n+i)[0])}))}},{key:"esds",value:function(e){return parseBox$1(e,!0,(function(e,t){e.codec="mp4a.";for(var r=0,n=0,i=0,a=0;t.length;){for(a=t[r=0],n=t[r+1],r+=2;128&n;)i=(127&n)<<7,n=t[r],r+=1;if(i+=127&n,3===a)t=t.subarray(r+3);else{if(4!==a){if(5===a){var o=e.config=t.subarray(r,r+i),s=(248&o[0])>>3;return 31===s&&o.length>=2&&(s=32+((7&o[0])<<3)+((224&o[1])>>5)),e.objectType=s,e.codec+=s.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[r].toString(16)+".").padStart(3,"0"),t=t.subarray(r+13)}}}))}},{key:"alaw",value:function(e){return parseBox$1(e,!1,(function(e,t){parseAudioSampleEntry$1(e,t)}))}},{key:"stts",value:function(e){return parseBox$1(e,!0,(function(e,t){for(var r=readBig32$1(t),n=[],i=4,a=0;a<r;a++)n.push({count:readBig32$1(t,i),delta:readBig32$1(t,i+4)}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"ctts",value:function(e){return parseBox$1(e,!0,(function(e,t){var r=readBig32$1(t),n=[],i=4;if(1===e.version)for(var a=0;a<r;a++)n.push({count:readBig32$1(t,i),offset:readBig32$1(t,i+4)}),i+=8;else for(var o=0;o<r;o++)n.push({count:readBig32$1(t,i),offset:-(1+~readBig32$1(t,i+4))}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stsc",value:function(e){return parseBox$1(e,!0,(function(e,t){for(var r=readBig32$1(t),n=[],i=4,a=0;a<r;a++)n.push({firstChunk:readBig32$1(t,i),samplesPerChunk:readBig32$1(t,i+4),sampleDescriptionIndex:readBig32$1(t,i+8)}),i+=12;e.entryCount=r,e.entries=n}))}},{key:"stsz",value:function(e){return parseBox$1(e,!0,(function(e,t){var r=readBig32$1(t),n=readBig32$1(t,4),i=[];if(!r)for(var a=8,o=0;o<n;o++)i.push(readBig32$1(t,a)),a+=4;e.sampleSize=r,e.sampleCount=n,e.entrySizes=i}))}},{key:"stco",value:function(e){return parseBox$1(e,!0,(function(e,t){for(var r=readBig32$1(t),n=[],i=4,a=0;a<r;a++)n.push(readBig32$1(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"co64",value:function(e){return parseBox$1(e,!0,(function(e,t){for(var r=readBig32$1(t),n=[],i=4,a=0;a<r;a++)n.push(readBig64$1(t,i)),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stss",value:function(e){return parseBox$1(e,!0,(function(e,t){for(var r=readBig32$1(t),n=[],i=4,a=0;a<r;a++)n.push(readBig32$1(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"moof",value:function(t){return parseBox$1(t,!1,(function(t,r,n){t.mfhd=e.mfhd(e.findBox(r,["mfhd"],n)[0]),t.traf=e.findBox(r,["traf"],n).map((function(t){return e.traf(t)}))}))}},{key:"mfhd",value:function(e){return parseBox$1(e,!0,(function(e,t){e.sequenceNumber=readBig32$1(t)}))}},{key:"traf",value:function(t){return parseBox$1(t,!1,(function(t,r,n){t.tfhd=e.tfhd(e.findBox(r,["tfhd"],n)[0]),t.tfdt=e.tfdt(e.findBox(r,["tfdt"],n)[0]),t.trun=e.trun(e.findBox(r,["trun"],n)[0])}))}},{key:"trun",value:function(e){return parseBox$1(e,!0,(function(e,t){var r=e.version,n=e.flags,i=t.length,a=e.sampleCount=readBig32$1(t),o=4;if(i>o&&1&n&&(e.dataOffset=-(1+~readBig32$1(t,o)),o+=4),i>o&&4&n&&(e.firstSampleFlags=readBig32$1(t,o),o+=4),e.samples=[],i>o)for(var s,u=0;u<a;u++)s={},256&n&&(s.duration=readBig32$1(t,o),o+=4),512&n&&(s.size=readBig32$1(t,o),o+=4),1024&n&&(s.flags=readBig32$1(t,o),o+=4),2048&n&&(s.cts=r?-(1+~readBig32$1(t,o+4)):readBig32$1(t,o),o+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return parseBox$1(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=readBig64$1(t):e.baseMediaDecodeTime=readBig32$1(t)}))}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(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]}}},{key:"moovToTrack",value:function(e,t,r){var n,i,a=e.trak;if(a&&a.length){var o=a.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),s=a.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(o&&t){var u,c,l,d,h,f,p,m=t,y=null===(u=o.tkhd)||void 0===u?void 0:u.trackId;null!=y&&(m.id=o.tkhd.trackId),m.tkhdDuration=o.tkhd.duration,m.mvhdDurtion=e.mvhd.duration,m.mvhdTimecale=e.mvhd.timescale,m.timescale=m.formatTimescale=o.mdia.mdhd.timescale,m.duration=o.mdia.mdhd.duration||m.mvhdDurtion/m.mvhdTimecale*m.timescale;var g,v,b,_,A,T,E,S,$=o.mdia.minf.stbl.stsd.entries[0];if(m.width=$.width,m.height=$.height,$.pasp&&(m.sarRatio=[$.pasp.hSpacing,$.pasp.vSpacing]),$.hvcC)m.codecType=VideoCodecType$2.HEVC,m.codec=$.hvcC.codec,m.vps=$.hvcC.vps,m.sps=$.hvcC.sps,m.pps=$.hvcC.pps,m.hvcC=$.hvcC.data;else{if(!$.avcC)throw new Error("unknown video stsd entry");m.codec=$.avcC.codec,m.sps=$.avcC.sps,m.pps=$.avcC.pps}if(m.present=!0,m.ext={},m.ext.stss=null===(c=o.mdia)||void 0===c||null===(l=c.minf)||void 0===l||null===(d=l.stbl)||void 0===d?void 0:d.stss,m.ext.ctts=null===(h=o.mdia)||void 0===h||null===(f=h.minf)||void 0===f||null===(p=f.stbl)||void 0===p?void 0:p.ctts,$&&"encv"===$.type)m.isVideoEncryption=!0,$.default_KID=null===(g=$.sinf)||void 0===g||null===(v=g.schi)||void 0===v?void 0:v.tenc.default_KID,$.default_IsEncrypted=null===(b=$.sinf)||void 0===b||null===(_=b.schi)||void 0===_?void 0:_.tenc.default_IsEncrypted,$.default_IV_size=null===(A=$.sinf)||void 0===A||null===(T=A.schi)||void 0===T?void 0:T.tenc.default_IV_size,m.videoSenc=o.mdia.minf.stbl.senc&&o.mdia.minf.stbl.senc.samples,$.data_format=null===(E=$.sinf)||void 0===E||null===(S=E.frma)||void 0===S?void 0:S.data_format,m.useEME=e.useEME,m.kidValue=e.kidValue,m.pssh=e.pssh,m.encv=$}if(s&&r){var I,w,R,k,P,C,x,L,O,D=r,M=null===(I=s.tkhd)||void 0===I?void 0:I.trackId;null!=M&&(D.id=s.tkhd.trackId),D.tkhdDuration=s.tkhd.duration,D.mvhdDurtion=e.mvhd.duration,D.mvhdTimecale=e.mvhd.timescale,D.timescale=D.formatTimescale=s.mdia.mdhd.timescale,D.duration=s.mdia.mdhd.duration||D.mvhdDurtion/D.mvhdTimecale*D.timescale;var Z,V,N,G,X,W,U,F,B=s.mdia.minf.stbl.stsd.entries[0];switch(D.sampleSize=B.sampleSize,D.sampleRate=B.sampleRate,D.channelCount=B.channelCount,D.present=!0,B.type){case"alaw":D.codecType=D.codec=AudioCodecType$1.G711PCMA,D.sampleRate=8e3;break;case"ulaw":D.codecType=D.codec=AudioCodecType$1.G711PCMU,D.sampleRate=8e3;break;default:D.sampleDuration=AAC$1.getFrameDuration(D.sampleRate,D.timescale),D.sampleRateIndex=AAC$1.getRateIndexByRate(D.sampleRate),D.objectType=(null===(n=B.esds)||void 0===n?void 0:n.objectType)||2,B.esds&&(D.config=Array.from(B.esds.config)),D.codec=(null===(i=B.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(D.sampleDuration=AAC$1.getFrameDuration(D.sampleRate,D.timescale),D.objectType=(null===(w=B.esds)||void 0===w?void 0:w.objectType)||2,B.esds&&(B.esds.config?D.config=Array.from(B.esds.config):console.warn("esds config is null")),D.codec=(null===(R=B.esds)||void 0===R?void 0:R.codec)||"mp4a.40.2",D.sampleRateIndex=AAC$1.getRateIndexByRate(D.sampleRate),D.ext={},D.ext.stss=null===(k=s.mdia)||void 0===k||null===(P=k.minf)||void 0===P||null===(C=P.stbl)||void 0===C?void 0:C.stss,D.ext.ctts=null===(x=s.mdia)||void 0===x||null===(L=x.minf)||void 0===L||null===(O=L.stbl)||void 0===O?void 0:O.ctts,D.present=!0,B&&"enca"===B.type)D.isAudioEncryption=!0,B.data_format=null===(Z=B.sinf)||void 0===Z||null===(V=Z.frma)||void 0===V?void 0:V.data_format,B.default_KID=null===(N=B.sinf)||void 0===N||null===(G=N.schi)||void 0===G?void 0:G.tenc.default_KID,B.default_IsEncrypted=null===(X=B.sinf)||void 0===X||null===(W=X.schi)||void 0===W?void 0:W.tenc.default_IsEncrypted,B.default_IV_size=null===(U=B.sinf)||void 0===U||null===(F=U.schi)||void 0===F?void 0:F.tenc.default_IV_size,D.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,D.useEME=e.useEME,D.kidValue=e.kidValue,D.enca=B}if(r&&(r.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!r&&r.isAudioEncryption),null!=t&&t.encv||null!=r&&r.enca){var Y,j,K=null==t||null===(Y=t.encv)||void 0===Y?void 0:Y.default_KID,H=null==r||null===(j=r.enca)||void 0===j?void 0:j.default_KID,z=K||H?(K||H).join(""):null;t&&(t.kid=z),r&&(r.kid=z)}return t&&(t.flags=3841),r&&(r.flags=1793),{videoTrack:t,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,r){var n,i=null==t||null===(n=t.samples)||void 0===n?void 0:n.length;return i?1024*i/t.timescale*e.timescale/r:1024}},{key:"moofToSamples",value:function(t,r,n){var i={};return t.mfhd&&(r&&(r.sequenceNumber=t.mfhd.sequenceNumber),n&&(n.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var a=t.tfhd,o=t.tfdt,s=t.trun;if(a&&s){o&&(r&&r.id===a.trackId&&(r.baseMediaDecodeTime=o.baseMediaDecodeTime),n&&n.id===a.trackId&&(n.baseMediaDecodeTime=o.baseMediaDecodeTime));var u=a.defaultSampleSize||0,c=a.defaultSampleDuration||e.evaluateDefaultDuration(r,n,s.samples.length||s.sampleCount),l=s.dataOffset||0,d=0,h=-1;if(!s.samples.length&&s.sampleCount){i[a.trackId]=[];for(var f=0;f<s.sampleCount;f++)i[a.trackId].push({offset:l,dts:d,duration:c,size:u}),d+=c,l+=u}else i[a.trackId]=s.samples.map((function(e,t){return(e={offset:l,dts:d,pts:d+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:h,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(h++,e.gopId=h),d+=e.duration,l+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var r=t.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),n=t.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(r||n){var i,a;if(r){var o,s,u=null===(o=r.mdia)||void 0===o||null===(s=o.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,l=u.stsc,d=u.stsz,h=u.stco,f=u.stss,p=u.ctts;if(!(c&&l&&d&&h&&f))return;i=getSamples$1(c,l,d,h,p,f)}if(n){var m,y,g,v=null===(m=n.mdia)||void 0===m||null===(y=m.minf)||void 0===y?void 0:y.stbl;if(!v)return;var b=null===(g=n.mdia.mdhd)||void 0===g?void 0:g.timescale,_=v.stts,A=v.stsc,T=v.stsz,E=v.stco;if(!(b&&_&&A&&T&&E))return;a=getSamples$1(_,A,T,E)}return{videoSamples:i,audioSamples:a}}}}}]),e}();function getSamples$1(e,t,r,n,i,a){var o,s,u,c=[],l=null==i?void 0:i.entries,d=t.entries,h=n.entries,f=r.entrySizes,p=null==a?void 0:a.entries;p&&(o={},p.forEach((function(e){o[e-1]=!0}))),l&&(s=[],l.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)s.push(r)})));var m=-1,y=0,g=0,v=0,b=0,_=0,A=d[0].samplesPerChunk,T=d[1]?d[1].firstChunk-1:1/0;return e.entries.forEach((function(e){for(var t=e.count,n=e.delta,i=0;i<t;i++)u={dts:y,duration:n,size:f[g]||r.sampleSize,offset:h[v]+_,index:g},p&&(u.keyframe=o[g],u.keyframe&&m++,u.gopId=m),s&&g<s.length&&(u.pts=u.dts+s[g]),c.push(u),y+=n,++g<A?_+=u.size:(v++,_=0,v>=T&&(b++,T=d[b+1]?d[b+1].firstChunk-1:1/0),A+=d[b].samplesPerChunk)})),c}function parseVisualSampleEntry$1(e,t){return e.dataReferenceIndex=readBig16$1(t,6),e.width=readBig16$1(t,24),e.height=readBig16$1(t,26),e.horizresolution=readBig32$1(t,28),e.vertresolution=readBig32$1(t,32),e.frameCount=readBig16$1(t,40),e.depth=readBig16$1(t,74),78}function parseAudioSampleEntry$1(e,t){return e.dataReferenceIndex=readBig16$1(t,6),e.channelCount=readBig16$1(t,16),e.sampleSize=readBig16$1(t,18),e.sampleRate=readBig32$1(t,24)/65536,28}function parseBox$1(e,t,r){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var n={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(n.version=e.data[e.headerSize],n.flags=readBig24$1(e.data,e.headerSize+1),n.headerSize+=4),r(n,e.data.subarray(n.headerSize),n.start+n.headerSize),n}}var padStart$1=function(e,t,r){for(var n=String(r),i=t>>0,a=Math.ceil(i/n.length),o=[],s=String(e);a--;)o.push(n);return o.join("").substring(0,i-s.length)+s},toHex$1=function(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e.push(padStart$1(Number(t).toString(16),2,0))})),e[0]},Buffer$3=function(){function e(){_classCallCheck$a(this,e),this.buffer=new Uint8Array(0)}return _createClass$a(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach((function(t){t?e.buffer=Concat$2(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),UINT32_MAX$2=Math.pow(2,32)-1,MP4$3=function(){function e(){_classCallCheck$a(this,e)}return _createClass$a(e,null,[{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=8+(r=r.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return r.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===TrackType$2.VIDEO&&e.codecType===VideoCodecType$2.HEVC}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return concatUint8Array$3(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var r=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],parse$2(t.kid),[0,0,0,0]));return e.box(e.types.pssh,r)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var r=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(_toConsumableArray$6(t.map((function(t){return e.trak(t)}))),[r]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(_toConsumableArray$6(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.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,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,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===TrackType$2.VIDEO?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var r=[];return t&&t.ext&&t.ext.stss&&r.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,r[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var r;return r="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r)}},{key:"enca",value:function(t){var r=t.enca.channelCount,n=t.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,n>>8&255,255&n,0,0]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var r,n,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=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,o>>8&255,255&o,s>>8&255,255&s,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]),d=new Uint8Array((r=(n=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(n,_toConsumableArray$6(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(r,_toConsumableArray$6(a))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),f=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,d),e.box(e.types.btrt,h),f,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var r=new Uint8Array([]),n=e.tenc(t);return e.box(e.types.schi,r,n)}},{key:"tenc",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(parse$2(t.default_KID)));return e.box(e.types.tenc,r)}},{key:"sinf",value:function(t){var r=new Uint8Array([]),n=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),a=e.schi(t);return e.box(e.types.sinf,r,e.box(e.types.frma,n),e.box(e.types.schm,i),a)}},{key:"avc1hev1",value:function(t){var r=t.codecType===VideoCodecType$2.HEVC,n=r?e.types.hvc1:e.types.avc1,i=r?e.hvcC(t):e.avcC(t),a=[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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,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,17,17]),i];return r?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[n].concat(a))}},{key:"avcC",value:function(t){var r,n,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,_toConsumableArray$6(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,_toConsumableArray$6(e))})),e.box(e.types.avcC,new Uint8Array((r=(n=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(n,a).concat([t.pps.length])).concat.apply(r,o)))}},{key:"hvcC",value:function(t){var r=t.hvcC;if(r instanceof ArrayBuffer||r instanceof Uint8Array)return r;var n,i=t.vps,a=t.sps,o=t.pps;if(r){var s=r.generalProfileCompatibilityFlags,u=r.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.length&&1);n=[1,r.generalProfileSpace<<6|r.generalTierFlag<<5|r.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],r.generalLevelIdc,240,0,252,252|r.chromaFormatIdc,248|r.bitDepthLumaMinus8,248|r.bitDepthChromaMinus8,0,0,r.numTemporalLayers<<3|r.temporalIdNested<<2|3,c];var l=function(e){var t;n.push(e.length>>8,e.length),(t=n).push.apply(t,_toConsumableArray$6(e))};i.length&&(n.push(160,0,i.length),i.forEach(l)),a.length&&(n.push(161,0,a.length),a.forEach(l)),o.length&&(n.push(162,0,o.length),o.forEach(l))}else n=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(n))}},{key:"pasp",value:function(t){var r=_slicedToArray$5(t,2),n=r[0],i=r[1];return e.box(e.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var r=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+r,0,0,0,4,15+r,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([r]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(_toConsumableArray$6(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.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]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(_toConsumableArray$6(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var r=e.tfhd(t.id),n=e.tfdt(t,t.baseMediaDecodeTime);if(t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(1===t.id){var i=e.saiz(t),a=e.saio(t),o=e.trun1(t),s=e.senc(t);return e.box(e.types.traf,r,n,i,a,o,s)}if(t.isAudioEncryption){var u=e.sbgp(),c=e.saiz(t),l=e.saio(t),d=e.senc(t),h=e.trun1(t);return e.box(e.types.traf,r,n,u,c,l,d,h)}var f=e.sbgp(),p=e.trun1(t);return e.box(e.types.traf,r,n,f,p)}if(1===t.id){var m=e.trun1(t);return e.box(e.types.traf,r,n,m)}var y=e.sbgp(),g=e.saiz(t),v=e.saio(t),b=e.senc(t),_=e.trun1(t);return e.box(e.types.traf,r,n,y,g,v,b,_)}var A=e.sdtp(t);return e.box(e.types.traf,r,n,A,e.trun(t.samples,A.byteLength+76))}},{key:"sdtp",value:function(t){var r=new Buffer$3;return t.samples.forEach((function(e){r.write(new Uint8Array(1===t.id?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),r.buffer)}},{key:"trun1",value:function(t){var r=new Buffer$3,n=Buffer$3.writeUint32(t.samples.length),i=null;if(1===t.id){var a=t.videoSencLength;i=Buffer$3.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=Buffer$3.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=Buffer$3.writeUint32(o)}return t.samples.forEach((function(e){r.write(Buffer$3.writeUint32(e.duration)),r.write(Buffer$3.writeUint32(e.size)),r.write(Buffer$3.writeUint32(e.keyframe?33554432:65536)),1===t.id&&r.write(Buffer$3.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),n,i,r.buffer)}},{key:"senc",value:function(t){var r=new Buffer$3,n=t.samples.length,i=1===t.id?16:8,a=1===t.id?2:0,o=[],s=0;return 1===t.id?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*n,r.write(Buffer$3.writeUint32(16+s),e.types.senc,this.extension(0,a)),r.write(Buffer$3.writeUint32(n)),o.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)r.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(r.write(Buffer$3.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){r.write(Buffer$3.writeUint16(e.BytesOfClearData)),r.write(Buffer$3.writeUint32(e.BytesOfProtectedData))})))})),r.buffer}},{key:"saio",value:function(t){var r=12*t.samples.length+141;2===t.id&&t.isAudioEncryption&&(r=149);var n=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saio,n)}},{key:"saiz",value:function(t){var r=t.samples.length,n=new Uint8Array([0,0,0,0,16,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saiz,n)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,r){var n=Math.floor(r/(UINT32_MAX$2+1)),i=Math.floor(r%(UINT32_MAX$2+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,r){var n=t.length,i=12+16*n;r+=8+i;var a=new Uint8Array(i);a.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var o=0;o<n;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;a.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|(null===d.dependsOn||void 0===d.dependsOn?1:d.dependsOn),d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|(null===d.isNonSyncSample||void 0===d.isNonSyncSample?1:d.isNonSyncSample),61440&d.degradationPriority,15&d.degradationPriority,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(_toConsumableArray$6(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===TrackType$2.VIDEO?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var r=t.ext,n=[e.stsd(t),e.stts(r.stts),e.stsc(r.stsc),e.stsz(r.stsz),e.stco(r.stco)];return r.stss.length&&n.push(e.stss(r.stss)),r.ctts.length&&n.push(e.ctts(r.ctts)),e.box.apply(e,[e.types.stbl].concat(n))}},{key:"stts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,concatUint8Array$3(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsc",value:function(t){var r=t.length,n=new Uint8Array(12*r),i=0;return t.forEach((function(e){var t=e.firstChunk,r=e.samplesPerChunk,a=e.sampleDescIndex;n.set([t>>24,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,concatUint8Array$3(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsz",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,concatUint8Array$3(new Uint8Array([0,0,0,0,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stco",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,concatUint8Array$3(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stss",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,concatUint8Array$3(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"ctts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,concatUint8Array$3(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var r=t.timescale,n=t.samples[0].duration,i=n*t.samples.length,a=t.samples[0].sampleOffset*n,o=8;t.samples.forEach((function(e){o+=e.size}));var s=0;if(1===t.id){var u,c=0;t.videoSenc&&(u=t.videoSenc),1===t.id&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,r>>24&255,r>>16&255,r>>8&255,255&r,a>>24&255,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();_defineProperty$9(MP4$3,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),_defineProperty$9(MP4$3,"HDLR_TYPES",{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]),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])}),_defineProperty$9(MP4$3,"FTYPAVC1",MP4$3.box(MP4$3.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),_defineProperty$9(MP4$3,"FTYPHEV1",MP4$3.box(MP4$3.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),_defineProperty$9(MP4$3,"DINF",MP4$3.box(MP4$3.types.dinf,MP4$3.box(MP4$3.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),_defineProperty$9(MP4$3,"VMHD",MP4$3.box(MP4$3.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),_defineProperty$9(MP4$3,"SMHD",MP4$3.box(MP4$3.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),_defineProperty$9(MP4$3,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),_defineProperty$9(MP4$3,"STTS",MP4$3.box(MP4$3.types.stts,MP4$3.StblTable)),_defineProperty$9(MP4$3,"STSC",MP4$3.box(MP4$3.types.stsc,MP4$3.StblTable)),_defineProperty$9(MP4$3,"STSZ",MP4$3.box(MP4$3.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),_defineProperty$9(MP4$3,"STCO",MP4$3.box(MP4$3.types.stco,MP4$3.StblTable));var Logger$6=function(){function e(t,r){_classCallCheck$a(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=r}return _createClass$a(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();_defineProperty$9(Logger$6,"disabled",!0);var FMP4Remuxer$2=function(){function e(t,r,n){_classCallCheck$a(this,e),this.videoTrack=t,this.audioTrack=r;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new Logger$6("FMP4Remuxer",!n||!n.openLog||!n.openLog)}return _createClass$a(e,[{key:"remux",value:function(){var e,t,r,n,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return a&&(o&&o.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),r=MP4$3.initSegment(d)):(c&&(e=MP4$3.initSegment([this.videoTrack])),l&&(t=MP4$3.initSegment([this.audioTrack])))),c&&s.hasSample()&&(n=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:r,videoInitSegment:e,audioInitSegment:t,videoSegment:n,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,r=0;t.forEach((function(e){r+=e.units.reduce((function(e,t){return e+t.byteLength}),0),r+=4*e.units.length}));for(var n,i=new Uint8Array(r),a=new DataView(i.buffer),o=function(e,r,o,s){s=t[e];var u=0;s.units.forEach((function(e){a.setUint32(o,e.byteLength),o+=4,i.set(e,o),o+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=o,n=s},s=0,u=t.length,c=0;s<u;s++)o(s,0,c,n);var l=MP4$3.mdat(i);return e.isVideoEncryption||e.isAudioEncryption?concatUint8Array$3(MP4$3.styp(),MP4$3.sidx(e),MP4$3.moof([e]),l):concatUint8Array$3(MP4$3.moof([e]),l)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,r){return t.set(r.data,e),e+r.size}),0);var r=MP4$3.mdat(t);return e.isVideoEncryption||e.isAudioEncryption?concatUint8Array$3(MP4$3.styp(),MP4$3.sidx(e),MP4$3.moof([e]),r):concatUint8Array$3(MP4$3.moof([e]),r)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),Crypto={decryptWordArray:function(e,t,r){var n=Hex.parse(t),i=Hex.parse(formatIV(r)),a=WordArray.create(new Uint8Array(e)),o=AES.decrypt(CipherParams.create({ciphertext:a}),n,{iv:i,mode:CTR,padding:NoPadding});return Crypto.wordArrayToUint8Array(o)},wordArrayToUint8Array:function(e){for(var t=e.sigBytes,r=e.words,n=new Uint8Array(t),i=0,a=0;i!==t;){var o=r[a++];if(n[i++]=(4278190080&o)>>>24,i===t)break;if(n[i++]=(16711680&o)>>>16,i===t)break;if(n[i++]=(65280&o)>>>8,i===t)break;n[i++]=255&o}return n}},NEW_ARRAY_MAX_CNT=20,MP4Demuxer=function(){function e(t,r,n,i){var a=this;_classCallCheck$a(this,e),_defineProperty$9(this,"_videoSamples",[]),_defineProperty$9(this,"_audioSamples",[]),_defineProperty$9(this,"_lastRemainBuffer",[]),_defineProperty$9(this,"_lastRemainBufferStartPos",0),this.videoTrack=new VideoTrack$1,this.audioTrack=new AudioTrack$1,this.metadataTrack=n||new MetadataTrack$1,this.log=new Logger$6("MP4Demuxer",!i||!i.openLog||!i.openLog),t&&t.forEach((function(e){var t;(t=a._videoSamples).push.apply(t,_toConsumableArray$6(e.frames))})),r&&r.forEach((function(e){var t;(t=a._audioSamples).push.apply(t,_toConsumableArray$6(e.frames))}))}return _createClass$a(e,[{key:"parseSamples",value:function(e){if(!e)throw new Error("moov is required");if(this.videoTrack.codec||this.audioTrack.codec||(MP4Parser$1.moovToTrack(e,this.videoTrack,this.audioTrack),this.videoSenc=this.videoTrack.videoSenc,this.audioSenc=this.audioTrack.audioSenc),!this._audioSamples.length&&!this._videoSamples.length){var t=MP4Parser$1.moovToSamples(e);if(!t)throw new Error("cannot parse samples from moov box");this._videoSamples=t.videoSamples||[],this._audioSamples=t.audioSamples||[]}}},{key:"demux",value:function(e,t,r,n,i){this.parseSamples(i);var a,o,s,u=this.videoTrack,c=this.audioTrack;if(u.samples=[],c.samples=[],r){for(var l,d=0,h=r[0],f=r[1];h<=f;h++){if(!(a=this._videoSamples[h]))throw new Error("cannot found video frame #".concat(h));s=a.offset-t,o=e.subarray(s,s+a.size),(l=new VideoSample$1(a.pts||a.dts,a.dts)).duration=a.duration,l.gopId=a.gopId,a.keyframe&&l.setToKeyframe();for(var p=0,m=o.length-1;p<m;)d=readBig32$1(o,p),p+=4,l.units.push(o.subarray(p,p+d)),p+=d;u.samples.push(l)}u.baseMediaDecodeTime=u.samples[0].dts}if(n){for(var y=n[0],g=n[1];y<=g;y++){if(!(a=this._audioSamples[y]))throw new Error("cannot found video frame #".concat(y));s=a.offset-t,o=e.subarray(s,s+a.size),c.samples.push(new AudioSample$1(a.dts,o,a.duration))}c.baseMediaDecodeTime=c.samples[0].dts}return{videoTrack:u,audioTrack:c,metadataTrack:this.metadataTrack}}},{key:"demuxPart",value:function(e,t,r,n,i,a,o){if(this.parseSamples(i),this.videoTrack.useEME=a,this.audioTrack.useEME=a,this._lastRemainBuffer&&this._lastRemainBuffer.byteLength>0&&t>this._lastRemainBufferStartPos&&t<=this._lastRemainBufferStartPos+this._lastRemainBuffer.byteLength)for(var s=0;s<NEW_ARRAY_MAX_CNT;)try{var u=this._lastRemainBuffer.subarray(0,t-this._lastRemainBufferStartPos),c=new Uint8Array(e.byteLength+u.byteLength);c.set(u,0),c.set(new Uint8Array(e),u.byteLength),e=c,t-=u.byteLength,this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0;break}catch(e){if(!(s<NEW_ARRAY_MAX_CNT))throw new Error("new Uint8Array error:,"+e.errorMessage);s++}var l,d,h,f=this.videoTrack,p=this.audioTrack;f.samples=[],p.samples=[],f.videoSenc=null,p.audioSenc=null;var m=0,y=0;if(this._videoSamples.length>0&&r.length>0){for(var g,v=e.byteLength+t,b=r[0];b<=r[1];b++){if(!(l=this._videoSamples[b]))throw new Error("cannot found video frame #".concat(b));l.offset>=t&&l.offset+l.size<=v&&(m=(h=l.offset-t)+l.size,d=e.subarray(h,m),(g=new VideoSample$1(l.pts||l.dts,l.dts)).duration=l.duration,g.gopId=l.gopId,g.sampleOffset=l.index,l.keyframe&&g.setToKeyframe(),g.data=d,g.size=l.size,f.samples.push(g))}f.samples.length>0&&(f.gopId=f.samples[0].gopId,f.baseMediaDecodeTime=f.samples[0].dts,f.startPts=f.samples[0].pts/f.timescale,f.endPts=f.samples[f.samples.length-1].pts/f.timescale,this.videoSenc&&(f.videoSenc=this.videoSenc.slice(f.samples[0].sampleOffset,f.samples[0].sampleOffset+f.samples.length),f.kidValue=o))}if(this._audioSamples.length>0&&n.length>0){for(var _=n[0];_<=n[1];_++){if(!(l=this._audioSamples[_]))throw new Error("cannot found video frame #".concat(_));l.offset>=t&&l.offset+l.size<=e.byteLength+t&&(y=(h=l.offset-t)+l.size,d=e.subarray(h,y),p.samples.push(new AudioSample$1(l.dts,d,l.duration,l.index)))}p.samples.length>0&&(p.gopId=p.samples[0].gopId||f.gopId,p.baseMediaDecodeTime=p.samples[0].dts,p.startPts=p.samples[0].pts/p.timescale,p.endPts=p.samples[p.samples.length-1].pts/p.timescale,this.audioSenc&&(p.audioSenc=this.audioSenc.slice(p.samples[0].sampleOffset,p.samples[0].sampleOffset+p.samples.length),p.kidValue=o))}this.decoderData(f,p);for(var A=0,T=0;T<f.samples.length;T++)for(var E=0,S=f.samples[T].data,$=S.length-1;E<$;)A=readBig32$1(S,E),E+=4,f.samples[T].units.push(S.subarray(E,E+A)),E+=A;return this._lastRemainBuffer=e.subarray(Math.max(m,y)),this._lastRemainBuffer.byteLength>0?this._lastRemainBufferStartPos=t+e.byteLength-this._lastRemainBuffer.byteLength:this._lastRemainBufferStartPos=0,{videoTrack:f,audioTrack:p,metadataTrack:this.metadataTrack}}},{key:"reset",value:function(){this._videoSamples=[],this._audioSamples=[],this._lastRemainBuffer=null,this._lastRemainBufferStartPos=0,this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}},{key:"decoderData",value:function(e,t){if(!e.useEME&&!t.useEME){if(e.videoSenc&&1===e.id){var r=e.kidValue,n=e.videoSenc;e.samples.forEach((function(t,i){var a=n[i],o=t.data,s=[],u=[],c=a.InitializationVector;if(a.subsamples&&a.subsamples.length)a.subsamples.forEach((function(e){var t=e.BytesOfClearData+e.BytesOfProtectedData,r=o.slice(0,t);s.push(r.slice(0,e.BytesOfClearData)),u.push(r.slice(e.BytesOfClearData)),o=o.slice(t)}));else{var l=t.size;s.push(o.slice(0,0)),u.push(o.slice(0,l)),o=o.slice(l)}var d=new Buffer$3;d.write.apply(d,u);var h=Crypto.decryptWordArray(d.buffer,r,c),f=new Buffer$3;s.forEach((function(e,t){var r=u[t].length,n=h.slice(0,r);f.write(e),f.write(n),h=h.slice(r)})),e.samples[i].data=f.buffer}))}if(t.audioSenc&&2===t.id){var i=t.kidValue,a=t.audioSenc;t.samples.forEach((function(e,r){var n=a[r],o=Crypto.decryptWordArray(e.data,i,n.InitializationVector);t.samples[r].data=o}))}}}}],[{key:"probe",value:function(e){return MP4Parser$1.probe(e)}}]),e}(),version="3.0.0-alpha.36-3",ERROR_CODES={416:-499899,401:-499898,403:-499897,404:-499896,timeout:-499895,"4xx":-499894,"5xx":-499893,networkError:-499892,contentError:-499891,mse:-499971,mseOpen:-499972,mseAppend:-499973,boxsError:-499980,moovError:-499981,notH264:-499982,mdatError:-499983,mdhdError:-499984,metaError:-499985,muxError:-499986,h265Error:-499987,noneURL:-499988,other:-499989,other1:-499990,waitTimeout:-499791,onWaitInBufferRange:-499792},ERROR_TYPES={network:1003,format:1005,runtime:1002,other:9999,demux:1006,remux:1007};function getErrorCodeByHttpCode(e){var t=0;switch(e){case 0:t=0;break;case-1:t=ERROR_CODES.networkError;break;case-2:t=ERROR_CODES.timeout;break;case-3:t=ERROR_CODES.contentError;break;default:t=e<500?ERROR_CODES[e]||e["4xx"]:ERROR_CODES[e]||e["5xx"]}return t}var NetWorkError=_createClass$d((function e(t,r,n){_classCallCheck$d(this,e);var i=0,a=0;n&&n.range&&n.range.length>1&&(i=n.range[0],a=n.range[1]);var o=getErrorCodeByHttpCode(r);return{errorCode:o,errorType:t,errorTypeCode:ERROR_TYPES[t],errorMessage:(null==n?void 0:n.httpText)||(null==n?void 0:n.message),url:null==n?void 0:n.url,httpCode:r,version:version,rangeStart:i,rangeEnd:a,ext:n,mediaError:{code:o,message:(null==n?void 0:n.httpText)||(null==n?void 0:n.message)}}})),ParserError=_createClass$d((function e(t,r,n){return _classCallCheck$d(this,e),{errorCode:r,errorType:t,errorTypeCode:ERROR_TYPES[t],version:version,errorMessage:n.msg,ext:n,mediaError:{code:r,message:n.msg}}})),$$p=_export,isArray2=isArray$6;$$p({target:"Array",stat:!0},{isArray:isArray2});var call$2=functionCall,fixRegExpWellKnownSymbolLogic=fixRegexpWellKnownSymbolLogic,anObject$2=anObject$m,isNullOrUndefined=isNullOrUndefined$9,toLength$1=toLength$b,toString$8=toString$l,requireObjectCoercible$1=requireObjectCoercible$b,getMethod=getMethod$6,advanceStringIndex=advanceStringIndex$3,regExpExec=regexpExecAbstract;fixRegExpWellKnownSymbolLogic("match",(function(e,t,r){return[function(t){var r=requireObjectCoercible$1(this),n=isNullOrUndefined(t)?void 0:getMethod(t,e);return n?call$2(n,t,r):new RegExp(t)[e](toString$8(r))},function(e){var n=anObject$2(this),i=toString$8(e),a=r(t,n,i);if(a.done)return a.value;if(!n.global)return regExpExec(n,i);var o=n.unicode;n.lastIndex=0;for(var s,u=[],c=0;null!==(s=regExpExec(n,i));){var l=toString$8(s[0]);u[c]=l,""===l&&(n.lastIndex=advanceStringIndex(i,toLength$1(n.lastIndex),o)),c++}return 0===c?null:u}]}));var util$1={};function ownKeys$5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$5(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$5(Object(r),!0).forEach((function(t){_defineProperty$8(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$5(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$6(){_regeneratorRuntime$6=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,d;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function asyncGeneratorStep$6(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator$6(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep$6(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep$6(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck$9(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$9(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$9(e,t,r){return t&&_defineProperties$9(e.prototype,t),r&&_defineProperties$9(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$8(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$8(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$8(e,t)}function _getPrototypeOf$8(e){return(_getPrototypeOf$8=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$8(e,t){return(_setPrototypeOf$8=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$8(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _objectWithoutPropertiesLoose$2(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}function _objectWithoutProperties$2(e,t){if(null==e)return{};var r,n,i=_objectWithoutPropertiesLoose$2(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _assertThisInitialized$8(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$8(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$8(e)}function _createSuper$8(e){var t=_isNativeReflectConstruct$8();return function(){var r,n=_getPrototypeOf$8(e);if(t){var i=_getPrototypeOf$8(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$8(this,r)}}function _slicedToArray$4(e,t){return _arrayWithHoles$4(e)||_iterableToArrayLimit$4(e,t)||_unsupportedIterableToArray$7(e,t)||_nonIterableRest$4()}function _toConsumableArray$5(e){return _arrayWithoutHoles$5(e)||_iterableToArray$5(e)||_unsupportedIterableToArray$7(e)||_nonIterableSpread$5()}function _arrayWithoutHoles$5(e){if(Array.isArray(e))return _arrayLikeToArray$7(e)}function _arrayWithHoles$4(e){if(Array.isArray(e))return e}function _iterableToArray$5(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit$4(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}function _unsupportedIterableToArray$7(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$7(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$7(e,t):void 0}}function _arrayLikeToArray$7(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread$5(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest$4(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ownKeys$4(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$4(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$4(Object(r),!0).forEach((function(t){_defineProperty$7(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$4(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$5(){_regeneratorRuntime$5=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,d;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function _typeof$4(e){return(_typeof$4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function asyncGeneratorStep$5(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator$5(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep$5(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep$5(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck$8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$8(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$8(e,t,r){return t&&_defineProperties$8(e.prototype,t),r&&_defineProperties$8(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$7(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$7(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$7(e,t)}function _getPrototypeOf$7(e){return(_getPrototypeOf$7=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$7(e,t){return(_setPrototypeOf$7=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$7(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _construct$2(e,t,r){return(_construct$2=_isNativeReflectConstruct$7()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&_setPrototypeOf$7(i,r.prototype),i}).apply(null,arguments)}function _isNativeFunction$2(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _wrapNativeSuper$2(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper$2=function(e){if(null===e||!_isNativeFunction$2(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct$2(e,arguments,_getPrototypeOf$7(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf$7(r,e)},_wrapNativeSuper$2(e)}function _objectWithoutPropertiesLoose$1(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}function _objectWithoutProperties$1(e,t){if(null==e)return{};var r,n,i=_objectWithoutPropertiesLoose$1(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _assertThisInitialized$7(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$7(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$7(e)}function _createSuper$7(e){var t=_isNativeReflectConstruct$7();return function(){var r,n=_getPrototypeOf$7(e);if(t){var i=_getPrototypeOf$7(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$7(this,r)}}function _superPropBase$2(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf$7(e)););return e}function _get$2(){return _get$2="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=_superPropBase$2(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},_get$2.apply(this,arguments)}function _unsupportedIterableToArray$6(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$6(e,t):void 0}}function _arrayLikeToArray$6(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _createForOfIteratorHelper$1(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray$6(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function createPublicPromise$2(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}function nowTime$2(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}util$1.findBox=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(e.type!==t){if(e&&e.subBox){var n=e.subBox.filter((function(e){return e.type===t}));n.length?n.forEach((function(e){return r.push(e)})):e.subBox.forEach((function(e){return util$1.findBox(e,t,r)}))}}else r.push(e);return(r=[].concat(r)).length>1?r:r[0]},util$1.padStart=function(e,t,r){for(var n=String(r),i=t>>0,a=Math.ceil(i/n.length),o=[],s=String(e);a--;)o.push(n);return o.join("").substring(0,i-s.length)+s},util$1.toHex=function(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e.push(util$1.padStart(Number(t).toString(16),2,0))})),e},util$1.sum=function(){for(var e=0,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e+=t})),e},util$1.StringToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return t},util$1.fromHex=function(e){for(var t=new Uint8Array(e.length/2),r=0;r<e.length;r+=2)t[r/2]=window.parseInt(e.substr(r,2),16);return t},util$1.fromCharCode=function(e){for(var t="",r=0;r<e.length;r+=16e3){var n=e.subarray(r,r+16e3);t+=String.fromCharCode.apply(null,n)}return t},util$1.ArrayBufferToString=function(e){for(var t="",r=new Uint8Array(e),n=0;n<r.length;n++)t+=String.fromCharCode(r[n]);return t},util$1.Base64ToHex=function(e){for(var t=window.atob(e.replace(/-/g,"+").replace(/_/g,"/")),r="",n=0;n<t.length;n++)r+=("0"+t.charCodeAt(n).toString(16)).substr(-2);return r},util$1.toBase64=function(e,t){var r=util$1.fromCharCode(e);t=void 0===t||t;var n=window.btoa(r).replace(/\+/g,"-").replace(/\//g,"_");return t?n:n.replace(/=*$/,"")},util$1.toUTF8=function(e){for(var t=encodeURIComponent(e),r=unescape(t),n=new Uint8Array(r.length),i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return n.buffer},util$1.bufferToString=function(e){return("0"+Number(e).toString(16)).slice(-2).toUpperCase()},util$1.strToBuf=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e[r]+e[r+1],16));return new Uint8Array(t)},util$1.formatIV=function(e){var t="";if(e.forEach((function(e){t+=util$1.bufferToString(e)})),t.length<=32)for(var r=32-t.length,n=0;n<r;n++)t+="0";return t},util$1.str2hex=function(e){if(""===e)return"";for(var t=[],r=0;r<e.length;r++)t.push(e.charCodeAt(r));return t},util$1.parse=function(e){if(!Array.isArray(e)){for(var t=[],r="",n=0;n<e.length;n++)n%2&&(r=e[n-1]+e[n],t.push(parseInt(r,16)),r="");return t}return e.map((function(e){return parseInt(e,16)}))},util$1.generateUniqueKey=function(e){var t=e.vid;e.start,e.end;var r=e.mediaType,n=e.definition;return e.preloadTime,r=r||"video",n=n||"0",t?"".concat(t,"#").concat(r,"#").concat(n,"#mp4"):null},util$1.validateFragment=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(e instanceof ArrayBuffer){try{if(2===t.length){var r=t[1]-t[0]+1;if(!(e.byteLength===r))return}}catch(e){return console.error(e),!1}return!0}return!1},util$1.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},util$1.getBufferSplits=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e5;if(t-e-r<r/2||!t)return[[e,t]];for(var n=[];e<t;){var i=e+r;(i>t||t-i<r/2)&&(i=t),n.push([e,i]),e=i+1}return n},util$1.nowTime=function(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}},util$1.extUrl=function(e,t){try{var r=e.indexOf("?");return r<0?Object.keys(t).map((function(r,n){e+=0===n?"?".concat(r,"=").concat(t[r]):"&".concat(r,"=").concat(t[r])})):Object.keys(t).map((function(n,i){r===e.length-1?e+="".concat(n,"=").concat(t[n]):e+="&".concat(n,"=").concat(t[n])})),e}catch(t){return e}},util$1.getFileSize=function(e,t){try{return e&&t?parseInt(t*e/8,10):0}catch(e){return 0}},util$1.hashVal=function(e){var t,r=0;if(0===e.length)return r;for(t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r},util$1.getFileSize=function(e,t){try{return e&&t?parseInt(t*e/8,10):0}catch(e){return 0}},util$1.concatData=function(e,t){var r=[],n=0;e&&r.push(e),t&&r.push(t),r.every((function(e){return e&&(n+=e.byteLength),!0}));var i=new Uint8Array(n),a=0;return r.every((function(e){return e&&(i.set(e,a),a+=e.byteLength),!0})),i},util$1.getFragRange=function(e,t,r){var n=e<t.length?t[e]:null,i=e<r.length?r[e]:null,a=0,o=0;return e===t.length-1&&(a=-1),e===r.length-1&&(o=-1),[Math.min((null==n?void 0:n.range[0])||1/0,(null==i?void 0:i.range[0])||1/0),Math.max((null==n?void 0:n.range[1])+a||0,(null==i?void 0:i.range[1])+o||0)]};var Logger$5=function(){function e(t){_classCallCheck$8(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return _createClass$8(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix,nowTime$2()].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix,nowTime$2()].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix,nowTime$2()].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix,nowTime$2()].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();_defineProperty$7(Logger$5,"disabled",!0);var LoaderType$1={FETCH:"fetch",XHR:"xhr"},ResponseType$1={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"},NetError$1=function(e){_inherits$7(r,_wrapNativeSuper$2(Error));var t=_createSuper$7(r);function r(e,n,i,a){var o;return _classCallCheck$8(this,r),_defineProperty$7(_assertThisInitialized$7(o=t.call(this,a)),"retryCount",0),_defineProperty$7(_assertThisInitialized$7(o),"isTimeout",!1),_defineProperty$7(_assertThisInitialized$7(o),"loaderType",LoaderType$1.FETCH),_defineProperty$7(_assertThisInitialized$7(o),"startTime",0),_defineProperty$7(_assertThisInitialized$7(o),"endTime",0),o.url=e,o.request=n,o.response=i,o}return _createClass$8(r)}(),toString$7=Object.prototype.toString;function isObject$5(e){return null!==e&&"object"===_typeof$4(e)}function isPlainObject$1(e){if("[object Object]"!==toString$7.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function isDate$1(e){return"[object Date]"===toString$7.call(e)}function getRangeValue$1(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function encode$1(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function setUrlParams$1(e,t){if(e){if(!t)return e;var r,n=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){return isDate$1(t)?t=t.toISOString():isObject$5(t)&&(t=JSON.stringify(t)),"".concat(encode$1(e),"=").concat(encode$1(t))})).join("&")})).filter(Boolean).join("&");if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}}function createResponse$1(e,t,r,n,i,a,o,s,u,c,l){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,option:{range:u,vid:c,index:s,contentLength:n,age:i,startTime:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:r}}function calculateSpeed$1(e,t){return Math.round(8*e*1e3/t/1024)}var EVENT$1={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",SPEED:"core.speed",HLS_MANIFEST_LOADED:"core.hlsmanifestloaded",HLS_LEVEL_LOADED:"core.hlslevelloaded",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT",REAL_TIME_SPEED:"real_time_speed"},CACHESIZE$1=2097152,FetchLoader$1=function(e){_inherits$7(n,EventEmitter$1);var t,r=_createSuper$7(n);function n(){var e;return _classCallCheck$8(this,n),_defineProperty$7(_assertThisInitialized$7(e=r.call(this)),"_abortController",null),_defineProperty$7(_assertThisInitialized$7(e),"_timeoutTimer",null),_defineProperty$7(_assertThisInitialized$7(e),"_reader",null),_defineProperty$7(_assertThisInitialized$7(e),"_response",null),_defineProperty$7(_assertThisInitialized$7(e),"_aborted",!1),_defineProperty$7(_assertThisInitialized$7(e),"_index",-1),_defineProperty$7(_assertThisInitialized$7(e),"_range",null),_defineProperty$7(_assertThisInitialized$7(e),"_receivedLength",0),_defineProperty$7(_assertThisInitialized$7(e),"_running",!1),_defineProperty$7(_assertThisInitialized$7(e),"_logger",null),_defineProperty$7(_assertThisInitialized$7(e),"_vid",""),_defineProperty$7(_assertThisInitialized$7(e),"_onProcessMinLen",0),_defineProperty$7(_assertThisInitialized$7(e),"_onCancel",null),_defineProperty$7(_assertThisInitialized$7(e),"_priOptions",null),e}return _createClass$8(n,[{key:"load",value:function(e){var t,r=this,n=e.url,i=e.vid,a=e.timeout,o=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,d=e.range,h=e.transformResponse,f=e.request,p=e.params,m=e.logger,y=e.method,g=e.headers,v=e.body,b=e.mode,_=e.credentials,A=e.cache,T=e.redirect,E=e.referrer,S=e.referrerPolicy,$=e.onProcessMinLen,I=e.priOptions;this._logger=m,this._aborted=!1,this._onProcessMinLen=$,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=d||[0,0],this._vid=i||n,this._priOptions=I||{};var w={method:y,headers:g,body:v,mode:b,credentials:_,cache:A,redirect:T,referrer:E,referrerPolicy:S,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},R=!1;clearTimeout(this._timeoutTimer),n=setUrlParams$1(n,p);var k=getRangeValue$1(d);k&&((g=f?f.headers:w.headers=w.headers||new Headers)instanceof Headers?g.append("Range",k):g.Range=k),a&&(this._timeoutTimer=setTimeout((function(){if(R=!0,r.cancel(),c){var e=new NetError$1(n,w,null,"timeout");e.isTimeout=!0,c(e,r._index)}}),a));var P=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",d),new Promise((function(e,t){fetch(f||n,f?void 0:w).then(function(){var i=_asyncToGenerator$5(_regeneratorRuntime$5().mark((function i(a){var c,l,f,p;return _regeneratorRuntime$5().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(r._timeoutTimer),r._response=a,!r._aborted&&r._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(a=h(a,n)||a),a.ok){i.next=7;break}throw new NetError$1(n,w,a,"bad network response");case 7:if(c=Date.now(),o!==ResponseType$1.TEXT){i.next=15;break}return i.next=11,a.text();case 11:l=i.sent,r._running=!1,i.next=37;break;case 15:if(o!==ResponseType$1.JSON){i.next=22;break}return i.next=18,a.json();case 18:l=i.sent,r._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return r.resolve=e,r.reject=t,r._loadChunk(a,s,P,c),i.abrupt("return");case 29:return i.next=31,a.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),r._running=!1,f=Date.now()-P,p=calculateSpeed$1(l.byteLength,f),r.emit(EVENT$1.REAL_TIME_SPEED,{speed:p});case 37:r._logger.debug("[fetch load end], index,",u,",range,",d),e(createResponse$1(l,!0,a,a.headers.get("Content-Length"),a.headers.get("age"),P,c,u,d,r._vid,r._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){clearTimeout(r._timeoutTimer),r._running=!1,r._aborted&&!R||((e=e instanceof NetError$1?e:new NetError$1(n,w,null,JSON.stringify(e))).startTime=P,e.endTime=Date.now(),e.isTimeout=R,t(e))}))}))}},{key:"cancel",value:(t=_asyncToGenerator$5(_regeneratorRuntime$5().mark((function e(){return _regeneratorRuntime$5().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14:if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel(this._index);case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,r,n){var i=this;if(!e.body||!e.body.getReader)return this._running=!1,void this.reject(NetError$1(e.url,"",e,"onProgress of bad response.body.getReader"));this._onProcessMinLen>0&&(this._cache=new Uint8Array(CACHESIZE$1),this._writeIdx=0);var a,o,s,u=this._reader=e.body.getReader(),c=function(){var l=_asyncToGenerator$5(_regeneratorRuntime$5().mark((function l(){var d,h,f,p,m,y;return _regeneratorRuntime$5().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:return o=Date.now(),l.prev=1,l.next=4,u.read();case 4:a=l.sent,s=Date.now(),l.next=13;break;case 8:return l.prev=8,l.t0=l.catch(1),s=Date.now(),i._aborted||(i._running=!1,i.reject(l.t0)),l.abrupt("return");case 13:if(d=i._range[0]+i._receivedLength,!i._aborted){l.next=18;break}return i._running=!1,t(void 0,!1,{range:[d,d],vid:i._vid,index:i._index,startTime:o,endTime:s,priOptions:i._priOptions},e),l.abrupt("return");case 18:h=a.value?a.value.byteLength:0,i._receivedLength+=h,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",d,", end,",i._range[0]+i._receivedLength,", done,",a.done),i._onProcessMinLen>0?i._writeIdx+h>=i._onProcessMinLen||a.done?((f=new Uint8Array(i._writeIdx+h)).set(i._cache.slice(0,i._writeIdx),0),h>0&&f.set(a.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",a.done,",len,",f.byteLength,", writeIdx,",i._writeIdx)):h>0&&i._writeIdx+h<CACHESIZE$1?(i._cache.set(a.value,i._writeIdx),i._writeIdx+=h,i._logger.debug("【fetchLoader,onProgress cache】,len,",h,", writeIdx,",i._writeIdx)):h>0&&(p=new Uint8Array(i._writeIdx+h+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+h+2048,", datalen,",h,", writeIdx,",i._writeIdx),p.set(i._cache.slice(0,i._writeIdx),0),h>0&&p.set(a.value,i._writeIdx),i._writeIdx+=h,delete i._cache,i._cache=p,i._logger.debug("【fetchLoader,onProgress extra end】,len,",h,", writeIdx,",i._writeIdx)):f=a.value,(f&&f.byteLength>0||a.done)&&t(f,a.done,{range:[i._range[0]+i._receivedLength-(f?f.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:o,endTime:s,priOptions:i._priOptions},e),m=Date.now()-r,y=calculateSpeed$1(i._receivedLength,m),i.emit(EVENT$1.REAL_TIME_SPEED,{speed:y}),a.done?(i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",a.done),i.resolve(createResponse$1(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),o,n,i._index,i._range,i._vid,i._priOptions))):c();case 27:case"end":return l.stop()}}),l,null,[[1,8]])})));return function(){return l.apply(this,arguments)}}();c()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),n}();function getConfig$3(e){return _objectSpread2$4({loaderType:LoaderType$1.FETCH,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:ResponseType$1.TEXT,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)}var XhrLoader$1=function(e){_inherits$7(r,EventEmitter$1);var t=_createSuper$7(r);function r(){var e;return _classCallCheck$8(this,r),_defineProperty$7(_assertThisInitialized$7(e=t.call(this)),"_xhr",null),_defineProperty$7(_assertThisInitialized$7(e),"_aborted",!1),_defineProperty$7(_assertThisInitialized$7(e),"_timeoutTimer",null),_defineProperty$7(_assertThisInitialized$7(e),"_range",null),_defineProperty$7(_assertThisInitialized$7(e),"_receivedLength",0),_defineProperty$7(_assertThisInitialized$7(e),"_url",null),_defineProperty$7(_assertThisInitialized$7(e),"_onProgress",null),_defineProperty$7(_assertThisInitialized$7(e),"_index",-1),_defineProperty$7(_assertThisInitialized$7(e),"_headers",null),_defineProperty$7(_assertThisInitialized$7(e),"_currentChunkSizeKB",384),_defineProperty$7(_assertThisInitialized$7(e),"_timeout",null),_defineProperty$7(_assertThisInitialized$7(e),"_xhr",null),_defineProperty$7(_assertThisInitialized$7(e),"_withCredentials",null),_defineProperty$7(_assertThisInitialized$7(e),"_startTime",-1),_defineProperty$7(_assertThisInitialized$7(e),"_loadCompleteResolve",null),_defineProperty$7(_assertThisInitialized$7(e),"_loadCompleteReject",null),_defineProperty$7(_assertThisInitialized$7(e),"_runing",!1),_defineProperty$7(_assertThisInitialized$7(e),"_logger",!1),_defineProperty$7(_assertThisInitialized$7(e),"_vid",""),_defineProperty$7(_assertThisInitialized$7(e),"_responseType",void 0),_defineProperty$7(_assertThisInitialized$7(e),"_credentials",void 0),_defineProperty$7(_assertThisInitialized$7(e),"_method",void 0),_defineProperty$7(_assertThisInitialized$7(e),"_transformResponse",void 0),_defineProperty$7(_assertThisInitialized$7(e),"_firstRtt",void 0),_defineProperty$7(_assertThisInitialized$7(e),"_subRangeStartTime",void 0),_defineProperty$7(_assertThisInitialized$7(e),"_onCancel",null),_defineProperty$7(_assertThisInitialized$7(e),"_priOptions",null),e}return _createClass$8(r,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,this._range=e.range||[0,0],this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,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._credentials=e.credentials,this._priOptions=e.priOptions||{},this._logger.debug("【xhrLoader task】, range",this._range),this._url=setUrlParams$1(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof NetError$1?e:new NetError$1(t._url,t._request)).startTime=r,e.endTime=Date.now(),e}))}},{key:"_startLoad",value:function(){var e=null;if(this._range&&this._range.length>1)if(this._onProgress){this._subRangeStartTime=Date.now(),this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._credentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){t._running=!1;var r=new NetError$1(t._url,t._request,{status:0},"onerror");t._loadCompleteReject(r)},r.ontimeout=function(e){t.cancel();var r=new NetError$1(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,t._index)),t._loadCompleteReject(r)};var n=getRangeValue$1(e),i=null;n&&((i=this._headers||{}).Range=n),i&&Object.keys(i).forEach((function(e){r.setRequestHeader(e,i[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send()}catch(e){this._loadCompleteReject(e)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t=e.target.status;if(t<200||t>299)return this._loadCompleteReject(new NetError$1(this._url,null,_objectSpread2$4(_objectSpread2$4({},e.target.response),{},{status:t}),"bad response,status:"+t));var r,n=null,i=!1;if(this._responseType===ResponseType$1.ARRAY_BUFFER){var a=new Uint8Array(e.target.response);if(r=this._range[0]+this._receivedLength,a&&a.byteLength>0){this._receivedLength+=a.byteLength;var o=Date.now()-this._subRangeStartTime,s=calculateSpeed$1(this._receivedLength,o);this.emit(EVENT$1.REAL_TIME_SPEED,{speed:s})}n=a,i=!(this._range.length>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",r,"end ",this._range[0]+this._receivedLength,",dataLen,",a?a.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",i)}else i=!0,n=e.target.response;var u={ok:t>=200&&t<300,status:t,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(u=this._transformResponse(u,this._url)||u),this._onProgress&&this._onProgress(n,i,{index:this._index,vid:this._vid,range:[r,this._range[0]+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},u),i?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(createResponse$1(this._onProgress?null:n,i,u,u.headers["content-length"],u.headers.age,this._startTime,-1,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,_get$2(_getPrototypeOf$7(r.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel(this._index),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r={},n=_createForOfIteratorHelper$1(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(e){n.e(e)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),r}(),_excluded$2=["retry","retryDelay","onRetryError","transformError"],Task$1=function(){function e(t,r){_classCallCheck$8(this,e),this.promise=createPublicPromise$2(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new Logger$5("Loader")),this._loaderType=t,this._loader=t===LoaderType$1.FETCH?new FetchLoader$1:new XhrLoader$1,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._logger=r.logger}var t;return _createClass$8(e,[{key:"exec",value:function(){var e=this,t=this._config,r=t.retry,n=t.retryDelay,i=t.onRetryError,a=t.transformError,o=_objectWithoutProperties$1(t,_excluded$2),s=function(){var t=_asyncToGenerator$5(_regeneratorRuntime$5().mark((function t(){var u,c;return _regeneratorRuntime$5().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(o);case 3:u=t.sent,e.promise.resolve(u),t.next=28;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(!(t.t0.response&&t.t0.response.status>=400&&t.t0.response.status<=599)){t.next=16;break}return e.promise.reject(t.t0),t.abrupt("return");case 16:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,a&&(c=a(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,r),e._retryCount++,!(e._retryCount<=r)){t.next=27;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",o.range),e._retryTimer=setTimeout(s,n),t.abrupt("return");case 27:e.promise.reject(c);case 28:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=_asyncToGenerator$5(_regeneratorRuntime$5().mark((function e(){return _regeneratorRuntime$5().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function concatUint8Array$2(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if((t=t.filter(Boolean)).length<2)return t[0];var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}function sleep$1(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var NetLoader$1=function(e){_inherits$7(n,EventEmitter$1);var t,r=_createSuper$7(n);function n(e){var t;return _classCallCheck$8(this,n),_defineProperty$7(_assertThisInitialized$7(t=r.call(this,e)),"type",LoaderType$1.FETCH),_defineProperty$7(_assertThisInitialized$7(t),"_queue",[]),_defineProperty$7(_assertThisInitialized$7(t),"_alive",[]),_defineProperty$7(_assertThisInitialized$7(t),"_currentTask",null),_defineProperty$7(_assertThisInitialized$7(t),"_config",void 0),t._config=getConfig$3(e),t._config.loaderType!==LoaderType$1.XHR&&FetchLoader$1.isSupported()||(t.type=LoaderType$1.XHR),t.log=e.logger,t}return _createClass$8(n,[{key:"isFetch",value:function(){return this.type===LoaderType$1.FETCH}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&isPlainObject$1(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&isPlainObject$1(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new Task$1(this.type,r);return n.loader.on(EVENT$1.REAL_TIME_SPEED,(function(e){t.emit(EVENT$1.REAL_TIME_SPEED,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(t=_asyncToGenerator$5(_regeneratorRuntime$5().mark((function e(){var t;return _regeneratorRuntime$5().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,sleep$1();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;this._currentTask=this._queue.shift(),this._currentTask&&(this._currentTask.alive&&this._alive.push(this._currentTask),this._currentTask.exec().catch((function(e){})).finally((function(){e._processTask()})))}}],[{key:"isFetchSupport",value:function(){return FetchLoader$1.isSupported()}}]),n}();function getConfig$2(e){return _objectSpread2$5({vid:"",moovEnd:8e4,segmentDuration:2,maxDownloadInfoSize:30,responseType:"arraybuffer",cache:null},e)}var MediaError=_createClass$9((function e(t,r){_classCallCheck$9(this,e),this.type="file",this.message=t,this.data=r})),Cache=function(){function e(){_classCallCheck$9(this,e),_defineProperty$8(this,"_data",Object.create(null))}return _createClass$9(e,[{key:"set",value:function(e,t){this._data[e]=t}},{key:"get",value:function(e){return this._data[e]}},{key:"clear",value:function(){this._data=Object.create(null)}}]),e}();function moovToSegments(e,t){var r=e.trak;if(r&&r.length){var n=r.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),i=r.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(n||i){var a,o=[],s=[];if(n){var u,c,l,d=null===(u=n.mdia)||void 0===u||null===(c=u.minf)||void 0===c?void 0:c.stbl;if(!d)return;var h=null===(l=n.mdia.mdhd)||void 0===l?void 0:l.timescale,f=d.stts,p=d.stsc,m=d.stsz,y=d.stco,g=d.stss,v=d.ctts;if(!(h&&f&&p&&m&&y&&g))return;a=(o=getSegments(t,h,f,p,m,y,g,v)).map((function(e){return e.duration}))}if(i){var b,_,A,T=null===(b=i.mdia)||void 0===b||null===(_=b.minf)||void 0===_?void 0:_.stbl;if(!T)return;var E=null===(A=i.mdia.mdhd)||void 0===A?void 0:A.timescale,S=T.stts,$=T.stsc,I=T.stsz,w=T.stco;if(!(E&&S&&$&&I&&w))return;s=getSegments(t,E,S,$,I,w,null,null,a)}return{videoSegments:o,audioSegments:s}}}}function getSegments(e,t,r,n,i,a,o,s,u){var c,l,d,h,f=[],p=[],m=[],y=n.entries,g=a.entries,v=i.entrySizes,b=null==o?void 0:o.entries,_=null==s?void 0:s.entries;_&&(c=[],_.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)c.push(r)}))),b&&(l={},b.forEach((function(e){l[e-1]=!0})));var A=0,T=0,E=0,S=0,$=0,I=y[0].samplesPerChunk,w=y[1]?y[1].firstChunk-1:1/0,R=0,k=-1;r.entries.forEach((function(e){var t=e.count,r=e.delta;h=r;for(var n=0;n<t;n++)d={dts:R,startTime:A,duration:h,size:v[T]||i.sampleSize,offset:g[E]+$,index:T},b&&(d.keyframe=l[T],d.keyframe?(k++,p.push([d]),m.push(d.duration)):(p[p.length-1].push(d),m[p.length-1]+=d.duration),d.gopId=k),c&&T<c.length&&(d.pts=R+c[T]),0===T&&(d.pts=0),f.push(d),A+=h,R+=r,++T<I?$+=d.size:(E++,$=0,E>=w&&(S++,w=y[S+1]?y[S+1].firstChunk-1:1/0),I+=y[S].samplesPerChunk)}));var P=f.length;if(P&&(!o||f[0].keyframe)){var C,x=[],L=[],O=0,D=function(e){var r;C=L[L.length-1],x.push({index:x.length,startTime:(null===(r=x[x.length-1])||void 0===r?void 0:r.endTime)||L[0].startTime/t,endTime:(C.startTime+C.duration)/t,duration:e,range:[L[0].offset,C.offset+C.size],frames:L}),O=0,L=[]};if(o)for(var M=e*t,Z=0,V=p.length;Z<V;Z++){var N;O+=m[Z],(N=L).push.apply(N,_toConsumableArray$5(p[Z])),Z+1<V?(0===Z||O>M)&&D(O/t):D(O/t)}else for(var G=(u=u||[])[0]||e,X=0;X<P;X++)L.push(f[X]),O+=f[X].duration,(X+1>=P||O/t>=G)&&(D(O/t),G=u[x.length]||e);return x}}function moovToMeta(e){var t="",r="",n=0,i=0,a=0,o=0,s=0,u=0,c=0;e.mvhd&&(s=e.mvhd.duration/e.mvhd.timescale);var l=e.trak;if(l){var d,h,f,p,m,y,g,v,b,_,A,T,E,S,$,I,w,R=l.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),k=l.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),P=null;if(R)if(P=null===(h=R.mdia)||void 0===h||null===(f=h.minf)||void 0===f||null===(p=f.stbl)||void 0===p?void 0:p.stsd.entries[0])if(n=P.width,i=P.height,u=null===(m=R.mdia)||void 0===m||null===(y=m.mdhd)||void 0===y?void 0:y.timescale,t=null===(g=P.avcC||P.hvcC)||void 0===g?void 0:g.codec,"encv"===P.type)d=null===(v=P.sinf)||void 0===v||null===(b=v.schi)||void 0===b?void 0:b.tenc.default_KID;if(k)if(P=null===(_=k.mdia)||void 0===_||null===(A=_.minf)||void 0===A||null===(T=A.stbl)||void 0===T?void 0:T.stsd.entries[0])if(a=P.channelCount,o=P.sampleRate,r=null===(E=P.esds)||void 0===E?void 0:E.codec,c=null===(S=k.mdia)||void 0===S||null===($=S.mdhd)||void 0===$?void 0:$.timescale,"enca"===P.type)d=d||(null===(I=P.sinf)||void 0===I||null===(w=I.schi)||void 0===w?void 0:w.tenc.default_KID);return{kid:d?d.join(""):null,videoCodec:t,audioCodec:r,width:n,height:i,videoTimescale:u,audioChannelCount:a,audioSampleRate:o,duration:s,audioTimescale:c,moov:e}}}function isNumber(e){return"number"==typeof e&&!Number.isNaN(e)}var _excluded$1=["vid","cache"],MP4Loader=function(e){_inherits$8(f,EventEmitter$1);var t,r,n,i,a,o,s,u,c,l,d,h=_createSuper$8(f);function f(e){var t;_classCallCheck$9(this,f),_defineProperty$8(_assertThisInitialized$8(t=h.call(this)),"vid",""),_defineProperty$8(_assertThisInitialized$8(t),"url",""),_defineProperty$8(_assertThisInitialized$8(t),"meta",{}),_defineProperty$8(_assertThisInitialized$8(t),"downloadInfo",[]),_defineProperty$8(_assertThisInitialized$8(t),"videoSegments",[]),_defineProperty$8(_assertThisInitialized$8(t),"audioSegments",[]),_defineProperty$8(_assertThisInitialized$8(t),"cache",null),_defineProperty$8(_assertThisInitialized$8(t),"_currentSegmentIndex",-1),_defineProperty$8(_assertThisInitialized$8(t),"_currentLoadingSegmentIndex",-1),_defineProperty$8(_assertThisInitialized$8(t),"buffer",void 0),_defineProperty$8(_assertThisInitialized$8(t),"_error",void 0),_defineProperty$8(_assertThisInitialized$8(t),"_transformError",(function(e){return e})),t._config=getConfig$2(e);var r=t._config,n=r.vid,i=r.cache,a=_objectWithoutProperties$2(r,_excluded$1);return t.cache=i||new Cache,t.vid=n||a.url,t.url=a.url,a.transformError=t._transformError,t.logger=new Logger$5("MP4Loader_"+t.vid),e.openLog&&Logger$5.enable(),a.logger=t.logger,t._loader=new NetLoader$1(a),t._loader.on(EVENT$1.REAL_TIME_SPEED,(function(e){t.emit(EVENT$1.REAL_TIME_SPEED,e)})),t}return _createClass$9(f,[{key:"isMetaLoaded",get:function(){return this.videoSegments.length||this.audioSegments.length}},{key:"setCurrentSegment",value:function(e){isNumber(e)&&(this._currentSegmentIndex=e)}},{key:"isLastSegment",value:function(e){var t,r;return!!isNumber(e)&&e===((null===(t=this.videoSegments[this.videoSegments.length-1])||void 0===t?void 0:t.index)||(null===(r=this.audioSegments[this.audioSegments.length-1])||void 0===r?void 0:r.index)||0)}},{key:"isSegmentLoading",value:function(e){return e===this._currentLoadingSegmentIndex}},{key:"changeUrl",value:(d=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t){var r,n,i,a=arguments;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:t,n=a.length>2?a[2]:void 0,i=a.length>3?a[3]:void 0,e.next=5,this.reset(i);case 5:t&&(this.url=t),r&&(this.vid=r),n&&(this._config.moovEnd=n);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"getOrLoadMeta",value:(l=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t){return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(t);case 3:return e.abrupt("return",this.meta);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"loadMetaProcess",value:(c=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t,r,n,i){var a,o,s,u,c=this;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=_slicedToArray$4(r,2),o=a[0],s=a[1],this._error=!1,this.logger.debug("[loadMetaProcess start], range,",[o,s]),u=function(){var e=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(r,a,u){var l,d,h,f,p,m,y,g;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c.meta&&null!=u&&u.range&&u.range.length>0&&u.range[1]>=s&&(a=!0,c.logger.debug("[loadMetaProcess],data done,setstate true,[",o,s,"]")),a&&null!=u&&u.range&&u.range.length>0&&u.range[1]<s&&(a=!1,c.logger.debug("[loadMetaProcess],data not done,setstate false,[",o,s,"]")),c.logger.debug("[loadMetaProcess],task,[",o,s,"], range,",u.range,",dataLen,",r?r.byteLength:void 0,", state,",a,",err,",c._error),!c._error&&r&&r.byteLength>0&&n(r,a,u),!c.meta.moov&&!c._error){e.next=6;break}return e.abrupt("return");case 6:if(!(r&&r.byteLength>0)){e.next=44;break}if(c.buffer=concatUint8Array$2(c.buffer,r),l=MP4Parser$1.findBox(c.buffer,["moov"])[0]){e.next=23;break}if(d=MP4Parser$1.findBox(c.buffer,["mdat"])[0],!a){e.next=23;break}if(d){e.next=18;break}return c._error=!0,n(null,a,u,{err:"cannot find moov or mdat box"}),e.abrupt("return");case 18:return h=d.start+d.size,e.next=21,c.loadData([h,""],t,i);case 21:(f=e.sent)&&(l=MP4Parser$1.findBox(f.data,["moov"])[0]);case 23:if(!(l&&a&&l.size>l.data.length)){e.next=27;break}return c.logger.debug("[loadMetaProcess],moov not all, range,",u.range[1],",dataLen,",c.buffer.byteLength,", state,",a),e.next=27,c.loadMetaProcess(t,[u.range[1],l.start+l.size-1],n);case 27:if(!(l&&l.size<=l.data.length)||c.meta.moov){e.next=44;break}if(p=MP4Parser$1.moov(l)){e.next=33;break}return c._error=!0,n(null,a,u,{err:"cannot parse moov box"}),e.abrupt("return");case 33:if(m=moovToSegments(p,c._config.segmentDuration)){e.next=38;break}return c._error=!0,n(null,a,u,{err:"cannot parse segments"}),e.abrupt("return");case 38:c.meta=moovToMeta(p),y=m.videoSegments,g=m.audioSegments,c.videoSegments=y,c.audioSegments=g,c.logger.debug("[loadMetaProcess] moov ok"),n(void 0,a,{meta:{meta:c.meta,videoSegments:y,audioSegments:g}});case 44:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),e.next=6,this.loadData([o,s||this._config.moovEnd],t,_objectSpread2$5({onProgress:u},i));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return c.apply(this,arguments)})},{key:"loadMeta",value:(u=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t,r,n){var i,a,o,s,u,c,l,d,h;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[],this.logger.debug("[loadMeta start]"),e.next=4,this.loadData([0,r||this._config.moovEnd],t,n);case 4:if(a=e.sent){e.next=7;break}return e.abrupt("return");case 7:if(i.push(a),o=MP4Parser$1.findBox(a.data,["moov"])[0]){e.next=23;break}if(s=MP4Parser$1.findBox(a.data,["mdat"])[0]){e.next=13;break}throw new MediaError("cannot find moov or mdat box",a.data);case 13:return u=s.start+s.size,e.next=16,this.loadData([u],t,n);case 16:if(a=e.sent){e.next=19;break}return e.abrupt("return");case 19:if(i.push(a),o=MP4Parser$1.findBox(a.data,["moov"],u)[0]){e.next=23;break}throw new MediaError("cannot find moov box",a.data);case 23:if(!(o.size>o.data.length)){e.next=31;break}return e.next=26,this.loadData([a.data.length,o.start+o.size-1],t,n);case 26:if(a=e.sent){e.next=29;break}return e.abrupt("return");case 29:i.push(a),o.data=concatUint8Array$2(o.data,a.data);case 31:if(c=MP4Parser$1.moov(o)){e.next=34;break}throw new MediaError("cannot parse moov box",o.data);case 34:if(l=moovToSegments(c,this._config.segmentDuration)){e.next=37;break}throw new MediaError("cannot parse segments",o.data);case 37:return this.meta=moovToMeta(c),d=l.videoSegments,h=l.audioSegments,this.videoSegments=d,this.audioSegments=h,this.logger.debug("[load moov end!!!!!]"),e.abrupt("return",{meta:this.meta,videoSegments:d,audioSegments:h,responses:i});case 43:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"getSegmentByTime",value:function(e){var t,r;return this.videoSegments.length?(t=this.videoSegments.find((function(t){return t.startTime<=e&&t.endTime>e})))&&(r=this.audioSegments[t.index]):r=this.audioSegments.find((function(t){return t.startTime<=e&&t.endTime>e})),{video:t,audio:r}}},{key:"loadSegmentByTime",value:(s=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t,r){var n,i,a,o,s,u=arguments;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(u.length>2&&void 0!==u[2])||u[2],i=u.length>3&&void 0!==u[3]?u[3]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta(r);case 5:return a=this.getSegmentByTime(t),o=a.video,s=a.audio,e.abrupt("return",this._loadSegment(o,s,r,n,i));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"loadNextSegment",value:(o=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t){var r,n,i,a,o=arguments;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(o.length>1&&void 0!==o[1])||o[1],n=o.length>2&&void 0!==o[2]?o[2]:{},this.isMetaLoaded){e.next=5;break}return e.next=5,this.loadMeta();case 5:return i=this.videoSegments[this._currentSegmentIndex+1],a=this.audioSegments[this._currentSegmentIndex+1],e.abrupt("return",this._loadSegment(i,a,t,r,n));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"preload",value:(a=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t){var r,n,i,a,o,s,u,c=this;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMetaLoaded){e.next=3;break}return e.next=3,this.loadMeta(!0);case 3:if(t&&!(t<0)){e.next=5;break}return e.abrupt("return");case 5:if(r=this.getSegmentByTime(t),n=r.video,i=r.audio,a=Math.max((null==n?void 0:n.index)||0,(null==i?void 0:i.index)||0)){e.next=9;break}return e.abrupt("return");case 9:return o=this.videoSegments.slice(0,a),s=this.audioSegments.slice(0,a),u=function(){var e=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t){return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t>a)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,c._loadSegment(o[t],s[t],!0,!1);case 4:return e.next=6,u(t+1);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=14,u(0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"cancel",value:function(){return this._loader.cancel()}},{key:"reset",value:(i=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(){var t=arguments;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length>0&&void 0!==t[0]&&t[0]){e.next=5;break}return this.logger.debug("[MP4loader reset func call loader.cancel]"),e.next=5,this._loader.cancel();case 5:this.vid=this.url="",this.meta={},this.downloadInfo=[],this.videoSegments=[],this.audioSegments=[],this._currentSegmentIndex=-1,this._currentLoadingSegmentIndex=-1;case 12:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"destroy",value:(n=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(){return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.reset();case 2:this.cache.clear();case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_loadSegment",value:(r=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t,r,n,i,a){var o,s;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||r){e.next=2;break}return e.abrupt("return");case 2:return o=(null==t?void 0:t.index)||(null==r?void 0:r.index)||0,this._currentLoadingSegmentIndex=o,e.prev=4,e.next=7,this.loadData([Math.min((null==t?void 0:t.range[0])||1/0,(null==r?void 0:r.range[0])||1/0),Math.max((null==t?void 0:t.range[1])||0,(null==r?void 0:r.range[1])||0)],n,a);case 7:s=e.sent;case 8:return e.prev=8,this._currentLoadingSegmentIndex=-1,e.finish(8);case 11:if(s){e.next=13;break}return e.abrupt("return");case 13:return i&&(this._currentSegmentIndex=o),s.video=t,s.audio=r,e.abrupt("return",s);case 17:case"end":return e.stop()}}),e,this,[[4,,8,11]])}))),function(e,t,n,i,a){return r.apply(this,arguments)})},{key:"loadData",value:(t=_asyncToGenerator$6(_regeneratorRuntime$6().mark((function e(t,r,n){var i,a,o;return _regeneratorRuntime$6().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._getCacheKey(t),e.next=3,this.cache.get(i);case 3:if(a=e.sent){e.next=10;break}return e.next=7,this._loader.load(this.url,_objectSpread2$5({range:t,vid:this.vid},n));case 7:o=e.sent,e.next=11;break;case 10:o={data:a,state:!0,options:{fromCache:!0,range:t,vid:this.vid}};case 11:if(o){e.next=13;break}return e.abrupt("return");case 13:return a||(o.data&&this.downloadInfo.push({startTime:o.startTime,endTime:o.endTime,size:o.data.byteLength,range:t}),this.downloadInfo&&this.downloadInfo.length>this._config.maxDownloadInfoSize&&(this.downloadInfo=this.downloadInfo.slice(-this._config.maxDownloadInfoSize))),e.abrupt("return",o);case 16:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"_getCacheKey",value:function(e){return(this.vid||this.url)+":"+e}}]),f}(),isSupport=_isLocalStorageUsable(),openLog=checkOpenLog();function probeSupport(){try{return"undefined"!=typeof localStorage&&"setItem"in window.localStorage&&!!window.localStorage.setItem}catch(e){return!1}}function checkIfLocalStorageThrows(){var e="_localstorage_support_test";try{return window.localStorage.setItem(e,!0),window.localStorage.removeItem(e),!1}catch(e){return!0}}function checkOpenLog(){if(isSupport)try{return!!window.localStorage.getItem("playerlog")}catch(e){return!1}return!1}function _isLocalStorageUsable(){return probeSupport()&&!checkIfLocalStorageThrows()}function log$2(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];openLog&&console.log&&(t=console).log.apply(t,["[logger]",util$1.nowTime(),e].concat(n))}var MONITOR_HEADERS={"x-cache":"x_cache","x-response-sinfo":"server_ip","x-response-cinfo":"x-response-cinfo"};function transformHeaders(e){var t={};return Object.keys(MONITOR_HEADERS).forEach((function(r){var n=MONITOR_HEADERS[r];e&&e.get&&e.get(r)&&(t[n]=e.get(r))})),t}var metaSizeConfig=[{range:[0,90],size:614400},{range:[90,120],size:1228800},{range:[120,Number.MAX_VALUE],size:2048e3}];function getMetaSize(e,t,r){var n=r>51200?Math.min(r,t):t;if(!e)return n;for(var i=0;i<metaSizeConfig.length;i++)if(e>=metaSizeConfig[i].range[0]&&e<metaSizeConfig[i].range[1]){n=Math.min(Math.max(n,metaSizeConfig[i].size),r>0?r:t);break}return n}var encodedJs$4="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHQodCxlKXt2YXIgcj1PY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W9UcmFjay5lbmRQdHMpfSxpbml0U2VnOnMuaW5pdFNlZ21lbnR9fXRoaXMucG9zdE1lc3NhZ2Uoe21ldGhvZDoidHJhbnNtdXgiLGlkOnQuZGF0YS5pZCxhcmdzOmUoe30sYSl9KTticmVhaztjYXNlInJlc2V0Ijp0aGlzLkZNUDRSZW11eGVyJiZ0aGlzLkZNUDRSZW11eGVyLnJlc2V0KCksdGhpcy5NUDREZW11eGVyJiZ0aGlzLk1QNERlbXV4ZXIucmVzZXQoKSx0aGlzLkZNUDRSZW11eGVyPW51bGwsdGhpcy5NUDREZW11eGVyPW51bGwsdGhpcy5fbmVlZEluaXRTZWdtZW50PSEwfX19KCk7Cg==",blob$4="undefined"!=typeof window&&window.Blob&&new Blob([atob(encodedJs$4)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$4(){var e=blob$4&&(window.URL||window.webkitURL).createObjectURL(blob$4);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+encodedJs$4,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var TransmuxerWorkerControl=function(e){_inherits$a(r,EventEmitter$1);var t=_createSuper$a(r);function r(e){var n;return _classCallCheck$d(this,r),(n=t.call(this)).openlog=e.openLog,n.codecType=e.codecType,n.supportHevc=e.supportHevc,n.worker=new WorkerWrapper$4,n.worker.onmessage=function(e){n.emit(e.data.method,e.data)},n.worker.postMessage({method:"init",id:e.id||0,args:{openlog:n.openlog,supportHevc:n.supportHevc,codecType:n.codecType}}),n}return _createClass$d(r,[{key:"transmux",value:function(e,t,r,n,i,a,o,s,u){var c=t.buffer;this.worker&&this.worker.postMessage({method:"transmux",id:e,buffer:c,args:{start:r,videoIdx:n,audioIdx:i,moov:a,useEME:o,kidValue:s,context:u}},[c])}},{key:"reset",value:function(){this.worker&&this.worker.postMessage({method:"reset"})}},{key:"destroy",value:function(){this.worker&&this.worker.terminate()}}]),r}(),MP4_EVENTS={ERROR:"error",META_READY:"metaReady",MOOV_READY:"moovReady",MOOV_REQ_PROGRESS:"moov_request_Progress",TASK_PROGRESS:"progress_event",REMOVE_URL:"remove_url",FRAGMENT:"fragment",UPDATEEME:"updateEME",CHANGE_URL:"chaneg_url"},MP4$2=function(e){_inherits$a(d,EventEmitter$1);var t,r,n,i,a,o,s,u,c,l=_createSuper$a(d);function d(e,t,r,n){var i,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[],o=arguments.length>7?arguments[7]:void 0,s=arguments.length>8?arguments[8]:void 0;if(_classCallCheck$d(this,d),_defineProperty$b(_assertThisInitialized$a(i=l.call(this)),"onprogressDataArrive",function(){var e=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t,r,n){var a;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t&&t.byteLength>0&&((a=i.timeRange[n.index].range)&&n.range[1]>=a[1]&&!r&&(r=!0),i.log("[mp4.loadFragment onprogressDataArrive ] receive data, >>> index,",n.index,",range,",JSON.stringify(n.range),", dataLen,",t.byteLength),i._mux(t,n.range[0],n.index,r)),r&&(i.timeRange[n.index].downloaded=!0,i.bufferLoadedPos=-1,i.log("[FragLoadDowned],fragmentIdx,",n.index,",rangeEnd,",n.range[1]));case 2:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}()),i.timeRecord={startMuxTime:-1,startLoadTime:-1,newMP4Time:util$1.nowTime(),startLoadMetaTime:-1},i.url=e,i.backUrl=a||[],i._bitRate=t,i.options=d.getDefaultConfig(),Object.keys(r).map((function(e){void 0!==r[e]&&null!==r[e]&&(i.options[e]=r[e])})),i.timeRange=[],i.firstFrameTime=o||{},i._logTag=s||"",i.CHUNK_SIZE=getMetaSize(r.duration,i.options.chunkSize,r.fileSize),i.player=n,i.bufferLoaded=new Uint8Array(0),i.bufferLoadedPos=0,i.meta=null,i.preloadCache=null,i.videoTrak=null,i.audioTrak=null,i.canDownload=!0,i._loadSuccessCallBack=null,i._isPending=!1,i._metaLoading=!1,i.MP4Loader=new MP4Loader(_objectSpread2$6(_objectSpread2$6({segmentDuration:r.segmentDuration,url:e,vid:r.vid+"-"+t,retry:r.retryCount||2,retryDelay:r.retryDelay||1e3,timeout:3e3},r.reqOptions),{},{openLog:checkOpenLog()})),i.MP4Demuxer=null,i.FMP4Remuxer=null,i._needInitSegment=!0,i._bitRateInfoMap=new Map,i._switchBitRate=!1,i._segmentToBitRateMap=new Map,i.useEME=!1,i.kidValue=null,i.enableWorker=r.enableWorker&&("h265"!==r.codecType||r.supportHevc),i.enableWorker&&"undefined"!=typeof Worker)try{i.workerSequence=0,i.transmuxerWorkerControl=new TransmuxerWorkerControl({id:i.workerSequence,codecType:r.codecType,supportHevc:i.options.supportHevc,openLog:checkOpenLog()}),i.transmuxerWorkerControl.on("transmux",(function(e){var t=e.args;i.log("[transmuxerworker end] ,range, ",JSON.stringify(t.range),",dataLen,",t.buffer.byteLength,t.context),i.firstFrameTime.firstmux<0&&i.timeRecord.startMuxTime>0&&(i.firstFrameTime.firstmux=util$1.nowTime()-i.timeRecord.startMuxTime),i._loadSuccessCallBack&&i._loadSuccessCallBack(t)}))}catch(e){i.log("Error in worker:",e),i.enableWorker=!1,i.transmuxerWorkerControl=null}return i.enableWorker||(i.MP4Demuxer=null,i.FMP4Remuxer=null),i.seekTime=-1,i}return _createClass$d(d,[{key:"changeBitRate",value:(c=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t){return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.bitrate===this._bitRate){e.next=9;break}return this.url=t.url,this._bitRate=t.bitrate,this.backUrl=t.backupURL,e.next=6,this.MP4Loader.changeUrl(this.url,this.options.vid+"-"+this._bitRate,this.CHUNK_SIZE);case 6:this.emit(MP4_EVENTS.CHANGE_URL,this.url),this._switchBitRate=!0,this.log("[switchBitrate] changeUrl, bitRate,",this._bitRate,this.url);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"_getByPreload",value:function(e,t,r,n){try{if(e&&e.byteLength>=t){var i={endTime:(new Date).getTime(),startTime:(new Date).getTime(),index:n,range:[],vid:this.options.vid,from:"local"};if(r<=e.byteLength){var a=e.slice(t,r);return i.range=[t,r],i.state=!0,{buffer:a,context:i,state:!0}}var o=e.byteLength-1,s=e.slice(t,o);return i.range=[t,o],{context:i,buffer:s,state:!1}}return null}catch(e){return console.error("[MP4] _getByPreload",t,r,e),null}}},{key:"log",value:function(e){for(var t=this.options,r=t&&t.vid?"[MP4]".concat(this._logTag," ").concat(t.vid," ").concat(e):"[MP4]".concat(this._logTag," ").concat(e),n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];log$2.apply(void 0,[r].concat(i))}},{key:"errorHandler",value:(u=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t,r){var n,i,a,o,s,u,c,l,d,h=arguments;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=h.length>2&&void 0!==h[2]?h[2]:{},i=t.response,a=t.message,o=this.options?this.options.vid:"",s=null,this._isPending=!0,!i){e.next=33;break}if(u=transformHeaders(i.headers),s=new NetWorkError("network",i.status,{httpText:i.httpText,message:a,url:i.url,headers:u}),console.log("[MP4] [".concat(o,"] errorHandler error state:[").concat(r,"], _isPending:[").concat(this._isPending,"] "),s),!(this.backUrl&&this.backUrl.length>0)){e.next=29;break}if(console.log("[MP4] [".concat(o,"] errorHandler start backUpUrl retry"),this.backUrl.length,this.backUrl),c=this.backUrl.shift(),this.update(c),this._isPending=!1,!this.MP4Loader){e.next=18;break}return e.next=17,this.MP4Loader.changeUrl(this.url,this.url+"-"+this._bitRate,this.CHUNK_SIZE);case 17:this.emit(MP4_EVENTS.CHANGE_URL,this.url);case 18:if(this.emit(MP4_EVENTS.TASK_PROGRESS,{type:"error",error:t}),"getMetaInfo"!==r){e.next=24;break}return this.getMetaInfo(),e.abrupt("return");case 24:if("loadFragment"!==r){e.next=29;break}if(l=n.index,d=n.range,!l||!d){e.next=29;break}return this.loadFragment(l,d),e.abrupt("return");case 29:console.log("[MP4] [".concat(o,"] errorHandler backUpUrl is null emit error")),this.emit(MP4_EVENTS.ERROR,s),e.next=36;break;case 33:console.log("[MP4] [".concat(o,"] errorHandler,"),t),s=t,this.emit(MP4_EVENTS.ERROR,s);case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"init",value:(s=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t){var r,n,i,a,o,s,u,c;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.url){e.next=3;break}return e.next=3,this.MP4Loader.changeUrl(this.url,this.options.vid+"-"+this._bitRate,this.CHUNK_SIZE);case 3:if(this.emit(MP4_EVENTS.CHANGE_URL,this.url),this.meta=null,r=t.meta,n=t.mediaSegList,i=t.buffer,a=t.fileSize,o=t.initSeg,s=t.bitrate,!r||!r.ext){e.next=21;break}this.meta=r,this._bitRate=s,this.videoTrak=r.ext.videoTrak,this.audioTrak=r.ext.audioTrak,this.timeRange=this.getTimeRange(),n?this.preloadCache={segList:n||[],initSeg:o}:i&&(this.size=a,this.bufferLoaded=i),u={meta:r,videoSegments:r.ext.videoTrak,audioSegments:r.ext.audioTrak,bufferLoaded:i||null},this._bitRateInfoMap.set(this._bitRate,u),c=(new Date).getTime(),setTimeout((function(){console.log(">>>>metaReady setTimeout",(new Date).getTime()-c)})),console.log(">>>>metaReady",util$1.nowTime()),this.emit(MP4_EVENTS.META_READY,this.meta),e.next=23;break;case 21:return e.next=23,this.getMetaInfo();case 23:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getTimeRange",value:function(){for(var e=[],t=null,r=0;this.videoTrak&&r<this.videoTrak.length;r++)t={startTime:this.videoTrak[r].startTime,endTime:this.videoTrak[r].endTime,downloaded:!1,isLoading:!1},e.push(t);if(this.audioTrak&&this.audioTrak.length>e.length)for(var n=e.length;n<this.audioTrak.length;n++)t={startTime:Math.max(this.audioTrak[n].startTime,t?t.endTime:0),endTime:Math.max(this.audioTrak[n].endTime,t?t.endTime:0),downloaded:!1,isLoading:!1},e.push(t);return e}},{key:"getMetaInfo",value:(o=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(){var t,r,n,i,a=this,o=arguments;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=!(o.length>0&&void 0!==o[0])||o[0],e.prev=1,r=util$1.nowTime(),this._metaLoading=!0,this.log("getMetaInfo start, bitRate,",this._bitRate),this.bufferLoaded=new Uint8Array(0),n=0,i=function(){var e=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(i,o,s,u){var c,l;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a.log("getMetaInfo onProgressHandle, dataLen,",i?i.byteLength:-1,", state,",o,",range,",JSON.stringify(s.range)),!u){e.next=7;break}return e.next=4,a.cancelLoading();case 4:return c=new ParserError(ERROR_TYPES.demux,ERROR_CODES.metaError,{msg:JSON.stringify(u)}),a.errorHandler(c,"getMetaInfo"),e.abrupt("return");case 7:i&&s.range[0]===n&&(a.bufferLoaded=Concat$2(Uint8Array,a.bufferLoaded,new Uint8Array(i)),n+=i.byteLength),s.meta&&!a.meta&&(a.firstFrameTime.metaload=util$1.nowTime()-r,l=s.meta,a.videoTrak=l.videoSegments,a.audioTrak=l.audioSegments,a.timeRange=a.getTimeRange(),a.meta=_objectSpread2$6(_objectSpread2$6({},l.meta),{},{ext:{videoTrak:a.videoTrak,audioTrak:a.audioTrak}}),l.bufferLoaded=a.bufferLoaded,a._bitRateInfoMap.set(a._bitRate,l),a.log("meta reach, bitRate,",a._bitRate),t&&a.emit(MP4_EVENTS.META_READY,a.meta)),a.meta&&o&&(a.log("[getMetaInfo req end]"),a._metaLoading=!1),a.meta&&(i||o)&&(a.log("emit moov_req_progress"),a.emit(MP4_EVENTS.MOOV_REQ_PROGRESS));case 11:case"end":return e.stop()}}),e)})));return function(t,r,n,i){return e.apply(this,arguments)}}(),e.next=10,this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,this.CHUNK_SIZE],i);case 10:e.next=16;break;case 12:e.prev=12,e.t0=e.catch(1),console.error("[MP4] trigger errorHandler getMetaInfo",e.t0),this.errorHandler(e.t0,"getMetaInfo");case 16:case"end":return e.stop()}}),e,this,[[1,12]])}))),function(){return o.apply(this,arguments)})},{key:"getFragmentIdx",value:function(e){var t,r;if(this.videoTrak.length){if(t=this.videoTrak.find((function(t){return t.startTime<=e&&t.endTime>e})),r=this.audioTrak.find((function(t){return t.startTime<=e&&t.endTime>e})),t&&r)return Math.min(t.index,r.index);if(t||r)return t?t.index:r.index;var n=Number.MAX_VALUE;return this.videoTrak&&this.videoTrak.length>0&&(n=this.videoTrak.length-1),this.audioTrak&&this.audioTrak.length>0&&(n=Math.min(this.audioTrak.length-1,n)),n}return(r=this.audioTrak.find((function(t){return t.startTime<=e&&t.endTime>e})))?r.index:0}},{key:"_checkHasMeta",value:(a=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(){var t,r;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._bitRateInfoMap.get(this._bitRate)){e.next=19;break}return this.log("[ABR], need load InitSegment, bitRate, ",this._bitRate),this._metaLoading=!0,e.next=6,this.MP4Loader.loadMeta(this.MP4Loader.cache,Math.round(this.CHUNK_SIZE/2));case 6:return r=e.sent,this._metaLoading=!1,this.videoTrak=r.videoSegments,this.audioTrak=r.audioSegments,this.meta=_objectSpread2$6(_objectSpread2$6({},r.meta),{},{ext:{videoTrak:this.videoTrak,audioTrak:this.audioTrak}}),this.emit(MP4_EVENTS.UPDATEEME,this.meta),this.timeRange=this.getTimeRange(),this.bufferLoaded=new Uint8Array(0),r.bufferLoaded=this.bufferLoaded,this._bitRateInfoMap.set(this._bitRate,r),e.abrupt("return",!0);case 19:return this.log("[ABR], not need load InitSegment, bitRate, ",this._bitRate),this.videoTrak=t.videoSegments,this.audioTrak=t.audioSegments,this.meta=t.meta,this.emit(MP4_EVENTS.UPDATEEME,this.meta),this.timeRange=this.getTimeRange(),this.bufferLoaded=new Uint8Array(0),e.abrupt("return",!0);case 27:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"resetFragmentLoadState",value:function(e){for(var t=0;t<this.timeRange.length;t++)t<e?(this.timeRange[t].downloaded=!0,this.timeRange[t].isLoading=!0):(this.timeRange[t].downloaded=!1,this.timeRange[t].isLoading=!1)}},{key:"getFragRange",value:function(e){var t,r,n,i,a=null;this.videoTrak&&(a=e<this.videoTrak.length?this.videoTrak[e]:this.videoTrak[this.videoTrak.length-1]);var o=null;this.audioTrak&&(o=e<this.audioTrak.length?this.audioTrak[e]:this.audioTrak[this.audioTrak.length-1]);var s=0,u=0;this.videoTrak&&e>=this.videoTrak.length-1&&(s=-1),this.audioTrak&&e>=this.audioTrak.length-1&&(u=-1);var c=[Math.min((null===(t=a)||void 0===t?void 0:t.range[0])||1/0,(null===(r=o)||void 0===r?void 0:r.range[0])||1/0),Math.max((null===(n=a)||void 0===n?void 0:n.range[1])+s||0,(null===(i=o)||void 0===i?void 0:i.range[1])+u||0)];return e<this.timeRange.length&&(this.timeRange[e].range=c),c}},{key:"load",value:(i=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t,r){var n,i,a,o;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loadSuccessCallBack=r,!this._switchBitRate||this._metaLoading){e.next=11;break}return this.log("[switchBitrate], switch bitRate start load, bitRate,",this._bitRate,", time,",t>=this.videoTrak.length?this.audioTrak[t].startTime:this.videoTrak[t].startTime,", fragIndex,",t),e.next=5,this._checkHasMeta();case 5:n=e.sent,this.resetFragmentLoadState(t),this.log("[switchBitrate], reset timerange state,",t),this._needInitSegment=!0,this.resetTansmuxer(),n&&(this._switchBitRate=!1);case 11:if(!this._switchBitRate||!this._metaLoading){e.next=13;break}return e.abrupt("return");case 13:i=this.getFragRange(t),(a=this.getFragmentFromCache(t,i))?(this.log("[mp4.load], segment ,",t,"Data In Cache",JSON.stringify(i),", needInit,",this._needInitSegment),this.timeRange[t].downloaded=!0,this.timeRange[t].isLoading=!1,this._needInitSegment=!1,this._loadSuccessCallBack&&this._loadSuccessCallBack(a)):(this.log("loadFragment,",t,",bitRate,",this._bitRate,",range,",JSON.stringify(i)),this.seekTime>0?(o=this.getSubRange(t,this.seekTime,i),this.loadFragment(t,o),this.seekTime=-1):this.loadFragment(t,i));case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"getSubRange",value:function(e,t,r){var n=r[0],i=r[0],a=1,o=!1;if(this.log(">>>>>getSubRange time,",t,JSON.stringify(r)),this.videoTrak){var s=e<this.videoTrak.length?this.videoTrak[e]:this.videoTrak[this.videoTrak.length-1],u=s.frames.filter(getKeyFrameList),c=this.meta.videoTimescale,l=u[0].startTime/c;this.log(">>>>>getSubRange video, startTime,",s.startTime,",endTime,",s.endTime);for(var d=0;d<u.length;d++)this.log(">>>>>getSubRange video keyFrameList, startTime,",u[d].startTime/c,",range,",u[d].offset);for(;a<u.length;a++){var h=u[a].startTime/c;if(l<=t&&t<h&&r[0]<u[a-1].offset){n=u[a-1].offset,o=!0,this.log(">>>>>getSubRange video end, startTime,",l,",endTime,",h,",startRange,",n,", keyFrameIndex,",a-1);break}l=h}!o&&l<=t&&t<s.endTime+.8&&(n=u[a-1].offset,this.log(">>>>>getSubRange video last, startTime,",l,",endTime,",s.endTime,",startRange,",n))}if(a=1,this.audioTrak){var f=e<this.audioTrak.length?this.audioTrak[e]:this.audioTrak[this.audioTrak.length-1],p=f.frames,m=this.meta.audioTimescale;a=Math.floor((t*m-p[0].startTime)/f.frames[0].duration);for(var y=(a=Math.min(p.length-1,a))>0?p[a-1].startTime/m:p[0].startTime/m;a>=0&&a<p.length;)if(a>0&&y>t)y=p[a-=1].startTime/m;else{var g=(p[a].startTime+p[a].duration)/m;if(y<=t&&t<g&&r[0]<p[a].offset){i=p[a].offset,o=!0,this.log(">>>>>getSubRange audio end, startTime,",y,",endTime,",g,",startRange,",i,", index,",a);break}y=g,a++}}var v=[Math.min(i,n),r[1]];return this.log(">>>>>getSubRange finalRange ",JSON.stringify(v),",oldRange,",JSON.stringify(r)),v}},{key:"getFragmentFromCache",value:function(e,t){var r=this.preloadCache;if(!r||!r.segList)return null;for(var n=-1,i=r.segList,a=r.initSeg,o=0;o<i.length;o++)if(i[o].index===e){n=o;break}if(n<0)return null;var s=i[n];if(console.log(">>>>preloadCache",n,s,s.range,t[1],s.range[1]>=t[1]),s.range[1]>=t[1]){var u=[this.timeRange[e].startTime,this.timeRange[e].endTime];return{buffer:s.buffer,range:t,context:{range:t,fragIndex:e,state:!0,timeRange:[u[0],u[1]]},state:!0,initSeg:this._needInitSegment?a:void 0}}return null}},{key:"_mux",value:function(e,t,r,n){this.firstFrameTime.firstmux<0&&this.timeRecord.startMuxTime<0&&(this.timeRecord.startMuxTime=util$1.nowTime(),this.firstFrameTime.startMuxTime=util$1.nowTime()-this.timeRecord.startLoadTime);var i=this.getSamplesRange(r,"video"),a=this.getSamplesRange(r,"audio"),o=[t,t+e.byteLength];if(this.transmuxerWorkerControl){var s={range:o,state:n,fragIndex:r};this.log("[transmuxerworker start] ,range, ",JSON.stringify(o),",dataLen,",e.byteLength,s),this.transmuxerWorkerControl.transmux(this.workerSequence,e,t,i,a,this.meta.moov,this.useEME,this.kidValue,s)}else try{this.MP4Demuxer||(this.MP4Demuxer=new MP4Demuxer(this.videoTrak,this.audioTrak,null,{openLog:checkOpenLog()}));var u,c=this.MP4Demuxer.demuxPart(e,t,i,a,this.meta.moov,this.useEME,this.kidValue);this.FMP4Remuxer||this.checkCodecH265()&&!this.options.supportHevc||(this.FMP4Remuxer=new FMP4Remuxer$2(this.MP4Demuxer.videoTrack,this.MP4Demuxer.audioTrack,{openLog:checkOpenLog()})),this.log("[mux], videoTimeRange,",c.videoTrack?[c.videoTrack.startPts,c.videoTrack.endPts]:null,",audioTimeRange,",c.audioTrack?[c.audioTrack.startPts,c.audioTrack.endPts]:null);var l=[Math.min(c.videoTrack.startPts,c.audioTrack.startPts),Math.max(c.videoTrack.endPts,c.audioTrack.endPts)];if(this.FMP4Remuxer){var d=this.FMP4Remuxer.remux(this._needInitSegment,{initMerge:!0,range:o});d.initSegment&&(this._needInitSegment=!1),u={buffer:util$1.concatData(d.audioSegment,d.videoSegment),range:o,state:n,context:{range:o,fragIndex:r,timeRange:l},initSeg:d.initSegment}}else u={videoTrack:c.videoTrack,audioTrack:c.audioTrack,buffer:null,range:o,state:n,context:{range:o,fragIndex:r,timeRange:l}};this.firstFrameTime.firstmux<0&&this.timeRecord.startMuxTime>0&&(this.firstFrameTime.firstmux=util$1.nowTime()-this.timeRecord.startMuxTime),this._loadSuccessCallBack&&this._loadSuccessCallBack(u)}catch(n){console.error("mux err:",n);var h=new ParserError(ERROR_TYPES.remux,ERROR_CODES.muxError,{msg:JSON.stringify(n)});this.errorHandler(h,"mux",{fragIndex:r,range:[t,t+e.byteLength]})}}},{key:"getSamplesRange",value:function(e,t){var r=[];switch(t){case"video":if(this.videoTrak&&e<this.videoTrak.length){var n=this.videoTrak[e].frames;r.push(n[0].index),r.push(n[n.length-1].index)}break;case"audio":if(this.audioTrak&&e<this.audioTrak.length){var i=this.audioTrak[e].frames;r.push(i[0].index),r.push(i[i.length-1].index)}break;default:console.warn("[getSamplesRange] type ",t," is invalid")}return r}},{key:"loadFragment",value:(n=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t,r){var n,i,a,o;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isPending&&r!==[0,0]&&!this.timeRange[t].isLoading){e.next=2;break}return e.abrupt("return");case 2:if(this.log("[MP4.loadFragment] ,fragIndex,",t,",range ",r,",len ,",r[1]-r[0],", bufferLoaded_Len,",this.bufferLoaded.byteLength),this._segmentToBitRateMap.set(t,this._bitRate),this.timeRecord.startLoadTime<0&&(this.timeRecord.startLoadTime=util$1.nowTime()),!(r.length>=2&&r[1]&&r[1]>0&&r[1]<=this.bufferLoaded.byteLength)){e.next=15;break}this.timeRange[t].isLoading=!0,n=Math.max(r[0],this.bufferLoadedPos),i=new Uint8Array(this.bufferLoaded.slice(n,r[1])),this.log("[mp4.loadFragment] has all data: ",n,r[1]),this.timeRange[t].downloaded=!0,this.bufferLoadedPos=-1,this._mux(i,n,t,!0),e.next=38;break;case 15:if(!(r.length>=2&&r[0]&&r[0]<=this.bufferLoaded.byteLength)){e.next=27;break}if(this.timeRange[t].isLoading){e.next=25;break}if(a=Math.max(r[0],this.bufferLoadedPos),!((o=new Uint8Array(this.bufferLoaded.slice(a,r[1]))).byteLength>0)){e.next=24;break}return this.bufferLoadedPos=a+o.byteLength,this.log("[mp4.loadFragment] has part data: ",a,a+o.byteLength),this._mux(o,a,t,r[1]<=this.bufferLoadedPos),e.abrupt("return");case 24:if(!this._metaLoading&&!this.timeRange[t].isLoading)try{this.log("[mp4.loadFragment] ready to load part data >>> ",this.bufferLoaded.byteLength,r[1]),this.timeRange[t].isLoading=!0,this.MP4Loader.loadData([this.bufferLoaded.byteLength,r[1]],this.MP4Loader.cache,{index:t,onProgress:this.onprogressDataArrive,onProcessMinLen:this.options.onProcessMinLen})}catch(e){this.errorHandler(e,"MP4Loader.loadData",{range:[this.bufferLoaded.byteLength,r[1]],fragIndex:t})}case 25:e.next=38;break;case 27:if(this._metaLoading&&!(r[0]>=this.CHUNK_SIZE)||this.timeRange[t].isLoading){e.next=38;break}return this.timeRange[t].isLoading=!0,this.log("[mp4.loadFragment],ready to load all data ,segmentIdx, ",t,",range >>> ",JSON.stringify(r)),e.prev=30,e.next=33,this.MP4Loader.loadData(r,this.MP4Loader.cache,{index:t,onProgress:this.onprogressDataArrive,onProcessMinLen:this.options.onProcessMinLen});case 33:e.next=38;break;case 35:e.prev=35,e.t0=e.catch(30),this.errorHandler(e.t0,"MP4Loader.loadData",{range:r,fragIndex:t});case 38:case"end":return e.stop()}}),e,this,[[30,35]])}))),function(e,t){return n.apply(this,arguments)})},{key:"loadAllFragmentData",value:(r=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t,r,n){var i,a,o;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.hasDestroyed){e.next=2;break}return e.abrupt("return");case 2:return i=this.getFragRange(t),e.prev=3,e.next=6,this.MP4Loader.loadData(i,this.MP4Loader.cache,{index:t});case 6:if(a=e.sent,this.log("loadAllFragmentData after",JSON.stringify(i),a),a&&a.data){e.next=11;break}return n(new Error("response null")),e.abrupt("return");case 11:o=a.data,this._loadSuccessCallBack=r,this._mux(o,i[0],t,!0),e.next=20;break;case 16:e.prev=16,e.t0=e.catch(3),console.error("[MP4] loadAllFragmentData error",e.t0),n(e.t0);case 20:case"end":return e.stop()}}),e,this,[[3,16]])}))),function(e,t,n){return r.apply(this,arguments)})},{key:"cancelLoading",value:(t=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(){return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.MP4Loader;case 2:if(e.t0=e.sent,!e.t0){e.next=5;break}this.MP4Loader.cancel();case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"update",value:function(e){this.url=e}},{key:"getDataBitRate",value:function(e){return this._segmentToBitRateMap.get(e)}},{key:"checkCodecH265",value:function(){return this.meta&&(this.meta.videoCodec.indexOf("hvc1")>-1||this.meta.videoCodec.indexOf("hev1")>-1)}},{key:"destroy",value:function(){this.hasDestroyed||(this.resetTansmuxer(),this.transmuxerWorkerControl&&this.transmuxerWorkerControl.destroy(),this.size=0,this._isPending=!1,this._metaLoading=!1,this.bufferLoadedPos=0,this.bufferLoaded=new Uint8Array(0),this._bitRateInfoMap.clear(),this._segmentToBitRateMap.clear(),this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy()),this.hasDestroyed=!0)}},{key:"resetTansmuxer",value:function(){this.MP4Demuxer&&this.MP4Demuxer.reset(),this.MP4Demuxer=null,this.FMP4Remuxer&&this.FMP4Remuxer.reset(),this.FMP4Remuxer=null,this.transmuxerWorkerControl&&this.transmuxerWorkerControl.reset()}}],[{key:"getDefaultConfig",value:function(){return{onProcessMinLen:5120,xhrSetup:null,chunkSize:8e5,loadSize:800,isCache:!1,playerId:"",vid:"",ext:{}}}}]),d}();function getKeyFrameList(e){if(e.keyframe)return e}var ProxyPromise=function(){function e(){var t,r;_classCallCheck$d(this,e);var n=new Promise((function(e,n){t=e,r=n}));return n.resolve=function(e){t(e),n.state="fulfilled"},n.reject=function(e){r(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}return _createClass$d(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}(),XHR=_createClass$d((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.url,n=t.method,i=void 0===n?"GET":n,a=t.type,o=void 0===a?"arraybuffer":a,s=t.data,u=void 0===s?{}:s;return _classCallCheck$d(this,e),new Promise((function(e,t){var n=new window.XMLHttpRequest,a=i.toUpperCase(),s=[];if(o&&(n.responseType=o),Object.keys(u).map((function(e){s.push("k=".concat(u[e]))})),"GET"===a)n.open(a,"".concat(r,"?").concat(s.join("&"))),n.send();else{if("POST"!==a)throw new Error("xhr ".concat(a," is not supported"));n.open(a,r,!0),n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify(u))}n.onload=function(){200===n.status||206===n.status?e(n):t(n)},n.onerror=function(){t(n)}}))}));function getPlayLicenses(e,t,r){var n=new ProxyPromise;return new XHR({type:"json",method:"POST",url:r,data:{drm_type:"22",license_request:[{vid:e,kids:[].concat(t)}]}}).then((function(r){var i=r.response;if(i){var a=i.play_licenses[e][t];n.resolve(a)}else n.reject()})).catch((function(){n.reject()})),n}function getKeyValue(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,i=new ProxyPromise;if(r){log$2("[getKeyValue]>before openBox");var a=n.awManager.openBox(r);if(log$2("[getKeyValue]>after openBox: ",a),t){var o={clearKeys:{}};o.clearKeys[t]=a,i.resolve(o)}else i.resolve(a)}else{var s=getPlayLicenses(e,t,n.config.getLicenseUrl);s.id="requestPromise",n._addPendingPromise(s),s.then((function(e){if(n._removePendingPromise(s),n.awManager){log$2("[getKeyValue]>before openBox");var r=n.awManager.openBox(e);log$2("[getKeyValue]>after openBox: ",r);var a={clearKeys:{}};a.clearKeys[t]=r,i.resolve(a)}else i.reject({errDes:"awManager not exist, player destroyed"}),log$2("[getKeyValue]>awManager not exist, player destroyed")})).catch((function(e){i.reject(e),log$2("[getKeyValue]>requestPromise reject")}))}return i}var userGestureEventMiddleware={playBtnClick:function(e,t,r,n){e.paused||e.waitingMoreBuffer&&(e.waitingMoreBuffer=!1),n.call(e,t,r)}},videoEventMiddleware={waiting:function(e,t){var r=e.player,n=e.eventName;r.waitingMoreBuffer=!0,t(n,e)},play:function(e,t){var r=e.player,n=e.eventName;r.waitingMoreBuffer||t(n,e)},pause:function(e,t){var r=e.player,n=e.eventName;r.waitingMoreBuffer||t(n,e)},seeking:function(e,t){var r=e.player,n=e.eventName;r.isSeekingStart=!0,t(n,e)},progress:function(e,t){log$2(">>>>progress");var r=e.player,n=e.eventName;if(r.waitingMoreBuffer){var i=r.getBufferedRange(r.buffered2);0===i[0]&&0===i[1]||(void 0===r.inWaitingStart||r.isSeekingStart?(log$2("progress 起播或seek结束"),i[1]-r.currentTime>=(r.config.canplayWaterLevel||1)||i[1]>r.duration-1?(log$2("progress 出起播水位"),r.play()):(log$2("progress 未出起播水位"),r.emit("waiting"))):(log$2("progress video卡顿结束"),i[1]-r.currentTime>=(r.config.bufferWaterLevel||5)||i[1]>r.duration-1?(log$2("progress 出卡顿水位"),r.play()):(log$2("progress 未出卡顿水位"),r.emit("waiting"))))}t(n,e)},playing:function(e,t){var r=e.player,n=e.eventName;log$2("playing");var i=r.getBufferedRange(r.buffered2);if(0===i[0]&&0===i[1])return log$2("playing 当前播放时刻没有缓存 未出水位"),r.waitingMoreBuffer=!0,r.pause(),void t.call("waiting",e);void 0===r.inWaitingStart||r.isSeekingStart?(log$2("playing 起播或seek结束"),i[1]-r.currentTime>=(r.config.canplayWaterLevel||1)||i[1]>r.duration-1?(log$2("playing 出起播水位"),r.waitingMoreBuffer=!1,r.isSeekingStart=!1,t(n,e)):(log$2("playing 未出起播水位"),r.waitingMoreBuffer=!0,r.pause(),t.call("waiting",e))):(log$2("playing video卡顿结束"),i[1]-r.currentTime>=(r.config.bufferWaterLevel||5)||i[1]>r.duration-1?(log$2("playing 出卡顿水位"),r.waitingMoreBuffer=!1,t(n,e)):(log$2("playing 未出卡顿水位"),r.waitingMoreBuffer=!0,r.pause(),t.call("waiting",e)))}};function offInDestroy(e,t,r,n){e.once(n,(function i(){e.off(t,r),e.off(n,i)}))}function on(e,t,r,n){if(n)e.on(t,r),offInDestroy(e,t,r,n);else{e.on(t,(function(e){r(e)}))}}var EME=function(e){_inherits$a(r,EventEmitter$1);var t=_createSuper$a(r);function r(e){var n;return _classCallCheck$d(this,r),(n=t.call(this)).drm=e,n.KEYSYSTEM_TYPE="",n.keys={},n.drm.clearKeys&&(n.KEYSYSTEM_TYPE="org.w3.clearkey",n.keys=n.drm.clearKeys),n.options=[],n.ensurePromise=void 0,n}return _createClass$d(r,[{key:"updateDrm",value:function(e){this.drm=e,this.keys=this.drm.clearKeys}},{key:"setOptions",value:function(){var e=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],t={videoCapabilities:e},r={videoCapabilities:e,persistentState:"required",sessionTypes:["persistent-license"]};this.options=[r,t]}},{key:"bail",value:function(e){}},{key:"UpdateSessionFunc",value:function(e){var t=this;return function(r){var n=[],i=[];Object.keys(e).forEach((function(t){var r=e[t],a=util$1.fromHex(t),o=util$1.fromHex(r),s={kty:"oct",kid:util$1.toBase64(a,!1),k:util$1.toBase64(o,!1)};n.push(s),i.push(s.kid)}));var a={keys:n},o=JSON.stringify(a);r.target.update(util$1.StringToArrayBuffer(o)).then((function(){}),t.bail(" MediaKeySession update failed"))}}},{key:"KeysChange",value:function(e){}},{key:"EnsureMediaKeysCreated",value:function(e,t,r){return this.ensurePromise||(this.ensurePromise=navigator.requestMediaKeySystemAccess(t,r).then((function(e){return e.createMediaKeys()}),this.bail(" Failed to request key system access.")).then((function(t){return e.setMediaKeys(t)}),this.bail(" failed to create MediaKeys object"))),this.ensurePromise}},{key:"SetupEME",value:function(e,t){var r=this;e.sessions=[],on(this,"encrypted",(function(){var t=JSON.stringify({kids:["0123456789abcdef0123456789abcdef"]}),n=new Uint8Array(util$1.toUTF8(t));r.EnsureMediaKeysCreated(e,r.KEYSYSTEM_TYPE,r.options).then((function(){var t=e.mediaKeys.createSession();return e.sessions.push(t),t.addEventListener("message",r.UpdateSessionFunc(r.keys)),t.addEventListener("keystatuseschange",r.KeysChange),t.generateRequest("keyids",n.buffer)}),r.bail(" failed to ensure MediaKeys on HTMLMediaElement")).then((function(){}),r.bail(" Failed to generate request."))}))}}]),r}(),WasmManager=function(){function e(){_classCallCheck$d(this,e),this.queue=[]}return _createClass$d(e,[{key:"push",value:function(e){this.queue.push(e)}},{key:"startup",value:function(){return Promise.all(this.queue)}},{key:"destroy",value:function(){this.queue=[]}}]),e}(),$$o=_export,lastIndexOf3=arrayLastIndexOf;$$o({target:"Array",proto:!0,forced:arrayLastIndexOf!==[].lastIndexOf},{lastIndexOf:arrayLastIndexOf});var $$n=_export,fails$9=fails$V,toIndexedObject$2=toIndexedObject$d,nativeGetOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,DESCRIPTORS$6=descriptors,FAILS_ON_PRIMITIVES$1=fails$9((function(){nativeGetOwnPropertyDescriptor$1(1)})),FORCED$6=!DESCRIPTORS$6||FAILS_ON_PRIMITIVES$1;$$n({target:"Object",stat:!0,forced:FORCED$6,sham:!DESCRIPTORS$6},{getOwnPropertyDescriptor:function(e,t){return nativeGetOwnPropertyDescriptor$1(toIndexedObject$2(e),t)}});var $$m=_export,DESCRIPTORS$5=descriptors,defineProperty$3=objectDefineProperty.f;$$m({target:"Object",stat:!0,forced:Object.defineProperty!==defineProperty$3,sham:!DESCRIPTORS$5},{defineProperty:defineProperty$3});var createTypedArrayConstructor$6=typedArrayConstructorExports;createTypedArrayConstructor$6("Int8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var createTypedArrayConstructor$5=typedArrayConstructorExports;createTypedArrayConstructor$5("Int16",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var createTypedArrayConstructor$4=typedArrayConstructorExports;createTypedArrayConstructor$4("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var createTypedArrayConstructor$3=typedArrayConstructorExports;createTypedArrayConstructor$3("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var createTypedArrayConstructor$2=typedArrayConstructorExports;createTypedArrayConstructor$2("Uint32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var createTypedArrayConstructor$1=typedArrayConstructorExports;createTypedArrayConstructor$1("Float32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var createTypedArrayConstructor=typedArrayConstructorExports;createTypedArrayConstructor("Float64",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var $$l=_export,fails$8=fails$V,$imul=Math.imul,FORCED$5=fails$8((function(){return-5!=$imul(4294967295,5)||2!=$imul.length}));$$l({target:"Math",stat:!0,forced:FORCED$5},{imul:function(e,t){var r=65535,n=+e,i=+t,a=r&n,o=r&i;return 0|a*o+((r&n>>>16)*o+a*(r&i>>>16)<<16>>>0)}});var mathSign=Math.sign||function(e){var t=+e;return 0==t||t!=t?t:t<0?-1:1},sign2=mathSign,abs=Math.abs,pow$1=Math.pow,EPSILON=pow$1(2,-52),EPSILON32=pow$1(2,-23),MAX32=pow$1(2,127)*(2-EPSILON32),MIN32=pow$1(2,-126),roundTiesToEven=function(e){return e+1/EPSILON-1/EPSILON},mathFround=Math.fround||function(e){var t,r,n=+e,i=abs(n),a=sign2(n);return i<MIN32?a*roundTiesToEven(i/MIN32/EPSILON32)*MIN32*EPSILON32:(r=(t=(1+EPSILON32/EPSILON)*i)-(t-i))>MAX32||r!=r?a*(1/0):a*r},$$k=_export,fround2=mathFround;$$k({target:"Math",stat:!0},{fround:fround2});var $$j=_export,floor$1=Math.floor,log$1=Math.log,LOG2E=Math.LOG2E;$$j({target:"Math",stat:!0},{clz32:function(e){var t=e>>>0;return t?31-floor$1(log$1(t+.5)*LOG2E):32}});var $$i=_export,trunc2=mathTrunc;$$i({target:"Math",stat:!0},{trunc:trunc2});var $$h=_export,uncurryThis$7=functionUncurryThisClause,getOwnPropertyDescriptor4=objectGetOwnPropertyDescriptor.f,toLength=toLength$b,toString$6=toString$l,notARegExp=notARegexp,requireObjectCoercible=requireObjectCoercible$b,correctIsRegExpLogic=correctIsRegexpLogic,nativeStartsWith=uncurryThis$7("".startsWith),stringSlice$3=uncurryThis$7("".slice),min=Math.min,CORRECT_IS_REGEXP_LOGIC=correctIsRegExpLogic("startsWith"),MDN_POLYFILL_BUG=!CORRECT_IS_REGEXP_LOGIC&&!!function(){var e=getOwnPropertyDescriptor4(String.prototype,"startsWith");return e&&!e.writable}();$$h({target:"String",proto:!0,forced:!MDN_POLYFILL_BUG&&!CORRECT_IS_REGEXP_LOGIC},{startsWith:function(e){var t=toString$6(requireObjectCoercible(this));notARegExp(e);var r=toLength(min(arguments.length>1?arguments[1]:void 0,t.length)),n=toString$6(e);return nativeStartsWith?nativeStartsWith(t,n,r):stringSlice$3(t,r,r+n.length)===n}});var aw=function(){var e="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0;return function(t){var r,n=void 0!==(t=t||{})?t:{},i={};for(r in n)n.hasOwnProperty(r)&&(i[r]=n[r]);var a=!0;if(n.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");var o,s="";if(document.currentScript&&(s=document.currentScript.src),e&&(s=e),s=0!==s.indexOf("blob:")?s.substr(0,s.lastIndexOf("/")+1):"","object"!==("undefined"==typeof window?"undefined":_typeof$5(window))&&"function"!=typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");var u,c=n.print||console.log.bind(console),l=n.printErr||console.warn.bind(console);for(r in i)i.hasOwnProperty(r)&&(n[r]=i[r]);function d(e){d.shown||(d.shown={}),d.shown[e]||(d.shown[e]=1,l(e))}i=null,n.arguments&&n.arguments,Object.getOwnPropertyDescriptor(n,"arguments")||Object.defineProperty(n,"arguments",{configurable:!0,get:function(){W("Module.arguments has been replaced with plain arguments_")}}),n.thisProgram&&n.thisProgram,Object.getOwnPropertyDescriptor(n,"thisProgram")||Object.defineProperty(n,"thisProgram",{configurable:!0,get:function(){W("Module.thisProgram has been replaced with plain thisProgram")}}),n.quit&&n.quit,Object.getOwnPropertyDescriptor(n,"quit")||Object.defineProperty(n,"quit",{configurable:!0,get:function(){W("Module.quit has been replaced with plain quit_")}}),y(void 0===n.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),y(void 0===n.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),y(void 0===n.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),y(void 0===n.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),y(void 0===n.read,"Module.read option was removed (modify read_ in JS)"),y(void 0===n.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),y(void 0===n.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),y(void 0===n.setWindowTitle,"Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),Object.getOwnPropertyDescriptor(n,"read")||Object.defineProperty(n,"read",{configurable:!0,get:function(){W("Module.read has been replaced with plain read_")}}),Object.getOwnPropertyDescriptor(n,"readAsync")||Object.defineProperty(n,"readAsync",{configurable:!0,get:function(){W("Module.readAsync has been replaced with plain readAsync")}}),Object.getOwnPropertyDescriptor(n,"readBinary")||Object.defineProperty(n,"readBinary",{configurable:!0,get:function(){W("Module.readBinary has been replaced with plain readBinary")}}),de=function(){W("cannot use the stack before compiled code is ready to run, and has provided stack access")},n.wasmBinary&&(u=n.wasmBinary),Object.getOwnPropertyDescriptor(n,"wasmBinary")||Object.defineProperty(n,"wasmBinary",{configurable:!0,get:function(){W("Module.wasmBinary has been replaced with plain wasmBinary")}}),n.noExitRuntime&&n.noExitRuntime,Object.getOwnPropertyDescriptor(n,"noExitRuntime")||Object.defineProperty(n,"noExitRuntime",{configurable:!0,get:function(){W("Module.noExitRuntime has been replaced with plain noExitRuntime")}});var h,f={Memory:function(e){return{buffer:new ArrayBuffer(65536*e.initial),grow:function(e){var t=this.buffer,r=fe(e);return y(this.buffer!==t),r}}},Table:function(e){var t=new Array(e.initial);return t.grow=function(e){t.length>=1&&W("Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH."),t.push(null)},t.set=function(e,r){t[e]=r},t.get=function(e){return t[e]},t},Module:function(e){return{}},Instance:function(e,t){var r,n=(r=p,function(e,t,n){var i=t.memory,a=r,o=new e.Int8Array(n);new e.Int16Array(n);var s=new e.Int32Array(n),u=new e.Uint8Array(n);new e.Uint16Array(n);var c=new e.Uint32Array(n);new e.Float32Array(n),new e.Float64Array(n);var l=e.Math.imul;e.Math.fround,e.Math.abs,e.Math.clz32,e.Math.min,e.Math.max,e.Math.floor,e.Math.ceil,e.Math.sqrt,t.abort,e.NaN,e.Infinity;var d=t.emscripten_memcpy_big,h=t.emscripten_resize_heap,f=t.__unlock,p=t.__lock,m=9744;function y(e){var t,r=0;return t=T(),(e=(r=s[388])+e|0)>>>0<=t<<16>>>0||h(0|e)?(s[388]=e,r):(s[256]=48,-1)}function g(e){var t,r=0,n=0,i=0,a=0,o=0,l=0,d=0,h=0,f=0,p=0,g=0,v=0;m=t=m-16|0;e:{t:{r:{n:{i:{a:{o:{s:{u:{c:{l:{if((e|=0)>>>0<=244){if(3&(r=(o=s[261])>>>(e=(l=e>>>0<11?16:e+11&-8)>>>3))){e=(r=s[1092+(a=(n=e+(1&(-1^r))|0)<<3)>>2])+8|0,(0|(i=s[r+8>>2]))!=(0|(a=a+1084|0))?(s[i+12>>2]=a,s[a+8>>2]=i):(g=1044,v=A(n)&o,s[g>>2]=v),n<<=3,s[r+4>>2]=3|n,s[4+(r=r+n|0)>>2]=1|s[r+4>>2];break e}if(l>>>0<=(h=s[263])>>>0)break l;if(r){n=r=(e=(0-(e=(0-(n=2<<e)|n)&r<<e)&e)-1|0)>>>12&16,n|=r=(e>>>=r)>>>5&8,n|=r=(e>>>=r)>>>2&4,r=s[1092+(i=(n=((n|=r=(e>>>=r)>>>1&2)|(r=(e>>>=r)>>>1&1))+(e>>>r)|0)<<3)>>2],(0|(e=s[r+8>>2]))!=(0|(i=i+1084|0))?(s[e+12>>2]=i,s[i+8>>2]=e):(o=A(n)&o,s[261]=o),e=r+8|0,s[r+4>>2]=3|l,a=(n<<=3)-l|0,s[4+(d=r+l|0)>>2]=1|a,s[r+n>>2]=a,h&&(r=1084+((n=h>>>3)<<3)|0,i=s[266],(n=1<<n)&o?n=s[r+8>>2]:(s[261]=n|o,n=r),s[r+8>>2]=i,s[n+12>>2]=i,s[i+12>>2]=r,s[i+8>>2]=n),s[266]=d,s[263]=a;break e}if(!(p=s[262]))break l;for(n=r=(e=(p&0-p)-1|0)>>>12&16,n|=r=(e>>>=r)>>>5&8,n|=r=(e>>>=r)>>>2&4,r=s[1348+(((n|=r=(e>>>=r)>>>1&2)|(r=(e>>>=r)>>>1&1))+(e>>>r)<<2)>>2],i=(-8&s[r+4>>2])-l|0,n=r;(e=s[n+16>>2])||(e=s[n+20>>2]);)i=(n=(a=(-8&s[e+4>>2])-l|0)>>>0<i>>>0)?a:i,r=n?e:r,n=e;if(f=s[r+24>>2],(0|(a=s[r+12>>2]))!=(0|r)){e=s[r+8>>2],s[e+12>>2]=a,s[a+8>>2]=e;break t}if(!(e=s[(n=r+20|0)>>2])){if(!(e=s[r+16>>2]))break c;n=r+16|0}for(;d=n,a=e,(e=s[(n=e+20|0)>>2])||(n=a+16|0,e=s[a+16>>2]););s[d>>2]=0;break t}if(l=-1,!(e>>>0>4294967231)&&(l=-8&(r=e+11|0),h=s[262])){n=0-l|0,o=0,(r>>>=8)&&(o=31,l>>>0>16777215||(o=28+((e=((o=(r<<=i=r+1048320>>>16&8)<<(e=r+520192>>>16&4))<<(r=o+245760>>>16&2)>>>15)-(r|e|i)|0)<<1|l>>>e+21&1)|0));d:{h:{if(i=s[1348+(o<<2)>>2])for(r=l<<(31==(0|o)?0:25-(o>>>1)|0),e=0;;){if(!((d=(-8&s[i+4>>2])-l|0)>>>0>=n>>>0||(a=i,n=d))){n=0,e=i;break h}if(d=s[i+20>>2],i=s[16+((r>>>29&4)+i|0)>>2],e=d?(0|d)==(0|i)?e:d:e,r<<=0!=(0|i),!i)break}else e=0;if(!(e|a)){if(!(e=(0-(e=2<<o)|e)&h))break l;i=r=(e=(e&0-e)-1|0)>>>12&16,i|=r=(e>>>=r)>>>5&8,i|=r=(e>>>=r)>>>2&4,e=s[1348+(((i|=r=(e>>>=r)>>>1&2)|(r=(e>>>=r)>>>1&1))+(e>>>r)<<2)>>2]}if(!e)break d}for(;n=(r=(i=(-8&s[e+4>>2])-l|0)>>>0<n>>>0)?i:n,a=r?e:a,e=(r=s[e+16>>2])||s[e+20>>2];);}if(!(!a|n>>>0>=s[263]-l>>>0)){if(d=s[a+24>>2],(0|a)!=(0|(r=s[a+12>>2]))){e=s[a+8>>2],s[e+12>>2]=r,s[r+8>>2]=e;break r}if(!(e=s[(i=a+20|0)>>2])){if(!(e=s[a+16>>2]))break u;i=a+16|0}for(;o=i,r=e,(e=s[(i=e+20|0)>>2])||(i=r+16|0,e=s[r+16>>2]););s[o>>2]=0;break r}}}if((r=s[263])>>>0>=l>>>0){e=s[266],(n=r-l|0)>>>0>=16?(s[263]=n,i=e+l|0,s[266]=i,s[i+4>>2]=1|n,s[e+r>>2]=n,s[e+4>>2]=3|l):(s[266]=0,s[263]=0,s[e+4>>2]=3|r,s[4+(r=e+r|0)>>2]=1|s[r+4>>2]),e=e+8|0;break e}if((i=s[264])>>>0>l>>>0){r=i-l|0,s[264]=r,n=(e=s[267])+l|0,s[267]=n,s[n+4>>2]=1|r,s[e+4>>2]=3|l,e=e+8|0;break e}if(e=0,n=a=l+47|0,s[379]?r=s[381]:(s[382]=-1,s[383]=-1,s[380]=4096,s[381]=4096,s[379]=t+12&-16^1431655768,s[384]=0,s[372]=0,r=4096),(n=(o=n+r|0)&(d=0-r|0))>>>0<=l>>>0)break e;if((r=s[371])&&(f=(h=s[369])+n|0)>>>0<=h>>>0|f>>>0>r>>>0)break e;if(4&u[1488])break a;l:{d:{if(r=s[267])for(e=1492;;){if((h=s[e>>2])+s[e+4>>2]>>>0>r>>>0&&h>>>0<=r>>>0)break d;if(!(e=s[e+8>>2]))break}if(-1==(0|(r=y(0))))break o;if(o=n,(i=(e=s[380])+-1|0)&r&&(o=(n-r|0)+(r+i&0-e)|0),o>>>0<=l>>>0|o>>>0>2147483646)break o;if((e=s[371])&&(d=(i=s[369])+o|0)>>>0<=i>>>0|d>>>0>e>>>0)break o;if((0|r)!=(0|(e=y(o))))break l;break i}if((o=d&o-i)>>>0>2147483646)break o;if((0|(r=y(o)))==(s[e>>2]+s[e+4>>2]|0))break s;e=r}if(r=e,!(l+48>>>0<=o>>>0|o>>>0>2147483646|-1==(0|e))){if((e=(e=s[381])+(a-o|0)&0-e)>>>0>2147483646)break i;if(-1!=(0|y(e))){o=e+o|0;break i}y(0-o|0);break o}if(-1!=(0|r))break i;break o}a=0;break t}r=0;break r}if(-1!=(0|r))break i}s[372]=4|s[372]}if(n>>>0>2147483646)break n;if((r=y(n))>>>0>=(e=y(0))>>>0|-1==(0|r)|-1==(0|e))break n;if((o=e-r|0)>>>0<=l+40>>>0)break n}e=s[369]+o|0,s[369]=e,e>>>0>c[370]&&(s[370]=e);i:{a:{o:{if(n=s[267]){for(e=1492;;){if(((i=s[e>>2])+(a=s[e+4>>2])|0)==(0|r))break o;if(!(e=s[e+8>>2]))break}break a}for(r>>>0>=(e=s[265])>>>0&&e||(s[265]=r),e=0,s[374]=o,s[373]=r,s[269]=-1,s[270]=s[379],s[376]=0;i=1084+(n=e<<3)|0,s[n+1092>>2]=i,s[n+1096>>2]=i,32!=(0|(e=e+1|0)););i=(e=o+-40|0)-(n=r+8&7?-8-r&7:0)|0,s[264]=i,n=r+n|0,s[267]=n,s[n+4>>2]=1|i,s[4+(e+r|0)>>2]=40,s[268]=s[383];break i}if(!(8&u[e+12|0]|r>>>0<=n>>>0|i>>>0>n>>>0)){s[e+4>>2]=a+o,r=(e=n+8&7?-8-n&7:0)+n|0,s[267]=r,e=(i=s[264]+o|0)-e|0,s[264]=e,s[r+4>>2]=1|e,s[4+(n+i|0)>>2]=40,s[268]=s[383];break i}}r>>>0<(a=s[265])>>>0&&(s[265]=r,a=0),i=r+o|0,e=1492;a:{o:{s:{u:{c:{l:{for(;;){if((0|i)!=s[e>>2]){if(e=s[e+8>>2])continue;break l}break}if(!(8&u[e+12|0]))break c}for(e=1492;;){if((i=s[e>>2])>>>0<=n>>>0&&(a=i+s[e+4>>2]|0)>>>0>n>>>0)break u;e=s[e+8>>2]}}if(s[e>>2]=r,s[e+4>>2]=s[e+4>>2]+o,s[4+(f=(r+8&7?-8-r&7:0)+r|0)>>2]=3|l,e=((r=i+(i+8&7?-8-i&7:0)|0)-f|0)-l|0,d=l+f|0,(0|r)==(0|n)){s[267]=d,e=s[264]+e|0,s[264]=e,s[d+4>>2]=1|e;break o}if(s[266]==(0|r)){s[266]=d,e=s[263]+e|0,s[263]=e,s[d+4>>2]=1|e,s[e+d>>2]=e;break o}if(1==(3&(n=s[r+4>>2]))){p=-8&n;c:if(n>>>0<=255){if(a=n>>>3,n=s[r+8>>2],(0|(i=s[r+12>>2]))==(0|n)){g=1044,v=s[261]&A(a),s[g>>2]=v;break c}s[n+12>>2]=i,s[i+8>>2]=n}else{if(h=s[r+24>>2],(0|(o=s[r+12>>2]))==(0|r))if((l=s[(i=r+20|0)>>2])||(l=s[(i=r+16|0)>>2])){for(;n=i,o=l,(l=s[(i=l+20|0)>>2])||(i=o+16|0,l=s[o+16>>2]););s[n>>2]=0}else o=0;else n=s[r+8>>2],s[n+12>>2]=o,s[o+8>>2]=n;if(h){n=s[r+28>>2];l:{if(s[(i=1348+(n<<2)|0)>>2]==(0|r)){if(s[i>>2]=o,o)break l;g=1048,v=s[262]&A(n),s[g>>2]=v;break c}if(s[h+(s[h+16>>2]==(0|r)?16:20)>>2]=o,!o)break c}s[o+24>>2]=h,(n=s[r+16>>2])&&(s[o+16>>2]=n,s[n+24>>2]=o),(n=s[r+20>>2])&&(s[o+20>>2]=n,s[n+24>>2]=o)}}r=r+p|0,e=e+p|0}if(s[r+4>>2]=-2&s[r+4>>2],s[d+4>>2]=1|e,s[e+d>>2]=e,e>>>0<=255){e=1084+((r=e>>>3)<<3)|0,(n=s[261])&(r=1<<r)?r=s[e+8>>2]:(s[261]=r|n,r=e),s[e+8>>2]=d,s[r+12>>2]=d,s[d+12>>2]=e,s[d+8>>2]=r;break o}if(r=0,(i=e>>>8)&&(r=31,e>>>0>16777215||(r=28+((r=((l=(i<<=a=i+1048320>>>16&8)<<(r=i+520192>>>16&4))<<(i=l+245760>>>16&2)>>>15)-(i|r|a)|0)<<1|e>>>r+21&1)|0)),s[(n=d)+28>>2]=r,s[d+16>>2]=0,s[d+20>>2]=0,n=1348+(r<<2)|0,(i=s[262])&(a=1<<r)){for(i=e<<(31==(0|r)?0:25-(r>>>1)|0),r=s[n>>2];;){if(n=r,(-8&s[r+4>>2])==(0|e))break s;if(r=i>>>29,i<<=1,!(r=s[16+(a=(4&r)+n|0)>>2]))break}s[a+16>>2]=d}else s[262]=i|a,s[n>>2]=d;s[d+24>>2]=n,s[d+12>>2]=d,s[d+8>>2]=d;break o}for(d=(e=o+-40|0)-(i=r+8&7?-8-r&7:0)|0,s[264]=d,i=r+i|0,s[267]=i,s[i+4>>2]=1|d,s[4+(e+r|0)>>2]=40,s[268]=s[383],s[(i=(e=(a+(a+-39&7?39-a&7:0)|0)-47|0)>>>0<n+16>>>0?n:e)+4>>2]=27,e=s[376],s[i+16>>2]=s[375],s[i+20>>2]=e,e=s[374],s[i+8>>2]=s[373],s[i+12>>2]=e,s[375]=i+8,s[374]=o,s[373]=r,s[376]=0,e=i+24|0;s[e+4>>2]=7,r=e+8|0,e=e+4|0,r>>>0<a>>>0;);if((0|n)==(0|i))break i;if(s[i+4>>2]=-2&s[i+4>>2],a=i-n|0,s[n+4>>2]=1|a,s[i>>2]=a,a>>>0<=255){e=1084+((r=a>>>3)<<3)|0,(i=s[261])&(r=1<<r)?r=s[e+8>>2]:(s[261]=r|i,r=e),s[e+8>>2]=n,s[r+12>>2]=n,s[n+12>>2]=e,s[n+8>>2]=r;break i}if(s[n+16>>2]=0,s[n+20>>2]=0,e=0,(i=a>>>8)&&(e=31,a>>>0>16777215||(e=28+((e=((d=(i<<=o=i+1048320>>>16&8)<<(e=i+520192>>>16&4))<<(i=d+245760>>>16&2)>>>15)-(i|e|o)|0)<<1|a>>>e+21&1)|0)),s[(r=n)+28>>2]=e,r=1348+(e<<2)|0,(i=s[262])&(o=1<<e)){for(e=a<<(31==(0|e)?0:25-(e>>>1)|0),r=s[r>>2];;){if(i=r,(0|a)==(-8&s[r+4>>2]))break a;if(r=e>>>29,e<<=1,!(r=s[16+(o=i+(4&r)|0)>>2]))break}s[o+16>>2]=n,s[n+24>>2]=i}else s[262]=i|o,s[r>>2]=n,s[n+24>>2]=r;s[n+12>>2]=n,s[n+8>>2]=n;break i}e=s[n+8>>2],s[e+12>>2]=d,s[n+8>>2]=d,s[d+24>>2]=0,s[d+12>>2]=n,s[d+8>>2]=e}e=f+8|0;break e}e=s[i+8>>2],s[e+12>>2]=n,s[i+8>>2]=n,s[n+24>>2]=0,s[n+12>>2]=i,s[n+8>>2]=e}if(!((e=s[264])>>>0<=l>>>0)){r=e-l|0,s[264]=r,n=(e=s[267])+l|0,s[267]=n,s[n+4>>2]=1|r,s[e+4>>2]=3|l,e=e+8|0;break e}}s[256]=48,e=0;break e}r:if(d){e=s[a+28>>2];n:{if(s[(i=1348+(e<<2)|0)>>2]==(0|a)){if(s[i>>2]=r,r)break n;h=A(e)&h,s[262]=h;break r}if(s[d+(s[d+16>>2]==(0|a)?16:20)>>2]=r,!r)break r}s[r+24>>2]=d,(e=s[a+16>>2])&&(s[r+16>>2]=e,s[e+24>>2]=r),(e=s[a+20>>2])&&(s[r+20>>2]=e,s[e+24>>2]=r)}r:if(n>>>0<=15)e=n+l|0,s[a+4>>2]=3|e,s[4+(e=e+a|0)>>2]=1|s[e+4>>2];else if(s[a+4>>2]=3|l,s[4+(i=a+l|0)>>2]=1|n,s[n+i>>2]=n,n>>>0<=255)e=1084+((r=n>>>3)<<3)|0,(n=s[261])&(r=1<<r)?r=s[e+8>>2]:(s[261]=r|n,r=e),s[e+8>>2]=i,s[r+12>>2]=i,s[i+12>>2]=e,s[i+8>>2]=r;else{e=0,(l=n>>>8)&&(e=31,n>>>0>16777215||(e=28+((e=((d=(l<<=o=l+1048320>>>16&8)<<(e=l+520192>>>16&4))<<(l=d+245760>>>16&2)>>>15)-(l|e|o)|0)<<1|n>>>e+21&1)|0)),s[(r=i)+28>>2]=e,s[i+16>>2]=0,s[i+20>>2]=0,r=1348+(e<<2)|0;n:{if((l=1<<e)&h){for(e=n<<(31==(0|e)?0:25-(e>>>1)|0),l=s[r>>2];;){if((-8&s[(r=l)+4>>2])==(0|n))break n;if(l=e>>>29,e<<=1,!(l=s[16+(o=(4&l)+r|0)>>2]))break}s[o+16>>2]=i}else s[262]=l|h,s[r>>2]=i;s[i+24>>2]=r,s[i+12>>2]=i,s[i+8>>2]=i;break r}e=s[r+8>>2],s[e+12>>2]=i,s[r+8>>2]=i,s[i+24>>2]=0,s[i+12>>2]=r,s[i+8>>2]=e}e=a+8|0;break e}t:if(f){e=s[r+28>>2];r:{if(s[(n=1348+(e<<2)|0)>>2]==(0|r)){if(s[n>>2]=a,a)break r;g=1048,v=A(e)&p,s[g>>2]=v;break t}if(s[f+(s[f+16>>2]==(0|r)?16:20)>>2]=a,!a)break t}s[a+24>>2]=f,(e=s[r+16>>2])&&(s[a+16>>2]=e,s[e+24>>2]=a),(e=s[r+20>>2])&&(s[a+20>>2]=e,s[e+24>>2]=a)}i>>>0<=15?(e=i+l|0,s[r+4>>2]=3|e,s[4+(e=e+r|0)>>2]=1|s[e+4>>2]):(s[r+4>>2]=3|l,s[4+(l=r+l|0)>>2]=1|i,s[i+l>>2]=i,h&&(e=1084+((n=h>>>3)<<3)|0,a=s[266],(n=1<<n)&o?n=s[e+8>>2]:(s[261]=n|o,n=e),s[e+8>>2]=a,s[n+12>>2]=a,s[a+12>>2]=e,s[a+8>>2]=n),s[266]=l,s[263]=i),e=r+8|0}return m=t+16|0,0|e}function v(e){var t=0,r=0,n=0,i=0,a=0,o=0,u=0,l=0,d=0;e:if(e|=0){a=(n=e+-8|0)+(e=-8&(r=s[e+-4>>2]))|0;t:if(!(1&r)){if(!(3&r))break e;if((n=n-(r=s[n>>2])|0)>>>0<c[265])break e;if(e=e+r|0,s[266]==(0|n)){if(3==(3&(r=s[a+4>>2])))return s[263]=e,s[a+4>>2]=-2&r,s[n+4>>2]=1|e,void(s[e+n>>2]=e)}else{if(r>>>0<=255){if(i=s[n+8>>2],r>>>=3,(0|(t=s[n+12>>2]))==(0|i)){l=1044,d=s[261]&A(r),s[l>>2]=d;break t}s[i+12>>2]=t,s[t+8>>2]=i;break t}if(u=s[n+24>>2],(0|n)==(0|(r=s[n+12>>2])))if((t=s[(i=n+20|0)>>2])||(t=s[(i=n+16|0)>>2])){for(;o=i,(t=s[(i=(r=t)+20|0)>>2])||(i=r+16|0,t=s[r+16>>2]););s[o>>2]=0}else r=0;else t=s[n+8>>2],s[t+12>>2]=r,s[r+8>>2]=t;if(!u)break t;i=s[n+28>>2];r:{if(s[(t=1348+(i<<2)|0)>>2]==(0|n)){if(s[t>>2]=r,r)break r;l=1048,d=s[262]&A(i),s[l>>2]=d;break t}if(s[u+(s[u+16>>2]==(0|n)?16:20)>>2]=r,!r)break t}if(s[r+24>>2]=u,(t=s[n+16>>2])&&(s[r+16>>2]=t,s[t+24>>2]=r),!(t=s[n+20>>2]))break t;s[r+20>>2]=t,s[t+24>>2]=r}}if(!(a>>>0<=n>>>0)&&1&(r=s[a+4>>2])){t:{if(!(2&r)){if(s[267]==(0|a)){if(s[267]=n,e=s[264]+e|0,s[264]=e,s[n+4>>2]=1|e,s[266]!=(0|n))break e;return s[263]=0,void(s[266]=0)}if(s[266]==(0|a))return s[266]=n,e=s[263]+e|0,s[263]=e,s[n+4>>2]=1|e,void(s[e+n>>2]=e);e=(-8&r)+e|0;r:if(r>>>0<=255){if(r>>>=3,(0|(t=s[a+8>>2]))==(0|(i=s[a+12>>2]))){l=1044,d=s[261]&A(r),s[l>>2]=d;break r}s[t+12>>2]=i,s[i+8>>2]=t}else{if(u=s[a+24>>2],(0|a)==(0|(r=s[a+12>>2])))if((t=s[(i=a+20|0)>>2])||(t=s[(i=a+16|0)>>2])){for(;o=i,(t=s[(i=(r=t)+20|0)>>2])||(i=r+16|0,t=s[r+16>>2]););s[o>>2]=0}else r=0;else t=s[a+8>>2],s[t+12>>2]=r,s[r+8>>2]=t;if(u){i=s[a+28>>2];n:{if(s[(t=1348+(i<<2)|0)>>2]==(0|a)){if(s[t>>2]=r,r)break n;l=1048,d=s[262]&A(i),s[l>>2]=d;break r}if(s[u+(s[u+16>>2]==(0|a)?16:20)>>2]=r,!r)break r}s[r+24>>2]=u,(t=s[a+16>>2])&&(s[r+16>>2]=t,s[t+24>>2]=r),(t=s[a+20>>2])&&(s[r+20>>2]=t,s[t+24>>2]=r)}}if(s[n+4>>2]=1|e,s[e+n>>2]=e,s[266]!=(0|n))break t;return void(s[263]=e)}s[a+4>>2]=-2&r,s[n+4>>2]=1|e,s[e+n>>2]=e}if(e>>>0<=255)return r=1084+((e>>>=3)<<3)|0,(t=s[261])&(e=1<<e)?e=s[r+8>>2]:(s[261]=e|t,e=r),s[r+8>>2]=n,s[e+12>>2]=n,s[n+12>>2]=r,void(s[n+8>>2]=e);s[n+16>>2]=0,s[n+20>>2]=0,t=0,(i=e>>>8)&&(t=31,e>>>0>16777215||(t=i,t<<=i=i+1048320>>>16&8,t=28+((t=((t<<=u=t+520192>>>16&4)<<(o=t+245760>>>16&2)>>>15)-(o|i|u)|0)<<1|e>>>t+21&1)|0)),s[(r=n)+28>>2]=t,o=1348+(t<<2)|0;t:if((i=s[262])&(r=1<<t)){i=e<<(31==(0|t)?0:25-(t>>>1)|0),r=s[o>>2];r:{for(;;){if(t=r,(-8&s[r+4>>2])==(0|e))break r;if(r=i>>>29,i<<=1,!(r=s[16+(o=t+(4&r)|0)>>2]))break}s[o+16>>2]=n,s[n+12>>2]=n,s[n+24>>2]=t,s[n+8>>2]=n;break t}e=s[t+8>>2],s[e+12>>2]=n,s[t+8>>2]=n,s[n+24>>2]=0,s[n+12>>2]=t,s[n+8>>2]=e}else s[262]=r|i,s[o>>2]=n,s[n+12>>2]=n,s[n+24>>2]=o,s[n+8>>2]=n;if(e=s[269]+-1|0,s[269]=e,!e){for(n=1500;n=(e=s[n>>2])+8|0,e;);s[269]=-1}}}}function b(e){var t,r=0;return c[e+20>>2]<=c[e+28>>2]||(a[s[e+36>>2]](e,0,0),s[e+20>>2])?((r=s[e+4>>2])>>>0<(t=s[e+8>>2])>>>0&&(r=r-t|0,a[s[e+40>>2]](e,r,r>>31,1)),s[e+28>>2]=0,s[e+16>>2]=0,s[e+20>>2]=0,s[e+4>>2]=0,s[e+8>>2]=0,0):-1}function _(e){for(var t=0,r=0;r=t,e;)e&=e-1,t=t+1|0;return r}function A(e){var t;return(-1>>>(t=31&e)&-2)<<t|(-1<<(e=0-e&31)&-2)>>>e}function T(){return n.byteLength/65536|0}return{__wasm_call_ctors:function(){},malloc:g,openBox:function(e,t){e|=0,t|=0;var r,n,i,a=0;return m=r=m-16|0,s[r+12>>2]=0,s[r+8>>2]=0,s[r+4>>2]=0,s[r>>2]=0,function(e,t,r,n,i,a){var c=0,l=0,d=0,h=0,f=0,p=0;if(c=(u[e+2|0]^u[e+1|0]^u[0|e])<<24>>24,s[a>>2]=c+-48,c=47+(t-c|0)|0,s[n>>2]=c,f=r,p=g(c),s[f>>2]=p,l=s[a>>2],d=g(l),s[i>>2]=d,(0|l)>0)for(c=l;;){if(d=(l-c|0)+d|0,l=(t-l|0)+e|0,o[0|d]=u[(t-c|0)+e|0]^u[l+-1|0]^u[l+-2|0],(0|(c=c+-1|0))<1){c=s[n>>2];break}d=s[i>>2],l=s[a>>2]}if((0|c)>0)for(;t=s[r>>2]+h|0,h=h+1|0,o[0|t]=u[h+e|0],(0|h)<s[n>>2];);}(e,t,r+12|0,r+4|0,r+8|0,r),function(e,t){var r=0,n=0,i=0,a=0,s=0,c=0,l=0;if((0|t)>=1)for(i=85,a=250;n=_(r),s=u[0|(c=e+r|0)],l=n,n=1&r,o[0|c]=l+(21+((s^(n?i:a))<<24>>24)|0),a=n?a:s,i=n?s:i,(0|(r=r+1|0))!=(0|t););}(e=s[r+12>>2],t=s[r+4>>2]),n=function(e){var t=0;return(255&(t=e+-48|0))>>>0<=9?t<<24>>24:((e+-97&255)>>>0<26?e+-87|0:-1)<<24>>24}(o[0|e]),s[r>>2]=n,i=g(a=t-n|0),o[i+(a=a+-1|0)|0]=0,(0|a)>=1&&function(e,t,r){var n,i=0;if(r>>>0>=8192)d(0|e,0|t,0|r);else{n=e+r|0;e:if(3&(e^t))if(n>>>0<4)r=e;else if((i=n+-4|0)>>>0<e>>>0)r=e;else for(r=e;o[0|r]=u[0|t],o[r+1|0]=u[t+1|0],o[r+2|0]=u[t+2|0],o[r+3|0]=u[t+3|0],t=t+4|0,(r=r+4|0)>>>0<=i>>>0;);else{t:if((0|r)<1)r=e;else if(3&e)for(r=e;;){if(o[0|r]=u[0|t],t=t+1|0,(r=r+1|0)>>>0>=n>>>0)break t;if(!(3&r))break}else r=e;if(!((e=-4&n)>>>0<64||r>>>0>(i=e+-64|0)>>>0))for(;s[r>>2]=s[t>>2],s[r+4>>2]=s[t+4>>2],s[r+8>>2]=s[t+8>>2],s[r+12>>2]=s[t+12>>2],s[r+16>>2]=s[t+16>>2],s[r+20>>2]=s[t+20>>2],s[r+24>>2]=s[t+24>>2],s[r+28>>2]=s[t+28>>2],s[r+32>>2]=s[t+32>>2],s[r+36>>2]=s[t+36>>2],s[r+40>>2]=s[t+40>>2],s[r+44>>2]=s[t+44>>2],s[r+48>>2]=s[t+48>>2],s[r+52>>2]=s[t+52>>2],s[r+56>>2]=s[t+56>>2],s[r+60>>2]=s[t+60>>2],t=t- -64|0,(r=r- -64|0)>>>0<=i>>>0;);if(r>>>0>=e>>>0)break e;for(;s[r>>2]=s[t>>2],t=t+4|0,(r=r+4|0)>>>0<e>>>0;);}if(r>>>0<n>>>0)for(;o[0|r]=u[0|t],t=t+1|0,(0|n)!=(0|(r=r+1|0)););}}(i,e+1|0,t+(-1^n)|0),v(e),v(s[r+8>>2]),m=r+16|0,0|i},free:v,__errno_location:function(){return 1024},fflush:function e(t){var r=0;if(t|=0)return s[t+76>>2],0|b(t);if(s[260]&&(r=e(s[260])),p(1028),t=s[259])for(;c[t+20>>2]>c[t+28>>2]&&(r=b(t)|r),t=s[t+56>>2];);return f(1028),0|r},setThrew:function(e,t){e|=0,t|=0,s[385]||(s[386]=t,s[385]=e)},stackSave:function(){return 0|m},stackAlloc:function(e){return m=e=m-(e|=0)&-16,0|e},stackRestore:function(e){m=e|=0},__growWasmMemory:function(t){return 0|function(t){t|=0;var r=0|T(),a=r+t|0;if(r<a&&a<65536){var d=new ArrayBuffer(l(a,65536)),h=new e.Int8Array(d);h.set(o),o=h,o=new e.Int8Array(d),new e.Int16Array(d),s=new e.Int32Array(d),u=new e.Uint8Array(d),new e.Uint16Array(d),c=new e.Uint32Array(d),new e.Float32Array(d),new e.Float64Array(d),n=d,i.buffer=d}return r}(0|(t|=0))}}}({Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:1/0,Math:Math},z,h.buffer));return{exports:n}},instantiate:function(e,t){return{then:function(r,n){r({instance:new f.Instance(new f.Module(e,t))})}}},RuntimeError:Error};u=[],"object"!==_typeof$5(f)&&W("No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.");var p=new f.Table({initial:1,maximum:1,element:"anyfunc"}),m=!1;function y(e,t){e||W("Assertion failed: "+t)}var g="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function v(e,t,r,n){if(!(n>0))return 0;for(var i=r,a=r+n-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o);if(s<=127){if(r>=a)break;t[r++]=s}else if(s<=2047){if(r+1>=a)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=a)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=a)break;s>=2097152&&d("Invalid Unicode code point 0x"+s.toString(16)+" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)."),t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-i}function b(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++r)),n<=127?++t:t+=n<=2047?2:n<=65535?3:4}return t}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var _,A,T,E,S;function $(e,t){return e%t>0&&(e+=t-e%t),e}function I(e){_=e,n.HEAP8=A=new Int8Array(e),n.HEAP16=new Int16Array(e),n.HEAP32=E=new Int32Array(e),n.HEAPU8=T=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAPU32=S=new Uint32Array(e),n.HEAPF32=new Float32Array(e),n.HEAPF64=new Float64Array(e)}var w=1712;y(!0,"stack must start aligned"),y(!0,"heap must start aligned");var R=8192;n.TOTAL_STACK&&y(R===n.TOTAL_STACK,"the stack size can no longer be determined at runtime");var k=n.TOTAL_MEMORY||65536;function P(){y(0==(3&w)),S[1+(w>>2)]=34821223,S[2+(w>>2)]=2310721022,E[0]=1668509029}function C(){var e=S[1+(w>>2)],t=S[2+(w>>2)];34821223==e&&2310721022==t||W("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+t.toString(16)+" "+e.toString(16)),1668509029!==E[0]&&W("Runtime error: The application has corrupted its heap memory area (address zero)!")}function x(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?n.dynCall_v(r):n.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}Object.getOwnPropertyDescriptor(n,"TOTAL_MEMORY")||Object.defineProperty(n,"TOTAL_MEMORY",{configurable:!0,get:function(){W("Module.TOTAL_MEMORY has been replaced with plain INITIAL_TOTAL_MEMORY")}}),y(k>=R,"TOTAL_MEMORY should be larger than TOTAL_STACK, was "+k+"! (TOTAL_STACK="+R+")"),y("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&void 0!==Int32Array.prototype.subarray&&void 0!==Int32Array.prototype.set,"JS engine does not provide full typed array support"),(h=n.wasmMemory?n.wasmMemory:new f.Memory({initial:k/65536}))&&(_=h.buffer),y((k=_.byteLength)%65536==0),I(_),E[388]=9904,function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,115!==t[0]||99!==t[1])throw"Runtime error: expected the system to be little-endian!"}();var L=[],O=[],D=[],M=[],Z=!1;y(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),y(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),y(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),y(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 V=0,N=null,G=null,X={};function W(e){throw n.onAbort&&n.onAbort(e),c(e+=""),l(e),m=!0,e="abort("+e+") at "+function(){var e=function(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(t){e=t}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}();n.extraStackTrace&&(e+="\n"+n.extraStackTrace());return t=e,r=/\b_Z[\w\d_]+/g,t.replace(r,(function(e){var t,r=(t=e,d("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),t);return e===r?e:r+" ["+e+"]"}));var t,r}(),new f.RuntimeError(e)}n.preloadedImages={},n.preloadedAudios={};var U={error:function(){W("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -s FORCE_FILESYSTEM=1")},init:function(){U.error()},createDataFile:function(){U.error()},createPreloadedFile:function(){U.error()},createLazyFile:function(){U.error()},open:function(){U.error()},mkdev:function(){U.error()},registerDevice:function(){U.error()},analyzePath:function(){U.error()},loadFilesFromDB:function(){U.error()},ErrnoError:function(){U.error()}};n.FS_createDataFile=U.createDataFile,n.FS_createPreloadedFile=U.createPreloadedFile;var F="data:application/octet-stream;base64,";function B(e){return String.prototype.startsWith?e.startsWith(F):0===e.indexOf(F)}var Y,j="aw.wasm";function K(){try{if(u)return new Uint8Array(u);var e=function(e){if(!B(e))return;return function(e){try{for(var t=H(e),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}catch(e){throw new Error("Converting base64 string to bytes failed.")}}(e.slice(F.length))}(j);if(e)return e;if(!o)throw"both async and sync fetching of the wasm failed"}catch(e){W(e)}}B(j)||(Y=j,j=n.locateFile?n.locateFile(Y,s):s+Y),O.push({func:function(){ce()}});var H="function"==typeof atob?atob:function(e){var t,r,n,i,a,o,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=s.indexOf(e.charAt(c++))<<2|(i=s.indexOf(e.charAt(c++)))>>4,r=(15&i)<<4|(a=s.indexOf(e.charAt(c++)))>>2,n=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),u+=String.fromCharCode(t),64!==a&&(u+=String.fromCharCode(r)),64!==o&&(u+=String.fromCharCode(n))}while(c<e.length);return u};var z={__lock:function(){},__unlock:function(){},emscripten_memcpy_big:function(e,t,r){T.set(T.subarray(t,t+r),e)},emscripten_resize_heap:function(e){var t=A.length;y(e>t);var r=65536,n=2147418112;if(e>n)return l("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is "+n+" bytes!"),!1;for(var i=Math.max(t,16777216);i<e;)(i=i<=536870912?$(2*i,r):Math.min($((3*i+2147483648)/4,r),n))===t&&d("Cannot ask for more memory since we reached the practical limit in browsers (which is just below 2GB), so the request would have failed. Requesting only "+A.length);return function(e){try{return h.grow(e-_.byteLength+65535>>16),I(h.buffer),1}catch(t){console.error("emscripten_realloc_buffer: Attempted to grow heap from "+_.byteLength+" bytes to "+e+" bytes, but got error: "+t)}}(i)?(l("Warning: Enlarging memory arrays, this is not fast! "+[t,i]),!0):(l("Failed to grow the heap from "+t+" bytes to "+i+" bytes, not enough memory!"),!1)},memory:h,table:p},J=function(){var e,t={env:z,wasi_unstable:z};function r(e,t){var r=e.exports;n.asm=r,function(e){if(V--,n.monitorRunDependencies&&n.monitorRunDependencies(V),e?(y(X[e]),delete X[e]):l("warning: run dependency removed without ID"),0==V&&(null!==N&&(clearInterval(N),N=null),G)){var t=G;G=null,t()}}("wasm-instantiate")}e="wasm-instantiate",V++,n.monitorRunDependencies&&n.monitorRunDependencies(V),e?(y(!X[e]),X[e]=1,null===N&&"undefined"!=typeof setInterval&&(N=setInterval((function(){if(m)return clearInterval(N),void(N=null);var e=!1;for(var t in X)e||(e=!0,l("still waiting on run dependencies:")),l("dependency: "+t);e&&l("(end of list)")}),1e4))):l("warning: run dependency added without ID");var i=n;function o(e){y(n===i,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),i=null,r(e.instance)}function s(e){return(!u&&a&&"function"==typeof fetch?fetch(j,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+j+"'";return e.arrayBuffer()})).catch((function(){return K()})):new Promise((function(e,t){e(K())}))).then((function(e){return f.instantiate(e,t)})).then(e,(function(e){l("failed to asynchronously prepare wasm: "+e),W(e)}))}if(n.instantiateWasm)try{return n.instantiateWasm(t,r)}catch(e){return l("Module.instantiateWasm callback failed with error: "+e),!1}return function(){if(u||"function"!=typeof f.instantiateStreaming||B(j)||"function"!=typeof fetch)return s(o);fetch(j,{credentials:"same-origin"}).then((function(e){return f.instantiateStreaming(e,t).then(o,(function(e){l("wasm streaming compile failed: "+e),l("falling back to ArrayBuffer instantiation"),s(o)}))}))}(),{}}(),Q=J.__wasm_call_ctors;J.__wasm_call_ctors=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Q.apply(null,arguments)};var q=J.malloc;J.malloc=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),q.apply(null,arguments)};var ee=J.openBox;J.openBox=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ee.apply(null,arguments)};var te=J.free;J.free=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),te.apply(null,arguments)};var re=J.__errno_location;J.__errno_location=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),re.apply(null,arguments)};var ne=J.fflush;J.fflush=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ne.apply(null,arguments)};var ie=J.setThrew;J.setThrew=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ie.apply(null,arguments)};var ae=J.stackSave;J.stackSave=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ae.apply(null,arguments)};var oe=J.stackAlloc;J.stackAlloc=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),oe.apply(null,arguments)};var se=J.stackRestore;J.stackRestore=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),se.apply(null,arguments)};var ue=J.__growWasmMemory;J.__growWasmMemory=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ue.apply(null,arguments)},n.asm=J;var ce=n.___wasm_call_ctors=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.__wasm_call_ctors.apply(null,arguments)},le=n._malloc=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.malloc.apply(null,arguments)};n._openBox=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.openBox.apply(null,arguments)},n._free=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.free.apply(null,arguments)},n.___errno_location=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.__errno_location.apply(null,arguments)},n._fflush=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.fflush.apply(null,arguments)},n._setThrew=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.setThrew.apply(null,arguments)};var de=n.stackSave=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.stackSave.apply(null,arguments)};n.stackAlloc=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.stackAlloc.apply(null,arguments)},n.stackRestore=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.stackRestore.apply(null,arguments)};var he,fe=n.__growWasmMemory=function(){return y(Z,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),y(!0,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n.asm.__growWasmMemory.apply(null,arguments)};function pe(e){function t(){he||(he=!0,m||(C(),y(!Z),Z=!0,x(O),C(),x(D),n.onRuntimeInitialized&&n.onRuntimeInitialized(),y(!n._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),function(){if(C(),n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),M.unshift(e);var e;x(M)}()))}V>0||(P(),function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),L.unshift(e);var e;x(L)}(),V>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),t()}),1)):t(),C()))}if(n.asm=J,n.intArrayFromString=function(e,t,r){var n=r>0?r:b(e)+1,i=new Array(n),a=v(e,i,0,i.length);return t&&(i.length=a),i},Object.getOwnPropertyDescriptor(n,"intArrayToString")||(n.intArrayToString=function(){W("'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"ccall")||(n.ccall=function(){W("'ccall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"cwrap")||(n.cwrap=function(){W("'cwrap' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"setValue")||(n.setValue=function(){W("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getValue")||(n.getValue=function(){W("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"allocate")||(n.allocate=function(){W("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getMemory")||(n.getMemory=function(){W("'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"AsciiToString")||(n.AsciiToString=function(){W("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToAscii")||(n.stringToAscii=function(){W("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"UTF8ArrayToString")||(n.UTF8ArrayToString=function(){W("'UTF8ArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.UTF8ToString=function(e,t){return e?function(e,t,r){for(var n=t+r,i=t;e[i]&&!(i>=n);)++i;if(i-t>16&&e.subarray&&g)return g.decode(e.subarray(t,i));for(var a="";t<i;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if(224==(240&o)?o=(15&o)<<12|s<<6|u:(240!=(248&o)&&d("Invalid UTF-8 leading byte 0x"+o.toString(16)+" encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!"),o=(7&o)<<18|s<<12|u<<6|63&e[t++]),o<65536)a+=String.fromCharCode(o);else{var c=o-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}(T,e,t):""},Object.getOwnPropertyDescriptor(n,"stringToUTF8Array")||(n.stringToUTF8Array=function(){W("'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToUTF8")||(n.stringToUTF8=function(){W("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"lengthBytesUTF8")||(n.lengthBytesUTF8=function(){W("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"UTF16ToString")||(n.UTF16ToString=function(){W("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToUTF16")||(n.stringToUTF16=function(){W("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"lengthBytesUTF16")||(n.lengthBytesUTF16=function(){W("'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"UTF32ToString")||(n.UTF32ToString=function(){W("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stringToUTF32")||(n.stringToUTF32=function(){W("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"lengthBytesUTF32")||(n.lengthBytesUTF32=function(){W("'lengthBytesUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.allocateUTF8=function(e){var t=b(e)+1,r=le(t);return r&&v(e,A,r,t),r},Object.getOwnPropertyDescriptor(n,"stackTrace")||(n.stackTrace=function(){W("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnPreRun")||(n.addOnPreRun=function(){W("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnInit")||(n.addOnInit=function(){W("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnPreMain")||(n.addOnPreMain=function(){W("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnExit")||(n.addOnExit=function(){W("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addOnPostRun")||(n.addOnPostRun=function(){W("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"writeStringToMemory")||(n.writeStringToMemory=function(){W("'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"writeArrayToMemory")||(n.writeArrayToMemory=function(){W("'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"writeAsciiToMemory")||(n.writeAsciiToMemory=function(){W("'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addRunDependency")||(n.addRunDependency=function(){W("'addRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"removeRunDependency")||(n.removeRunDependency=function(){W("'removeRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"ENV")||(n.ENV=function(){W("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"FS")||(n.FS=function(){W("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"FS_createFolder")||(n.FS_createFolder=function(){W("'FS_createFolder' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createPath")||(n.FS_createPath=function(){W("'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createDataFile")||(n.FS_createDataFile=function(){W("'FS_createDataFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createPreloadedFile")||(n.FS_createPreloadedFile=function(){W("'FS_createPreloadedFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createLazyFile")||(n.FS_createLazyFile=function(){W("'FS_createLazyFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createLink")||(n.FS_createLink=function(){W("'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_createDevice")||(n.FS_createDevice=function(){W("'FS_createDevice' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"FS_unlink")||(n.FS_unlink=function(){W("'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(n,"GL")||(n.GL=function(){W("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"dynamicAlloc")||(n.dynamicAlloc=function(){W("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"loadDynamicLibrary")||(n.loadDynamicLibrary=function(){W("'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"loadWebAssemblyModule")||(n.loadWebAssemblyModule=function(){W("'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getLEB")||(n.getLEB=function(){W("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getFunctionTables")||(n.getFunctionTables=function(){W("'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"alignFunctionTables")||(n.alignFunctionTables=function(){W("'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"registerFunctions")||(n.registerFunctions=function(){W("'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"addFunction")||(n.addFunction=function(){W("'addFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"removeFunction")||(n.removeFunction=function(){W("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getFuncWrapper")||(n.getFuncWrapper=function(){W("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"prettyPrint")||(n.prettyPrint=function(){W("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"makeBigInt")||(n.makeBigInt=function(){W("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"dynCall")||(n.dynCall=function(){W("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getCompilerSetting")||(n.getCompilerSetting=function(){W("'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stackSave")||(n.stackSave=function(){W("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stackRestore")||(n.stackRestore=function(){W("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"stackAlloc")||(n.stackAlloc=function(){W("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"establishStackSpace")||(n.establishStackSpace=function(){W("'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"print")||(n.print=function(){W("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"printErr")||(n.printErr=function(){W("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"getTempRet0")||(n.getTempRet0=function(){W("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"setTempRet0")||(n.setTempRet0=function(){W("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"callMain")||(n.callMain=function(){W("'callMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"abort")||(n.abort=function(){W("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.Pointer_stringify=function(e,t){W("this function has been removed - you should use UTF8ToString(ptr, maxBytesToRead) instead!")},Object.getOwnPropertyDescriptor(n,"warnOnce")||(n.warnOnce=function(){W("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),n.writeStackCookie=P,n.checkStackCookie=C,n.abortStackOverflow=function(e){W("Stack overflow! Attempted to allocate "+e+" bytes on the stack, but stack has only "+(w-de()+e)+" bytes available!")},Object.getOwnPropertyDescriptor(n,"intArrayFromBase64")||(n.intArrayFromBase64=function(){W("'intArrayFromBase64' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"tryParseAsDataURI")||(n.tryParseAsDataURI=function(){W("'tryParseAsDataURI' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(n,"ALLOC_NORMAL")||Object.defineProperty(n,"ALLOC_NORMAL",{configurable:!0,get:function(){W("'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(n,"ALLOC_STACK")||Object.defineProperty(n,"ALLOC_STACK",{configurable:!0,get:function(){W("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(n,"ALLOC_DYNAMIC")||Object.defineProperty(n,"ALLOC_DYNAMIC",{configurable:!0,get:function(){W("'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(n,"ALLOC_NONE")||Object.defineProperty(n,"ALLOC_NONE",{configurable:!0,get:function(){W("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(n,"calledRun")||Object.defineProperty(n,"calledRun",{configurable:!0,get:function(){W("'calledRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}}),n.then=function(e){if(he)e(n);else{var t=n.onRuntimeInitialized;n.onRuntimeInitialized=function(){t&&t(),e(n)}}return n},G=function e(){he||pe(),he||(G=e)},n.run=pe,n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return pe(),t}}(),AwManager=function(){function e(t,r){_classCallCheck$d(this,e),this.cdnHost=t,this.cdnBucket=r}return _createClass$d(e,[{key:"init",value:function(){var e=new ProxyPromise;this.module={onRuntimeInitialized:function(){e.resolve()},onAbort:function(t){e.reject(t)}},this.cdnHost&&(this.module.cdnHost=this.cdnHost);var t=this.cdnBucket?"-".concat(this.cdnBucket):"";return this.module.cdnBucket="media-fe".concat(t),aw(this.module),e}},{key:"openBox",value:function(e){try{var t=window.atob(e),r=util$1.str2hex(t),n=this.module._malloc(Number(r.length));this.module.HEAP8.set(r,n);var i=this.module._openBox(Number(n),r.length),a=this.module.UTF8ToString(i);return this.module._free(n),a}catch(e){}}},{key:"destroy",value:function(){this.module=null}}]),e}(),$$g=_export,$some=arrayIteration.some,arrayMethodIsStrict$2=arrayMethodIsStrict$8,STRICT_METHOD$2=arrayMethodIsStrict$2("some");$$g({target:"Array",proto:!0,forced:!STRICT_METHOD$2},{some:function(e){return $some(this,e,arguments.length>1?arguments[1]:void 0)}});var wellKnownSymbolWrapped={},wellKnownSymbol$3=wellKnownSymbol$u;wellKnownSymbolWrapped.f=wellKnownSymbol$3;var global$5=global$M,path$1=global$5,path=path$1,hasOwn$5=hasOwnProperty_1,wrappedWellKnownSymbolModule$1=wellKnownSymbolWrapped,defineProperty$2=objectDefineProperty.f,wellKnownSymbolDefine=function(e){var t=path.Symbol||(path.Symbol={});hasOwn$5(t,e)||defineProperty$2(t,e,{value:wrappedWellKnownSymbolModule$1.f(e)})},call$1=functionCall,getBuiltIn$2=getBuiltIn$d,wellKnownSymbol$2=wellKnownSymbol$u,defineBuiltIn$2=defineBuiltIn$j,symbolDefineToPrimitive=function(){var e=getBuiltIn$2("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=wellKnownSymbol$2("toPrimitive");t&&!t[n]&&defineBuiltIn$2(t,n,(function(e){return call$1(r,this)}),{arity:1})},$$f=_export,global$4=global$M,call=functionCall,uncurryThis$6=functionUncurryThis,DESCRIPTORS$4=descriptors,NATIVE_SYMBOL$3=symbolConstructorDetection,fails$7=fails$V,hasOwn$4=hasOwnProperty_1,isPrototypeOf$2=objectIsPrototypeOf,anObject$1=anObject$m,toIndexedObject$1=toIndexedObject$d,toPropertyKey=toPropertyKey$5,$toString=toString$l,createPropertyDescriptor=createPropertyDescriptor$7,nativeObjectCreate=objectCreate,objectKeys$1=objectKeys$4,getOwnPropertyNamesModule=objectGetOwnPropertyNames,getOwnPropertyNamesExternal=objectGetOwnPropertyNamesExternal,getOwnPropertySymbolsModule$1=objectGetOwnPropertySymbols,getOwnPropertyDescriptorModule=objectGetOwnPropertyDescriptor,definePropertyModule=objectDefineProperty,definePropertiesModule=objectDefineProperties,propertyIsEnumerableModule=objectPropertyIsEnumerable,defineBuiltIn$1=defineBuiltIn$j,shared$2=sharedExports,sharedKey=sharedKey$4,hiddenKeys=hiddenKeys$6,uid=uid$5,wellKnownSymbol$1=wellKnownSymbol$u,wrappedWellKnownSymbolModule=wellKnownSymbolWrapped,defineWellKnownSymbol=wellKnownSymbolDefine,defineSymbolToPrimitive=symbolDefineToPrimitive,setToStringTag=setToStringTag$8,InternalStateModule=internalState,$forEach=arrayIteration.forEach,HIDDEN=sharedKey("hidden"),SYMBOL="Symbol",PROTOTYPE="prototype",setInternalState=InternalStateModule.set,getInternalState$1=InternalStateModule.getterFor(SYMBOL),ObjectPrototype$1=Object[PROTOTYPE],$Symbol=global$4.Symbol,SymbolPrototype$1=$Symbol&&$Symbol[PROTOTYPE],TypeError$1=global$4.TypeError,QObject=global$4.QObject,nativeGetOwnPropertyDescriptor=getOwnPropertyDescriptorModule.f,nativeDefineProperty=definePropertyModule.f,nativeGetOwnPropertyNames=getOwnPropertyNamesExternal.f,nativePropertyIsEnumerable=propertyIsEnumerableModule.f,push$3=uncurryThis$6([].push),AllSymbols=shared$2("symbols"),ObjectPrototypeSymbols=shared$2("op-symbols"),WellKnownSymbolsStore=shared$2("wks"),USE_SETTER=!QObject||!QObject[PROTOTYPE]||!QObject[PROTOTYPE].findChild,setSymbolDescriptor=DESCRIPTORS$4&&fails$7((function(){return 7!=nativeObjectCreate(nativeDefineProperty({},"a",{get:function(){return nativeDefineProperty(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=nativeGetOwnPropertyDescriptor(ObjectPrototype$1,t);n&&delete ObjectPrototype$1[t],nativeDefineProperty(e,t,r),n&&e!==ObjectPrototype$1&&nativeDefineProperty(ObjectPrototype$1,t,n)}:nativeDefineProperty,wrap=function(e,t){var r=AllSymbols[e]=nativeObjectCreate(SymbolPrototype$1);return setInternalState(r,{type:SYMBOL,tag:e,description:t}),DESCRIPTORS$4||(r.description=t),r},$defineProperty=function(e,t,r){e===ObjectPrototype$1&&$defineProperty(ObjectPrototypeSymbols,t,r),anObject$1(e);var n=toPropertyKey(t);return anObject$1(r),hasOwn$4(AllSymbols,n)?(r.enumerable?(hasOwn$4(e,HIDDEN)&&e[HIDDEN][n]&&(e[HIDDEN][n]=!1),r=nativeObjectCreate(r,{enumerable:createPropertyDescriptor(0,!1)})):(hasOwn$4(e,HIDDEN)||nativeDefineProperty(e,HIDDEN,createPropertyDescriptor(1,{})),e[HIDDEN][n]=!0),setSymbolDescriptor(e,n,r)):nativeDefineProperty(e,n,r)},$defineProperties=function(e,t){anObject$1(e);var r=toIndexedObject$1(t),n=objectKeys$1(r).concat($getOwnPropertySymbols(r));return $forEach(n,(function(t){DESCRIPTORS$4&&!call($propertyIsEnumerable$1,r,t)||$defineProperty(e,t,r[t])})),e},$create=function(e,t){return void 0===t?nativeObjectCreate(e):$defineProperties(nativeObjectCreate(e),t)},$propertyIsEnumerable$1=function(e){var t=toPropertyKey(e),r=call(nativePropertyIsEnumerable,this,t);return!(this===ObjectPrototype$1&&hasOwn$4(AllSymbols,t)&&!hasOwn$4(ObjectPrototypeSymbols,t))&&(!(r||!hasOwn$4(this,t)||!hasOwn$4(AllSymbols,t)||hasOwn$4(this,HIDDEN)&&this[HIDDEN][t])||r)},$getOwnPropertyDescriptor=function(e,t){var r=toIndexedObject$1(e),n=toPropertyKey(t);if(r!==ObjectPrototype$1||!hasOwn$4(AllSymbols,n)||hasOwn$4(ObjectPrototypeSymbols,n)){var i=nativeGetOwnPropertyDescriptor(r,n);return!i||!hasOwn$4(AllSymbols,n)||hasOwn$4(r,HIDDEN)&&r[HIDDEN][n]||(i.enumerable=!0),i}},$getOwnPropertyNames=function(e){var t=nativeGetOwnPropertyNames(toIndexedObject$1(e)),r=[];return $forEach(t,(function(e){hasOwn$4(AllSymbols,e)||hasOwn$4(hiddenKeys,e)||push$3(r,e)})),r},$getOwnPropertySymbols=function(e){var t=e===ObjectPrototype$1,r=nativeGetOwnPropertyNames(t?ObjectPrototypeSymbols:toIndexedObject$1(e)),n=[];return $forEach(r,(function(e){!hasOwn$4(AllSymbols,e)||t&&!hasOwn$4(ObjectPrototype$1,e)||push$3(n,AllSymbols[e])})),n};NATIVE_SYMBOL$3||(defineBuiltIn$1(SymbolPrototype$1=($Symbol=function(){if(isPrototypeOf$2(SymbolPrototype$1,this))throw TypeError$1("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?$toString(arguments[0]):void 0,t=uid(e),r=function(e){this===ObjectPrototype$1&&call(r,ObjectPrototypeSymbols,e),hasOwn$4(this,HIDDEN)&&hasOwn$4(this[HIDDEN],t)&&(this[HIDDEN][t]=!1),setSymbolDescriptor(this,t,createPropertyDescriptor(1,e))};return DESCRIPTORS$4&&USE_SETTER&&setSymbolDescriptor(ObjectPrototype$1,t,{configurable:!0,set:r}),wrap(t,e)})[PROTOTYPE],"toString",(function(){return getInternalState$1(this).tag})),defineBuiltIn$1($Symbol,"withoutSetter",(function(e){return wrap(uid(e),e)})),propertyIsEnumerableModule.f=$propertyIsEnumerable$1,definePropertyModule.f=$defineProperty,definePropertiesModule.f=$defineProperties,getOwnPropertyDescriptorModule.f=$getOwnPropertyDescriptor,getOwnPropertyNamesModule.f=getOwnPropertyNamesExternal.f=$getOwnPropertyNames,getOwnPropertySymbolsModule$1.f=$getOwnPropertySymbols,wrappedWellKnownSymbolModule.f=function(e){return wrap(wellKnownSymbol$1(e),e)},DESCRIPTORS$4&&(nativeDefineProperty(SymbolPrototype$1,"description",{configurable:!0,get:function(){return getInternalState$1(this).description}}),defineBuiltIn$1(ObjectPrototype$1,"propertyIsEnumerable",$propertyIsEnumerable$1,{unsafe:!0}))),$$f({global:!0,constructor:!0,wrap:!0,forced:!NATIVE_SYMBOL$3,sham:!NATIVE_SYMBOL$3},{Symbol:$Symbol}),$forEach(objectKeys$1(WellKnownSymbolsStore),(function(e){defineWellKnownSymbol(e)})),$$f({target:SYMBOL,stat:!0,forced:!NATIVE_SYMBOL$3},{useSetter:function(){USE_SETTER=!0},useSimple:function(){USE_SETTER=!1}}),$$f({target:"Object",stat:!0,forced:!NATIVE_SYMBOL$3,sham:!DESCRIPTORS$4},{create:$create,defineProperty:$defineProperty,defineProperties:$defineProperties,getOwnPropertyDescriptor:$getOwnPropertyDescriptor}),$$f({target:"Object",stat:!0,forced:!NATIVE_SYMBOL$3},{getOwnPropertyNames:$getOwnPropertyNames}),defineSymbolToPrimitive(),setToStringTag($Symbol,SYMBOL),hiddenKeys[HIDDEN]=!0;var NATIVE_SYMBOL$2=symbolConstructorDetection,symbolRegistryDetection=NATIVE_SYMBOL$2&&!!Symbol.for&&!!Symbol.keyFor,$$e=_export,getBuiltIn$1=getBuiltIn$d,hasOwn$3=hasOwnProperty_1,toString$5=toString$l,shared$1=sharedExports,NATIVE_SYMBOL_REGISTRY$1=symbolRegistryDetection,StringToSymbolRegistry=shared$1("string-to-symbol-registry"),SymbolToStringRegistry$1=shared$1("symbol-to-string-registry");$$e({target:"Symbol",stat:!0,forced:!NATIVE_SYMBOL_REGISTRY$1},{for:function(e){var t=toString$5(e);if(hasOwn$3(StringToSymbolRegistry,t))return StringToSymbolRegistry[t];var r=getBuiltIn$1("Symbol")(t);return StringToSymbolRegistry[t]=r,SymbolToStringRegistry$1[r]=t,r}});var $$d=_export,hasOwn$2=hasOwnProperty_1,isSymbol=isSymbol$6,tryToString=tryToString$7,shared=sharedExports,NATIVE_SYMBOL_REGISTRY=symbolRegistryDetection,SymbolToStringRegistry=shared("symbol-to-string-registry");$$d({target:"Symbol",stat:!0,forced:!NATIVE_SYMBOL_REGISTRY},{keyFor:function(e){if(!isSymbol(e))throw TypeError(tryToString(e)+" is not a symbol");if(hasOwn$2(SymbolToStringRegistry,e))return SymbolToStringRegistry[e]}});var $$c=_export,NATIVE_SYMBOL$1=symbolConstructorDetection,fails$6=fails$V,getOwnPropertySymbolsModule=objectGetOwnPropertySymbols,toObject$1=toObject$h,FORCED$4=!NATIVE_SYMBOL$1||fails$6((function(){getOwnPropertySymbolsModule.f(1)}));$$c({target:"Object",stat:!0,forced:FORCED$4},{getOwnPropertySymbols:function(e){var t=getOwnPropertySymbolsModule.f;return t?t(toObject$1(e)):[]}});var $$b=_export,DESCRIPTORS$3=descriptors,global$3=global$M,uncurryThis$5=functionUncurryThis,hasOwn$1=hasOwnProperty_1,isCallable=isCallable$v,isPrototypeOf$1=objectIsPrototypeOf,toString$4=toString$l,defineProperty$1=objectDefineProperty.f,copyConstructorProperties=copyConstructorProperties$2,NativeSymbol=global$3.Symbol,SymbolPrototype=NativeSymbol&&NativeSymbol.prototype;if(DESCRIPTORS$3&&isCallable(NativeSymbol)&&(!("description"in SymbolPrototype)||void 0!==NativeSymbol().description)){var EmptyStringDescriptionStore={},SymbolWrapper=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:toString$4(arguments[0]),t=isPrototypeOf$1(SymbolPrototype,this)?new NativeSymbol(e):void 0===e?NativeSymbol():NativeSymbol(e);return""===e&&(EmptyStringDescriptionStore[t]=!0),t};copyConstructorProperties(SymbolWrapper,NativeSymbol),SymbolWrapper.prototype=SymbolPrototype,SymbolPrototype.constructor=SymbolWrapper;var NATIVE_SYMBOL="Symbol(test)"==String(NativeSymbol("test")),thisSymbolValue=uncurryThis$5(SymbolPrototype.valueOf),symbolDescriptiveString=uncurryThis$5(SymbolPrototype.toString),regexp=/^Symbol\((.*)\)[^)]+$/,replace$1=uncurryThis$5("".replace),stringSlice$2=uncurryThis$5("".slice);defineProperty$1(SymbolPrototype,"description",{configurable:!0,get:function(){var e=thisSymbolValue(this);if(hasOwn$1(EmptyStringDescriptionStore,e))return"";var t=symbolDescriptiveString(e),r=NATIVE_SYMBOL?stringSlice$2(t,7,-1):replace$1(t,regexp,"$1");return""===r?void 0:r}}),$$b({global:!0,constructor:!0,forced:!0},{Symbol:SymbolWrapper})}var ArrayBufferViewCore=arrayBufferViewCore,TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS=typedArrayConstructorsRequireWrappers,aTypedArrayConstructor=ArrayBufferViewCore.aTypedArrayConstructor,exportTypedArrayStaticMethod=ArrayBufferViewCore.exportTypedArrayStaticMethod;function isMSBrowser(){var e=window.navigator.userAgent,t=e.indexOf("MSIE "),r=e.indexOf("Trident/");return t>0||r>0}function checkIsQihuBrowser(){var e=navigator.mimeTypes,t=navigator.userAgent,r=!1;return e&&t.indexOf("Chrome")>1&&(r=Object.keys(e).some((function(t){return!!(e[t].type&&e[t].type.indexOf("360")>-1)||(!!(e[t].type&&e[t].type.indexOf("application/vnd.chromium.remoting-viewer")>-1)||!!(e[t].description&&e[t].description.indexOf("360")>-1))}))),r}function isEMESupported(){var e,t,r,n,i;return!(!navigator.requestMediaKeySystemAccess||(e=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),t=isMSBrowser(),r=checkIsQihuBrowser(),n=navigator.userAgent.indexOf("Firefox")>0,i=navigator.userAgent.indexOf("Edge")>0,e||t||r||n||i))}function isWebAssemblySupported(){try{if("object"===("undefined"==typeof WebAssembly?"undefined":_typeof$5(WebAssembly))&&"function"==typeof WebAssembly.instantiate){var 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){console.log(e)}return!1}function isMediaSourceSupported(){var e=window.MediaSource=window.MediaSource||window.WebKitMediaSource;return e&&"function"==typeof e.isTypeSupported}function isSupported$1(){return isMediaSourceSupported()&&isWebAssemblySupported()&&!isMSBrowser()}function isSupportedWithXgmse(){return isWebAssemblySupported()&&!isMSBrowser()}exportTypedArrayStaticMethod("of",(function(){for(var e=0,t=arguments.length,r=new(aTypedArrayConstructor(this))(t);t>e;)r[e]=arguments[e++];return r}),TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS);var Timer=function(){function e(t){_classCallCheck$d(this,e),this.onTick_=t,this.cancelPending_=null}return _createClass$d(e,[{key:"tickAfter",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.stop();var n=!0,i=null;this.cancelPending_=function(){window.clearTimeout(i),n=!1};return i=window.setTimeout((function(){n&&(t.onTick_(),r&&r())}),1e3*e),this}},{key:"tickEvery",value:function(e){var t=this;this.tickAfter(e,(function(){t.tickEvery(e)}))}},{key:"stop",value:function(){this.cancelPending_&&(this.cancelPending_(),this.cancelPending_=null)}}]),e}(),global$2=global$M,fails$5=fails$V,uncurryThis$4=functionUncurryThis,toString$3=toString$l,trim2=stringTrim.trim,whitespaces=whitespaces$4,charAt$1=uncurryThis$4("".charAt),$parseFloat$1=global$2.parseFloat,Symbol$1=global$2.Symbol,ITERATOR=Symbol$1&&Symbol$1.iterator,FORCED$3=1/$parseFloat$1(whitespaces+"-0")!=-1/0||ITERATOR&&!fails$5((function(){$parseFloat$1(Object(ITERATOR))})),numberParseFloat=FORCED$3?function(e){var t=trim2(toString$3(e)),r=$parseFloat$1(t);return 0===r&&"-"==charAt$1(t,0)?-0:r}:$parseFloat$1,$$a=_export,$parseFloat=numberParseFloat;$$a({global:!0,forced:parseFloat!=numberParseFloat},{parseFloat:numberParseFloat});var PRELOAD_NEXT="PRELOAD_NEXT",PRELOAD_SEG_DONE="PRELOAD_SEG_DONE",STATES={PREPARE:"PREPARE",IDLE:"IDLE",PRELOADING:"PRELOADING",FINISH:"FINISH"},ONE_STEP_DONE="ONE_STEP_DONE",PRELOAD_TYPES$1={DURATION:0,SIZE:1},CACHE_TYPES={INDEXDB:0,MEMORY:1},DOWN_STATES={FAIL:-1,SUCCESS:0,DOWNLOADING:1},VTYPES$1={MP4:"MP4",DASH:"DASH",HLS:"HLS"};function _typeof$3(e){return(_typeof$3="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck$7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$7(e,t,r){return t&&_defineProperties$7(e.prototype,t),r&&_defineProperties$7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var isImplemented$1,hasRequiredIsImplemented,eventEmitter={exports:{}},d$1={exports:{}},_undefined$1=void 0,is$4=function(e){return e!==_undefined$1&&null!==e},isValue$4=is$4,possibleTypes={object:!0,function:!0,undefined:!0},is$3=function(e){return!!isValue$4(e)&&hasOwnProperty.call(possibleTypes,typeof e)},isObject$4=is$3,is$2=function(e){if(!isObject$4(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}},isPrototype=is$2,is$1=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!isPrototype(e)},isFunction=is$1,classRe=/^\s*class[\s{/}]/,functionToString=Function.prototype.toString,is=function(e){return!!isFunction(e)&&!classRe.test(functionToString.call(e))},isImplemented$2=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")};function requireIsImplemented(){return hasRequiredIsImplemented?isImplemented$1:(hasRequiredIsImplemented=1,isImplemented$1=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}})}var shim$2,hasRequiredShim$2,keys$1,hasRequiredKeys,validValue,hasRequiredValidValue,shim$1,hasRequiredShim$1,noop=function(){},_undefined=noop(),isValue$3=function(e){return e!==_undefined&&null!==e};function requireShim$2(){if(hasRequiredShim$2)return shim$2;hasRequiredShim$2=1;var e=isValue$3,t=Object.keys;return shim$2=function(r){return t(e(r)?Object(r):r)}}function requireKeys(){return hasRequiredKeys?keys$1:(hasRequiredKeys=1,keys$1=requireIsImplemented()()?Object.keys:requireShim$2())}function requireValidValue(){if(hasRequiredValidValue)return validValue;hasRequiredValidValue=1;var e=isValue$3;return validValue=function(t){if(!e(t))throw new TypeError("Cannot use null or undefined");return t}}function requireShim$1(){if(hasRequiredShim$1)return shim$1;hasRequiredShim$1=1;var e=requireKeys(),t=requireValidValue(),r=Math.max;return shim$1=function(n,i){var a,o,s,u=r(arguments.length,2);for(n=Object(t(n)),s=function(e){try{n[e]=i[e]}catch(e){a||(a=e)}},o=1;o<u;++o)e(i=arguments[o]).forEach(s);if(void 0!==a)throw a;return n},shim$1}var shim,hasRequiredShim,assign$1=isImplemented$2()?Object.assign:requireShim$1(),isValue$2=isValue$3,forEach4=Array.prototype.forEach,create$1=Object.create,process=function(e,t){var r;for(r in e)t[r]=e[r]},normalizeOptions=function(e){var t=create$1(null);return forEach4.call(arguments,(function(e){isValue$2(e)&&process(Object(e),t)})),t},str="razdwatrzy",isImplemented=function(){return"function"==typeof str.contains&&(!0===str.contains("dwa")&&!1===str.contains("foo"))};function requireShim(){if(hasRequiredShim)return shim;hasRequiredShim=1;var e=String.prototype.indexOf;return shim=function(t){return e.call(this,t,arguments[1])>-1},shim}var contains$1=isImplemented()?String.prototype.contains:requireShim(),isValue$1=is$4,isPlainFunction=is,assign2=assign$1,normalizeOpts=normalizeOptions,contains=contains$1,d=d$1.exports=function(e,t){var r,n,i,a,o;return arguments.length<2||"string"!=typeof e?(a=t,t=e,e=null):a=arguments[2],isValue$1(e)?(r=contains.call(e,"c"),n=contains.call(e,"e"),i=contains.call(e,"w")):(r=i=!0,n=!1),o={value:t,configurable:r,enumerable:n,writable:i},a?assign2(normalizeOpts(a),o):o};d.gs=function(e,t,r){var n,i,a,o;return"string"!=typeof e?(a=r,r=t,t=e,e=null):a=arguments[3],isValue$1(t)?isPlainFunction(t)?isValue$1(r)?isPlainFunction(r)||(a=r,r=void 0):r=void 0:(a=t,t=r=void 0):t=void 0,isValue$1(e)?(n=contains.call(e,"c"),i=contains.call(e,"e")):(n=!0,i=!1),o={get:t,set:r,configurable:n,enumerable:i},a?assign2(normalizeOpts(a),o):o};var dExports=d$1.exports,validCallable=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e};!function(e,t){var r,n,i,a,o,s,u,c=dExports,l=validCallable,d=Function.prototype.apply,h=Function.prototype.call,f=Object.create,p=Object.defineProperty,m=Object.defineProperties,y=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};n=function(e,t){var n,a;return l(t),a=this,r.call(this,e,n=function(){i.call(a,e,n),d.call(t,this,arguments)}),n.__eeOnceListener__=t,this},a=function(e){var t,r,n,i,a;if(y.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(r=arguments.length,a=new Array(r-1),t=1;t<r;++t)a[t-1]=arguments[t];for(i=i.slice(),t=0;n=i[t];++t)d.call(n,this,a)}else switch(arguments.length){case 1:h.call(i,this);break;case 2:h.call(i,this,arguments[1]);break;case 3:h.call(i,this,arguments[1],arguments[2]);break;default:for(r=arguments.length,a=new Array(r-1),t=1;t<r;++t)a[t-1]=arguments[t];d.call(i,this,a)}},o={on:r=function(e,t){var r;return l(t),y.call(this,"__ee__")?r=this.__ee__:(r=g.value=f(null),p(this,"__ee__",g),g.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},once:n,off:i=function(e,t){var r,n,i,a;if(l(t),!y.call(this,"__ee__"))return this;if(!(r=this.__ee__)[e])return this;if("object"==typeof(n=r[e]))for(a=0;i=n[a];++a)i!==t&&i.__eeOnceListener__!==t||(2===n.length?r[e]=n[a?0:1]:n.splice(a,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},emit:a},s={on:c(r),once:c(n),off:c(i),emit:c(a)},u=m({},s),e.exports=t=function(e){return null==e?f(u):m(Object(e),s)},t.methods=o}(eventEmitter,eventEmitter.exports);var eventEmitterExports=eventEmitter.exports,EventEmitter=getDefaultExportFromCjs(eventEmitterExports),$$9=_export,uncurryThis$3=functionUncurryThis,aCallable=aCallable$b,toObject=toObject$h,lengthOfArrayLike=lengthOfArrayLike$i,deletePropertyOrThrow=deletePropertyOrThrow$3,toString$2=toString$l,fails$4=fails$V,internalSort=arraySort$1,arrayMethodIsStrict$1=arrayMethodIsStrict$8,FF=engineFfVersion,IE_OR_EDGE=engineIsIeOrEdge,V8=engineV8Version,WEBKIT=engineWebkitVersion,test=[],nativeSort=uncurryThis$3(test.sort),push$2=uncurryThis$3(test.push),FAILS_ON_UNDEFINED=fails$4((function(){test.sort(void 0)})),FAILS_ON_NULL=fails$4((function(){test.sort(null)})),STRICT_METHOD$1=arrayMethodIsStrict$1("sort"),STABLE_SORT=!fails$4((function(){if(V8)return V8<70;if(!(FF&&FF>3)){if(IE_OR_EDGE)return!0;if(WEBKIT)return WEBKIT<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)test.push({k:t+n,v:r})}for(test.sort((function(e,t){return t.v-e.v})),n=0;n<test.length;n++)t=test[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}})),FORCED$2=FAILS_ON_UNDEFINED||!FAILS_ON_NULL||!STRICT_METHOD$1||!STABLE_SORT,getSortCompare=function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:toString$2(t)>toString$2(r)?1:-1}};$$9({target:"Array",proto:!0,forced:FORCED$2},{sort:function(e){void 0!==e&&aCallable(e);var t=toObject(this);if(STABLE_SORT)return void 0===e?nativeSort(t):nativeSort(t,e);var r,n,i=[],a=lengthOfArrayLike(t);for(n=0;n<a;n++)n in t&&push$2(i,t[n]);for(internalSort(i,getSortCompare(e)),r=lengthOfArrayLike(i),n=0;n<r;)t[n]=i[n++];for(;n<a;)deletePropertyOrThrow(t,n++);return t}});var DESCRIPTORS$2=descriptors,uncurryThis$2=functionUncurryThis,objectKeys=objectKeys$4,toIndexedObject=toIndexedObject$d,$propertyIsEnumerable=objectPropertyIsEnumerable.f,propertyIsEnumerable3=uncurryThis$2($propertyIsEnumerable),push$1=uncurryThis$2([].push),createMethod=function(e){return function(t){for(var r,n=toIndexedObject(t),i=objectKeys(n),a=i.length,o=0,s=[];a>o;)r=i[o++],DESCRIPTORS$2&&!propertyIsEnumerable3(n,r)||push$1(s,e?[r,n[r]]:n[r]);return s}},objectToArray={entries:createMethod(!0),values:createMethod(!1)},$$8=_export,$values=objectToArray.values;$$8({target:"Object",stat:!0},{values:function(e){return $values(e)}});var isValue=isValue$3,map3={function:!0,object:!0},isObject$3=function(e){return isValue(e)&&map3[typeof e]||!1},isObject$2=isObject$3,validObject=function(e){if(!isObject$2(e))throw new TypeError(e+" is not an Object");return e},value=validObject,hasOwnProperty$1=Object.prototype.hasOwnProperty,allOff=function(e){var t,r=arguments[1];if(value(e),void 0===r)hasOwnProperty$1.call(e,"__ee__")&&delete e.__ee__;else{if(!(t=hasOwnProperty$1.call(e,"__ee__")&&e.__ee__))return;t[r]&&delete t[r]}},allOff$1=getDefaultExportFromCjs(allOff),RETRY_MAX=10,PRELOADER=function(){function e(t,r,n,i,a){_classCallCheck$7(this,e),EventEmitter(this),this.state=STATES.PREPARE,this.options=t||{},this.logger=t.logger||function(){},this._preloadManager=r,this.player=r.player;var o=n.handlers,s=n.predictInst,u=n.readyPromise;this._predictInst=s,this._handlers=o,this._predictInstReadyPromise=u,this._toLoadList=[],this.retryCount=0,this._cachedHandler=i,this._cachedDataHanlder=a,this.cnt=0}return _createClass$7(e,[{key:"start",value:function(){var e=this,t=new ProxyPromise$1;return this._handlers.start(this.options).then((function(r){r.onObtain().then((function(n){e._predictInstReadyPromise.then((function(){e._predictInst.updateMediaInfos(n);var i=e._predictInst.preloadPredict(e.options),a=e._predictInst.cachedData;e._cachedDataHanlder(Object.assign({vid:e.options.vid},{data:a}));var o=Object.assign(i,e.options);r.onTransform(o).then((function(r){e._toLoadList=r,t.resolve(r)}))}))}))})).catch((function(e){t.reject(new Error("preload unit start error"))})),t}},{key:"preloadSeg",value:function(){var e=this;if(0===this._toLoadList.length)return this.state=STATES.FINISH,void this.emit(PRELOAD_SEG_DONE,!0);this.state="PRELOADING";var t=this._toLoadList.shift();this._handlers.onRequest(t,(function(r){var n=Object.assign({},t.extData,r);e._cachedHandler(n)})).then((function(){e.state=STATES.IDLE,e.emit(PRELOAD_SEG_DONE)})).catch((function(t){e.requestError(),e.emit(PRELOAD_SEG_DONE,!1)}))}},{key:"requestError",value:function(){this.retryCount++,this.state=STATES.IDLE,this.retryCount>=RETRY_MAX&&(this.state=STATES.FINISH),this.emit(ONE_STEP_DONE),this.logger("preload request error")}},{key:"cancelLoading",value:function(){this._toLoadList=[]}},{key:"destroy",value:function(){allOff$1(this)}}]),e}();function getIDB(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){}}var idb=getIDB();function isIndexedDBValid(){try{if(!idb||!idb.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function executeCallback(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function executeTwoCallbacks(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function normalizeKey(e){return"string"!=typeof e&&(console.warn("".concat(e," used as a key, but it is not a string.")),e=String(e)),e}var dbContexts={},READ_ONLY="readonly",READ_WRITE="readwrite";function _deferReadiness(e){var t=dbContexts[e.name],r={};r.promise=new Promise((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function _advanceReadiness(e){var t=dbContexts[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _rejectReadiness(e,t){var r=dbContexts[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function _getConnection(e,t){return new Promise((function(r,n){if(dbContexts[e.name]=dbContexts[e.name]||createDbContext(),e.db){if(!t)return r(e.db);_deferReadiness(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=idb.open.apply(idb,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),_advanceReadiness(e)}}))}function _getOriginalConnection(e){return _getConnection(e,!1)}function _getUpgradedConnection(e){return _getConnection(e,!0)}function _isUpgradeNeeded(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function _tryReconnect(e){_deferReadiness(e);for(var t=dbContexts[e.name],r=t.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,_getOriginalConnection(e).then((function(t){return e.db=t,_isUpgradeNeeded(e)?_getUpgradedConnection(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(t){throw _rejectReadiness(e,t),t}))}function createTransaction(e,t,r,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return Promise.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),_getUpgradedConnection(e)})).then((function(){return _tryReconnect(e).then((function(){createTransaction(e,t,r,n-1)}))})).catch(r);r(i)}}function createDbContext(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}var AsyncStorage=function(){function e(){_classCallCheck$7(this,e)}return _createClass$7(e,[{key:"ready",value:function(){return this._ready}},{key:"_initStorage",value:function(e){var t=this;t._defaultConfig=e;var r={db:null};if(e)for(var n in e)r[n]=e[n];var i=dbContexts[r.name];i||(i=createDbContext(),dbContexts[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=t._fullyReady);var a=[];function o(){return Promise.resolve()}for(var s=0;s<i.forages.length;s++){var u=i.forages[s];u!==t&&a.push(u._initReady().catch(o))}var c=i.forages.slice(0);return t._ready=Promise.all(a).then((function(){return r.db=i.db,_getOriginalConnection(r)})).then((function(e){return r.db=e,_isUpgradeNeeded(r,t._defaultConfig.version)?_getUpgradedConnection(r):e})).then((function(e){r.db=i.db=e,t._dbInfo=r;for(var n=0;n<c.length;n++){var a=c[n];a!==t&&(a._dbInfo.db=r.db,a._dbInfo.version=r.version)}})),t._ready}},{key:"probeSupport",get:function(){return isIndexedDBValid()}},{key:"getItem",value:function(e,t){var r=this;e=normalizeKey(e);var n=new Promise((function(t,n){r.ready().then((function(){createTransaction(r._dbInfo,READ_ONLY,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),t(e)},o.onerror=function(){n(o.error)}}catch(e){n(e)}}))})).catch(n)}));return executeCallback(n,t),n}},{key:"setItem",value:function(e,t,r){var n=this;e=normalizeKey(e);var i=new Promise((function(r,i){n.ready().then((function(){return n._dbInfo,t})).then((function(t){createTransaction(n._dbInfo,READ_WRITE,(function(a,o){if(a)return i(a);try{var s=o.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var u=s.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),r(t)},o.onabort=o.onerror=function(){var e=u.error?u.error:u.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return executeCallback(i,r),i}},{key:"removeItem",value:function(e,t){var r=this;e=normalizeKey(e);var n=new Promise((function(t,n){r.ready().then((function(){createTransaction(r._dbInfo,READ_WRITE,(function(i,a){if(i)return n(i);try{var o=a.objectStore(r._dbInfo.storeName).delete(e);a.oncomplete=function(){t()},a.onerror=function(){n(o.error)},a.onabort=function(){var e=o.error?o.error:o.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return executeCallback(n,t),n}},{key:"clear",value:function(e){var t=this,r=new Promise((function(e,r){t.ready().then((function(){createTransaction(t._dbInfo,READ_WRITE,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return executeCallback(r,e),r}},{key:"length",value:function(e){var t=this,r=new Promise((function(e,r){t.ready().then((function(){createTransaction(t._dbInfo,READ_ONLY,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).count();a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return executeCallback(r,e),r}},{key:"all",value:function(e){var t=this,r=new Promise((function(e,r){t.ready().then((function(){createTransaction(t._dbInfo,READ_ONLY,(function(n,i){if(n)return r(n);try{var a=i.objectStore(t._dbInfo.storeName).openCursor(),o=[];a.onsuccess=function(){var t=a.result;t?(o.push({key:t.key,value:t.value}),t.continue()):e(o)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return executeCallback(r,e),r}},{key:"_fullyReady",value:function(e){var t=this,r=t._initReady().then((function(){var e=dbContexts[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return executeTwoCallbacks(r,e,e),r}}]),e}(),MemoryCache=function(){function e(){_classCallCheck$7(this,e)}return _createClass$7(e,[{key:"_initStorage",value:function(e){var t=e.name+"_"+e.storeName;return this.key=t,window[t]&&"object"===_typeof$3(window[t])||(window[t]={}),this.store=window[t],Promise.resolve()}},{key:"getItem",value:function(e,t){var r=this.store[e];return void 0===r&&(r=null),this._internalPromise(t,r)}},{key:"setItem",value:function(e,t,r){return this.store[e]=t,this._internalPromise(r)}},{key:"removeItem",value:function(e,t){return delete this.store[e],this._internalPromise(t)}},{key:"clear",value:function(e){return this.store={},window[this.key]={},this._internalPromise(e)}},{key:"length",value:function(e){var t=Object.keys(this.store).length;return this._internalPromise(e,t)}},{key:"_internalPromise",value:function(e,t){var r=t?Promise.resolve(t):Promise.resolve();return executeCallback(r,e),r}},{key:"all",value:function(e){for(var t=[],r=Object.keys(this.store),n=0;n<r.length;n++){var i=r[n];t.push({key:i,value:this.store[i]})}return this._internalPromise(e,t)}},{key:"probeSupport",value:function(){return!0}}]),e}(),DefaultConfig={description:"",name:"__PRE_CACHE__",storeName:"keyvaluepairs",version:1},SPLIT="|",SESSION_KEY="__PRE_CACHE__KEYS",TIMESPLIT="$",MAX_CACHE=200,PreloadCache=function(){function e(t,r){_classCallCheck$7(this,e);var n=r===CACHE_TYPES.MEMORY?MemoryCache:AsyncStorage;this._driver=new n,this._driver._initStorage(DefaultConfig).catch((function(){})),this._hasIdbForbidden=!1,this._maxCache=!t||t<=0?MAX_CACHE:t,this.setMaxCache(this._maxCache),this._allCachedKeys={},this._allCachedTimeKeys={},this.getCachedKeysFromLocal(),this._readyPromise=new ProxyPromise$1,this.init()}return _createClass$7(e,[{key:"getCachedKeysFromLocal",value:function(){var e=proxyLocalStorage$1.getItem(SESSION_KEY);if(e)for(var t=e.split(SPLIT),r=0;r<t.length;r++){var n=t[r],i=this._getCacheKeyInfos(n),a=i.time,o=i.cachedKey;this._allCachedKeys[o]=1,this._allCachedTimeKeys[o]=a}}},{key:"_getCacheKeyInfos",value:function(e){var t,r=e.split(TIMESPLIT);return 2===r.length&&(t=r[0],e=r[1]),{time:t,cachedKey:e}}},{key:"writeCachedKeysToLocal",value:function(e){var t=[];this._allCachedKeys={},this._allCachedTimeKeys={};for(var r=0;r<e.length;r++){var n=e[r].key,i=this._getCacheKeyInfos(n),a=i.time,o=i.cachedKey;this._allCachedKeys[o]=1,this._allCachedTimeKeys[o]=a,t.push(n)}var s=t.join(SPLIT);proxyLocalStorage$1.setItem(SESSION_KEY,s)}},{key:"init",value:function(){var e=this;this._driver.setItem("test","test").then((function(){})).catch((function(){e._hasIdbForbidden=!0})).finally((function(){e._driver.removeItem("test").catch((function(){})),e._hasIdbForbidden&&(e._driver=new MemoryCache,e._driver._initStorage(DefaultConfig)),e._getAll(),e._readyPromise.resolve()}))}},{key:"_getAll",value:function(){var e=this;this._driver.all().then((function(t){e._cachedLength=t.length;var r=t.length-e._maxCache,n=t;if(r>0){var i=t.slice(0,r);n=t.slice(r);for(var a=0;a<i.length;a++)e.removeItem(i[a].key).then((function(){}))}e.writeCachedKeysToLocal(n)})).catch((function(){}))}},{key:"getItem",value:function(e,t){if(!this.hasItem(e))return Promise.resolve(!1);var r=this._getTimeKey(e).timeKey;return this._driver.getItem(r,t)}},{key:"setItem",value:function(e,t,r){var n=this;this._getTimeKey(e).timeKey&&this.removeItem(e);var i=(new Date).getTime();this._allCachedKeys[e]=1,this._allCachedTimeKeys[e]=i;var a=this._genTimeKey(e,i);return r=r?function(){n._getAll(),r()}:function(){n._getAll()},this._driver.setItem(a,t,r)}},{key:"_getTimeKey",value:function(e){var t=this._allCachedTimeKeys[e],r=e;return t&&(r=this._genTimeKey(e,t)),{timeKey:r,time:t}}},{key:"_genTimeKey",value:function(e,t){return"".concat(t).concat(TIMESPLIT).concat(e)}},{key:"removeItem",value:function(e,t){var r=this._getTimeKey(e).timeKey,n=this._driver.removeItem(r,t);return delete this._allCachedKeys[e],delete this._allCachedTimeKeys[e],n}},{key:"hasItem",value:function(e){return!!this._allCachedKeys[e]}},{key:"clear",value:function(e){return this._driver.clear(e)}},{key:"length",value:function(e){return this._driver.length(e)}},{key:"setMaxCache",value:function(e){"number"==typeof e&&e>0&&(this._maxCache=e)}}]),e}(),PRELOADER_KEY="DEFAULT",PreloaderManager=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;_classCallCheck$7(this,e),EventEmitter(this),this._preloadDataList=[],this._currentPreloadInst=null,this._dashPreloadList=[],this.autoPreload=t.autoPreload||!1,this._onPreloadNext=this.onPreloadNextReady.bind(this),this.on(PRELOAD_NEXT,this._onPreloadNext),this._preloaderConfigs={},this.update(t,r,n),this._cacheInst=new PreloadCache(t.preloadMaxCacheCount,t.preloadCacheType),this._preloadCacheProgress={},this._ptag_=!0,this._cachedDatas={}}return _createClass$7(e,[{key:"_getProloaderKey",value:function(e){return e.vtype?e.vtype:PRELOADER_KEY}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!r)throw new Error("PreloaderManager predictInst is null");var n=this._getProloaderKey(e);this._preloaderConfigs[n]={predictInst:r,readyPromise:r.init(e),handlers:t}}},{key:"cachedDatas",get:function(){return this._cachedDatas}},{key:"onCacheSegment",value:function(e){var t=e.vid,r=e.format,n=e.cacheKey,i=e.total,a=e.loaded,o=e.isInitSegment,s=e.mediaType,u=this.getProgressCacheKey(t,r,s),c=this._preloadCacheProgress[u];c||(c=this._preloadCacheProgress[u]={}),c[n]={total:i,loaded:a,isInitSegment:o}}},{key:"onCachePredict",value:function(e){var t=e.vid,r=e.data;t&&r&&(this._cachedDatas[t]=r)}},{key:"getProgressCacheKey",value:function(e,t,r){return"".concat(e,"-").concat(t,"-").concat(r)}},{key:"onPreloadNextReady",value:function(){this.onPreloadNext()}},{key:"onPreloadSegDone",value:function(){this.autoPreload&&this.emit(PRELOAD_NEXT)}},{key:"onPreloadNext",value:function(){var e=this;if(null==this._currentPreloadInst&&this._preloadDataList.length>0){if(this._preloadDataList.length>0){var t=this._preloadDataList.shift().data;if(t.payload){var r=this._getProloaderKey(t),n=this._preloaderConfigs[r];if(!n)return void console.warn("need to set vtype, no preloader",t);this._currentPreloadInst=new PRELOADER(t,this,n,(function(t){e.onCacheSegment(t)}),(function(t){e.onCachePredict(t)})),this._currentPreloadInst.on(PRELOAD_SEG_DONE,this.onPreloadSegDone.bind(this)),this._currentPreloadInst.start().then((function(){e._currentPreloadInst.preloadSeg()})).catch((function(){e._currentPreloadInst=null}))}}}else null!=this._currentPreloadInst&&(this._currentPreloadInst.state===STATES.IDLE?this._currentPreloadInst.preloadSeg():this._currentPreloadInst.state===STATES.FINISH?(this._currentPreloadInst.destroy(),this._currentPreloadInst=null):this._currentPreloadInst.state===STATES.PREPARE&&(this._currentPreloadInst.cnt++,this._currentPreloadInst.cnt>2&&(this._currentPreloadInst.destroy(),this._currentPreloadInst=null)))}},{key:"addDashPreloader",value:function(e){e&&e.data&&(this._preloadDataList.push(e),this.sort(this._preloadDataList),this.autoPreload&&this.emit(PRELOAD_NEXT))}},{key:"_addDashPreloader",value:function(e){e&&e.data&&this._preloadDataList.push(e)}},{key:"addDashPreloaderList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.sort(e);for(var t=0;t<e.length;t++)this._addDashPreloader(e[t])}},{key:"sort",value:function(e){e.sort((function(e,t){return void 0===e.order&&void 0===e.order||e.order<t.order?-1:1}))}},{key:"destroy",value:function(){this.off(PRELOAD_NEXT,this._onPreloadNext)}},{key:"cancelLoading",value:function(){this._currentPreloadInst&&(this._currentPreloadInst.cancelLoading(),this._currentPreloadInst=null),this._preloadDataList=[]}},{key:"preloadCacheProgress",value:function(e){var t=e.vid,r=e.format,n=e.mediaType,i=e.prelaodType,a=e.bitrate,o=e.set_duration,s=e.set_size,u=e.media_type,c=e.start_time,l=this.getProgressCacheKey(t,r,n),d=this._preloadCacheProgress[l];if(d){for(var h=Object.values(d),f=0,p=0,m=0,y=0,g=0,v=0;v<h.length;v++){var b=h[v];b.isInitSegment&&(f=b.total,m=b.loaded,y=b.loaded===b.total?DOWN_STATES.SUCCESS:DOWN_STATES.DOWNLOADING),p+=b.total,g+=b.loaded}return{media_type:u,preload_type:i,stream_bitrate:a,header_size:f,content_total_size:p,start_time:c||-1,state_info:{set_duration:o,set_size:s,current_header_download_size:m,current_content_download_size:g,header_download_state:y,content_download_state:g===p?DOWN_STATES.SUCCESS:DOWN_STATES.DOWNLOADING}}}return null}},{key:"getPreloadTaskInfos",value:function(){}},{key:"getItem",value:function(e,t){return this._cacheInst.getItem(e,t)}},{key:"setItem",value:function(e,t,r){return this._cacheInst.setItem(e,t,r)}},{key:"removeItem",value:function(e,t){return this.removeItem(e,t)}}],[{key:"getInstance",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.GLOBAL_KEY+(t.globalKey?t.globalKey:""),a=window[i];if(a&&a._ptag_)return a.update(t,r,n),a;var o=new e(t,r,n);return window[i]=o,o}}]),e}();PreloaderManager.GLOBAL_KEY="__preloadcontext__";var PreloaderBase=function(){function e(t){_classCallCheck$7(this,e),EventEmitter(this),this.options=t,this.promisePolyfill(),this.before(),this.check(),this._preloadManager=PreloaderManager.getInstance(t,this.handlers,this.predictInst),this.loadingTasks=[]}return _createClass$7(e,[{key:"promisePolyfill",value:function(){Promise.prototype.finally||(Promise.prototype.finally={finally:function(e){var t=function(t){return Promise.resolve(e()).then(t)};return this.then((function(e){return t((function(){return e}))}),(function(e){return t((function(){return Promise.reject(e)}))}))}}.finally)}},{key:"before",value:function(){throw new Error("need")}},{key:"check",value:function(){if(!this.handlers)throw new Error("handlers null");if(!this.handlers.start||!this.handlers.onRequest)throw new Error("handlers callback null");if(!this.predictInst)throw new Error("predictInst null");if(!this.predictInst.__p__)throw new Error("predictInst need extends predictbase")}},{key:"preloadNext",value:function(){this._preloadManager.emit(PRELOAD_NEXT)}},{key:"preloadManager",get:function(){return this._preloadManager}},{key:"start",value:function(e){throw new Error("start need implment, return Promise")}},{key:"cancelLoading",value:function(){for(var e=0;e<this.loadingTasks.length;e++)try{var t=this.loadingTasks[e];"function"==typeof t.cancel&&t.cancel()}catch(e){}this.loadingTasks=[],this._preloadManager.cancelLoading()}},{key:"addTasker",value:function(e){this.loadingTasks.push(e)}},{key:"removeTasker",value:function(e){var t=this;setTimeout((function(){for(var r=t.loadingTasks.length-1;r>-1;r--)if(t.loadingTasks[r]===e){t.loadingTasks.splice(r,1);break}}))}},{key:"addDashPreloader",value:function(e){this._preloadManager.addDashPreloader(e)}},{key:"addDashPreloaderList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._preloadManager.addDashPreloaderList(e)}}]),e}(),PredictBase=function(){function e(){_classCallCheck$7(this,e),this.bandwidth2item={},this._mediaInfos=null,this.__p__=!0}return _createClass$7(e,[{key:"init",value:function(){throw new Error("init func not implement, return promise")}},{key:"preloadPredict",value:function(e){throw new Error("preloadPredict error",e)}},{key:"updateMediaInfos",value:function(e){if(this._mediaInfos=e,this.bandwidth2item={},this.dynamic_video=e&&e.dynamic_video_list,this.dynamic_video&&this.dynamic_video.length>0)for(var t=0;t<this.dynamic_video.length;t++){var r=this.dynamic_video[t];this.bandwidth2item[r.bitrate||r.bandwidth]=r}}},{key:"getIdx",value:function(e,t){var r=0;return e.forEach((function(e,n){e.definition===t&&(r=n)})),r}},{key:"cachedData",get:function(){return null}}]),e}(),VTYPES=VTYPES$1,CODEC_TYPE$1={H264:"h264",H265:"h265"},MAX_LOADING_COUNT=1,PRELOAD_TYPES=PRELOAD_TYPES$1,DEFAULT_TRUNK=8e5,_BITRATE_SELECTOR=null,Predict=function(e){_inherits$a(r,PredictBase);var t=_createSuper$a(r);function r(){return _classCallCheck$d(this,r),t.apply(this,arguments)}return _createClass$d(r,[{key:"init",value:function(){return Promise.resolve()}},{key:"preloadPredict",value:function(e){return e}}]),r}(),Mp4Preloader=function(e){_inherits$a(o,PreloaderBase);var t,r,n,i,a=_createSuper$a(o);function o(e,t){var r;return _classCallCheck$d(this,o),e.vtype=VTYPES.MP4,(r=a.call(this,e)).player=t,r.loadingCount=0,r._mp4=null,r._loader=null,r._pendingPromise=null,r.playerId=t.playerId,r}return _createClass$d(o,[{key:"log",value:function(e){for(var t="[Preloader] ".concat(e),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];log$2.apply(void 0,[t].concat(n))}},{key:"before",value:function(){var e=this;this.handlers={start:function(t){var r=t.payload||[];if(0===r.length)return Promise.reject();var n=t.vid,i=t.vtype||VTYPES.MP4,a=t.codecType||CODEC_TYPE$1.H264,s=e.getUserSelectDefinition(),u=e.checkCacheKey(n,r,s,i,a);if(console.log("[Preloader] ".concat(n," codecType:").concat(a," vtype:").concat(i," hasCache:").concat(u)),u||"MP3"===i)return Promise.reject();var c=e.getInitDefinition(r,e.options.definition,s);if(console.log("[Preloader] ".concat(n," getInitDefinition"),c),!c)return Promise.reject();var l=c.definition,d=t.preloadTime||e.options.preloadTime,h=t.preloadSize||e.options.preloadSize||Math.pow(25,4)-1,f=o.generateUniqueKey({vid:n,definition:l,vtype:i,codecType:a});log$2("[Preloader] ".concat(n," start duration:").concat(c.duration," cacheKey:").concat(f));var p=_objectSpread2$6({vid:n,definition:l,preloadTime:d,preloadSize:h,cacheKey:f,codecType:a,vtype:i},c);return e.loadingCount++,e.start(p)},onRequest:function(t,r){var n=t.url,i=t.range,a=t.extData;return e.getData(n,i,a,r)}},this.loggerConfig={logger:function(){},openLog:!1},this.predictInst=new Predict(this.loggerConfig)}},{key:"start",value:function(e){var t=this,r={mediaInfos:{dynamic_video_list:[],dynamic_audio_list:[]},onObtain:function(){var e=new ProxyPromise;return e.resolve(r.mediaInfos),e},onTransform:function(r){var n=new ProxyPromise;t._pendingPromise=n;var i=e.preloadTime,a=e.codecType;return i&&(a!==CODEC_TYPE$1.H265||t.options.supportHevc)?t.loadByPreloadTime(e,n):t.loadByChunkSize(e,n),n}};return Promise.resolve(r)}},{key:"getInitDefinition",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=null;if(o.BitRateAdapter)n=o.BitRateAdapter.getSuitableBitrate(e,r),this.log("Mp4Preloader.BitRateAdapter",n);else{for(var i=0,a=0;a<e.length;a++){if(e[a].definition===t){i=a;break}}n=e[i]}return n||(n=e[0]),n}},{key:"getPreLoadData",value:function(e){var t=this,r=new ProxyPromise;return this.getItemSameVid(e).then((function(e){if(t.log("getPreLoadData",e.value),e.value){var n=e.value,i=n.mediaSegList,a=n.meta,o=n.type,s=n.buffer,u=n.preloadTime,c=n.vid,l=n.cacheKey,d=n.definition,h=n.byteLength,f=n.duration,p=n.fileSize,m=n.from,y=n.vtype,g=n.codecType,v=n.initSeg,b={vid:c,type:o,vtype:y,codecType:g,definition:d,bitrate:n.bitrate,cacheKey:l,duration:f||0,byteLength:h,from:m,meta:a};o===PRELOAD_TYPES.SIZE?(b.buffer=s,b.fileSize=p||0):(b.mediaSegList=i,b.preloadTime=u,b.initSeg=v),r.resolve(b)}else r.resolve(null)})).catch((function(e){r.reject(e)})),r}},{key:"setPreLoadData",value:(i=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t,r){var n,i,a,o,s,u,c,l,d,h,f,p,m,y,g,v,b,_,A=this;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new ProxyPromise,i=r.mediaSegList,a=r.meta,o=r.vid,s=r.definition,u=r.type,c=r.buffer,l=r.duration,d=r.byteLength,h=r.preloadTime,f=r.preloadSize,p=r.fileSize,m=r.from,y=r.vtype,g=r.codecType,v=r.initSeg,b=r.bitrate,_={codecType:g,vtype:y,vid:o,definition:s,cacheKey:t,type:u,from:m,meta:a,fileSize:p,bitrate:b},u===PRELOAD_TYPES.SIZE?(_.buffer=c,_.byteLength=d||0,_.preloadSize=f||0,_.fileSize=p,_.buffer&&_.buffer.byteLength>0&&(this.setItem(t,_),n.resolve(!0))):(_.mediaSegList=i||[],_.duration=l,_.byteLength=d||0,_.preloadTime=h||0,_.initSeg=v,a&&0===i.length?(this.setItem(t,_),n.resolve(!0)):(i.every((function(e){return!!e.buffer&&e.state}))||n.resolve(!1),this.setItem(t,_).then((function(){A.log("setPreLoadData1 success",t,(new Date).getTime())})),n.resolve(!0))),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"getInitCacheData",value:function(e,t){var r={type:e,meta:null,byteLength:0,fileSize:0,bitrate:0};return e===PRELOAD_TYPES.DURATION?(r.mediaSegList=[],r.initSeg=null,r.duration=0):r.buffer=null,Object.keys(t).map((function(e){r[e]=t[e]})),r}},{key:"updatePreCacheData",value:function(e,t,r,n,i,a,o){var s=e.mediaSegList;if(e.type===PRELOAD_TYPES.SIZE||-1===i)return e.buffer=Concat$2(Uint8Array,e.buffer.buffer||[],new Uint8Array(t)),e;for(var u=-1,c=0;c<s.length;c++)if(s[c].index===i){u=c;break}var l=a||[0,0];return u>-1?(t&&(s[u].buffer=Concat$2(Uint8Array,s[u].buffer||[],new Uint8Array(t))),r.length>1&&(s[u].range.length>1?s[u].range[1]=r[1]:s[u].range=r),-1!==o[1]&&(n=s[u].range[1]>=o[1]),s[u].state=n):(e.duration=l[1],s.push({buffer:t,range:r||[],index:i,totalRange:o||[],timeRange:[l[0],l[1]],state:n})),n&&(e.byteLength=r[1]),n}},{key:"checkCacheKey",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:VTYPES.MP4,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:CODEC_TYPE$1.H264;if(r){var a=o.generateUniqueKey({vid:e,definition:r,vtype:n,codecType:i});return this.hasItemSameVid(a)?a:null}for(var s=0;s<t.length;s++){var u=o.generateUniqueKey({vid:e,definition:t[s].definition,vtype:n,codecType:i});if(this.hasItemSameVid(u))return u}return null}},{key:"checkCanPreloadNext",value:function(){var e=!0;return this.loadingCount>=MAX_LOADING_COUNT&&(e=!1),e&&this.preloadNext(),e}},{key:"loadByPreloadTime",value:function(e,t){var r=this,n=e.vid,i=e.cacheKey,a=e.preloadTime,o=e.definition,s=e.duration,u=e.bitrate,c=e.codecType,l=e.vtype,d=null;if(d="Array"===util$1.typeOf(e.url)?e.url.length>1?e.url[1].src:e.url[0].src:e.url){d=util$1.extUrl(d,{__vid:n});var h=a>=this.options.segmentMinDuration?this.options.segmentMinDuration:a;this.log("loadByPreloadTime","".concat(e.cacheKey,", definition:").concat(e.definition,",segmentMinDuration:").concat(h),e);var f=util$1.getFileSize(u,s);this._mp4=new MP4$2(d,u,_objectSpread2$6({segmentDuration:h,codecType:this.codecType,chunkSize:this.options.preloadSize,duration:s,fileSize:f,playerId:this.playerId,vid:n,useUrlRange:!1,retryCount:1,retryDelay:1e3,supportHevc:this.options.supportHevc},this.options.reqOptions),null,null,{},[],this.firstFrameTime,"");var p=this.getInitCacheData(PRELOAD_TYPES.DURATION,{vid:n,preloadTime:a,definition:o,cacheKey:i,codecType:c,vtype:l,bitrate:u||0});this._mp4.once("metaReady",(function(i){r.log("".concat(n," metaReady this._pendingPromise"),r._pendingPromise.state),p.meta=i,p.from=2,r._mp4.cancelLoading(),r.startLoadByFragments(p,e,t)})),this._mp4.on("error",(function(e){console.error("[Preloader] ".concat(n," loadByPreloadTime error"),e),r._endLoadFragments()})),this._mp4.init({})}else this._endLoadFragments()}},{key:"loadByChunkSize",value:(n=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t){var r,n,i,a,o,s,u,c,l,d,h,f,p,m,y,g,v,b=this;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.vid,n=t.cacheKey,i=t.definition,a=t.duration,o=t.bitrate,s=t.codecType,u=t.vtype,c=this.options,l="Array"===util$1.typeOf(t.url)?t.url[0].src:t.url){e.next=6;break}return this._endLoadChunk(),e.abrupt("return");case 6:return l=util$1.extUrl(l,{__vid:r}),d=util$1.getFileSize(o,a),h=getMetaSize(a,DEFAULT_TRUNK,d),this.log("".concat(r,"loadByChunkSize"),t.cacheKey,t.definition,h,t),f=this.getInitCacheData(PRELOAD_TYPES.SIZE,{vid:r,definition:i,cacheKey:n,codecType:s,vtype:u,fileSize:d,bitrate:o||0}),this.MP4Loader=new MP4Loader(_objectSpread2$6(_objectSpread2$6({url:l,retry:c.retry||2,retryDelay:c.retryDelay||1e3,timeout:3e3},c.reqOptions),{},{segmentDuration:c.segmentDuration})),e.prev=12,p=new Uint8Array(0),m=0,y=null,g=null,v=function(e,t,r){if(e&&r.range[0]===m&&(p=Concat$2(Uint8Array,p,new Uint8Array(e)),m+=e.byteLength),r.meta){b.MP4Loader.cancel();var i=r.meta,a=i.videoSegments,o=i.audioSegments;g=_objectSpread2$6(_objectSpread2$6({},i.meta),{},{ext:{videoTrak:a,audioTrak:o}}),f.meta=g,f.buffer=p,f.byteLength=p.byteLength,b.setPreLoadData(n,f),y=util$1.getFragRange(0,a,o),b.log("".concat(n," onProgressHandle4 meta"),t,y,m,p.byteLength),y[0]<m&&(y[0]=m),b._loadOneChunk(f,y)}},e.next=20,this.MP4Loader.loadMetaProcess(this.MP4Loader.cache,[0,h],v);case 20:e.next=26;break;case 22:e.prev=22,e.t0=e.catch(12),console.error("[Preloader] ".concat(n," loadByChunkSize error"),e.t0),this._endLoadChunk();case 26:case"end":return e.stop()}}),e,this,[[12,22]])}))),function(e){return n.apply(this,arguments)})},{key:"_loadOneChunk",value:(r=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t,r){var n,i,a,o,s,u,c,l;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.vid,i=t.cacheKey,a=t.buffer,e.prev=1,e.next=4,this.MP4Loader.loadData(r,this.MP4Loader.cache,{});case 4:o=e.sent,this.log("".concat(n," _loadOneChunk"),r,o),s=o.response,(u=o.data)?(this._endLoadChunk(),s&&s.headers&&(c=util$1.getFileSize(s.headers))&&(t.fileSize=c),l=Concat$2(Uint8Array,a,new Uint8Array(u)),t.buffer=l,t.byteLength=l.byteLength,this.log("".concat(n," _loadOneChunk ret"),i,l.byteLength,t),t.from=4,this.setPreLoadData(i,t)):this._endLoadChunk(),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(1),console.error("[Preloader] ".concat(n," loadByChunkSize error"),e.t0),this._endLoadChunk();case 14:case"end":return e.stop()}}),e,this,[[1,10]])}))),function(e,t){return r.apply(this,arguments)})},{key:"_endLoadChunk",value:function(){this.log("_endLoadChunk loadingCount:".concat(this.loadingCount),this._pendingPromise?this._pendingPromise.state:null),this._pendingPromise&&(this._pendingPromise.resolve(),this._pendingPromise=null),this.loadingCount>0&&this.loadingCount--,this.MP4Loader&&(this.MP4Loader.cancel(),this.MP4Loader.destroy(),this.MP4Loader=null)}},{key:"startLoadByFragments",value:(t=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t,r,n){var i,a,o,s,u,c,l=this;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(i=r.preloadTime,a=r.vid,console.log("[Preloader] ".concat(a," startLoadByFragments")),o=[],s=0;s<this._mp4.timeRange.length;s++)this._mp4.timeRange[s].startTime<=i&&o.push(s);return u=function(e){l.log("[Preloader] _failedCallback",e),l._endLoadFragments()},c=function(){var e=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(r){var n,i,a,s,d,h,f,p,m;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l._mp4){e.next=2;break}return e.abrupt("return");case 2:if(n=r.buffer,i=r.context,a=r.state,s=r.initSeg,d=i.fragIndex,h=i.range,f=i.timeRange,p=l._mp4.getFragRange(d),!t.initSeg&&s&&(t.initSeg=s),m=l.updatePreCacheData(t,n,h,a,d,f,p),console.log("[Preloader] ".concat(t.cacheKey," _successCallback"),d,a,m,h,f,p,r),t.from=3,!m){e.next=20;break}return e.next=12,l.setPreLoadData(t.cacheKey,t);case 12:if(!(d>=o.length-1)){e.next=17;break}l.log("".concat(t.cacheKey," mp4.load end"),d),l._endLoadFragments(),e.next=20;break;case 17:return l.log("".concat(t.cacheKey," mp4.load start"),d+1),e.next=20,l._mp4.loadAllFragmentData(d+1,c,u);case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.next=8,this._mp4.loadAllFragmentData(0,c,u);case 8:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"_endLoadFragments",value:function(){this.log("_endLoadFragments loadingCount:".concat(this.loadingCount),this._pendingPromise?this._pendingPromise.state:null),this._pendingPromise&&(this._pendingPromise.resolve(),this._pendingPromise=null),this.loadingCount>0&&this.loadingCount--,this._mp4&&(this._mp4.destroy(),this._mp4=null)}},{key:"getFragment",value:function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=new ProxyPromise;return this.getData(e,t,a,!1).then((function(e){n.createFragment(new Uint8Array(e.res),t[0]-n.mdatStart,r,{range:t,context:e.context}).then((function(e){o.resolve(e)}))})),o}},{key:"getPreloadUrl",value:function(e){var t=e.url,r=e.range,n=e.definition,i=e.vid;return[{url:t,range:r,extData:{cacheKey:o.generateUniqueKey({vid:i,start:r[0],end:r[1],definition:n}),vid:i,format:"mp4"}}]}},{key:"getRangeList",value:function(e){var t=this.allCachedKeys,r={timeRange:[],contentRange:[]};for(var n in t)if(t.hasOwnProperty(n)&&n.indexOf(e)>-1){var i=n.split("#");0===i[2].indexOf("pretime")?r.timeRange.push([0,parseFloat(i[2].slice(7))]):r.contentRange.push([parseInt(i[2]),parseInt(i[3])])}return r}},{key:"hasItemSameVid",value:function(e){if(!e)return!1;var t=this.allCachedKeys;for(var r in t)if(t.hasOwnProperty(r)){if(r===e)return r;var n=r.split("#"),i=e.split("#");if(n.length>=4&&i.length>=4&&n[0]===i[0]){if(0===n[2].indexOf("pretime")&&0===i[2].indexOf("pretime"))return r;var a=[parseInt(n[2]),parseInt(n[3])],o=[parseInt(i[2]),parseInt(i[3])];if(o[0]>=a[0]&&o[1]>o[0]&&o[1]<=a[1])return r}}return!1}},{key:"removeOthers",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.allCachedKeys;for(var n in r)r.hasOwnProperty(n)&&n.split("#").length>=1&&function(){var r=n.split("#")[0];t.every((function(e){return e.split("#").length>=1&&e.split("#")[0]!==r}))&&(e.log("remove cache:".concat(n)),e.cacheInst.removeItem(n))}()}},{key:"getItemSameVid",value:function(e,t){var r=this.hasItemSameVid(e);return this.log("getItemSameVid: key:".concat(e," checkResult:").concat(r)),r?this.cacheInst.getItem(r,t).then((function(e){return{value:e,key:r}})):Promise.resolve({})}},{key:"setItem",value:function(e,t){return this.cacheInst.setItem(e,t)}},{key:"allCachedKeys",get:function(){return this.cacheInst._allCachedKeys}},{key:"cacheInst",get:function(){return this._preloadManager._cacheInst}},{key:"cancelPreloadByVid",value:function(e){if(e){for(var t=this._preloadManager._preloadDataList,r=[],n=0;n<t.length;n++){t[n].data.vid!==e?r.push(t[n]):(console.log("[Preloader] cancelPreloadByVid",e),this.log("cancelPreloadByVid",e))}this._preloadManager._preloadDataList=r}}},{key:"cancelLoading",value:function(e){this._endLoadFragments(),this._endLoadChunk();var t=this._preloadManager;if(t._currentPreloadInst){var r=t._currentPreloadInst._toLoadList,n=[];r.map((function(t){return t.playerId!==e&&n.push(t),t})),t._currentPreloadInst._toLoadList=n}var i=[],a=[];t._preloadDataList.map((function(t){return t.playerId!==e?i.push(t):a.push(t.data.vid),t})),this.log("cancelLoading",e,a.join(",")),t._preloadDataList=i}},{key:"checkIfExistInList",value:function(e){for(var t=this._preloadManager._preloadDataList,r=0;r<t.length;r++)if(e===t[r].data.vid)return!0;return!1}},{key:"addPreloader",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(e.data){e.data.vtype||(e.data.vtype=VTYPES.MP4);var n=e.data.vid,i=this.checkIfExistInList(n);console.log("[Preloader] addPreloader checkIfExistInList",n,i),r&&n===r||i||(e.playerId=t,this.addDashPreloader(e))}}},{key:"addPreloaderList",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=[],n=0;n<e.length;n++){var i=e[n].data,a=i.vid,o=i.vtype,s=this.checkIfExistInList(a);console.log("[Preloader] addPreloaderList checkIfExistInList",a,a===t,s),t&&a===t||s||(o||(e[n].data.vtype=VTYPES.MP4),r.push(e[n]))}console.log("[Preloader] addPreloaderList length is ".concat(r.length)),this.addDashPreloaderList(r)}},{key:"setUserSelectDefinition",value:function(e){this._preloadManager&&(this._preloadManager.userDefinition=e)}},{key:"getUserSelectDefinition",value:function(){return this._preloadManager.userDefinition||null}},{key:"destroy",value:function(){this._endLoadFragments(),this._endLoadChunk(),this.cancelLoading(this.playerId)}}],[{key:"PRELOAD_TYPES",get:function(){return PRELOAD_TYPES}},{key:"BitRateAdapter",get:function(){return _BITRATE_SELECTOR},set:function(e){_BITRATE_SELECTOR=e}},{key:"generateUniqueKey",value:function(e){var t=e.vid,r=e.mediaType,n=e.definition,i=e.codecType,a=e.vtype;return r=r||"video",n=n||"-1",i=i||CODEC_TYPE$1.H264,a=a||VTYPES.MP4,t?"".concat(t,"#").concat(r,"#").concat(i,"#").concat(a,"#").concat(n):null}}]),o}(),CUSTOM_EVENTS={MEDIA_EXPIRED:"MEDIA_EXPIRED",INIT_FAIL:"INIT_FAIL",PARSE_ERROR:"PARSE_ERROR",PLAYER_LOG:"PLAYER_LOG",BUFFERED_RESET:"BUFFERED_RESET"},BUFFER_BREAK=1e4,$$7=_export,$reduce=arrayReduce.left,arrayMethodIsStrict=arrayMethodIsStrict$8,CHROME_VERSION=engineV8Version,IS_NODE=engineIsNode,STRICT_METHOD=arrayMethodIsStrict("reduce"),CHROME_BUG=!IS_NODE&&CHROME_VERSION>79&&CHROME_VERSION<83;$$7({target:"Array",proto:!0,forced:!STRICT_METHOD||CHROME_BUG},{reduce:function(e){var t=arguments.length;return $reduce(this,e,t,t>1?arguments[1]:void 0)}});var GapJump=function(){function e(t,r){_classCallCheck$d(this,e),this.player=t,this.mediaElem=t.video,this.config=r,this.timer=new IntervalTimer$1,this.prevReadyState=this.mediaElem.readyState,this.didFireLargeGap=!1,this.seekingEventReceived=!1,this.onWaitFunc=this._onWaiting.bind(this),this.onPlayFunc=this._onPlay.bind(this),this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),!1!==this.config.useGapJump&&this._start(),this.hasPlayed=!1}return _createClass$d(e,[{key:"_onWaiting",value:function(){this.onGapJump()}},{key:"_onPlay",value:function(){this.hasPlayed=!0}},{key:"_start",value:function(){this.mediaElem.addEventListener("waiting",this.onWaitFunc),this.mediaElem.addEventListener("play",this.onPlayFunc)}},{key:"onSegmentAppend",value:function(e){if(this.config.enableCheckBufferDiff&&this.mediaElem){var t=e.reduce((function(e,t){return e+t.downloaded?t[1]-t[0]:0}),0);this._getBuffered(this.mediaElem.buffered).reduce((function(e,t){return e+(t.end-t.start)}),0)/t<.8&&(log$2("onSegmentAppend detectGap"),this.player&&this.player.emit("detectGap"))}this.onGapJump()}},{key:"onSeeking",value:function(){this.seekingEventReceived=!0,this.didFireLargeGap=!1}},{key:"onGapJump",value:function(){if(this.mediaElem.readyState!==HTMLMediaElement.HAVE_NOTHING){if(this.mediaElem.seeking){if(!this.seekingEventReceived)return}else this.seekingEventReceived=!1;if(!this.mediaElem.paused||0===this.mediaElem.currentTime||!this.hasPlayed){this.mediaElem.readyState!==this.prevReadyState&&(this.didFireLargeGap=!1,this.prevReadyState=this.mediaElem.readyState);var t=this.mediaElem.buffered,r=this.config.smallGapLimit||.5,n=this.config.gapDetectionThreshold||.1,i=this.mediaElem.currentTime,a=this._getIndex(t,i,n);if(null!==a&&(0!==a||t&&t.length)){var o=t.start(a)+.1;if(!(o>this.mediaElem.duration)){var s=o-i,u=s<=r;s<e.BROWSER_GAP_TOLERANCE||u&&(!0!==this.config.disableGapSetPosition&&(log$2("onGapJump this.mediaElem.currentTime"),this.mediaElem.currentTime=this.isSafari?o+.1:o),this.player&&this.player.emit("detectGap"),log$2("gapJump gapIndex",a,"isGapSamll",u,"jumpLargeGap",!1,"currentTime",this.mediaElem.currentTime),.08!==o&&this.player&&this.player.emit("log",{type:"oneevent",end_type:"gap",vid:this.player.config.vid,ext:{video_postion:Math.floor(1e3*o)}}))}}}}}},{key:"_getIndex",value:function(e,t,r){if(!e||!e.length)return null;if(1===e.length&&e.end(0)-e.start(0)<1e-6)return null;for(var n=this._getBuffered(e),i=null,a=0;a<n.length;a++){if(n[a].start>t&&(0===a||n[a-1].end-t<=r)){i=a;break}}return i}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var t=[],r=0;r<e.length;r++)t.push({start:e.start(r),end:e.end(r)});return t}},{key:"destroy",value:function(){this.mediaElem.removeEventListener("waiting",this.onWaitFunc),this.mediaElem.removeEventListener("play",this.onPlayFunc),this.timer.clear(),this.timer=null}}]),e}();GapJump.BROWSER_GAP_TOLERANCE=.001;var SPPED_CACHE="danger_d_speed";function convert32ToC64(e){var t=e.toString(16);return t.length<=8?{high:0,low:e}:{high:parseInt(t.substr(0,t.length-8),16),low:parseInt(t.substr(t.length-8),16)}}var BaseAbr=function(){function e(t,r,n,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{logger:function(){},openLog:!1};_classCallCheck$b(this,e),this.bitrate=r,this.segment_duration=i||5e3,this.logger=a.logger,this.openLog=a.openLog,this.cdnHost=t.cdnHost,this._loadedPromise=new ProxyPromise$1,this._wasmPromise=new ProxyPromise$1,this.config=t,this.autoBitrateOpts=t.autoBitrateOpts||{},this.stall_penalty=this.autoBitrateOpts.stall_penalty||11,this.switch_penalty=this.autoBitrateOpts.switch_penalty||4,this.interval=this.autoBitrateOpts.interval||1e3;var o=t.progressTimer||1e3,s=this.autoBitrateOpts.startInterval||o;this.initInterval=.8*s,this._prealodMethod=t.preloadmethod||0,this._videoWidth=0,this._videoHeight=0,this._hasDeviceInfoChanged=!0,this.updateMediaInfos(n,!1)}return _createClass$b(e,[{key:"onLoadWasm",value:function(){var e=this,t=this.module={onRuntimeInitialized:function(){e._wasmPromise.resolve()}};return(0,this.autoBitrateOpts.module)(t),this._wasmPromise}},{key:"updateMediaInfos",value:function(e){var t=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._heightToDefitionConfig=new Map,this._bitrateToDefitionConfig=new Map,e?(this.mediaInfos=e,this.mediaInfos.dynamic_video_list.forEach((function(e){t._heightToDefitionConfig.set(e.vheight,e),t._bitrateToDefitionConfig.set(e.bitrate,e)}))):r&&console.error("baseAbr mediaInfos null")}},{key:"parseMPD",value:function(){if(this.setDebugModel(this.openLog),this.mediaInfos){this.logger("mediaInfos",this.mediaInfos);try{for(var e=[],t=this.mediaInfos.dynamic_video_list,r=0;r<t.length;r++){var n=t[r];e.push({stream_id:"s".concat(r),bandwidth:n.bitrate||n.bandwidth,width:n.vwidth||n.width,height:n.vheight||n.height,codec:n.codecs||n.codec_type||"h264",frame_rate:Number(n.fps)||-1,segment_duration:this.segment_duration})}var i={v_adaptation:e},a=JSON.stringify(i);this.module.ccall("parseMPD","null",["string"],[a])}catch(e){}}else console.warn("mediaInfos is null")}},{key:"_getDefautSpeed",value:function(e){var t=0,r=window.navigator.connection;if(r&&r.downlink)t=1024*navigator.connection.downlink/8,this.logger("initSpeed connect",t);else try{t=parseFloat(proxyLocalStorage$1.getItem(SPPED_CACHE))||0,this.logger("initSpeed connect",t)}catch(e){}return 0===t&&(t=e&&e.historyAvspeed||0,this.logger("initSpeed history",t)),t}},{key:"setDebugModel",value:function(e){this.module._setDebugModel(e)}},{key:"updateBitrate",value:function(e){this.bitrate=e}},{key:"_updatePreloadSupplier",value:function(e,t){this.module._updatePreloadSupplier(e,t)}},{key:"updatePreloadSupplier",value:function(e){var t=this._getDefautSpeed();this._updatePreloadSupplier(t,e)}},{key:"getPreloadBitrate",value:function(){var e,t=null,r=[];try{this.logger("preloadMethod",this._prealodMethod),e=this.module._getPreloadBitrate(this._prealodMethod);for(var n=0;n<5;n++)r.push(this.module.HEAP32[e/Int32Array.BYTES_PER_ELEMENT+n]);var i={bitrate:r[0],pduration:r[1],preloadType:r[2],size:r[3],mediaType:r[4]};return this.logger("getPreloadBitrate",i),i}catch(e){t=null,console.log("getPreloadBitrate",e)}finally{this.module._free(e)}return t}},{key:"_updateDeviceInfo",value:function(e){try{if(this._hasDeviceInfoChanged){var t=window.devicePixelRatio||1;this.module._updateDeviceInfo(this._videoWidth||Number(this.config.width),this._videoHeight||Number(this.config.height),t,e||-1)}this._hasDeviceInfoChanged=!1}catch(e){console.log("_updateDeviceInfo")}}},{key:"preload",value:function(e){this.parseMPD(),this.updatePreloadSupplier(e),this._updateDeviceInfo(-1);var t=window.devicePixelRatio||1;return this.logger("baseAbr updateDeviceInfo width",this._videoWidth||Number(this.config.width),"height",this._videoHeight||Number(this.config.height),"dpr",t),this.getPreloadBitrate()}}]),e}();BaseAbr.SPPED_CACHE=SPPED_CACHE;var $$6=_export,getBuiltIn=getBuiltIn$d,apply=functionApply,bind2=functionBind,aConstructor=aConstructor$3,anObject=anObject$m,isObject$1=isObject$t,create3=objectCreate,fails$3=fails$V,nativeConstruct=getBuiltIn("Reflect","construct"),ObjectPrototype=Object.prototype,push=[].push,NEW_TARGET_BUG=fails$3((function(){function e(){}return!(nativeConstruct((function(){}),[],e)instanceof e)})),ARGS_BUG=!fails$3((function(){nativeConstruct((function(){}))})),FORCED$1=NEW_TARGET_BUG||ARGS_BUG;function _arrayLikeToArray$5(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _arrayWithoutHoles$4(e){if(Array.isArray(e))return _arrayLikeToArray$5(e)}function _iterableToArray$4(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray$5(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$5(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$5(e,t):void 0}}function _nonIterableSpread$4(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toConsumableArray$4(e){return _arrayWithoutHoles$4(e)||_iterableToArray$4(e)||_unsupportedIterableToArray$5(e)||_nonIterableSpread$4()}function _assertThisInitialized$6(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _setPrototypeOf$6(e,t){return(_setPrototypeOf$6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _inherits$6(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$6(e,t)}function _typeof$2(e){return(_typeof$2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _possibleConstructorReturn$6(e,t){if(t&&("object"===_typeof$2(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$6(e)}function _getPrototypeOf$6(e){return(_getPrototypeOf$6=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}$$6({target:"Reflect",stat:!0,forced:FORCED$1,sham:FORCED$1},{construct:function(e,t){aConstructor(e),anObject(t);var r=arguments.length<3?e:aConstructor(arguments[2]);if(ARGS_BUG&&!NEW_TARGET_BUG)return nativeConstruct(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return apply(push,n,t),new(apply(bind2,e,n))}var i=r.prototype,a=create3(isObject$1(i)?i:ObjectPrototype),o=apply(e,a,t);return isObject$1(o)?o:a}});var $$5=_export,uncurryThis$1=functionUncurryThis,toIntegerOrInfinity=toIntegerOrInfinity$c,thisNumberValue=thisNumberValue$2,$repeat=stringRepeat,fails$2=fails$V,$RangeError=RangeError,$String=String,floor=Math.floor,repeat2=uncurryThis$1($repeat),stringSlice$1=uncurryThis$1("".slice),nativeToFixed=uncurryThis$1(1..toFixed),pow=function(e,t,r){return 0===t?r:t%2==1?pow(e,t-1,r*e):pow(e*e,t/2,r)},log=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t},multiply=function(e,t,r){for(var n=-1,i=r;++n<6;)i+=t*e[n],e[n]=i%1e7,i=floor(i/1e7)},divide=function(e,t){for(var r=6,n=0;--r>=0;)n+=e[r],e[r]=floor(n/t),n=n%t*1e7},dataToString=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var n=$String(e[t]);r=""===r?n:r+repeat2("0",7-n.length)+n}return r},FORCED=fails$2((function(){return"0.000"!==nativeToFixed(8e-5,3)||"1"!==nativeToFixed(.9,0)||"1.25"!==nativeToFixed(1.255,2)||"1000000000000000128"!==nativeToFixed(0xde0b6b3a7640080,0)}))||!fails$2((function(){nativeToFixed({})}));function _createSuper$6(e){var t=_isNativeReflectConstruct$6();return function(){var r,n=_getPrototypeOf$6(e);if(t){var i=_getPrototypeOf$6(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$6(this,r)}}function _isNativeReflectConstruct$6(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}$$5({target:"Number",proto:!0,forced:FORCED},{toFixed:function(e){var t,r,n,i,a=thisNumberValue(this),o=toIntegerOrInfinity(e),s=[0,0,0,0,0,0],u="",c="0";if(o<0||o>20)throw $RangeError("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return $String(a);if(a<0&&(u="-",a=-a),a>1e-21)if(r=(t=log(a*pow(2,69,1))-69)<0?a*pow(2,-t,1):a/pow(2,t,1),r*=4503599627370496,(t=52-t)>0){for(multiply(s,0,r),n=o;n>=7;)multiply(s,1e7,0),n-=7;for(multiply(s,pow(10,n,1),0),n=t-1;n>=23;)divide(s,1<<23),n-=23;divide(s,1<<n),multiply(s,1,1),divide(s,2),c=dataToString(s)}else multiply(s,0,r),multiply(s,1<<-t,0),c=dataToString(s)+repeat2("0",o);return c=o>0?u+((i=c.length)<=o?"0."+repeat2("0",o-i)+c:stringSlice$1(c,0,i-o)+"."+stringSlice$1(c,i-o)):u+c}});var _ERR_CODE$1,ABR_EVENTS={ABR_CHANGE:"ABR_CHANGE_A",ABR_UPDATE_SPEC:"ABR_UPDATE_SPEC",START_ABR:"START_ABR",UPDATE_AUTO_DESC:"UPDATE_AUTO_DESC",ABR_START_PROGRESS:"ABR_START_PROGRESS",MAX_BUFFER_CHANGE:"MAX_BUFFER_CHANGE"},INIT_BIRTATE=0,MIN_WAITIONG=200,SEEKING_STATE={SEEK_NO:0,SEEK_FORWARD:1,SEEK_BACKWORD:-1},STALL_STATE={STALL_NO:0,STALL:1},AVG_ARGS={PLAYBACK_BITRATE:"avg_play_bitrate",DOWNLOAD_BITRATE:"avg_download_bitrate",DOWNLOAD_NETWORK_SPEED:"avg_download_speed",PREDICT_NETWORK_SPEED:"avg_predict_speed",BUFFER_LENGTH:"avg_buffer_length",QOE:"avg_qoe"},ABR=function(e){_inherits$6(r,BaseAbr);var t=_createSuper$6(r);function r(e,n,i,a,o){var s,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{logger:function(){},openLog:!1};_classCallCheck$b(this,r),(s=t.call(this,n,i,a,o,u)).player=e,s.timerId=0,s.isOpenAutoDefi=!!s.autoBitrateOpts.isOpenAutoDefi,s.onPlayrateChange=s._onPlayrateChange.bind(_assertThisInitialized$6(s)),s.onPlay=s._onPlay.bind(_assertThisInitialized$6(s)),s._stop=s.stop.bind(_assertThisInitialized$6(s)),s._bufferRange=new Map,s._sortedBufferRange=[],s._lastCheckResolutionStamp=0,s._currentDefinition=null,s._isSeeking=!1,s._waitingStartTime=0,s._stallCount=0,s._seekState=SEEKING_STATE.SEEK_NO,s._stallState=STALL_STATE.STALL_NO,s._videoCurrentTime=0,s.listeners=[{evt:"playbackrateChange",handler:s.onPlayrateChange},{evt:"ended",handler:s._stop},{evt:"error",handler:s._stop},{evt:"timeupdate",handler:s._onTimeUpdate.bind(_assertThisInitialized$6(s))},{evt:"addVideoBufferEnd",handler:s._bufferRangeUpdate.bind(_assertThisInitialized$6(s))},{evt:"canplay",handler:s._updateAutoDesc.bind(_assertThisInitialized$6(s))},{evt:"play",handler:s._onplayStart.bind(_assertThisInitialized$6(s))},{evt:ABR_EVENTS.MAX_BUFFER_CHANGE,handler:s._onMaxBufferChange.bind(_assertThisInitialized$6(s))},{evt:"seeking",handler:s._onSeeking.bind(_assertThisInitialized$6(s))},{evt:"seeked",handler:s._onSeekEnd.bind(_assertThisInitialized$6(s))},{evt:"waiting",handler:s._onWaiting.bind(_assertThisInitialized$6(s))},{evt:"playing",handler:s._onPlaying.bind(_assertThisInitialized$6(s))}],s._hasStart=!1,s.listeners.forEach((function(e){var t=e.evt,r=e.handler;s.player.on(t,r)})),s._isPaused=!1,s._hasAddFrament=!1,s._eventInfo={local_time_ms:0,internet_speed:0,buffer_length:0,last_bitrate:0,now_bitrate:0,play_speed:1},s._bitrateSet=[],s._generalInfo={},s._currentInAbr=!1,s._hasCalcTimelineLog=!1,s._abr_play_info={start_play_time_ms:0,is_hint:0,playback_info:{internet_speed_record:[],play_bitrate_record:[],buffer_length_record:[],play_speed_record:[],qoe_record:[],qoe_a_record:[],qoe_b_record:[],qoe_c_record:[]}},s._abrMethod=s.autoBitrateOpts.method||0,s.logger("abr: constructor"),s._loopInterval=s.initInterval,s._tickCount=0,s._fps=30,FpsDetection.install(),s.startTime=performance.now(),s.logger("time abr",(new Date).getTime()),s._maxCacheTimeVideo=s.config.maxBufferLength||s.config.preloadTime||50,s._maxCacheTimeAudio=s._maxCacheTimeVideo,s._prevDefinitionItem=null,s._currentItem=null,s._switchCount=0,s._switchBitrate=0,s._avgStatItems={};for(var c=Object.keys(AVG_ARGS),l=0;l<c.length;l++){var d=c[l],h=AVG_ARGS[d];s._avgStatItems[h]=new AvgStat}return s._qoeArgs=[0,0,0,0],s._abrUsed=-1,s._abrAlwaysOn=1,s._prelaodInfo=null,s._hasLogStartInfo=!1,s._hasExecuteAbrAlgo=!1,s._lastExecuteTimeInMs=0,s}return _createClass$b(r,[{key:"init",value:function(e){return this._mediaList=e,this.isOpenAutoDefi?this.onLoadWasm():this._wasmPromise.resolve(),this._wasmPromise}},{key:"execute",value:function(){return this.listenSize(),this.initFps(),this.onWinElemSizeChange(),this.onPlay()}},{key:"_onSeeking",value:function(){this._isSeeking=!0,this.player.currentTime<this._videoCurrentTime?this._seekState=SEEKING_STATE.SEEK_BACKWORD:this._seekState=SEEKING_STATE.SEEK_FORWARD,this.logger("seekState",this._seekState)}},{key:"_onSeekEnd",value:function(){this._isSeeking=!1}},{key:"_onWaiting",value:function(){var e=this;this._isSeeking||this._waitingStartTime>0||(this._waitingStartTime=(new Date).getTime(),this._stallId=setTimeout((function(){clearTimeout(e._stallId),e._stallCount++,e._stallState=STALL_STATE.STALL}),MIN_WAITIONG))}},{key:"_onPlaying",value:function(){this._waitingStartTime=0,this._stallState=STALL_STATE.STALL_NO,clearTimeout(this._stallId)}},{key:"initFps",value:function(){this.fpsDetection=new FpsDetection,this.fpsDetection.start(),this._fps=this.fpsDetection.fps,this._hasDeviceInfoChanged=!0}},{key:"listenSize",value:function(){this.mediaElem=this.player.video,this._onWinSizeChange=debounce$1(this.onWinElemSizeChange.bind(this),1e3,!1),window.addEventListener("resize",this._onWinSizeChange)}},{key:"onWinElemSizeChange",value:function(){if(this.mediaElem){var e=this.mediaElem.getBoundingClientRect();this._videoWidth=Math.floor(e.width),this._videoHeight=Math.floor(e.height),this._hasDeviceInfoChanged=!0}}},{key:"_onMaxBufferChange",value:function(e){var t=e.videoCacheTime,r=e.audioCacheTime;this._maxCacheTimeAudio=r,this._maxCacheTimeVideo=t}},{key:"_onTimeUpdate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._sortedBufferRange&&0!==this._sortedBufferRange.length&&this._currentInAbr){this._videoCurrentTime=this.player.currentTime;var r=Date.now();if(!(r-this._lastCheckResolutionStamp<1e3&&0!==this._lastCheckResolutionStamp)||t){this._lastCheckResolutionStamp=r;for(var n=this.player.currentTime,i=0,a=this._sortedBufferRange.length-1,o=null;i<=a;){var s=Math.floor(i+(a-i)/2),u=this._sortedBufferRange[s];if(n<u.start)a=s-1;else{if(!(n>=u.end)){o=u;break}i=s+1}}if(o){var c=this._bitrateToDefitionConfig.get(o.bandwidth),l=c&&c.definition;if(this._currentDefinition===l&&!t||!l)return void(l||this.logger("error defintion, mpd配置与接口配置不一致"));this._currentDefinition=l,this._prevDefinitionItem=this._currentItem,this._currentFps=c.fps,this._currentItem=c,this._emitAutoDescChange(l,!1,this._currentFps,c)}}}}},{key:"_emitAutoDescChange",value:function(e,t,r,n){console.log("[ABR],emitAutoDescChange, definition, ",e,",item,",n,",pre_item,",this._prevDefinitionItem),this.player.emit(ABR_EVENTS.UPDATE_AUTO_DESC,{definition:e,reset:t,fps:r,item:n,pre_item:this._prevDefinitionItem})}},{key:"_onplayStart",value:function(){this._hasStart=!0,this.logger("onplaystart")}},{key:"_updateAutoDesc",value:function(){var e=this;this._currentInAbr&&this._currentDefinition&&(this._updateId=setTimeout((function(){clearTimeout(e._updateId),e._emitAutoDescChange(e._currentDefinition,!1,e._currentFps,e._currentItem)}),0))}},{key:"_bufferRangeUpdate",value:function(e){if(void 0!==e.start){null===this._currentItem&&this._onTimeUpdate(null,!0);var t=e.start;this._hasAddFrament=!0,this._bufferRange.set(t,e);var r=_toConsumableArray$4(this._bufferRange.values());this._sortedBufferRange=r.sort((function(e,t){return e.start-t.start})),this.avgStat(AVG_ARGS.DOWNLOAD_BITRATE,e.bandwidth)}}},{key:"_onPlayrateChange",value:function(){this.module&&this.updateBufferInfo()}},{key:"_onPlay",value:function(){var e=this;if(!this.isOpenAutoDefi)return this.logger("onPlay"),INIT_BIRTATE;var t=INIT_BIRTATE;try{this.logger("abr: loadeddata"),this.updateSwitchInfo(),this.parseMPD(),this.updateDeviceInfo();var n=r.getIsPlayAutoDefi(this.autoBitrateOpts);if(this.isOpenAutoDefi&&n){this._abrUsed=1;var i=this._getDefautSpeed(this.player);t=this._loopAbr(i),this.start(),this.logger("time abr start prgress",(new Date).getTime()),this.logger("time abr costTime",performance.now()-this.startTime),this.logger("abr onplay"),this.startTimer=setTimeout((function(){e._loopInterval=e.interval,clearTimeout(e.startTimer),e.logger("interval change")}),5e3)}}catch(e){this.logger("abr: loadeddata error",e),this.logger("time abr costTime err",performance.now()-this.startTime)}return t}},{key:"start",value:function(){if(this.logger("abr: start"),this._isPaused=!1,!this._hasCalcTimelineLog){var e=1===Math.floor(100*Math.random());this._abr_play_info.is_hint=e?1:0}this._hasCalcTimelineLog=!0,this._loop()}},{key:"_loop",value:function(){var e=this;this._isPaused||(clearTimeout(this.timerId),this.timerId=setTimeout((function(){if(!e.player.paused||!e.player.config.autoplay&&!e._hasStart){var t=e._hasAddFrament?void 0:e._getDefautSpeed(e.player);e._loopAbr(t)}e._loop()}),this._loopInterval))}},{key:"updateDeviceInfo",value:function(){try{if(this.fpsDetection){var e=this.fpsDetection.fps;e!==this._fps&&(this._fps=e,this._hasDeviceInfoChanged=!0)}this._updateDeviceInfo(this._fps)}catch(e){}}},{key:"updateBufferInfo",value:function(e){var t=this.player.playbackRate,r=this.bufferLength,n=e||Math.floor(this.player.downloadSpeed);return this._tickCount<5&&0===n&&(n=this._getDefautSpeed(this.player),this.logger("initSpeed fix")),this.logger("maxCacheTimeAudio:",this._maxCacheTimeAudio,"maxCacheVideoTime",this._maxCacheTimeVideo,"seekState",this._seekState,"stallState",this._stallState),this.module._updateBufferInfo(t,this._maxCacheTimeAudio,this._maxCacheTimeVideo,r,r,n,this._seekState,this.player.currentTime,this._stallState),this._seekState=SEEKING_STATE.SEEK_NO,this._eventInfo={internet_speed:n,buffer_length:r,last_bitrate:this.bitrate,play_speed:t},this.logger("playRate:",t,"buff:",r,"downloadSpeed:",n),{buffer:r,downloadSpeed:n}}},{key:"updateSwitchInfo",value:function(){var e=(new Date).getTime();this._openTimeMs=e,this._abr_play_info.start_play_time_ms=e;var t=this.player.config.preloadTime||50,r=convert32ToC64(e),n=this.autoBitrateOpts.noStallCheckTime||5,i=this.openLog;this.logger("openTime:",e,"this.logger",i),this.module._updateSwitchInfo(r.low,r.high,n,i,this.stall_penalty,this.switch_penalty);var a=this._mediaList.video,o=a.map((function(e){var t=e.bandwidth,r=e.bitrate;return t||r}));this._bitrateSet=o.map((function(e,t){return{bitrate:e,codecs:a[t].codecs||a[t].codec_type}})),this._generalInfo={max_cache_time:t,bitrate_set:this._bitrateSet,segment_duration:this.segment_duration,preload_info:{},startup_info:{}}}},{key:"updatePreloadCacheInfo",value:function(e){try{this._prelaodInfo=e,this.logger("update preloadInfo",e),e&&e.item_num!==e.items.length&&(this.logger("preloadInfo invalid"),this._prelaodInfo=null)}catch(e){this.logger("updatePreloadCacheInfo",e),this._prelaodInfo=null}}},{key:"updatePreloadLogInfo",value:function(e){this._generalInfo.preload_info=e||{}}},{key:"_updatePreloadInfo",value:function(){try{var e=this.player.getPreloadInfos();if(e){var t=e.preloadInfo,r=e.abr;this.updatePreloadLogInfo(t),r&&this.updatePreloadCacheInfo(t)}if(this.logger("_updatePreloadInfo preloadinfos",e),null!=this._prelaodInfo){var n=JSON.stringify(this._prelaodInfo);this.module.ccall("updatePreloadInfo","null",["string"],[n])}else this.logger("_updatePreloadInfo preloadinfo null, no preload")}catch(e){this.logger("_updatePreloadInfo err",e)}}},{key:"_loopAbr",value:function(e){var t;this._tickCount++;var r=[];try{this.updateDeviceInfo();var n=this.updateBufferInfo(e),i=n.downloadSpeed,a=n.buffer;t=this.module._getPredictedBitrate(this.bitrate,this._abrMethod);for(var o=0;o<7;o++)r.push(this.module.HEAP32[t/Int32Array.BYTES_PER_ELEMENT+o]);var s=r[0],u=1===r[1];this._eventInfo.now_bitrate=s,this._eventInfo.local_time_ms=(new Date).getTime();var c=0;if(s!==this.bitrate&&0!==s){var l=this.bitrate;c=Math.abs(l-s);for(var d=[],h=this.player.video.buffered,f=0;f<h.length;f++)d.push({start:h.start(f),end:h.end(f)});var p=this._videoWidth||Number(this.config.width),m=this._videoHeight||Number(this.config.height),y=(new Date).getTime(),g={speed:"".concat(i," KB/s"),buffer_length:"".concat(a," s"),video_pos:this.player.currentTime,all_buffers:d,seek_state:this._seekState,stall_state:this._stallState,screen_width:p,screen_height:m,dpr:window&&window.devicePixelRatio,playbackRate:this.player.playbackRate,bitrateSet:this._bitrateSet,abrMethod:this._abrMethod,delta:this._hasExecuteAbrAlgo?y-this._lastExecuteTimeInMs:0};this._lastExecuteTimeInMs=y,this._hasExecuteAbrAlgo=!0,this.player.emit(ABR_EVENTS.ABR_CHANGE,this.bitrate,s,u,JSON.stringify(g)),this.logger("abr loop predicte:",s,"willStall:",u,"switchBitrate",c,"cur",l),this.bitrate=s}this._hasLogStartInfo||(this._hasLogStartInfo=!0,this._generalInfo.startup_info={predict_bitrate:s,download_speed:i,screen_width:this._videoWidth||Number(this.config.width),screen_height:this._videoHeight||Number(this.config.height),device_pixel_ratio:window&&window.devicePixelRatio,screen_fps:this._fps,startup_method:this._abrMethod}),this.player.emit("ABR_LOOP"),this.onAbrLoop(i,r[2],c,r.slice(3))}catch(e){this.logger("abr error",e),console.log("error",e)}finally{this.module._free(t)}return this.bitrate}},{key:"stop",value:function(){!0===(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&(this._abrAlwaysOn=-1),clearTimeout(this.timerId),this._isPaused=!0,this.logger("abr: stop")}},{key:"destroy",value:function(){var e=this;this._stop(),this.listeners.forEach((function(t){var r=t.evt,n=t.handler;e.player.off(r,n)})),this.player=null,this._heightToDefitionConfig=null,this._bitrateToDefitionConfig=null,this._bufferRange=null,this._sortedBufferRange=null,this.module=null,clearTimeout(this._stallId),clearTimeout(this._updateId),clearTimeout(this.startTimer),window.removeEventListener("resize",this._onWinSizeChange),this.fpsDetection&&this.fpsDetection.stop(),this.player=null}},{key:"eventInfo",get:function(){return this._eventInfo}},{key:"generalInfo",get:function(){return this._generalInfo}},{key:"bufferLength",get:function(){var e=this.player.getBufferedRange(),t=this.player.video.currentTime,r=e[1]-Math.max(e[0],t);return r=Math.max(0,r).toFixed(2),parseFloat(r)}},{key:"downloadSpeed",get:function(){return Math.floor(this.player.downloadSpeed)}},{key:"nowBitrate",get:function(){return this.bitrate}},{key:"openTimeMs",get:function(){return this._openTimeMs}},{key:"isCurrentInAbr",get:function(){return this._currentInAbr},set:function(e){this._currentInAbr=e}},{key:"onAbrLoop",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(this._qoeArgs=n,this._currentItem&&this.avgStat(AVG_ARGS.PLAYBACK_BITRATE,this._currentItem.bitrate),this.avgStat(AVG_ARGS.DOWNLOAD_NETWORK_SPEED,1e3*e*8),this.avgStat(AVG_ARGS.PREDICT_NETWORK_SPEED,t),this.avgStat(AVG_ARGS.BUFFER_LENGTH,this.bufferLength),this.avgStat(AVG_ARGS.QOE,this.getQoeRelValue(0)),r>0&&(this._switchCount++,this._switchBitrate+=r),this._abr_play_info.is_hint){var i=this,a=((new Date).getTime()-this.openTimeMs)/1e3;a=parseFloat(a.toFixed(2)),this._abr_play_info.playback_info.internet_speed_record.push([a,i.downloadSpeed]),this._abr_play_info.playback_info.play_bitrate_record.push([a,i.nowBitrate]),this._abr_play_info.playback_info.buffer_length_record.push([a,i.bufferLength]),this._abr_play_info.playback_info.play_speed_record.push([a,this.player.playbackRate]),this._abr_play_info.playback_info.qoe_record.push([a,this.getQoeRelValue(0)]),this._abr_play_info.playback_info.qoe_a_record.push([a,this.getQoeRelValue(1)]),this._abr_play_info.playback_info.qoe_b_record.push([a,this.getQoeRelValue(2)]),this._abr_play_info.playback_info.qoe_c_record.push([a,this.getQoeRelValue(3)])}}},{key:"getQoeRelValue",value:function(e){return this._qoeArgs[e]/100}},{key:"avgStat",value:function(e,t){var r=this._avgStatItems[e];r&&r.add(t)}},{key:"getAbrPlayInfo",value:function(){return this._abr_play_info}},{key:"updateAbrMethod",value:function(e){this._abrMethod=e}},{key:"getAbrMethod",value:function(){return this._abrMethod}},{key:"getAbrVVStats",value:function(){for(var e={},t=Object.keys(AVG_ARGS),r=0;r<t.length;r++){var n=t[r],i=AVG_ARGS[n],a=this._avgStatItems[i];e[i]=a.avg()}return e.switch_counts=this._switchCount,e.avg_switch_bitrate=0===this._switchCount?0:this._switchBitrate/this._switchCount,e.abr_qoe=this.getQoeRelValue(0),e.abr_qoe_a=this.getQoeRelValue(1),e.abr_qoe_b=this.getQoeRelValue(2),e.abr_qoe_c=this.getQoeRelValue(3),e.abr_method=this._abrMethod,e.abr_used=this._abrUsed,e.abr_always_on=this._abrAlwaysOn,this.logger("abrVVStats",e),e}}],[{key:"getIsPlayAutoDefi",value:function(e){return!!e.isPlayAutoDefi}}]),r}(),AvgStat=function(){function e(){_classCallCheck$b(this,e),this.total=0,this.count=0}return _createClass$b(e,[{key:"add",value:function(e){this.total+=e,this.count++}},{key:"avg",value:function(){if(0===this.count)return 0;var e=this.total/this.count;return Math.floor(e)}}]),e}(),START_TYPES={FIXED:"FIXED",AUTO:"AUTO"},AbrService=function(){function e(t,r){var n=this;_classCallCheck$d(this,e),_defineProperty$b(this,"_onAbrChange",(function(e,t,r,i){var a=n._pluginInst.player,o=n.bitrateMap[e],s=n.bitrateMap[t],u=o.definition,c=s&&s.definition?s.definition:u;console.log("[ABR] _onAbrChange ",u,c),u!==c&&(n._abrSwitchHandler(s),a.emit("ABR_CHANGE",{prev:u,cur:c,prevName:o.definitionName,curName:s.definitionName,abrInfo:i}))})),_defineProperty$b(this,"_onAutoDescChange",(function(e){var t=e.definition,r=e.reset,i=e.fps,a=e.item;n.updateAutoDefiDesc(t,r,i,a)})),this._pluginInst=t;var i=this._pluginInst.config.autoBitrateOpts||{};this.isPlayAutoDefi=ABR.getIsPlayAutoDefi(i),this.isOpenAutoDefi=!!i.isOpenAutoDefi,this.isCurrentAutoDefi=this.isOpenAutoDefi&&this.isPlayAutoDefi,this.bitrateMap={},this.defiIdMap={},this._abrSwitchHandler=r}var t;return _createClass$d(e,[{key:"_destroyAbr",value:function(){var e=this._pluginInst.player;this.abrInstance&&(e&&e.off(ABR_EVENTS.UPDATE_AUTO_DESC,this._onAutoDescChange),this.abrInstance.destroy(),this.abrInstance=null)}},{key:"init",value:(t=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(t){var r,n,i,a;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isOpenAutoDefi){e.next=2;break}return e.abrupt("return",{type:START_TYPES.FIXED});case 2:return r=this._pluginInst,n=r.player,i=r.playerConfig,a=r.config,n.on(ABR_EVENTS.UPDATE_AUTO_DESC,this._onAutoDescChange),this.bitrateMap={},this.defiIdMap={},this.abrInstance=new ABR(n,a,0,{dynamic_video_list:i.definition.list.concat()},5e3,{logger:log$2,openLog:openLog}),e.next=9,this.abrInstance.init(t);case 9:n.on(ABR_EVENTS.ABR_CHANGE,this._onAbrChange),this.abrInstance.isCurrentInAbr=this.isCurrentAutoDefi;case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"execute",value:function(){var e=this.abrInstance.execute();return{bitrate:e,type:-1===e?START_TYPES.FIXED:START_TYPES.AUTO}}},{key:"updateBitrate",value:function(e){this.abrInstance&&this.abrInstance.updateBitrate(e)}},{key:"enable",value:function(){this.abrInstance.start(),this.isCurrentAutoDefi=!0,this.abrInstance.isCurrentInAbr=!0,this.abrInstance._onTimeUpdate(null,!0)}},{key:"disable",value:function(){this.abrInstance&&(this.updateAutoDefiDesc("",!0),this.isCurrentAutoDefi=!1,this.abrInstance.isCurrentInAbr=!1,this.abrInstance.stop(!0))}},{key:"isCurrentInAbr",value:function(){return!!this.abrInstance&&this.abrInstance.isCurrentInAbr}},{key:"updateAutoDefiDesc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=this._pluginInst,a=i.player,o=(i.config.autoBitrateOpts||{}).autoDefiText||"auto";a.emit("ABR_AUTO_DESC_CHANGE",o,t?void 0:e,r,n)}},{key:"updateAbrCacheData",value:function(){var e=this,t=this._pluginInst,r=t.player,n=t.config,i=t.playerConfig,a=n.autoBitrateOpts||{},o=i.definition.list,s=!1;if(o.forEach((function(t){e.bitrateMap[t.bitrate]={url:t.url,definition:t.definition,definitionName:t.text},e.defiIdMap[t.definition]={bitrate:t.bitrate,definition:t.definition},"auto"!==t.definition&&"自动"!==t.definition||(s=!0)})),this.isOpenAutoDefi,this.isOpenAutoDefi&&!s){var u=a.autoDefiText||"auto",c={definition:"自动",bitrate:r.curDefinition.bitrate,text:u,url:"__auto__",selected:this.isPlayAutoDefi,name:"自动",vwidth:r.curDefinition.vwidth,vheight:r.curDefinition.vheight};i.definition.list.push(c)}}},{key:"destroy",value:function(){this._pluginInst.player.off(ABR_EVENTS.ABR_CHANGE,this._onAbrChange),this._destroyAbr()}}]),e}(),DESTROYED="DESTROYED",REAL_TIME_SPEED_EVENT="real_time_speed",_playerPlayNext=null,_playerStartInit=null,_playerChangeDefinition=null,_playerSwitchUrl=null,CODEC_TYPE={H264:"h264",H265:"h265"},_realTimeSpeed=0,Mp4EncryptPlayer=function(e){_inherits$a(i,BasePlugin);var t,r,n=_createSuper$a(i);function i(e){var t;return _classCallCheck$d(this,i),_defineProperty$b(_assertThisInitialized$a(t=n.call(this,e)),"_replayHook",(function(e){"xgmse-video"===t.player.config.mediaType?t._onReplay():t.useVideoLoad||(t._defInited=!1,t.log("replayHook ",t.playerConfig.url),t.player.video.load(),t.playerStartInit(t.playerConfig.url))})),_defineProperty$b(_assertThisInitialized$a(t),"_retryHook",(function(){var e=_assertThisInitialized$a(t),r=e.player,n=e.playerConfig,i=e.config,a=r.currentTime;if(t.codecType!==CODEC_TYPE.H265||i.supportHevc){t._defInited=!1;var o=t.config,s=o.drm,u=o.kid,c=o.secretKey,l=o.keyValue;if(s||u||c||l)t.initAwManager(),t.playerStartInit(n.url);else{if(t.useVideoLoad=!0,"Array"===util$2.typeOf(n.url)){var d=n.url.length;r.video.src=n.url[d-1].src}else r.video.src=n.url;r.currentTime=a,r.play()}}else t.log("h265 retryHook ",n.vid),t._onDegrade("retry");return!1})),_defineProperty$b(_assertThisInitialized$a(t),"_playHook",(function(e){t._usePaused=!1})),_defineProperty$b(_assertThisInitialized$a(t),"_pauseHook",(function(e){t._usePaused=!0})),_defineProperty$b(_assertThisInitialized$a(t),"abrSwitchURL",function(){var e=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(r){var n,i,a,o,s,u;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=_assertThisInitialized$a(t),i=n.playerConfig,a=i.definition.list,o=0,s=0;case 4:if(!(s<a.length)){e.next=11;break}if(r.definition!==a[s].definition){e.next=8;break}return o=s,e.abrupt("break",11);case 8:s++,e.next=4;break;case 11:u=t.player.curDefinition,t.changeDefinition(a[o],u,!0);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),_defineProperty$b(_assertThisInitialized$a(t),"changeDefineCanPlay",(function(e,r,n,i){var a=_assertThisInitialized$a(t).player;a.ended?a.currentTime=0:(t.log("[oldChangeDefinition],this._changeDefState,",t._changeDefState),a.currentTime=t._changeDefState?t._changeDefState.currentTime:e,(t._changeDefState?t._changeDefState.paused:r)?a.pause():a.play(),t._changeDefState=null,a.emit(AFTER_DEFINITION_CHANGE,{from:n,to:i}))})),_defineProperty$b(_assertThisInitialized$a(t),"changeDefinition",(function(e,r,n){var i=_assertThisInitialized$a(t),a=i.player,o=i.playerConfig,s=i.mp4;if(r||(r=a.curDefinition),t.useVideoLoad)return"__auto__"===e.url&&(e.url=a.config.definition.list[0].url),void _playerChangeDefinition.call(t.player,e,r);if(t._switchBitRateWay&&!n)return t.log("changeDefinition old"),void t.oldChangeDefinition(e,r);var u="自动"===e.definition||"auto"===e.definition;if(n)t.log("[switchBitrate:ABR], ready to switch bitRate, ",e.bitrate);else{var c=!1;if(u)t._abrService&&t._abrService.enable(),c=!0;else if(t._abrService&&t._abrService.disable(),!e.bitrate||e.bitrate<=0)for(var l=0;l<o.definition.list.length;l++)e.definition===o.definition.list[l].definition&&(e.bitrate=o.definition.list[l].bitrate);a.emit(DEFINITION_CHANGE,{from:r,to:e}),setTimeout((function(){t._abrService&&t._abrService.updateAutoDefiDesc(a.curDefinition.definition,!u)})),c&&(e=a.curDefinition),t.log("[switchBitrate:CBS],switch bitRate, ",e.bitrate)}a.curDefinition=e;var d=a.definitionList.filter((function(e){return e.definition===a.curDefinition.definition}));d.length>0&&(e=d[0]),s&&(t.config.keyValue=e.keyValue,t.config.kid=e.kid,t.config.secretKey=e.secretKey,t.config.drm=e.drm,t.config.getLicenseUrl=e.getLicenseUrl,t._getLicense().then(_asyncToGenerator$7(_regeneratorRuntime$7().mark((function r(){var i,u,c,l,d,h;return _regeneratorRuntime$7().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o.url=e.url,o.backupURL=e.backupURL,i=0,u=!1,t._abrService&&t._abrService.isCurrentInAbr()?(c=a.getBufferedRange(a.buffered2),(i=c[1])<a.currentTime&&(i=a.currentTime,t.log("bufferRange is invaild,adjust",c,",timeStart,",i)),t.log("[switchBitrate:ABR],switch bufferedList, ",t.player.buffered2?t.player.buffered2.bufferedList:null,",curtime,",a.currentTime,",bufferRange,",c)):(i=a.currentTime,u=!0),(l=s.getFragmentIdx(i))<0&&(l=t._curLoadSegmentIdx),t.log("switchBitrate:point,",l,",startTime,",s.timeRange[l].startTime,",currentTime,",a.currentTime),u&&a.emit("definitionSwitchTime",s.timeRange[l].startTime+1),t.changeState("changeDefinition",{abr:n,fragIndex:l,startTime:s.timeRange[l].startTime,currentTime:a.currentTime}),!s){r.next=14;break}return r.next=13,s.cancelLoading();case 13:s._metaLoading&&(s._metaLoading=!1);case 14:return!((d=a.getBufferedRange(a.buffered))[1]>0&&d[1]-a.currentTime>5)||t._abrService&&t._abrService.isCurrentInAbr()||(t.mse.clearOpqueues(CONTENT_TYPES.VIDEO),t.mse.reuse(a.currentTime+5,d[1])),s.resetFragmentLoadState(l),t._curLoadSegmentIdx=l,r.next=20,t.mp4.changeBitRate(e);case 20:h={width:e.width||e.vwidth,height:e.height||e.vheight},a.emit("RESOLUTION_UPDATE",h);case 22:case"end":return r.stop()}}),r)})))).catch((function(r){console.error(r),r.errorType="GET_LICENSE_ERROR",t.emit("error",r),t.changeState("LICENSE_ERROR",{d:e.definition})})))})),_defineProperty$b(_assertThisInitialized$a(t),"_onVideoError",(function(e){t.log("video err,",e)})),_defineProperty$b(_assertThisInitialized$a(t),"_onPlaying",(function(){t._waitAdjustTimeCnt>0&&t._waitInBufferTimer&&(t._waitAdjustTimeCnt-=1,t.log("[waitInBuffer resume play], waitAdjustTimeCnt,",t._waitAdjustTimeCnt)),clearTimeout(t._waitInBufferTimer),t._waitInBufferTimer=null,t.log("[Index] onPlaying, timeNow,",util$1.nowTime());var e=_assertThisInitialized$a(t),r=e.mp4,n=e.player,i=t.config.resumePlayWaterLevel;if(r){if(!t.playFlag||n.currentTime<1)t.playFlag=!0;else if(!(r&&r.meta&&r.meta.duration-n.currentTime<=i)&&i>0&&t.playFlag){var a=n.getBufferedRange(n.buffered2);a[1]-n.currentTime<i?(n.paused||(n.pause(),t.log("[!!!!!buffer not rich, pause],time,",util$1.nowTime(),", currentTime, ",n.currentTime,", bufferEnd,",a[1])),clearTimeout(t.checkResumePlayTimer),t.checkResumePlayTimer=setTimeout(t._onPlaying,i/2*1e3)):n.paused&&(t.log("[!!!!!buffer rich, play],time,",util$1.nowTime(),", currentTime, ",n.currentTime,", bufferEnd,",a[1]),clearTimeout(t.checkResumePlayTimer),t.checkResumePlayTimer=null,n.play())}}else t.checkResumePlayTimer>0&&(clearTimeout(t.checkResumePlayTimer),t.checkResumePlayTimer=null,n.paused&&n.play())})),_defineProperty$b(_assertThisInitialized$a(t),"_lowDecoder",(function(){var e="function"==typeof t.player.video.getStats?t.player.video.getStats():null;t.log("H265 lowdecode: ".concat(t.playerConfig.vid," "),e,", h265Degrade, ",t.config.h265Degrade),t.config.h265Degrade&&t._onDegrade()})),_defineProperty$b(_assertThisInitialized$a(t),"_onError",(function(e){console.log("H265 onError: ".concat(t.playerConfig.vid," "),e,", h265Degrade, ",t.config.h265Degrade),t._onDegrade(e)})),_defineProperty$b(_assertThisInitialized$a(t),"_onDegrade",(function(e){var r,n,i=_assertThisInitialized$a(t),a=i.player,o=i.playerConfig,s=i.config;a.video.removeEventListener("lowdecode",t._onDegrade),a.video.removeEventListener("error",t._onError),null===(r=t.mp4)||void 0===r||r.destroy();var u=a.currentTime;if(console.log("[h265 degrade], vid,",o.vid,",currtime,",u),t.emit("H265_DEGRADE",{reason:e?"error":"lowdecode",currentTime:u}),null!=s&&s.H264Config){var c=s.H264Config;s.drm=(null==c?void 0:c.drm)||null,s.getLicenseUrl=(null==c?void 0:c.getLicenseUrl)||null,s.kid=(null==c?void 0:c.kid)||null,s.keyValue=(null==c?void 0:c.keyValue)||null,s.secretKey=(null==c?void 0:c.secretKey)||null,s.isEncrypt=(null==c?void 0:c.isEncrypt)||null,s.useEME=(null==c?void 0:c.useEME)||null}var l={mp4encryptplayer:s,mediaType:"video",codecType:CODEC_TYPE.H264};(null==o||null===(n=o.H264DefinitionList)||void 0===n?void 0:n.length)>0?(a.config.definition.list=o.H264DefinitionList,a.config.url=o.H264DefinitionList[0].url,a.config.defaultBitrate=o.H264DefinitionList[0].bitrate,a.config.defaultDefinition=o.H264DefinitionList[0].definition,a.playNext(l),a.once("canplay",(function(){a.currentTime=u}))):(console.error("H265 error,degrade h264 but no h264 url"),t.emit("error",e))})),_defineProperty$b(_assertThisInitialized$a(t),"_onMp4MetaReady",(function(e){console.log(">>>>_onMp4MetaReady",util$1.nowTime()),t.firstFrameTime.metaload=t.mp4.firstFrameTime.metaload,t.firstFrameTime.bitrate=t.player.curDefinition.bitrate;var r=t.playerConfig.vid,n=t._checkMetaInfo(e),i=t.mp4.checkCodecH265();if(t.changeState("MP4_META_READY",{is265:i?1:0}),n)return t.removeAndRejectInitPromise(n),void t._errorHandler(n);try{if(t._initEME(t.mp4,e),t.codecType!==CODEC_TYPE.H265||t.config.supportHevc){if(!(t.player.video instanceof HTMLVideoElement))return void console.error("".concat(t.player.config.mediaType," is not match"));t._initMse(e)}else{if(!i||t.player.video instanceof HTMLVideoElement)return void console.error("[Index] ".concat(r," config_codec ").concat(t.codecType," and meta_codec ").concat(e.videoCodec," is not match or supportHevc is ").concat(t.config.supportHevc));t._initH265MseProxy()}t._initPromise.resolve()}catch(e){t.removeAndRejectInitPromise(e),console.error("[Index] ".concat(r," _initEME error"),e);var a=new Errors(t.player,{errorType:"runtime",errorTypeCode:ERROR_TYPES.runtime,errorCode:ERROR_CODES.other1,errorMessage:null==e?void 0:e.message,vid:r,mediaError:{code:ERROR_CODES.other1,message:null==e?void 0:e.message}});t._errorHandler(a)}if(t.mp4&&t.mp4.timeRange){var o=[];t.mp4.timeRange.every((function(e){return o.push({startTime:e.startTime,endTime:e.endTime}),!0})),t.emit("KEYFRAMETIME",o)}t._loadData()})),_defineProperty$b(_assertThisInitialized$a(t),"_onMp4Error",(function(e){var r=t.playerConfig.vid;console.error("[Index] _onMp4Error",r,e),t.changeState("MP4_ERROR",e),t._initPromise&&"pending"===t._initPromise.state&&t.removeAndRejectInitPromise(e),t._errorHandler(e)})),_defineProperty$b(_assertThisInitialized$a(t),"_onMp4Progress",(function(e){t.emit("progress_event",e)})),_defineProperty$b(_assertThisInitialized$a(t),"_onMp4DataCallBack",(function(){t.mse&&!t.mse.ready&&t.openMSE(),t._isMseInit&&t._onTimeUpdate()})),_defineProperty$b(_assertThisInitialized$a(t),"_updateDrmConfig",(function(e){var r=_assertThisInitialized$a(t),n=r.config,i=r.mp4;e.kid&&n.keyValue?n.drm={clearKeys:_defineProperty$b({},e.kid,n.keyValue)}:!e.kid&&n.keyValue&&(n.useEME=!1),i.useEME=n.useEME;var a=n.drm;n.useEME||(i.kidValue=n.keyValue||(a&&a.clearKeys?a.clearKeys[Object.keys(a.clearKeys)[0]]:null)),t.eme&&a&&a.clearKeys&&n.useEME&&t.eme.updateDrm(a)})),_defineProperty$b(_assertThisInitialized$a(t),"_onVideoTimeUpdate",(function(){t.useVideoLoad||null!==t._requestTimer||!t._offineLine&&t._startProgress(),t.useVideoLoad&&t.checkIfCanPreload()})),_defineProperty$b(_assertThisInitialized$a(t),"_onBufferedReset",(function(e){t.mp4&&t.mp4.videoTrak&&t.mp4.resetFragmentLoadState(0)})),_defineProperty$b(_assertThisInitialized$a(t),"_onOnlineHandler",(function(){t._offineLine=!1;var e=_assertThisInitialized$a(t).config;t.log("online useVideoLoad:",t.useVideoLoad,t._hasStartProgressBack),t.useVideoLoad?t.player.src=e._mainURL:(t._hasStartProgressBack&&t._startProgress(),t._hasStartProgressBack=!1)})),_defineProperty$b(_assertThisInitialized$a(t),"_onOfflineHandler",(function(){t._offineLine=!0,t.log("offline, ",t._hasStartProgress),t._hasStartProgress&&(t._stopProgress(),t._hasStartProgressBack=!0)})),_defineProperty$b(_assertThisInitialized$a(t),"_loadDataSuccess",(function(e){if(!t.isDestroy&&(t.mse||t.mseProxy)){e.state&&t._firstSegState<0&&(t._firstSegState=1),t.log("[loadFragment] _loadDataSuccess ",JSON.stringify(e.context.range),",dataLen,",e.buffer?e.buffer.byteLength:0,e.state),t.firstFrameTime.startload_stmux<0&&(t.firstFrameTime.startload_stmux=t.mp4.firstFrameTime.startMuxTime,t.firstFrameTime.firstmux=t.mp4.firstFrameTime.firstmux),t.firstFrameTime.loadst_loadeddata<0&&(t.firstFrameTime.loaddata=util$1.nowTime()-t.loadstart);try{e.initSeg&&(t._appendInitSeg(e.initSeg),(!e.buffer||e.buffer.byteLength<1)&&(t.log("no data, must load data"),t._onTimeUpdate()));var r=e.buffer,n=e.state,i=e.context,a=e.videoTrack,o=e.audioTrack;if(t.debugInfo.loadIndx=i?i.fragIndex:-1,t.mse&&n&&(!r||r.byteLength<=0)&&i.fragIndex===t.mp4.timeRange.length-1){var s=t.player.buffered;t.bufferEndTime=s.end(s.length-1),t._isEnded(),t.log("loaded ended !!!==>>>",JSON.stringify(i.range),", fragIndex,",i.fragIndex,", bufferEndTime,",t.bufferEndTime,",meta_duration,",t.mp4.meta.duration)}if(t.mse&&n&&i.fragIndex===t.mp4.timeRange.length-1&&(!r||r.byteLength<=0)){var u=t.player.buffered;t.bufferEndTime=u.end(u.length-1),t._isEnded(),t.log("load ended !!!==>>>",t.playerConfig.vid,JSON.stringify(i.range),", fragIndex,",i.fragIndex,", bufferEndTime,",t.bufferEndTime,",meta_duration,",t.mp4.meta.duration)}if(r&&t.mse){if(r&&r.byteLength>0){t._appendBuffer(CONTENT_TYPES.VIDEO,r,i,n);var c=t.getDataBitRate(i.fragIndex);t.player.emit("addVideoBufferEnd",{start:Math.floor(i.startPts),end:i.endPts,bandwidth:c.bitrate})}}else if(t.mseProxy&&(a&&a.samples.length>0||o&&o.samples.length>0)){var l=a.samples.length>0?a.samples[0].sampleOffset:-1,d=a.samples.length>0?a.samples[a.samples.length-1].sampleOffset:-1,h=o.samples.length>0?o.samples[0].sampleOffset:-1,f=o.samples.length>0?o.samples[o.samples.length-1].sampleOffset:-1;t.log("[livevideo] appendBuffer,index,",i.fragIndex,",range,",JSON.stringify(e.context.range),",videoIdxRange,",l,"-",d,",audioIdxRange,",h,"-",f,", timeRange,",i.timeRange),t.mseProxy.appendBuffer(a,o)}}catch(e){t.changeState("APPEND_DATA_ERROR"),t.log("appendBuffer error",e);var p=new Errors(t.player,{errorType:"runtime",errorTypeCode:ERROR_TYPES.runtime,errorCode:ERROR_CODES.mse,vid:t.player.config.vid,errorMessage:e.message,mediaError:{code:ERROR_CODES.mse,message:e.message}});t._errorHandler(p)}}})),_defineProperty$b(_assertThisInitialized$a(t),"_onWaiting",(function(){var e=_assertThisInitialized$a(t),r=e.player,n=e.config,i=e.playerConfig;clearTimeout(t._waitInBufferTimer),t._waitInBufferTimer=null;var a=r.currentTime;console.log("[>>>>onWaiting],currentTime, ",a,util$1.nowTime());var o=r.bufferedPoint;o.end>0&&o.end-r.currentTime>=2&&(t._waitAdjustTimeCnt<n.waitJampBufferMaxCnt?t._waitInBufferTimer=setTimeout((function(){t._waitAdjustTimeCnt++,r.currentTime=r.currentTime+.5,t.log("[waitInBufferTimeout], waitAdjustTimeCnt,",t._waitAdjustTimeCnt,",curtime,",a,util$1.nowTime())}),n.waitingInBufferTimeOut):t._errorHandler(new Errors(t.player,{errorType:"waitInBuffer",errorTypeCode:ERROR_TYPES.runtime,errorCode:ERROR_CODES.onWaitInBufferRange,errorMessage:"onWait_in_buffer",vid:i.vid})))})),_defineProperty$b(_assertThisInitialized$a(t),"_onEnded",(function(){t.log("[player.onEnded], stopProgress"),t.player&&t.off("waiting",t._onWaiting),t._stopProgress()})),_defineProperty$b(_assertThisInitialized$a(t),"_onReplay",(function(){var e=_assertThisInitialized$a(t),r=e.playerConfig,n=e.player;t._reset(),t._init(r.url).then((function(e){var r=e[0],i=e[1];n.video.src=i.url,t._startProgress(),t.mp4=r,t.mse=i,t.log("_replay play"),t.once("canplay",(function(){n.play(),t.on("waiting",t._onWaiting)}))}),(function(e){t.log("_errorHandler6",e),t._errorHandler(e)}))})),_defineProperty$b(_assertThisInitialized$a(t),"_onSeeking",_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(){var r,n,i,a,o,s,u,c,l,d,h;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.useVideoLoad){e.next=2;break}return e.abrupt("return");case 2:if(r=_assertThisInitialized$a(t),n=r.player,i=r.mp4,a=n.currentTime,t.changeState("seeking",{curTime:a}),t.log("[seekTime], curTime,",a,",buffer,",n.buffered2.bufferedList),i&&i.meta){e.next=8;break}return e.abrupt("return");case 8:if(t.endofstream=!1,i.bufferLoadedPos=-1,i._metaLoading=!1,o=n.bufferedPoint,s=!1,u=0,!(o.end>0)){e.next=23;break}if(s=!0,u=i.getFragmentIdx(o.end),t._curLoadSegmentIdx!==u){e.next=20;break}return t.log("[seeking in buffered range], seek fragIndex is current load segmentIdx",u),e.abrupt("return");case 20:i.seekTime=o.end,u<0&&(u=t._curLoadSegmentIdx),t.log("[seeking in buffered range], seekTime ",a,",bufferRange,",o.start,"-",o.end,", fragIndex,",u);case 23:return s||(i.seekTime=a,(u=i.getFragmentIdx(a))<0&&(u=t._curLoadSegmentIdx),t.log("[seekTime out buffer range], curTime,",a,", Idx,",u),c=_assertThisInitialized$a(t),(l=c.mse)&&l.isFull()&&(d=n.buffered2.bufferedList,h=d[d.length-1],l.clearOpqueues(CONTENT_TYPES.VIDEO),t._checkRemoveSourceBuffer([h.start,h.end],n.currentTime,!0,!0))),e.next=26,i.cancelLoading();case 26:i.resetFragmentLoadState(u),t._curLoadSegmentIdx=u,t._onTimeUpdate(),t._isEnded();case 30:case"end":return e.stop()}}),e)})))),t._pendingPromises=[],t._allInitPromise=new ProxyPromise,t._isInit=!1,t._isEventInit=!1,t.playerId=t.player._pluginInfoId,t.preloader=null,t.gapJumpInst=null,t.log("playerId",t.playerId),t._tickInSeconds=t.config.tickInSeconds,t.awManager=null,t._useVideoLoad=!1,t.mse=null,t.mp4=null,t.eme=null,t._isMseInit=!1,t._awPromise=null,t._corePromise=null,t._initPromise=null,t._hasStartProgress=!1,t._hasStartProgressBack=!1,t._maxBufferLength=t.config.maxBufferLength,t._minBufferLength=t.config.minBufferLength,t._switchBitRateWay=t.config.switchBitRateWay,t._curLoadSegmentIdx=0,t._abrService=null,t._checkRemoveBufferLastTime=util$1.nowTime(),t.playFlag=!1,t.config.resumePlayWaterLevel=Math.min(t.config.minBufferLength,t.config.resumePlayWaterLevel),t.checkResumePlayTimer=null,t.loadstart=-1,t._loadStartEventTime=-1,t._waitAdjustTimeCnt=0,t._waitInBufferTimer=null,t._firstSegState=-1,t.codecType=t.playerConfig.codecType?t.playerConfig.codecType.toLowerCase():CODEC_TYPE.H264,t.playerConfig.vtype&&(t._vtype=t.playerConfig.vtype.toUpperCase()),t.firstFrameTime={newplayer:util$1.nowTime(),newplayer_initkernel:-1,initkernel_initmp4:-1,initmse_sbopen:-1,mseopen:-1,initmse_sbopendone:-1,metaload:-1,metaready_mseisopen:-1,metaready_initsegend:-1,startload_stmux:-1,firstmux:-1,apcnt:0,aplen:0,data_ap:-1,loadst_loadeddata:-1,loaddata:-1,new_loadeddata:-1,bitrate:-1},t.debugInfo={},t.states=[],t.removeVideo=null,t._lastCheckTime=util$1.nowTime(),t._changeDefState=null,t._defInited=!1,t.states=[],t.preLoadData=null,t.forPreloadTimeCache=null,t._usePaused=!1,t.endofstream=!1,t.bufferEndTime=-1,t.hitpreload=!1,window&&window.location.href.indexOf("playerInstance=true")>-1&&(void 0===window.mp4PlayerInstanceList&&(window.mp4PlayerInstanceList=[]),window.mp4PlayerInstanceList.push(t.player)),t}return _createClass$d(i,[{key:"afterCreate",value:function(){var e=this,t=this.playerConfig,r=this.config,n=this.player;r.width=t.width||0,r.height=t.height||0,t.vid=t.vid||r.vid,MSE$1.isSupported('video/mp4; codecs="avc1.64001E, mp4a.40.5"')&&(void 0===r.supportHevc&&null!=sniffer&&sniffer.isHevcSupported&&null!=sniffer&&sniffer.isHevcSupported()&&this.player.video instanceof HTMLVideoElement&&(r.supportHevc=!0),isEMESupported()||(r.useEME=!1),this.checkConfig(),r.onlyInit&&(t.autoplay=!1,t.videoInit=!1,this._hasStartProgress=!1,this._hasStartProgressBack=!1),t.useWaterLevel&&(!t.userGestureEventMiddleware&&(t.userGestureEventMiddleware=userGestureEventMiddleware),!t.videoEventMiddleware&&n.setEventsMiddleware(videoEventMiddleware)),this.gapJumpInst=new GapJump(this.player,this.playerConfig),this.preloader=r.isOpenPreload?new Mp4Preloader(this.config,this,this.bitRateAdapter):null,n.preloader=this.preloader,this._proxyPlayer(),this.initAwManager(),n.useHooks("replay",this._replayHook),n.useHooks("play",this._playHook),n.useHooks("pause",this._pauseHook),n.useHooks("retry",this._retryHook),n.video.addEventListener(CUSTOM_EVENTS.BUFFERED_RESET,this._onBufferedReset),this._bindNetworkStateChange(),this.on(TIME_UPDATE,this._onVideoTimeUpdate),this.on(LOADED_DATA,(function(){e.changeState("LOADED_DATA"),e.deleteVideo(),e._firstSegState=2,e._onTimeUpdate(),e._firstFrameTime()})),this.on(LOAD_START,(function(){e.changeState("LOAD_START"),e._loadStartEventTime=util$1.nowTime(),e.codecType!==CODEC_TYPE.H265||e.config.supportHevc||(e._isMseInit=!0,e._onTimeUpdate())})),this.on("xglog",(function(t){if("firstFrame"===t.eventType){var r=e.preLoadData&&e.preLoadData.definition?e.preLoadData.definition:-1;e.codecType===CODEC_TYPE.H264?console.log("[xgplayer-encrypt-mp4]>>>>firstFrame ",e.playerConfig.vid,t.fvt,", codectype: ",e.codecType,", hitpreload: ",e.hitpreload,", video: ",e._useVideoLoad,",curPlayBitrate: ",e.player.curDefinition.definition,", preloadBitrate: ",r,",metaLoad, ",e.firstFrameTime.metaload,", mseOpen: ",e.firstFrameTime.mseopen,",appendInit: ",e.firstFrameTime.metaready_initsegend):console.log("[xgplayer-encrypt-mp4]>>>>firstFrame ",e.playerConfig.vid,t.fvt,", codectype: ",e.codecType,", hitpreload: ",e.hitpreload,",curPlayBitrate: ",e.player.curDefinition.definition,", preloadBitrate: ",r,",metaLoad, ",e.firstFrameTime.metaload)}})),n.mp4MseFlag=!0)}},{key:"_startBufferCheck",value:function(){var e=this.player;if(e.video){var t=[];if(e.video.buffered){for(var r=0,n=e.video.buffered.length;r<n;r++)t.push([e.video.buffered.start(r),e.video.buffered.end(r)]);t.toString()!==this.lastBuffer&&(this.lastBuffer=t.toString(),this._onBufferReachThreshold())}}}},{key:"_onBufferReachThreshold",value:function(){var e=this.player,t=this.config;if(e.video){for(var r=e.video.buffered,n=0,i=0,a=0;a<r.length&&(n=r.start(a),i=r.end(a),!(n<=e.video.currentTime&&e.video.currentTime<=i));a++);i-e.video.currentTime>=t.bufferThreshold&&!this._hasTriggerBufferThreshold&&(this._hasTriggerBufferThreshold=!0,e.emit("BUFFER_THRESHOLD",i-e.video.currentTime))}}},{key:"_startUrlExpiredCheck",value:function(){var e=this.player.config;e.definition&&e.definition.list&&e.definition.list.length>0&&(this.urlExpireTimestamp=e.definition.list[0].url_expire||0,this._handleUrlExpire())}},{key:"checkConfig",value:function(){var e=this.playerConfig,t=this.config,r=e.defaultDefinition,n=e.defaultBitrate;if(!r){var i=this.playerConfig.definition;r=i&&i.defaultDefinition?i.defaultDefinition:t.definition}!n&&t.bitrate&&(n=t.bitrate),e.defaultDefinition=r,e.defaultBitrate=n}},{key:"beforePlayerInit",value:function(){var e=this.player,t=this;this._isInit||(BasePlugin.defineGetterOrSetter(e,{__url:{get:function(){return t.mse?t.mse.url:e.config.url},configurable:!0},downloadSpeed:{get:function(){return _realTimeSpeed/8},configurable:!0},playerVersion:{get:function(){return version},configurable:!0},menuCodeType:{get:function(){return t.mp4&&t.mp4.meta?t.mp4.meta.videoCodec:"avc"},configurable:!0},playerType:{get:function(){return"MP4"},configurable:!0},supportMenus:{get:function(){return{speed:e.mp4MseFlag,cdn:e.mp4MseFlag,resolution:e.mp4MseFlag}},configurable:!0},CDNUrl:{get:function(){return t.CDNUrl},configurable:!0},abrInstance:{get:function(){return t.abrInstance},configurable:!0},ext:{get:function(){var e,r,n,i,a,o,s=[];if(null!==(e=t.player)&&void 0!==e&&null!==(r=e.video)&&void 0!==r&&r.buffered)for(var u=t.player.video.buffered,c=0,l=u.length;c<l;c++)s.push([u.start(c),u.end(c)]);var d=[];if(t.mse)for(var h=Math.min(t.opQueueLen,5),f=0;f<h;f++)d.push(t.mse.opQueues.video[f].context);return{type:"MP4",usevideo:t.useVideoLoad,duration:null===(n=t.mp4)||void 0===n||null===(i=n.meta)||void 0===i?void 0:i.duration,loadseg:{loadIdx:t._curLoadSegmentIdx,loadTimeRange:null!==(a=t.mp4)&&void 0!==a&&a.timeRange?t.mp4.timeRange[t._curLoadSegmentIdx]:{},waitIdx:t.debugInfo.loadIndx,waitTimeRange:null!==(o=t.mp4)&&void 0!==o&&o.timeRange&&void 0!==t.debugInfo.loadIndx?t.mp4.timeRange[t.debugInfo.loadIndx]:{}},bufffer:s,speed:t.debugInfo.speed,states:t.states,mseque:d,url:t.playerConfig.url}},configurable:!0}}),this._isInit=!0)}},{key:"destroy",value:function(){var e=this.player;console.log("[Index] destroy",this.playerId),this.preloader&&this.preloader.destroy(this.playerId),e.preloader=null,e.removeHooks("replay",this._replayHook),e.removeHooks("play",this._playHook),e.removeHooks("pause",this._pauseHook),e.removeHooks("retry",this._retryHook),this._reset(),this._onDestroyWasm(),this.player.playNext=_playerPlayNext,this.player._startInit=_playerStartInit,this.player.changeDefinition=_playerChangeDefinition,this.player.switchURL=_playerSwitchUrl,this._unbindNetworkStateChange(),e.video&&e.video.removeEventListener(CUSTOM_EVENTS.BUFFERED_RESET,this._onBufferedReset),this._bufferCheckTimer&&clearInterval(this._bufferCheckTimer),this._removeBufferTimer&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null)}},{key:"initAwManager",value:function(){var e=this,t=this.config;this.awManager||(this.awManager=new AwManager(t.cdnHost,t.cdnBucket));var r=new ProxyPromise;if(r.id="aw",this._awPromise=r,t.isEncrypt){var n=new WasmManager;n.push(this.awManager.init()),n.startup().then((function(){n.destroy(),r.resolve()})).catch((function(t){n.destroy(),e._emitInitFail(t),r.reject()}))}else r.resolve()}},{key:"_proxyPlayer",value:function(){var e=this;"function"==typeof this.player.playNext&&(_playerPlayNext=this.player.playNext),this.player.playNext=function(){e.playNext.apply(e,arguments)},_playerStartInit=this.player._startInit,_playerSwitchUrl=this.player.switchURL,_playerChangeDefinition=this.player.changeDefinition,this.player._startInit=this.playerStartInit.bind(this),this.player.switchURL=this.switchURL.bind(this),this.player.changeDefinition=this.changeDefinition.bind(this)}},{key:"getInitBitrate",value:function(){var e=this,t=this.player,r=this.config,n=this.playerConfig,i=null,a=t.definitionList;return a&&a.length>0&&(a.map((function(t){var r=Mp4Preloader.generateUniqueKey({vid:n.vid,definition:t.definition||"",vtype:n.vtype,codecType:n.codecType});t.cacheKey=r,r&&!i&&e.preloader&&e.preloader.hasItemSameVid(r)&&((i=t).type="preload")})),i&&n.userSelectDefinition&&r.focusUserDefinition&&(console.log("[Index] getInitBitrate","preloadDefinition: ".concat(i.definition," userSelectDefinition:").concat(n.userSelectDefinition)),n.userSelectDefinition!==i.definition&&(i=null)),!i&&this.bitRateAdapter&&(this.bitRateAdapter.speed=MP4$2.speed,(i=this.getDefinitonFromAdapter(a,n.userSelectDefinition))&&(i.type="bitRateAdapter"))),i&&i.url||(i="Array"===util$2.typeOf(n.url)&&n.url.length>0||"String"===util$2.typeOf(n.url)&&n.url?{url:n.url,definition:n.defaultDefinition,duration:n.duration||this.config.duration||0,bitrate:n.defaultBitrate||this._getBitrateByDefition(n.defaultDefinition),type:"default"}:a[a.length-1]),this.playerConfig.url=i.url,i.networkSpeed=MP4$2.speed,i.fileSize=util$1.getFileSize(i.bitrate,n.duration),t.curDefinition=i,i}},{key:"_setPlayerSrc",value:function(e){var t=this.player;this._removeVideoSource(),"Array"===util$2.typeOf(e)?(t.video.removeAttribute("src"),!t._detachSourceEvents&&e.forEach((function(e){t.video.appendChild(util$2.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||"")}))})),t._attachSourceEvents(t.video,e),t.play()):(t.video.src=e,t.play()),t.mp4MseFlag=!1,t.emit("playertypechange")}},{key:"_removeVideoSource",value:function(e){var t=this.player,r=(e=e||t.video).children;if(r.length>0)for(t._detachSourceEvents(e);r.length>0;)e.removeChild(r[0])}},{key:"_getBitrateByDefition",value:function(e){var t=this.playerConfig,r=0;if(!t.definition||!t.definition.list)return r;for(var n=0;n<t.definition.list.length;n++){var i=t.definition.list[n];i.definition===e&&(r=i.bitrate)}return r}},{key:"_getDefinitionItem",value:function(e){for(var t=this.playerConfig,r=0;r<t.definition.list.length;r++){var n=t.definition.list[r];if(n.definition===e)return n}return null}},{key:"_initAbrDefinition",value:function(){var e=this.player,t=this.playerConfig;if(t.definition.list.length>0&&(e.curDefinition||(e.curDefinition=t.definition.list[0]),e.curDefinition.vwidth||Object.assign(e.curDefinition,this._getDefinitionItem(e.curDefinition.definition)),this._abrService.updateAbrCacheData()),this._abrService&&this._abrService.isCurrentAutoDefi){var r=t.definition.list.length;e.curDefinition=t.definition.list[r-1]}for(var n=0;n<t.definition.list.length;n++){var i=t.definition.list[n];e.curDefinition.definition===i.definition?i.selected=!0:i.selected=!1}console.log("resourceReady",t.definition.list.concat()),this.player.emit("resourceReady",t.definition.list);var a=e.curDefinition.bitrate;if(!a)for(var o=0;o<t.definition.list.length;o++){var s=t.definition.list[o];s.definition===e.curDefinition.definition&&(a=s.bitrate)}this._abrService.updateBitrate(a)}},{key:"_initAbrService",value:(r=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(){var t,r;return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.playerConfig,(r=this.config).autoBitrateOpts&&r.autoBitrateOpts.isOpenAutoDefi){e.next=3;break}return e.abrupt("return");case 3:return this._abrService=new AbrService(this,this.abrSwitchURL),e.next=6,this._abrService.init({video:t.definition.list.concat()});case 6:this._initAbrDefinition();case 7:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_initMp4Kernel",value:function(){var e=this;this.firstFrameTime.newplayer_initkernel=util$1.nowTime()-this.firstFrameTime.newplayer,this.log("[===========], initMp4Kernel,",util$1.nowTime());var t=this.playerConfig,r=this.config,n=new ProxyPromise;try{var i=this._defInited?null:this.getInitBitrate();if(this._defInited=!0,this.log("curDefinition",i),this.log("[_initMp4Kernel] ".concat(t.vid," curDefinition"),i),!this._handlerUrl(t.url))return n.reject(new Error("emptyUrl")),n;if(r.forceVideoPlay&&(this.codecType===CODEC_TYPE.H264||r.supportHevc))return this.useVideoLoad=!0,n.reject("forceVideoPlay"),n;var a=[];a.push(this._getLicense()),a.push(this._checkPreloader()),Promise.all(a).then((function(t){e.isDestroy&&n.reject(new Error("destroy"));var a=null;if(t&&t.length>0&&t[1]&&(a=t[1].data),a||!r.needPreloadCheck||e.codecType===CODEC_TYPE.H265&&!r.supportHevc)if(e._vtype&&"MP3"===e._vtype)e.useVideoLoad=!0,n.reject(new Error("vtype_not_MP4"));else{var o=r._mainURL;e._initMp4(o,a,{fileSize:i?i.fileSize:0}),e._initAbrService()}else e.useVideoLoad=!0,n.reject(new Error("no_preload"))})).catch((function(t){console.error(t),t.errorType="GET_LICENSE_ERROR",e.emit("error",t),e.changeState("LICENSE_ERROR",{d:i?i.definition:0}),n.reject(t)}))}catch(e){n.reject(e)}return n}},{key:"playerStartInit",value:function(e){var t=this;if(this.log("playerStartInit",this.player.hasStart),!this.isDestroy){if(!e||"__auto__"===e||"anytext"===e){var r=this.playerConfig,n=r.definition;if(n&&n.list&&n.list.length>0&&n.defaultDefinition&&(n.list.map((function(e){e.definition===n.defaultDefinition&&(r.url=e.url,t.player.curDefinition=e)})),!r.url||"__auto__"===e||"anytext"===e)){var i=n.list[0];e=i.url,r.url=i.url,this.player.curDefinition=i}}if(this.useVideoLoad)_playerStartInit.call(this.player,e);else{this.player.mp4MseFlag=!0,this.bufferEndTime=-1,this._tm=(new Date).getTime(),this._reset();var a=this.playerConfig.vid;this.preloader&&this.preloader.cancelPreloadByVid(a),this.changeState("PLAYER_START_INIT"),this._awPromise.then((function(){if(!t.isDestroy){t.changeState("AW_OK INIT_MP4_KERNEL");var r=t._initMp4Kernel();t._initPromise=r,t._addPendingPromise(t._initPromise),r.then((function(r){t.isDestroy||(t.log("[Index] _initMp4Kernel.then vid:".concat(a," isDestroy").concat(t.isDestroy),r,t.mse?t.mse.url:""),t.mse&&(e=t.mse.url),t.changeState("PLAY_INIT_OK"),t._bindEvents(),t._startProgress())})).catch((function(r){var n=!!t._initPromise&&t._initPromise.isBreak;if(!t.isDestroy&&!n)if(console.error("_initMp4Kernel.catch: ".concat(a," isDestroy:").concat(t.isDestroy," _initPromise.isBreak:").concat(n),r),-499897!==r.errorCode){var i=r;i.errorCode||((i=new Errors(t.player,{errorType:"runtime",errorTypeCode:ERROR_TYPES.runtime,errorCode:ERROR_CODES.other,vid:t.playerConfig.vid,errorMessage:null==r?void 0:r.message,mediaError:{code:ERROR_CODES.other,message:null==r?void 0:r.message}})).url=e),t.changeState("PLAY_INIT_CATCH",{c:i.errorCode,m:i.message}),t.player.vtype="MP4_1",t.player.emit("playCatch",t.player.vtype,i)}else t._emitExpireEvent(r)})).finally((function(){if(t._initPromise){var r=t._initPromise.isBreak;t._initPromise&&t._removePendingPromise(t._initPromise),t._initPromise=null,t._usePaused&&(t.playerConfig.autoplay=!1),t.codecType===CODEC_TYPE.H265&&"Array"===util$2.typeOf(e)&&(e=e[0].src),t.log("_initMp4Kernel.finally:isDestroy".concat(t.isDestroy," _initPromise.isBreak:").concat(r)),t.log("[===========], playerStartInit,",util$1.nowTime()),t.changeState("PLAY_INIT_FINALLY"),!t.isDestroy&&!r&&_playerStartInit.call(t.player,e)}}))}})).catch((function(r){t.log("_awPromise.error",r),t.changeState("PLAY_INIT_CATCH"),!t.isDestroy&&_playerStartInit.call(t.player,e)})),this._abrService&&this._abrService.isCurrentInAbr()&&(this._abrService.enable(),this._abrService.execute())}}}},{key:"playNext",value:function(e){var t=this.player;this._defInited=!1,t.resetState(),t._currentTime=0,t._duration=0,t.isPlaying=!1,this._useVideoLoad=!1,t.pause(),this._reset(),e.vtype&&(this._vtype=e.vtype.toUpperCase()),t.setConfig(e);var r=this.codecType;this.codecType=e.codecType?e.codecType.toLowerCase():CODEC_TYPE.H264;var n=e[this.pluginName];n&&(this.config=Object.assign(this.config,n)),r!==this.codecType&&this.h265_h264_switch(this.playerConfig.mediaType||"video"),this.checkConfig(),this.initAwManager(),this.log("[Index] playNext",e),t.play(),this.emit("playnext")}},{key:"h265_h264_switch",value:function(e){this.log("h265_switch_h264");var t=this.player,r=util$2.createDom(e,"",this.getVideoConfig(this.playerConfig),"xgplayer-".concat(e,"-img"));this.removeVideo=t.video,r.muted=t.video.muted,r.volume=t.video.volume,t.video=r,t.attachVideoEvents(t.video)}},{key:"getVideoConfig",value:function(e){var t=Object.assign({},{controls:!1,autoplay:e.autoplay,playsinline:e.playsinline,"x5-playsinline":e.playsinline,"webkit-playsinline":e.playsinline,"x5-video-player-fullscreen":e["x5-video-player-fullscreen"]||e.x5VideoPlayerFullscreen,"x5-video-orientation":e["x5-video-orientation"]||e.x5VideoOrientation,airplay:e.airplay,"webkit-airplay":e.airplay,tabindex:2,mediaType:e.mediaType||"video"},e.videoConfig,e.videoAttributes);return e.loop&&(t.loop="loop"),t}},{key:"next",value:function(e){this.playNext(e)}},{key:"oldChangeDefinition",value:function(e,t){var r=this,n=this.config,i=this.player,a=this.playerConfig;i.emit(DEFINITION_CHANGE,{from:t,to:e}),i.emit(WAITING);var o=i.definitionList.filter((function(t){return t.definition===e.definition||t.definition===Number(e.definition)})),s=i.definitionList.filter((function(e){return e.definition===t.definition||e.definition===Number(t.definition)}));if(s.length>0&&(s[0].selected=!1),o.length>0){(e=o[0]).selected=!0,i.curDefinition=e,this.log("[oldChangeDefinition],currentTime,",i.currentTime,",from,",t,",to,",e);var u=i.currentTime,c=i.paused;this._changeDefState||(this._changeDefState={currentTime:u,paused:c},this.log("[oldChangeDefinition],currentTime,",i.currentTime,",pause,",c)),n.definition=e.definition,this.config.keyValue=e.keyValue,this.config.kid=e.kid,this.config.secretKey=e.secretKey,this.config.drm=e.drm,this.config.getLicenseUrl=e.getLicenseUrl,a.url=e.url,a.backupURL=e.backupURL,a.userSelectDefinition=e.definition,a.defaultDefinition=e.definition,n.focusUserDefinition=!0,i.currentTime=0,i.pause(),this._reset(),this._isMseInit=!1,this.eme=null,this._handlerUrl(e.url),this._changeDefineCanPlay&&i.off("canplay",this._changeDefineCanPlay),this._changeDefineCanPlay=function(){r.changeDefineCanPlay(u,c,t,e),r._changeDefineCanPlay=null},i.once("canplay",this._changeDefineCanPlay),this.player.video.load(),this.playerStartInit(a.url)}}},{key:"switchURL",value:function(e){if(this.useVideoLoad)_playerSwitchUrl.call(this.player,e);else{var t=this.player,r=this.playerConfig;this.config.keyValue=e.keyValue,r.url=e.url,r.backupURL=e.backupURL,t.currentTime=0,t.pause(),this.reset(),this._isMseInit=!1,this.eme=null,this._handlerUrl(e.url),t.video.removeAttribute("src"),this._removeVideoSource(),t.resetState()}}},{key:"_handlerUrl",value:function(e){var t,r=this.config,n=this.playerConfig;if(!e)return!1;var i=[];if("String"===util$2.typeOf(e))t=e,n.backupURL&&i.push(n.backupURL);else if("Array"===util$2.typeOf(e)&&e.length>0&&(t=e[0].src,e.length>1))for(var a=1;a<e.length;a++)i.push(util$1.extUrl(e[a].src,{__vid:n.vid}));return!(!t&&0===i.length)&&(r._mainURL=util$1.extUrl(t,{__vid:n.vid}),r._backupURL=i,!0)}},{key:"_firstFrameTime",value:function(){if(this.codecType===CODEC_TYPE.H264||this.config.supportHevc){if(this.firstFrameTime.new_loadeddata<0){this.firstFrameTime.loadst_loadeddata=util$1.nowTime()-this.loadstart,this.firstFrameTime.new_loadeddata=util$1.nowTime()-this.firstFrameTime.newplayer;var e={};for(var t in this.firstFrameTime)Object.prototype.hasOwnProperty.call(this.firstFrameTime,t)&&(this.log("======this.firstFrameTime======",t,", ",this.firstFrameTime[t]),e[t]=this.firstFrameTime[t])}}else if(this.codecType===CODEC_TYPE.H265){var r=this.player.video.getStats(),n=this.firstFrameTime.metaload,i=this.firstFrameTime.startMuxTime;this.firstFrameTime=r,this.firstFrameTime.metaload=n,this.firstFrameTime.startload_stmux=i,this.firstFrameTime.firstmux=this.mp4?this.mp4.firstFrameTime.firstmux:-1;for(var a=0;a<r.bootStats.length;a++)this.firstFrameTime[r.bootStats[a].action]=r.bootStats[a].dot;delete this.firstFrameTime.bootStats,this.log("======this.firstFrameTime===>>",JSON.stringify(this.firstFrameTime))}}},{key:"_bindEvents",value:function(){var e=this,t=this.config,r=this.player;this._isEventInit||(this.on("seeking",this._onSeeking),this.on("waiting",this._onWaiting),this.on("ended",this._onEnded),this.on("error",this._onVideoError),this.on("playing",this._onPlaying),this.on("detectGap",(function(){t.gapDegrade&&t.useEME&&(t.useEME=!1,e._replay())})),this.on("error",(function(t){e.changeState("video_error",{code:t.code,message:t.message,videoType:e.useVideoLoad})})),r.setEventsMiddleware({error:function(t,r){var n=t.originalEvent;e.changeState("video_error",{code:n.code,message:n.message,videoType:e.useVideoLoad}),e.log("error middleware",t,",useVideoLoad,",e.useVideoLoad),e.useVideoLoad&&r(t.eventName,n)}})),this._isEventInit=!0}},{key:"deleteVideo",value:function(){if(this.removeVideo){var e=this.removeVideo.parentNode;e&&e.removeChild(this.removeVideo),this.removeVideo=null,this.log("[_removeVideoSource]")}}},{key:"_unbindEvents",value:function(){this.off("seeking",this._onSeeking),this.off("waiting",this._onWaiting),this.off("ended",this._onEnded),this.off("playing",this._onPlaying),this._isEventInit=!1}},{key:"changeState",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._pTime||(this._pTime=util$1.nowTime());var r=util$1.nowTime()-this._pTime,n=util$1.nowTime()-this._sTime;this.log(">>>changeState[".concat(e,"]"),r,n,t),this.states.push({state:e,t1:r,t2:n,data:t}),this._pTime=util$1.nowTime();var i=util$1.nowTime()-this._pTime;t.state=e,i&&(t.t=i)}},{key:"checkIfCanPreload",value:function(){var e=this.player,t=this.useVideoLoad,r=this.config;if(r.isOpenPreload){var n=t?5:r.minBufferLength,i=e.currentTime+n;i=i>e.duration?e.duration:i;var a=(t?e.getBufferedRange(e.buffered):e.getBufferedRange(e.buffered2))[1]-i;e.currentTime>=n&&(a>0||Math.abs(a)<1)&&this.preloader&&this.preloader.checkCanPreloadNext()&&this.emit("PRELOAD_NEXT")}}},{key:"_getLicense",value:function(){var e=this,t=this.config,r=t.vid,n=t.kid,i=t.secretKey,a=new ProxyPromise,o={method:"getLicense",success:0};if(n||i){var s=getKeyValue(r,n,i,this);s.id="licensePromise",this._addPendingPromise(s),s.then((function(t){e._removePendingPromise(s),t.clearKeys?e.config.drm=t:e.config.keyValue=t,o.success=1,a.resolve(o)})).catch((function(t){e.log("licensePromise reject"),o.success=0,o.error=t,a.reject(o)}))}else o.success=0,a.resolve(o);return a}},{key:"softDecode",get:function(){var e,t;return"xg-video"===(null===(e=this.player)||void 0===e||null===(t=e.config)||void 0===t?void 0:t.mediaType)}},{key:"_initH265MseProxy",value:function(){this.player.video instanceof HTMLVideoElement&&this.h265_h264_switch(this.playerConfig.mediaType);var e=this.player.video;this.softDecode&&e.setPlayMode&&e.setPlayMode("VOD"),this.mseProxy=e,this.softDecode&&(this.player.forceDegradeToVideo=function(){},this.player.video.addEventListener("lowdecode",this._lowDecoder),this.player.video.addEventListener("error",this._onError))}},{key:"removeAndRejectInitPromise",value:function(e){this._initPromise&&(this._removePendingPromise(this._initPromise),this._initPromise.reject(e))}},{key:"_initMp4",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.firstFrameTime.initkernel_initmp4=util$1.nowTime()-this.firstFrameTime.newplayer-this.firstFrameTime.newplayer_initkernel;var i=this.config,a=this.player,o=this.playerConfig;this.mp4&&(this.mp4.off(MP4_EVENTS.META_READY,this._onMp4MetaReady),this.mp4.off(MP4_EVENTS.ERROR,this._onMp4Error),this.mp4.off(MP4_EVENTS.UPDATEEME,this._updateDrmConfig),this.mp4.off(MP4_EVENTS.TASK_PROGRESS,this._onMp4Progress),this.mp4.off(MP4_EVENTS.MOOV_REQ_PROGRESS,this._onMp4DataCallBack),this.mp4.destroy(),this.mp4=null),this.changeState("MP4_NEW",{}),this.mp4=new MP4$2(e,a.curDefinition.bitrate,{segmentDuration:i.segmentMinDuration,enableWorker:i.enableWorker,codecType:this.codecType,chunkSize:i.preloadSize,loadSize:800,duration:o.duration||0,fileSize:n.fileSize||0,playerId:this.playerId,vid:o.vid,useUrlRange:i.useUrlRange,retryCount:i.retryCount,retryDelay:i.retryDelay,onProcessMinLen:i.onProcessMinLen,supportHevc:i.supportHevc,reqOptions:i.reqOptions},this,null,r,this.config._backupURL,this.firstFrameTime,""),this.mp4.once(MP4_EVENTS.META_READY,this._onMp4MetaReady),this.mp4.on(MP4_EVENTS.ERROR,this._onMp4Error),this.mp4.on(MP4_EVENTS.UPDATEEME,this._updateDrmConfig),this.mp4.on(MP4_EVENTS.TASK_PROGRESS,this._onMp4Progress),this.mp4.on(MP4_EVENTS.MOOV_REQ_PROGRESS,this._onMp4DataCallBack),this.mp4.on(MP4_EVENTS.CHANGE_URL,(function(e){t.player&&t.player.emit("initialUrl",{url:e})})),this.mp4.MP4Loader.on(REAL_TIME_SPEED_EVENT,(function(e){_realTimeSpeed=e.speed,t.debugInfo.speed||(t.debugInfo.speed=[]),t.debugInfo.speed.push(_realTimeSpeed),t.debugInfo.speed.length>10&&t.debugInfo.speed.shift(),t.emit(REAL_TIME_SPEED_EVENT,e)})),this.changeState("MP4_INIT",{}),this.mp4.init(r)}},{key:"_checkPreloader",value:function(){var e=this,t=this.playerConfig,r=new ProxyPromise,n={method:"checkPreloader",success:0,type:"error",cacheKey:""};this.changeState("CHECK_PRELOAD");var i=this.player.curDefinition,a=i.cacheKey?i.cacheKey:Mp4Preloader.generateUniqueKey({vid:t.vid,definition:i.definition||"",vtype:t.vtype,codecType:t.codecType});return n.cacheKey=a,this.preloader&&a?this.preloader.getPreLoadData(a).then((function(t){console.log(">>>>check Preloader result",a,t),t?(e.preLoadData=t,e.emit("PRELOAD_INFO",e.preLoadData),n.success=1,n.data=t,e.changeState("PRELOAD_OK",{l:e.preLoadData.byteLength,ck:a}),t.mediaSegList&&t.mediaSegList.length>0||t.buffer&&t.buffer.byteLength>0?e.hitpreload=!0:e.hitpreload=!1,r.resolve(n)):(e.preLoadData=null,e.changeState("PRELOAD_ERROR",{t:0}),n.success=0,n.error=new Error("none_preload"),r.resolve(n))})):(this.changeState("PRELOAD_ERROR",{t:2}),n.success=0,n.error=new Error("no_preloader"),r.resolve(n)),r}},{key:"_initEME",value:function(e,t){var r=this.player,n=this.config,i=e.checkCodecH265();n.useEME=!(!1===n.useEME||i),this._updateDrmConfig(t),this.log("config.useEME: ",n.useEME);var a=n.drm;!this.eme&&a&&a.clearKeys&&n.useEME&&(this.eme=new EME(a)),n.useEME&&this.eme&&(this.eme.setOptions('video/mp4; codecs="avc1.64001E"','audio/mp4; codecs="mp4a.40.2"'),this.eme.SetupEME(r.video))}},{key:"_initMse",value:function(e){var t=this,r=this.playerConfig;this.mse&&(this.mse.destroy(),this.mse=null);var n,i=this.mp4&&this.mp4.checkCodecH265(),a=!!e.videoCodec,o=!!e.audioCodec;n=a&&o?i?'video/mp4; codecs="hev1.1.6.L93.B0, mp4a.40.5"':'video/mp4; codecs="avc1.64001E, mp4a.40.5"':a?i?'video/mp4; codecs="hev1.1.6.L93.B0"':'video/mp4; codecs="avc1.64001E"':'video/mp4; codecs="mp4a.40.5"';var s=_defineProperty$b({},CONTENT_TYPES.VIDEO,{mimeType:"video/mp4",codec:n});this.mse=new MSE$1(r.mediaType,this.log.bind(this)),this.mse.on(MSE_EVENTS.MSE_OPEN,(function(e){t.firstFrameTime.initmse_sbopen=e.costtime,t._loadStartEventTime>0&&(t.firstFrameTime.mseopen=util$1.nowTime()-t._loadStartEventTime),t.changeState("MSE_OPEN")})),this.mse.on(MSE_EVENTS.MSE_OPEN_DONE,(function(e){t.firstFrameTime.initmse_sbopendone=e.costtime,t.changeState("MSE_OPEN_DONE"),t._isMseInit=!0,t._onTimeUpdate()})),this.mse.on(MSE_EVENTS.MSE_ERROR,(function(e){if(console.log("[MSE error]",e),e&&t.mse&&t.mse.isFull()){var n=t.player.getBufferedRange(t.player.buffered2);t._checkRemoveSourceBuffer(n,t.player.currentTime,!0)}else{var i=new Errors(t.player,{errorType:"runtime",errorTypeCode:ERROR_TYPES.runtime,errorCode:ERROR_CODES.mseAppend,errorMessage:e.message,vid:r.vid,mediaError:{code:ERROR_CODES.mseAppend,message:e.message}});t._errorHandler(i)}})),this.mse.on(MSE_EVENTS.UPDATE_END,(function(e){var r=e.context,n=e.costtime;if(r&&r.isinit)t.firstFrameTime.metaready_initsegend=n,t.log("player appendBuffer end ==>>>",r||null,", costTime,",n),t.changeState("MSE_INITSEG_OK");else if(t.log("player appendBuffer end ==>>>",r||null,", costTime,",n,", opt,",e.name,",bufferRange,",t.player.getBufferedRange()),t.firstFrameTime.loadst_loadeddata<0&&(t._firstSegState<0&&t._onTimeUpdate(),t.firstFrameTime.apcnt++,t.firstFrameTime.aplen+=r?r.dataLen:0,t.firstFrameTime.data_ap+=n,t.changeState("APPEND_DATA_OK",{costime:n,dataLen:r?r.dataLen:0})),t.mse&&r.state&&r.fragIndex===t.mp4.timeRange.length-1){var i=t.player.buffered;t.bufferEndTime=i.end(i.length-1),t._isEnded(),t.log("loaded ended !!!==>>>",r.range,", fragIndex,",r.fragIndex,", bufferEndTime,",t.bufferEndTime,",meta_duration,",t.mp4.meta.duration)}})),this.changeState("MSE_INIT"),this.mse.init(s)}},{key:"_appendInitSeg",value:function(e){this.mp4&&this.mse&&(this.changeState("MSE_INITSEG"),this.log("[=======ready_append_init]",util$1.nowTime(),",mseDone,",!!this.mse&&this.mse.ready,",isopen,",!!this.mse&&this.mse.isMediaSourceOpen()),!this.mse.ready&&this.openMSE(),this.firstFrameTime.metaready_mseisopen=this.mse&&this.mse.ready?1:0,this.mse.appendBuffer(CONTENT_TYPES.VIDEO,e,{vid:this.playerConfig.vid,range:null,dataLen:e.byteLength,isinit:!0}),this.mp4.useEME&&this.eme&&this.eme.emit("encrypted"))}},{key:"_checkMetaInfo",value:function(e){var t=null;return e?null:(t={errorCode:ERROR_CODES.metaError,errorMessage:"meta is null",errorType:"demux",errorTypeCode:ERROR_TYPES.demux},new Errors(this.player,_objectSpread2$6(_objectSpread2$6({},t),{},{vid:this.playerConfig.vid,mediaError:{code:t.errorCode,message:t.errorMessage}})))}},{key:"_stopProgress",value:function(){this._hasStartProgress=!1,this._requestTimer&&(this._requestTimer.stop(),this._requestTimer=null),this._bufferBreakTimer&&(clearTimeout(this._bufferBreakTimer),this._bufferBreakTimer=null,this._bufferBreakFlag=void 0)}},{key:"_bindNetworkStateChange",value:function(){window.addEventListener("online",this._onOnlineHandler),window.addEventListener("offline",this._onOfflineHandler)}},{key:"_unbindNetworkStateChange",value:function(){window.removeEventListener("online",this._onOnlineHandler),window.removeEventListener("offline",this._onOfflineHandler)}},{key:"_onSuperStart",value:function(e){var t=this,r=this.player;log$2("_onSuperStart:".concat(e),this.mse),r.video.src=e,this.once("canplay",(function(){r.play(),t.on("waiting",t._onWaiting)}))}},{key:"openMSE",value:function(){var e=this.mse;!e.ready&&e.isMediaSourceOpen()&&(this.log("[=======主动调用_onSourceOpen start]",util$1.nowTime()),e._onSourceOpen(),this.log("[=======主动调用_onSourceOpen, end ]",util$1.nowTime(),"mseDone,",e.ready))}},{key:"_appendBuffer",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0,i=this.mse,a=this.playerConfig.vid;this.log("player appendBuffer start ==>>>",a,r.range,t.byteLength,", queueLen,",i&&i.opQueues[e]?i.opQueues[e].length:null),i.ready||(this.openMSE(),this.firstFrameTime.metaready_mseisopen=this.mse&&this.mse.ready?2:-1),i.appendBuffer(e,t,{vid:a,fragIndex:r.fragIndex,range:r.range,dataLen:t.byteLength,state:n})}},{key:"_loadData",value:(t=_asyncToGenerator$7(_regeneratorRuntime$7().mark((function e(){return _regeneratorRuntime$7().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.onLine){e.next=2;break}return e.abrupt("return");case 2:if(this.mp4&&this._isMseInit){e.next=5;break}return this.log("loadData, player.mp4 null",this._isMseInit),e.abrupt("return");case 5:return this.loadstart<0&&(this.loadstart=util$1.nowTime()),e.prev=6,e.next=9,this.mp4.load(this._curLoadSegmentIdx,this._loadDataSuccess);case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(6),console.error("[Index] _loadData error",this.playerConfig.vid,e.t0);case 14:case"end":return e.stop()}}),e,this,[[6,11]])}))),function(){return t.apply(this,arguments)})},{key:"getDataBitRate",value:function(e){var t=this.mp4,r=this.playerConfig;if(!t)return 0;for(var n=t.getDataBitRate(e),i=r.definition.list,a=0,o=0;o<i.length;o++)if(i[o].bitrate===n){a=i[o];break}return a}},{key:"_loadStuckCheck",value:function(){var e=this,t=this.config,r=this.playerConfig,n=this.player;t.disableBufferBreakCheck||(n.currentTime-(this._lastCurrentTime||0)>.1||n.paused?1!==this._bufferBreakFlag&&2!==this._bufferBreakFlag||(this.log("视频没有卡死,重置卡死标记"),this._bufferBreakFlag=0,clearTimeout(this._bufferBreakTimer),this._bufferBreakFlag=null):this._bufferBreakFlag||(this._bufferBreakFlag=1,this.log("卡死计时开始! 持续".concat(BUFFER_BREAK,"毫秒则确认卡死")),this._bufferBreakTimer=setTimeout((function(){e.isDestroy||(1===e._bufferBreakFlag&&(e._bufferBreakFlag=2,e.log("确认卡死!!!"),e._errorHandler(new Errors(e.player,{errorType:"runtime",errorTypeCode:ERROR_TYPES.runtime,errorCode:ERROR_CODES.waitTimeout,errorMessage:"wait_timeout",vid:r.vid}))),e._bufferBreakTimer=null)}),BUFFER_BREAK)),this._lastCurrentTime=n.currentTime)}},{key:"_doubleCheckBuffer",value:function(e){var t=this.player;if(!(e.startTime>t.currentTime))return!0;if(!t.video||!t.video.buffered)return!0;var r=t.video.buffered;if(1===r.length)return!0;for(var n=!1,i=0;i<r.length;i++){var a=r.start(i)-.5,o=r.end(i)+.5;if(a<=e.startTime&&e.endTime<=o){n=!0;break}}return n}},{key:"_onTimeUpdate",value:function(){var e=this,t=this.mse,r=this.mp4,n=this.player;if(this.useVideoLoad)this.checkIfCanPreload();else if(r){var i=r.timeRange;if(i&&!(i.length<1)&&1!==this._firstSegState){var a=n.getBufferedRange(n.buffered2);if((t||this.mseProxy)&&r&&r.canDownload){util$1.nowTime()-this._lastCheckTime>1e3&&(this._lastCheckTime=util$1.nowTime(),this._loadStuckCheck(),this._startUrlExpiredCheck(),this._checkRemoveSourceBuffer(a,n.currentTime));var o=n.paused?n.currentTime+this._minBufferLength:n.currentTime+this._maxBufferLength;a[1]-o<0&&i.every((function(t,r){if(t.downloaded){if(e._doubleCheckBuffer(t))return!0;t.downloaded=!1,t.isLoading=!1,e.log("".concat(r," download state error, no buffer, download again"))}t.startTime-n.currentTime<e._maxBufferLength?(e._curLoadSegmentIdx=r,e.log("[onTimeUpdate],load index==>>>, ",r,",IdxTimeRange, ",t.startTime,"-",t.endTime,",buffEnd, ",a[1],",playCurTime,",n.currentTime,", bufferLen,",a[1]-n.currentTime,",bufferRangeList,",e.player.buffered2?e.player.buffered2.bufferedList:null),e._loadData()):e.log("[onTimeUpdate] not load index==>>>",r,",IdxTimeRange, ",t.startTime,"-",t.endTime,",playCurTime,",n.currentTime,",bufferRangeList,",e.player.buffered2?e.player.buffered2.bufferedList:null)})),this.checkIfCanPreload(),this.playFlag&&!this._hasTriggerBufferThreshold&&this._startBufferCheck(),this._isEnded()}}}}},{key:"_reset",value:function(){for(var e in this.states=[],this.hitpreload=!1,this._sTime=util$1.nowTime(),this._usePaused=!1,this._firstSegState=-1,this.useVideoLoad=!1,this._isMseInit=!1,this.endofstream=!1,this._curLoadSegmentIdx=0,this.preLoadData=null,this.forPreloadTimeCache=null,this.playFlag=!1,this._waitAdjustTimeCnt=0,this._initPromise&&"pending"===this._initPromise.state&&this._initPromise.reject("DESTROYED"),clearTimeout(this.checkResumePlayTimer),this.checkResumePlayTimer=null,this._stopProgress(),this.mp4&&(this.mp4.off(MP4_EVENTS.META_READY,this._onMp4MetaReady),this.mp4.off(MP4_EVENTS.ERROR,this._onMp4Error),this.mp4.off(MP4_EVENTS.UPDATEEME,this._updateDrmConfig),this.mp4.off(MP4_EVENTS.TASK_PROGRESS,this._onMp4Progress),this.mp4.off(MP4_EVENTS.MOOV_REQ_PROGRESS,this._onMp4DataCallBack),this.mp4.destroy(),this.mp4=null),this.mse&&(this.mse.destroy(),this.mse=null),this.mseProxy&&(this.player.video.removeEventListener("lowdecode",this._onDegrade),this.player.video.removeEventListener("error",this._onError)),this._clearMediaKeys(),this._unloadVideo(),this._cancelPendingPromises(),this._abrService&&(this._abrService.destroy(),this._abrService=null),this.firstFrameTime)Object.prototype.hasOwnProperty.call(this.firstFrameTime,e)&&(this.firstFrameTime[e]="apcnt"===e||"aplen"===e?0:"newplayer"===e?util$1.nowTime():-1);clearTimeout(this._waitInBufferTimer),this._waitInBufferTimer=null,this.loadstart=-1,this._loadStartEventTime=-1,this.startLoadData=-1}},{key:"removeErrorUrls",value:function(e,t,r){return-499897!==e.errorCode&&-499892!==e.errorCode||this._emitExpireEvent(e),r}},{key:"_errorHandler",value:function(e){var t=this.player,r=this.playerConfig,n=this.preLoadData;if(t){if(this.useVideoLoad)return console.log("useVideoLoad final error!!!!, ",r.vid,e),void this.emit("error",e);if("object"!==_typeof$5(e)){var i={};i.err=e,e=i}var a=t.paused;e.vid=r.vid,e.preloadHit=n&&n.byteLength>0?1:0,e.preloadCached=n?n.duration:0,e=new Errors(t,e),this.log("_errorHandle","preState is ".concat(a),e),!e.url&&(e.url=t.src),this.player.vtype="MP4_2",this.player.emit("playCatch",this.player.vtype,e),e.errd&&"object"===_typeof$5(e.errd)&&this.mp4&&(e.errd.url=this.mp4.url,e.url=this.mp4.url),e.codectype=this.codecType,this.emit("DATA_REPORT",e),this.mp4&&this.mp4.url&&this.removeErrorUrls(e,this.mp4.url,r.url),this.log("error task cancel"),this.mp4&&this.mp4.cancelLoading(),this._abrService&&this._abrService.disable(),this.mp4&&(this.mp4.canDownload=!1),this.mp4&&this.mp4.bufferCache&&this.mp4.bufferCache.clear(),this._startDegradedPlayback(e)}}},{key:"_startDegradedPlayback",value:function(e){var t=this;this.mp4&&(this.mp4.canDownload=!1);var r=this.player,n=this.playerConfig;this.endofstream=!1,this._currentTime=r.currentTime||0,this.player.pause(),this._reset(),this._replay=null,this.codecType===CODEC_TYPE.H265?(console.log("h265 err,degrade use 264 play",n.vid),this._onDegrade(e)):this.codecType===CODEC_TYPE.H264&&(this.config.drm?(this.config.drm&&Object.keys(this.config.drm).map((function(r){t.config.drm&&(e[r]=t.config.drm[r])})),console.log("final error !!!!, ",n.vid,e),this.emit("error",e)):(this.useVideoLoad=!0,this._setPlayerSrc(n.url),this.once("canplay",(function(){t._currentTime&&(r.currentTime=t._currentTime),!r.paused&&r.play()}))))}},{key:"_startProgress",value:function(){var e=this;this._hasStartProgress||(this._stopProgress(),this._requestTimer=new Timer((function(){e._requestTimer&&e._onTimeUpdate()})),this._requestTimer.tickEvery(this._tickInSeconds),this._hasStartProgress=!0)}},{key:"_unloadVideo",value:function(){var e=this.player;try{this.log("unloadVideo src ".concat(e.video.src)),e.video&&e.video.src&&(e.video.removeAttribute("src"),e.video.load())}catch(e){this.log("unloadVideo error",e)}}},{key:"_addPendingPromise",value:function(e){this._pendingPromises.push(e)}},{key:"_removePendingPromise",value:function(e){this.log("removePendingPromise",e.id);var t=this._pendingPromises.indexOf(e);t>-1&&this._pendingPromises.splice(t,1)}},{key:"_cancelPendingPromises",value:function(){this._pendingPromises.length>0&&this._pendingPromises.forEach((function(e){e.reject(DESTROYED)})),this._pendingPromises=[]}},{key:"_onMediaExpired",value:function(){this._stopProgress(),this.emit(CUSTOM_EVENTS.MEDIA_EXPIRED)}},{key:"_onDestroyWasm",value:function(){this.awManager&&(this.awManager.destroy(),this.awManager=null)}},{key:"_isEnded",value:function(){var e=this.player,t=this.mp4,r=e.bufferedPoint,n=r?r.end:0;return!this.endofstream&&this.bufferEndTime>0&&this.mse&&this.bufferEndTime-e.currentTime<.5&&(this.log("[check player isEnded],deal mse.endOfStream, currentTime,",e.currentTime,", bufferend,",n,", duration,",t.meta.duration),this.endofstream=!0,this.mse.endOfStream()),!!(t&&t.meta&&t.meta.duration-e.currentTime<.5)&&(this._stopProgress(),this.log("[check player isEnded],stopProgress and endOfStream,currentTime, ",e.currentTime,", bufferend,",n,", duration,",t.meta.duration),this.mse&&this.mse.endOfStream(),!0)}},{key:"_clearMediaKeys",value:function(){var e=this.player;e.video&&"function"==typeof e.video.setMediaKeys&&e.video.setMediaKeys(null).catch((function(){}))}},{key:"_checkRemoveSourceBuffer",value:function(e,t,r,n){var i=this,a=this.mse,o=this.mp4,s=this.player;if(a&&o&&s&&(r&&(clearTimeout(this._removeBufferTimer),this._removeBufferTimer=null),e||(e=s.getBufferedRange(s.buffered2)),t||(t=s.currentTime),!(!r&&util$1.nowTime()-this._checkRemoveBufferLastTime<=this.config.removeBufferLen||this.endofstream)&&(this._checkRemoveBufferLastTime=util$1.nowTime(),e&&e[0]>=0&&(t-e[0]>this.config.removeBufferLen||a.isFull())))){var u=n?e[1]:t-(a.isFull()?0:15),c=o.getFragmentIdx(u);if(c>=0&&(n||o.timeRange[c].startTime<t)){var l=Math.floor(Math.min(o.timeRange[c].startTime,e[1]));e[0]<l?(this.log("[checkremoveSourceBuffer], remove range==>>>",e[0],l),a.reuse(e[0],l)):a.isFull()&&!this._removeBufferTimer&&(this.log("[after 10s, go on checkremoveSourceBuffer], currentTime==>>>",t,", buffer start,",e[0]),this._removeBufferTimer=setTimeout((function(){i._checkRemoveSourceBuffer(null,null,!0)}),1e4))}}}},{key:"onMediaUpdate",value:function(e){var t=e.vid,r=e.kid,n=e.url,i=this.player,a=this.config;if(t===this.playerConfig.vid&&r===a.kid&&n){this.playerConfig.url=n,this._handlerUrl(n);var o=a._mainURL;return this.useVideoLoad?i.src=n:this.mp4&&this.mp4.update(o),!0}return!1}},{key:"enableAutoBuffer",value:function(e){var t=this;if(e){if(!this._allInitPromise)return void this.log("player destroyed!!");this._allInitPromise.then((function(){t.log("enableAutoBuffer true"),t._startProgress()}))}else this._stopProgress(),this.log("enableAutoBuffer false")}},{key:"bitRateAdapter",get:function(){return this.player&&this.player.plugins&&this.config.needAutoBitrate?this.player.plugins.bitrateselector:null}},{key:"getDefinitonFromAdapter",value:function(e,t){if(!this.bitRateAdapter)return null;var r=this.bitRateAdapter;return r.getSuitableBitrate?r.getSuitableBitrate(e,t):r.bitRateAdapter?r.bitRateAdapter.select(e):null}},{key:"addPreloader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.playerId=this.playerId,this.preloader?this.preloader.addPreloader(e,this.playerId,this.playerConfig.vid):this.log("preloader has destroyed")}},{key:"addPreloaderList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.preloader?this.preloader.addPreloaderList(e,this.playerId,this.playerConfig.vid):this.log("preloader has destroyed")}},{key:"changeUserSelectDefinition",value:function(e){this.preloader&&e&&this.preloader.changeUserSelectDefinition(e)}},{key:"log",value:function(e){for(var t=this.playerConfig,r=t&&t.vid?"[Index]".concat(t.vid," ").concat(e):"[Index] ".concat(e),n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];log$2.apply(void 0,[r].concat(i))}},{key:"_emitInitFail",value:function(e){this.log("initFail, reason:",e),this.emit(CUSTOM_EVENTS.INIT_FAIL,e)}},{key:"emitParseError",value:function(){this.log("parseError"),this.emit(CUSTOM_EVENTS.PARSE_ERROR)}},{key:"useVideoLoad",get:function(){return this._useVideoLoad},set:function(e){this._useVideoLoad=e}},{key:"ready",get:function(){return this._allInitPromise}},{key:"speed",get:function(){return parseInt(MP4$2.speed,10)}},{key:"version",get:function(){return version}},{key:"realTimeSpeed",get:function(){return _realTimeSpeed}},{key:"opQueueLen",get:function(){var e=this.mse&&this.mse.opQueues?this.mse.opQueues.video:[];return e?e.length:0}},{key:"loadSegmentTimeRange",get:function(){if(!this.mp4)return[0,0,0,0];var e=this.mp4.timeRange;if(e&&e.length>0&&this._curLoadSegmentIdx&&this._curLoadSegmentIdx<e.length){var t=e[this._curLoadSegmentIdx];if(t.isLoading){var r=this.mp4.getFragRange(this._curLoadSegmentIdx);return[Number(t.startTime),Number(t.endTime)].concat(_toConsumableArray$7(r))}}return[0,0,0,0]}},{key:"preloadState",get:function(){return this.preloader&&this.preloader.loadingCount}},{key:"moovSize",get:function(){return 0}},{key:"isDestroy",get:function(){return!this.player}},{key:"cancelPreloadTask",value:function(){this.preloader&&this.preloader.cancelLoading(this.player.playerId)}},{key:"CDNUrl",get:function(){var e=this.playerConfig.url,t=document.createElement("a");return t.href=e,t.host}},{key:"abrInstance",get:function(){return this._abrService?this._abrService.abrInstance:null}},{key:"_handleUrlExpire",value:function(){var e=this,t=this.config,r=this.player,n=r.paused;(new Date).getTime()/1e3>=this.urlExpireTimestamp&&this.urlExpireTimestamp>0&&!n&&t.getServerTime&&(r.serverTimeDiffPromise=r.serverTimeDiffPromise||t.getServerTime().catch((function(){return 0})),r.serverTimeDiffPromise.then((function(t){if(t&&(r.serverTimeDiff=(new Date).getTime()/1e3-t),(new Date).getTime()/1e3>=e.urlExpireTimestamp+r.serverTimeDiff){e.urlExpireTimestamp=(new Date).getTime()/1e3+86400;var n=new NetWorkError("network",ERROR_CODES[403]);e._emitExpireEvent(n)}})))}},{key:"_emitExpireEvent",value:function(e){var t=this.player,r=(new Date).getTime()/1e3;this.emitExpireTimestamp?r-this.emitExpireTimestamp>300&&(this.emitExpireTimestamp=r,t.emit("MEDIA_EXPIRED",e)):(this.emitExpireTimestamp=r,t.emit("MEDIA_EXPIRED",e))}}],[{key:"registerPreloader",value:function(e,t){e.vtype=VTYPES.MP4,Mp4Preloader.BitRateAdapter=t,new Mp4Preloader(e,this)}},{key:"pluginName",get:function(){return"Mp4EncryptPlayer"}},{key:"defaultConfig",get:function(){return{onlyInit:!1,useWaterLevel:!1,maxBufferLength:10,minBufferLength:5,tickInSeconds:.2,getLicenseUrl:"",xhrSetup:{},retryCount:1,retryDelay:1e3,preloadCacheType:1,needPreloadRangeList:!1,cdnHost:"",cdnBucket:"",isEncrypt:!1,isOpenPreload:!0,needPreloadCheck:!1,preloadTime:0,preloadMaxCacheCount:0,needAutoBitrate:!0,keyValue:null,drm:null,switchBitRateWay:!1,enableWorker:!1,bufferThreshold:10,removeBufferLen:40,focusUserDefinition:!1,resumePlayWaterLevel:2,waitJampBufferMaxCnt:3,waitingInBufferTimeOut:5e3,h265Degrade:!1,forceVideoPlay:!1,segmentMinDuration:2,supportHevc:void 0,H264Config:null}}},{key:"speed",get:function(){return _realTimeSpeed}},{key:"realTimeSpeed",get:function(){return _realTimeSpeed}},{key:"version",get:function(){return version}}]),i}();function ownKeys$3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$3(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$3(Object(r),!0).forEach((function(t){_defineProperty$6(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$3(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$4(){_regeneratorRuntime$4=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function asyncGeneratorStep$4(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator$4(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep$4(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep$4(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck$6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$6(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$2(n.key),n)}}function _createClass$6(e,t,r){return t&&_defineProperties$6(e.prototype,t),r&&_defineProperties$6(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$6(e,t,r){return(t=_toPropertyKey$2(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$5(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$5(e,t)}function _getPrototypeOf$5(e){return(_getPrototypeOf$5=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$5(e,t){return(_setPrototypeOf$5=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$5(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized$5(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$5(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$5(e)}function _createSuper$5(e){var t=_isNativeReflectConstruct$5();return function(){var r,n=_getPrototypeOf$5(e);if(t){var i=_getPrototypeOf$5(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$5(this,r)}}function _toPrimitive$2(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey$2(e){var t=_toPrimitive$2(e,"string");return"symbol"==typeof t?t:String(t)}function ownKeys$2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$2(Object(r),!0).forEach((function(t){_defineProperty$5(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$2(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$3(){_regeneratorRuntime$3=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function _typeof$1(e){return(_typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function asyncGeneratorStep$3(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator$3(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep$3(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep$3(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck$5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$5(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey$1(n.key),n)}}function _createClass$5(e,t,r){return t&&_defineProperties$5(e.prototype,t),r&&_defineProperties$5(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$5(e,t,r){return(t=_toPropertyKey$1(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$4(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$4(e,t)}function _getPrototypeOf$4(e){return(_getPrototypeOf$4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$4(e,t){return(_setPrototypeOf$4=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$4(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _construct$1(e,t,r){return(_construct$1=_isNativeReflectConstruct$4()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&_setPrototypeOf$4(i,r.prototype),i}).apply(null,arguments)}function _isNativeFunction$1(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _wrapNativeSuper$1(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper$1=function(e){if(null===e||!_isNativeFunction$1(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct$1(e,arguments,_getPrototypeOf$4(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf$4(r,e)},_wrapNativeSuper$1(e)}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _assertThisInitialized$4(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$4(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$4(e)}function _createSuper$4(e){var t=_isNativeReflectConstruct$4();return function(){var r,n=_getPrototypeOf$4(e);if(t){var i=_getPrototypeOf$4(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$4(this,r)}}function _superPropBase$1(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf$4(e)););return e}function _get$1(){return _get$1="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=_superPropBase$1(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},_get$1.apply(this,arguments)}function _unsupportedIterableToArray$4(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$4(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$4(e,t):void 0}}function _arrayLikeToArray$4(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray$4(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function _toPrimitive$1(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey$1(e){var t=_toPrimitive$1(e,"string");return"symbol"==typeof t?t:String(t)}function createPublicPromise$1(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}Mp4EncryptPlayer.isSupported=isSupported$1,Mp4EncryptPlayer.isEMESupported=isEMESupported,Mp4EncryptPlayer.isSupportedWithXgmse=isSupportedWithXgmse,Mp4EncryptPlayer.isMediaSourceSupported=isMediaSourceSupported,Mp4EncryptPlayer.isWebAssemblySupported=isWebAssemblySupported,Mp4EncryptPlayer.getPlayLicenses=getPlayLicenses,Mp4EncryptPlayer.CUSTOM_EVENTS=CUSTOM_EVENTS,Mp4EncryptPlayer.Mp4Preloader=Mp4Preloader;var ERR$1={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",NETWORK_FORBIDDEN:"network_forbidden",NETWORK_NOTFOUND:"network_notfound",NETWROK_RANGE_NOT_SATISFIABLE:"network_range_not_satisfiable",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",RUNTIME:"runtime",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION",DASH:"DASH",LICENSE:"LICENSE",CUSTOM_LICENSE:"CUSTOM_LICENSE",MSE_HIJACK:"MSE_HIJACK",EME_HIJACK:"EME_HIJACK",SIDX:"SIDX",NO_CANPLAY_ERROR:"NO_CANPLAY_ERROR",BUFFERBREAK_ERROR:"BUFFERBREAK_ERROR",WAITING_TIMEOUT_ERROR:"WAITINT_TIME_OUT_ERROR",MEDIA_ERR_ABORTED:"MEDIA_ERR_ABORTED",MEDIA_ERR_NETWORK:"MEDIA_ERR_NETWORK",MEDIA_ERR_DECODE:"MEDIA_ERR_DECODE",MEDIA_ERR_SRC_NOT_SUPPORTED:"MEDIA_ERR_SRC_NOT_SUPPORTED",MEDIA_ERR_CODEC_NOT_SUPPORTED:"MEDIA_ERR_CODEC_NOT_SUPPORTED",MEDIA_ERR_URL_EMPTY:"MEDIA_ERR_URL_EMPTY"}},ERR_CODE$1=(_defineProperty$5(_ERR_CODE$1={},ERR$1.MANIFEST,{HLS:1100,DASH:1200}),_defineProperty$5(_ERR_CODE$1,ERR$1.NETWORK,2100),_defineProperty$5(_ERR_CODE$1,ERR$1.NETWORK_TIMEOUT,2101),_defineProperty$5(_ERR_CODE$1,ERR$1.NETWORK_FORBIDDEN,2103),_defineProperty$5(_ERR_CODE$1,ERR$1.NETWORK_NOTFOUND,2104),_defineProperty$5(_ERR_CODE$1,ERR$1.NETWROK_RANGE_NOT_SATISFIABLE,2116),_defineProperty$5(_ERR_CODE$1,ERR$1.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400,SIDX:3410}),_defineProperty$5(_ERR_CODE$1,ERR$1.REMUX,{FMP4:4100,MP4:4200}),_defineProperty$5(_ERR_CODE$1,ERR$1.MEDIA,{MEDIA_ERR_ABORTED:5101,MEDIA_ERR_NETWORK:5102,MEDIA_ERR_DECODE:5103,MEDIA_ERR_SRC_NOT_SUPPORTED:5104,MEDIA_ERR_CODEC_NOT_SUPPORTED:5105,MEDIA_ERR_URL_EMPTY:5106,MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203,MSE_HIJACK:5204,EME_HIJACK:5301}),_defineProperty$5(_ERR_CODE$1,ERR$1.DRM,{LICENSE:7100,CUSTOM_LICENSE:7200}),_defineProperty$5(_ERR_CODE$1,ERR$1.OTHER,8e3),_defineProperty$5(_ERR_CODE$1,ERR$1.RUNTIME,{NO_CANPLAY_ERROR:9001,BUFFERBREAK_ERROR:9002,WAITING_TIMEOUT_ERROR:9003}),_ERR_CODE$1),StreamingError$1=function(e){_inherits$4(r,_wrapNativeSuper$1(Error));var t=_createSuper$4(r);function r(e,n,i,a,o){var s;return _classCallCheck$5(this,r),(s=t.call(this,o||(null==i?void 0:i.message))).errorType=e===ERR$1.NETWORK_TIMEOUT?ERR$1.NETWORK:e,s.originError=i,s.ext=a,s.errorCode=ERR_CODE$1[e][n]||ERR_CODE$1[e],s.errorMessage=s.message,s.errorCode||(s.errorType=ERR$1.OTHER,s.errorCode=ERR_CODE$1[s.errorType]),s}return _createClass$5(r,null,[{key:"create",value:function(e,t,n,i,a){return e instanceof r?e:(e instanceof Error&&(n=e,e=""),e||(e=ERR$1.OTHER),new r(e,t,n,i,a))}},{key:"network",value:function(e){var t;return new r(null!=e&&e.isTimeout?ERR$1.NETWORK_TIMEOUT:ERR$1.NETWORK,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})}}]),r}(),LogCacheLevel={DEBUG:1,LOG:2,WARN:3,ERROR:4},LOG_MAX_SIZE=204800,SIMPLE_TYPE=["Boolean","Number","String","Undefined","Null","Date","Object"],Logger$4=function(){function e(t,r){_classCallCheck$5(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=(null==r?void 0:r.disabled)||!0,this.logCacheLevel=(null==r?void 0:r.logCacheLevel)||3,this.logMaxSize=(null==r?void 0:r.logMaxSize)||LOG_MAX_SIZE,this.logSize=0,this.logTextArray=[]}return _createClass$5(e,[{key:"debug",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel.DEBUG].concat(n)),e.disabled||(t=console).debug.apply(t,[this._prefix,nowTime$1()].concat(n))}},{key:"log",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel.LOG].concat(n)),e.disabled||(t=console).log.apply(t,[this._prefix,nowTime$1()].concat(n))}},{key:"warn",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel.WARN].concat(n)),e.disabled||(t=console).warn.apply(t,[this._prefix,nowTime$1()].concat(n))}},{key:"error",value:function(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];this.logCache.apply(this,[LogCacheLevel.ERROR].concat(n)),e.disabled||(t=console).error.apply(t,[this._prefix,nowTime$1()].concat(n))}},{key:"logCache",value:function(e){if(!(e<this.logCacheLevel)){var t="";try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];var a=n.map((function(e){return logable(e)}));t=this._prefix+nowTime$1()+JSON.stringify(a)}catch(e){return}if(e>=this.logCacheLevel&&(this.logSize+=t.length,this.logTextArray.push(t)),this.logSize>this.logMaxSize){var o=this.logTextArray.shift();this.logSize-=o.length}}}},{key:"getLogCache",value:function(){var e=this.logTextArray.join("\n");return this.reset(),e}},{key:"reset",value:function(){this.logTextArray=[],this.logSize=0}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}},{key:"setLogLevel",value:function(e){this.logCacheLevel=e}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function nowTime$1(){return(new Date).toLocaleString()}function reduceDepth(e){if("object"!==_typeof$1(e))return e;var t=Object.prototype.toString.call(e).slice(8,-1);switch(t){case"Array":case"Uint8Array":case"ArrayBuffer":return t+"["+e.length+"]";case"Object":return"{}";default:return t}}function logable(e,t,r){r||(r=1),t||(t=2);var n={};if(!e||"object"!==_typeof$1(e))return e;var i=Object.prototype.toString.call(e).slice(8,-1);if(!SIMPLE_TYPE.includes(i))return i;if(!(r>t)){for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r===t?n[a]=reduceDepth(e[a]):"object"===_typeof$1(e[a])?n[a]=logable(e[a],t,r+1):n[a]=e[a]);return n}}_defineProperty$5(Logger$4,"disabled",!0);var LoaderType={FETCH:"fetch",XHR:"xhr"},ResponseType={ARRAY_BUFFER:"arraybuffer",TEXT:"text",JSON:"json"},NetError=function(e){_inherits$4(r,_wrapNativeSuper$1(Error));var t=_createSuper$4(r);function r(e,n,i,a){var o;return _classCallCheck$5(this,r),_defineProperty$5(_assertThisInitialized$4(o=t.call(this,a)),"retryCount",0),_defineProperty$5(_assertThisInitialized$4(o),"isTimeout",!1),_defineProperty$5(_assertThisInitialized$4(o),"loaderType",LoaderType.FETCH),_defineProperty$5(_assertThisInitialized$4(o),"startTime",0),_defineProperty$5(_assertThisInitialized$4(o),"endTime",0),_defineProperty$5(_assertThisInitialized$4(o),"options",{}),o.url=e,o.request=n,o.response=i,o}return _createClass$5(r)}(),toString$1=Object.prototype.toString;function isObject(e){return null!==e&&"object"===_typeof$1(e)}function isPlainObject(e){if("[object Object]"!==toString$1.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function isDate(e){return"[object Date]"===toString$1.call(e)}function getRangeValue(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function setUrlParams(e,t){if(e){if(!t)return e;var r,n=Object.keys(t).map((function(e){if(null!=(r=t[e]))return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){return isDate(t)?t=t.toISOString():isObject(t)&&(t=JSON.stringify(t)),"".concat(encode(e),"=").concat(encode(t))})).join("&")})).filter(Boolean).join("&");if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}}function createResponse(e,t,r,n,i,a,o,s,u,c,l){return i=null!=i?parseFloat(i):null,n=parseInt(n||"0",10),Number.isNaN(n)&&(n=0),{data:e,done:t,options:{range:u,vid:c,index:s,contentLength:n,age:i,startTime:a,firstByteTime:o,endTime:Date.now(),priOptions:l},response:r}}function calculateSpeed(e,t){return Math.round(8*e*1e3/t/1024)}var EVENT={ERROR:"error",TTFB:"core.ttfb",LOAD_START:"core.loadstart",LOAD_RESPONSE_HEADERS:"core.loadresponseheaders",LOAD_COMPLETE:"core.loadcomplete",LOAD_RETRY:"core.loadretry",SOURCEBUFFER_CREATED:"core.sourcebuffercreated",ANALYZE_DURATION_EXCEEDED:"core.analyzedurationexceeded",REMOVE_BUFFER:"core.removebuffer",BUFFEREOS:"core.buffereos",KEYFRAME:"core.keyframe",METADATA_PARSED:"core.metadataparsed",SEI:"core.sei",SEI_IN_TIME:"core.seiintime",FLV_SCRIPT_DATA:"core.flvscriptdata",LOWDECODE:"core.lowdecode",SWITCH_URL_SUCCESS:"core.switchurlsuccess",SWITCH_URL_FAILED:"core.switchurlfailed",SPEED:"core.speed",HLS_MANIFEST_LOADED:"core.hlsmanifestloaded",HLS_LEVEL_LOADED:"core.hlslevelloaded",DEMUXED_TRACK:"core.demuxedtrack",STREAM_EXCEPTION:"core.streamexception",LARGE_AV_FIRST_FRAME_GAP_DETECT:"LARGE_AV_FIRST_FRAME_GAP_DETECT",LARGE_VIDEO_DTS_GAP_DETECT:"LARGE_VIDEO_DTS_GAP_DETECT",LARGE_AUDIO_DTS_GAP_DETECT:"LARGE_AUDIO_DTS_GAP_DETECT",AUDIO_GAP_DETECT:"AUDIO_GAP_DETECT",AUDIO_OVERLAP_DETECT:"AUDIO_OVERLAP_DETECT",MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT:"MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT",REAL_TIME_SPEED:"real_time_speed"},CACHESIZE=2097152,FetchLoader=function(e){_inherits$4(n,EventEmitter$1);var t,r=_createSuper$4(n);function n(){var e;return _classCallCheck$5(this,n),_defineProperty$5(_assertThisInitialized$4(e=r.call(this)),"_abortController",null),_defineProperty$5(_assertThisInitialized$4(e),"_timeoutTimer",null),_defineProperty$5(_assertThisInitialized$4(e),"_reader",null),_defineProperty$5(_assertThisInitialized$4(e),"_response",null),_defineProperty$5(_assertThisInitialized$4(e),"_aborted",!1),_defineProperty$5(_assertThisInitialized$4(e),"_index",-1),_defineProperty$5(_assertThisInitialized$4(e),"_range",null),_defineProperty$5(_assertThisInitialized$4(e),"_receivedLength",0),_defineProperty$5(_assertThisInitialized$4(e),"_running",!1),_defineProperty$5(_assertThisInitialized$4(e),"_logger",null),_defineProperty$5(_assertThisInitialized$4(e),"_vid",""),_defineProperty$5(_assertThisInitialized$4(e),"_onProcessMinLen",0),_defineProperty$5(_assertThisInitialized$4(e),"_onCancel",null),_defineProperty$5(_assertThisInitialized$4(e),"_priOptions",null),e}return _createClass$5(n,[{key:"load",value:function(e){var t,r=this,n=e.url,i=e.vid,a=e.timeout,o=e.responseType,s=e.onProgress,u=e.index,c=e.onTimeout,l=e.onCancel,d=e.range,h=e.transformResponse,f=e.request,p=e.params,m=e.logger,y=e.method,g=e.headers,v=e.body,b=e.mode,_=e.credentials,A=e.cache,T=e.redirect,E=e.referrer,S=e.referrerPolicy,$=e.onProcessMinLen,I=e.priOptions;this._logger=m,this._aborted=!1,this._onProcessMinLen=$,this._onCancel=l,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=u,this._range=d||[0,0],this._vid=i||n,this._priOptions=I||{};var w={method:y,headers:g,body:v,mode:b,credentials:_,cache:A,redirect:T,referrer:E,referrerPolicy:S,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},R=!1;clearTimeout(this._timeoutTimer),n=setUrlParams(n,p);var k=getRangeValue(d);k&&(g=f?f.headers:w.headers=w.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",k):g.Range=k),a&&(this._timeoutTimer=setTimeout((function(){if(R=!0,r.cancel(),c){var e=new NetError(n,w,null,"timeout");e.isTimeout=!0,c(e,{index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions})}}),a));var P=Date.now();return this._logger.debug("[fetch load start], index,",u,",range,",d),new Promise((function(e,t){fetch(f||n,f?void 0:w).then(function(){var i=_asyncToGenerator$3(_regeneratorRuntime$3().mark((function i(a){var c,l,f,p;return _regeneratorRuntime$3().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(clearTimeout(r._timeoutTimer),r._response=a,!r._aborted&&r._running){i.next=4;break}return i.abrupt("return");case 4:if(h&&(a=h(a,n)||a),a.ok){i.next=7;break}throw new NetError(n,w,a,"bad network response");case 7:if(c=Date.now(),o!==ResponseType.TEXT){i.next=15;break}return i.next=11,a.text();case 11:l=i.sent,r._running=!1,i.next=37;break;case 15:if(o!==ResponseType.JSON){i.next=22;break}return i.next=18,a.json();case 18:l=i.sent,r._running=!1,i.next=37;break;case 22:if(!s){i.next=29;break}return r.resolve=e,r.reject=t,r._loadChunk(a,s,P,c),i.abrupt("return");case 29:return i.next=31,a.arrayBuffer();case 31:l=i.sent,l=new Uint8Array(l),r._running=!1,f=Date.now()-P,p=calculateSpeed(l.byteLength,f),r.emit(EVENT.REAL_TIME_SPEED,{speed:p,len:l.byteLength,time:f,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions});case 37:r._logger.debug("[fetch load end], index,",u,",range,",d),e(createResponse(l,!0,a,a.headers.get("Content-Length"),a.headers.get("age"),P,c,u,d,r._vid,r._priOptions));case 39:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}()).catch((function(e){var i;clearTimeout(r._timeoutTimer),r._running=!1,r._aborted&&!R||((e=e instanceof NetError?e:new NetError(n,w,null,null===(i=e)||void 0===i?void 0:i.message)).startTime=P,e.endTime=Date.now(),e.isTimeout=R,e.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},t(e))}))}))}},{key:"cancel",value:(t=_asyncToGenerator$3(_regeneratorRuntime$3().mark((function e(){return _regeneratorRuntime$3().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._aborted){e.next=2;break}return e.abrupt("return");case 2:if(this._aborted=!0,this._running=!1,!this._response){e.next=14;break}if(e.prev=5,!this._reader){e.next=9;break}return e.next=9,this._reader.cancel();case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:this._response=this._reader=null;case 14: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});case 16:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})},{key:"_loadChunk",value:function(e,t,r,n){var i=this;if(!e.body||!e.body.getReader){this._running=!1;var a=new NetError(e.url,"",e,"onProgress of bad response.body.getReader");return a.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(a)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(CACHESIZE),this._writeIdx=0);var o,s,u,c=this._reader=e.body.getReader(),l=function(){var a=_asyncToGenerator$3(_regeneratorRuntime$3().mark((function a(){var d,h,f,p,m,y,g,v;return _regeneratorRuntime$3().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return s=Date.now(),a.prev=1,a.next=4,c.read();case 4:o=a.sent,u=Date.now(),a.next=13;break;case 8:return a.prev=8,a.t0=a.catch(1),u=Date.now(),i._aborted||(i._running=!1,a.t0.options={index:i._index,range:i._range,vid:i._vid,priOptions:i._priOptions},i.reject(a.t0)),a.abrupt("return");case 13:if(h=(null===(d=i._range)||void 0===d?void 0:d.length)>0?i._range[0]:0,f=h+i._receivedLength,!i._aborted){a.next=19;break}return i._running=!1,t(void 0,!1,{range:[f,f],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),a.abrupt("return");case 19:p=o.value?o.value.byteLength:0,i._receivedLength+=p,i._logger.debug("【fetchLoader,onProgress call】,task,",i._range,", start,",f,", end,",h+i._receivedLength,", done,",o.done),i._onProcessMinLen>0?i._writeIdx+p>=i._onProcessMinLen||o.done?((m=new Uint8Array(i._writeIdx+p)).set(i._cache.slice(0,i._writeIdx),0),p>0&&m.set(o.value,i._writeIdx),i._writeIdx=0,i._logger.debug("【fetchLoader,onProgress enough】,done,",o.done,",len,",m.byteLength,", writeIdx,",i._writeIdx)):p>0&&i._writeIdx+p<CACHESIZE?(i._cache.set(o.value,i._writeIdx),i._writeIdx+=p,i._logger.debug("【fetchLoader,onProgress cache】,len,",p,", writeIdx,",i._writeIdx)):p>0&&(y=new Uint8Array(i._writeIdx+p+2048),i._logger.debug("【fetchLoader,onProgress extra start】,size,",i._writeIdx+p+2048,", datalen,",p,", writeIdx,",i._writeIdx),y.set(i._cache.slice(0,i._writeIdx),0),p>0&&y.set(o.value,i._writeIdx),i._writeIdx+=p,delete i._cache,i._cache=y,i._logger.debug("【fetchLoader,onProgress extra end】,len,",p,", writeIdx,",i._writeIdx)):m=o.value,(m&&m.byteLength>0||o.done)&&t(m,o.done,{range:[i._range[0]+i._receivedLength-(m?m.byteLength:0),i._range[0]+i._receivedLength],vid:i._vid,index:i._index,startTime:s,endTime:u,st:r,firstByteTime:n,priOptions:i._priOptions},e),o.done?(g=Date.now()-r,v=calculateSpeed(i._receivedLength,g),i.emit(EVENT.REAL_TIME_SPEED,{speed:v,len:i._receivedLength,time:g,vid:i._vid,index:i._index,range:i._range,priOptions:i._priOptions}),i._running=!1,i._logger.debug("[fetchLoader onProgress end],task,",i._range,",done,",o.done),i.resolve(createResponse(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),r,n,i._index,i._range,i._vid,i._priOptions))):l();case 25:case"end":return a.stop()}}),a,null,[[1,8]])})));return function(){return a.apply(this,arguments)}}();l()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}]),n}();function getConfig$1(e){return _objectSpread2$2({loaderType:LoaderType.FETCH,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:ResponseType.TEXT,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)}var XhrLoader=function(e){_inherits$4(r,EventEmitter$1);var t=_createSuper$4(r);function r(){var e;return _classCallCheck$5(this,r),_defineProperty$5(_assertThisInitialized$4(e=t.call(this)),"_xhr",null),_defineProperty$5(_assertThisInitialized$4(e),"_aborted",!1),_defineProperty$5(_assertThisInitialized$4(e),"_timeoutTimer",null),_defineProperty$5(_assertThisInitialized$4(e),"_range",null),_defineProperty$5(_assertThisInitialized$4(e),"_receivedLength",0),_defineProperty$5(_assertThisInitialized$4(e),"_url",null),_defineProperty$5(_assertThisInitialized$4(e),"_onProgress",null),_defineProperty$5(_assertThisInitialized$4(e),"_index",-1),_defineProperty$5(_assertThisInitialized$4(e),"_headers",null),_defineProperty$5(_assertThisInitialized$4(e),"_currentChunkSizeKB",384),_defineProperty$5(_assertThisInitialized$4(e),"_timeout",null),_defineProperty$5(_assertThisInitialized$4(e),"_xhr",null),_defineProperty$5(_assertThisInitialized$4(e),"_withCredentials",null),_defineProperty$5(_assertThisInitialized$4(e),"_startTime",-1),_defineProperty$5(_assertThisInitialized$4(e),"_loadCompleteResolve",null),_defineProperty$5(_assertThisInitialized$4(e),"_loadCompleteReject",null),_defineProperty$5(_assertThisInitialized$4(e),"_runing",!1),_defineProperty$5(_assertThisInitialized$4(e),"_logger",!1),_defineProperty$5(_assertThisInitialized$4(e),"_vid",""),_defineProperty$5(_assertThisInitialized$4(e),"_responseType",void 0),_defineProperty$5(_assertThisInitialized$4(e),"_credentials",void 0),_defineProperty$5(_assertThisInitialized$4(e),"_method",void 0),_defineProperty$5(_assertThisInitialized$4(e),"_transformResponse",void 0),_defineProperty$5(_assertThisInitialized$4(e),"_firstRtt",void 0),_defineProperty$5(_assertThisInitialized$4(e),"_onCancel",null),_defineProperty$5(_assertThisInitialized$4(e),"_priOptions",null),e}return _createClass$5(r,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._logger=e.logger,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._logger.debug("【xhrLoader task】, range",this._range),this._url=setUrlParams(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof NetError?e:new NetError(t._url,t._request)).startTime=r,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===ResponseType.ARRAY_BUFFER&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,n=this._range[1];t<this._range[1]-r&&(n=r+t),e=[r,n],this._logger.debug("[xhr_loader->],tast :",this._range,", SubRange, ",e)}else e=this._range,this._logger.debug("[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var t=this;try{this._startTime=Date.now();var r=this._xhr=new XMLHttpRequest;r.open(this._method||"GET",this._url,!0),r.responseType=this._responseType,this._timeout&&(r.timeout=this._timeout),r.withCredentials=this._withCredentials,r.onload=this._onLoad.bind(this),r.onreadystatechange=this._onReadyStatechange.bind(this),r.onerror=function(e){var r,n,i;t._running=!1;var a=new NetError(t._url,t._request,null==e||null===(r=e.currentTarget)||void 0===r?void 0:r.response,"xhr.onerror.status:"+(null==e||null===(n=e.currentTarget)||void 0===n?void 0:n.status)+",statusText,"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.statusText));a.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(a)},r.ontimeout=function(e){t.cancel();var r=new NetError(t._url,t._request,{status:408},"timeout");t._onTimeout&&(r.isTimeout=!0,t._onTimeout(r,{index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions})),r.options={index:t._index,range:t._range,vid:t._vid,priOptions:t._priOptions},t._loadCompleteReject(r)};var n=this._headers||{},i=getRangeValue(e);i&&(n.Range=i),n&&Object.keys(n).forEach((function(e){r.setRequestHeader(e,n[e])})),this._logger.debug("[xhr.send->] tast,",this._range,",load sub range, ",e),r.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,r=e.target.status;if(r<200||r>299){var n=new NetError(this._url,null,_objectSpread2$2(_objectSpread2$2({},e.target.response),{},{status:r}),"bad response,status:"+r);return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(n)}var i,a=null,o=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===ResponseType.ARRAY_BUFFER){var u,c=new Uint8Array(e.target.response);if(i=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var l=Date.now()-this._startTime,d=calculateSpeed(this._receivedLength,l);this.emit(EVENT.REAL_TIME_SPEED,{speed:d,len:this._receivedLength,time:l,vid:this._vid,index:this._index,range:[i,s+this._receivedLength],priOptions:this._priOptions})}a=c,o=!((null===(u=this._range)||void 0===u?void 0:u.length)>1&&this._range[1]&&this._receivedLength<this._range[1]-this._range[0]),this._logger.debug("[xhr load done->], tast :",this._range,", start",i,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,a=e.target.response;var h={ok:r>=200&&r<300,status:r,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(a,o,{index:this._index,vid:this._vid,range:[i,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(createResponse(this._onProgress?null:a,o,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,_get$1(_getPrototypeOf$4(r.prototype),"removeAllListeners",this).call(this),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r={},n=_createForOfIteratorHelper(e.getAllResponseHeaders().trim().split("\r\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value.split(": ");r[i[0].toLowerCase()]=i.slice(1).join(": ")}}catch(e){n.e(e)}finally{n.f()}return r}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}]),r}(),_excluded=["retry","retryDelay","onRetryError","transformError"],Task=function(){function e(t,r){_classCallCheck$5(this,e),this.promise=createPublicPromise$1(),this.alive=!!r.onProgress,!r.logger&&(r.logger=new Logger$4("Loader")),this._loaderType=t,this._loader=t===LoaderType.FETCH&&window.fetch?new FetchLoader:new XhrLoader,this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc,this._logger=r.logger}var t;return _createClass$5(e,[{key:"exec",value:function(){var e=this,t=this._config,r=t.retry,n=t.retryDelay,i=t.onRetryError,a=t.transformError,o=_objectWithoutProperties(t,_excluded),s=function(){var t=_asyncToGenerator$3(_regeneratorRuntime$3().mark((function t(){var u,c,l;return _regeneratorRuntime$3().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(o);case 3:u=t.sent,e.promise.resolve(u),t.next=27;break;case 7:if(t.prev=7,t.t0=t.catch(0),e._loader.running=!1,e._logger.debug("[task request catch err]",t.t0),!e._canceled){t.next=13;break}return t.abrupt("return");case 13:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,a&&(c=a(c)||c),i&&e._retryCount>0&&i(c,e._retryCount,{index:o.index,vid:o.vid,range:o.range,priOptions:o.priOptions}),e._retryCount++,l=!0,e._retryCheckFunc&&(l=e._retryCheckFunc(t.t0)),!(l&&e._retryCount<=r)){t.next=26;break}return clearTimeout(e._retryTimer),e._logger.debug("[task request setTimeout],retry",e._retryCount,",retry range,",o.range),e._retryTimer=setTimeout(s,n),t.abrupt("return");case 26:e.promise.reject(c);case 27:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:(t=_asyncToGenerator$3(_regeneratorRuntime$3().mark((function e(){return _regeneratorRuntime$3().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,e.abrupt("return",this._loader.cancel());case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}]),e}();function sleep(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}var NetLoader=function(e){_inherits$4(n,EventEmitter$1);var t,r=_createSuper$4(n);function n(e){var t;return _classCallCheck$5(this,n),_defineProperty$5(_assertThisInitialized$4(t=r.call(this,e)),"type",LoaderType.FETCH),_defineProperty$5(_assertThisInitialized$4(t),"_queue",[]),_defineProperty$5(_assertThisInitialized$4(t),"_alive",[]),_defineProperty$5(_assertThisInitialized$4(t),"_currentTask",null),_defineProperty$5(_assertThisInitialized$4(t),"_config",void 0),t._config=getConfig$1(e),t._config.loaderType!==LoaderType.XHR&&FetchLoader.isSupported()||(t.type=LoaderType.XHR),t.log=e.logger,t}return _createClass$5(n,[{key:"isFetch",value:function(){return this.type===LoaderType.FETCH}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,(r=Object.assign({},this._config,r)).params&&(r.params=Object.assign({},r.params)),r.headers&&isPlainObject(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&isPlainObject(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r),r.logger=this.log;var n=new Task(this.type,r);return n.loader.on(EVENT.REAL_TIME_SPEED,(function(e){t.emit(EVENT.REAL_TIME_SPEED,e)})),this._queue.push(n),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),n.promise}},{key:"cancel",value:(t=_asyncToGenerator$3(_regeneratorRuntime$3().mark((function e(){var t;return _regeneratorRuntime$3().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,sleep();case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return FetchLoader.isSupported()}}]),n}(),EXTEND_EVENTS={RTC_STATE_CHANGE:"core.rtcstatechange"},lib={},parser$1={},grammar$2={exports:{}},grammar$1=grammar$2.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(grammar$1).forEach((function(e){grammar$1[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}));var grammarExports=grammar$2.exports;!function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var a=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var a=0;a<n.length;a+=1)null!=e[a+1]&&(r[n[a]]=t(e[a+1]))}(n.match(e.reg),a,e.names,e.name),e.push&&r[e.push].push(a)},n=grammarExports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},a=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(a.push({rtp:[],fmtp:[]}),o=a[a.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var u=n[t][s];if(u.reg.test(i))return r(u,o,i)}})),t.media=a,t};var a=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(parser$1);var grammar=grammarExports,formatRegExp=/%[sdv%]/g,format=function(e){var t=1,r=arguments,n=r.length;return e.replace(formatRegExp,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},makeLine=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var a=t.names[i];t.name?n.push(r[t.name][a]):n.push(r[t.names[i]])}else n.push(r[t.name]);return format.apply(null,n)},defaultOuterOrder=["v","o","s","i","u","e","p","c","b","t","r","z","a"],defaultInnerOrder=["i","c","b","a"],writer$1=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var r=t.outerOrder||defaultOuterOrder,n=t.innerOrder||defaultInnerOrder,i=[];return r.forEach((function(t){grammar[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(makeLine(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(makeLine(t,r,e))}))}))})),e.media.forEach((function(e){i.push(makeLine("m",grammar.m[0],e)),n.forEach((function(t){grammar[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(makeLine(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(makeLine(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"},parser=parser$1,writer=writer$1;function getOption(e){return _objectSpread2$3({retryCount:0,retryDelay:1e3,loadTimeout:5e3,stallInterval:400,delayHint:0},e)}function _getStats(e){var t=[];return e.forEach((function(e){"inbound-rtp"===e.type&&t.push(e)})),t.map((function(t){var r=e.get(t.codecId),n=e.get(t.trackId);return{type:t.mediaType,inboundRtp:t,codec:r,track:n}}))}function getStats(e){return new Promise((function(t){var r;null===(r=e.getStats(null))||void 0===r||r.then((function(e){t(_getStats(e))}))})).catch((function(){}))}function getStatsSnapshoot(e){var t,r,n,i,a,o,s,u,c,l,d,h,f,p,m,y,g,v,b,_,A,T,E,S,$,I,w,R,k,P=null==e?void 0:e.filter((function(e){return"video"===e.type}))[0],C=null==e?void 0:e.filter((function(e){return"audio"===e.type}))[0];return{video:P?{codec:null===(t=P.codec)||void 0===t?void 0:t.mimeType,payloadType:null===(r=P.codec)||void 0===r?void 0:r.payloadType,sdpFmtpLine:null===(n=P.codec)||void 0===n?void 0:n.sdpFmtpLine,bytesReceived:null===(i=P.inboundRtp)||void 0===i?void 0:i.bytesReceived,firCount:null===(a=P.inboundRtp)||void 0===a?void 0:a.firCount,pliCount:null===(o=P.inboundRtp)||void 0===o?void 0:o.pliCount,frameHeight:null===(s=P.inboundRtp)||void 0===s?void 0:s.frameHeight,frameWidth:null===(u=P.inboundRtp)||void 0===u?void 0:u.frameWidth,framesDecoded:null===(c=P.inboundRtp)||void 0===c?void 0:c.framesDecoded,framesDropped:null===(l=P.inboundRtp)||void 0===l?void 0:l.framesDropped,framesPerSecond:null===(d=P.inboundRtp)||void 0===d?void 0:d.framesPerSecond,framesReceived:null===(h=P.inboundRtp)||void 0===h?void 0:h.framesReceived,jitter:null===(f=P.inboundRtp)||void 0===f?void 0:f.jitter,jitterBufferDelay:null===(p=P.inboundRtp)||void 0===p?void 0:p.jitterBufferDelay,keyFramesDecoded:null===(m=P.inboundRtp)||void 0===m?void 0:m.keyFramesDecoded,nackCount:null===(y=P.inboundRtp)||void 0===y?void 0:y.nackCount,packetsLost:null===(g=P.inboundRtp)||void 0===g?void 0:g.packetsLost,packetsReceived:null===(v=P.inboundRtp)||void 0===v?void 0:v.packetsReceived}:void 0,audio:C?{codec:null===(b=C.codec)||void 0===b?void 0:b.mimeType,payloadType:null===(_=C.codec)||void 0===_?void 0:_.payloadType,sdpFmtpLine:null===(A=C.codec)||void 0===A?void 0:A.sdpFmtpLine,bytesReceived:null===(T=C.inboundRtp)||void 0===T?void 0:T.bytesReceived,audioLevel:null===(E=C.inboundRtp)||void 0===E?void 0:E.audioLevel,jitter:null===(S=C.inboundRtp)||void 0===S?void 0:S.jitter,jitterBufferDelay:null===($=C.inboundRtp)||void 0===$?void 0:$.jitterBufferDelay,packetsLost:null===(I=C.inboundRtp)||void 0===I?void 0:I.packetsLost,packetsReceived:null===(w=C.inboundRtp)||void 0===w?void 0:w.packetsReceived,totalSamplesDuration:null===(R=C.inboundRtp)||void 0===R?void 0:R.totalSamplesDuration,totalSamplesReceived:null===(k=C.inboundRtp)||void 0===k?void 0:k.totalSamplesReceived}:void 0}}lib.write=writer,lib.parse=parser.parse,lib.parseParams=parser.parseParams,lib.parseFmtpConfig=parser.parseFmtpConfig,lib.parsePayloads=parser.parsePayloads,lib.parseRemoteCandidates=parser.parseRemoteCandidates,lib.parseImageAttributes=parser.parseImageAttributes,lib.parseSimulcastStreamList=parser.parseSimulcastStreamList;var logger$5=new Logger$4("rts"),Rts=function(e){_inherits$5(i,EventEmitter$1);var t,r,n=_createSuper$5(i);function i(e){var t;return _classCallCheck$6(this,i),_defineProperty$6(_assertThisInitialized$5(t=n.call(this)),"_url",""),_defineProperty$6(_assertThisInitialized$5(t),"_pc",null),_defineProperty$6(_assertThisInitialized$5(t),"_audioTransceicer",null),_defineProperty$6(_assertThisInitialized$5(t),"_videoTransceicer",null),_defineProperty$6(_assertThisInitialized$5(t),"_mediaStream",null),_defineProperty$6(_assertThisInitialized$5(t),"_media",null),_defineProperty$6(_assertThisInitialized$5(t),"_opts",null),_defineProperty$6(_assertThisInitialized$5(t),"_loader",null),_defineProperty$6(_assertThisInitialized$5(t),"_retry",0),_defineProperty$6(_assertThisInitialized$5(t),"_waitingTimer",0),_defineProperty$6(_assertThisInitialized$5(t),"_rctConnectStartTs",0),_defineProperty$6(_assertThisInitialized$5(t),"_onTrack",(function(e){if(logger$5.log("addTrack: ",e.track,e.streams),t["_".concat(e.track.kind)]=e.track,!t._mediaStream){t._mediaStream=new MediaStream,t._media.srcObject=t._mediaStream;var r=t._media.play();r&&r.catch&&r.catch((function(e){}))}t._mediaStream.addTrack(e.track)})),_defineProperty$6(_assertThisInitialized$5(t),"_mockWaitingByTimeupdate",(function(){var e,r;"connected"!==(null===(e=t._pc)||void 0===e?void 0:e.connectionState)&&"connected"!==(null===(r=t._pc)||void 0===r?void 0:r.iceConnectionState)||(clearTimeout(t._waitingTimer),t._waitingTimer=setTimeout((function(){var e;null!==(e=t._media)&&void 0!==e&&e.paused||t.emit("waiting")}),t._opts.stallInterval))})),_defineProperty$6(_assertThisInitialized$5(t),"_onLoadedData",(function(){logger$5.log("loadeddata emit"),t.getStatsSnapshoot().then((function(e){t.emit(EVENT.METADATA_PARSED,{type:"video",elapsed:Date.now()-t._rctConnectStartTs,meta:e.video}),t.emit(EVENT.METADATA_PARSED,{type:"audio",elapsed:Date.now()-t._rctConnectStartTs,meta:e.audio})}))})),_defineProperty$6(_assertThisInitialized$5(t),"_onLoaderRetry",(function(e,r){t.emit(EVENT.LOAD_RETRY,{error:StreamingError$1.network(e),retryTime:r})})),t._opts=getOption(e),t._media=t._opts.media,t._loader=new NetLoader(_objectSpread2$3(_objectSpread2$3({},e.fetchOptions),{},{responseType:"json",method:"POST",retry:t._opts.retryCount,retryDelay:t._opts.retryDelay,timeout:t._opts.loadTimeout,onRetryError:t._onLoaderRetry,logger:logger$5})),t._retry=t._opts.retryCount,t._bindMediaEvent(),t}return _createClass$6(i,[{key:"pc",get:function(){return this._pc}},{key:"audioTrack",get:function(){return this._audio}},{key:"videoTack",get:function(){return this._video}},{key:"getStats",value:function(){return getStats(this._pc)}},{key:"getStatsSnapshoot",value:function(){return this.getStats().then((function(e){return getStatsSnapshoot(e)}))}},{key:"load",value:(r=_asyncToGenerator$4(_regeneratorRuntime$4().mark((function e(t){var r,n=this;return _regeneratorRuntime$4().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._disconnect(),this._url=t,this._retry=this._opts.retryCount,(r=this._pc)&&r.close(),e.prev=5,this._pc=new RTCPeerConnection,this._bindRTCEvents(),e.next=10,this._connect(t);case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),setTimeout((function(){return n._emitError(StreamingError$1.create(ERR$1.OTHER,null,e.t0))}));case 15:case"end":return e.stop()}}),e,this,[[5,12]])}))),function(e){return r.apply(this,arguments)})},{key:"switchURL",value:function(e){this.load(e||this._url)}},{key:"_bindRTCEvents",value:function(){var e=this,t=this._pc;t.addEventListener("track",this._onTrack),t.addEventListener("connectionstatechange",(function(){if(logger$5.warn("onconnectionstatechange:",t.connectionState),e.emit(EXTEND_EVENTS.RTC_STATE_CHANGE,{state:t.connectionState,url:e._url}),"disconnected"!==t.connectionState&&"failed"!==t.connectionState||e.emit("waiting"),"failed"===t.connectionState){if(0===e._retry)return void e._emitError(StreamingError$1.network(new Error("rtc connect failed")));e._retry--,e.load(e._url)}"connected"===t.connectionState&&e.emit(EVENT.TTFB,{url:e._url,responseUrl:e._url,elapsed:Date.now()-e._rctConnectStartTs})}))}},{key:"_bindMediaEvent",value:function(){this._media.addEventListener("timeupdate",this._mockWaitingByTimeupdate),this._media.addEventListener("loadeddata",this._onLoadedData)}},{key:"_connect",value:(t=_asyncToGenerator$4(_regeneratorRuntime$4().mark((function e(){var t,r,n,i,a,o,s,u,c,l,d,h;return _regeneratorRuntime$4().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=this._pc).addTransceiver){e.next=11;break}return this._audioTransceicer=t.addTransceiver("audio",{direction:"recvonly"}),this._videoTransceicer=t.addTransceiver("video",{direction:"recvonly"}),(n=this._opts.delayHint)&&(this._audioTransceicer.receiver.playoutDelayHint=n,this._audioTransceicer.receiver.jitterBufferDelayHint=n,this._videoTransceicer.receiver.playoutDelayHint=n,this._videoTransceicer.receiver.jitterBufferDelayHint=n),e.next=8,t.createOffer();case 8:r=e.sent,e.next=14;break;case 11:return e.next=13,t.createOffer({iceRestart:!0,offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 13:r=e.sent;case 14:return logger$5.log("local offer"),logger$5.log(r.sdp),(i=lib.parse(r.sdp)).media.filter((function(e){return"audio"===e.type})).forEach((function(e){var t,r=null===(t=e.rtp.filter((function(e){return"opus"===e.codec}))[0])||void 0===t?void 0:t.payload;r&&e.fmtp.forEach((function(e){e.payload===r&&(e.config="minptime=10;stereo=1;useinbandfec=1")}))})),r.sdp=lib.write(i),logger$5.log("local offer modified:\n",r.sdp),e.next=22,t.setLocalDescription(r);case 22:return e.prev=22,s=/_?session_id=([^&$]+)/.exec(this._url),u=s?s[1]:Date.now()+"",this.emit(EVENT.LOAD_START,{url:this._url,offersdp:r.sdp,sessionId:u}),c=Date.now(),e.next=29,this._loader.load(this._url,{body:JSON.stringify({sessionId:u,version:"1.0-html",localSdp:r})});case 29:if(l=e.sent,this.emit(EVENT.LOAD_RESPONSE_HEADERS,{headers:l.response.headers}),200===(null==(d=null==l?void 0:l.data)?void 0:d.code)){e.next=34;break}throw new Error("code: ".concat(null==d?void 0:d.code,", message:").concat(null==d?void 0:d.message));case 34:return logger$5.log("answer:"),logger$5.log(null===(a=d.remoteSdp)||void 0===a?void 0:a.sdp),this.emit(EVENT.LOAD_COMPLETE,{url:this._url,elapsed:Date.now()-c,answersdp:null===(o=d.remoteSdp)||void 0===o?void 0:o.sdp}),(h=lib.parse(d.remoteSdp.sdp)).media.forEach((function(e){e.fingerprint.hash=e.fingerprint.hash.toUpperCase()})),d.remoteSdp.sdp=lib.write(h),logger$5.log("answer modified:\n",d.remoteSdp.sdp),this._rctConnectStartTs=Date.now(),e.next=44,this._pc.setRemoteDescription(d.remoteSdp);case 44:e.next=49;break;case 46:e.prev=46,e.t0=e.catch(22),this._emitError(StreamingError$1.network(e.t0));case 49:case"end":return e.stop()}}),e,this,[[22,46]])}))),function(){return t.apply(this,arguments)})},{key:"_disconnect",value:function(){var e;null===(e=this._loader)||void 0===e||e.cancel(),this._audioTransceicer=null,this._videoTransceicer=null,this._mediaStream=null}},{key:"_emitError",value:function(e){this.emit(EVENT.ERROR,e)}},{key:"destroy",value:function(){var e;this._disconnect(),null===(e=this._media)||void 0===e||e.removeEventListener("timeupdate",this._mockWaitingByTimeupdate),this._media&&(this._media.srcObject=null),this._pc&&this._pc.close(),this._loader=null,this._media=null,this._pc=null}}],[{key:"enableLogger",value:function(){Logger$4.enable()}},{key:"disableLogger",value:function(){Logger$4.disable()}}]),i}();try{localStorage.getItem("xgd")?Rts.enableLogger():Rts.disableLogger()}catch(e){}function isSupported(){return!(!window.RTCPeerConnection||!window.RTCPeerConnection.prototype.addTransceiver)}function getCapacity(){if(!isSupported())return Promise.reject("RTCPeerConnection no support");var e;try{(e=new RTCPeerConnection).addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"})}catch(e){return Promise.reject(null==e?void 0:e.message)}return e.createOffer().then((function(t){var r,n,i,a;logger$5.log(t.sdp);var o=lib.parse(t.sdp),s=null===(r=o.media)||void 0===r?void 0:r.filter((function(e){return"video"===e.type}))[0],u=null===(n=o.media)||void 0===n?void 0:n.filter((function(e){return"audio"===e.type}))[0],c=null==s||null===(i=s.rtp)||void 0===i?void 0:i.filter((function(e){return"VP8"===e.codec||"VP9"===e.codec||"H264"===e.codec})),l=null==u||null===(a=u.rtp)||void 0===a?void 0:a.filter((function(e){return"opus"===e.codec})),d=null==s?void 0:s.fmtp,h=null==u?void 0:u.fmtp;return d&&c.map((function(e){var t;e.config=null===(t=d.filter((function(t){return t.payload===e.payload}))[0])||void 0===t?void 0:t.config})),h&&l.map((function(e){var t;e.config=null===(t=h.filter((function(t){return t.payload===e.payload}))[0])||void 0===t?void 0:t.config})),e.close(),{video:c,audio:l}}))}var RtsPlugin=function(e){_inherits$5(n,BasePlugin);var t,r=_createSuper$5(n);function n(){var e;_classCallCheck$6(this,n);for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];return _defineProperty$6(_assertThisInitialized$5(e=r.call.apply(r,[this].concat(i))),"_rts",null),_defineProperty$6(_assertThisInitialized$5(e),"_rtsOpts",null),_defineProperty$6(_assertThisInitialized$5(e),"_init",(function(){var t;null===(t=e._rts)||void 0===t||t.destroy();var r=e.player.config,n=r.rts||{};e._rtsOpts=n,e._rts=new Rts(_objectSpread2$3({media:e.player.video},n)),e._rts.load(r.url)})),_defineProperty$6(_assertThisInitialized$5(e),"_onSwitchURL",(function(t){e._rts&&(e.player.config.url=t,e._rts.switchURL(t))})),e}return _createClass$6(n,[{key:"pc",get:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.pc}},{key:"videoTrack",get:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.videoTack}},{key:"audioTrack",get:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.audioTrack}},{key:"core",get:function(){return this._rts}},{key:"version",get:function(){return"0.2.0-alpha.3"}},{key:"beforePlayerInit",value:function(){var e,t=this;this._init(),this.player.switchURL=this._onSwitchURL,null===(e=this.player)||void 0===e||e.useHooks("replay",(function(){var e;return null===(e=t._rts)||void 0===e?void 0:e.switchURL()})),this.on(URL_CHANGE,this._onSwitchURL),this.on(DESTROY,this.destroy),this._transErrorEvent(),this._transCoreEvent(EVENT.LOAD_START),this._transCoreEvent(EVENT.LOAD_COMPLETE),this._transCoreEvent(EVENT.TTFB),this._transCoreEvent(EVENT.LOAD_RESPONSE_HEADERS),this._transCoreEvent(EVENT.LOAD_RETRY),this._transCoreEvent(EVENT.METADATA_PARSED),this._transCoreEvent(EXTEND_EVENTS.RTC_STATE_CHANGE);try{BasePlugin.defineGetterOrSetter(this.player,{__url:{get:function(){try{return URL.createObjectURL(new MediaSource)}catch(n){var e,r;null!==(e=t.player)&&void 0!==e&&null!==(r=e.video)&&void 0!==r&&r.srcObject||(t.player.video.srcObject=new MediaStream)}}}})}catch(e){}}},{key:"getStats",value:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.getStats()}},{key:"getStatsSnapshoot",value:function(){var e;return null===(e=this._rts)||void 0===e?void 0:e.getStatsSnapshoot()}},{key:"_transErrorEvent",value:function(){var e=this;this._rts.on(EVENT.ERROR,(function(t){if(e.player){var r=new Errors(e.player,t),n=e._rtsOpts,i=n.backupConstruct,a=n.backupURL;if(a){var o,s=e.player;s.emit("core_event",_objectSpread2$3(_objectSpread2$3({},{url:s.config.url,code:r.errorCode,message:r.message,httpCode:r.httpCode}),{},{eventName:"core.degrade"})),s.emit("degrade",{url:s.config.url,code:r.errorCode,message:r.message,httpCode:r.httpCode}),s.unRegisterPlugin("rts"),e._rts=null,s.rts=null,null!==(o=s.video)&&void 0!==o&&o.srcObject&&(s.video.srcObject=null),s.config.url=a,i?s.registerPlugin(i).beforePlayerInit():s.video.src=a}else e.player.emit(ERROR,r)}})),this._rts.on("waiting",(function(){var t;null===(t=e.player)||void 0===t||t.emit("waiting")}))}},{key:"_transCoreEvent",value:function(e){var t=this;this._rts.on(e,(function(r){t.player&&t.player.emit("core_event",_objectSpread2$3(_objectSpread2$3({},r),{},{eventName:e}))}))}},{key:"destroy",value:function(){var e;null===(e=this._rts)||void 0===e||e.destroy()}}],[{key:"pluginName",get:function(){return"rts"}},{key:"isSupported",value:function(){return isSupported()}},{key:"getCapacity",value:function(){return getCapacity()}},{key:"isSupportedH264",value:(t=_asyncToGenerator$4(_regeneratorRuntime$4().mark((function e(t){var r,i,a,o,s;return _regeneratorRuntime$4().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n.getCapacity();case 3:if(i=e.sent,a=null===(r=i.video)||void 0===r?void 0:r.filter((function(e){return"H264"===e.codec&&(!t||-1!==e.config.indexOf(t))})).length){e.next=10;break}return e.next=8,n.getCapacity();case 8:s=e.sent,a=null===(o=s.video)||void 0===o?void 0:o.filter((function(e){return"H264"===e.codec&&(!t||-1!==e.config.indexOf(t))})).length;case 10:return e.abrupt("return",!!a);case 13:return e.prev=13,e.t0=e.catch(0),e.abrupt("return",!1);case 16:case"end":return e.stop()}}),e,null,[[0,13]])}))),function(e){return t.apply(this,arguments)})}]),n}();function _iterableToArrayLimit$3(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach((function(t){_defineProperty$4(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$2(){_regeneratorRuntime$2=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,d;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function asyncGeneratorStep$2(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator$2(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep$2(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep$2(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck$4(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$4(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass$4(e,t,r){return t&&_defineProperties$4(e.prototype,t),r&&_defineProperties$4(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$4(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$3(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$3(e,t)}function _getPrototypeOf$3(e){return(_getPrototypeOf$3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$3(e,t){return(_setPrototypeOf$3=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$3(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized$3(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$3(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$3(e)}function _createSuper$3(e){var t=_isNativeReflectConstruct$3();return function(){var r,n=_getPrototypeOf$3(e);if(t){var i=_getPrototypeOf$3(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$3(this,r)}}function _slicedToArray$3(e,t){return _arrayWithHoles$3(e)||_iterableToArrayLimit$3(e,t)||_unsupportedIterableToArray$3(e,t)||_nonIterableRest$3()}function _toConsumableArray$3(e){return _arrayWithoutHoles$3(e)||_iterableToArray$3(e)||_unsupportedIterableToArray$3(e)||_nonIterableSpread$3()}function _arrayWithoutHoles$3(e){if(Array.isArray(e))return _arrayLikeToArray$3(e)}function _arrayWithHoles$3(e){if(Array.isArray(e))return e}function _iterableToArray$3(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray$3(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$3(e,t):void 0}}function _arrayLikeToArray$3(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread$3(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest$3(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:String(t)}function _classCallCheck$3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$3(e,t,r){return t&&_defineProperties$3(e.prototype,t),r&&_defineProperties$3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$3(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$2(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$2(e,t)}function _getPrototypeOf$2(e){return(_getPrototypeOf$2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$2(e,t){return(_setPrototypeOf$2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$2(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized$2(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$2(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$2(e)}function _createSuper$2(e){var t=_isNativeReflectConstruct$2();return function(){var r,n=_getPrototypeOf$2(e);if(t){var i=_getPrototypeOf$2(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$2(this,r)}}function _slicedToArray$2(e,t){return _arrayWithHoles$2(e)||_iterableToArrayLimit$2(e,t)||_unsupportedIterableToArray$2(e,t)||_nonIterableRest$2()}function _toConsumableArray$2(e){return _arrayWithoutHoles$2(e)||_iterableToArray$2(e)||_unsupportedIterableToArray$2(e)||_nonIterableSpread$2()}function _arrayWithoutHoles$2(e){if(Array.isArray(e))return _arrayLikeToArray$2(e)}function _arrayWithHoles$2(e){if(Array.isArray(e))return e}function _iterableToArray$2(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit$2(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}function _unsupportedIterableToArray$2(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$2(e,t):void 0}}function _arrayLikeToArray$2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread$2(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest$2(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var TrackType$1={VIDEO:"video",AUDIO:"audio",METADATA:"metadata"},VideoCodecType$1={AVC:"avc",HEVC:"hevc"},AudioCodecType={AAC:"aac",G711PCMA:"g7110a",G711PCMU:"g7110m"},WarningType={LARGE_AV_SHIFT:"LARGE_AV_SHIFT",LARGE_VIDEO_GAP:"LARGE_VIDEO_GAP",LARGE_VIDEO_GAP_BETWEEN_CHUNK:"LARGE_VIDEO_GAP_BETWEEN_CHUNK",LARGE_AUDIO_GAP:"LARGE_AUDIO_GAP",AUDIO_FILLED:"AUDIO_FILLED",AUDIO_DROPPED:"AUDIO_DROPPED"},VideoTrack=function(){function e(){_classCallCheck$3(this,e),_defineProperty$3(this,"id",1),_defineProperty$3(this,"type",TrackType$1.VIDEO),_defineProperty$3(this,"codecType",VideoCodecType$1.AVC),_defineProperty$3(this,"pid",-1),_defineProperty$3(this,"hvcC",void 0),_defineProperty$3(this,"codec",""),_defineProperty$3(this,"timescale",0),_defineProperty$3(this,"formatTimescale",0),_defineProperty$3(this,"sequenceNumber",0),_defineProperty$3(this,"baseMediaDecodeTime",0),_defineProperty$3(this,"baseDts",0),_defineProperty$3(this,"duration",0),_defineProperty$3(this,"warnings",[]),_defineProperty$3(this,"samples",[]),_defineProperty$3(this,"pps",[]),_defineProperty$3(this,"sps",[]),_defineProperty$3(this,"vps",[]),_defineProperty$3(this,"fpsNum",0),_defineProperty$3(this,"fpsDen",0),_defineProperty$3(this,"sarRatio",[]),_defineProperty$3(this,"width",0),_defineProperty$3(this,"height",0),_defineProperty$3(this,"nalUnitSize",4),_defineProperty$3(this,"present",!1),_defineProperty$3(this,"isVideoEncryption",!1),_defineProperty$3(this,"isAudioEncryption",!1),_defineProperty$3(this,"isVideo",!0),_defineProperty$3(this,"kid",null),_defineProperty$3(this,"pssh",null),_defineProperty$3(this,"ext",void 0)}return _createClass$3(e,[{key:"reset",value:function(){this.sequenceNumber=this.width=this.height=this.fpsDen=this.fpsNum=this.duration=this.baseMediaDecodeTime=this.timescale=0,this.codec="",this.present=!1,this.pid=-1,this.pps=[],this.sps=[],this.vps=[],this.sarRatio=[],this.samples=[],this.warnings=[],this.hvcC=null}},{key:"exist",value:function(){return!!(this.pps.length&&this.sps.length&&this.codec)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isVideoEncryption}}]),e}(),AudioTrack=function(){function e(){_classCallCheck$3(this,e),_defineProperty$3(this,"id",2),_defineProperty$3(this,"type",TrackType$1.AUDIO),_defineProperty$3(this,"codecType",AudioCodecType.AAC),_defineProperty$3(this,"pid",-1),_defineProperty$3(this,"codec",""),_defineProperty$3(this,"sequenceNumber",0),_defineProperty$3(this,"sampleDuration",0),_defineProperty$3(this,"timescale",0),_defineProperty$3(this,"formatTimescale",0),_defineProperty$3(this,"baseMediaDecodeTime",0),_defineProperty$3(this,"duration",0),_defineProperty$3(this,"warnings",[]),_defineProperty$3(this,"samples",[]),_defineProperty$3(this,"baseDts",0),_defineProperty$3(this,"sampleSize",16),_defineProperty$3(this,"sampleRate",0),_defineProperty$3(this,"channelCount",0),_defineProperty$3(this,"objectType",0),_defineProperty$3(this,"sampleRateIndex",0),_defineProperty$3(this,"config",[]),_defineProperty$3(this,"present",!1),_defineProperty$3(this,"isVideoEncryption",!1),_defineProperty$3(this,"isAudioEncryption",!1),_defineProperty$3(this,"kid",null),_defineProperty$3(this,"ext",void 0)}return _createClass$3(e,[{key:"reset",value:function(){this.sequenceNumber=0,this.timescale=0,this.sampleDuration=0,this.sampleRate=0,this.channelCount=0,this.baseMediaDecodeTime=0,this.present=!1,this.pid=-1,this.codec="",this.samples=[],this.config=[],this.warnings=[]}},{key:"exist",value:function(){return!!(this.sampleRate&&this.channelCount&&this.codec&&this.codecType===AudioCodecType.AAC)}},{key:"hasSample",value:function(){return!!this.samples.length}},{key:"isEncryption",get:function(){return this.isAudioEncryption}}]),e}(),VideoSample=function(){function e(t,r,n){_classCallCheck$3(this,e),_defineProperty$3(this,"flag",{}),_defineProperty$3(this,"keyframe",!1),_defineProperty$3(this,"gopId",0),_defineProperty$3(this,"duration",0),_defineProperty$3(this,"size",0),_defineProperty$3(this,"units",[]),_defineProperty$3(this,"chromaFormat",420),this.originPts=this.pts=t,this.originDts=this.dts=r,n&&(this.units=n)}return _createClass$3(e,[{key:"cts",get:function(){return this.pts-this.dts}},{key:"setToKeyframe",value:function(){this.keyframe=!0,this.flag.dependsOn=2,this.flag.isNonSyncSample=0}}]),e}(),AudioSample=_createClass$3((function e(t,r,n,i){_classCallCheck$3(this,e),_defineProperty$3(this,"duration",1024),_defineProperty$3(this,"flag",{dependsOn:2,isNonSyncSample:0}),_defineProperty$3(this,"keyframe",!0),this.originPts=this.pts=this.dts=t,this.data=r,this.size=r.byteLength,this.sampleOffset=i,n&&(this.duration=n)})),Sample=_createClass$3((function e(t,r){_classCallCheck$3(this,e),_defineProperty$3(this,"time",0),this.data=t,this.originPts=this.pts=r})),SeiSample=function(e){_inherits$2(r,Sample);var t=_createSuper$2(r);function r(){return _classCallCheck$3(this,r),t.apply(this,arguments)}return _createClass$3(r)}(),MetadataTrack=function(){function e(){_classCallCheck$3(this,e),_defineProperty$3(this,"id",3),_defineProperty$3(this,"type",TrackType$1.METADATA),_defineProperty$3(this,"timescale",0),_defineProperty$3(this,"flvScriptSamples",[]),_defineProperty$3(this,"seiSamples",[])}return _createClass$3(e,[{key:"exist",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length||!this.timescale)}},{key:"reset",value:function(){this.timescale=0,this.flvScriptSamples=[],this.seiSamples=[]}},{key:"hasSample",value:function(){return!(!this.flvScriptSamples.length&&!this.seiSamples.length)}}]),e}(),Logger$3=function(){function e(t){_classCallCheck$3(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return _createClass$3(e,[{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();_defineProperty$3(Logger$3,"disabled",!0);var isBrowser$1="undefined"!=typeof window,ua=isBrowser$1&&navigator.userAgent.toLocaleLowerCase(),isSafari=isBrowser$1&&/^((?!chrome|android).)*safari/.test(ua),isFirefox=isBrowser$1&&ua.includes("firefox"),isAndroid=isBrowser$1&&ua.includes("android"),AAC=function(){function e(){_classCallCheck$3(this,e)}return _createClass$3(e,null,[{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}},{key:"parseADTS",value:function(t,r){for(var n=t.length,i=0;i+2<n&&(255!==t[i]||240!=(246&t[i+1]));)i++;if(!(i>=n)){var a=i,o=[],s=(60&t[i+2])>>>2,u=e.FREQ[s];if(!u)throw new Error("Invalid sampling index: ".concat(s));for(var c,l,d=1+((192&t[i+2])>>>6),h=(1&t[i+2])<<2|(192&t[i+3])>>>6,f=e._getConfig(s,h,d),p=f.config,m=f.codec,y=0,g=e.getFrameDuration(u);i+7<n;)if(255===t[i]&&240==(246&t[i+1])){if(n-i<(l=(3&t[i+3])<<11|t[i+4]<<3|(224&t[i+5])>>5))break;c=2*(1&~t[i+1]),o.push({pts:r+y*g,data:t.subarray(i+7+c,i+l)}),y++,i+=l}else i++;return{skip:a,remaining:i>=n?void 0:t.subarray(i),frames:o,samplingFrequencyIndex:s,sampleRate:u,objectType:d,channelCount:h,codec:m,config:p,originCodec:"mp4a.40.".concat(d)}}}},{key:"parseAudioSpecificConfig",value:function(t){if(t.length){var r=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,i=(120&t[1])>>>3,a=e.FREQ[n];if(a){var o=e._getConfig(n,i,r);return{samplingFrequencyIndex:n,sampleRate:a,objectType:r,channelCount:i,config:o.config,codec:o.codec,originCodec:"mp4a.40.".concat(r)}}}}},{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"_getConfig",value:function(e,t,r){var n,i,a=[];return isFirefox?e>=6?(n=5,i=e-3):(n=2,i=e):isAndroid?(n=2,i=e):(n=2===r||5===r?r:5,i=e,e>=6?i=e-3:1===t&&(n=2,i=e)),a[0]=n<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=t<<3,5===n&&(a[1]|=(14&i)>>1,a[2]=(1&i)<<7,a[2]|=8,a[3]=0),{config:a,codec:"mp4a.40.".concat(n)}}},{key:"getSilentFrame",value:function(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])}}}]),e}();function concatUint8Array$1(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t.filter(Boolean);var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}_defineProperty$3(AAC,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var MAX_SIZE=Math.pow(2,32);function readBig16(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function readBig24(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}function readBig32(e){var 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 readBig64(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return readBig32(e,t)*MAX_SIZE+readBig32(e,t+4)}function getAvcCodec(e){for(var t,r="avc1.",n=0;n<3;n++)(t=e[n].toString(16)).length<2&&(t="0".concat(t)),r+=t;return r}function parse$1(e){if(!Array.isArray(e)){for(var t=[],r="",n=0;n<e.length;n++)n%2&&(r=e[n-1]+e[n],t.push(parseInt(r,16)),r="");return t}return e.map((function(e){return parseInt(e,16)}))}var NALu=function(){function e(){_classCallCheck$3(this,e)}return _createClass$3(e,null,[{key:"parseAnnexB",value:function(e){for(var t=e.length,r=2,n=0;null!==e[r]&&void 0!==e[r]&&1!==e[r];)r++;if((n=++r+2)>=t)return[];for(var i=[];n<t;)switch(e[n]){case 0:if(0!==e[n-1]){n+=2;break}if(0!==e[n-2]){n++;break}r!==n-2&&i.push(e.subarray(r,n-2));do{n++}while(1!==e[n]&&n<t);n=(r=n+1)+2;break;case 1:if(0!==e[n-1]||0!==e[n-2]){n+=3;break}r!==n-2&&i.push(e.subarray(r,n-2)),n=(r=n+1)+2;break;default:n+=3}return r<t&&i.push(e.subarray(r)),i}},{key:"parseAvcC",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var r,n=e.length,i=[],a=0;a+t<n;)if(r=readBig32(e,a),3===t&&(r>>>=8),a+=t,r){if(a+r>n)break;i.push(e.subarray(a,a+r)),a+=r}return i}}},{key:"parseSEI",value:function(e,t){for(var r=e.length,n=t?2:1,i=0,a=0,o="";255===e[n];)i+=255,n++;for(i+=e[n++];255===e[n];)a+=255,n++;if(a+=e[n++],5===i&&r>n+16)for(var s=0;s<16;s++)o+=e[n].toString(16),n++;return{payload:e.subarray(n),type:i,size:a,uuid:o}}},{key:"removeEPB",value:function(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(!r.length)return e;var i=t-r.length,a=new Uint8Array(i),o=0;for(n=0;n<i;o++,n++)o===r[0]&&(o++,r.shift()),a[n]=e[o];return a}}]),e}(),ExpGolomb=function(){function e(t){if(_classCallCheck$3(this,e),_defineProperty$3(this,"_bytesAvailable",void 0),_defineProperty$3(this,"_bitsAvailable",0),_defineProperty$3(this,"_word",0),!t)throw new Error("ExpGolomb data params is required");this._data=t,this._bytesAvailable=t.byteLength,this._bytesAvailable&&this._loadWord()}return _createClass$3(e,[{key:"_loadWord",value:function(){var e=this._data.byteLength-this._bytesAvailable,t=Math.min(4,this._bytesAvailable);if(0===t)throw new Error("No bytes available");var r=new Uint8Array(4);r.set(this._data.subarray(e,e+t)),this._word=new DataView(r.buffer).getUint32(0),this._bitsAvailable=8*t,this._bytesAvailable-=t}},{key:"skipBits",value:function(e){if(this._bitsAvailable>e)this._word<<=e,this._bitsAvailable-=e;else{e-=this._bitsAvailable;var t=Math.floor(e/8);e-=8*t,this._bytesAvailable-=t,this._loadWord(),this._word<<=e,this._bitsAvailable-=e}}},{key:"readBits",value:function(e){if(e>32)throw new Error("Cannot read more than 32 bits");var t=Math.min(this._bitsAvailable,e),r=this._word>>>32-t;return this._bitsAvailable-=t,this._bitsAvailable>0?this._word<<=t:this._bytesAvailable>0&&this._loadWord(),(t=e-t)>0&&this._bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this._bitsAvailable;++e)if(0!=(this._word&2147483648>>>e))return this._word<<=e,this._bitsAvailable-=e,e;return this._loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r}}]),e}(),AVC=function(){function e(){_classCallCheck$3(this,e)}return _createClass$3(e,null,[{key:"parseAVCDecoderConfigurationRecord",value:function(t){if(!(t.length<7)){for(var r,n,i=1+(3&t[4]),a=[],o=[],s=6,u=31&t[5],c=0;c<u;c++)if(n=t[s]<<8|t[s+1],s+=2,n){var l=t.subarray(s,s+n);s+=n,a.push(l),r||(r=e.parseSPS(NALu.removeEPB(l)))}var d,h=t[s];s++;for(var f=0;f<h;f++)d=t[s]<<8|t[s+1],s+=2,d&&(o.push(t.subarray(s,s+d)),s+=d);return{sps:r,spsArr:a,ppsArr:o,nalUnitSize:i}}}},{key:"parseSPS",value:function(e){var t=new ExpGolomb(e);t.readUByte();var r=t.readUByte(),n=t.readUByte(),i=t.readUByte();t.skipUEG();var a=420;if(100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r){var o=t.readUEG();if(o<=3&&(a=[0,420,422,444][o]),3===o&&t.skipBits(1),t.skipUEG(),t.skipUEG(),t.skipBits(1),t.readBool())for(var s=3!==o?8:12,u=0;u<s;u++)t.readBool()&&(u<6?t.skipScalingList(16):t.skipScalingList(64))}t.skipUEG();var c=t.readUEG();if(0===c)t.readUEG();else if(1===c){t.skipBits(1),t.skipUEG(),t.skipUEG();for(var l=t.readUEG(),d=0;d<l;d++)t.skipUEG()}t.skipUEG(),t.skipBits(1);var h=t.readUEG(),f=t.readUEG(),p=t.readBits(1);0===p&&t.skipBits(1),t.skipBits(1);var m,y,g,v,b,_=0,A=0,T=0,E=0;if(t.readBool()&&(_=t.readUEG(),A=t.readUEG(),T=t.readUEG(),E=t.readUEG()),t.readBool()){if(t.readBool())switch(t.readUByte()){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:m=[t.readUByte()<<8|t.readUByte(),t.readUByte()<<8|t.readUByte()]}if(t.readBool()&&t.readBool(),t.readBool()&&(t.readBits(4),t.readBool()&&t.readBits(24)),t.readBool()&&(t.readUEG(),t.readUEG()),t.readBool()){var S=t.readBits(32),$=t.readBits(32);y=t.readBool(),b=(g=$)/(v=2*S)}}return{codec:getAvcCodec(e.subarray(1,4)),profileIdc:r,profileCompatibility:n,levelIdc:i,chromaFormat:a,width:Math.ceil(16*(h+1)-2*(_+A)),height:(2-p)*(f+1)*16-(p?2:4)*(T+E),sarRatio:m,fpsNum:g,fpsDen:v,fps:b,fixedFrame:y}}}]),e}(),HEVC=function(){function e(){_classCallCheck$3(this,e)}return _createClass$3(e,null,[{key:"parseHEVCDecoderConfigurationRecord",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(t.length<23)){r=r||{};for(var n,i,a,o,s,u=1+(3&t[21]),c=[],l=[],d=[],h=23,f=t[22],p=0;p<f;p++){a=63&t[h],o=t[h+1]<<8|t[h+2],h+=3;for(var m=0;m<o;m++)if(s=t[h]<<8|t[h+1],h+=2,s){switch(a){case 32:var y=t.subarray(h,h+s);n||(n=e.parseVPS(NALu.removeEPB(y),r)),d.push(y);break;case 33:var g=t.subarray(h,h+s);i||(i=e.parseSPS(NALu.removeEPB(g),r)),c.push(g);break;case 34:l.push(t.subarray(h,h+s))}h+=s}}return{hvcC:r,sps:i,spsArr:c,ppsArr:l,vpsArr:d,nalUnitSize:u}}}},{key:"parseVPS",value:function(t,r){r=r||{};var n=new ExpGolomb(t);n.readUByte(),n.readUByte(),n.readBits(12);var i=n.readBits(3);return r.numTemporalLayers=Math.max(r.numTemporalLayers||0,i+1),n.readBits(17),e._parseProfileTierLevel(n,i,r),r}},{key:"parseSPS",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r=r||{};var n=new ExpGolomb(t);n.readUByte(),n.readUByte(),n.readBits(4);var i=n.readBits(3);r.numTemporalLayers=Math.max(i+1,r.numTemporalLayers||0),r.temporalIdNested=n.readBits(1),e._parseProfileTierLevel(n,i,r),n.readUEG();var a=r.chromaFormatIdc=n.readUEG(),o=420;a<=3&&(o=[0,420,422,444][a]);var s=0;3===a&&(s=n.readBits(1));var u,c,l,d,h=n.readUEG(),f=n.readUEG(),p=n.readBits(1);(1===p&&(u=n.readUEG(),c=n.readUEG(),l=n.readUEG(),d=n.readUEG()),r.bitDepthLumaMinus8=n.readUEG(),r.bitDepthChromaMinus8=n.readUEG(),1===p)&&(h-=(1!==a&&2!==a||0!==s?1:2)*(c+u),f-=(1===a&&0===s?2:1)*(d+l));return{codec:"hev1.1.6.L93.B0",width:h,height:f,chromaFormat:o,hvcC:r}}},{key:"_parseProfileTierLevel",value:function(e,t,r){var n=r.generalTierFlag||0;r.generalProfileSpace=e.readBits(2),r.generalTierFlag=Math.max(e.readBits(1),n),r.generalProfileIdc=Math.max(e.readBits(5),r.generalProfileIdc||0),r.generalProfileCompatibilityFlags=e.readBits(32),r.generalConstraintIndicatorFlags=[e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8),e.readBits(8)];var i=e.readBits(8);n<r.generalTierFlag?r.generalLevelIdc=i:r.generalLevelIdc=Math.max(i,r.generalLevelIdc||0);for(var a=[],o=[],s=0;s<t;s++)a[s]=e.readBits(1),o[s]=e.readBits(1);t>0&&e.readBits(2*(8-t));for(var u=0;u<t;u++)0!==a[u]&&(e.readBits(2),e.readBits(1),e.readBits(5),e.readBits(16),e.readBits(16),e.readBits(4),e.readBits(16),e.readBits(16),e.readBits(12)),0!==o[u]&&e.readBits(8)}}]),e}(),LARGE_AV_FIRST_FRAME_GAP=45e3,AUDIO_GAP_OVERLAP_THRESHOLD_COUNT=3,MAX_SILENT_FRAME_DURATION=9e4,AUDIO_EXCETION_LOG_EMIT_DURATION=45e4,MAX_VIDEO_FRAME_DURATION=9e4,MAX_DTS_DELTA_WITH_NEXT_CHUNK=45e3,TsFixer=function(){function e(t,r,n){_classCallCheck$3(this,e),this.videoTrack=t,this.audioTrack=r,this.metadataTrack=n,this._baseDts=-1,this._baseDtsInited=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0}return _createClass$3(e,[{key:"fix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=Math.round(9e4*t);var i=this.videoTrack,a=this.audioTrack,o=i.samples,s=a.samples;if(o.length||s.length){var u=o[0],c=s[0],l=0;if(o.length&&s.length&&(l=u.dts-c.pts),this._baseDtsInited||this._calculateBaseDts(this.audioTrack,this.videoTrack),r&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t),!n){this._videoNextDts=l>0?t+l:t,this._audioNextPts=l>0?t:t-l;var d=u?u.dts-this._baseDts-this._videoNextDts:0,h=c?c.pts-this._baseDts-this._audioNextPts:0;Math.abs(d||h)>MAX_VIDEO_FRAME_DURATION&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t)}if(this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(a),this._fixVideo(i),this.metadataTrack.exist()){var f=this.metadataTrack.timescale;this.metadataTrack.seiSamples.forEach((function(t){t.pts=t.originPts-e._baseDts,t.time=Math.max(0,t.pts)/f}))}i.samples.length&&(i.baseMediaDecodeTime=i.samples[0].dts),a.samples.length&&(a.baseMediaDecodeTime=a.samples[0].pts*a.timescale/9e4)}}},{key:"_fixVideo",value:function(e){var t=this,r=e.samples;if(r.length){if(r.forEach((function(e){e.dts-=t._baseDts,e.pts-=t._baseDts})),void 0===this._videoNextDts){var n=r[0];this._videoNextDts=n.dts}var i,a,o=r.length,s=0,u=r[0],c=r[1],l=this._videoNextDts-u.dts;if(Math.abs(l)>MAX_DTS_DELTA_WITH_NEXT_CHUNK)u.dts+=l,u.pts+=l,e.warnings.push({type:WarningType.LARGE_VIDEO_GAP_BETWEEN_CHUNK,nextDts:this._videoNextDts,firstSampleDts:u.dts,nextSampleDts:null===(i=r[1])||void 0===i?void 0:i.dts,sampleDuration:l}),c&&Math.abs(c.dts-u.dts)>MAX_VIDEO_FRAME_DURATION&&(this._videoTimestampBreak=!0,r.forEach((function(e,t){0!==t&&(e.dts+=l,e.pts+=l)})));if(e.fpsNum&&e.fpsDen)a=e.timescale*(e.fpsDen/e.fpsNum);else{var d=e.samples[0],h=e.samples[o-1];a=1===o?9e3:Math.floor((h.dts-d.dts)/(o-1))}for(var f=0;f<o;f++){var p=r[f].dts,m=r[f+1];if((s=f<o-1?m.dts-p:r[f-1]?Math.min(p-r[f-1].dts,a):a)>MAX_VIDEO_FRAME_DURATION||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?a:Math.max(s,2700);var y=this._audioNextPts||0;m&&m.dts>y&&(s=a),e.warnings.push({type:WarningType.LARGE_VIDEO_GAP,time:p/e.timescale,dts:p,originDts:r[f].originDts,nextDts:this._videoNextDts,sampleDuration:s,refSampleDuration:a})}r[f].duration=s,this._videoNextDts+=s}}}},{key:"_fixAudio",value:function(e){var t=this,r=e.samples;r.length&&(r.forEach((function(e){e.pts-=t._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,r,9e4))}},{key:"_calculateBaseDts",value:function(e,t){var r=e.samples,n=t.samples;if(!r.length&&!n.length)return!1;var i=1/0,a=1/0;r.length&&(e.baseDts=i=r[0].pts),n.length&&(t.baseDts=a=n[0].dts),this._baseDts=Math.min(i,a);var o=a-i;return Number.isFinite(o)&&Math.abs(o)>LARGE_AV_FIRST_FRAME_GAP&&t.warnings.push({type:WarningType.LARGE_AV_SHIFT,videoBaseDts:a,audioBasePts:i,baseDts:this._baseDts,delta:o}),this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){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}}},{key:"_doFixAudioInternal",value:function(e,t,r){e.sampleDuration||(e.sampleDuration=AAC.getFrameDuration(e.timescale,r));var n=e.sampleDuration;if(void 0===this._audioNextPts){var i=t[0];this._audioNextPts=i.pts}for(var a=0;a<t.length;a++){var o=this._audioNextPts,s=t[a],u=s.pts-o;if(!this._audioTimestampBreak&&u>=AUDIO_GAP_OVERLAP_THRESHOLD_COUNT*n&&u<=MAX_SILENT_FRAME_DURATION&&!isSafari){var c=AAC.getSilentFrame(e.codec,e.channelCount)||t[0].data.subarray(),l=Math.floor(u/n);Math.abs(s.pts-this._lastAudioExceptionGapDot)>AUDIO_EXCETION_LOG_EMIT_DURATION&&(this._lastAudioExceptionGapDot=s.pts),e.warnings.push({type:WarningType.AUDIO_FILLED,pts:s.pts,originPts:s.originPts,count:l,nextPts:o,refSampleDuration:n});for(var d=0;d<l;d++){var h=new AudioSample(Math.floor(o),c);h.originPts=Math.floor(this._baseDts+o),t.splice(a,0,h),this._audioNextPts+=n,a++}a--}else u<=-AUDIO_GAP_OVERLAP_THRESHOLD_COUNT*n&&u>=-1*MAX_SILENT_FRAME_DURATION?(Math.abs(s.pts-this._lastAudioExceptionOverlapDot)>AUDIO_EXCETION_LOG_EMIT_DURATION&&(this._lastAudioExceptionOverlapDot=s.pts,e.warnings.push({type:WarningType.AUDIO_DROPPED,pts:s.pts,originPts:s.originPts,nextPts:o,refSampleDuration:n})),t.splice(a,1),a--):(Math.abs(u)>=MAX_SILENT_FRAME_DURATION&&(this._audioTimestampBreak=!0,Math.abs(s.pts-this._lastAudioExceptionLargeGapDot)>AUDIO_EXCETION_LOG_EMIT_DURATION&&(this._lastAudioExceptionLargeGapDot=s.pts,e.warnings.push({type:WarningType.LARGE_AUDIO_GAP,time:s.pts/1e3,pts:s.pts,originPts:s.originPts,nextPts:o,sampleDuration:u,refSampleDuration:n}))),s.dts=s.pts=o,this._audioNextPts+=n)}}}]),e}(),logger$4=new Logger$3("TsDemuxer"),TsDemuxer=function(){function e(t,r,n){_classCallCheck$3(this,e),_defineProperty$3(this,"_pmtId",-1),_defineProperty$3(this,"_remainingPacketData",null),_defineProperty$3(this,"_videoPesData",[]),_defineProperty$3(this,"_audioPesData",[]),_defineProperty$3(this,"_gopId",0),this.videoTrack=t||new VideoTrack,this.audioTrack=r||new AudioTrack,this.metadataTrack=n||new MetadataTrack,this._fixer=new TsFixer(this.videoTrack,this.audioTrack,this.metadataTrack)}return _createClass$3(e,[{key:"demux",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=this.audioTrack,i=this.videoTrack,a=this.metadataTrack;t&&(this._pmtId=-1,i.reset(),n.reset(),a.reset()),!r||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(i.samples=[],n.samples=[],a.seiSamples=[],i.warnings=[],n.warnings=[],this._remainingPacketData&&(e=concatUint8Array$1(this._remainingPacketData,e),this._remainingPacketData=null));var o=e.length,s=o%188;s&&(this._remainingPacketData=e.subarray(o-s),o-=s);for(var u=i.pid,c=n.pid,l=0;l<o;l+=188){if(71!==e[l])throw new Error("TS packet did not start with 0x47");var d=!!(64&e[l+1]),h=((31&e[l+1])<<8)+e[l+2],f=void 0;if((48&e[l+3])>>4>1){if((f=l+5+e[l+4])===l+188)continue}else f=l+4;switch(h){case 0:d&&(f+=e[f]+1),this._pmtId=(31&e[f+10])<<8|e[f+11];break;case this._pmtId:d&&(f+=e[f]+1);var p=f+3+((15&e[f+1])<<8|e[f+2])-4;for(f+=12+((15&e[f+10])<<8|e[f+11]);f<p;){var m=(31&e[f+1])<<8|e[f+2];switch(e[f]){case 15:n.pid=c=m;break;case 27:if(-1!==u)break;i.codecType=VideoCodecType$1.AVC,i.pid=u=m;break;case 36:if(-1!==u)break;i.codecType=VideoCodecType$1.HEVC,i.pid=u=m;break;default:logger$4.warn("Unsupported stream. type: ".concat(e[f],", pid: ").concat(m))}f+=5+((15&e[f+3])<<8|e[f+4])}break;case u:d&&this._videoPesData.length&&this._parseVideoData(),this._videoPesData.push(e.subarray(f,l+188));break;case c:d&&this._audioPesData.length&&this._parseAudioData(),this._audioPesData.push(e.subarray(f,l+188));break;case 17:case 8191:break;default:logger$4.warn("Unknown pid: ".concat(h))}}return this._parseVideoData(),this._parseAudioData(),n.formatTimescale=i.formatTimescale=i.timescale=a.timescale=9e4,n.timescale=n.sampleRate||0,{videoTrack:i,audioTrack:n,metadataTrack:a}}},{key:"fix",value:function(e,t,r){return this._fixer.fix(e,t,r),{videoTrack:this.videoTrack,audioTrack:this.audioTrack,metadataTrack:this.metadataTrack}}},{key:"demuxAndFix",value:function(e,t,r,n){return this.demux(e,t,r),this.fix(n,t,r)}},{key:"_parseVideoData",value:function(){if(this._videoPesData.length){var t=e._parsePES(concatUint8Array$1.apply(void 0,_toConsumableArray$2(this._videoPesData)));if(t){var r=NALu.parseAnnexB(t.data);r?this._createVideoSample(r,t.pts,t.dts):logger$4.warn("Cannot parse avc units",t),this._videoPesData=[]}else logger$4.warn("Cannot parse video pes",this._videoPesData)}}},{key:"_createVideoSample",value:function(e,t,r){var n=this;if(e.length){var i=this.videoTrack,a=i.codecType===VideoCodecType$1.HEVC,o=new VideoSample(t,r);e.forEach((function(e){var r=a?e[0]>>>1&63:31&e[0];switch(r){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!a&&5!==r||a&&5===r)break;o.setToKeyframe(),n._gopId++;break;case 6:case 39:case 40:if(!a&&6!==r||a&&6===r)break;return void n.metadataTrack.seiSamples.push(new SeiSample(NALu.parseSEI(NALu.removeEPB(e),a),t));case 32:if(!a)break;if(!i.vps.length){var s=HEVC.parseVPS(NALu.removeEPB(e),i.hvcC);i.hvcC=i.hvcC||s,i.vps=[e]}break;case 7:case 33:if(!a&&7!==r||a&&7===r)break;if(!i.sps.length){var u=NALu.removeEPB(e),c=a?HEVC.parseSPS(u,i.hvcC):AVC.parseSPS(u);i.sps=[e],i.hvcC=i.hvcC||c.hvcC,i.codec=c.codec,i.width=c.width,i.height=c.height,i.sarRatio=c.sarRatio,i.fpsNum=c.fpsNum,i.fpsDen=c.fpsDen}break;case 8:case 34:if(!a&&8!==r||a&&8===r)break;i.pps.length||(i.pps=[e])}o.units.push(e)})),o.gopId=this._gopId,this._pushVideoSample(i,o)}}},{key:"_pushVideoSample",value:function(e,t){if(t.units.length)if(null===t.pts||void 0===t.pts){logger$4.warn("Video sample no pts",t);var r=e.samples[e.samples.length-1];r?(t.pts=r.pts,t.dts=r.dts):logger$4.warn("Drop video sample",t)}else e.samples.push(t)}},{key:"_parseAudioData",value:function(){if(this._audioPesData.length){var t=e._parsePES(concatUint8Array$1.apply(void 0,_toConsumableArray$2(this._audioPesData)));t?(this._parseAacData(t),this._audioPesData=[]):logger$4.warn("Cannot parse audio pes",this._audioPesData)}}},{key:"_parseAacData",value:function(e){var t=this.audioTrack,r=e.pts;if(null==r){if(logger$4.warn("AAC pes not pts",t),!t.samples.length||!t.sampleRate)return;r=t.samples[t.samples.length-1].pts+AAC.getFrameDuration(t.sampleRate)}var n,i=AAC.parseADTS(e.data,r);i?(t.codec=i.codec,t.channelCount=i.channelCount,t.sampleRate=i.sampleRate,t.objectType=i.objectType,t.sampleRateIndex=i.samplingFrequencyIndex,t.config=i.config,(n=t.samples).push.apply(n,_toConsumableArray$2(i.frames.map((function(e){return new AudioSample(e.pts,e.data)})))),i.skip&&logger$4.warn("Skip aac adts ".concat(i.skip," bits")),i.remaining&&logger$4.warn("Remaining aac adts ".concat(i.remaining," bits"))):logger$4.warn("Cannot parse aac adts",e)}}],[{key:"probe",value:function(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}},{key:"_parsePES",value:function(e){var t=e[8];if(!(null==t||e.length<t+9)&&1===(e[0]<<16|e[1]<<8|e[2])){var r=(e[4]<<8)+e[5];if(!(r&&r>e.length-6)){var n,i,a=e[7];return 192&a&&(n=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&a?n-(i=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(n=i):i=n),{data:e.subarray(9+t),pts:n,dts:i}}}}}]),e}(),MP4Parser=function(){function e(){_classCallCheck$3(this,e)}return _createClass$3(e,null,[{key:"findBox",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[];if(!t)return i;for(var a=0,o="",s=0;t.length>7;){if(a=readBig32(t),o=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===a?(a=readBig64(t,8),s+=8):a||(a=t.length),!r[0]||o===r[0]){var u=t.subarray(0,a);if(!(r.length<2))return e.findBox(u.subarray(s),r.slice(1),n+s);i.push({start:n,size:a,headerSize:s,type:o,data:u})}n+=a,t=t.subarray(a)}return i}},{key:"tfhd",value:function(e){return parseBox(e,!0,(function(e,t){e.trackId=readBig32(t);var r=4,n=1&e.flags,i=2&e.flags,a=8&e.flags,o=16&e.flags,s=32&e.flags;n&&(r+=4,e.baseDataOffset=readBig32(t,r),r+=4),i&&(e.sampleDescriptionIndex=readBig32(t,r),r+=4),a&&(e.defaultSampleDuration=readBig32(t,r),r+=4),o&&(e.defaultSampleSize=readBig32(t,r),r+=4),s&&(e.defaultSampleFlags=readBig32(t,r))}))}},{key:"sidx",value:function(e){return parseBox(e,!0,(function(e,t){var r=0;e.reference_ID=readBig32(t,r),r+=4,e.timescale=readBig32(t,r),r+=4,0===e.version?(e.earliest_presentation_time=readBig32(t,r),r+=4,e.first_offset=readBig32(t,r),r+=4):(e.earliest_presentation_time=readBig64(t,r),r+=8,e.first_offset=readBig64(t,r),r+=8),r+=2,e.references=[];var n=readBig16(t,r);r+=2;for(var i=0;i<n;i++){var a={};e.references.push(a);var o=readBig32(t,r);r+=4,a.reference_type=o>>31&1,a.referenced_size=2147483647&o,a.subsegment_duration=readBig32(t,r),o=readBig32(t,r+=4),r+=4,a.starts_with_SAP=o>>31&1,a.SAP_type=o>>28&7,a.SAP_delta_time=268435455&o}}))}},{key:"moov",value:function(t){return parseBox(t,!1,(function(t,r,n){t.mvhd=e.mvhd(e.findBox(r,["mvhd"],n)[0]),t.trak=e.findBox(r,["trak"],n).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(r,["pssh"],n)[0])}))}},{key:"mvhd",value:function(e){return parseBox(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=readBig32(t,16),e.duration=readBig64(t,20),r+=28):(e.timescale=readBig32(t,8),e.duration=readBig32(t,12),r+=16),e.nextTrackId=readBig32(t,r+76)}))}},{key:"trak",value:function(t){return parseBox(t,!1,(function(t,r,n){t.tkhd=e.tkhd(e.findBox(r,["tkhd"],n)[0]),t.mdia=e.mdia(e.findBox(r,["mdia"],n)[0])}))}},{key:"tkhd",value:function(e){return parseBox(e,!0,(function(e,t){var r=0;1===e.version?(e.trackId=readBig32(t,16),e.duration=readBig64(t,24),r+=32):(e.trackId=readBig32(t,8),e.duration=readBig32(t,16),r+=20),e.width=readBig32(t,r+52),e.height=readBig32(t,r+56)}))}},{key:"mdia",value:function(t){return parseBox(t,!1,(function(t,r,n){t.mdhd=e.mdhd(e.findBox(r,["mdhd"],n)[0]),t.hdlr=e.hdlr(e.findBox(r,["hdlr"],n)[0]),t.minf=e.minf(e.findBox(r,["minf"],n)[0])}))}},{key:"mdhd",value:function(e){return parseBox(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=readBig32(t,16),e.duration=readBig64(t,20),r+=28):(e.timescale=readBig32(t,8),e.duration=readBig32(t,12),r+=16);var n=readBig16(t,r);e.language=String.fromCharCode(96+(n>>10&31),96+(n>>5&31),96+(31&n))}))}},{key:"hdlr",value:function(e){return parseBox(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return parseBox(t,!1,(function(t,r,n){t.vmhd=e.vmhd(e.findBox(r,["vmhd"],n)[0]),t.smhd=e.smhd(e.findBox(r,["smhd"],n)[0]),t.stbl=e.stbl(e.findBox(r,["stbl"],n)[0])}))}},{key:"vmhd",value:function(e){return parseBox(e,!0,(function(e,t){e.graphicsmode=readBig16(t),e.opcolor=[readBig16(t,2),readBig16(t,4),readBig16(t,6)]}))}},{key:"smhd",value:function(e){return parseBox(e,!0,(function(e,t){e.balance=readBig16(t)}))}},{key:"stbl",value:function(t){return parseBox(t,!1,(function(t,r,n){var i,a,o;t.stsd=e.stsd(e.findBox(r,["stsd"],n)[0]),t.stts=e.stts(e.findBox(r,["stts"],n)[0]),t.ctts=e.ctts(e.findBox(r,["ctts"],n)[0]),t.stsc=e.stsc(e.findBox(r,["stsc"],n)[0]),t.stsz=e.stsz(e.findBox(r,["stsz"],n)[0]),t.stco=e.stco(e.findBox(r,["stco"],n)[0]),t.stco||(t.co64=e.co64(e.findBox(r,["co64"],n)[0]),t.stco=t.co64);var s=null===(i=t.stsd.entries[0])||void 0===i||null===(a=i.sinf)||void 0===a||null===(o=a.schi)||void 0===o?void 0:o.tenc.default_IV_size;t.stss=e.stss(e.findBox(r,["stss"],n)[0]),t.senc=e.senc(e.findBox(r,["senc"],n)[0],s)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return parseBox(e,!0,(function(e,r){var n=0,i=readBig32(r,n);n+=4,e.samples=[];for(var a=0;a<i;a++){for(var o={InitializationVector:[]},s=0;s<t;s++)o.InitializationVector[s]=r[n+s];if(n+=t,2&e.flags){o.subsamples=[];var u=readBig16(r,n);n+=2;for(var c=0;c<u;c++){var l={};l.BytesOfClearData=readBig16(r,n),n+=2,l.BytesOfProtectedData=readBig32(r,n),n+=4,o.subsamples.push(l)}}e.samples.push(o)}}))}},{key:"pssh",value:function(e){return parseBox(e,!0,(function(e,t){for(var r=[],n=[],i=0,a=0;a<16;a++)n.push(toHex(t[i+a]));if(i+=16,e.version>0){var o=readBig32(t,i);i+=4;for(var s=0;s<(""+o).length;s++)for(var u=0;u<16;u++){var c=t[i];i+=1,r.push(toHex(c))}}var l=readBig32(t,i);e.data_size=l,i+=4,e.kid=r,e.system_id=n,e.buffer=t}))}},{key:"stsd",value:function(t){return parseBox(t,!0,(function(t,r,n){t.entryCount=readBig32(r),t.entries=e.findBox(r.subarray(4),[],n+4).map((function(t){switch(t.type){case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return parseBox(t,!1,(function(t,r,n){t.channelCount=readBig16(r,16),t.samplesize=readBig16(r,18),t.sampleRate=readBig32(r,24)/65536,r=r.subarray(28),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.esds=e.esds(e.findBox(r,["esds"],n)[0])}));case"encv":return parseBox(t,!1,(function(t,r,n){t.width=readBig16(r,24),t.height=readBig16(r,26),t.horizresolution=readBig32(r,28),t.vertresolution=readBig32(r,32),r=r.subarray(78),t.sinf=e.sinf(e.findBox(r,["sinf"],n)[0]),t.avcC=e.avcC(e.findBox(r,["avcC"],n)[0]),t.hvcC=e.hvcC(e.findBox(r,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(r,["pasp"],n)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return parseBox(e,!1,(function(e,t){var r=6;e.default_IsEncrypted=t[r],r+=1,e.default_IV_size=t[r],r+=1,e.default_KID=[];for(var n=0;n<16;n++)e.default_KID.push(toHex(t[r])),r+=1}))}},{key:"schi",value:function(t){return parseBox(t,!1,(function(t,r,n){t.tenc=e.tenc(e.findBox(r,["tenc"],n)[0])}))}},{key:"sinf",value:function(t){return parseBox(t,!1,(function(t,r,n){t.schi=e.schi(e.findBox(r,["schi"],n)[0]),t.frma=e.frma(e.findBox(r,["frma"],n)[0])}))}},{key:"frma",value:function(e){return parseBox(e,!1,(function(e,t){e.data_format="";for(var r=0;r<4;r++)e.data_format+=String.fromCharCode(t[r])}))}},{key:"avc1",value:function(t){return parseBox(t,!1,(function(t,r,n){var i=parseVisualSampleEntry(t,r),a=r.subarray(i);n+=i,t.avcC=e.avcC(e.findBox(a,["avcC"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])}))}},{key:"avcC",value:function(e){return parseBox(e,!1,(function(e,t){e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=getAvcCodec([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];for(var r=6,n=0;n<e.spsLength;n++){var i=readBig16(t,r);r+=2,e.sps.push(t.subarray(r,r+i)),r+=i}e.ppsLength=t[r],r+=1,e.pps=[];for(var a=0;a<e.ppsLength;a++){var o=readBig16(t,r);r+=2,e.pps.push(t.subarray(r,r+=o)),r+=o}}))}},{key:"hvc1",value:function(t){return parseBox(t,!1,(function(t,r,n){var i=parseVisualSampleEntry(t,r),a=r.subarray(i);n+=i,t.hvcC=e.hvcC(e.findBox(a,["hvcC"],n)[0]),t.pasp=e.pasp(e.findBox(a,["pasp"],n)[0])}))}},{key:"hvcC",value:function(e){return parseBox(e,!1,(function(t,r){t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=r[0];var n=r[1];t.generalProfileSpace=n>>6,t.generalTierFlag=(32&n)>>5,t.generalProfileIdc=31&n,t.generalProfileCompatibility=readBig32(r,2),t.generalConstraintIndicatorFlags=r.subarray(6,12),t.generalLevelIdc=r[12],t.avgFrameRate=readBig16(r,19),t.numOfArrays=r[22],t.vps=[],t.sps=[],t.pps=[];for(var i=23,a=0,o=0,s=0,u=0;u<t.numOfArrays;u++){a=63&r[i],o=readBig16(r,i+1),i+=3;for(var c,l=[],d=0;d<o;d++)s=readBig16(r,i),i+=2,l.push(r.subarray(i,i+s)),i+=s;if(32===a)(c=t.vps).push.apply(c,l);else if(33===a){var h;(h=t.sps).push.apply(h,l)}else if(34===a){var f;(f=t.pps).push.apply(f,l)}}}))}},{key:"pasp",value:function(e){return parseBox(e,!1,(function(e,t){e.hSpacing=readBig32(t),e.vSpacing=readBig32(t,4)}))}},{key:"mp4a",value:function(t){return parseBox(t,!1,(function(t,r,n){var i=parseAudioSampleEntry(t,r);t.esds=e.esds(e.findBox(r.subarray(i),["esds"],n+i)[0])}))}},{key:"esds",value:function(e){return parseBox(e,!0,(function(e,t){e.codec="mp4a.";for(var r=0,n=0,i=0,a=0;t.length;){for(a=t[r=0],n=t[r+1],r+=2;128&n;)i=(127&n)<<7,n=t[r],r+=1;if(i+=127&n,3===a)t=t.subarray(r+3);else{if(4!==a){if(5===a){var o=e.config=t.subarray(r,r+i),s=(248&o[0])>>3;return 31===s&&o.length>=2&&(s=32+((7&o[0])<<3)+((224&o[1])>>5)),e.objectType=s,e.codec+=s.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[r].toString(16)+".").padStart(3,"0"),t=t.subarray(r+13)}}}))}},{key:"alaw",value:function(e){return parseBox(e,!1,(function(e,t){parseAudioSampleEntry(e,t)}))}},{key:"stts",value:function(e){return parseBox(e,!0,(function(e,t){for(var r=readBig32(t),n=[],i=4,a=0;a<r;a++)n.push({count:readBig32(t,i),delta:readBig32(t,i+4)}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"ctts",value:function(e){return parseBox(e,!0,(function(e,t){var r=readBig32(t),n=[],i=4;if(1===e.version)for(var a=0;a<r;a++)n.push({count:readBig32(t,i),offset:readBig32(t,i+4)}),i+=8;else for(var o=0;o<r;o++)n.push({count:readBig32(t,i),offset:-(1+~readBig32(t,i+4))}),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stsc",value:function(e){return parseBox(e,!0,(function(e,t){for(var r=readBig32(t),n=[],i=4,a=0;a<r;a++)n.push({firstChunk:readBig32(t,i),samplesPerChunk:readBig32(t,i+4),sampleDescriptionIndex:readBig32(t,i+8)}),i+=12;e.entryCount=r,e.entries=n}))}},{key:"stsz",value:function(e){return parseBox(e,!0,(function(e,t){var r=readBig32(t),n=readBig32(t,4),i=[];if(!r)for(var a=8,o=0;o<n;o++)i.push(readBig32(t,a)),a+=4;e.sampleSize=r,e.sampleCount=n,e.entrySizes=i}))}},{key:"stco",value:function(e){return parseBox(e,!0,(function(e,t){for(var r=readBig32(t),n=[],i=4,a=0;a<r;a++)n.push(readBig32(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"co64",value:function(e){return parseBox(e,!0,(function(e,t){for(var r=readBig32(t),n=[],i=4,a=0;a<r;a++)n.push(readBig64(t,i)),i+=8;e.entryCount=r,e.entries=n}))}},{key:"stss",value:function(e){return parseBox(e,!0,(function(e,t){for(var r=readBig32(t),n=[],i=4,a=0;a<r;a++)n.push(readBig32(t,i)),i+=4;e.entryCount=r,e.entries=n}))}},{key:"moof",value:function(t){return parseBox(t,!1,(function(t,r,n){t.mfhd=e.mfhd(e.findBox(r,["mfhd"],n)[0]),t.traf=e.findBox(r,["traf"],n).map((function(t){return e.traf(t)}))}))}},{key:"mfhd",value:function(e){return parseBox(e,!0,(function(e,t){e.sequenceNumber=readBig32(t)}))}},{key:"traf",value:function(t){return parseBox(t,!1,(function(t,r,n){t.tfhd=e.tfhd(e.findBox(r,["tfhd"],n)[0]),t.tfdt=e.tfdt(e.findBox(r,["tfdt"],n)[0]),t.trun=e.trun(e.findBox(r,["trun"],n)[0])}))}},{key:"trun",value:function(e){return parseBox(e,!0,(function(e,t){var r=e.version,n=e.flags,i=t.length,a=e.sampleCount=readBig32(t),o=4;if(i>o&&1&n&&(e.dataOffset=-(1+~readBig32(t,o)),o+=4),i>o&&4&n&&(e.firstSampleFlags=readBig32(t,o),o+=4),e.samples=[],i>o)for(var s,u=0;u<a;u++)s={},256&n&&(s.duration=readBig32(t,o),o+=4),512&n&&(s.size=readBig32(t,o),o+=4),1024&n&&(s.flags=readBig32(t,o),o+=4),2048&n&&(s.cts=r?-(1+~readBig32(t,o+4)):readBig32(t,o),o+=4),e.samples.push(s)}))}},{key:"tfdt",value:function(e){return parseBox(e,!0,(function(e,t){1===e.version?e.baseMediaDecodeTime=readBig64(t):e.baseMediaDecodeTime=readBig32(t)}))}},{key:"probe",value:function(t){return!!e.findBox(t,["ftyp"])}},{key:"parseSampleFlags",value:function(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]}}},{key:"moovToTrack",value:function(e,t,r){var n,i,a=e.trak;if(a&&a.length){var o=a.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),s=a.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(o&&t){var u,c,l,d,h,f,p,m=t,y=null===(u=o.tkhd)||void 0===u?void 0:u.trackId;null!=y&&(m.id=o.tkhd.trackId),m.tkhdDuration=o.tkhd.duration,m.mvhdDurtion=e.mvhd.duration,m.mvhdTimecale=e.mvhd.timescale,m.timescale=m.formatTimescale=o.mdia.mdhd.timescale,m.duration=o.mdia.mdhd.duration||m.mvhdDurtion/m.mvhdTimecale*m.timescale;var g,v,b,_,A,T,E,S,$=o.mdia.minf.stbl.stsd.entries[0];if(m.width=$.width,m.height=$.height,$.pasp&&(m.sarRatio=[$.pasp.hSpacing,$.pasp.vSpacing]),$.hvcC)m.codecType=VideoCodecType$1.HEVC,m.codec=$.hvcC.codec,m.vps=$.hvcC.vps,m.sps=$.hvcC.sps,m.pps=$.hvcC.pps,m.hvcC=$.hvcC.data;else{if(!$.avcC)throw new Error("unknown video stsd entry");m.codec=$.avcC.codec,m.sps=$.avcC.sps,m.pps=$.avcC.pps}if(m.present=!0,m.ext={},m.ext.stss=null===(c=o.mdia)||void 0===c||null===(l=c.minf)||void 0===l||null===(d=l.stbl)||void 0===d?void 0:d.stss,m.ext.ctts=null===(h=o.mdia)||void 0===h||null===(f=h.minf)||void 0===f||null===(p=f.stbl)||void 0===p?void 0:p.ctts,$&&"encv"===$.type)m.isVideoEncryption=!0,$.default_KID=null===(g=$.sinf)||void 0===g||null===(v=g.schi)||void 0===v?void 0:v.tenc.default_KID,$.default_IsEncrypted=null===(b=$.sinf)||void 0===b||null===(_=b.schi)||void 0===_?void 0:_.tenc.default_IsEncrypted,$.default_IV_size=null===(A=$.sinf)||void 0===A||null===(T=A.schi)||void 0===T?void 0:T.tenc.default_IV_size,m.videoSenc=o.mdia.minf.stbl.senc&&o.mdia.minf.stbl.senc.samples,$.data_format=null===(E=$.sinf)||void 0===E||null===(S=E.frma)||void 0===S?void 0:S.data_format,m.useEME=e.useEME,m.kidValue=e.kidValue,m.pssh=e.pssh,m.encv=$}if(s&&r){var I,w,R,k,P,C,x,L,O,D=r,M=null===(I=s.tkhd)||void 0===I?void 0:I.trackId;null!=M&&(D.id=s.tkhd.trackId),D.tkhdDuration=s.tkhd.duration,D.mvhdDurtion=e.mvhd.duration,D.mvhdTimecale=e.mvhd.timescale,D.timescale=D.formatTimescale=s.mdia.mdhd.timescale,D.duration=s.mdia.mdhd.duration||D.mvhdDurtion/D.mvhdTimecale*D.timescale;var Z,V,N,G,X,W,U,F,B=s.mdia.minf.stbl.stsd.entries[0];switch(D.sampleSize=B.sampleSize,D.sampleRate=B.sampleRate,D.channelCount=B.channelCount,D.present=!0,B.type){case"alaw":D.codecType=D.codec=AudioCodecType.G711PCMA,D.sampleRate=8e3;break;case"ulaw":D.codecType=D.codec=AudioCodecType.G711PCMU,D.sampleRate=8e3;break;default:D.sampleDuration=AAC.getFrameDuration(D.sampleRate,D.timescale),D.sampleRateIndex=AAC.getRateIndexByRate(D.sampleRate),D.objectType=(null===(n=B.esds)||void 0===n?void 0:n.objectType)||2,B.esds&&(D.config=Array.from(B.esds.config)),D.codec=(null===(i=B.esds)||void 0===i?void 0:i.codec)||"mp4a.40.2"}if(D.sampleDuration=AAC.getFrameDuration(D.sampleRate,D.timescale),D.objectType=(null===(w=B.esds)||void 0===w?void 0:w.objectType)||2,B.esds&&(B.esds.config?D.config=Array.from(B.esds.config):console.warn("esds config is null")),D.codec=(null===(R=B.esds)||void 0===R?void 0:R.codec)||"mp4a.40.2",D.sampleRateIndex=AAC.getRateIndexByRate(D.sampleRate),D.ext={},D.ext.stss=null===(k=s.mdia)||void 0===k||null===(P=k.minf)||void 0===P||null===(C=P.stbl)||void 0===C?void 0:C.stss,D.ext.ctts=null===(x=s.mdia)||void 0===x||null===(L=x.minf)||void 0===L||null===(O=L.stbl)||void 0===O?void 0:O.ctts,D.present=!0,B&&"enca"===B.type)D.isAudioEncryption=!0,B.data_format=null===(Z=B.sinf)||void 0===Z||null===(V=Z.frma)||void 0===V?void 0:V.data_format,B.default_KID=null===(N=B.sinf)||void 0===N||null===(G=N.schi)||void 0===G?void 0:G.tenc.default_KID,B.default_IsEncrypted=null===(X=B.sinf)||void 0===X||null===(W=X.schi)||void 0===W?void 0:W.tenc.default_IsEncrypted,B.default_IV_size=null===(U=B.sinf)||void 0===U||null===(F=U.schi)||void 0===F?void 0:F.tenc.default_IV_size,D.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,D.useEME=e.useEME,D.kidValue=e.kidValue,D.enca=B}if(r&&(r.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!r&&r.isAudioEncryption),null!=t&&t.encv||null!=r&&r.enca){var Y,j,K=null==t||null===(Y=t.encv)||void 0===Y?void 0:Y.default_KID,H=null==r||null===(j=r.enca)||void 0===j?void 0:j.default_KID,z=K||H?(K||H).join(""):null;t&&(t.kid=z),r&&(r.kid=z)}return t&&(t.flags=3841),r&&(r.flags=1793),{videoTrack:t,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,r){var n,i=null==t||null===(n=t.samples)||void 0===n?void 0:n.length;return i?1024*i/t.timescale*e.timescale/r:1024}},{key:"moofToSamples",value:function(t,r,n){var i={};return t.mfhd&&(r&&(r.sequenceNumber=t.mfhd.sequenceNumber),n&&(n.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var a=t.tfhd,o=t.tfdt,s=t.trun;if(a&&s){o&&(r&&r.id===a.trackId&&(r.baseMediaDecodeTime=o.baseMediaDecodeTime),n&&n.id===a.trackId&&(n.baseMediaDecodeTime=o.baseMediaDecodeTime));var u=a.defaultSampleSize||0,c=a.defaultSampleDuration||e.evaluateDefaultDuration(r,n,s.samples.length||s.sampleCount),l=s.dataOffset||0,d=0,h=-1;if(!s.samples.length&&s.sampleCount){i[a.trackId]=[];for(var f=0;f<s.sampleCount;f++)i[a.trackId].push({offset:l,dts:d,duration:c,size:u}),d+=c,l+=u}else i[a.trackId]=s.samples.map((function(e,t){return(e={offset:l,dts:d,pts:d+(e.cts||0),duration:e.duration||c,size:e.size||u,gopId:h,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(h++,e.gopId=h),d+=e.duration,l+=e.size,e}))}})),i}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var r=t.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),n=t.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(r||n){var i,a;if(r){var o,s,u=null===(o=r.mdia)||void 0===o||null===(s=o.minf)||void 0===s?void 0:s.stbl;if(!u)return;var c=u.stts,l=u.stsc,d=u.stsz,h=u.stco,f=u.stss,p=u.ctts;if(!(c&&l&&d&&h&&f))return;i=getSamples(c,l,d,h,p,f)}if(n){var m,y,g,v=null===(m=n.mdia)||void 0===m||null===(y=m.minf)||void 0===y?void 0:y.stbl;if(!v)return;var b=null===(g=n.mdia.mdhd)||void 0===g?void 0:g.timescale,_=v.stts,A=v.stsc,T=v.stsz,E=v.stco;if(!(b&&_&&A&&T&&E))return;a=getSamples(_,A,T,E)}return{videoSamples:i,audioSamples:a}}}}}]),e}();function getSamples(e,t,r,n,i,a){var o,s,u,c=[],l=null==i?void 0:i.entries,d=t.entries,h=n.entries,f=r.entrySizes,p=null==a?void 0:a.entries;p&&(o={},p.forEach((function(e){o[e-1]=!0}))),l&&(s=[],l.forEach((function(e){for(var t=e.count,r=e.offset,n=0;n<t;n++)s.push(r)})));var m=-1,y=0,g=0,v=0,b=0,_=0,A=d[0].samplesPerChunk,T=d[1]?d[1].firstChunk-1:1/0;return e.entries.forEach((function(e){for(var t=e.count,n=e.delta,i=0;i<t;i++)u={dts:y,duration:n,size:f[g]||r.sampleSize,offset:h[v]+_,index:g},p&&(u.keyframe=o[g],u.keyframe&&m++,u.gopId=m),s&&g<s.length&&(u.pts=u.dts+s[g]),c.push(u),y+=n,++g<A?_+=u.size:(v++,_=0,v>=T&&(b++,T=d[b+1]?d[b+1].firstChunk-1:1/0),A+=d[b].samplesPerChunk)})),c}function parseVisualSampleEntry(e,t){return e.dataReferenceIndex=readBig16(t,6),e.width=readBig16(t,24),e.height=readBig16(t,26),e.horizresolution=readBig32(t,28),e.vertresolution=readBig32(t,32),e.frameCount=readBig16(t,40),e.depth=readBig16(t,74),78}function parseAudioSampleEntry(e,t){return e.dataReferenceIndex=readBig16(t,6),e.channelCount=readBig16(t,16),e.sampleSize=readBig16(t,18),e.sampleRate=readBig32(t,24)/65536,28}function parseBox(e,t,r){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var n={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(n.version=e.data[e.headerSize],n.flags=readBig24(e.data,e.headerSize+1),n.headerSize+=4),r(n,e.data.subarray(n.headerSize),n.start+n.headerSize),n}}var padStart3=function(e,t,r){for(var n=String(r),i=t>>0,a=Math.ceil(i/n.length),o=[],s=String(e);a--;)o.push(n);return o.join("").substring(0,i-s.length)+s},toHex=function(){for(var e=[],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return r.forEach((function(t){e.push(padStart3(Number(t).toString(16),2,0))})),e[0]},FMP4Demuxer=function(){function e(t,r,n){_classCallCheck$3(this,e),this.videoTrack=t||new VideoTrack,this.audioTrack=r||new AudioTrack,this.metadataTrack=n||new MetadataTrack}return _createClass$3(e,[{key:"demux",value:function(e,t){var r=this.videoTrack,n=this.audioTrack,i=r.exist(),a=n.exist();if(r.samples=[],n.samples=[],t){if(!a){var o=MP4Parser.findBox(t,["moov"])[0];if(!o)throw new Error("cannot found moov box");MP4Parser.moovToTrack(MP4Parser.moov(o),null,n)}var s=MP4Parser.findBox(t,["moof"])[0];if(s){var u=MP4Parser.moofToSamples(MP4Parser.moof(s),null,n)[n.id],c=n.baseMediaDecodeTime;if(u){var l=s.start;u.map((function(e){e.offset+=l;var r=t.subarray(e.offset,e.offset+e.size);n.samples.push(new AudioSample(e.dts+c,r,e.duration))}))}}}if(e){if(!i&&!a){var d=MP4Parser.findBox(e,["moov"])[0];if(!d)throw new Error("cannot found moov box");MP4Parser.moovToTrack(MP4Parser.moov(d),r,n)}var h=MP4Parser.findBox(e,["moof"])[0];if(h){var f,p=MP4Parser.moofToSamples(MP4Parser.moof(h),r,n),m=r.baseMediaDecodeTime,y=n.baseMediaDecodeTime,g=h.start;Object.keys(p).forEach((function(t){r.id==t?p[t].map((function(t){t.offset+=g;var n=new VideoSample((t.pts||t.dts)+m,t.dts+m);n.duration=t.duration,n.gopId=t.gopId,t.keyframe&&n.setToKeyframe();var i=e.subarray(t.offset,t.offset+t.size);n.data=i;for(var a=0,o=i.length-1;a<o;)f=readBig32(i,a),a+=4,n.units.push(i.subarray(a,a+f)),a+=f;r.samples.push(n)})):n.id==t&&p[t].map((function(t){t.offset+=g;var r=e.subarray(t.offset,t.offset+t.size);n.samples.push(new AudioSample(t.dts+y,r,t.duration))}))}))}}return{videoTrack:r,audioTrack:n,metadataTrack:this.metadataTrack}}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset(),this.metadataTrack.reset()}}],[{key:"probe",value:function(e){return MP4Parser.probe(e)}}]),e}();function Concat$1(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.forEach((function(e){t+=e.length}));var a=new e(t),o=0;return n.forEach((function(e){a.set(e,o),o+=e.length})),a}var Buffer$2=function(){function e(){_classCallCheck$3(this,e),this.buffer=new Uint8Array(0)}return _createClass$3(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach((function(t){t?e.buffer=Concat$1(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),UINT32_MAX$1=Math.pow(2,32)-1,MP4$1=function(){function e(){_classCallCheck$3(this,e)}return _createClass$3(e,null,[{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=8+(r=r.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return r.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===TrackType$1.VIDEO&&e.codecType===VideoCodecType$1.HEVC}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return concatUint8Array$1(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var r=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],parse$1(t.kid),[0,0,0,0]));return e.box(e.types.pssh,r)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var r=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(_toConsumableArray$2(t.map((function(t){return e.trak(t)}))),[r]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(_toConsumableArray$2(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.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,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,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===TrackType$1.VIDEO?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var r=[];return t&&t.ext&&t.ext.stss&&r.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,r[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var r;return r="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r)}},{key:"enca",value:function(t){var r=t.enca.channelCount,n=t.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,n>>8&255,255&n,0,0]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var r,n,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=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,o>>8&255,255&o,s>>8&255,255&s,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]),d=new Uint8Array((r=(n=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(n,_toConsumableArray$2(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(r,_toConsumableArray$2(a))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),f=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,d),e.box(e.types.btrt,h),f,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var r=new Uint8Array([]),n=e.tenc(t);return e.box(e.types.schi,r,n)}},{key:"tenc",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(parse$1(t.default_KID)));return e.box(e.types.tenc,r)}},{key:"sinf",value:function(t){var r=new Uint8Array([]),n=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),a=e.schi(t);return e.box(e.types.sinf,r,e.box(e.types.frma,n),e.box(e.types.schm,i),a)}},{key:"avc1hev1",value:function(t){var r=t.codecType===VideoCodecType$1.HEVC,n=r?e.types.hvc1:e.types.avc1,i=r?e.hvcC(t):e.avcC(t),a=[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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,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,17,17]),i];return r?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[n].concat(a))}},{key:"avcC",value:function(t){var r,n,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,_toConsumableArray$2(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,_toConsumableArray$2(e))})),e.box(e.types.avcC,new Uint8Array((r=(n=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(n,a).concat([t.pps.length])).concat.apply(r,o)))}},{key:"hvcC",value:function(t){var r=t.hvcC;if(r instanceof ArrayBuffer||r instanceof Uint8Array)return r;var n,i=t.vps,a=t.sps,o=t.pps;if(r){var s=r.generalProfileCompatibilityFlags,u=r.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.length&&1);n=[1,r.generalProfileSpace<<6|r.generalTierFlag<<5|r.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],r.generalLevelIdc,240,0,252,252|r.chromaFormatIdc,248|r.bitDepthLumaMinus8,248|r.bitDepthChromaMinus8,0,0,r.numTemporalLayers<<3|r.temporalIdNested<<2|3,c];var l=function(e){var t;n.push(e.length>>8,e.length),(t=n).push.apply(t,_toConsumableArray$2(e))};i.length&&(n.push(160,0,i.length),i.forEach(l)),a.length&&(n.push(161,0,a.length),a.forEach(l)),o.length&&(n.push(162,0,o.length),o.forEach(l))}else n=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(n))}},{key:"pasp",value:function(t){var r=_slicedToArray$2(t,2),n=r[0],i=r[1];return e.box(e.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var r=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+r,0,0,0,4,15+r,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([r]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(_toConsumableArray$2(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.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]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(_toConsumableArray$2(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var r=e.tfhd(t.id),n=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var a=e.saiz(t),o=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,r,n,a,o,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),l=e.saiz(t),d=e.saio(t),h=e.senc(t),f=e.trun1(t);return e.box(e.types.traf,r,n,c,l,d,h,f)}var p=e.sbgp(),m=e.trun1(t);return e.box(e.types.traf,r,n,p,m)}if(t.isVideo){var y=e.trun1(t);return e.box(e.types.traf,r,n,y)}var g=e.sbgp(),v=e.saiz(t),b=e.saio(t),_=e.senc(t),A=e.trun1(t);return e.box(e.types.traf,r,n,g,v,b,_,A)}var T=e.sdtp(t);return e.box(e.types.traf,r,n,T,e.trun(t.samples,T.byteLength+76))}},{key:"sdtp",value:function(t){var r=new Buffer$2;return t.samples.forEach((function(e){r.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),r.buffer)}},{key:"trun1",value:function(t){var r=new Buffer$2,n=Buffer$2.writeUint32(t.samples.length),i=null;if(t.isVideo){var a=t.videoSencLength;i=Buffer$2.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=Buffer$2.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=Buffer$2.writeUint32(o)}return t.samples.forEach((function(e){r.write(Buffer$2.writeUint32(e.duration)),r.write(Buffer$2.writeUint32(e.size)),r.write(Buffer$2.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&r.write(Buffer$2.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),n,i,r.buffer)}},{key:"senc",value:function(t){var r=new Buffer$2,n=t.samples.length,i=t.isVideo?16:8,a=t.isVideo?2:0,o=[],s=0;return t.isVideo?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*n,r.write(Buffer$2.writeUint32(16+s),e.types.senc,this.extension(0,a)),r.write(Buffer$2.writeUint32(n)),o.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)r.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(r.write(Buffer$2.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){r.write(Buffer$2.writeUint16(e.BytesOfClearData)),r.write(Buffer$2.writeUint32(e.BytesOfProtectedData))})))})),r.buffer}},{key:"saio",value:function(t){var r=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(r=149);var n=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saio,n)}},{key:"saiz",value:function(t){var r=t.samples.length,n=new Uint8Array([0,0,0,0,16,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saiz,n)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,r){var n=Math.floor(r/(UINT32_MAX$1+1)),i=Math.floor(r%(UINT32_MAX$1+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,r){var n=t.length,i=12+16*n;r+=8+i;var a=new Uint8Array(i);a.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var o=0;o<n;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;a.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|(null===d.dependsOn||void 0===d.dependsOn?1:d.dependsOn),d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|(null===d.isNonSyncSample||void 0===d.isNonSyncSample?1:d.isNonSyncSample),61440&d.degradationPriority,15&d.degradationPriority,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(_toConsumableArray$2(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===TrackType$1.VIDEO?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var r=t.ext,n=[e.stsd(t),e.stts(r.stts),e.stsc(r.stsc),e.stsz(r.stsz),e.stco(r.stco)];return r.stss.length&&n.push(e.stss(r.stss)),r.ctts.length&&n.push(e.ctts(r.ctts)),e.box.apply(e,[e.types.stbl].concat(n))}},{key:"stts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,concatUint8Array$1(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsc",value:function(t){var r=t.length,n=new Uint8Array(12*r),i=0;return t.forEach((function(e){var t=e.firstChunk,r=e.samplesPerChunk,a=e.sampleDescIndex;n.set([t>>24,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,concatUint8Array$1(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsz",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,concatUint8Array$1(new Uint8Array([0,0,0,0,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stco",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,concatUint8Array$1(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stss",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,concatUint8Array$1(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"ctts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,concatUint8Array$1(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var r=t.timescale,n=t.samples[0].duration,i=n*t.samples.length,a=t.samples[0].sampleOffset*n,o=8;t.samples.forEach((function(e){o+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,r>>24&255,r>>16&255,r>>8&255,255&r,a>>24&255,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();_defineProperty$3(MP4$1,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),_defineProperty$3(MP4$1,"HDLR_TYPES",{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]),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])}),_defineProperty$3(MP4$1,"FTYPAVC1",MP4$1.box(MP4$1.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),_defineProperty$3(MP4$1,"FTYPHEV1",MP4$1.box(MP4$1.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),_defineProperty$3(MP4$1,"DINF",MP4$1.box(MP4$1.types.dinf,MP4$1.box(MP4$1.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),_defineProperty$3(MP4$1,"VMHD",MP4$1.box(MP4$1.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),_defineProperty$3(MP4$1,"SMHD",MP4$1.box(MP4$1.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),_defineProperty$3(MP4$1,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),_defineProperty$3(MP4$1,"STTS",MP4$1.box(MP4$1.types.stts,MP4$1.StblTable)),_defineProperty$3(MP4$1,"STSC",MP4$1.box(MP4$1.types.stsc,MP4$1.StblTable)),_defineProperty$3(MP4$1,"STSZ",MP4$1.box(MP4$1.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),_defineProperty$3(MP4$1,"STCO",MP4$1.box(MP4$1.types.stco,MP4$1.StblTable));var Logger$2=function(){function e(t,r){_classCallCheck$3(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=r}return _createClass$3(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();_defineProperty$3(Logger$2,"disabled",!0);var FMP4Remuxer$1=function(){function e(t,r,n){_classCallCheck$3(this,e),this.videoTrack=t,this.audioTrack=r;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new Logger$2("FMP4Remuxer",!n||!n.openLog||!n.openLog)}return _createClass$3(e,[{key:"remux",value:function(){var e,t,r,n,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return a&&(o&&o.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),r=MP4$1.initSegment(d)):(c&&(e=MP4$1.initSegment([this.videoTrack])),l&&(t=MP4$1.initSegment([this.audioTrack])))),c&&s.hasSample()&&(n=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:r,videoInitSegment:e,audioInitSegment:t,videoSegment:n,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,r=0;t.forEach((function(e){r+=e.units.reduce((function(e,t){return e+t.byteLength}),0),r+=4*e.units.length}));for(var n,i=new Uint8Array(r),a=new DataView(i.buffer),o=function(e,r,o,s){s=t[e];var u=0;s.units.forEach((function(e){a.setUint32(o,e.byteLength),o+=4,i.set(e,o),o+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=o,n=s},s=0,u=t.length,c=0;s<u;s++)o(s,0,c,n);var l=MP4$1.mdat(i);return concatUint8Array$1(MP4$1.moof([e]),l)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,r){return t.set(r.data,e),e+r.size}),0);var r=MP4$1.mdat(t);return concatUint8Array$1(MP4$1.moof([e]),r)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),defineProperty5=objectDefineProperty.f,proxyAccessor$1=function(e,t,r){r in e||defineProperty5(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},DESCRIPTORS$1=descriptors,global$1=global$M,uncurryThis=functionUncurryThis,isForced=isForced_1,inheritIfRequired=inheritIfRequired$4,createNonEnumerableProperty=createNonEnumerableProperty$a,getOwnPropertyNames$1=objectGetOwnPropertyNames.f,isPrototypeOf=objectIsPrototypeOf,isRegExp=isRegexp,toString5=toString$l,getRegExpFlags=regexpGetFlags,stickyHelpers=regexpStickyHelpers,proxyAccessor=proxyAccessor$1,defineBuiltIn=defineBuiltIn$j,fails$1=fails$V,hasOwn2=hasOwnProperty_1,enforceInternalState=internalState.enforce,setSpecies=setSpecies$5,wellKnownSymbol=wellKnownSymbol$u,UNSUPPORTED_DOT_ALL=regexpUnsupportedDotAll,UNSUPPORTED_NCG=regexpUnsupportedNcg,MATCH=wellKnownSymbol("match"),NativeRegExp=global$1.RegExp,RegExpPrototype$1=NativeRegExp.prototype,SyntaxError=global$1.SyntaxError,exec=uncurryThis(RegExpPrototype$1.exec),charAt=uncurryThis("".charAt),replace=uncurryThis("".replace),stringIndexOf=uncurryThis("".indexOf),stringSlice=uncurryThis("".slice),IS_NCG=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,re1=/a/g,re2=/a/g,CORRECT_NEW=new NativeRegExp(re1)!==re1,MISSED_STICKY$1=stickyHelpers.MISSED_STICKY,UNSUPPORTED_Y=stickyHelpers.UNSUPPORTED_Y,BASE_FORCED=DESCRIPTORS$1&&(!CORRECT_NEW||MISSED_STICKY$1||UNSUPPORTED_DOT_ALL||UNSUPPORTED_NCG||fails$1((function(){return re2[MATCH]=!1,NativeRegExp(re1)!=re1||NativeRegExp(re2)==re2||"/a/i"!=NativeRegExp(re1,"i")}))),handleDotAll=function(e){for(var t,r=e.length,n=0,i="",a=!1;n<=r;n++)"\\"!==(t=charAt(e,n))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),i+=t):i+="[\\s\\S]":i+=t+charAt(e,++n);return i},handleNCG=function(e){for(var t,r=e.length,n=0,i="",a=[],o={},s=!1,u=!1,c=0,l="";n<=r;n++){if("\\"===(t=charAt(e,n)))t+=charAt(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:exec(IS_NCG,stringSlice(e,n+1))&&(n+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===l||hasOwn2(o,l))throw new SyntaxError("Invalid capture group name");o[l]=!0,a[a.length]=[l,c],u=!1,l="";continue}u?l+=t:i+=t}return[i,a]};if(isForced("RegExp",BASE_FORCED)){for(var RegExpWrapper=function(e,t){var r,n,i,a,o,s,u=isPrototypeOf(RegExpPrototype$1,this),c=isRegExp(e),l=void 0===t,d=[],h=e;if(!u&&c&&l&&e.constructor===RegExpWrapper)return e;if((c||isPrototypeOf(RegExpPrototype$1,e))&&(e=e.source,l&&(t=getRegExpFlags(h))),e=void 0===e?"":toString5(e),t=void 0===t?"":toString5(t),h=e,UNSUPPORTED_DOT_ALL&&"dotAll"in re1&&(n=!!t&&stringIndexOf(t,"s")>-1)&&(t=replace(t,/s/g,"")),r=t,MISSED_STICKY$1&&"sticky"in re1&&(i=!!t&&stringIndexOf(t,"y")>-1)&&UNSUPPORTED_Y&&(t=replace(t,/y/g,"")),UNSUPPORTED_NCG&&(e=(a=handleNCG(e))[0],d=a[1]),o=inheritIfRequired(NativeRegExp(e,t),u?this:RegExpPrototype$1,RegExpWrapper),(n||i||d.length)&&(s=enforceInternalState(o),n&&(s.dotAll=!0,s.raw=RegExpWrapper(handleDotAll(e),r)),i&&(s.sticky=!0),d.length&&(s.groups=d)),e!==h)try{createNonEnumerableProperty(o,"source",""===h?"(?:)":h)}catch(e){}return o},keys5=getOwnPropertyNames$1(NativeRegExp),index=0;keys5.length>index;)proxyAccessor(RegExpWrapper,NativeRegExp,keys5[index++]);RegExpPrototype$1.constructor=RegExpWrapper,RegExpWrapper.prototype=RegExpPrototype$1,defineBuiltIn(global$1,"RegExp",RegExpWrapper,{constructor:!0})}setSpecies("RegExp");var DESCRIPTORS=descriptors,MISSED_STICKY=regexpStickyHelpers.MISSED_STICKY,classof=classofRaw$2,defineBuiltInAccessor=defineBuiltInAccessor$3,getInternalState=internalState.get,RegExpPrototype=RegExp.prototype,$TypeError=TypeError;DESCRIPTORS&&MISSED_STICKY&&defineBuiltInAccessor(RegExpPrototype,"sticky",{configurable:!0,get:function(){if(this!==RegExpPrototype){if("RegExp"===classof(this))return!!getInternalState(this).sticky;throw $TypeError("Incompatible receiver, RegExp required")}}});var Decryptor=function(){function e(){_classCallCheck$4(this,e);var t=window.crypto||window.msCrypto;this.subtle=t&&(t.subtle||t.webkitSubtle),this.externalDecryptor=null}var t,r;return _createClass$4(e,[{key:"decrypt",value:function(e,t){if(e||t){var r=[];return e&&(r[0]=this._decryptSegment(e)),t&&(r[1]=this._decryptSegment(t)),Promise.all(r)}}},{key:"_decryptSegment",value:(r=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){var r;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.data,!t.key){e.next=5;break}return e.next=4,this._decryptData(t.data,t.key,t.keyIv);case 4:r=e.sent;case 5:if(t.map){e.next=7;break}return e.abrupt("return",r);case 7:return e.abrupt("return",concatUint8Array$5(t.map,r));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_decryptData",value:(t=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t,r,n){var i;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.externalDecryptor){e.next=6;break}return e.next=3,this.externalDecryptor.decrypt(t,r,n);case 3:return e.abrupt("return",e.sent);case 6:if(this.subtle){e.next=8;break}throw new Error("crypto is not defined");case 8:return e.next=10,this.subtle.importKey("raw",r,{name:"AES-CBC"},!1,["encrypt","decrypt"]);case 10:return i=e.sent,e.t0=Uint8Array,e.next=14,this.subtle.decrypt({name:"AES-CBC",iv:n},i,t);case 14:return e.t1=e.sent,e.abrupt("return",new e.t0(e.t1));case 16:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})}]),e}(),Event$1=_objectSpread2$1(_objectSpread2$1({},EVENT$2),{},{STREAM_PARSED:"core.streamparsed",NO_AUDIO_TRACK:"core.noaudiotrack",SUBTITLE_SEGMENTS:"core.subtitlesegments",SUBTITLE_PLAYLIST:"core.subtitleplaylist",SEI_PAYLOAD_TIME:"core.seipayloadtime"}),logger$3=new Logger$9("Transmuxer"),Transmuxer=function(){function e(t,r,n){_classCallCheck$4(this,e),_defineProperty$4(this,"_initSegmentId",""),this.hls=t,this._demuxer=r?new FMP4Demuxer:new TsDemuxer,this._isMP4=r,n&&(this._remuxer=new FMP4Remuxer$1(this._demuxer.videoTrack,this._demuxer.audioTrack))}return _createClass$4(e,[{key:"transmux",value:function(e,t,r,n,i,a){var o=this._demuxer;try{this._isMP4?o.demux(e,t):o.demuxAndFix(concatUint8Array$5(e,t),r,n,i)}catch(e){throw new StreamingError$2(ERR$2.DEMUX,ERR$2.SUB_TYPES.HLS,e)}var s=o.videoTrack,u=o.audioTrack,c=o.metadataTrack,l="".concat(s.codec,"/").concat(s.width,"/").concat(s.height,"/").concat(u.codec,"/").concat(u.config);if(l!==this._initSegmentId&&(this._initSegmentId=l,a=!0),this._fireEvents(s,u,c,r||a),this.hls.emit(Event$1.DEMUXED_TRACK,s),!this._remuxer)return[s,u];try{var d=this._remuxer.remux(a),h=d.videoInitSegment,f=d.videoSegment,p=d.audioInitSegment,m=d.audioSegment,y=concatUint8Array$5(h,f),g=concatUint8Array$5(p,m);return[y?{codec:s.codec,data:y}:void 0,g?{codec:u.codec,data:g}:void 0]}catch(e){throw new StreamingError$2(ERR$2.REMUX,ERR$2.SUB_TYPES.FMP4,e)}}},{key:"_fireEvents",value:function(e,t,r,n){var i=this;logger$3.debug(e.samples,t.samples),n&&(e.exist()&&this.hls.emit(Event$1.METADATA_PARSED,{type:"video",track:e,meta:{codec:e.codec,timescale:e.timescale,width:e.width,height:e.height,sarRatio:e.sarRatio,baseDts:e.baseDts}}),t.exist()&&this.hls.emit(Event$1.METADATA_PARSED,{type:"audio",track:t,meta:{codec:t.codec,channelCount:t.channelCount,sampleRate:t.sampleRate,timescale:t.timescale,baseDts:t.baseDts}}),logger$3.debug("discontinuity",e,t)),e.warnings.forEach((function(e){var t;switch(e.type){case WarningType.LARGE_AV_SHIFT:t=Event$1.LARGE_AV_FIRST_FRAME_GAP_DETECT;break;case WarningType.LARGE_VIDEO_GAP:t=Event$1.LARGE_VIDEO_DTS_GAP_DETECT;break;case WarningType.LARGE_VIDEO_GAP_BETWEEN_CHUNK:t=Event$1.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT}t&&i.hls.emit(Event$1.STREAM_EXCEPTION,_objectSpread2$1(_objectSpread2$1({},e),{},{type:t})),logger$3.warn("video exception",e)})),t.warnings.forEach((function(e){var t;switch(e.type){case WarningType.LARGE_AUDIO_GAP:t=Event$1.LARGE_AUDIO_DTS_GAP_DETECT;break;case WarningType.AUDIO_FILLED:t=Event$1.AUDIO_GAP_DETECT;break;case WarningType.AUDIO_DROPPED:t=Event$1.AUDIO_OVERLAP_DETECT}t&&i.hls.emit(Event$1.STREAM_EXCEPTION,_objectSpread2$1(_objectSpread2$1({},e),{},{type:t})),logger$3.warn("audio exception",e)})),e.samples.forEach((function(e){e.keyframe&&i.hls.emit(Event$1.KEYFRAME,{pts:e.pts})})),r.seiSamples.forEach((function(e){i.hls.emit(Event$1.SEI,_objectSpread2$1(_objectSpread2$1({},e),{},{originPts:e.originPts/90,sei:{code:e.data.type,content:e.data.payload,dts:e.pts}}))}))}}]),e}(),logger$2=new Logger$9("BufferService"),BufferService=function(){function e(t){if(_classCallCheck$4(this,e),_defineProperty$4(this,"_decryptor",new Decryptor),_defineProperty$4(this,"_transmuxer",null),_defineProperty$4(this,"_mse",null),_defineProperty$4(this,"_softVideo",null),_defineProperty$4(this,"_sourceCreated",!1),_defineProperty$4(this,"_needInitSegment",!0),_defineProperty$4(this,"_directAppend",!1),this.hls=t,t.config.softDecode)this._softVideo=t.media;else if(this._mse=new MSE$2,t.config.url){var r=this._mse.bindMedia(t.media);r&&r.then&&r.then((function(){t&&t.emit("sourceAttached")}))}t.config.decryptor&&(this._decryptor.externalDecryptor=t.config.decryptor)}var t,r,n,i,a,o,s,u,c;return _createClass$4(e,[{key:"baseDts",get:function(){var e,t,r;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t||null===(r=t._fixer)||void 0===r?void 0:r._baseDts}},{key:"nbSb",get:function(){var e;return null!==(e=this._mse)&&void 0!==e&&e._sourceBuffer?Object.keys(this._mse._sourceBuffer).length:0}},{key:"updateDuration",value:(c=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(logger$2.debug("update duration",t),!this._mse){e.next=9;break}if(this._mse.isOpened){e.next=5;break}return e.next=5,this._mse.open();case 5:return e.next=7,this._mse.updateDuration(t);case 7:e.next=10;break;case 9:this._softVideo&&(this._softVideo.duration=t);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"createSource",value:function(e,t,r,n){if(!this._sourceCreated){var i=e||t;if(i){if(TsDemuxer.probe(i))this._transmuxer||(this._transmuxer=new Transmuxer(this.hls,!1,!this._softVideo));else{if(!MP4Parser.probe(i))throw new StreamingError$2(ERR$2.OTHER,null,null,null,"unsupported stream");if(this._softVideo)this._transmuxer||(this._transmuxer=new Transmuxer(this.hls,!0));else{this._directAppend=!0;var a=!1;e&&!r&&MP4Parser.findBox(e,["moov","trak"]).forEach((function(e){var t=MP4Parser.findBox(e.data,["trak","mdia","minf","stbl","stsd"])[0];if(t){var i=MP4Parser.stsd(t).entries[0];if(i)if(i.hvcC)r=i.hvcC.codec||"hev1.1.6.L93.B0";else if(i.avcC)r=i.avcC.codec;else if(i.sampleRate||i.esds){var o;n=(null===(o=i.esds)||void 0===o?void 0:o.codec)||"mp4a.40.2",a=!0}}})),t&&!n&&MP4Parser.findBox(t,["moov","trak","mdia","minf","stbl","stsd"]).forEach((function(e){var t=MP4Parser.stsd(e).entries[0];t&&t.esds&&(n=t.esds.codec)})),e&&!r&&(r="avc1.42e01e"),t&&!n&&(n="mp4a.40.2"),a&&(r+=", ".concat(n),n=""),this._createMseSource(r,n)}}this._softVideo&&(this._sourceCreated=!0)}}}},{key:"appendBuffer",value:(u=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t,r,n,i,a,o,s){var u,c,l,d,h,f,p,m,y;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n&&n.length||null!=i&&i.length){e.next=2;break}return e.abrupt("return");case 2:if(!this._directAppend){e.next=7;break}return u=[],n&&u.push(this._mse.append(MSE$2.VIDEO,n)),i&&u.push(this._mse.append(MSE$2.AUDIO,i)),e.abrupt("return",Promise.all(u));case 7:if(c=this._needInitSegment||a,l=this._transmuxer.transmux(n,i,a,o,s,this._needInitSegment||a),d=_slicedToArray$3(l,2),h=d[0],f=d[1],i&&r&&(null==r||r.setTrackExist(!1,!0)),i&&t&&(null==t||t.setTrackExist(!0,!1)),r||null==t||t.setTrackExist(!!h,!!f),h&&!f&&this.hls.emit(Event$1.NO_AUDIO_TRACK),!this._softVideo){e.next=18;break}this._softVideo.appendBuffer(h,f),this._needInitSegment=!1,e.next=28;break;case 18:if(!this._mse){e.next=28;break}return(p=!this._sourceCreated)&&this._createMseSource(null==h?void 0:h.codec,null==f?void 0:f.codec),this._needInitSegment=!1,m=this._mse,y=[],c&&!p&&this._handleCodecChange(h,f),h&&y.push(m.append(MSE$2.VIDEO,h.data)),f&&y.push(m.append(MSE$2.AUDIO,f.data)),e.abrupt("return",Promise.all(y));case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i,a,o){return u.apply(this,arguments)})},{key:"removeBuffer",value:(s=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){var t,r,n,i=this,a=arguments;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:0,r=a.length>1&&void 0!==a[1]?a[1]:1/0,n=this.hls.media,!(!this._mse||!n||t<0||r<t||t>=this._mse.duration)){e.next=5;break}return e.abrupt("return");case 5:return e.abrupt("return",this._mse.clearBuffer(t,r).then((function(){return i.hls.emit(EVENT$2.REMOVE_BUFFER,{start:t,end:r,removeEnd:r})})));case 6:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"evictBuffer",value:(o=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){var r,n,i;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.hls.media,this._mse&&r&&t&&!(t<0)){e.next=3;break}return e.abrupt("return");case 3:if(n=r.currentTime,!((i=n-t)<=0)){e.next=7;break}return e.abrupt("return");case 7:if(!(Buffer$5.start(Buffer$5.get(r))+1>=i)){e.next=10;break}return e.abrupt("return");case 10:return e.abrupt("return",this.removeBuffer(0,i));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"clearAllBuffer",value:(a=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=2;break}return e.abrupt("return",this._mse.clearAllBuffer());case 2:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"decryptBuffer",value:function(e,t){return this._decryptor.decrypt(e,t)}},{key:"reset",value:(i=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){var t,r=arguments;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=r.length>0&&void 0!==r[0]&&r[0],!this._mse||t){e.next=7;break}return this._sourceCreated=!1,e.next=5,this._mse.unbindMedia();case 5:return e.next=7,this._mse.bindMedia(this.hls.media);case 7:this._transmuxer=null,this._needInitSegment=!0,this._directAppend=!1;case 10:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"endOfStream",value:(n=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=5;break}if(!this._sourceCreated){e.next=5;break}return e.next=4,this._mse.endOfStream();case 4:this.hls.emit(EVENT$2.BUFFEREOS);case 5:this._softVideo&&this._softVideo.endOfStream();case 6:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setLiveSeekableRange",value:(r=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t,r){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._mse&&this._mse.setLiveSeekableRange(t,r);case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"destroy",value:(t=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){var t;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._mse,this._mse=null,this._softVideo=null,!t){e.next=6;break}return e.next=6,t.unbindMedia();case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_createMseSource",value:function(e,t){logger$2.debug("create mse source, videoCodec=".concat(e,", audioCodec=").concat(t));var r=this._mse;r&&(e&&(r.createSource(MSE$2.VIDEO,"video/mp4;codecs=".concat(e)),this._sourceCreated=!0),t&&(r.createSource(MSE$2.AUDIO,"audio/mp4;codecs=".concat(t)),this._sourceCreated=!0),this.hls.emit(EVENT$2.SOURCEBUFFER_CREATED))}},{key:"_handleCodecChange",value:function(e,t){var r=this._mse;[{type:MSE$2.VIDEO,codecs:null==e?void 0:e.codec},{type:MSE$2.AUDIO,codecs:null==t?void 0:t.codec}].filter((function(e){return!!e.codecs})).forEach((function(e){var t=e.type,n=e.codecs,i=r.getSourceBuffer(t);if(i){var a=n.split(",")[0];new RegExp(a,"ig").test(i.mimeType)||r.changeType(t,"".concat(t,"/mp4;codecs=").concat(n))}}))}},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0}}]),e}();function getConfig(e){var t=(null==e?void 0:e.media)||document.createElement("video");return _objectSpread2$1(_objectSpread2$1({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),{},{media:t})}var MasterPlaylist=_createClass$4((function e(){_classCallCheck$4(this,e),_defineProperty$4(this,"version",0),_defineProperty$4(this,"streams",[]),_defineProperty$4(this,"isMaster",!0)})),MediaType={Audio:"AUDIO",Video:"VIDEO",SubTitle:"SUBTITLE",ClosedCaptions:"CLOSED-CAPTIONS"},MediaStream$1=_createClass$4((function e(){_classCallCheck$4(this,e),_defineProperty$4(this,"id",0),_defineProperty$4(this,"url",""),_defineProperty$4(this,"default",!1),_defineProperty$4(this,"autoSelect",!1),_defineProperty$4(this,"forced",!1),_defineProperty$4(this,"group",""),_defineProperty$4(this,"name",""),_defineProperty$4(this,"lang",""),_defineProperty$4(this,"segments",[]),_defineProperty$4(this,"endSN",0)})),AudioStream=function(e){_inherits$3(r,MediaStream$1);var t=_createSuper$3(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return _defineProperty$4(_assertThisInitialized$3(e=t.call.apply(t,[this].concat(i))),"mediaType",MediaType.Audio),_defineProperty$4(_assertThisInitialized$3(e),"channels",0),e}return _createClass$4(r)}(),SubTitleStream=function(e){_inherits$3(r,MediaStream$1);var t=_createSuper$3(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return _defineProperty$4(_assertThisInitialized$3(e=t.call.apply(t,[this].concat(i))),"mediaType",MediaType.SubTitle),e}return _createClass$4(r)}(),MasterStream=_createClass$4((function e(){_classCallCheck$4(this,e),_defineProperty$4(this,"id",0),_defineProperty$4(this,"bitrate",0),_defineProperty$4(this,"width",0),_defineProperty$4(this,"height",0),_defineProperty$4(this,"name",""),_defineProperty$4(this,"url",""),_defineProperty$4(this,"audioCodec",""),_defineProperty$4(this,"videoCodec",""),_defineProperty$4(this,"textCodec",""),_defineProperty$4(this,"audioGroup",""),_defineProperty$4(this,"audioStreams",[]),_defineProperty$4(this,"subtitleStreams",[]),_defineProperty$4(this,"closedCaptionsStream",[])})),MediaPlaylist=_createClass$4((function e(){_classCallCheck$4(this,e),_defineProperty$4(this,"version",0),_defineProperty$4(this,"url",""),_defineProperty$4(this,"type",""),_defineProperty$4(this,"startCC",0),_defineProperty$4(this,"endCC",0),_defineProperty$4(this,"startSN",0),_defineProperty$4(this,"endSN",0),_defineProperty$4(this,"totalDuration",0),_defineProperty$4(this,"targetDuration",0),_defineProperty$4(this,"live",!0),_defineProperty$4(this,"segments",[])})),MediaSegment=function(){function e(){_classCallCheck$4(this,e),_defineProperty$4(this,"sn",0),_defineProperty$4(this,"cc",0),_defineProperty$4(this,"url",""),_defineProperty$4(this,"title",""),_defineProperty$4(this,"start",0),_defineProperty$4(this,"duration",0),_defineProperty$4(this,"key",null),_defineProperty$4(this,"byteRange",null),_defineProperty$4(this,"isInitSegment",!1),_defineProperty$4(this,"initSegment",null),_defineProperty$4(this,"isLast",!1),_defineProperty$4(this,"hasAudio",!1),_defineProperty$4(this,"hasVideo",!1)}return _createClass$4(e,[{key:"end",get:function(){return this.start+this.duration}},{key:"setTrackExist",value:function(e,t){this.hasVideo=e,this.hasAudio=t}},{key:"setByteRange",value:function(e,t){this.byteRange=[0];var r=e.split("@");1===r.length&&t&&t.byteRange?(this.byteRange[0]=t.byteRange[1]||0,this.byteRange[0]&&(this.byteRange[0]+=1)):this.byteRange[0]=parseInt(r[1]),this.byteRange[1]=this.byteRange[0]+parseInt(r[0])-1}}]),e}(),MediaSegmentKey=function(){function e(t){_classCallCheck$4(this,e),_defineProperty$4(this,"method",""),_defineProperty$4(this,"url",""),_defineProperty$4(this,"iv",null),_defineProperty$4(this,"keyFormat",""),_defineProperty$4(this,"keyFormatVersions",""),t instanceof e&&(this.method=t.method,this.url=t.url,this.keyFormat=t.keyFormat,this.keyFormatVersions=t.keyFormatVersions,t.iv&&(this.iv=new Uint8Array(t.iv)))}return _createClass$4(e,[{key:"clone",value:function(t){var r=new e(this);return null!=t&&r.setIVFromSN(t),r}},{key:"setIVFromSN",value:function(e){if(!this.iv&&"AES-128"===this.method&&"number"==typeof e&&this.url){this.iv=new Uint8Array(16);for(var t=12;t<16;t++)this.iv[t]=e>>8*(15-t)&255}}}]),e}(),REGEXP_TAG=/^#(EXT[^:]*)(?::(.*))?$/,REGEXP_ATTR=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,REGEXP_ABSOLUTE_URL=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,REGEXP_URL_PAIR=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function getLines(e){return e.split(/[\r\n]/).map((function(e){return e.trim()})).filter(Boolean)}function parseTag(e){var t=e.match(REGEXP_TAG);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function parseAttr(e){for(var t={},r=REGEXP_ATTR.exec(e);r;)t[r[1]]=r[2]||r[3],r=REGEXP_ATTR.exec(e);return t}function getAbsoluteUrl(e,t){if(!t||!e||REGEXP_ABSOLUTE_URL.test(e))return e;var r=REGEXP_URL_PAIR.exec(t);return r?"/"===e[0]?r[1]+e:r[1]+r[2]+e:e}var CODECS_REGEXP={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function getCodecs(e,t){var r=CODECS_REGEXP[e];if(r&&t&&t.length)for(var n=0;n<r.length;n++)for(var i=0;i<t.length;i++)if(r[n].test(t[i]))return t[i]}function parseMasterPlaylist(e,t){for(var r,n=new MasterPlaylist,i=0,a=[],o=[];r=e[i++];){var s=parseTag(r);if(s){var u=_slicedToArray$3(s,2),c=u[0],l=u[1];if("VERSION"===c)n.version=parseInt(l);else if("MEDIA"===c&&l){var d=parseAttr(l),h=void 0;switch(d.TYPE){case"AUDIO":h=new AudioStream;break;case"SUBTITLES":h=new SubTitleStream;break;default:h=new MediaStream$1}h.url=getAbsoluteUrl(d.URI,t),h.default="YES"===d.DEFAULT,h.autoSelect="YES"===d.AUTOSELECT,h.group=d["GROUP-ID"],h.name=d.NAME,h.lang=d.LANGUAGE,d.CHANNELS&&(h.channels=Number(d.CHANNELS.split("/")[0]),Number.isNaN(h.channels)&&(h.channels=0)),"AUDIO"===d.TYPE&&d.URI&&a.push(h),"SUBTITLES"===d.TYPE&&o.push(h)}else if("STREAM-INF"===c&&l){var f=new MasterStream,p=parseAttr(l);if(f.bitrate=parseInt(p["AVERAGE-BANDWIDTH"]||p.BANDWIDTH),f.name=p.NAME,f.url=getAbsoluteUrl(e[i++],t),p.RESOLUTION){var m=_slicedToArray$3(p.RESOLUTION.split("x"),2),y=m[0],g=m[1];f.width=parseInt(y),f.height=parseInt(g)}if(p.CODECS){var v=p.CODECS.split(/[ ,]+/).filter(Boolean);f.videoCodec=getCodecs("video",v),f.audioCodec=getCodecs("audio",v),f.textCodec=getCodecs("text",v)}f.audioGroup=p.AUDIO,f.subtitleGroup=p.SUBTITLES,n.streams.push(f)}}}return n.streams.forEach((function(e,t){e.id=t})),a.length&&(a.forEach((function(e,t){e.id=t})),n.streams.forEach((function(e){e.audioGroup&&(e.audioStreams=a.filter((function(t){return t.group===e.audioGroup})))}))),o.length&&(o.forEach((function(e,t){e.id=t})),n.streams.forEach((function(e){e.subtitleGroup&&(e.subtitleStreams=o.filter((function(t){return t.group===e.subtitleGroup})))}))),n}function parseMediaPlaylist(e,t){var r=new MediaPlaylist;r.url=t;for(var n,i=new MediaSegment,a=null,o=null,s=0,u=0,c=0,l=0,d=!1;(n=e[l++])&&!d;)if("#"===n[0]){var h=parseTag(n);if(h){var f=_slicedToArray$3(h,2),p=f[0],m=f[1];switch(p){case"VERSION":r.version=parseInt(m);break;case"PLAYLIST-TYPE":r.type=null==m?void 0:m.toUpperCase();break;case"TARGETDURATION":r.targetDuration=parseFloat(m);break;case"ENDLIST":var y=r.segments[r.segments.length-1];y&&(y.isLast=!0),r.live=!1,d=!0;break;case"MEDIA-SEQUENCE":u=r.startSN=parseInt(m);break;case"DISCONTINUITY-SEQUENCE":c=r.startCC=parseInt(m);break;case"DISCONTINUITY":c++;break;case"BYTERANGE":i.setByteRange(m,r.segments[r.segments.length-1]);break;case"EXTINF":var g=_slicedToArray$3(m.split(","),2),v=g[0],b=g[1];i.start=s,i.duration=parseFloat(v),s+=i.duration,i.title=b;break;case"KEY":var _=parseAttr(m);if("NONE"===_.METHOD){o=null;break}if("AES-128"!==_.METHOD)throw new Error("encrypt ".concat(_.METHOD,"/").concat(_.KEYFORMAT," is not supported"));if((o=new MediaSegmentKey).method=_.METHOD,o.url=/^blob:/.test(_.URI)?_.URI:getAbsoluteUrl(_.URI,t),o.keyFormat=_.KEYFORMAT||"identity",o.keyFormatVersions=_.KEYFORMATVERSIONS,_.IV){var A=_.IV.slice(2);A=(1&A.length?"0":"")+A,o.iv=new Uint8Array(A.length/2);for(var T=0,E=A.length/2;T<E;T++)o.iv[T]=parseInt(A.slice(2*T,2*T+2),16)}break;case"MAP":var S=parseAttr(m);i.url=getAbsoluteUrl(S.URI,t),S.BYTERANGE&&i.setByteRange(S.BYTERANGE),i.isInitSegment=!0,i.sn=0,o&&(i.key=o.clone(0)),a=i,i=new MediaSegment}}}else i.sn=u,i.cc=c,i.url=getAbsoluteUrl(n,t),o&&(i.key=o.clone(u)),a&&(i.initSegment=a),r.segments.push(i),i=new MediaSegment,u++;var $=r.segments[r.segments.length-1];return $&&(r.endSN=$.sn),r.totalDuration=s,r.endCC=c,r}var M3U8Parser=function(){function e(){_classCallCheck$4(this,e)}return _createClass$4(e,null,[{key:"parse",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if(!t.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");var n=getLines(t);return e.isMediaPlaylist(t)?parseMediaPlaylist(n,r):parseMasterPlaylist(n,r)}},{key:"isMediaPlaylist",value:function(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}]),e}(),ManifestLoader=function(){function e(t){var r=this;_classCallCheck$4(this,e),_defineProperty$4(this,"_onLoaderRetry",(function(e,t){r.hls.emit(Event$1.LOAD_RETRY,{error:StreamingError$2.network(e),retryTime:t})})),this.hls=t,this._timer=null;var n=this.hls.config,i=n.retryCount,a=n.retryDelay,o=n.loadTimeout,s=n.fetchOptions;this._loader=new NetLoader$2(_objectSpread2$1(_objectSpread2$1({},s),{},{responseType:"text",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry})),this._audioLoader=new NetLoader$2(_objectSpread2$1(_objectSpread2$1({},s),{},{responseType:"text",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry})),this._subtitleLoader=new NetLoader$2(_objectSpread2$1(_objectSpread2$1({},s),{},{responseType:"text",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry}))}var t;return _createClass$4(e,[{key:"load",value:(t=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t,r,n){var i,a,o,s,u,c,l,d,h,f,p,m,y,g;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[this._loader.load(t)],r&&i.push(this._audioLoader.load(r)),n&&i.push(this._subtitleLoader.load(n)),e.prev=3,e.next=6,Promise.all(i);case 6:if(u=e.sent,c=_slicedToArray$3(u,3),l=c[0],d=c[1],h=c[2],l){e.next=13;break}return e.abrupt("return",[]);case 13:a=l.data,r?(o=null==d?void 0:d.data,s=null==h?void 0:h.data):s=null==d?void 0:d.data,e.next=20;break;case 17:throw e.prev=17,e.t0=e.catch(3),StreamingError$2.network(e.t0);case 20:if(f=this.hls.config.onPreM3U8Parse,e.prev=21,f&&(a=f(a)||a,o&&(o=f(o,!0)||o),s&&(s=f(s,!0)||s)),p=M3U8Parser.parse(a,t),!1!==(null===(g=p)||void 0===g?void 0:g.live)||!p.segments||p.segments.length){e.next=26;break}throw new Error("empty segments list");case 26:o&&(m=M3U8Parser.parse(o,r)),s&&(y=M3U8Parser.parse(s,n)),e.next=33;break;case 30:throw e.prev=30,e.t1=e.catch(21),new StreamingError$2(ERR$2.MANIFEST,ERR$2.SUB_TYPES.HLS,e.t1);case 33:return p&&(p.isMaster?this.hls.emit(Event$1.HLS_MANIFEST_LOADED,{playlist:p}):this.hls.emit(Event$1.HLS_LEVEL_LOADED,{playlist:p})),e.abrupt("return",[p,m,y]);case 35:case"end":return e.stop()}}),e,this,[[3,17],[21,30]])}))),function(e,r,n){return t.apply(this,arguments)})},{key:"poll",value:function(e,t,r,n,i,a){var o=this;clearTimeout(this._timer),a=a||3e3;var s=this.hls.config.pollRetryCount,u=function(){var c=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function c(){var l;return _regeneratorRuntime$2().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return clearTimeout(o._timer),c.prev=1,c.next=4,o.load(e,t,r);case 4:if((l=c.sent)[0]){c.next=7;break}return c.abrupt("return");case 7:s=o.hls.config.pollRetryCount,n(l[0],l[1],l[2]),c.next=15;break;case 11:c.prev=11,c.t0=c.catch(1),--s<=0&&i(c.t0);case 15:o._timer=setTimeout(u,a);case 16:case"end":return c.stop()}}),c,null,[[1,11]])})));return function(){return c.apply(this,arguments)}}();this._timer=setTimeout(u,a)}},{key:"stopPoll",value:function(){return clearTimeout(this._timer),this.cancel()}},{key:"cancel",value:function(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}]),e}();function clamp(e,t,r){return t>r&&(r=t),Math.min(Math.max(e,t),r)}var $$4=_export,$findIndex=arrayIteration.findIndex,addToUnscopables$1=addToUnscopables$5,FIND_INDEX="findIndex",SKIPS_HOLES=!0;FIND_INDEX in[]&&Array(1)[FIND_INDEX]((function(){SKIPS_HOLES=!1})),$$4({target:"Array",proto:!0,forced:SKIPS_HOLES},{findIndex:function(e){return $findIndex(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables$1(FIND_INDEX);var Stream=function(){function e(t,r,n){_classCallCheck$4(this,e),_defineProperty$4(this,"live",void 0),_defineProperty$4(this,"id",0),_defineProperty$4(this,"bitrate",0),_defineProperty$4(this,"width",0),_defineProperty$4(this,"height",0),_defineProperty$4(this,"name",""),_defineProperty$4(this,"url",""),_defineProperty$4(this,"audioCodec",""),_defineProperty$4(this,"videoCodec",""),_defineProperty$4(this,"textCodec",""),_defineProperty$4(this,"startCC",0),_defineProperty$4(this,"endCC",0),_defineProperty$4(this,"startSN",0),_defineProperty$4(this,"endSN",-1),_defineProperty$4(this,"totalDuration",0),_defineProperty$4(this,"targetDuration",0),_defineProperty$4(this,"snDiff",null),_defineProperty$4(this,"segments",[]),_defineProperty$4(this,"audioStreams",[]),_defineProperty$4(this,"subtitleStreams",[]),_defineProperty$4(this,"closedCaptions",[]),_defineProperty$4(this,"currentAudioStream",null),_defineProperty$4(this,"currentSubtitleStream",null),this.update(t,r,n)}return _createClass$4(e,[{key:"lastSegment",get:function(){return this.segments.length?this.segments[this.segments.length-1]:null}},{key:"segmentDuration",get:function(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}},{key:"liveEdge",get:function(){return this.endTime}},{key:"endTime",get:function(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0}},{key:"currentSubtitleEndSn",get:function(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}},{key:"clearOldSegment",value:function(e,t){return this.currentAudioStream&&this._clearSegments(e,t),this._clearSegments(e,t)}},{key:"getAudioSegment",value:function(e){if(e&&this.currentAudioStream){var t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((function(e){return e.sn===t}))}}},{key:"update",value:function(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((function(e){return e.default}))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((function(e){return e.default}))||this.subtitleStreams[0]))}},{key:"updateSubtitle",value:function(e){var t=this;if(e&&this.currentSubtitleStream&&Array.isArray(e.segments)){var r=this._updateSegments(e,this.currentSubtitleStream),n=this.currentSubtitleStream.segments;if(n.length>100&&(this.currentSubtitleStream.segments=n.slice(100)),r)return r.map((function(e){return{sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:t.currentSubtitleStream.lang}}))}}},{key:"switchSubtitle",value:function(e){var t=this.subtitleStreams.find((function(t){return t.lang===e})),r=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,r.segments=[])}},{key:"_clearSegments",value:function(e,t){for(var r=0,n=this.segments,i=0,a=n.length;i<a;i++)if(n[i].end>=e){r=i;break}return r>t&&(r=t),r&&(this.segments=this.segments.slice(r),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(r))),t-r}},{key:"_updateSegments",value:function(e,t){var r=t.segments;if(this.live){var n=r[r.length-1],i=(null==n?void 0:n.sn)||-1;if(i<e.endSN&&e.segments.length){var a=e.segments.findIndex((function(e){return e.sn===i})),o=a<0?e.segments:e.segments.slice(a+1);if(r.length&&o.length){var s=n.end;o.forEach((function(e){e.start=s,s=e.end}));var u=(null==n?void 0:n.cc)||-1;u>o[0].cc&&o.forEach((function(e){return e.cc+=u}))}return t.endSN=e.endSN,t.segments=r.concat(o),o}}else t.segments=e.segments}}]),e}(),Playlist=function(){function e(t){_classCallCheck$4(this,e),_defineProperty$4(this,"streams",[]),_defineProperty$4(this,"currentStream",null),_defineProperty$4(this,"dvrWindow",0),_defineProperty$4(this,"_segmentPointer",-1),this.hls=t}return _createClass$4(e,[{key:"lastSegment",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}},{key:"currentSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}},{key:"nextSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}},{key:"currentSegments",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}},{key:"currentSubtitleEndSn",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}},{key:"liveEdge",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge}},{key:"totalDuration",get:function(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}},{key:"seekRange",get:function(){var e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}},{key:"isEmpty",get:function(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}},{key:"isLive",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}},{key:"hasSubtitle",get:function(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}},{key:"getAudioSegment",value:function(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}},{key:"moveSegmentPointer",value:function(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=clamp(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length)}},{key:"reset",value:function(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}},{key:"getSegmentByIndex",value:function(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}},{key:"setNextSegmentByIndex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1}},{key:"findSegmentIndexByTime",value:function(e){var t=this.currentSegments;if(t){for(var r,n=0,i=t.length;n<i;n++)if(e>=(r=t[n]).start&&e<r.end)return n;var a=t[t.length-1];if(Math.abs(e-a.end)<.2)return t.length-1}}},{key:"upsertPlaylist",value:function(e,t,r){var n=this;if(e){if(e.isMaster)this.streams.length=e.streams.length,e.streams.filter((function(e){return e.url})).forEach((function(e,t){n.streams[t]?n.streams[t].update(e):n.streams[t]=new Stream(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){var i=this.currentStream;if(i){i.update(e,t,r);var a=i.updateSubtitle(r);a&&this.hls.emit(Event$1.SUBTITLE_SEGMENTS,{list:a})}else this.reset(),this.currentStream=this.streams[0]=new Stream(e,t,r)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce((function(e,t){return e+=t.duration}),0))}}},{key:"switchSubtitle",value:function(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}},{key:"clearOldSegment",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,t=this.currentStream;if(this.dvrWindow&&t){var r=t.endTime-this.dvrWindow;if(!(r<=0))t.segments.length<=e||(this._segmentPointer=t.clearOldSegment(r,this._segmentPointer))}}},{key:"checkSegmentTrackChange",value:function(e,t){var r=this.findSegmentIndexByTime(e),n=this.getSegmentByIndex(r);if(n&&(n.hasAudio||n.hasVideo)){if(2!==t&&n.hasAudio&&n.hasVideo)return n;if(!(n.end-e>.3)){var i=this.getSegmentByIndex(r+1);if(i&&(i.hasAudio||i.hasVideo))return i.hasAudio!==n.hasAudio||i.hasVideo!==n.hasVideo?i:void 0}}}}]),e}(),SegmentLoader=function(){function e(t){var r=this;_classCallCheck$4(this,e),_defineProperty$4(this,"error",null),_defineProperty$4(this,"_emitOnLoaded",(function(e,t){var n=e.data,i=e.response,a=e.option||{},o=a.firstByteTime,s=a.startTime,u=a.endTime,c=a.contentLength,l=u-s;r._bandwidthService.addRecord(c||n.byteLength,l),r.hls.emit(EVENT$2.SPEED,{time:l,byteLength:c,url:t}),r.hls.emit(EVENT$2.LOAD_COMPLETE,{url:t,elapsed:l||0}),r.hls.emit(EVENT$2.TTFB,{url:t,responseUrl:i.url,elapsed:o-s}),r.hls.emit(EVENT$2.LOAD_RESPONSE_HEADERS,{headers:i.headers})})),_defineProperty$4(this,"_onLoaderRetry",(function(e,t){r.hls.emit(EVENT$2.LOAD_RETRY,{error:StreamingError$2.network(e),retryTime:t})})),this.hls=t,this._bandwidthService=new BandwidthService,this._mapCache={},this._keyCache={};var n=this.hls.config,i=n.retryCount,a=n.retryDelay,o=n.loadTimeout,s=n.fetchOptions;this._segmentLoader=new NetLoader$2(_objectSpread2$1(_objectSpread2$1({},s),{},{responseType:"arraybuffer",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry})),this._audioSegmentLoader=new NetLoader$2(_objectSpread2$1(_objectSpread2$1({},s),{},{responseType:"arraybuffer",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry})),this._keyLoader=new NetLoader$2(_objectSpread2$1(_objectSpread2$1({},s),{},{responseType:"arraybuffer",retry:i,retryDelay:a,timeout:o,onRetryError:this._onLoaderRetry}))}var t,r;return _createClass$4(e,[{key:"speedInfo",value:function(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}},{key:"load",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r,i=[];return e&&(i[0]=this.loadVideoSegment(e,r)),t&&(i[1]=this.loadAudioSegment(t,n)),Promise.all(i)}},{key:"loadVideoSegment",value:function(e,t){return this._loadSegment(this._segmentLoader,e,t)}},{key:"loadAudioSegment",value:function(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}},{key:"_loadSegment",value:(r=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t,r,n){var i,a,o,s,u,c,l,d,h,f,p,m,y,g,v,b=this;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=[],this.hls.emit(EVENT$2.LOAD_START,{url:r.url}),l[0]=t.load(r.url),n&&r.initSegment&&(h=r.initSegment.url,(a=this._mapCache[h])||(this.hls.emit(EVENT$2.LOAD_START,{url:h}),l[1]=t.load(h).then((function(e){e&&(Object.keys(b._mapCache)>30&&(b._mapCache={}),a=b._mapCache[h]=e.data,b._emitOnLoaded(e,h))}))),(f=null===(d=r.initSegment.key)||void 0===d?void 0:d.url)&&(c=r.initSegment.key.iv,(u=this._keyCache[f])||(this.hls.emit(EVENT$2.LOAD_START,{url:f}),l[2]=this._keyLoader.load(f).then((function(e){e&&(u=b._keyCache[f]=e.data,b._emitOnLoaded(e,f))}))))),(p=null===(i=r.key)||void 0===i?void 0:i.url)&&(s=r.key.iv,(o=this._keyCache[p])||(this.hls.emit(EVENT$2.LOAD_START,{url:p}),l[3]=this._keyLoader.load(p).then((function(e){e&&(o=b._keyCache[p]=e.data,b._emitOnLoaded(e,p))})))),e.next=8,Promise.all(l);case 8:if(m=e.sent,y=_slicedToArray$3(m,1),g=y[0]){e.next=13;break}return e.abrupt("return");case 13:return v=g.data,this._emitOnLoaded(g,r.url),e.abrupt("return",{data:v,map:a,key:o,mapKey:u,keyIv:s,mapKeyIv:c});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"reset",value:function(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}},{key:"cancel",value:(t=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()]);case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),logger$1=new Logger$9("hls"),Hls=function(e){_inherits$3(m,EventEmitter$1);var t,r,n,i,a,o,s,u,c,l,d,h,f,p=_createSuper$3(m);function m(e){var t;return _classCallCheck$4(this,m),_defineProperty$4(_assertThisInitialized$3(t=p.call(this)),"version",m.version),_defineProperty$4(_assertThisInitialized$3(t),"media",null),_defineProperty$4(_assertThisInitialized$3(t),"config",null),_defineProperty$4(_assertThisInitialized$3(t),"_manifestLoader",null),_defineProperty$4(_assertThisInitialized$3(t),"_segmentLoader",null),_defineProperty$4(_assertThisInitialized$3(t),"_playlist",null),_defineProperty$4(_assertThisInitialized$3(t),"_bufferService",null),_defineProperty$4(_assertThisInitialized$3(t),"_gapService",null),_defineProperty$4(_assertThisInitialized$3(t),"_seiService",null),_defineProperty$4(_assertThisInitialized$3(t),"_stats",null),_defineProperty$4(_assertThisInitialized$3(t),"_prevSegSn",null),_defineProperty$4(_assertThisInitialized$3(t),"_prevSegCc",null),_defineProperty$4(_assertThisInitialized$3(t),"_tickTimer",null),_defineProperty$4(_assertThisInitialized$3(t),"_tickInterval",500),_defineProperty$4(_assertThisInitialized$3(t),"_segmentProcessing",!1),_defineProperty$4(_assertThisInitialized$3(t),"_reloadOnPlay",!1),_defineProperty$4(_assertThisInitialized$3(t),"_switchUrlOpts",null),_defineProperty$4(_assertThisInitialized$3(t),"_loadSegment",_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){var r,n;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t._segmentProcessing&&t.media){e.next=2;break}return e.abrupt("return");case 2:if(r=t.media.currentTime,n=t._playlist.currentSegment,t._playlist.nextSegment&&!(n&&!t.isLive&&n.end-r>=t.config.preloadTime)){e.next=7;break}return e.abrupt("return");case 7:return e.abrupt("return",t._loadSegmentDirect());case 8:case"end":return e.stop()}}),e)})))),_defineProperty$4(_assertThisInitialized$3(t),"_onPlay",_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(clearTimeout(t._disconnectTimer),!t._reloadOnPlay){e.next=6;break}t._reloadOnPlay=!1,t.replay(!0),e.next=9;break;case 6:return e.next=8,t._loadSegment();case 8:t._startTick();case 9:case"end":return e.stop()}}),e)})))),_defineProperty$4(_assertThisInitialized$3(t),"_onPause",(function(){if(t.isLive){if(!t._reloadOnPlay){var e=t.config.disconnectTime;if(null==e&&(e=t._playlist.dvrWindow),!Number.isFinite(e))return;clearTimeout(t._disconnectTimer),t._disconnectTimer=setTimeout((function(){t._reloadOnPlay=!0,t._clear()}),e||0)}}else t._stopTick()})),_defineProperty$4(_assertThisInitialized$3(t),"_onSeeking",_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){var r,n,i,a,o,s,u;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.media){e.next=2;break}return e.abrupt("return");case 2:if(r=t.media.currentTime,!(n=t._playlist.seekRange)){e.next=9;break}if(!((i=clamp(r,n[0]+.1,n[1]-.1))>=0&&Math.abs(r-i)>=.1)){e.next=9;break}return t.media.currentTime=i,e.abrupt("return");case 9:if(!(a=t._playlist.currentSegment)){e.next=14;break}if(!((o=Buffer$5.info(Buffer$5.get(t.media),r,.1)).end&&Math.abs(o.end-a.end)<.2)){e.next=14;break}return e.abrupt("return");case 14:if(s=t._playlist.findSegmentIndexByTime(r),u=t._playlist.getSegmentByIndex(s),null!=s&&u&&(!t._segmentProcessing||u!==t._playlist.nextSegment)){e.next=18;break}return e.abrupt("return");case 18:return logger$1.debug("seek to",r,u),t._playlist.setNextSegmentByIndex(s),t._stopTick(),e.next=23,t._segmentLoader.cancel();case 23:return e.next=25,t._loadSegmentDirect();case 25:t._startTick();case 26:case"end":return e.stop()}}),e)})))),_defineProperty$4(_assertThisInitialized$3(t),"_onTimeupdate",(function(){if(t.media){var e=t.config;if(e.isLive&&e.maxLatency&&e.targetLatency&&t.media){var r=t._playlist.liveEdge;if(!r)return;var n=r-t.media.currentTime;n>=e.maxLatency&&(logger$1.debug("latency jump, currentTime:".concat(t.media.currentTime,", liveEdge:").concat(r,", latency=").concat(n)),t.media.currentTime=r-e.targetLatency)}t._seiService.throw(t.media.currentTime),t.config.allowedStreamTrackChange&&!t.config.softDecode&&t._checkStreamTrackChange(t.media.currentTime)}})),_defineProperty$4(_assertThisInitialized$3(t),"_tick",(function(){if(t.media){t._startTick();var e=t.media,r=Buffer$5.get(e),n=t._segmentLoader.error;if(n){(!e.readyState||t.bufferInfo(.5).remaining<1)&&(n.fatal=!0,t._emitError(StreamingError$2.network(n)))}else Buffer$5.end(r)<.1||!e.readyState||(isMediaPlaying(e)?(t._loadSegment(),t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,t.isLive)):e.readyState<2&&t._gapService&&t._gapService.do(e,t.config.maxJumpDistance,!e.currentTime||t.isLive))}})),t.config=e=getConfig(e),t.media=t.config.media,t._manifestLoader=new ManifestLoader(_assertThisInitialized$3(t)),t._segmentLoader=new SegmentLoader(_assertThisInitialized$3(t)),t._playlist=new Playlist(_assertThisInitialized$3(t)),t._bufferService=new BufferService(_assertThisInitialized$3(t)),t._seiService=new SeiService(_assertThisInitialized$3(t)),e.softDecode||(t._gapService=new GapService),t._stats=new MediaStatsService(_assertThisInitialized$3(t),9e4),t.media.addEventListener("play",t._onPlay),t.media.addEventListener("pause",t._onPause),t.media.addEventListener("seeking",t._onSeeking),t.media.addEventListener("timeupdate",t._onTimeupdate),t}return _createClass$4(m,[{key:"isLive",get:function(){return this._playlist.isLive}},{key:"streams",get:function(){return this._playlist.streams}},{key:"currentStream",get:function(){return this._playlist.currentStream}},{key:"hasSubtitle",get:function(){return this._playlist.hasSubtitle}},{key:"baseDts",get:function(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}},{key:"speedInfo",value:function(){return this._segmentLoader.speedInfo()}},{key:"bufferInfo",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.1;return Buffer$5.info(Buffer$5.get(this.media),null===(e=this.media)||void 0===e?void 0:e.currentTime,t)}},{key:"getStats",value:function(){return this._stats.getStats()}},{key:"playbackQuality",value:function(){return getVideoPlaybackQuality(this.media)}},{key:"load",value:(f=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){var r,n=arguments;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]&&n[1],t&&(this.config.url=t),t=this.config.url,e.next=5,this._reset(r);case 5:return e.next=7,this._loadData(t);case 7:this._startTick();case 8:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"_loadData",value:(h=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){var r,n,i,a,o,s,u,c,l,d;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&(t=t.trim()),t){e.next=3;break}throw this._emitError(new StreamingError$2(ERR$2.OTHER,ERR$2.SUB_TYPES.OPTION,null,null,"m3u8 url is missing"));case 3:return e.next=5,this._loadM3U8(t);case 5:if(r=e.sent,n=this._playlist.currentStream,!this._urlSwitching){e.next=17;break}if(0===n.bitrate&&null!==(i=this._switchUrlOpts)&&void 0!==i&&i.bitrate&&(n.bitrate=null===(a=this._switchUrlOpts)||void 0===a?void 0:a.bitrate),o=this._getSeamlessSwitchPoint(),this.config.startTime=o,s=this._playlist.findSegmentIndexByTime(o),!(u=this._playlist.getSegmentByIndex(s+1))){e.next=17;break}return c=u.start,e.next=17,this._bufferService.removeBuffer(c);case 17:if(!r){e.next=29;break}if(!this.isLive){e.next=25;break}this._bufferService.setLiveSeekableRange(0,4294967295),logger$1.log("totalDuration first time got",this._playlist.totalDuration),this.config.targetLatency<this._playlist.totalDuration&&(this.config.targetLatency=this._playlist.totalDuration,this.config.maxLatency=1.5*this.config.targetLatency),r.isMaster||this._pollM3U8(t),e.next=29;break;case 25:return e.next=27,this._bufferService.updateDuration(n.totalDuration);case 27:(l=this.config.startTime)&&(null!==(d=this._switchUrlOpts)&&void 0!==d&&d.seamless||(this.media.currentTime=l),this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(l)||0));case 29:return e.next=31,this._loadSegment();case 31:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"replay",value:(d=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.config.startTime=0,!this.config.softDecode){e.next=5;break}this.load(),e.next=7;break;case 5:return e.next=7,this.load();case 7:return this._reloadOnPlay=!1,e.abrupt("return",this.media.play(!t));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"switchURL",value:(l=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){var r,n,i,a,o,s,u,c=arguments;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=c.length>1&&void 0!==c[1]?c[1]:{},n={seamless:!1,startTime:0,bitrate:0},e.t0=_typeof(r),e.next="number"===e.t0?5:"boolean"===e.t0?7:"object"===e.t0?9:11;break;case 5:return r={startTime:r},e.abrupt("break",12);case 7:return r={seamless:r},e.abrupt("break",12);case 9:for(i in r)void 0!==r[i]&&null!==r[i]||delete r[i];return e.abrupt("break",12);case 11:throw"unsupported switchURL args: ".concat(r);case 12:if(r=Object.assign({},n,r),o=(a=r).seamless,s=a.startTime,this.config.url=t,this.config.startTime=s,this._switchUrlOpts=r,o){e.next=38;break}if(e.prev=18,!this.config.softDecode){e.next=23;break}e.t1=this.load(t),e.next=26;break;case 23:return e.next=25,this.load(t);case 25:e.t1=e.sent;case 26:u=e.t1,e.next=33;break;case 29:throw e.prev=29,e.t2=e.catch(18),this.emit(Event$1.SWITCH_URL_FAILED,e.t2),e.t2;case 33:return this._reloadOnPlay=!1,u&&this.emit(Event$1.SWITCH_URL_SUCCESS,{url:t}),e.abrupt("return",this.media.play(!0));case 38:return this._urlSwitching=!0,this._prevSegSn=null,this._prevSegCc=null,this._playlist.reset(),this._bufferService.seamlessSwitch(),e.next=45,this._clear();case 45:return e.next=47,this._loadData(t);case 47:this._startTick();case 48:this._switchUrlOpts=null;case 49:case"end":return e.stop()}}),e,this,[[18,29]])}))),function(e){return l.apply(this,arguments)})},{key:"switchStream",value:(c=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){var r,n,i,a,o,s=arguments;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(s.length>1&&void 0!==s[1])||s[1],n=this.currentStream,i=this.streams,n&&n.id!==t&&i&&!(i.length<2)){e.next=5;break}return e.abrupt("return");case 5:if(a=i.find((function(e){return e.id===t}))){e.next=8;break}return e.abrupt("return");case 8:return e.prev=8,e.next=11,this._clear();case 11:if(!r){e.next=14;break}return e.next=14,this._bufferService.clearAllBuffer();case 14:e.next=19;break;case 16:throw e.prev=16,e.t0=e.catch(8),this._emitError(StreamingError$2.create(e.t0));case 19:if(n.currentAudioStream&&a.audioStreams.length>2&&(o=n.currentAudioStream.id,a.currentAudioStream=a.audioStreams.find((function(e){return e.id===o}))||a.currentAudioStream),this._playlist.currentStream=a,e.prev=21,!this.isLive&&a.segments.length){e.next=25;break}return e.next=25,this._refreshM3U8();case 25:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=29,this._loadSegmentDirect();case 29:e.next=35;break;case 31:throw e.prev=31,e.t1=e.catch(21),this._playlist.currentStream=n,e.t1;case 35:return this._startTick(),e.abrupt("return",a);case 37:case"end":return e.stop()}}),e,this,[[8,16],[21,31]])}))),function(e){return c.apply(this,arguments)})},{key:"switchAudioStream",value:(u=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){var r,n,i,a,o=arguments;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(o.length>1&&void 0!==o[1])||o[1],n=this.currentStream){e.next=4;break}return e.abrupt("return");case 4:if((i=n.currentAudioStream)&&i.id!==t&&!(n.audioStreams.length<2)){e.next=7;break}return e.abrupt("return");case 7:if(a=n.audioStreams.find((function(e){return e.id===t}))){e.next=10;break}return e.abrupt("return");case 10:return e.prev=10,e.next=13,this._clear();case 13:if(!r){e.next=16;break}return e.next=16,this._bufferService.clearAllBuffer();case 16:e.next=21;break;case 18:throw e.prev=18,e.t0=e.catch(10),this._emitError(StreamingError$2.create(e.t0));case 21:if(n.currentAudioStream=a,e.prev=22,!this.isLive&&a.segments.length){e.next=26;break}return e.next=26,this._refreshM3U8();case 26:return this._playlist.setNextSegmentByIndex(this._playlist.findSegmentIndexByTime(this.media.currentTime)||0),this._prevSegCc=null,e.next=30,this._loadSegmentDirect();case 30:e.next=36;break;case 32:throw e.prev=32,e.t1=e.catch(22),n.currentAudioStream=i,e.t1;case 36:return this._startTick(),e.abrupt("return",a);case 38:case"end":return e.stop()}}),e,this,[[10,18],[22,32]])}))),function(e){return u.apply(this,arguments)})},{key:"switchSubtitleStream",value:(s=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._playlist.switchSubtitle(t),e.next=3,this._manifestLoader.stopPoll();case 3:return e.next=5,this._refreshM3U8();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"destroy",value:(o=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.media){e.next=2;break}return e.abrupt("return");case 2:return this.removeAllListeners(),this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this.media.removeEventListener("play",this._onPlay),this.media.removeEventListener("pause",this._onPause),this.media.removeEventListener("seeking",this._onSeeking),this.media.removeEventListener("timeupdate",this._onTimeupdate),e.next=12,Promise.all([this._clear(),this._bufferService.destroy()]);case 12:this.media=null;case 13:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"_loadM3U8",value:(a=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t){var r,n,i,a;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._manifestLoader.load(t);case 3:n=e.sent,i=_slicedToArray$3(n,1),r=i[0],e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(0),this._emitError(StreamingError$2.create(e.t0));case 11:if(r){e.next=13;break}return e.abrupt("return");case 13:if(this._playlist.upsertPlaylist(r),!r.isMaster){e.next=18;break}return null!==(a=this._playlist.currentStream.subtitleStreams)&&void 0!==a&&a.length&&this.emit(Event$1.SUBTITLE_PLAYLIST,{list:this._playlist.currentStream.subtitleStreams}),e.next=18,this._refreshM3U8();case 18:return this.emit(Event$1.STREAM_PARSED),e.abrupt("return",r);case 20:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(e){return a.apply(this,arguments)})},{key:"_refreshM3U8",value:function(){var e,t,r=this,n=this._playlist.currentStream;if(!n||!n.url)throw this._emitError(StreamingError$2.create(null,null,new Error("m3u8 url is not defined")));var i=n.url,a=null===(e=n.currentAudioStream)||void 0===e?void 0:e.url,o=null===(t=n.currentSubtitleStream)||void 0===t?void 0:t.url;return this._manifestLoader.load(i,a,o).then((function(e){var t=_slicedToArray$3(e,3),n=t[0],s=t[1],u=t[2];n&&(r._playlist.upsertPlaylist(n,s,u),r.isLive&&r._pollM3U8(i,a,o))})).catch((function(e){throw r._emitError(StreamingError$2.create(e))}))}},{key:"_pollM3U8",value:function(e,t,r){var n,i=this,a=this._playlist.isEmpty;this._manifestLoader.poll(e,t,r,(function(e,t,r){i._playlist.upsertPlaylist(e,t,r),i._playlist.clearOldSegment(),e&&a&&!i._playlist.isEmpty&&i._loadSegment(),a&&(a=i._playlist.isEmpty)}),(function(e){i._emitError(StreamingError$2.create(e))}),1e3*((null===(n=this._playlist.lastSegment)||void 0===n?void 0:n.duration)||0))}},{key:"_loadSegmentDirect",value:(i=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){var t,r,n;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._playlist.nextSegment){e.next=3;break}return e.abrupt("return");case 3:return r=!1,n=null,e.prev=5,this._segmentProcessing=!0,e.next=9,this._reqAndBufferSegment(t,this._playlist.getAudioSegment(t));case 9:r=e.sent,e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),n=e.t0;case 15:return e.prev=15,this._segmentProcessing=!1,e.finish(15);case 18:if(!n){e.next=20;break}return e.abrupt("return",this._emitError(StreamingError$2.create(n)));case 20:return r&&(this._urlSwitching&&(this._urlSwitching=!1,this.emit(Event$1.SWITCH_URL_SUCCESS,{url:this.config.url})),this._playlist.moveSegmentPointer(),t.isLast?this._end():this._loadSegment()),e.abrupt("return",r);case 22:case"end":return e.stop()}}),e,this,[[5,12,15,18]])}))),function(){return i.apply(this,arguments)})},{key:"_reqAndBufferSegment",value:(n=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(t,r){var n,i,a,o,s,u,c,l;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t?t.cc:r.cc,a=this._prevSegCc!==i,o=[],e.prev=3,e.next=6,this._segmentLoader.load(t,r,a);case 6:o=e.sent,e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(3),e.t0.fatal=!1,this._segmentLoader.error=e.t0,e.t0;case 14:if(o[0]){e.next=16;break}return e.abrupt("return");case 16:return e.next=18,(n=this._bufferService).decryptBuffer.apply(n,_toConsumableArray$3(o));case 18:if(s=e.sent){e.next=21;break}return e.abrupt("return");case 21:return u=t?t.sn:r.sn,c=t?t.start:r.start,l=this._playlist.currentStream,this._bufferService.createSource(s[0],s[1],null==l?void 0:l.videoCodec,null==l?void 0:l.audioCodec),e.next=27,this._bufferService.appendBuffer(t,r,s[0],s[1],a,this._prevSegSn===u-1,c);case 27:return e.next=29,this._bufferService.evictBuffer(this.config.bufferBehind);case 29:return this._prevSegCc=i,this._prevSegSn=u,e.abrupt("return",!0);case 32:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e,t){return n.apply(this,arguments)})},{key:"_checkStreamTrackChange",value:function(e){var t=this._playlist.checkSegmentTrackChange(e,this._bufferService.nbSb);t&&this.switchURL(this.config.url,t.start+.2)}},{key:"_clear",value:(r=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this._disconnectTimer),this._stopTick(),e.next=4,Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]);case 4:this._segmentProcessing=!1;case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_reset",value:(t=_asyncToGenerator$2(_regeneratorRuntime$2().mark((function e(){var t,r=arguments;return _regeneratorRuntime$2().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]&&r[0],this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this._stats.reset(),e.next=11,this._clear();case 11:return e.abrupt("return",this._bufferService.reset(t));case 12:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_end",value:function(){this._clear(),this._bufferService.endOfStream()}},{key:"_stopTick",value:function(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}},{key:"_startTick",value:function(){this._stopTick(),this._tickTimer=setTimeout(this._tick,this._tickInterval)}},{key:"_emitError",value:function(e){var t,r,n,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?logger$1.warn(e):(logger$1.table(e),logger$1.error(e),logger$1.error(null===(r=this.media)||void 0===r?void 0:r.error),null!==(n=this.media)&&void 0!==n&&n.readyState&&this.media.pause(),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(Event$1.SWITCH_URL_FAILED,e)),this.emit(Event$1.ERROR,e),i&&this._end(),this._seiService.reset());return e}},{key:"_getSeamlessSwitchPoint",value:function(){var e=this.media,t=e.currentTime;if(!e.paused){var r,n=this._playlist.findSegmentIndexByTime(e.currentTime),i=this._playlist.getSegmentByIndex(n),a=null===(r=this._stats)||void 0===r?void 0:r.getStats().downloadSpeed;if(a&&i)t+=i.duration*this._playlist.currentStream.bitrate/a+1;else t+=5}return t}}],[{key:"isSupported",value:function(e){return e&&"video"!==e&&"audio"!==e?"undefined"!=typeof WebAssembly:MSE$2.isSupported()}},{key:"enableLogger",value:function(){Logger$9.enable(),Logger$3.enable()}},{key:"disableLogger",value:function(){Logger$9.disable(),Logger$3.disable()}}]),m}();_defineProperty$4(Hls,"version","3.0.0-next.36-1");try{localStorage.getItem("xgd")?Hls.enableLogger():Hls.disableLogger()}catch(e){}var PluginExtension=function(){function e(t,r){var n=this;_classCallCheck$4(this,e),_defineProperty$4(this,"_opts",null),_defineProperty$4(this,"_plugin",null),_defineProperty$4(this,"_onLowDecode",(function(){var e,t,r,i,a=n._opts,o=a.media,s=a.innerDegrade;null===(e=n._plugin)||void 0===e||null===(t=e.player)||void 0===t||t.emit("lowdecode",o.degradeInfo),null===(r=n._plugin)||void 0===r||null===(i=r.player)||void 0===i||i.emit("core_event",_objectSpread2$1(_objectSpread2$1({},o.degradeInfo),{},{eventName:Event$1.LOWDECODE})),1===s&&n._degrade(o.src)})),_defineProperty$4(this,"_degrade",(function(e){var t=n._plugin.player,r=t.video;if(!r||"MVideo"===r.TAG){var i=t.video.degradeVideo;t.video=i,r.degrade(e),e&&(t.config.url=e);var a=t.root.firstChild;"MVideo"===a.TAG&&t.root.replaceChild(i,a);var o=n._plugin.constructor.pluginName.toLowerCase();t.unRegisterPlugin(o),t.once("canplay",(function(){t.play()}))}})),_defineProperty$4(this,"forceDegradeToVideo",(function(e){1===n._opts.innerDegrade&&n._degrade(e)})),this._opts=t,this._plugin=r,this._init()}return _createClass$4(e,[{key:"_init",value:function(){var e=this._opts,t=e.media,r=e.preloadTime,n=e.innerDegrade,i=e.isLive;t&&(i||!t.setPlayMode?(n&&t.setAttribute("innerdegrade",n),r&&t.setAttribute("preloadtime",r),this._bindEvents()):t.setPlayMode("VOD"))}},{key:"_bindEvents",value:function(){this._opts.media.addEventListener("lowdecode",this._onLowDecode)}},{key:"destroy",value:function(){var e,t;null===(e=this._opts)||void 0===e||null===(t=e.media)||void 0===t||t.removeEventListener("lowdecode",this._onLowDecode),this._plugin=null}}]),e}();function parseSwitchUrlArgs(e,t){var r={startTime:t.player.currentTime};switch(_typeof(e)){case"boolean":r.seamless=e;break;case"object":Object.assign(r,e)}return r}var HlsPlugin=function(e){_inherits$3(r,BasePlugin);var t=_createSuper$3(r);function r(){var e;_classCallCheck$4(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return _defineProperty$4(_assertThisInitialized$3(e=t.call.apply(t,[this].concat(i))),"hls",null),_defineProperty$4(_assertThisInitialized$3(e),"pluginExtension",null),_defineProperty$4(_assertThisInitialized$3(e),"getStats",(function(){var t;return null===(t=e.hls)||void 0===t?void 0:t.getStats()})),_defineProperty$4(_assertThisInitialized$3(e),"destroy",(function(){var t;e.hls&&(e.hls.destroy(),e.hls=null),null===(t=e.pluginExtension)||void 0===t||t.destroy(),e.pluginExtension=null})),_defineProperty$4(_assertThisInitialized$3(e),"_onSwitchSubtitle",(function(t){var r,n=t.lang;null===(r=e.hls)||void 0===r||r.switchSubtitleStream(n)})),_defineProperty$4(_assertThisInitialized$3(e),"_onSwitchURL",(function(t,r){var n=_assertThisInitialized$3(e),i=n.player,a=n.hls;if(a){var o=parseSwitchUrlArgs(r,_assertThisInitialized$3(e));i.config.url=t,a.switchURL(t,o).catch((function(e){}))}})),e}return _createClass$4(r,[{key:"core",get:function(){return this.hls}},{key:"version",get:function(){var e;return null===(e=this.hls)||void 0===e?void 0:e.version}},{key:"softDecode",get:function(){var e,t,r=null===(e=this.player)||void 0===e||null===(t=e.config)||void 0===t?void 0:t.mediaType;return!!r&&"video"!==r&&"audio"!==r}},{key:"beforePlayerInit",value:function(){var e,t=this,r=new Promise((function(t,r){e=t})),n=this.player.config;if(n.url||n.__allowHlsEmptyUrl__){this.hls&&this.hls.destroy(),this.player.switchURL=this._onSwitchURL;var i,a,o=n.hls||{};if(o.innerDegrade=o.innerDegrade||n.innerDegrade,null!==o.disconnectTime&&void 0!==o.disconnectTime||(o.disconnectTime=0),this.hls=new Hls(_objectSpread2$1({softDecode:this.softDecode,isLive:n.isLive,media:this.player.media||this.player.video,startTime:n.startTime,url:n.url},o)),this.softDecode)e(!0);else BasePlugin.defineGetterOrSetter(this.player,{url:{get:function(){var e,r;return null===(e=t.hls)||void 0===e||null===(r=e.media)||void 0===r?void 0:r.src},configurable:!0}}),null!==(i=this.hls.media)&&void 0!==i&&i.src?this.hls.on("sourceAttached",(function(){e(!0)})):e(!0);if(this.softDecode&&(this.pluginExtension=new PluginExtension(_objectSpread2$1({isLive:n.isLive,media:this.player.video},o),this),this.player.forceDegradeToVideo=function(){for(var e,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return null===(e=t.pluginExtension)||void 0===e?void 0:e.forceDegradeToVideo.apply(e,n)}),n.isLive)null===(a=this.player)||void 0===a||a.useHooks("replay",(function(){var e;return null===(e=t.hls)||void 0===e?void 0:e.replay()}));return this.on(SWITCH_SUBTITLE,this._onSwitchSubtitle),this.on(URL_CHANGE,this._onSwitchURL),this.on(DESTROY,this.destroy),this._transError(),this._transCoreEvent(EVENT$2.TTFB),this._transCoreEvent(EVENT$2.LOAD_START),this._transCoreEvent(EVENT$2.LOAD_RESPONSE_HEADERS),this._transCoreEvent(EVENT$2.LOAD_COMPLETE),this._transCoreEvent(EVENT$2.LOAD_RETRY),this._transCoreEvent(EVENT$2.SOURCEBUFFER_CREATED),this._transCoreEvent(EVENT$2.REMOVE_BUFFER),this._transCoreEvent(EVENT$2.BUFFEREOS),this._transCoreEvent(EVENT$2.KEYFRAME),this._transCoreEvent(EVENT$2.METADATA_PARSED),this._transCoreEvent(EVENT$2.SEI),this._transCoreEvent(EVENT$2.SEI_IN_TIME),this._transCoreEvent(EVENT$2.SPEED),this._transCoreEvent(EVENT$2.HLS_MANIFEST_LOADED),this._transCoreEvent(EVENT$2.HLS_LEVEL_LOADED),this._transCoreEvent(EVENT$2.STREAM_EXCEPTION),this._transCoreEvent(EVENT$2.SWITCH_URL_SUCCESS),this._transCoreEvent(EVENT$2.SWITCH_URL_FAILED),this._transCoreEvent(Event$1.NO_AUDIO_TRACK),this._transCoreEvent(Event$1.STREAM_PARSED),this._transCoreEvent(Event$1.SUBTITLE_SEGMENTS),this._transCoreEvent(Event$1.SUBTITLE_PLAYLIST),n.url&&this.hls.load(n.url,!0).catch((function(e){})),r}e()}},{key:"_transError",value:function(){var e=this;this.hls.on(Event$1.ERROR,(function(t){e.player&&e.player.emit(ERROR,new Errors(e.player,t))}))}},{key:"_transCoreEvent",value:function(e){var t=this;this.hls.on(e,(function(r){t.player&&(t.player.emit("core_event",_objectSpread2$1(_objectSpread2$1({},r),{},{eventName:e})),e===EVENT$2.SEI_IN_TIME&&t.hls.hasSubtitle&&t._emitSeiPaylodTime(r))}))}},{key:"_emitSeiPaylodTime",value:function(e){try{var t=JSON.parse(Array.from(e.data.payload).map((function(e){return String.fromCharCode(e)})).join("").slice(0,-1));if(!t.rtmp_dts)return;this.player.emit("core_event",{eventName:Event$1.SEI_PAYLOAD_TIME,time:t.rtmp_dts})}catch(e){}}}],[{key:"pluginName",get:function(){return"hls"}},{key:"isSupported",value:function(e,t){return Hls.isSupported(e,t)}}]),r}();_defineProperty$4(HlsPlugin,"Hls",Hls),_defineProperty$4(HlsPlugin,"EVENT",Event$1);var shakaPlayer_compiled={};
|
|
2
|
+
/*
|
|
3
|
+
@license
|
|
4
|
+
Shaka Player
|
|
5
|
+
Copyright 2016 Google LLC
|
|
6
|
+
SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/!function(e){!function(){var t="undefined"!=typeof window?window:commonjsGlobal,r={};for(var n in function(e,t,r){var n,i="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,r){e!=Array.prototype&&e!=Object.prototype&&(e[t]=r.value)},a=void 0!==e&&e===this?this:void 0!==t&&null!=t?t:this;function o(){o=function(){},a.Symbol||(a.Symbol=u)}var s,u=(s=0,function(e){return"jscomp_symbol_"+(e||"")+s++});function c(){o();var e=a.Symbol.iterator;e||(e=a.Symbol.iterator=a.Symbol("iterator")),"function"!=typeof Array.prototype[e]&&i(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return l(this)}}),c=function(){}}function l(e){var t=0;return d((function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}))}function d(e){return c(),(e={next:e})[a.Symbol.iterator]=function(){return this},e}function h(e){c();var t=e[Symbol.iterator];return t?t.call(e):l(e)}function f(e,t){if(t){for(var r=a,n=e.split("."),o=0;o<n.length-1;o++){var s=n[o];s in r||(r[s]={}),r=r[s]}(s=t(o=r[n=n[n.length-1]]))!=o&&null!=s&&i(r,n,{configurable:!0,writable:!0,value:s})}}function p(e){return function(e){function t(t){return e.next(t)}function r(t){return e.throw(t)}return new Promise((function(n,i){!function e(a){a.done?n(a.value):Promise.resolve(a.value).then(t,r).then(e,i)}(e.next())}))}(e())}f("Promise",(function(e){function t(e){this.h=0,this.l=void 0,this.g=[];var t=this.i();try{e(t.resolve,t.reject)}catch(e){t.reject(e)}}function r(){this.g=null}function n(e){return e instanceof t?e:new t((function(t){t(e)}))}if(e)return e;r.prototype.h=function(e){null==this.g&&(this.g=[],this.j()),this.g.push(e)},r.prototype.j=function(){var e=this;this.i((function(){e.m()}))};var i=a.setTimeout;r.prototype.i=function(e){i(e,0)},r.prototype.m=function(){for(;this.g&&this.g.length;){var e=this.g;this.g=[];for(var t=0;t<e.length;++t){var r=e[t];e[t]=null;try{r()}catch(e){this.l(e)}}}this.g=null},r.prototype.l=function(e){this.i((function(){throw e}))},t.prototype.i=function(){function e(e){return function(n){r||(r=!0,e.call(t,n))}}var t=this,r=!1;return{resolve:e(this.C),reject:e(this.j)}},t.prototype.C=function(e){if(e===this)this.j(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof t)this.F(e);else{e:switch(typeof e){case"object":var r=null!=e;break e;case"function":r=!0;break e;default:r=!1}r?this.A(e):this.m(e)}},t.prototype.A=function(e){var t=void 0;try{t=e.then}catch(e){return void this.j(e)}"function"==typeof t?this.J(t,e):this.m(e)},t.prototype.j=function(e){this.o(2,e)},t.prototype.m=function(e){this.o(1,e)},t.prototype.o=function(e,t){if(0!=this.h)throw Error("Cannot settle("+e+", "+t+"): Promise already settled in state"+this.h);this.h=e,this.l=t,this.u()},t.prototype.u=function(){if(null!=this.g){for(var e=0;e<this.g.length;++e)o.h(this.g[e]);this.g=null}};var o=new r;return t.prototype.F=function(e){var t=this.i();e.nc(t.resolve,t.reject)},t.prototype.J=function(e,t){var r=this.i();try{e.call(t,r.resolve,r.reject)}catch(e){r.reject(e)}},t.prototype.then=function(e,r){function n(e,t){return"function"==typeof e?function(t){try{i(e(t))}catch(e){a(e)}}:t}var i,a,o=new t((function(e,t){i=e,a=t}));return this.nc(n(e,i),n(r,a)),o},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype.nc=function(e,t){function r(){switch(n.h){case 1:e(n.l);break;case 2:t(n.l);break;default:throw Error("Unexpected state: "+n.h)}}var n=this;null==this.g?o.h(r):this.g.push(r)},t.resolve=n,t.reject=function(e){return new t((function(t,r){r(e)}))},t.race=function(e){return new t((function(t,r){for(var i=h(e),a=i.next();!a.done;a=i.next())n(a.value).nc(t,r)}))},t.all=function(e){var r=h(e),i=r.next();return i.done?n([]):new t((function(e,t){function a(t){return function(r){o[t]=r,0==--s&&e(o)}}var o=[],s=0;do{o.push(void 0),s++,n(i.value).nc(a(o.length-1),t),i=r.next()}while(!i.done)}))},t})),f("Promise.prototype.finally",(function(e){return e||function(e){return this.then((function(t){return Promise.resolve(e()).then((function(){return t}))}),(function(t){return Promise.resolve(e()).then((function(){throw t}))}))}}));var m,y="function"==typeof Object.create?Object.create:function(e){function t(){}return t.prototype=e,new t};if("function"==typeof Object.setPrototypeOf)m=Object.setPrototypeOf;else{var g;e:{var v={};try{v.__proto__={a:!0},g=v.a;break e}catch(s){}g=!1}m=g?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null}var b=m;function _(e,t){if(e.prototype=y(t.prototype),e.prototype.constructor=e,b)b(e,t);else for(var r in t)if("prototype"!=r)if(Object.defineProperties){var n=Object.getOwnPropertyDescriptor(t,r);n&&Object.defineProperty(e,r,n)}else e[r]=t[r];e.Lg=t.prototype}function A(){this.l=!1,this.i=null,this.B=void 0,this.s=1,this.h=this.j=0,this.o=this.g=null}function T(e){if(e.l)throw new TypeError("Generator is already running");e.l=!0}function E(e,t){e.g={ce:t,ne:!0},e.s=e.j||e.h}function S(e,t,r){return e.s=r,{value:t}}function $(e){e.s=0}function I(e,t,r){e.j=t,null!=r&&(e.h=r)}function w(e,t){e.j=0,e.h=t||0}function R(e,t){e.s=t,e.j=0}function k(e){e.j=0;var t=e.g.ce;return e.g=null,t}function P(e){e.o=[e.g],e.j=0,e.h=0}function C(e,t){var r=e.o.splice(0)[0];(r=e.g=e.g||r)?r.ne?e.s=e.j||e.h:null!=r.I&&e.h<r.I?(e.s=r.I,e.g=null):e.s=e.h:e.s=t}function x(e){this.g=new A,this.h=e}function L(e,t,r,n){try{var i=t.call(e.g.i,r);if(!(i instanceof Object))throw new TypeError("Iterator result "+i+" is not an object");if(!i.done)return e.g.l=!1,i;var a=i.value}catch(t){return e.g.i=null,E(e.g,t),O(e)}return e.g.i=null,n.call(e.g,a),O(e)}function O(e){for(;e.g.s;)try{var t=e.h(e.g);if(t)return e.g.l=!1,{value:t.value,done:!1}}catch(t){e.g.B=void 0,E(e.g,t)}if(e.g.l=!1,e.g.g){if(t=e.g.g,e.g.g=null,t.ne)throw t.ce;return{value:t.return,done:!0}}return{value:void 0,done:!0}}function D(e){this.next=function(t){return T(e.g),e.g.i?t=L(e,e.g.i.next,t,e.g.m):(e.g.m(t),t=O(e)),t},this.throw=function(t){return T(e.g),e.g.i?t=L(e,e.g.i.throw,t,e.g.m):(E(e.g,t),t=O(e)),t},this.return=function(t){return function(e,t){T(e.g);var r=e.g.i;return r?L(e,"return"in r?r.return:function(e){return{value:e,done:!0}},t,e.g.return):(e.g.return(t),O(e))}(e,t)},c(),this[Symbol.iterator]=function(){return this}}function M(e,t){return D.prototype=e.prototype,new D(new x(t))}function Z(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function V(e,t,r){e instanceof String&&(e=String(e));for(var n=e.length,i=0;i<n;i++){var a=e[i];if(t.call(r,a,i,e))return{le:i,Qe:a}}return{le:-1,Qe:void 0}}function N(e,t,r){if(null==e)throw new TypeError("The 'this' value for String.prototype."+r+" must not be null or undefined");if(t instanceof RegExp)throw new TypeError("First argument to String.prototype."+r+" must not be a regular expression");return e+""}A.prototype.m=function(e){this.B=e},A.prototype.return=function(e){this.g={return:e},this.s=this.h},A.prototype.I=function(e){this.s=e},f("Array.prototype.keys",(function(e){return e||function(){return function(e,t){c(),e instanceof String&&(e+="");var r=0,n={next:function(){if(r<e.length){var i=r++;return{value:t(i,e[i]),done:!1}}return n.next=function(){return{done:!0,value:void 0}},n.next()}};return n[Symbol.iterator]=function(){return n},n}(this,(function(e){return e}))}})),f("WeakMap",(function(e){function t(e){if(this.g=(s+=Math.random()+1).toString(),e){o(),c(),e=h(e);for(var t;!(t=e.next()).done;)t=t.value,this.set(t[0],t[1])}}function r(e){Z(e,a)||i(e,a,{value:{}})}function n(e){var t=Object[e];t&&(Object[e]=function(e){return r(e),t(e)})}if(function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),r=Object.seal({}),n=new e([[t,2],[r,3]]);return 2==n.get(t)&&3==n.get(r)&&(n.delete(t),n.set(r,4),!n.has(t)&&4==n.get(r))}catch(e){return!1}}())return e;var a="$jscomp_hidden_"+Math.random();n("freeze"),n("preventExtensions"),n("seal");var s=0;return t.prototype.set=function(e,t){if(r(e),!Z(e,a))throw Error("WeakMap key fail: "+e);return e[a][this.g]=t,this},t.prototype.get=function(e){return Z(e,a)?e[a][this.g]:void 0},t.prototype.has=function(e){return Z(e,a)&&Z(e[a],this.g)},t.prototype.delete=function(e){return!(!Z(e,a)||!Z(e[a],this.g))&&delete e[a][this.g]},t})),f("Map",(function(e){function t(){var e={};return e.Na=e.next=e.head=e}function r(e,t){var r=e.g;return d((function(){if(r){for(;r.head!=e.g;)r=r.Na;for(;r.next!=r.head;)return r=r.next,{done:!1,value:t(r)};r=null}return{done:!0,value:void 0}}))}function n(e,t){var r=t&&typeof t;"object"==r||"function"==r?a.has(t)?r=a.get(t):(r=""+ ++s,a.set(t,r)):r="p_"+t;var n=e.h[r];if(n&&Z(e.h,r))for(var i=0;i<n.length;i++){var o=n[i];if(t!=t&&o.key!=o.key||t===o.key)return{id:r,list:n,index:i,ga:o}}return{id:r,list:n,index:-1,ga:void 0}}function i(e){if(this.h={},this.g=t(),this.size=0,e){e=h(e);for(var r;!(r=e.next()).done;)r=r.value,this.set(r[0],r[1])}}if(function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),r=new e(h([[t,"s"]]));if("s"!=r.get(t)||1!=r.size||r.get({x:4})||r.set({x:4},"t")!=r||2!=r.size)return!1;var n=r.entries(),i=n.next();return!i.done&&i.value[0]==t&&"s"==i.value[1]&&!((i=n.next()).done||4!=i.value[0].x||"t"!=i.value[1]||!n.next().done)}catch(e){return!1}}())return e;o(),c();var a=new WeakMap;i.prototype.set=function(e,t){var r=n(this,e);return r.list||(r.list=this.h[r.id]=[]),r.ga?r.ga.value=t:(r.ga={next:this.g,Na:this.g.Na,head:this.g,key:e,value:t},r.list.push(r.ga),this.g.Na.next=r.ga,this.g.Na=r.ga,this.size++),this},i.prototype.delete=function(e){return!(!(e=n(this,e)).ga||!e.list)&&(e.list.splice(e.index,1),e.list.length||delete this.h[e.id],e.ga.Na.next=e.ga.next,e.ga.next.Na=e.ga.Na,e.ga.head=null,this.size--,!0)},i.prototype.clear=function(){this.h={},this.g=this.g.Na=t(),this.size=0},i.prototype.has=function(e){return!!n(this,e).ga},i.prototype.get=function(e){return(e=n(this,e).ga)&&e.value},i.prototype.entries=function(){return r(this,(function(e){return[e.key,e.value]}))},i.prototype.keys=function(){return r(this,(function(e){return e.key}))},i.prototype.values=function(){return r(this,(function(e){return e.value}))},i.prototype.forEach=function(e,t){for(var r,n=this.entries();!(r=n.next()).done;)r=r.value,e.call(t,r[1],r[0],this)},i.prototype[Symbol.iterator]=i.prototype.entries;var s=0;return i})),f("Set",(function(e){function t(e){if(this.g=new Map,e){e=h(e);for(var t;!(t=e.next()).done;)this.add(t.value)}this.size=this.g.size}return function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),r=new e(h([t]));if(!r.has(t)||1!=r.size||r.add(t)!=r||1!=r.size||r.add({x:4})!=r||2!=r.size)return!1;var n=r.entries(),i=n.next();return!i.done&&i.value[0]==t&&i.value[1]==t&&(!(i=n.next()).done&&i.value[0]!=t&&4==i.value[0].x&&i.value[1]==i.value[0]&&n.next().done)}catch(e){return!1}}()?e:(o(),c(),t.prototype.add=function(e){return this.g.set(e,e),this.size=this.g.size,this},t.prototype.delete=function(e){return e=this.g.delete(e),this.size=this.g.size,e},t.prototype.clear=function(){this.g.clear(),this.size=0},t.prototype.has=function(e){return this.g.has(e)},t.prototype.entries=function(){return this.g.entries()},t.prototype.values=function(){return this.g.values()},t.prototype.keys=t.prototype.values,t.prototype[Symbol.iterator]=t.prototype.values,t.prototype.forEach=function(e,t){var r=this;this.g.forEach((function(n){return e.call(t,n,n,r)}))},t)})),f("Array.prototype.findIndex",(function(e){return e||function(e,t){return V(this,e,t).le}})),f("Array.prototype.find",(function(e){return e||function(e,t){return V(this,e,t).Qe}})),f("String.prototype.startsWith",(function(e){return e||function(e,t){for(var r=N(this,e,"startsWith"),n=r.length,i=e.length,a=Math.max(0,Math.min(0|t,r.length)),o=0;o<i&&a<n;)if(r[a++]!=e[o++])return!1;return o>=i}})),f("Object.is",(function(e){return e||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}})),f("Array.prototype.includes",(function(e){return e||function(e,t){var r=this;r instanceof String&&(r=String(r));var n=r.length,i=t||0;for(0>i&&(i=Math.max(i+n,0));i<n;i++){var a=r[i];if(a===e||Object.is(a,e))return!0}return!1}})),f("String.prototype.includes",(function(e){return e||function(e,t){return-1!==N(this,e,"includes").indexOf(e,t||0)}})),f("Array.from",(function(e){return e||function(e,t,r){c(),t=null!=t?t:function(e){return e};var n=[],i=e[Symbol.iterator];if("function"==typeof i)for(e=i.call(e);!(i=e.next()).done;)n.push(t.call(r,i.value));else{i=e.length;for(var a=0;a<i;a++)n.push(t.call(r,e[a]))}return n}}));var G="function"==typeof Object.assign?Object.assign:function(e,t){for(var r=1;r<arguments.length;r++){var n=arguments[r];if(n)for(var i in n)Z(n,i)&&(e[i]=n[i])}return e};f("Object.assign",(function(e){return e||G}));var X=this;function W(e,t){var r,n=e.split("."),i=X;n[0]in i||!i.execScript||i.execScript("var "+n[0]);for(;n.length&&(r=n.shift());)n.length||void 0===t?i=i[r]?i[r]:i[r]={}:i[r]=t}function U(e,t){function r(){}r.prototype=t.prototype,e.Lg=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.Wg=function(e,r,n){return t.prototype[r].apply(e,Array.prototype.slice.call(arguments,2))}}function F(e){this.i=Math.exp(Math.log(.5)/e),this.h=this.g=0}function B(e,t,r){var n=Math.pow(e.i,t);r=r*(1-n)+n*e.g,isNaN(r)||(e.g=r,e.h+=t)}function Y(e){return e.g/(1-Math.pow(e.i,e.h))}function j(){this.h=new F(2),this.i=new F(5),this.g=0}X.g=!0,j.prototype.getBandwidthEstimate=function(e){return 128e3>this.g?e:Math.min(Y(this.h),Y(this.i))};var K={sb:0,kc:function(){},ba:function(){},error:function(){},v:function(){},info:function(){},debug:function(){},K:function(){},O:function(){}};function H(e,t,r,n){for(var i=[],a=3;a<arguments.length;++a)i[a-3]=arguments[a];this.severity=e,this.category=t,this.code=r,this.data=i,this.handled=!1}e.console&&e.console.log.bind&&(K.ba=console.warn.bind(console),K.kc=console.error.bind(console),1<=K.sb&&(K.error=console.error.bind(console)),2<=K.sb&&(K.v=console.warn.bind(console)),3<=K.sb&&(K.info=console.info.bind(console)),4<=K.sb&&(K.debug=console.log.bind(console)),5<=K.sb&&(K.K=console.debug.bind(console)),6<=K.sb&&(K.O=console.debug.bind(console))),W("shaka.util.Error",H),H.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},H.Severity={RECOVERABLE:1,CRITICAL:2},H.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},H.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,MALFORMED_TEST_URI:1008,UNEXPECTED_TEST_REQUEST:1009,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,UNABLE_TO_EXTRACT_CUE_START_TIME:2009,BUFFER_READ_OUT_OF_BOUNDS:3e3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005,MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011,WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,TRANSMUXING_FAILED:3018,UNABLE_TO_GUESS_MANIFEST_TYPE:4e3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003,DASH_EMPTY_PERIOD:4004,DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,UNPLAYABLE_PERIOD:4011,RESTRICTIONS_CANNOT_BE_MET:4012,NO_PERIODS:4014,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_MASTER_PLAYLIST_NOT_PROVIDED:4022,HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026,DASH_UNSUPPORTED_XLINK_ACTUATE:4027,DASH_XLINK_DEPTH_LIMIT:4028,HLS_COULD_NOT_PARSE_SEGMENT_START_TIME:4030,CONTENT_UNSUPPORTED_BY_BROWSER:4032,CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM:4033,HLS_AES_128_ENCRYPTION_NOT_SUPPORTED:4034,HLS_INTERNAL_SKIP_STREAM:4035,INVALID_STREAMS_CHOSEN:5005,NO_RECOGNIZED_KEY_SYSTEMS:6e3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006,LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012,OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,SERVER_CERTIFICATE_REQUIRED:6015,INIT_DATA_TRANSFORM_ERROR:6016,LOAD_INTERRUPTED:7e3,OPERATION_ABORTED:7001,NO_VIDEO_ELEMENT:7002,CAST_API_UNAVAILABLE:8e3,NO_CAST_RECEIVERS:8001,ALREADY_CASTING:8002,UNEXPECTED_CAST_ERROR:8003,CAST_CANCELED_BY_USER:8004,CAST_CONNECTION_TIMED_OUT:8005,CAST_RECEIVER_APP_UNAVAILABLE:8006,STORAGE_NOT_SUPPORTED:9e3,INDEXED_DB_ERROR:9001,DEPRECATED_OPERATION_ABORTED:9002,REQUESTED_ITEM_NOT_FOUND:9003,MALFORMED_OFFLINE_URI:9004,CANNOT_STORE_LIVE_OFFLINE:9005,STORE_ALREADY_IN_PROGRESS:9006,NO_INIT_DATA_FOR_OFFLINE:9007,LOCAL_PLAYER_INSTANCE_REQUIRED:9008,NEW_KEY_OPERATION_NOT_SUPPORTED:9011,KEY_NOT_FOUND:9012,MISSING_STORAGE_CELL:9013};
|
|
8
|
+
/*
|
|
9
|
+
@license
|
|
10
|
+
Copyright 2008 The Closure Library Authors
|
|
11
|
+
SPDX-License-Identifier: Apache-2.0
|
|
12
|
+
*/
|
|
13
|
+
var z=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;
|
|
14
|
+
/*
|
|
15
|
+
@license
|
|
16
|
+
Copyright 2006 The Closure Library Authors
|
|
17
|
+
SPDX-License-Identifier: Apache-2.0
|
|
18
|
+
*/function J(e){var t;e instanceof J?(Q(this,e.Ba),this.pb=e.pb,this.Aa=e.Aa,q(this,e.Ob),this.pa=e.pa,ee(this,e.g.clone()),this.bb=e.bb):e&&(t=String(e).match(z))?(Q(this,t[1]||"",!0),this.pb=te(t[2]||""),this.Aa=te(t[3]||"",!0),q(this,t[4]),this.pa=te(t[5]||"",!0),ee(this,t[6]||"",!0),this.bb=te(t[7]||"")):this.g=new ce(null)}function Q(e,t,r){e.Ba=r?te(t,!0):t,e.Ba&&(e.Ba=e.Ba.replace(/:$/,""))}function q(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.Ob=t}else e.Ob=null}function ee(e,t,r){t instanceof ce?e.g=t:(r||(t=re(t,se)),e.g=new ce(t))}function te(e,t){return e?t?decodeURI(e):decodeURIComponent(e):""}function re(e,t,r){return"string"==typeof e?(e=encodeURI(e).replace(t,ne),r&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ne(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}(n=J.prototype).Ba="",n.pb="",n.Aa="",n.Ob=null,n.pa="",n.bb="",n.toString=function(){var e=[],t=this.Ba;if(t&&e.push(re(t,ie,!0),":"),t=this.Aa){e.push("//");var r=this.pb;r&&e.push(re(r,ie,!0),"@"),e.push(encodeURIComponent(t).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(t=this.Ob)&&e.push(":",String(t))}return(t=this.pa)&&(this.Aa&&"/"!=t.charAt(0)&&e.push("/"),e.push(re(t,"/"==t.charAt(0)?oe:ae,!0))),(t=this.g.toString())&&e.push("?",t),(t=this.bb)&&e.push("#",re(t,ue)),e.join("")},n.resolve=function(e){var t=this.clone();"data"===t.Ba&&(t=new J);var r=!!e.Ba;r?Q(t,e.Ba):r=!!e.pb,r?t.pb=e.pb:r=!!e.Aa,r?t.Aa=e.Aa:r=null!=e.Ob;var n=e.pa;if(r)q(t,e.Ob);else if(r=!!e.pa){if("/"!=n.charAt(0))if(this.Aa&&!this.pa)n="/"+n;else{var i=t.pa.lastIndexOf("/");-1!=i&&(n=t.pa.substr(0,i+1)+n)}if(".."==n||"."==n)n="";else if(-1!=n.indexOf("./")||-1!=n.indexOf("/.")){i=0==n.lastIndexOf("/",0),n=n.split("/");for(var a=[],o=0;o<n.length;){var s=n[o++];"."==s?i&&o==n.length&&a.push(""):".."==s?((1<a.length||1==a.length&&""!=a[0])&&a.pop(),i&&o==n.length&&a.push("")):(a.push(s),i=!0)}n=a.join("/")}}return r?t.pa=n:r=""!==e.g.toString(),r?ee(t,e.g.clone()):r=!!e.bb,r&&(t.bb=e.bb),t},n.clone=function(){return new J(this)};var ie=/[#\/\?@]/g,ae=/[#\?:]/g,oe=/[#\?]/g,se=/[#\?@]/g,ue=/#/g;function ce(e){this.g=e||null}(n=ce.prototype).na=null,n.qc=null,n.add=function(e,t){if(!this.na&&(this.na={},this.qc=0,this.g))for(var r=this.g.split("&"),n=0;n<r.length;n++){var i=r[n].indexOf("="),a=null;if(0<=i){var o=r[n].substring(0,i);a=r[n].substring(i+1)}else o=r[n];o=decodeURIComponent(o.replace(/\+/g," ")),a=a||"",this.add(o,decodeURIComponent(a.replace(/\+/g," ")))}return this.g=null,(r=this.na.hasOwnProperty(e)&&this.na[e])||(this.na[e]=r=[]),r.push(t),this.qc++,this},n.toString=function(){if(this.g)return this.g;if(!this.na)return"";var e,t=[];for(e in this.na)for(var r=encodeURIComponent(e),n=this.na[e],i=0;i<n.length;i++){var a=r;""!==n[i]&&(a+="="+encodeURIComponent(n[i])),t.push(a)}return this.g=t.join("&")},n.clone=function(){var e=new ce;if(e.g=this.g,this.na){var t,r={};for(t in this.na)r[t]=this.na[t].concat();e.na=r,e.qc=this.qc}return e};var le={df:function(e,t){return e.reduce(function(e,t,r){return t.catch(e.bind(null,r))}.bind(null,t),Promise.reject())},Rc:function(e,t){return e.concat(t)},Bc:function(){},Ra:function(e){return null!=e}};function de(e,t){if(0==t.length)return e;var r=t.map((function(e){return new J(e)}));return e.map((function(e){return new J(e)})).map((function(e){return r.map(e.resolve.bind(e))})).reduce(le.Rc,[]).map((function(e){return e.toString()}))}function he(e,t){return{keySystem:e,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:t||[],keyIds:[]}}var fe={Za:"video",Sb:"audio",za:"text",Ug:"image",Sg:"application"},pe=1/15;function me(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.resolve=e,r.reject=t,r}function ye(e){if(!e)return"";239==(e=new Uint8Array(e))[0]&&187==e[1]&&191==e[2]&&(e=e.subarray(3)),e=Ae(e),e=escape(e);try{return decodeURIComponent(e)}catch(e){throw new H(2,2,2004)}}function ge(e,t,r){if(!e)return"";if(!r&&0!=e.byteLength%2)throw K.error("Data has an incorrect length, must be even."),new H(2,2,2004);if(e instanceof ArrayBuffer)var n=e;else(r=new Uint8Array(e.byteLength)).set(new Uint8Array(e)),n=r.buffer;e=Math.floor(e.byteLength/2),r=new Uint16Array(e),n=new DataView(n);for(var i=0;i<e;i++)r[i]=n.getUint16(2*i,t);return Ae(r)}function ve(e){var t=new Uint8Array(e);if(239==t[0]&&187==t[1]&&191==t[2])return ye(t);if(254==t[0]&&255==t[1])return ge(t.subarray(2),!1);if(255==t[0]&&254==t[1])return ge(t.subarray(2),!0);var r=function(e,t){return e.byteLength<=t||32<=e[t]&&126>=e[t]}.bind(null,t);if(K.debug("Unable to find byte-order-mark, making an educated guess."),0==t[0]&&0==t[2])return ge(e,!1);if(0==t[1]&&0==t[3])return ge(e,!0);if(r(0)&&r(1)&&r(2)&&r(3))return ye(e);throw new H(2,2,2003)}function be(e){e=encodeURIComponent(e),e=unescape(e);for(var t=new Uint8Array(e.length),r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t.buffer}function _e(e,t){for(var r=new Uint8Array(2*e.length),n=new DataView(r.buffer),i=0;i<e.length;++i)n.setUint16(2*i,e.charCodeAt(i),t);return r.buffer}function Ae(e){if(!Te)for(var t=function(e){try{var t=new Uint8Array(e);return 0<String.fromCharCode.apply(null,t).length}catch(e){return!1}},r={size:65536};0<r.size;(r={size:r.size}).size/=2)if(t(r.size)){Te=function(e){return function(t){for(var r="",n=0;n<t.length;n+=e.size)r+=String.fromCharCode.apply(null,t.subarray(n,n+e.size));return r}}(r);break}return Te(e)}me.prototype.resolve=function(){},me.prototype.reject=function(){},W("shaka.util.StringUtils.fromUTF8",ye),W("shaka.util.StringUtils.fromUTF16",ge),W("shaka.util.StringUtils.fromBytesAutoDetect",ve),W("shaka.util.StringUtils.toUTF8",be),W("shaka.util.StringUtils.toUTF16",_e);var Te=null;W("shaka.util.StringUtils.resetFromCharCode",(function(){Te=null}));var Ee={Mc:function(t,r){var n=Ae(t);return r=null==r||r,n=e.btoa(n).replace(/\+/g,"-").replace(/\//g,"_"),r?n:n.replace(/=*$/,"")}};function Se(){this.g=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0}),this.h=null,this.l=[],this.i=[],this.j=!1,this.g.on("data",this.o.bind(this)),this.g.on("done",this.m.bind(this))}function $e(t,r){return!(!e.muxjs||"mp2t"!=t.toLowerCase().split(";")[0].split("/")[1])&&(r?MediaSource.isTypeSupported(Ie(r,t)):MediaSource.isTypeSupported(Ie("audio",t))||MediaSource.isTypeSupported(Ie("video",t)))}function Ie(e,t){var r=t.replace(/mp2t/i,"mp4");"audio"==e&&(r=r.replace("video","audio"));var n=/avc1\.(66|77|100)\.(\d+)/.exec(r);if(n){var i="avc1.",a=n[1],o=Number(n[2]);i=("66"==a?i+"4200":"77"==a?i+"4d00":i+"6400")+(o>>4).toString(16),i+=(15&o).toString(16),r=r.replace(n[0],i)}return r}function we(e){this.h=e,this.g=null}function Re(e){this.h=e,this.g=null}function ke(e,t){var r={maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0};this.o=null==e.maxAttempts?r.maxAttempts:e.maxAttempts,this.j=null==e.baseDelay?r.baseDelay:e.baseDelay,this.m=null==e.fuzzFactor?r.fuzzFactor:e.fuzzFactor,this.l=null==e.backoffFactor?r.backoffFactor:e.backoffFactor,this.g=0,this.h=this.j,(this.i=void 0!==t&&t)&&(this.g=1)}function Pe(e){return p((function t(){var r,n;return M(t,(function(t){switch(t.s){case 1:if(e.g>=e.o){if(!e.i)return t.return(Promise.reject());e.g=1,e.h=e.j}return r=e.g,e.g++,0==r?t.return():(n=e.h*(1+(2*Math.random()-1)*e.m),S(t,new Promise((function(e){new Re(e).V(n/1e3)})),2));case 2:e.h*=e.l,$(t)}}))}))}function Ce(e,t){this.promise=e,this.se=t,this.g=!1}function xe(e){return new Ce(Promise.reject(e),(function(){return Promise.resolve()}))}function Le(){var e=Promise.reject(new H(2,7,7001));return e.catch((function(){})),new Ce(e,(function(){return Promise.resolve()}))}function Oe(e){return new Ce(Promise.resolve(e),(function(){return Promise.resolve()}))}function De(e){return new Ce(e,(function(){return e.catch((function(){}))}))}function Me(e){return new Ce(Promise.all(e.map((function(e){return e.promise}))),(function(){return Promise.all(e.map((function(e){return e.abort()})))}))}function Ze(t,r){for(var n in r=void 0===r?{}:r)this[n]=r[n];this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=e.performance&&e.performance.now?e.performance.now():Date.now(),this.type=t,this.isTrusted=!1,this.target=this.currentTarget=null,this.g=!1}function Ve(){this.g={}}function Ne(){this.hd=new Ve,this.jc=this}function Ge(e){var t=new Set;return function e(r){switch(typeof r){case"undefined":case"boolean":case"number":case"string":case"symbol":case"function":return r;default:if(!r||r.buffer&&r.buffer.constructor==ArrayBuffer)return r;if(t.has(r))return null;var n=r.constructor==Array;if(r.constructor!=Object&&!n)return null;t.add(r);var i,a=n?[]:{};for(i in r)a[i]=e(r[i]);return n&&(a.length=r.length),a}}(e)}function Xe(e,t){return!("number"!=typeof e||"number"!=typeof t||!isNaN(e)||!isNaN(t))||e===t}function We(e,t){var r=e.indexOf(t);-1<r&&e.splice(r,1)}function Ue(e,t,r){if(r||(r=Xe),e.length!=t.length)return!1;t=t.slice();for(var n={},i=(e=h(e)).next();!i.done;n={item:n.item},i=e.next()){if(n.item=i.value,-1==(i=t.findIndex(function(e){return function(t){return r(e.item,t)}}(n))))return!1;t[i]=t[t.length-1],t.pop()}return 0==t.length}function Fe(){this.g=[]}function Be(e,t){e.g.push(t.finally((function(){We(e.g,t)})))}function Ye(e){Ne.call(this),this.j=!1,this.l=new Fe,this.g=new Set,this.h=new Set,this.i=e||null}W("shaka.util.Uint8ArrayUtils.toBase64",Ee.Mc),Ee.Ja=function(t){t=e.atob(t.replace(/-/g,"+").replace(/_/g,"/"));for(var r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r},W("shaka.util.Uint8ArrayUtils.fromBase64",Ee.Ja),Ee.$c=function(t){for(var r=new Uint8Array(t.length/2),n=0;n<t.length;n+=2)r[n/2]=e.parseInt(t.substr(n,2),16);return r},W("shaka.util.Uint8ArrayUtils.fromHex",Ee.$c),Ee.Nc=function(e){for(var t="",r=0;r<e.length;++r){var n=e[r].toString(16);1==n.length&&(n="0"+n),t+=n}return t},W("shaka.util.Uint8ArrayUtils.toHex",Ee.Nc),Ee.Ha=function(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!=t.length)return!1;for(var r=0;r<e.length;++r)if(e[r]!=t[r])return!1;return!0},W("shaka.util.Uint8ArrayUtils.equal",Ee.Ha),Ee.concat=function(e){for(var t=[],r=0;r<arguments.length;++r)t[r]=arguments[r];for(var n=r=0;n<t.length;++n)r+=t[n].length;r=new Uint8Array(r);for(var i=n=0;i<t.length;++i)r.set(t[i],n),n+=t[i].length;return r},W("shaka.util.Uint8ArrayUtils.concat",Ee.concat),Se.prototype.destroy=function(){return this.g.dispose(),this.g=null,Promise.resolve()},Se.prototype.o=function(e){this.i=e.captions;var t=new Uint8Array(e.data.byteLength+e.initSegment.byteLength);t.set(e.initSegment,0),t.set(e.data,e.initSegment.byteLength),this.l.push(t)},Se.prototype.m=function(){var e={data:Ee.concat.apply(null,this.l),captions:this.i};this.h.resolve(e),this.j=!1},we.prototype.V=function(t){var r=this;this.stop();var n=!0,i=null;return this.g=function(){e.clearTimeout(i),n=!1},i=e.setTimeout((function(){n&&r.h()}),1e3*t),this},we.prototype.stop=function(){this.g&&(this.g(),this.g=null)},W("shaka.util.Timer",Re),Re.prototype.Lc=function(){return this.stop(),this.h(),this},Re.prototype.tickNow=Re.prototype.Lc,Re.prototype.V=function(e){var t=this;return this.stop(),this.g=new we((function(){t.h()})).V(e),this},Re.prototype.tickAfter=Re.prototype.V,Re.prototype.Oa=function(e){var t=this;return this.stop(),this.g=new we((function(){t.g.V(e),t.h()})).V(e),this},Re.prototype.tickEvery=Re.prototype.Oa,Re.prototype.stop=function(){this.g&&(this.g.stop(),this.g=null)},Re.prototype.stop=Re.prototype.stop,W("shaka.util.AbortableOperation",Ce),Ce.failed=xe,Ce.aborted=Le,Ce.completed=Oe,Ce.notAbortable=De,Ce.prototype.abort=function(){return this.g=!0,this.se()},Ce.prototype.abort=Ce.prototype.abort,Ce.all=Me,Ce.prototype.finally=function(e){return this.promise.then((function(){return e(!0)}),(function(){return e(!1)})),this},Ce.prototype.finally=Ce.prototype.finally,Ce.prototype.ca=function(e,t){function r(r){return function(s){if(i.g&&r)a.reject(o);else{var u=r?e:t;u?n=function(e,t,r){try{var n=e(t);return n&&n.promise&&n.abort?(r.resolve(n.promise),function(){return n.abort()}):(r.resolve(n),function(){return Promise.resolve(n).then((function(){}),(function(){}))})}catch(e){return r.reject(e),function(){return Promise.resolve()}}}(u,s,a):(r?a.resolve:a.reject)(s)}}}function n(){return a.reject(o),i.abort()}var i=this,a=new me,o=new H(2,7,7001);return this.promise.then(r(!0),r(!1)),new Ce(a,(function(){return n()}))},Ce.prototype.chain=Ce.prototype.ca,W("shaka.util.FakeEvent",Ze),Ze.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},Ze.prototype.stopImmediatePropagation=function(){this.g=!0},Ze.prototype.stopPropagation=function(){},(n=Ve.prototype).push=function(e,t){this.g.hasOwnProperty(e)?this.g[e].push(t):this.g[e]=[t]},n.get=function(e){return(e=this.g[e])?e.slice():null},n.getAll=function(){var e,t=[];for(e in this.g)t.push.apply(t,this.g[e]);return t},n.remove=function(e,t){var r=this.g[e];if(r)for(var n=0;n<r.length;++n)r[n]==t&&(r.splice(n,1),--n)},n.forEach=function(e){for(var t in this.g)e(t,this.g[t])},n.size=function(){return Object.keys(this.g).length},Ne.prototype.addEventListener=function(e,t){this.hd.push(e,t)},Ne.prototype.removeEventListener=function(e,t){this.hd.remove(e,t)},Ne.prototype.dispatchEvent=function(e){for(var t=this.hd.get(e.type)||[],r=0;r<t.length;++r){e.target=this.jc,e.currentTarget=this.jc;var n=t[r];try{n.handleEvent?n.handleEvent(e):n.call(this,e)}catch(e){K.error("Uncaught exception in event handler",e,e?e.message:null,e?e.stack:null)}if(e.g)break}return e.defaultPrevented},Fe.prototype.destroy=function(){var e=[];return this.g.forEach((function(t){t.promise.catch((function(){})),e.push(t.abort())})),this.g=[],Promise.all(e)},U(Ye,Ne),W("shaka.net.NetworkingEngine",Ye),Ye.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2,APP:3,TIMING:4},Ye.PluginPriority={FALLBACK:1,PREFERRED:2,APPLICATION:3};var je={};function Ke(e,t,r){r=r||3;var n=je[e];(!n||r>=n.priority)&&(je[e]={priority:r,mg:t})}function He(e,t){return{uris:e,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:t,licenseRequestType:null,sessionId:null}}function ze(e,t,r,n,i,a,o){var s=new J(r.uris[i]),u=s.Ba,c=!1;u||(Q(s,u=(u=location.protocol).slice(0,-1)),r.uris[i]=s.toString()),u=u.toLowerCase();var l,d=(u=je[u])?u.mg:null;return d?De(Pe(n)).ca((function(){return e.j?Le():(l=Date.now(),d(r.uris[i],r,t,(function(r,n,i){e.i&&1==t&&(e.i(r,n),c=!0,o.g=i)})))})).ca((function(e){return null==e.timeMs&&(e.timeMs=Date.now()-l),{response:e,Nf:c}}),(function(s){if(s&&7001==s.code)throw s;if(e.j)return Le();if(s&&1==s.severity)return e.dispatchEvent(new Ze("retry",{error:s instanceof H?s:null})),i=(i+1)%r.uris.length,ze(e,t,r,n,i,s,o);throw s||a})):xe(new H(2,1,1e3,s))}function Je(){this.g=0}function Qe(e,t,r){Ce.call(this,e,t),this.h=r}function qe(){}function et(){this.g=new Ve}function tt(e,t,r,n){this.target=e,this.type=t,this.listener=r,this.g=function(e,t){if(null==t)return!1;if("boolean"==typeof t)return t;var r=new Set(["passive","capture"]);return Object.keys(t).filter((function(e){return!r.has(e)})),function(e){var t=rt;if(null==t){t=!1;try{var r={},n={get:function(){return t=!0,!1}};Object.defineProperty(r,"passive",n),Object.defineProperty(r,"capture",n),n=function(){},e.addEventListener("test",n,r),e.removeEventListener("test",n,r)}catch(e){t=!1}rt=t}return t||!1}(e)?t:t.capture||!1}(e,n),this.target.addEventListener(t,r,this.g)}Ye.registerScheme=Ke,Ye.unregisterScheme=function(e){delete je[e]},Ye.prototype.og=function(e){this.g.add(e)},Ye.prototype.registerRequestFilter=Ye.prototype.og,Ye.prototype.Ng=function(e){this.g.delete(e)},Ye.prototype.unregisterRequestFilter=Ye.prototype.Ng,Ye.prototype.bf=function(){this.g.clear()},Ye.prototype.clearAllRequestFilters=Ye.prototype.bf,Ye.prototype.pg=function(e){this.h.add(e)},Ye.prototype.registerResponseFilter=Ye.prototype.pg,Ye.prototype.Og=function(e){this.h.delete(e)},Ye.prototype.unregisterResponseFilter=Ye.prototype.Og,Ye.prototype.cf=function(){this.h.clear()},Ye.prototype.clearAllResponseFilters=Ye.prototype.cf,Ye.defaultRetryParameters=function(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}},Ye.makeRequest=He,Ye.prototype.destroy=function(){return this.j=!0,this.g.clear(),this.h.clear(),this.l.destroy()},Ye.prototype.destroy=Ye.prototype.destroy,Ye.prototype.request=function(e,t){var r=this,n=new Je;if(this.j){var i=Promise.reject(new H(2,7,7001));return i.catch((function(){})),new Qe(i,(function(){return Promise.resolve()}),n)}t.method=t.method||"GET",t.headers=t.headers||{},t.retryParameters=t.retryParameters?Ge(t.retryParameters):{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},t.uris=Ge(t.uris),i=function(e,t,r){for(var n=Oe(void 0),i={},a=(e=h(e.g)).next();!a.done;i={Gd:i.Gd},a=e.next())i.Gd=a.value,n=n.ca(function(e){return function(){return e.Gd(t,r)}}(i));return n.ca(void 0,(function(e){if(e&&7001==e.code)throw e;throw new H(2,1,1006,e)}))}(this,e,t);var a=i.ca((function(){return ze(r,e,t,new ke(t.retryParameters,!1),0,null,n)})),o=a.ca((function(t){return function(e,t,r){for(var n=Oe(void 0),i=(e=h(e.h)).next();!i.done;i=e.next())n=n.ca(i.value.bind(null,t,r.response));return n.ca((function(){return r}),(function(e){if(e&&7001==e.code)throw e;var t=2;throw e instanceof H&&(t=e.severity),new H(t,1,1007,e)}))}(r,e,t)})),s=Date.now(),u=0;i.promise.then((function(){u=Date.now()-s}),(function(){}));var c=0;return a.promise.then((function(){c=Date.now()}),(function(){})),i=new Qe((i=o.ca((function(t){var n=Date.now()-c,i=t.response;return i.timeMs+=u,i.timeMs+=n,t.Nf||!r.i||i.fromCache||1!=e||r.i(i.timeMs,i.data.byteLength),i}),(function(e){throw e&&(e.severity=2),e}))).promise,i.se,n),Be(this.l,i),i},Ye.prototype.request=Ye.prototype.request,Ye.NumBytesRemainingClass=Je,_(Qe,Ce),Ye.PendingRequest=Qe,Qe.all=Me,Qe.notAbortable=De,Qe.completed=Oe,Qe.aborted=Le,Qe.failed=xe,W("shaka.util.IReleasable",qe),qe.prototype.release=function(){},W("shaka.util.EventManager",et),et.prototype.release=function(){this.nb(),this.g=null},et.prototype.release=et.prototype.release,et.prototype.H=function(e,t,r,n){this.g&&(e=new tt(e,t,r,n),this.g.push(t,e))},et.prototype.listen=et.prototype.H,et.prototype.ya=function(e,t,r,n){var i=this;this.H(e,t,(function n(a){i.ta(e,t,n),r(a)}),n)},et.prototype.listenOnce=et.prototype.ya,et.prototype.ta=function(e,t,r){if(this.g)for(var n=this.g.get(t)||[],i=(n=h(n)).next();!i.done;i=n.next())(i=i.value).target!=e||r!=i.listener&&r||(i.ta(),this.g.remove(t,i))},et.prototype.unlisten=et.prototype.ta,et.prototype.nb=function(){if(this.g){for(var e=this.g.getAll(),t=(e=h(e)).next();!t.done;t=e.next())t.value.ta();this.g.g={}}},et.prototype.removeAll=et.prototype.nb,tt.prototype.ta=function(){this.target.removeEventListener(this.type,this.listener,this.g),this.listener=this.target=null,this.g=!1},tt.prototype.unlisten=tt.prototype.ta;var rt=void 0;function nt(e){return new J(e=ve(e)).Aa}function it(e,t,r){function n(e){new DataView(i.buffer).setUint32(a,e.byteLength,!0),a+=4,i.set(e,a),a+=e.byteLength}if(!r||!r.byteLength)throw new H(2,6,6015);t="string"==typeof t?new Uint8Array(_e(t,!0)):new Uint8Array(t),e=_e(e=ve(e),!0);var i=new Uint8Array(12+e.byteLength+t.byteLength+r.byteLength),a=0;return n(new Uint8Array(e)),n(t),n(new Uint8Array(r)),i}function at(e,t){for(var r=[],n=h(e),i=n.next();!i.done;i=n.next())r.push(t(i.value));return r}function ot(e,t){for(var r=h(e),n=r.next();!n.done;n=r.next())if(!t(n.value))return!1;return!0}function st(e){var t=new Map;return Object.keys(e).forEach((function(r){t.set(r,e[r])})),t}function ut(e){var t={};return e.forEach((function(e,r){t[r]=e})),t}function ct(e,t){var r=e;return t&&(r+='; codecs="'+t+'"'),r}function lt(e){return(e=e.split(/ *; */)).shift(),(e=e.find((function(e){return e.startsWith("codecs=")})))?e.split("=")[1].replace(/^"|"$/g,""):""}function dt(e){var t=(e=e.split("."))[0];return e.pop(),[t,e.join(".")]}W("shaka.util.FairPlayUtils.defaultGetContentId",nt),W("shaka.util.FairPlayUtils.initDataTransform",it);var ht=(new Map).set("codecs","codecs").set("frameRate","framerate").set("bandwidth","bitrate").set("width","width").set("height","height").set("channelsCount","channels");function ft(){return!(!e.MediaSource||!MediaSource.isTypeSupported)}function pt(e){return""!=bt().canPlayType(e)}function mt(){return vt("Tizen")}function yt(){return!!navigator.vendor&&navigator.vendor.includes("Apple")&&!mt()}function gt(){if(!yt())return null;var e=navigator.userAgent.match(/Version\/(\d+)/);return e||(e=navigator.userAgent.match(/OS (\d+)(?:_\d+)?/))?parseInt(e[1],10):null}function vt(e){return(navigator.userAgent||"").includes(e)}function bt(){return At||(_t||(_t=new Re((function(){At=null}))),(At=document.getElementsByTagName("video")[0]||document.getElementsByTagName("audio")[0])||(At=document.createElement("video")),_t.V(1),At)}var _t=null,At=null;function Tt(e,t){var r=this;t=void 0===t?1:t,this.J=e,this.C=new Set,this.m=this.o=null,this.Z=!1,this.P=0,this.g=null,this.u=new et,this.h=new Map,this.F=[],this.A=new me,this.j=null,this.l=function(t){r.A.reject(t),e.onError(t)},this.wa=new Map,this.da=new Map,this.X=new Re((function(){return function(e){var t=e.wa,r=e.da;r.clear(),t.forEach((function(e,t){return r.set(t,e)})),t=Array.from(r.values()),t.length&&t.every((function(e){return"expired"==e}))&&e.l(new H(2,6,6014)),e.J.Dc(ut(r))}(r)})),this.i=!1,this.ua=new me,this.L=!1,this.M=[],this.va=!1,this.ea=new Re((function(){!function(e){e.h.forEach((function(t,r){var n=t.xd,i=r.expiration;isNaN(i)&&(i=1/0),i!=n&&(e.J.onExpirationUpdated(r.sessionId,i),t.xd=i)}))}(r)})).Oa(t),this.A.catch((function(){}))}function Et(e,t,r){return e.F=r,e.L=0<r.length,St(e,t)}function St(t,r){var n=function(t){if(t=st(t.j.clearKeys),0==t.size)return null;var r=[],n=[];t.forEach((function(e,t){var i=Ee.$c(t),a=Ee.$c(e);i={kty:"oct",kid:Ee.Mc(i,!1),k:Ee.Mc(a,!1)},r.push(i),n.push(i.kid)})),t=JSON.stringify({keys:r});var i=JSON.stringify({kids:n});return i=[{initData:new Uint8Array(be(i)),initDataType:"keyids"}],{keySystem:"org.w3.clearkey",licenseServerUri:"data:application/json;base64,"+e.btoa(t),distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:i,keyIds:[]}}(t);if(n)for(var i=h(r),a=i.next();!a.done;a=i.next())a.value.drmInfos=[n];for((n=r.some((function(e){return 0<e.drmInfos.length})))||function(e,t){var r=[];t.forEach((function(e,t){r.push({keySystem:t,licenseServerUri:e,distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[]})}));for(var n=h(e),i=n.next();!i.done;i=n.next())i.value.drmInfos=r}(r,a=st(t.j.servers)),a=(i=h(r)).next();!a.done;a=i.next())for(var o=(a=h(a.value.drmInfos)).next();!o.done;o=a.next())Xt(o.value,st(t.j.servers),st(t.j.advanced||{}));return a=function(e,t){for(var r=new Set,n=h(t),i=n.next();!i.done;i=n.next()){var a=h(i.value.drmInfos);for(i=a.next();!i.done;i=a.next())r.add(i.value)}for(n=h(r),i=n.next();!i.done;i=n.next())Xt(i.value,st(e.j.servers),st(e.j.advanced||{}));a=e.L?"required":"optional";var o=e.L?["persistent-license"]:["temporary"];for(n=new Map,r=h(r),i=r.next();!i.done;i=r.next())i=i.value,n.set(i.keySystem,{audioCapabilities:[],videoCapabilities:[],distinctiveIdentifier:"optional",persistentState:a,sessionTypes:o,label:i.keySystem,drmInfos:[]});for(r=h(t),i=r.next();!i.done;i=r.next()){a=(i=i.value).audio,o=i.video;var s=a?Ct(a):"",u=o?Ct(o):"",c=h(i.drmInfos);for(i=c.next();!i.done;i=c.next()){i=i.value;var l=n.get(i.keySystem);l.drmInfos.push(i),i.distinctiveIdentifierRequired&&(l.distinctiveIdentifier="required"),i.persistentStateRequired&&(l.persistentState="required"),a&&(l.audioCapabilities.push({robustness:i.audioRobustness||"",contentType:s}),"ac-3"==a.codecs.toLowerCase()&&mt()&&l.audioCapabilities.push({robustness:i.audioRobustness||"",contentType:ct(a.mimeType,"ec-3")})),o&&l.videoCapabilities.push({robustness:i.videoRobustness||"",contentType:u})}}return n}(t,r),a.size?(a=xt(t,a),n?a:a.catch((function(){}))):(t.Z=!0,Promise.resolve())}function $t(e){return p((function t(){var r;return M(t,(function(t){switch(t.s){case 1:if(!(e.o&&e.g&&e.g.serverCertificate&&e.g.serverCertificate.length)){t.I(0);break}return I(t,3),S(t,e.o.setServerCertificate(e.g.serverCertificate),5);case 5:t.B||K.v("Server certificates are not supported by the key system. The server certificate has been ignored."),R(t,0);break;case 3:return r=k(t),t.return(Promise.reject(new H(2,6,6004,r.message)))}}))}))}function It(e){var t=e.g?e.g.initData:[];return t.forEach((function(t){return wt(e,t.initDataType,t.initData)})),e.F.forEach((function(t){return Lt(e,t)})),t.length||e.F.length||e.A.resolve(),e.A}function wt(e,t,r){for(var n=e.h.values(),i=(n=h(n)).next();!i.done;i=n.next())if(Ee.Ha(r,i.value.initData)&&!vt("Tizen 2"))return void K.debug("Ignoring duplicate init data.");!function(e,t,r){try{if(e.L){K.K("Creating new persistent session");var n=e.o.createSession("persistent-license")}else K.K("Creating new temporary session"),n=e.o.createSession()}catch(t){return void e.l(new H(2,6,6005,t.message))}e.u.H(n,"message",e.ye.bind(e)),e.u.H(n,"keystatuseschange",e.we.bind(e)),e.h.set(n,{initData:r,loaded:!1,xd:1/0,Ga:null});try{r=e.j.initDataTransform(r,e.g)}catch(r){return t=r,r instanceof H||(t=new H(2,6,6016,r)),void e.l(t)}n.generateRequest(t,r).catch((function(t){if(!e.i){if(e.h.delete(n),t.errorCode&&t.errorCode.systemCode){var r=t.errorCode.systemCode;0>r&&(r+=Math.pow(2,32)),r="0x"+r.toString(16)}e.l(new H(2,6,6006,t.message,t,r))}}))}(e,t,r)}function Rt(e){return e?e.keySystem:""}function kt(e,t){if(navigator.userAgent.match(/Edge\//))return!0;if(t=t.toLowerCase(),mt()&&t.includes('codecs="ac-3"')){var r=t.replace("ac-3","ec-3");return e.C.has(t)||e.C.has(r)}return e.C.has(t)}function Pt(e){return e=at(e=e.h.keys(),(function(e){return e.sessionId})),Array.from(e)}function Ct(e){var t=ct(e.mimeType,e.codecs);return $e(t)?Ie(e.type,t):t}function xt(e,t){if(1==t.size&&t.has(""))return Promise.reject(new H(2,6,6e3));for(var r=h(t.values()),n=r.next();!n.done;n=r.next())0==(n=n.value).audioCapabilities.length&&delete n.audioCapabilities,0==n.videoCapabilities.length&&delete n.videoCapabilities;var i=r=new me;return[!0,!1].forEach(function(e){var r=this;t.forEach((function(t,n){t.drmInfos.some((function(e){return!!e.licenseServerUri}))==e&&(i=i.catch(function(){if(!this.i)return navigator.requestMediaKeySystemAccess(n,[t])}.bind(r)))}))}.bind(e)),i=(i=i.catch((function(){return Promise.reject(new H(2,6,6001))}))).then(function(e){if(this.i)return Promise.reject();this.C.clear();var r=e.getConfiguration(),n=r.videoCapabilities||[],i=h(r.audioCapabilities||[]);for(r=i.next();!r.done;r=i.next())this.C.add(r.value.contentType.toLowerCase());for(r=(n=h(n)).next();!r.done;r=n.next())this.C.add(r.value.contentType.toLowerCase());n=e.keySystem,i=[];var a=[],o=[],s=[];return function(e,t,r,n,i){e.forEach((function(e){if(t.includes(e.licenseServerUri)||t.push(e.licenseServerUri),e.serverCertificate&&(r.some((function(t){return Ee.Ha(t,e.serverCertificate)}))||r.push(e.serverCertificate)),e.initData&&e.initData.forEach((function(e){n.some((function(t){return!(!t.keyId||t.keyId!=e.keyId)||t.initDataType==e.initDataType&&Ee.Ha(t.initData,e.initData)}))||n.push(e)})),e.keyIds)for(var a=0;a<e.keyIds.length;++a)i.includes(e.keyIds[a])||i.push(e.keyIds[a])}))}((r=t.get(e.keySystem)).drmInfos,i,a,o,s),1<a.length&&K.v("Multiple unique server certificates found! Only the first will be used."),1<i.length&&K.v("Multiple unique license server URIs found! Only the first will be used."),this.g={keySystem:n,licenseServerUri:i[0],distinctiveIdentifierRequired:"required"==r.distinctiveIdentifier,persistentStateRequired:"required"==r.persistentState,audioRobustness:(r.audioCapabilities?r.audioCapabilities[0].robustness:"")||"",videoRobustness:(r.videoCapabilities?r.videoCapabilities[0].robustness:"")||"",serverCertificate:a[0],initData:o,keyIds:s},this.g.licenseServerUri?e.createMediaKeys():Promise.reject(new H(2,6,6012,this.g.keySystem))}.bind(e)).then(function(e){if(this.i)return Promise.reject();K.info("Created MediaKeys object for key system",this.g.keySystem),this.o=e,this.Z=!0}.bind(e)).catch(function(e){if(!this.i)return this.g=null,this.C.clear(),e instanceof H?Promise.reject(e):Promise.reject(new H(2,6,6002,e.message))}.bind(e)),r.reject(),i}function Lt(e,t){try{K.K("Attempting to load an offline session",t);var r=e.o.createSession("persistent-license")}catch(t){var n=new H(2,6,6005,t.message);return e.l(n),Promise.reject(n)}e.u.H(r,"message",e.ye.bind(e)),e.u.H(r,"keystatuseschange",e.we.bind(e));var i={initData:null,loaded:!1,xd:1/0,Ga:null};return e.h.set(r,i),r.load(t).then(function(e){return this.i?Promise.reject():(K.O("Loaded offline session",t,e),e?(i.loaded=!0,Gt(this)&&this.A.resolve(),r):(this.h.delete(r),void this.l(new H(2,6,6013))))}.bind(e),function(e){this.i||(this.h.delete(r),this.l(new H(2,6,6005,e.message)))}.bind(e))}function Ot(e,t){if(Rt(t).startsWith("com.apple.fps")){var r=t.serverCertificate;e=it(e,nt(e),r)}return e}function Dt(e,t){var r=t.target;K.K("Sending license request for session",r.sessionId,"of type",t.messageType);var n=e.h.get(r),i=e.g.licenseServerUri,a=e.j.advanced[e.g.keySystem];"individualization-request"==t.messageType&&a&&a.individualizationServer&&(i=a.individualizationServer),(i=He([i],e.j.retryParameters)).body=t.message,i.method="POST",i.licenseRequestType=t.messageType,i.sessionId=r.sessionId,"com.microsoft.playready"!=e.g.keySystem&&"com.chromecast.playready"!=e.g.keySystem||function(e){var t=ge(e.body,!0,!0);if(t.includes("PlayReadyKeyMessage")){K.debug("Unwrapping PlayReady request.");for(var r=(t=(new DOMParser).parseFromString(t,"application/xml")).getElementsByTagName("HttpHeader"),n=0;n<r.length;++n)e.headers[r[n].getElementsByTagName("name")[0].textContent]=r[n].getElementsByTagName("value")[0].textContent;e.body=Ee.Ja(t.getElementsByTagName("Challenge")[0].textContent).buffer}else K.debug("PlayReady request is already unwrapped."),e.headers["Content-Type"]="text/xml; charset=utf-8"}(i),e.g.keySystem.startsWith("com.apple.fps")&&e.j.fairPlayTransform&&function(e){var t=new Uint8Array(e.body);t="spc="+Ee.Mc(t),e.headers["Content-Type"]="application/x-www-form-urlencoded",e.body=be(t)}(i);var o=Date.now();e.J.Ib.request(2,i).promise.then(function(e){return this.i?Promise.reject():(this.g.keySystem.startsWith("com.apple.fps")&&this.j.fairPlayTransform&&function(e){try{var t=ye(e.data)}catch(e){return}t=t.trim(),"<ckc>"===t.substr(0,5)&&"</ckc>"===t.substr(-6)&&(t=t.slice(5,-6));try{t=JSON.parse(t).ckc}catch(e){}e.data=Ee.Ja(t).buffer}(e),this.P+=(Date.now()-o)/1e3,K.K("Updating session",r.sessionId),r.update(e.data).then(function(){var e=this;this.J.onEvent(new Ze("drmsessionupdate")),n&&(n.Ga&&n.Ga.resolve(),new Re((function(){n.loaded=!0,Gt(e)&&e.A.resolve()})).V(Ut))}.bind(this)))}.bind(e),function(e){this.i||(e=new H(2,6,6007,e),this.l(e),n&&n.Ga&&n.Ga.reject(e))}.bind(e)).catch(function(e){this.i||(e=new H(2,6,6008,e.message),this.l(e),n&&n.Ga&&n.Ga.reject(e))}.bind(e))}function Mt(){var e=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],t=[{videoCapabilities:e,persistentState:"required",sessionTypes:["persistent-license"]},{videoCapabilities:e}],r=new Map;return e="org.w3.clearkey com.widevine.alpha com.microsoft.playready com.apple.fps.3_0 com.apple.fps.2_0 com.apple.fps.1_0 com.apple.fps com.adobe.primetime".split(" ").map((function(e){return n=e,p((function e(){var i,a,o;return M(e,(function(e){switch(e.s){case 1:return I(e,2),S(e,navigator.requestMediaKeySystemAccess(n,t),4);case 4:return i=e.B,o=!!(a=i.getConfiguration().sessionTypes)&&a.includes("persistent-license"),vt("Tizen 3")&&(o=!1),r.set(n,{persistentState:o}),S(e,i.createMediaKeys(),5);case 5:R(e,0);break;case 2:k(e),r.set(n,null),$(e)}}))}));var n})),Promise.all(e).then((function(){return ut(r)}))}function Zt(e,t){var r=t.audio,n=t.video;if(r&&r.encrypted&&!kt(e,r=Ct(r))||n&&n.encrypted&&!kt(e,n=Ct(n)))return!1;var i=Rt(e.g);return 0==t.drmInfos.length||t.drmInfos.some((function(e){return e.keySystem==i}))}function Vt(e,t){if(!e.length)return t;if(!t.length)return e;for(var r=[],n=0;n<e.length;n++)for(var i=0;i<t.length;i++)if(e[n].keySystem==t[i].keySystem){var a=e[n];i=t[i];var o=[];o=(o=o.concat(a.initData||[])).concat(i.initData||[]);var s=[];s=(s=s.concat(a.keyIds)).concat(i.keyIds),r.push({keySystem:a.keySystem,licenseServerUri:a.licenseServerUri||i.licenseServerUri,distinctiveIdentifierRequired:a.distinctiveIdentifierRequired||i.distinctiveIdentifierRequired,persistentStateRequired:a.persistentStateRequired||i.persistentStateRequired,videoRobustness:a.videoRobustness||i.videoRobustness,audioRobustness:a.audioRobustness||i.audioRobustness,serverCertificate:a.serverCertificate||i.serverCertificate,initData:o,keyIds:s});break}return r}function Nt(e){return p((function t(){var r;return M(t,(function(t){if(1===t.s)return r=Array.from(e.h.keys()),e.h.clear(),S(t,Promise.all(r.map((function(e){return p((function t(){return M(t,(function(t){switch(t.s){case 1:return K.K("Closing session",e.sessionId),I(t,2),S(t,function(e){return p((function t(){var r;return M(t,(function(t){switch(t.s){case 1:return r=new Promise((function(e,t){new Re(t).V(Wt)})),I(t,2),S(t,Promise.race([Promise.all([e.close(),e.closed]),r]),4);case 4:R(t,0);break;case 2:k(t),K.v("Timeout waiting for session close"),$(t)}}))}))}(e),4);case 4:R(t,0);break;case 2:k(t),$(t)}}))}))}))),0)}))}))}function Gt(e){return ot(e=e.h.values(),(function(e){return e.loaded}))}function Xt(t,r,n){!t.keySystem||"org.w3.clearkey"==t.keySystem&&t.licenseServerUri||(r.size&&(r=r.get(t.keySystem)||"",t.licenseServerUri=r),t.keyIds||(t.keyIds=[]),(n=n.get(t.keySystem))&&(t.distinctiveIdentifierRequired||(t.distinctiveIdentifierRequired=n.distinctiveIdentifierRequired),t.persistentStateRequired||(t.persistentStateRequired=n.persistentStateRequired),t.videoRobustness||(t.videoRobustness=n.videoRobustness),t.audioRobustness||(t.audioRobustness=n.audioRobustness),t.serverCertificate||(t.serverCertificate=n.serverCertificate)),e.cast&&e.cast.__platform__&&"com.microsoft.playready"==t.keySystem&&(t.keySystem="com.chromecast.playready"))}(n=Tt.prototype).destroy=function(){var e=this;return p((function t(){return M(t,(function(t){switch(t.s){case 1:return e.i?S(t,e.ua,0):(e.i=!0,S(t,function(e){return p((function t(){return M(t,(function(t){switch(t.s){case 1:return e.u.release(),e.u=null,e.A.reject(),e.ea.stop(),e.ea=null,e.X.stop(),e.X=null,S(t,Nt(e),2);case 2:if(!e.m){t.I(3);break}return I(t,4),S(t,e.m.setMediaKeys(null),6);case 6:R(t,5);break;case 4:k(t);case 5:e.m=null;case 3:e.g=null,e.C.clear(),e.o=null,e.F=[],e.j=null,e.l=null,e.J=null,$(t)}}))}))}(e),4));case 4:e.ua.resolve(),t.I(0)}}))}))},n.configure=function(e){this.j=e},n.Ub=function(e){var t=this;if(!this.o)return this.u.ya(e,"encrypted",(function(){t.l(new H(2,6,6010))})),Promise.resolve();this.m=e,this.u.ya(this.m,"play",(function(){for(var e=0;e<t.M.length;e++)Dt(t,t.M[e]);t.va=!0,t.M=[]})),"webkitCurrentPlaybackTargetIsWireless"in this.m&&this.u.H(this.m,"webkitcurrentplaybacktargetiswirelesschanged",(function(){return Nt(t)})),e=(e=this.m.setMediaKeys(this.o)).catch((function(e){return Promise.reject(new H(2,6,6003,e.message))}));var r=$t(this);return Promise.all([e,r]).then((function(){if(t.i)return Promise.reject();It(t),t.g.initData.length||t.F.length||t.u.H(t.m,"encrypted",(function(e){return wt(t,e.initDataType,new Uint8Array(e.initData))}))})).catch((function(e){if(!t.i)return Promise.reject(e)}))},n.Xb=function(){for(var e=1/0,t=this.h.keys(),r=(t=h(t)).next();!r.done;r=t.next())r=r.value,isNaN(r.expiration)||(e=Math.min(e,r.expiration));return e},n.ye=function(e){this.m&&this.j.delayLicenseRequestUntilPlayed&&this.m.paused&&!this.va?this.M.push(e):Dt(this,e)},n.we=function(e){e=e.target,K.O("Key status changed for session",e.sessionId);var t=this.h.get(e),r=!1;e.keyStatuses.forEach(function(e,n){if("string"==typeof n){var i=n;n=e,e=i}if("com.microsoft.playready"==this.g.keySystem&&16==n.byteLength&&(vt("Trident/")||navigator.userAgent.match(/Edge?\//))){var a=(i=new DataView(n)).getUint32(0,!0),o=i.getUint16(4,!0),s=i.getUint16(6,!0);i.setUint32(0,a,!1),i.setUint16(4,o,!1),i.setUint16(6,s,!1)}"com.microsoft.playready"==this.g.keySystem&&"status-pending"==e&&(e="usable"),"status-pending"!=e&&(t.loaded=!0),"expired"==e&&(r=!0),i=Ee.Nc(new Uint8Array(n)),this.wa.set(i,e)}.bind(this));var n=e.expiration-Date.now();(0>n||r&&1e3>n)&&t&&!t.Ga&&(K.debug("Session has expired",e.sessionId),this.h.delete(e),e.close().catch((function(){}))),Gt(this)&&(this.A.resolve(),this.X.V(Ft))};var Wt=1,Ut=5,Ft=.5;function Bt(){this.g=new muxjs.mp4.CaptionParser,this.l=[],this.j={}}function Yt(){}function jt(e){return!e||1==e.length&&1e-6>e.end(0)-e.start(0)?null:e.length?e.end(e.length-1):null}function Kt(e,t,r){return r=void 0===r?0:r,!(!e||!e.length||1==e.length&&1e-6>e.end(0)-e.start(0)||t>e.end(e.length-1))&&t+r>=e.start(0)}function Ht(e,t){if(!e||!e.length||1==e.length&&1e-6>e.end(0)-e.start(0))return 0;for(var r=0,n=e.length-1;0<=n&&e.end(n)>t;--n)r+=e.end(n)-Math.max(e.start(n),t);return r}function zt(e){if(!e)return[];for(var t=[],r=0;r<e.length;r++)t.push({start:e.start(r),end:e.end(r)});return t}function Jt(e,t,r){this.startTime=e,this.direction=nr,this.endTime=t,this.payload=r,this.region=new dr,this.position=null,this.positionAlign=Qt,this.size=0,this.textAlign=qt,this.writingMode=ir,this.lineInterpretation=ar,this.line=null,this.lineHeight="",this.lineAlign=or,this.displayAlign=tr,this.fontSize=this.backgroundImage=this.backgroundColor=this.color="",this.fontWeight=ur,this.fontStyle=cr,this.fontFamily="",this.textDecoration=[],this.wrapLine=!0,this.id="",this.nestedCues=[],this.spacer=!1}Bt.prototype.init=function(e){var t=muxjs.mp4.probe;e=new Uint8Array(e),this.l=t.videoTrackIds(e),this.j=t.timescale(e),this.g.init()},Bt.prototype.h=function(e,t){var r=new Uint8Array(e);(r=this.g.parse(r,this.l,this.j))&&r.captions&&t(r.captions),this.g.clearParsedCaptions()},Bt.prototype.i=function(){this.g.resetCaptionStream()},Yt.prototype.init=function(){},Yt.prototype.h=function(){},Yt.prototype.i=function(){},W("shaka.text.Cue",Jt),Jt.prototype.clone=function(){var e,t=new Jt(0,0,"");for(e in this)t[e]=this[e],t[e]&&t[e].constructor==Array&&(t[e]=t[e].slice());return t};var Qt="auto";Jt.positionAlign={LEFT:"line-left",RIGHT:"line-right",CENTER:"center",AUTO:Qt};var qt="center",er={LEFT:"left",RIGHT:"right",CENTER:qt,START:"start",END:"end"};Jt.textAlign=er;var tr="after",rr={BEFORE:"before",CENTER:"center",AFTER:tr};Jt.displayAlign=rr;var nr="ltr";Jt.direction={HORIZONTAL_LEFT_TO_RIGHT:nr,HORIZONTAL_RIGHT_TO_LEFT:"rtl"};var ir="horizontal-tb";Jt.writingMode={HORIZONTAL_TOP_TO_BOTTOM:ir,VERTICAL_LEFT_TO_RIGHT:"vertical-lr",VERTICAL_RIGHT_TO_LEFT:"vertical-rl"};var ar=0;Jt.lineInterpretation={LINE_NUMBER:ar,PERCENTAGE:1};var or="start",sr={CENTER:"center",START:or,END:"end"};Jt.lineAlign=sr;var ur=400;Jt.fontWeight={NORMAL:ur,BOLD:700};var cr="normal",lr={NORMAL:cr,ITALIC:"italic",OBLIQUE:"oblique"};function dr(){this.id="",this.regionAnchorY=this.regionAnchorX=this.viewportAnchorY=this.viewportAnchorX=0,this.height=this.width=100,this.viewportAnchorUnits=this.widthUnits=this.heightUnits=hr,this.scroll=fr}Jt.fontStyle=lr,Jt.textDecoration={UNDERLINE:"underline",LINE_THROUGH:"lineThrough",OVERLINE:"overline"},W("shaka.text.CueRegion",dr);var hr=1;dr.units={PX:0,PERCENTAGE:hr,LINES:2};var fr="";function pr(e){this.l=null,this.i=e,this.j=this.A=0,this.m=1/0,this.h=this.g=null,this.u="",this.o=new Map}dr.scrollMode={NONE:fr,UP:"up"};var mr={};function yr(t){return!!(mr[t]||e.muxjs&&"application/cea-608"==t)}function gr(e,t){"application/cea-608"!=t&&(e.l=new mr[t])}function vr(e,t,r,n,i){for(var a=r+" "+n,o=new Map,s=(t=h(t)).next();!s.done;s=t.next()){var u=s.value;s=u.stream,o.has(s)||o.set(s,new Map),o.get(s).has(a)||o.get(s).set(a,[]),u.startTime+=i,u.endTime+=i,u.startTime>=e.j&&u.startTime<e.m&&(u=new Jt(u.startTime,u.endTime,u.text),o.get(s).get(a).push(u),s==e.u&&e.i.append([u]))}for(a=(i=h(o.keys())).next();!a.done;a=i.next())for(a=a.value,e.o.has(a)||e.o.set(a,new Map),s=(t=h(o.get(a).keys())).next();!s.done;s=t.next())s=s.value,u=o.get(a).get(s),e.o.get(a).set(s,u);e.g=null==e.g?Math.max(r,e.j):Math.min(e.g,Math.max(r,e.j)),e.h=Math.max(e.h,Math.min(n,e.m))}function br(e,t,r){this.j=e,this.l=r,this.h={},this.g=null,this.i={},this.o=new et,this.F=!1,this.u={},this.A=t,this.C=new me,this.m=function(e,t){var r=new MediaSource;return e.o.ya(r,"sourceopen",(function(){URL.revokeObjectURL(e.J),t.resolve()})),e.J=_r(r),e.j.src=e.J,r}(this,this.C),this.J=""}W("shaka.text.TextEngine.registerParser",(function(e,t){mr[e]=t})),W("shaka.text.TextEngine.unregisterParser",(function(e){delete mr[e]})),pr.prototype.destroy=function(){return this.i=this.l=null,this.o.clear(),Promise.resolve()},pr.prototype.xc=function(e){try{return this.l.parseMedia(new Uint8Array(e),{periodStart:0,segmentStart:null,segmentEnd:0})[0].startTime}catch(e){throw new H(2,2,2009,e)}},pr.prototype.remove=function(e,t){return Promise.resolve().then(function(){!this.i||!this.i.remove(e,t)||null==this.g||t<=this.g||e>=this.h||(e<=this.g&&t>=this.h?this.g=this.h=null:e<=this.g&&t<this.h?this.g=t:e>this.g&&t>=this.h&&(this.h=e))}.bind(this))};var _r=e.URL.createObjectURL;function Ar(e){var t=ct(e.mimeType,e.codecs),r=function(e){var t=[e.mimeType];return ht.forEach((function(r,n){var i=e[n];i&&t.push(r+'="'+i+'"')})),t.join(";")}(e);return yr(t)||MediaSource.isTypeSupported(r)||$e(t,e.type)}function Tr(e,t){e.g||(e.g=new pr(e.l)),gr(e.g,t)}function Er(e){return!e.m||"ended"==e.m.readyState}function Sr(e,t){if("text"==t)var r=e.g.g;else r=!(r=Ir(e,t))||1==r.length&&1e-6>r.end(0)-r.start(0)?null:1==r.length&&0>r.start(0)?0:r.length?r.start(0):null;return r}function $r(e,t){return"text"==t?e.g.h:jt(Ir(e,t))}function Ir(e,t){try{return e.h[t].buffered}catch(r){return t in e.h&&K.error("failed to get buffered range for "+t,r),null}}function wr(t,r,n,i,a,o){return"text"==r?function(e,t,r,n){return Promise.resolve().then(function(){if(this.l&&this.i)if(null==r||null==n)this.l.parseInit(new Uint8Array(t));else{var e={periodStart:this.A,segmentStart:r,segmentEnd:n};e=this.l.parseMedia(new Uint8Array(t),e).filter(function(e){return e.startTime>=this.j&&e.startTime<this.m}.bind(this)),this.i.append(e),null==this.g&&(this.g=Math.max(r,this.j)),this.h=Math.min(n,this.m)}}.bind(e))}(t.g,n,i,a):t.u[r]?function(e,t){e.j=!0,e.h=new me,e.l=[],e.i=[];var r=new Uint8Array(t);return e.g.push(r),e.g.flush(),e.j&&e.h.reject(new H(2,3,3018)),e.h}(t.u[r],n).then(function(e){return this.g||Tr(this,"text/vtt"),e.captions&&e.captions.length&&vr(this.g,e.captions,i,a,this.h.video.timestampOffset),Pr(this,r,this.Me.bind(this,r,e.data.buffer))}.bind(t)):(o&&e.muxjs&&(t.g||Tr(t,"text/vtt"),null==i&&null==a?t.A.init(n):t.A.h(n,(function(e){e.length&&vr(t.g,e,i,a,t.h.video.timestampOffset)}))),Pr(t,r,t.Me.bind(t,r,n)))}function Rr(e,t){var r=$r(e,"video")||0;!function(e,t,r){if(e.u=t,t=e.o.get(t))for(var n=h(t.keys()),i=n.next();!i.done;i=n.next())(i=t.get(i.value).filter((function(e){return e.endTime<=r})))&&e.i.append(i)}(e.g,t,r)}function kr(e,t){return"text"==t?e.g?(e.A.i(),e.g.remove(0,1/0)):Promise.resolve():Pr(e,t,e.Ne.bind(e,t,0,e.m.duration))}function Pr(e,t,r){if(e.F)return Promise.reject();if(r={start:r,p:new me},e.i[t].push(r),1==e.i[t].length)try{r.start()}catch(n){"QuotaExceededError"==n.name?r.p.reject(new H(2,3,3017,t)):r.p.reject(new H(2,3,3015,n)),xr(e,t)}return r.p}function Cr(e,t){if(e.F)return Promise.reject();var r,n=[];for(r in e.h){var i=new me,a={start:function(e){e.resolve()}.bind(null,i),p:i};e.i[r].push(a),n.push(i),1==e.i[r].length&&a.start()}return Promise.all(n).then(function(){try{t()}catch(t){var e=Promise.reject(new H(2,3,3015,t))}for(var r in this.h)xr(this,r);return e}.bind(e),function(e){throw e}.bind(e))}function xr(e,t){e.i[t].shift();var r=e.i[t][0];if(r)try{r.start()}catch(n){r.p.reject(new H(2,3,3015,n)),xr(e,t)}}function Lr(e,t){return e=Dr(e),t=Dr(t),e.split("-")[0]==t.split("-")[0]}function Or(e,t){e=Dr(e),t=Dr(t);var r=e.split("-"),n=t.split("-");return r[0]==n[0]&&1==r.length&&2==n.length}function Dr(e){var t=e.split("-");return e=t[0]||"",t=t[1]||"",e=e.toLowerCase(),e=Vr.get(e)||e,(t=t.toUpperCase())?e+"-"+t:e}function Mr(e){return e.language?Dr(e.language):e.audio&&e.audio.language?Dr(e.audio.language):e.video&&e.video.language?Dr(e.video.language):"und"}function Zr(e,t){for(var r=Dr(e),n=new Set,i=h(t),a=i.next();!a.done;a=i.next())n.add(Dr(a.value));for(a=(i=h(n)).next();!a.done;a=i.next())if((a=a.value)==r)return a;for(a=(i=h(n)).next();!a.done;a=i.next())if(Or(a=a.value,r))return a;for(a=(i=h(n)).next();!a.done;a=i.next()){var o=a=a.value,s=r;if(o=Dr(o),s=Dr(s),o=o.split("-"),s=s.split("-"),2==o.length&&2==s.length&&o[0]==s[0])return a}for(a=(n=h(n)).next();!a.done;a=n.next())if(Or(r,i=a.value))return i;return null}(n=br.prototype).destroy=function(){var e=this;this.F=!0;var t,r=[];for(t in this.i){var n=this.i[t],i=n[0];for(this.i[t]=n.slice(0,1),i&&r.push(i.p.catch(le.Bc)),i=1;i<n.length;++i)n[i].p.reject()}for(var a in this.g&&r.push(this.g.destroy()),this.l&&r.push(this.l.destroy()),this.u)r.push(this.u[a].destroy());return Promise.all(r).then((function(){e.o&&(e.o.release(),e.o=null),e.j&&(e.j.removeAttribute("src"),e.j.load(),e.j=null),e.m=null,e.g=null,e.l=null,e.h={},e.u={},e.A=null,e.i={}}))},n.init=function(e,t){var r=this;return p((function n(){var i;return M(n,(function(n){switch(n.s){case 1:return i=fe,S(n,r.C,2);case 2:e.forEach((function(e,n){var a=ct(e.mimeType,e.codecs);n==i.za?Tr(r,a):(!t&&MediaSource.isTypeSupported(a)||!$e(a,n)||(r.u[n]=new Se,a=Ie(n,a)),a=r.m.addSourceBuffer(a),r.o.H(a,"error",r.Dg.bind(r,n)),r.o.H(a,"updateend",r.Lb.bind(r,n)),r.h[n]=a,r.i[n]=[])})),$(n)}}))}))},n.bd=function(e){if(e.total=zt(this.j.buffered),e.audio=zt(Ir(this,"audio")),e.video=zt(Ir(this,"video")),e.text=[],this.g){var t=this.g.g,r=this.g.h;null!=t&&null!=r&&e.text.push({start:t,end:r})}},n.remove=function(e,t,r){return"text"==e?this.g.remove(t,r):Pr(this,e,this.Ne.bind(this,e,t,r))},n.flush=function(e){return"text"==e?Promise.resolve():Pr(this,e,this.lf.bind(this,e))},n.endOfStream=function(e){return Cr(this,function(){Er(this)||(e?this.m.endOfStream(e):this.m.endOfStream())}.bind(this))},n.Fa=function(e){return Cr(this,function(){this.m.duration=e}.bind(this))},n.ha=function(){return this.m.duration},n.Me=function(e,t){this.h[e].appendBuffer(t)},n.Ne=function(e,t,r){r<=t?this.Lb(e):this.h[e].remove(t,r)},n.Ve=function(e){var t=this.h[e].appendWindowStart,r=this.h[e].appendWindowEnd;this.h[e].abort(),this.h[e].appendWindowStart=t,this.h[e].appendWindowEnd=r,this.Lb(e)},n.lf=function(e){this.j.currentTime-=.001,this.Lb(e)},n.Cg=function(e,t){0>t&&(t+=.001),this.h[e].timestampOffset=t,this.Lb(e)},n.zg=function(e,t,r){this.h[e].appendWindowStart=0,this.h[e].appendWindowEnd=r,this.h[e].appendWindowStart=t,this.Lb(e)},n.Dg=function(e){this.i[e][0].p.reject(new H(2,3,3014,this.j.error?this.j.error.code:0))},n.Lb=function(e){var t=this.i[e][0];t&&(t.p.resolve(),xr(this,e))};var Vr=new Map([["aar","aa"],["abk","ab"],["afr","af"],["aka","ak"],["alb","sq"],["amh","am"],["ara","ar"],["arg","an"],["arm","hy"],["asm","as"],["ava","av"],["ave","ae"],["aym","ay"],["aze","az"],["bak","ba"],["bam","bm"],["baq","eu"],["bel","be"],["ben","bn"],["bih","bh"],["bis","bi"],["bod","bo"],["bos","bs"],["bre","br"],["bul","bg"],["bur","my"],["cat","ca"],["ces","cs"],["cha","ch"],["che","ce"],["chi","zh"],["chu","cu"],["chv","cv"],["cor","kw"],["cos","co"],["cre","cr"],["cym","cy"],["cze","cs"],["dan","da"],["deu","de"],["div","dv"],["dut","nl"],["dzo","dz"],["ell","el"],["eng","en"],["epo","eo"],["est","et"],["eus","eu"],["ewe","ee"],["fao","fo"],["fas","fa"],["fij","fj"],["fin","fi"],["fra","fr"],["fre","fr"],["fry","fy"],["ful","ff"],["geo","ka"],["ger","de"],["gla","gd"],["gle","ga"],["glg","gl"],["glv","gv"],["gre","el"],["grn","gn"],["guj","gu"],["hat","ht"],["hau","ha"],["heb","he"],["her","hz"],["hin","hi"],["hmo","ho"],["hrv","hr"],["hun","hu"],["hye","hy"],["ibo","ig"],["ice","is"],["ido","io"],["iii","ii"],["iku","iu"],["ile","ie"],["ina","ia"],["ind","id"],["ipk","ik"],["isl","is"],["ita","it"],["jav","jv"],["jpn","ja"],["kal","kl"],["kan","kn"],["kas","ks"],["kat","ka"],["kau","kr"],["kaz","kk"],["khm","km"],["kik","ki"],["kin","rw"],["kir","ky"],["kom","kv"],["kon","kg"],["kor","ko"],["kua","kj"],["kur","ku"],["lao","lo"],["lat","la"],["lav","lv"],["lim","li"],["lin","ln"],["lit","lt"],["ltz","lb"],["lub","lu"],["lug","lg"],["mac","mk"],["mah","mh"],["mal","ml"],["mao","mi"],["mar","mr"],["may","ms"],["mkd","mk"],["mlg","mg"],["mlt","mt"],["mon","mn"],["mri","mi"],["msa","ms"],["mya","my"],["nau","na"],["nav","nv"],["nbl","nr"],["nde","nd"],["ndo","ng"],["nep","ne"],["nld","nl"],["nno","nn"],["nob","nb"],["nor","no"],["nya","ny"],["oci","oc"],["oji","oj"],["ori","or"],["orm","om"],["oss","os"],["pan","pa"],["per","fa"],["pli","pi"],["pol","pl"],["por","pt"],["pus","ps"],["que","qu"],["roh","rm"],["ron","ro"],["rum","ro"],["run","rn"],["rus","ru"],["sag","sg"],["san","sa"],["sin","si"],["slk","sk"],["slo","sk"],["slv","sl"],["sme","se"],["smo","sm"],["sna","sn"],["snd","sd"],["som","so"],["sot","st"],["spa","es"],["sqi","sq"],["srd","sc"],["srp","sr"],["ssw","ss"],["sun","su"],["swa","sw"],["swe","sv"],["tah","ty"],["tam","ta"],["tat","tt"],["tel","te"],["tgk","tg"],["tgl","tl"],["tha","th"],["tib","bo"],["tir","ti"],["ton","to"],["tsn","tn"],["tso","ts"],["tuk","tk"],["tur","tr"],["twi","tw"],["uig","ug"],["ukr","uk"],["urd","ur"],["uzb","uz"],["ven","ve"],["vie","vi"],["vol","vo"],["wel","cy"],["wln","wa"],["wol","wo"],["xho","xh"],["yid","yi"],["yor","yo"],["zha","za"],["zho","zh"],["zul","zu"]]),Nr={$d:function(e,t){var r=e.periods.reduce((function(e,t){return e.concat(t.variants)}),[]);r=Nr.ee(r,t),r=Nr.Lf(r),r=Nr.jf(r);for(var n=Nr.kf(r),i=(r=h(e.periods)).next();!i.done;i=r.next())(i=i.value).variants=i.variants.filter((function(e){return Nr.he(e)==n||(K.debug("Dropping Variant (better codec available)",e),!1)}))},Lf:function(e){for(var t=new Ve,r=(e=h(e)).next();!r.done;r=e.next()){r=r.value;var n=Nr.he(r);t.push(n,r)}return t},jf:function(e){var t=0,r=new Map,n=e.size();return e.forEach((function(e,i){for(var a=h(i),o=a.next();!o.done;o=a.next()){var s=(o=o.value).video;if(s&&s.width&&s.height){s=s.width*s.height*(s.frameRate||1),r.has(s)||r.set(s,new Ve);var u=r.get(s);u.push(e,o),u.size()===n&&(t=Math.max(t,s))}}})),t?r.get(t):e},kf:function(e){var t="",r=1/0;return e.forEach((function(e,n){for(var i=0,a=0,o=h(n),s=o.next();!s.done;s=o.next())i+=s.value.bandwidth||0,++a;i/=a,K.debug("codecs",e,"avg bandwidth",i),i<r&&(t=e,r=i)})),t},he:function(e){var t="";e.video&&(t=dt(e.video.codecs)[0]);var r="";return e.audio&&(r=dt(e.audio.codecs)[0]),t+"-"+r},rd:function(e,t,r){function n(e,t,r){return e>=t&&e<=r}var i=e.video;return!(i&&i.width&&i.height&&(!n(i.width,t.minWidth,Math.min(t.maxWidth,r.width))||!n(i.height,t.minHeight,Math.min(t.maxHeight,r.height))||!n(i.width*i.height,t.minPixels,t.maxPixels))||e&&e.video&&e.video.frameRate&&!n(e.video.frameRate,t.minFrameRate,t.maxFrameRate)||!n(e.bandwidth,t.minBandwidth,t.maxBandwidth))},Xd:function(e,t,r){var n=!1;return e.forEach((function(e){var i=e.allowedByApplication;e.allowedByApplication=Nr.rd(e,t,r),i!=e.allowedByApplication&&(n=!0)})),n},filterNewPeriod:function(e,t,r,n){n.variants=n.variants.filter((function(n){if(e&&e.Z&&!Zt(e,n))return K.debug("Dropping variant - not compatible with key system",n),!1;var i=n.audio;return n=n.video,i&&!Ar(i)?(K.debug("Dropping variant - audio not compatible with platform",Nr.fb(i)),!1):n&&!Ar(n)||vt("Xbox One")&&n&&(n.width&&1920<n.width||n.height&&1080<n.height)&&n.codecs.includes("avc1.")?(K.debug("Dropping variant - video not compatible with platform",Nr.fb(n)),!1):i&&t&&!Nr.Yd(i,t)?(K.debug("Droping variant - not compatible with active audio","active audio",Nr.fb(t),"variant.audio",Nr.fb(i)),!1):!(n&&r&&!Nr.Yd(n,r))||(K.debug("Droping variant - not compatible with active video","active video",Nr.fb(r),"variant.video",Nr.fb(n)),!1)})),n.textStreams=n.textStreams.filter((function(e){var t=yr(ct(e.mimeType,e.codecs));return t||K.debug("Dropping text stream. Is not supported by the platform.",e),t}))},Yd:function(e,t){return e.mimeType==t.mimeType&&e.codecs.split(".")[0]==t.codecs.split(".")[0]},Oc:function(e){var t=e.audio,r=e.video,n=t?t.codecs:null,i=r?r.codecs:null,a=[];i&&a.push(i),n&&a.push(n);var o=[];r&&o.push(r.mimeType),t&&o.push(t.mimeType),o=o[0]||null;var s=[];t&&s.push(t.kind),r&&s.push(r.kind),s=s[0]||null;var u=new Set;return t&&t.roles.forEach((function(e){return u.add(e)})),r&&r.roles.forEach((function(e){return u.add(e)})),e={id:e.id,active:!1,type:"variant",bandwidth:e.bandwidth,language:e.language,label:null,kind:s,width:null,height:null,frameRate:null,pixelAspectRatio:null,mimeType:o,codecs:a.join(", "),audioCodec:n,videoCodec:i,primary:e.primary,roles:Array.from(u),audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null},r&&(e.videoId=r.id,e.originalVideoId=r.originalId,e.width=r.width||null,e.height=r.height||null,e.frameRate=r.frameRate||null,e.pixelAspectRatio=r.pixelAspectRatio||null,e.videoBandwidth=r.bandwidth||null),t&&(e.audioId=t.id,e.originalAudioId=t.originalId,e.channelsCount=t.channelsCount,e.audioSamplingRate=t.audioSamplingRate,e.audioBandwidth=t.bandwidth||null,e.label=t.label,e.audioRoles=t.roles),e},Kc:function(e){return{id:e.id,active:!1,type:"text",bandwidth:0,language:e.language,label:e.label,kind:e.kind||null,width:null,height:null,frameRate:null,pixelAspectRatio:null,mimeType:e.mimeType,codecs:e.codecs||null,audioCodec:null,videoCodec:null,primary:e.primary,roles:e.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:e.originalId}},gd:function(e){return e.__shaka_id||(e.__shaka_id=Nr.Uf++),e.__shaka_id},Uf:0,Of:function(e){var t=Nr.ke(e);return t.active="disabled"!=e.mode,t.type="text",t.originalTextId=e.id,"captions"==e.kind&&(t.mimeType="application/cea-608"),e.kind&&(t.roles=[e.kind]),t},je:function(e){var t=Nr.ke(e);return t.active=e.enabled,t.type="variant",t.originalAudioId=e.id,"main"==e.kind&&(t.primary=!0),e.kind&&(t.roles=[e.kind],t.audioRoles=[e.kind]),t},ke:function(e){return{id:Nr.gd(e),active:!1,type:"",bandwidth:0,language:Dr(e.language),label:e.label,kind:e.kind,width:null,height:null,frameRate:null,pixelAspectRatio:null,mimeType:null,codecs:null,audioCodec:null,videoCodec:null,primary:!1,roles:[],audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null}},Gb:function(e){return e.allowedByApplication&&e.allowedByKeySystem},Bf:function(e){return e.filter((function(e){return Nr.Gb(e)}))},ee:function(e,t){for(var r=e.filter((function(e){return e.audio&&e.audio.channelsCount})),n=new Map,i=(r=h(r)).next();!i.done;i=r.next()){var a=(i=i.value).audio.channelsCount;n.has(a)||n.set(a,[]),n.get(a).push(i)}return 0==(r=Array.from(n.keys())).length?e:(i=r.filter((function(e){return e<=t}))).length?n.get(Math.max.apply(null,i)):n.get(Math.min.apply(null,r))},Wb:function(e,t,r){var n=e,i=e.filter((function(e){return e.primary}));i.length&&(n=i);var a=n.length?n[0].language:"";if(n=n.filter((function(e){return e.language==a})),t){var o=Zr(Dr(t),e.map((function(e){return e.language})));o&&(n=e.filter((function(e){return Dr(e.language)==o})))}if(r){if((e=Nr.de(n,r)).length)return e;K.v("No exact match for the text role could be found.")}else if((e=n.filter((function(e){return 0==e.roles.length}))).length)return e;return(e=n.map((function(e){return e.roles})).reduce(le.Rc,[])).length?Nr.de(n,e[0]):n},de:function(e,t){return e.filter((function(e){return e.roles.includes(t)}))},ie:function(e,t,r){for(var n=0;n<r.length;n++)if(r[n].audio==e&&r[n].video==t)return r[n];return null},Pf:function(e){return"audio"==e.type},Sf:function(e){return"video"==e.type},Kf:function(e){var t=[];return e.audio&&t.push(e.audio),e.video&&t.push(e.video),t},fb:function(e){return Nr.Pf(e)?"type=audio codecs="+e.codecs+" bandwidth="+e.bandwidth+" channelsCount="+e.channelsCount+" audioSamplingRate="+e.audioSamplingRate:Nr.Sf(e)?"type=video codecs="+e.codecs+" bandwidth="+e.bandwidth+" frameRate="+e.frameRate+" width="+e.width+" height="+e.height:"unexpected stream type"}};function Gr(){this.m=null,this.i=!1,this.h=new j,this.l=[],this.o=!1,this.g=this.j=null}function Xr(e,t){return e&&(t=t.filter((function(t){return Nr.rd(t,e,{width:1/0,height:1/0})}))),t.sort((function(e,t){return e.bandwidth-t.bandwidth}))}function Wr(e,t){this.g=e,this.h=t}function Ur(e,t){var r=new Wr(2,6),n=Yr,i=n.g,a=r.h-i.h;(0<(r.g-i.g||a)?n.i:n.h)(n.g,r,e,t)}function Fr(e,t,r,n){K.ba([r,"has been deprecated and will be removed in",t,". We are currently at version",e,". Additional information:",n].join(" "))}function Br(e,t,r,n){K.kc([r,"has been deprecated and has been removed in",t,". We are now at version",e,". Additional information:",n].join(""))}W("shaka.abr.SimpleAbrManager",Gr),Gr.prototype.stop=function(){this.m=null,this.i=!1,this.l=[],this.j=null},Gr.prototype.stop=Gr.prototype.stop,Gr.prototype.init=function(e){this.m=e},Gr.prototype.init=Gr.prototype.init,Gr.prototype.chooseVariant=function(){var e=Xr(this.g.restrictions,this.l),t=this.h.getBandwidthEstimate(this.g.defaultBandwidthEstimate);this.l.length&&!e.length&&(K.v("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),e=[(e=Xr(null,this.l))[0]]);for(var r=e[0]||null,n=0;n<e.length;++n){var i=e[n],a=i.bandwidth/this.g.bandwidthDowngradeTarget,o=(e[n+1]||{bandwidth:1/0}).bandwidth/this.g.bandwidthUpgradeTarget;K.O("Bandwidth ranges:",(i.bandwidth/1e6).toFixed(3),(a/1e6).toFixed(3),(o/1e6).toFixed(3)),t>=a&&t<=o&&(r=i)}return this.j=Date.now(),r},Gr.prototype.chooseVariant=Gr.prototype.chooseVariant,Gr.prototype.enable=function(){this.i=!0},Gr.prototype.enable=Gr.prototype.enable,Gr.prototype.disable=function(){this.i=!1},Gr.prototype.disable=Gr.prototype.disable,Gr.prototype.segmentDownloaded=function(e,t){K.O("Segment downloaded:","deltaTimeMs="+e,"numBytes="+t,"lastTimeChosenMs="+this.j,"enabled="+this.i);var r=this.h;if(!(16e3>t)){var n=8e3*t/e,i=e/1e3;r.g+=t,B(r.h,i,n),B(r.i,i,n)}if(null!=this.j&&this.i)e:{if(K.O("Suggesting Streams..."),this.o){if(Date.now()-this.j<1e3*this.g.switchInterval){K.O("Still within switch interval...");break e}}else{if(!(128e3<=this.h.g)){K.O("Still waiting for a good estimate...");break e}this.o=!0}r=this.chooseVariant(),n=this.h.getBandwidthEstimate(this.g.defaultBandwidthEstimate),K.debug("Calling switch_(), bandwidth="+Math.round(n/1e3)+" kbps"),this.m(r)}},Gr.prototype.segmentDownloaded=Gr.prototype.segmentDownloaded,Gr.prototype.getBandwidthEstimate=function(){return this.h.getBandwidthEstimate(this.g.defaultBandwidthEstimate)},Gr.prototype.getBandwidthEstimate=Gr.prototype.getBandwidthEstimate,Gr.prototype.setVariants=function(e){this.l=e},Gr.prototype.setVariants=Gr.prototype.setVariants,Gr.prototype.configure=function(e){this.g=e},Gr.prototype.configure=Gr.prototype.configure,Wr.prototype.toString=function(){return"v"+this.g+"."+this.h};var Yr=null,jr="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),Kr="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),Hr=["loop","playbackRate"],zr=["pause","play"],Jr="abrstatuschanged adaptation buffering drmsessionupdate emsg error expirationupdated largegap loading manifestparsed onstatechange onstateidle streaming textchanged texttrackvisibility timelineregionadded timelineregionenter timelineregionexit trackschanged unloading variantchanged".split(" "),Qr={getAssetUri:2,getAudioLanguages:4,getAudioLanguagesAndRoles:4,getBufferedInfo:2,getConfiguration:2,getExpiration:2,getPlaybackRate:2,getTextLanguages:4,getTextLanguagesAndRoles:4,getTextTracks:2,getStats:5,getVariantTracks:2,isAudioOnly:10,isBuffering:1,isInProgress:1,isLive:10,isTextTrackVisible:1,keySystem:10,seekRange:1,usingEmbeddedTextTrack:2,getLoadMode:10},qr={getPlayheadTimeAsDate:1,getPresentationStartTimeAsDate:20},en=[["getConfiguration","configure"]],tn=[["isTextTrackVisible","setTextTrackVisibility"]],rn="addTextTrack cancelTrickPlay configure resetConfiguration retryStreaming selectAudioLanguage selectEmbeddedTextTrack selectTextLanguage selectTextTrack selectVariantTrack selectVariantsByLabel setTextTrackVisibility trickPlay".split(" "),nn=["attach","detach","load","unload"];function an(e){return JSON.stringify(e,(function(e,t){if("function"!=typeof t){if(t instanceof Event||t instanceof Ze){var r={};for(i in t){var n=t[i];n&&"object"==typeof n?"detail"==i&&(r[i]=n):i in Event||(r[i]=n)}return r}if(t instanceof Error){var i=new Set(["name","message","stack"]);for(r in t)i.add(r);for(r=(n=h(Object.getOwnPropertyNames(t))).next();!r.done;r=n.next())i.add(r.value);for(n={},r=(i=h(i)).next();!r.done;r=i.next())n[r=r.value]=t[r];i={__type__:"Error",contents:n}}else if(t instanceof TimeRanges)for(i={__type__:"TimeRanges",length:t.length,start:[],end:[]},r=0;r<t.length;++r)i.start.push(t.start(r)),i.end.push(t.end(r));else i=t instanceof Uint8Array?{__type__:"Uint8Array",entries:Array.from(t)}:"number"==typeof t?isNaN(t)?"NaN":isFinite(t)?t:0>t?"-Infinity":"Infinity":t;return i}}))}function on(e){return JSON.parse(e,(function(e,t){if("NaN"==t)var r=NaN;else if("-Infinity"==t)r=-1/0;else if("Infinity"==t)r=1/0;else if(t&&"object"==typeof t&&"TimeRanges"==t.__type__)r=function(e){return{length:e.length,start:function(t){return e.start[t]},end:function(t){return e.end[t]}}}(t);else if(t&&"object"==typeof t&&"Uint8Array"==t.__type__)r=new Uint8Array(t.entries);else if(t&&"object"==typeof t&&"Error"==t.__type__){r=t.contents;var n,i=Error(r.message);for(n in r)i[n]=r[n];r=i}else r=t;return r}))}function sn(e,t,r,n,i,a){this.X=e,this.j=new Re(t),this.Z=r,this.u=!1,this.F=n,this.P=i,this.L=a,this.h=this.m=!1,this.M="",this.o=null,this.A=this.yd.bind(this),this.C=this.ag.bind(this),this.g={video:{},player:{}},this.J=0,this.i={},this.l=null,yn.add(this)}var un=!1,cn=null;function ln(e){for(var t=h(yn),r=t.next();!r.done;r=t.next())dn(r.value,e)}function dn(e,t){K.debug("CastSender: onExistingSessionJoined");var r=e.L();e.l=new me,e.u=!0,e.Ad(r,t)}function hn(e){for(var t=h(yn),r=t.next();!r.done;r=t.next()){r=r.value;var n=e;K.debug("CastSender: receiver status",n),un="available"==n,r.j.Lc()}}function fn(e){var t=cn;t.removeUpdateListener(e.A),t.removeMessageListener("urn:x-cast:com.google.shaka.v2",e.C)}function pn(e){for(var t in e.i){var r=e.i[t];delete e.i[t],r.reject(new H(1,7,7e3))}}function mn(e,t){var r=an(t),n=cn;try{n.sendMessage("urn:x-cast:com.google.shaka.v2",r,(function(){}),K.error)}catch(t){throw K.error("Cast session sendMessage threw",t),r=new H(2,8,8005,t),e.F("player",new Ze("error",{detail:r})),e.Bb(),r}}(n=sn.prototype).destroy=function(){return yn.delete(this),pn(this),cn&&fn(this),this.j&&(this.j.stop(),this.j=null),this.P=this.F=null,this.h=this.m=!1,this.C=this.A=this.l=this.i=this.g=this.o=null,Promise.resolve()},n.la=function(){return this.h},n.Dd=function(){return this.M},n.init=function(){if(this.X.length)if(e.chrome&&chrome.cast&&chrome.cast.isAvailable){this.m=!0,this.j.Lc();var t=new chrome.cast.SessionRequest(this.X);t=new chrome.cast.ApiConfig(t,ln.bind(this),hn.bind(this),"origin_scoped"),chrome.cast.initialize(t,(function(){K.debug("CastSender: init")}),(function(e){K.error("CastSender: init error",e)})),un&&this.j.V(.02),(t=cn)&&t.status!=chrome.cast.SessionStatus.STOPPED?(K.debug("CastSender: re-using existing connection"),dn(this,t)):cn=null}else e.__onGCastApiAvailable||(e.__onGCastApiAvailable=gn),e.__onGCastApiAvailable!=gn&&K.ba("A global Cast SDK hook is already installed! Shaka Player will be unable to receive a notification when the Cast SDK is ready.")},n.Md=function(e){this.o=e,this.h&&mn(this,{type:"appData",appData:this.o})},n.cast=function(e){return this.m?un?this.h?Promise.reject(new H(1,8,8002)):(this.l=new me,chrome.cast.requestSession(this.Ad.bind(this,e),this.ve.bind(this)),this.l):Promise.reject(new H(1,8,8001)):Promise.reject(new H(1,8,8e3))},n.Bb=function(){if(this.h){if(pn(this),cn){fn(this);try{cn.stop((function(){}),(function(){}))}catch(e){}cn=null}this.yd()}},n.get=function(e,t){if("video"==e){if(zr.includes(t))return this.Ee.bind(this,e,t)}else if("player"==e){if(qr[t]&&!this.get("player","isLive")())return function(){};if(rn.includes(t))return this.Ee.bind(this,e,t);if(nn.includes(t))return this.rg.bind(this,e,t);if(Qr[t])return this.Be.bind(this,e,t)}return this.Be(e,t)},n.set=function(e,t,r){this.g[e][t]=r,mn(this,{type:"set",targetName:e,property:t,value:r})},n.Ad=function(e,t){K.debug("CastSender: onSessionInitiated"),cn=t,t.addUpdateListener(this.A),t.addMessageListener("urn:x-cast:com.google.shaka.v2",this.C),this.yd(),mn(this,{type:"init",initState:e,appData:this.o}),this.l.resolve()},n.ve=function(e){var t=8003;switch(e.code){case"cancel":t=8004;break;case"timeout":t=8005;break;case"receiver_unavailable":t=8006}this.l.reject(new H(2,8,t,e))},n.Be=function(e,t){return this.g[e][t]},n.Ee=function(e,t,r){for(var n=[],i=2;i<arguments.length;++i)n[i-2]=arguments[i];mn(this,{type:"call",targetName:e,methodName:t,args:n})},n.rg=function(e,t,r){for(var n=[],i=2;i<arguments.length;++i)n[i-2]=arguments[i];i=new me;var a=this.J.toString();this.J++,this.i[a]=i;try{mn(this,{type:"asyncCall",targetName:e,methodName:t,args:n,id:a})}catch(e){i.reject(e)}return i},n.yd=function(){var e=!!cn&&"connected"==cn.status;if(K.debug("CastSender: connection status",e),this.h&&!e){for(var t in this.P(),this.g)this.g[t]={};pn(this)}this.M=(this.h=e)?cn.receiver.friendlyName:"",this.j.Lc()},n.ag=function(e,t){var r=on(t);switch(K.O("CastSender: message",r),r.type){case"event":var n=r.event;this.F(r.targetName,new Ze(n.type,n));break;case"update":for(var i in n=r.update)for(var a in r=this.g[i]||{},n[i])r[a]=n[i][a];this.u&&(this.Z(),this.u=!1);break;case"asyncComplete":if(i=r.id,r=r.error,a=this.i[i],delete this.i[i],a)if(r){for(n in i=new H(r.severity,r.category,r.code),r)i[n]=r[n];a.reject(i)}else a.resolve()}};var yn=new Set;function gn(e){if(e)for(var t=(e=h(yn)).next();!t.done;t=e.next())t.value.init()}function vn(e,t,r){var n=this;Ne.call(this),this.i=e,this.h=t,this.o=this.l=this.j=this.u=this.m=null,this.C=r,this.A=new Map,this.g=new sn(r,(function(){return An(n)}),(function(){return Tn(n)}),(function(e,t){return $n(n,e,t)}),(function(){return En(n)}),(function(){return _n(n)})),function(e){for(var t in e.g.init(),e.o=new et,jr.forEach(function(e){this.o.H(this.i,e,this.L.bind(this))}.bind(e)),Jr.forEach(function(e){this.o.H(this.h,e,this.F.bind(this))}.bind(e)),e.m={},e.i)Object.defineProperty(e.m,t,{configurable:!1,enumerable:!0,get:e.J.bind(e,t),set:e.M.bind(e,t)});e.u={},bn(e,(function(t){Object.defineProperty(e.u,t,{configurable:!1,enumerable:!0,get:function(){return Sn(e,t)}})})),function(e){var t=new Map;bn(e,(function(r,n){if(t.has(n)){var i=t.get(n);r.length<i.length?e.A.set(r,i):e.A.set(i,r)}else t.set(n,r)}))}(e),e.j=new Ne,e.j.jc=e.m,e.l=new Ne,e.l.jc=e.u}(this)}function bn(e,t){function r(e){return"constructor"!=e&&"function"==typeof n[e]&&!i.has(e)}var n=e.h,i=new Set;for(a in n)r(a)&&(i.add(a),t(a,n[a]));for(var a=Object.getPrototypeOf(n),o=Object.getPrototypeOf({});a&&a!=o;){for(var s=h(Object.getOwnPropertyNames(a)),u=s.next();!u.done;u=s.next())r(u=u.value)&&(i.add(u),t(u,n[u]));a=Object.getPrototypeOf(a)}}function _n(e){var t={video:{},player:{},playerAfterLoad:{},manifest:e.h.tc(),startTime:null};return e.i.pause(),Hr.forEach(function(e){t.video[e]=this.i[e]}.bind(e)),e.i.ended||(t.startTime=e.i.currentTime),en.forEach(function(e){var r=e[1];e=this.h[e[0]](),t.player[r]=e}.bind(e)),tn.forEach(function(e){var r=e[1];e=this.h[e[0]](),t.playerAfterLoad[r]=e}.bind(e)),t}function An(e){e.dispatchEvent(new Ze("caststatuschanged"))}function Tn(e){e.j.dispatchEvent(new Ze(e.m.paused?"pause":"play"))}function En(e){en.forEach(function(e){var t=e[1];e=this.g.get("player",e[0])(),this.h[t](e)}.bind(e));var t=e.g.get("player","getAssetUri")(),r=e.g.get("video","ended"),n=Promise.resolve(),i=e.i.autoplay,a=null;r||(a=e.g.get("video","currentTime")),t&&(e.i.autoplay=!1,n=e.h.load(t,a));var o={};Hr.forEach(function(e){o[e]=this.g.get("video",e)}.bind(e)),n.then((function(){e.i&&(Hr.forEach(function(e){this.i[e]=o[e]}.bind(e)),tn.forEach(function(e){var t=e[1];e=this.g.get("player",e[0])(),this.h[t](e)}.bind(e)),e.i.autoplay=i,t&&e.i.play())}),(function(t){e.h.dispatchEvent(new Ze("error",{detail:t}))}))}function Sn(e,t){if(e.A.has(t)&&(t=e.A.get(t)),"addEventListener"==t)return e.l.addEventListener.bind(e.l);if("removeEventListener"==t)return e.l.removeEventListener.bind(e.l);if("getMediaElement"==t)return function(){return this.m}.bind(e);if("getSharedConfiguration"==t)return K.v("Can't share configuration across a network. Returning copy."),e.g.get("player","getConfiguration");if("getNetworkingEngine"==t)return e.g.la()&&K.v("NOTE: getNetworkingEngine() is always local!"),e.h.Yb.bind(e.h);if(e.g.la()){if("getManifest"==t||"drmInfo"==t)return function(){return K.ba(t+"() does not work while casting!"),null};if("getManifestUri"==t)return Ur("getManifestUri",'Please use "getAssetUri" instead.'),Sn(e,"getAssetUri");if("attach"==t||"detach"==t)return function(){return K.ba(t+"() does not work while casting!"),Promise.resolve()}}return e.g.la()&&0==Object.keys(e.g.g.video).length&&Qr[t]||!e.g.la()?e.h[t].bind(e.h):e.g.get("player",t)}function $n(e,t,r){e.g.la()&&("video"==t?e.j.dispatchEvent(r):"player"==t&&e.l.dispatchEvent(r))}function In(e,t,r,n){var i=this;Ne.call(this),this.g=e,this.h=t,this.i=new et,this.L={video:e,player:t},this.C=r||function(){},this.M=n||function(e){return e},this.F=!1,this.m=!0,this.l=0,this.A=!1,this.u=!0,this.o=this.j=null,this.J=new Re((function(){Rn(i)})),function(e){var t=cast.receiver.CastReceiverManager.getInstance();t.onSenderConnected=e.xe.bind(e),t.onSenderDisconnected=e.xe.bind(e),t.onSystemVolumeChanged=e.hf.bind(e),e.o=t.getCastMessageBus("urn:x-cast:com.google.cast.media"),e.o.onMessage=e.Wf.bind(e),e.j=t.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.j.onMessage=e.fg.bind(e),t.start(),jr.forEach(function(e){this.i.H(this.g,e,this.Ce.bind(this,"video"))}.bind(e)),Jr.forEach(function(e){this.i.H(this.h,e,this.Ce.bind(this,"player"))}.bind(e)),cast.__platform__&&cast.__platform__.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')?e.h.Nd(3840,2160):e.h.Nd(1920,1080),e.i.H(e.g,"loadeddata",function(){this.A=!0}.bind(e)),e.i.H(e.h,"loading",function(){this.m=!1,wn(this)}.bind(e)),e.i.H(e.g,"playing",function(){this.m=!1,wn(this)}.bind(e)),e.i.H(e.g,"pause",function(){wn(this)}.bind(e)),e.i.H(e.h,"unloading",function(){this.m=!0,wn(this)}.bind(e)),e.i.H(e.g,"ended",function(){var e=this;new Re((function(){e.g&&e.g.ended&&(e.m=!0,wn(e))})).V(5)}.bind(e))}(this)}function wn(e){Promise.resolve().then(function(){this.h&&(this.dispatchEvent(new Ze("caststatuschanged")),kn(this)||xn(this))}.bind(e))}function Rn(e){e.J.V(.5);var t={video:{},player:{}};if(Kr.forEach(function(e){t.video[e]=this.g[e]}.bind(e)),e.h.aa())for(var r in qr)0==e.l%qr[r]&&(t.player[r]=e.h[r]());for(var n in Qr)0==e.l%Qr[n]&&(t.player[n]=e.h[n]());(r=cast.receiver.CastReceiverManager.getInstance().getSystemVolume())&&(t.video.volume=r.level,t.video.muted=r.muted),e.A&&(e.l+=1),Cn(e,{type:"update",update:t},e.j),kn(e)}function kn(e){return!(!e.u||!e.g.duration&&!e.h.aa())&&(Pn(e),e.u=!1,!0)}function Pn(e,t){t=void 0===t?0:t;var r={contentId:e.h.tc(),streamType:e.h.aa()?"LIVE":"BUFFERED",contentType:""};e.h.aa()||(r.duration=e.g.duration),xn(e,t,r)}function Cn(e,t,r,n){e.F&&(e=an(t),n?r.getCastChannel(n).send(e):r.broadcast(e))}function xn(e,t,r){t=void 0===t?0:t,r=void 0===r?null:r;var n=e.g.playbackRate,i=Ln;n={mediaSessionId:0,playbackRate:n,playerState:i=e.m?i.IDLE:e.h.jd()?i.Re:e.g.paused?i.Te:i.Ue,currentTime:e.g.currentTime,supportedMediaCommands:63,volume:{level:e.g.volume,muted:e.g.muted}},r&&(n.media=r),Cn(e,{requestId:t,type:"MEDIA_STATUS",status:[n]},e.o)}U(vn,Ne),W("shaka.cast.CastProxy",vn),vn.prototype.destroy=function(e){return e&&this.g.Bb(),this.o&&(this.o.release(),this.o=null),e=[],this.h&&(e.push(this.h.destroy()),this.h=null),this.g&&(e.push(this.g.destroy()),this.g=null),this.u=this.m=this.i=null,Promise.all(e)},vn.prototype.destroy=vn.prototype.destroy,vn.prototype.Mf=function(){return this.m},vn.prototype.getVideo=vn.prototype.Mf,vn.prototype.Df=function(){return this.u},vn.prototype.getPlayer=vn.prototype.Df,vn.prototype.Ye=function(){return this.g.m&&un},vn.prototype.canCast=vn.prototype.Ye,vn.prototype.la=function(){return this.g.la()},vn.prototype.isCasting=vn.prototype.la,vn.prototype.Dd=function(){return this.g.Dd()},vn.prototype.receiverName=vn.prototype.Dd,vn.prototype.cast=function(){var e=_n(this);return this.g.cast(e).then(function(){if(this.h)return this.h.Ud()}.bind(this))},vn.prototype.cast=vn.prototype.cast,vn.prototype.Md=function(e){this.g.Md(e)},vn.prototype.setAppData=vn.prototype.Md,vn.prototype.Kg=function(){var e=this.g;if(e.h){var t=e.L();chrome.cast.requestSession(e.Ad.bind(e,t),e.ve.bind(e))}},vn.prototype.suggestDisconnect=vn.prototype.Kg,vn.prototype.af=function(e){var t=this;return p((function r(){return M(r,(function(r){switch(r.s){case 1:return e==t.C?r.return():(t.C=e,t.g.Bb(),S(r,t.g.destroy(),2));case 2:t.g=null,t.g=new sn(e,(function(){return An(t)}),(function(){return Tn(t)}),(function(e,r){return $n(t,e,r)}),(function(){return En(t)}),(function(){return _n(t)})),t.g.init(),$(r)}}))}))},vn.prototype.changeReceiverId=vn.prototype.af,vn.prototype.Bb=function(){this.g.Bb()},vn.prototype.forceDisconnect=vn.prototype.Bb,vn.prototype.J=function(e){if("addEventListener"==e)return this.j.addEventListener.bind(this.j);if("removeEventListener"==e)return this.j.removeEventListener.bind(this.j);if(this.g.la()&&0==Object.keys(this.g.g.video).length){var t=this.i[e];if("function"!=typeof t)return t}return this.g.la()?this.g.get("video",e):("function"==typeof(e=this.i[e])&&(e=e.bind(this.i)),e)},vn.prototype.M=function(e,t){this.g.la()?this.g.set("video",e,t):this.i[e]=t},vn.prototype.L=function(e){this.g.la()||this.j.dispatchEvent(new Ze(e.type,e))},vn.prototype.F=function(e){this.g.la()||this.l.dispatchEvent(e)},U(In,Ne),W("shaka.cast.CastReceiver",In),In.prototype.isConnected=function(){return this.F},In.prototype.isConnected=In.prototype.isConnected,In.prototype.Rf=function(){return this.m},In.prototype.isIdle=In.prototype.Rf,In.prototype.destroy=function(){var e=this;return p((function t(){var r;return M(t,(function(t){switch(t.s){case 1:return e.i&&(e.i.release(),e.i=null),r=[],e.h&&(r.push(e.h.destroy()),e.h=null),e.J&&(e.J.stop(),e.J=null),e.g=null,e.L=null,e.C=null,e.F=!1,e.m=!0,e.j=null,e.o=null,S(t,Promise.all(r),2);case 2:cast.receiver.CastReceiverManager.getInstance().stop(),$(t)}}))}))},In.prototype.destroy=In.prototype.destroy,(n=In.prototype).xe=function(){this.l=0,this.u=!0,this.F=0!=cast.receiver.CastReceiverManager.getInstance().getSenders().length,wn(this)},n.Ce=function(e,t){this.h&&(Rn(this),Cn(this,{type:"event",targetName:e,event:t},this.j))},n.hf=function(){var e=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();e&&Cn(this,{type:"update",update:{video:{volume:e.level,muted:e.muted}}},this.j),Cn(this,{type:"event",targetName:"video",event:{type:"volumechange"}},this.j)},n.fg=function(e){var t=on(e.data);switch(K.debug("CastReceiver: message",t),t.type){case"init":this.l=0,this.A=!1,this.u=!0,function(e,t,r){for(var n in t.player)e.h[n](t.player[n]);e.C(r),r=Promise.resolve();var i=e.g.autoplay;t.manifest&&(e.g.autoplay=!1,r=e.h.load(t.manifest,t.startTime)),r.then((function(){if(e.h){for(var r in t.video)e.g[r]=t.video[r];for(var n in t.playerAfterLoad)e.h[n](t.playerAfterLoad[n]);e.g.autoplay=i,t.manifest&&(e.g.play(),xn(e))}}),(function(t){e.h.dispatchEvent(new Ze("error",{detail:t}))}))}(this,t.initState,t.appData),Rn(this);break;case"appData":this.C(t.appData);break;case"set":var r=t.targetName,n=t.property;if(t=t.value,"video"==r){var i=cast.receiver.CastReceiverManager.getInstance();if("volume"==n){i.setSystemVolumeLevel(t);break}if("muted"==n){i.setSystemVolumeMuted(t);break}}this.L[r][n]=t;break;case"call":(r=this.L[t.targetName])[t.methodName].apply(r,t.args);break;case"asyncCall":r=t.targetName,n=t.methodName,"player"==r&&"load"==n&&(this.l=0,this.A=!1),i=t.id,e=e.senderId;var a=this.L[r];t=a[n].apply(a,t.args),"player"==r&&"load"==n&&(t=t.then(function(){this.u=!0}.bind(this))),t.then(this.Je.bind(this,e,i,null),this.Je.bind(this,e,i))}},n.Wf=function(e){var t=on(e.data);switch(K.debug("CastReceiver: message",t),t.type){case"PLAY":this.g.play(),xn(this);break;case"PAUSE":this.g.pause(),xn(this);break;case"SEEK":e=t.currentTime;var r=t.resumeState;null!=e&&(this.g.currentTime=Number(e)),r&&"PLAYBACK_START"==r?(this.g.play(),xn(this)):r&&"PLAYBACK_PAUSE"==r&&(this.g.pause(),xn(this));break;case"STOP":this.h.Ud().then(function(){this.h&&xn(this)}.bind(this));break;case"GET_STATUS":Pn(this,Number(t.requestId));break;case"VOLUME":e=(r=t.volume).level,r=r.muted;var n=this.g.volume,i=this.g.muted;null!=e&&(this.g.volume=Number(e)),null!=r&&(this.g.muted=r),n==this.g.volume&&i==this.g.muted||xn(this);break;case"LOAD":this.l=0,this.u=this.A=!1,e=t.media,r=t.currentTime,n=this.M(e.contentId),i=t.autoplay||!0,this.C(e.customData),i&&(this.g.autoplay=!0),this.h.load(n,r).then(function(){this.h&&Pn(this)}.bind(this)).catch(function(e){var r="LOAD_FAILED";7==e.category&&7e3==e.code&&(r="LOAD_CANCELLED"),Cn(this,{requestId:Number(t.requestId),type:r},this.o)}.bind(this));break;default:K.v("Unrecognized message type from the generic Chromecast controller!",t.type),Cn(this,{requestId:Number(t.requestId),type:"INVALID_REQUEST",reason:"INVALID_COMMAND"},this.o)}},n.Je=function(e,t,r){this.h&&Cn(this,{type:"asyncComplete",id:t,error:r},this.j,e)};var Ln={IDLE:"IDLE",Ue:"PLAYING",Re:"BUFFERING",Te:"PAUSED"};function On(e,t){this.S=e,this.h=t==Dn,this.g=0}W("shaka.util.DataViewReader",On);var Dn=1;function Mn(){throw new H(2,3,3e3)}function Zn(){this.i=[],this.h=[],this.g=!1}function Vn(e){for(var t=Un(e);e.reader.Ca()&&!e.parser.g;)e.parser.Fc(e.start+t,e.reader,e.partialOkay)}function Nn(e){for(var t=Un(e),r=e.reader.N();0<r&&!e.parser.g;--r)e.parser.Fc(e.start+t,e.reader,e.partialOkay)}function Gn(e){return function(t){e(t.reader.mb(t.reader.S.byteLength-t.reader.ka()))}}function Xn(e){for(var t=0,r=0;r<e.length;r++)t=t<<8|e.charCodeAt(r);return t}function Wn(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}function Un(e){return 8+(e.has64BitSize?8:0)+(null!=e.flags?4:0)}function Fn(e){var t=this;this.g=[],this.h=[],this.data=[],(new Zn).box("moov",Vn).ma("pssh",(function(e){if(1<e.version)K.v("Unrecognized PSSH version found!");else{var r=e.reader.S;if(r=new Uint8Array(r.buffer,r.byteOffset-12,e.size),t.data.push(r),t.g.push(Ee.Nc(e.reader.mb(16))),0<e.version){r=e.reader.N();for(var n=0;n<r;++n){var i=Ee.Nc(e.reader.mb(16));t.h.push(i)}}}})).parse(e),0==this.data.length&&K.v("No pssh box found!")}On.Endianness={Tg:0,Vg:Dn},On.prototype.Ca=function(){return this.g<this.S.byteLength},On.prototype.hasMoreData=On.prototype.Ca,On.prototype.ka=function(){return this.g},On.prototype.getPosition=On.prototype.ka,On.prototype.sf=function(){return this.S.byteLength},On.prototype.getLength=On.prototype.sf,On.prototype.ra=function(){try{var e=this.S.getUint8(this.g);return this.g+=1,e}catch(e){Mn()}},On.prototype.readUint8=On.prototype.ra,On.prototype.dc=function(){try{var e=this.S.getUint16(this.g,this.h);return this.g+=2,e}catch(e){Mn()}},On.prototype.readUint16=On.prototype.dc,On.prototype.N=function(){try{var e=this.S.getUint32(this.g,this.h);return this.g+=4,e}catch(e){Mn()}},On.prototype.readUint32=On.prototype.N,On.prototype.De=function(){try{var e=this.S.getInt32(this.g,this.h);return this.g+=4,e}catch(e){Mn()}},On.prototype.readInt32=On.prototype.De,On.prototype.Pb=function(){try{if(this.h)var e=this.S.getUint32(this.g,!0),t=this.S.getUint32(this.g+4,!0);else t=this.S.getUint32(this.g,!1),e=this.S.getUint32(this.g+4,!1)}catch(e){Mn()}if(2097151<t)throw new H(2,3,3001);return this.g+=8,t*Math.pow(2,32)+e},On.prototype.readUint64=On.prototype.Pb,On.prototype.mb=function(e){this.g+e>this.S.byteLength&&Mn();var t=new Uint8Array(this.S.buffer,this.S.byteOffset+this.g,e);return this.g+=e,t},On.prototype.readBytes=On.prototype.mb,On.prototype.U=function(e){this.g+e>this.S.byteLength&&Mn(),this.g+=e},On.prototype.skip=On.prototype.U,On.prototype.Fe=function(e){this.g<e&&Mn(),this.g-=e},On.prototype.rewind=On.prototype.Fe,On.prototype.seek=function(e){(0>e||e>this.S.byteLength)&&Mn(),this.g=e},On.prototype.seek=On.prototype.seek,On.prototype.Cd=function(){for(var e=this.g;this.Ca()&&0!=this.S.getUint8(this.g);)this.g+=1;return e=new Uint8Array(this.S.buffer,this.S.byteOffset+e,this.g-e),this.g+=1,ye(e)},On.prototype.readTerminatedString=On.prototype.Cd,W("shaka.util.Mp4Parser",Zn),Zn.prototype.box=function(e,t){var r=Xn(e);return this.i[r]=0,this.h[r]=t,this},Zn.prototype.box=Zn.prototype.box,Zn.prototype.ma=function(e,t){var r=Xn(e);return this.i[r]=1,this.h[r]=t,this},Zn.prototype.fullBox=Zn.prototype.ma,Zn.prototype.stop=function(){this.g=!0},Zn.prototype.stop=Zn.prototype.stop,Zn.prototype.parse=function(e,t){var r=new Uint8Array(e);for(r=new On(new DataView(r.buffer,r.byteOffset,r.byteLength),0),this.g=!1;r.Ca()&&!this.g;)this.Fc(0,r,t)},Zn.prototype.parse=Zn.prototype.parse,Zn.prototype.Fc=function(e,t,r){var n=t.ka(),i=t.N(),a=t.N(),o=!1;switch(K.O("Parsing MP4 box",Wn(a)),i){case 0:i=t.S.byteLength-n;break;case 1:i=t.Pb(),o=!0}var s=this.h[a];if(s){var u=null,c=null;1==this.i[a]&&(u=(c=t.N())>>>24,c&=16777215),a=n+i,r&&a>t.S.byteLength&&(a=t.S.byteLength),a-=t.ka(),t=0<a?t.mb(a):new Uint8Array(0),s({parser:this,partialOkay:r||!1,version:u,flags:c,reader:t=new On(new DataView(t.buffer,t.byteOffset,t.byteLength),0),size:i,start:n+e,has64BitSize:o})}else t.U(Math.min(n+i-t.ka(),t.S.byteLength-t.ka()))},Zn.prototype.parseNext=Zn.prototype.Fc,Zn.children=Vn,Zn.sampleDescription=Nn,Zn.allData=Gn,Zn.typeToString=Wn,Zn.headerSize=Un;var Bn={sc:function(e,t){var r=Bn.Y(e,t);return 1!=r.length?null:r[0]},Yc:function(e,t,r){return 1!=(e=Bn.fe(e,t,r)).length?null:e[0]},Y:function(e,t){return Array.prototype.filter.call(e.childNodes,(function(e){return e instanceof Element&&e.tagName==t}))},fe:function(e,t,r){return Array.prototype.filter.call(e.childNodes,(function(e){return e instanceof Element&&e.localName==r&&e.namespaceURI==t}))},getAttributeNS:function(e,t,r){return e.hasAttributeNS(t,r)?e.getAttributeNS(t,r):null},uc:function(e){return Array.prototype.every.call(e.childNodes,(function(e){return e.nodeType==Node.TEXT_NODE||e.nodeType==Node.CDATA_SECTION_NODE}))?e.textContent.trim():null},R:function(e,t,r,n){n=void 0===n?null:n;var i=null;return null!=(e=e.getAttribute(t))&&(i=r(e)),null==i?n:i},jg:function(e){return e?(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),e=Date.parse(e),isNaN(e)?null:Math.floor(e/1e3)):null},Ma:function(e){if(!e)return null;var t=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(e);return t?(e=31536e3*Number(t[1]||null)+2592e3*Number(t[2]||null)+86400*Number(t[3]||null)+3600*Number(t[4]||null)+60*Number(t[5]||null)+Number(t[6]||null),isFinite(e)?e:null):(K.v("Invalid duration string:",e),null)},Hc:function(e){var t=/([0-9]+)-([0-9]+)/.exec(e);return t?(e=Number(t[1]),isFinite(e)?(t=Number(t[2]),isFinite(t)?{start:e,end:t}:null):null):null},parseInt:function(e){return 0==(e=Number(e))%1?e:null},Gc:function(e){return 0==(e=Number(e))%1&&0<e?e:null},Mb:function(e){return 0==(e=Number(e))%1&&0<=e?e:null},parseFloat:function(e){return e=Number(e),isNaN(e)?null:e},ff:function(e){var t;return e=(t=e.match(/^(\d+)\/(\d+)$/))?Number(t[1])/Number(t[2]):Number(e),isNaN(e)?null:e},Ae:function(e,t){var r=new DOMParser;try{var n=r.parseFromString(e,"text/xml")}catch(e){}if(n&&n.documentElement.tagName==t)var i=n.documentElement;return i&&0<i.getElementsByTagName("parsererror").length?null:i},ze:function(e,t){try{var r=ye(e);return Bn.Ae(r,t)}catch(e){}}},Yn=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b","org.w3.clearkey").set("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine.alpha").set("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95","com.microsoft.playready").set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95","com.microsoft.playready").set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb","com.adobe.primetime");function jn(e,t,r){var n=function(e){for(var t=[],r=(e=h(e)).next();!r.done;r=e.next())(r=zn(r.value))&&t.push(r);return t}(e),i=null;e=[];var a=[],o=new Set(n.map((function(e){return e.keyId})));if(o.delete(null),1<o.size)throw new H(2,4,4010);if(r||(a=n.filter((function(e){return"urn:mpeg:dash:mp4protection:2011"!=e.Ge||(i=e.init||i,!1)}))).length&&(e=function(e,t,r){for(var n=[],i=(r=h(r)).next();!i.done;i=r.next()){i=i.value;var a=Yn.get(i.Ge);if(a){var o;if(o=Bn.Yc(i.node,"urn:microsoft:playready","pro")){o=Ee.Ja(o.textContent);var s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),u=o.length,c=s.length+16+u,l=new ArrayBuffer(c),d=new Uint8Array(l),f=0;(l=new DataView(l)).setUint32(f,c),f+=4,l.setUint32(f,1886614376),f+=4,l.setUint32(f,0),f+=4,d.set(s,f),f+=s.length,l.setUint32(f,u),f+=4,d.set(o,f),o=[{initData:d,initDataType:"cenc",keyId:i.keyId}]}else o=null;o=he(a,i.init||e||o),(a=Hn.get(a))&&(o.licenseServerUri=a(i)),n.push(o)}else for(a=(i=h(i=t(i.node)||[])).next();!a.done;a=i.next())n.push(a.value)}return n}(i,t,a),0==e.length&&(e=[he("",i)])),n.length&&(r||!a.length))for(e=[],r=(t=h(Yn.values())).next();!r.done;r=t.next())"org.w3.clearkey"!=(r=r.value)&&e.push(he(r,i));if(o=Array.from(o)[0]||null)for(r=(t=h(e)).next();!r.done;r=t.next())for(n=(r=h(r.value.initData)).next();!n.done;n=r.next())n.value.keyId=o;return{be:o,Xg:i,drmInfos:e,ge:!0}}var Kn,Hn=(new Map).set("com.widevine.alpha",(function(e){return(e=Bn.Yc(e.node,"urn:microsoft","laurl"))&&e.getAttribute("licenseUrl")||""})).set("com.microsoft.playready",(function(e){return(e=Bn.Yc(e.node,"urn:microsoft:playready","pro"))&&(e=function(e){var t=0,r=new DataView(e).getUint32(t,!0);if(t+=4,r!==e.byteLength)return K.v("PlayReady Object with invalid length encountered."),[];t+=2,r=[];for(var n=new DataView(e);t<e.byteLength-1;){var i=n.getUint16(t,!0);t+=2;var a=n.getUint16(t,!0);t+=2;var o=new Uint8Array(e,t,a);r.push({type:i,value:o}),t+=a}return r}((e=Ee.Ja(e.textContent)).buffer).filter((function(e){return 1===e.type}))[0])?(e=ge(e.value,!0),(e=Bn.Ae(e,"WRMHEADER"))?function(e){for(var t=(e=h(e.getElementsByTagName("DATA"))).next();!t.done;t=e.next())for(var r=(t=h(t.value.childNodes)).next();!r.done;r=t.next())if((r=r.value)instanceof Element&&"LA_URL"==r.tagName)return r.textContent;return""}(e):""):""}));function zn(e){var t=e.getAttribute("schemeIdUri"),r=Bn.getAttributeNS(e,"urn:mpeg:cenc:2013","default_KID"),n=Bn.fe(e,"urn:mpeg:cenc:2013","pssh").map(Bn.uc);if(!t)return K.error("Missing required schemeIdUri attribute on","ContentProtection element",e),null;if(t=t.toLowerCase(),r&&(r=r.replace(/-/g,"").toLowerCase()).includes(" "))throw new H(2,4,4009);var i=[];try{i=n.map((function(e){return{initDataType:"cenc",initData:Ee.Ja(e),keyId:null}}))}catch(e){throw new H(2,4,4007)}return{node:e,Ge:t,keyId:r,init:0<i.length?i:null}}function Jn(t,r,n,i,a){var o={RepresentationID:r,Number:n,Bandwidth:i,Time:a};return t.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g,(function(r,n,i,a){if("$$"==r)return"$";var s=o[n];if(null==s)return K.v("URL template does not have an available substitution for identifier",'"'+n+'":',t),r;switch("RepresentationID"==n&&i&&(K.v("URL template should not contain a width specifier for identifier",'"RepresentationID":',t),i=void 0),"Time"==n&&(s=Math.round(s)),a){case void 0:case"d":case"i":case"u":r=s.toString();break;case"o":r=s.toString(8);break;case"x":r=s.toString(16);break;case"X":r=s.toString(16).toUpperCase();break;default:r=s.toString()}return i=e.parseInt(i,10)||1,Array(Math.max(0,i-r.length)+1).join("0")+r}))}function Qn(e,t){var r=qn(e,t,"timescale"),n=1;r&&(n=Bn.Gc(r)||1),r=qn(e,t,"duration"),(r=Bn.Gc(r||""))&&(r/=n);var i=qn(e,t,"startNumber"),a=Number(qn(e,t,"presentationTimeOffset"))||0,o=Bn.Mb(i||"");null!=i&&null!=o||(o=1);var s=ei(e,t,"SegmentTimeline");if(i=null,s){i=n;var u=e.$.duration||1/0;s=Bn.Y(s,"S");for(var c=[],l=-a,d=0;d<s.length;++d){var h=s[d],f=Bn.R(h,"t",Bn.Mb),p=Bn.R(h,"d",Bn.Mb),m=Bn.R(h,"r",Bn.parseInt);if(null!=f&&(f-=a),!p){K.v('"S" element must have a duration:','ignoring the remaining "S" elements.',h);break}if(f=null!=f?f:l,0>(m=m||0))if(d+1<s.length){if(null==(m=Bn.R(s[d+1],"t",Bn.Mb))){K.v('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:','ignoring the remaining "S" elements.',h);break}if(f>=m){K.v('An "S" element cannot have a negative repeat','if its start time exceeds the next "S" element\'s start time:','ignoring the remaining "S" elements.',h);break}m=Math.ceil((m-f)/p)-1}else{if(1/0==u){K.v('The last "S" element cannot have a negative repeat',"if the Period has an infinite duration:",'ignoring the last "S" element.',h);break}if(f/i>=u){K.v('The last "S" element cannot have a negative repeat',"if its start time exceeds the Period's duration:",'igoring the last "S" element.',h);break}m=Math.ceil((u*i-f)/p)-1}for(0<c.length&&f!=l&&(Math.abs((f-l)/i)>=pe&&K.v("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",h),c[c.length-1].end=f/i),h=0;h<=m;++h)l=f+p,c.push({start:f/i,end:l/i,Pg:f}),f=l}i=c}return{timescale:n,ia:r,ob:o,sa:a/n||0,Vd:a,W:i}}function qn(e,t,r){return[t(e.G),t(e.fa),t(e.qa)].filter(le.Ra).map((function(e){return e.getAttribute(r)})).reduce((function(e,t){return e||t}))}function ei(e,t,r){return[t(e.G),t(e.fa),t(e.qa)].filter(le.Ra).map((function(e){return Bn.sc(e,r)})).reduce((function(e,t){return e||t}))}function ti(e,t,r,n,i,a){if(a=void 0===a?0:a,Bn.getAttributeNS(e,"http://www.w3.org/1999/xlink","href")){var o=function(e,t,r,n,i,a){for(var o=Bn.getAttributeNS(e,"http://www.w3.org/1999/xlink","href"),s=Bn.getAttributeNS(e,"http://www.w3.org/1999/xlink","actuate")||"onRequest",u=0;u<e.attributes.length;u++){var c=e.attributes[u];"http://www.w3.org/1999/xlink"==c.namespaceURI&&(e.removeAttributeNS(c.namespaceURI,c.localName),--u)}if(5<=a)return xe(new H(2,4,4028));if("onLoad"!=s)return xe(new H(2,4,4027));var l=de([n],[o]);return i.request(0,He(l,t)).ca((function(n){if(!(n=Bn.ze(n.data,e.tagName)))return xe(new H(2,4,4001,o));for(;e.childNodes.length;)e.removeChild(e.childNodes[0]);for(;n.childNodes.length;){var s=n.childNodes[0];n.removeChild(s),e.appendChild(s)}for(s=0;s<n.attributes.length;s++){var u=n.attributes[s].nodeName,c=n.getAttribute(u);e.setAttribute(u,c)}return ti(e,t,r,l[0],i,a+1)}))}(e,t,r,n,i,a);return r&&(o=o.ca(void 0,(function(){return ti(e,t,r,n,i,a)}))),o}o=[];for(var s=0;s<e.childNodes.length;s++){var u=e.childNodes[s];u instanceof Element&&("urn:mpeg:dash:resolve-to-zero:2013"==Bn.getAttributeNS(u,"http://www.w3.org/1999/xlink","href")?(e.removeChild(u),--s):"SegmentTimeline"!=u.tagName&&o.push(ti(u,t,r,n,i,a)))}return Me(o).ca((function(){return e}))}function ri(e,t,r){this.i=e,this.h=t,this.g=r}function ni(e,t,r,n,i,a){this.position=e,this.startTime=t,this.endTime=r,this.i=n,this.h=i,this.g=a}function ii(e,t,r,n){var i,a=(new Zn).ma("sidx",(function(e){i=function(e,t,r,n){var i=[];n.reader.U(4);var a=n.reader.N();if(0==a)throw K.error("Invalid timescale."),new H(2,3,3005);if(0==n.version)var o=n.reader.N(),s=n.reader.N();else o=n.reader.Pb(),s=n.reader.Pb();n.reader.U(2);var u=n.reader.dc();for(e=e+n.size+s,s=0;s<u;s++){var c=n.reader.N(),l=(2147483648&c)>>>31;c&=2147483647;var d=n.reader.N();if(n.reader.U(4),1==l)throw K.error("Heirarchical SIDXs are not supported."),new H(2,3,3006);i.push(new ni(i.length,o/a-t,(o+d)/a-t,(function(){return r}),e,e+c-1)),o+=d,e+=c}return n.parser.stop(),i}(t,n,r,e)}));if(e&&a.parse(e),i)return i;throw K.error('Invalid box type, expected "sidx".'),new H(2,3,3004)}function ai(e){this.g=e}function oi(e,t){for(;e.g.length&&e.g[e.g.length-1].startTime>=t;)e.g.pop();for(;e.g.length&&0>=e.g[0].endTime;)e.g.shift();if(0!=e.g.length){var r=e.g[e.g.length-1];e.g[e.g.length-1]=new ni(r.position,r.startTime,t,r.i,r.h,r.g)}}function si(e){this.h=e,this.g=new On(e,0),Kn||(Kn=[new Uint8Array([255]),new Uint8Array([127,255]),new Uint8Array([63,255,255]),new Uint8Array([31,255,255,255]),new Uint8Array([15,255,255,255,255]),new Uint8Array([7,255,255,255,255,255]),new Uint8Array([3,255,255,255,255,255,255]),new Uint8Array([1,255,255,255,255,255,255,255])])}function ui(e){var t=ci(e);if(7<t.length)throw new H(2,3,3002);for(var r=0,n=0;n<t.length;n++)r=256*r+t[n];t=r,r=ci(e);e:{n=Ee.Ha;for(var i=0;i<Kn.length;i++)if(n(r,Kn[i])){n=!0;break e}n=!1}if(n)r=e.h.byteLength-e.g.ka();else{if(8==r.length&&224&r[1])throw new H(2,3,3001);for(n=r[0]&(1<<8-r.length)-1,i=1;i<r.length;i++)n=256*n+r[i];r=n}return r=e.g.ka()+r<=e.h.byteLength?r:e.h.byteLength-e.g.ka(),n=new DataView(e.h.buffer,e.h.byteOffset+e.g.ka(),r),e.g.U(r),new li(t,n)}function ci(e){var t,r=e.g.ra();for(t=1;8>=t&&!(r&1<<8-t);t++);if(8<t)throw new H(2,3,3002);var n=new Uint8Array(t);for(n[0]=r,r=1;r<t;r++)n[r]=e.g.ra();return n}function li(e,t){this.id=e,this.g=t}function di(e){if(8<e.g.byteLength)throw new H(2,3,3002);if(8==e.g.byteLength&&224&e.g.getUint8(0))throw new H(2,3,3001);for(var t=0,r=0;r<e.g.byteLength;r++){t=256*t+e.g.getUint8(r)}return t}function hi(){}function fi(e){var t=new si(e.g);if(179!=(e=ui(t)).id)throw K.v("Not a CueTime element."),new H(2,3,3013);if(e=di(e),183!=(t=ui(t)).id)throw K.v("Not a CueTrackPositions element."),new H(2,3,3012);t=new si(t.g);for(var r=0;t.Ca();){var n=ui(t);if(241==n.id){r=di(n);break}}return{Qg:e,qg:r}}function pi(e,t){var r=ei(e,t,"Initialization");if(!r)return null;var n=e.G.xa,i=r.getAttribute("sourceURL");i&&(n=de(e.G.xa,[i])),i=0;var a=null;return(r=Bn.R(r,"range",Bn.Hc))&&(i=r.start,a=r.end),new ri((function(){return n}),i,a)}function mi(e,t,r,n,i,a,o,s){var u=e.presentationTimeline,c=!e.zb||!e.$.ld,l=e.$.start,d=e.$.duration,h=t,f=null;return{createSegmentIndex:function(){var e=[h(n,i,a),"webm"==o?h(r.i(),r.h,r.g):null];return h=null,Promise.all(e).then((function(e){var t=e[0];e=e[1]||null,t="mp4"==o?ii(t,i,n,s):(new hi).parse(t,e,n,s),u.Jb(t,l),f=new ai(t),c&&oi(f,d)}))},findSegmentPosition:function(e){return f.find(e)},getSegmentReference:function(e){return f.get(e)}}}function yi(e){return e.ec}function gi(e,t){var r=pi(e,vi),n=function(e){return[e.G.Ua,e.fa.Ua,e.qa.Ua].filter(le.Ra).map((function(e){return Bn.Y(e,"SegmentURL")})).reduce((function(e,t){return 0<e.length?e:t})).map((function(t){return t.getAttribute("indexRange")&&!e.me&&(e.me=!0,K.v("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate.")),{Tf:t.getAttribute("media"),start:(t=Bn.R(t,"mediaRange",Bn.Hc,{start:0,end:null})).start,end:t.end}}))}(e),i=Qn(e,vi),a=i.ob;0==a&&(K.v("SegmentList@startNumber must be > 0"),a=1);var o=0;if(i.ia?o=i.ia*(a-1):i.W&&0<i.W.length&&(o=i.W[0].start),!(n={ia:i.ia,startTime:o,ob:a,sa:i.sa,W:i.W,jb:n}).ia&&!n.W&&1<n.jb.length)throw K.v("SegmentList does not contain sufficient segment information:","the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",e.G),new H(2,4,4002);if(!n.ia&&!e.$.duration&&!n.W&&1==n.jb.length)throw K.v("SegmentList does not contain sufficient segment information:","the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",e.G),new H(2,4,4002);if(n.W&&0==n.W.length)throw K.v("SegmentList does not contain sufficient segment information:","the SegmentList has an empty timeline.",e.G),new H(2,4,4002);return a=i=null,e.qa.id&&e.G.id&&(i=t[a=e.qa.id+","+e.G.id]),o=function(e,t,r,n){var i=n.jb.length;n.W&&n.W.length!=n.jb.length&&(i=Math.min(n.W.length,n.jb.length),K.v("The number of items in the segment timeline and the number of segment","URLs do not match, truncating",n.jb.length,"to",i));for(var a=[],o=n.startTime,s=0;s<i;s++){var u=n.jb[s],c=de(r,[u.Tf]),l=void 0;l=null!=n.ia?o+n.ia:n.W?n.W[s].end:o+e,a.push(new ni(s+t,o,l,function(e){return e}.bind(null,c),u.start,u.end)),o=l}return a}(e.$.duration,n.ob,e.G.xa,n),i?(i.sd(o),a=e.presentationTimeline.$b(),i.Vc(a-e.$.start)):(e.presentationTimeline.Jb(o,e.$.start),i=new ai(o),a&&e.zb&&(t[a]=i)),e.zb&&e.$.ld||oi(i,e.$.duration),{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:i.find.bind(i),getSegmentReference:i.get.bind(i),initSegmentReference:r,sa:n.sa}}function vi(e){return e.Ua}function bi(e,t,r,n){var i=function(e){var t=qn(e,_i,"initialization");if(!t)return null;var r=e.G.id,n=e.bandwidth||null,i=e.G.xa;return new ri((function(){var e=Jn(t,r,null,n,null);return de(i,[e])}),0,null)}(e),a=Qn(e,_i),o=qn(e,_i,"media"),s=qn(e,_i,"index");if(o=(a={ia:a.ia,timescale:a.timescale,ob:a.ob,sa:a.sa,Vd:a.Vd,W:a.W,qd:o,bc:s}).bc?1:0,o+=a.W?1:0,0==(o+=a.ia?1:0))throw K.error("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template","a SegmentTimeline, or a segment duration.",e.G),new H(2,4,4002);if(1!=o&&(K.v("SegmentTemplate containes multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",e.G),a.bc?(K.info("Using the index URL template by default."),a.W=null):K.info("Using the SegmentTimeline by default."),a.ia=null),!a.bc&&!a.qd)throw K.error("SegmentTemplate does not contain sufficient segment information:","the SegmentTemplate's media URL template is missing.",e.G),new H(2,4,4002);if(a.bc){if("mp4"!=(r=e.G.mimeType.split("/")[1])&&"webm"!=r)throw K.error("SegmentTemplate specifies an unsupported container type.",e.G),new H(2,4,4006);if("webm"==r&&!i)throw K.error("SegmentTemplate does not contain sufficient segment information:","the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",e.G),new H(2,4,4005);n=Jn(a.bc,e.G.id,null,e.bandwidth||null,null),e=mi(e,t,i,n=de(e.G.xa,[n]),0,null,r,a.sa)}else a.ia?(n||(e.presentationTimeline.ud(a.ia),e.presentationTimeline.vd(e.$.start)),e=function(e,t){var r=e.$.duration,n=t.ia,i=t.ob,a=t.timescale,o=t.qd,s=e.bandwidth||null,u=e.G.id,c=e.G.xa;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(e){return 0>e||r&&e>=r?null:Math.floor(e/n)},getSegmentReference:function(e){var t=e*n,l=t+n;return r&&(l=Math.min(l,r)),0>l||r&&t>=r?null:new ni(e,t,l,(function(){var r=Jn(o,u,e+i,s,t*a);return de(c,[r])}),0,null)}}}(e,a)):(o=t=null,e.qa.id&&e.G.id&&(t=r[o=e.qa.id+","+e.G.id]),s=function(e,t){for(var r=[],n=0;n<t.W.length;n++){var i=n+t.ob;r.push(new ni(i,t.W[n].start,t.W[n].end,function(e,t,r,n,i,a){return de(n,[e=Jn(e,t,i,r,a)]).map((function(e){return e.toString()}))}.bind(null,t.qd,e.G.id,e.bandwidth||null,e.G.xa,i,t.W[n].Pg+t.Vd),0,null))}return r}(e,a),n=!e.zb||!e.$.ld,t?(n&&oi(new ai(s),e.$.duration),t.sd(s),r=e.presentationTimeline.$b(),t.Vc(r-e.$.start)):(e.presentationTimeline.Jb(s,e.$.start),t=new ai(s),o&&e.zb&&(r[o]=t)),n&&oi(t,e.$.duration),e={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:t.find.bind(t),getSegmentReference:t.get.bind(t)});return{createSegmentIndex:e.createSegmentIndex,findSegmentPosition:e.findSegmentPosition,getSegmentReference:e.getSegmentReference,initSegmentReference:i,sa:a.sa}}function _i(e){return e.gc}W("shaka.media.InitSegmentReference",ri),ri.prototype.Tc=function(){return this.i()},ri.prototype.createUris=ri.prototype.Tc,ri.prototype.dd=function(){return this.h},ri.prototype.getStartByte=ri.prototype.dd,ri.prototype.cd=function(){return this.g},ri.prototype.getEndByte=ri.prototype.cd,W("shaka.media.SegmentReference",ni),ni.prototype.ka=function(){return this.position},ni.prototype.getPosition=ni.prototype.ka,ni.prototype.xc=function(){return this.startTime},ni.prototype.getStartTime=ni.prototype.xc,ni.prototype.qf=function(){return this.endTime},ni.prototype.getEndTime=ni.prototype.qf,ni.prototype.Tc=function(){return this.i()},ni.prototype.createUris=ni.prototype.Tc,ni.prototype.dd=function(){return this.h},ni.prototype.getStartByte=ni.prototype.dd,ni.prototype.cd=function(){return this.g},ni.prototype.getEndByte=ni.prototype.cd,W("shaka.media.SegmentIndex",ai),ai.prototype.destroy=function(){return this.g=null,Promise.resolve()},ai.prototype.destroy=ai.prototype.destroy,ai.prototype.find=function(e){for(var t=this.g.length-1,r=t;0<=r;--r){var n=this.g[r],i=r<t?this.g[r+1].startTime:n.endTime;if(e>=n.startTime&&e<i)return n.position}return this.g.length&&e<this.g[0].startTime?this.g[0].position:null},ai.prototype.find=ai.prototype.find,ai.prototype.get=function(e){return 0==this.g.length||0>(e-=this.g[0].position)||e>=this.g.length?null:this.g[e]},ai.prototype.get=ai.prototype.get,ai.prototype.offset=function(e){for(var t=0;t<this.g.length;++t)this.g[t].startTime+=e,this.g[t].endTime+=e},ai.prototype.offset=ai.prototype.offset,ai.prototype.sd=function(e){for(var t=[],r=0,n=0;r<this.g.length&&n<e.length;){var i=this.g[r],a=e[n];i.startTime<a.startTime?(t.push(i),r++):(i.startTime>a.startTime?0==r?t.push(a):K.v("Refusing to rewrite original references on update!"):(.1<Math.abs(i.endTime-a.endTime)?t.push(new ni(i.position,a.startTime,a.endTime,a.i,a.h,a.g)):t.push(i),r++),n++)}for(;r<this.g.length;)t.push(this.g[r++]);if(t.length)for(r=t[t.length-1].position+1;n<e.length;)i=new ni(r++,(i=e[n++]).startTime,i.endTime,i.i,i.h,i.g),t.push(i);else t=e;this.g=t},ai.prototype.merge=ai.prototype.sd,ai.prototype.Vc=function(e){for(var t=0;t<this.g.length;++t)if(this.g[t].endTime>e)return void this.g.splice(0,t);this.g=[]},ai.prototype.evict=ai.prototype.Vc,si.prototype.Ca=function(){return this.g.Ca()},hi.prototype.parse=function(e,t,r,n){var i;if(440786851!=ui(t=new si(new DataView(t))).id)throw K.error("Not an EBML element."),new H(2,3,3008);var a=ui(t);if(408125543!=a.id)throw K.error("Not a Segment element."),new H(2,3,3009);for(t=a.g.byteOffset,a=new si(a.g),i=null;a.Ca();){var o=ui(a);if(357149030==o.id){i=o;break}}if(!i)throw K.error("Not an Info element."),new H(2,3,3010);for(a=new si(i.g),i=1e6,o=null;a.Ca();){var s=ui(a);if(2807729==s.id)i=di(s);else if(17545==s.id)if(4==(o=s).g.byteLength)o=o.g.getFloat32(0);else{if(8!=o.g.byteLength)throw new H(2,3,3003);o=o.g.getFloat64(0)}}if(null==o)throw new H(2,3,3011);if(i=o*(a=i/1e9),475249515!=(e=ui(new si(new DataView(e)))).id)throw K.error("Not a Cues element."),new H(2,3,3007);return function(e,t,r,n,i,a){function o(){return i}var s=[];e=new si(e.g);for(var u=null,c=null;e.Ca();){var l=ui(e);if(187==l.id){var d=fi(l);d&&(l=r*d.Qg,d=t+d.qg,null!=u&&s.push(new ni(s.length,u-a,l-a,o,c,d-1)),u=l,c=d)}}return null!=u&&s.push(new ni(s.length,u-a,n-a,o,c,null)),s}(e,t,a,i,r,n)};var Ai={Nb:{},cc:{},Fd:function(e,t){Ai.cc[e]=t}};function Ti(e,t,r){this.j=e,this.Ic=t,this.m=this.l=1/0,this.g=1,this.h=this.i=null,this.u=0,this.A=!0,this.o=0,this.C=void 0===r||r}function Ei(e,t,r,n){return e=He(e,n),0==t&&null==r||(e.headers.Range=r?"bytes="+t+"-"+r:"bytes="+t+"-"),e}function Si(){var e=this;this.h=this.g=null,this.j=[],this.i=null,this.u=[],this.m=1,this.A={},this.C=0,this.F=new F(5),this.o=new Re((function(){!function(e){p((function t(){var r,n;return M(t,(function(t){switch(t.s){case 1:return K.info("Updating manifest..."),r=0,I(t,2),S(t,$i(e),4);case 4:r=t.B,R(t,3);break;case 2:n=k(t),e.h&&(n.severity=1,e.h.onError(n));case 3:if(!e.h)return t.return();ki(e,r),$(t)}}))}))}(e)})),this.l=new Fe}function $i(e){var t=Date.now(),r=e.h.networkingEngine.request(0,He(e.j,e.g.retryParameters));return Be(e.l,r),r.promise.then((function(t){if(e.h)return t.uri&&!e.j.includes(t.uri)&&e.j.unshift(t.uri),function(e,t,r){if(t=Bn.ze(t,"MPD"),!t)throw new H(2,4,4001,r);return t=ti(t,e.g.retryParameters,e.g.dash.xlinkFailGracefully,r,e.h.networkingEngine),Be(e.l,t),t.promise.then((function(t){return function(e,t,r){return p((function n(){var i,a,o,s,u,c,l,d,h,f,p,m,y,g,v,b,_,A,T,E,I,w,R,k;return M(n,(function(n){switch(n.s){case 1:s=le,c=[r],0<(l=(u=Bn).Y(t,"Location").map(u.uc).filter(s.Ra)).length&&(d=de(c,l),c=e.j=d),h=u.Y(t,"BaseURL").map(u.uc),f=de(c,h),p=e.g.dash.ignoreMinBufferTime,m=0,p||(m=u.R(t,"minBufferTime",u.Ma)),e.C=u.R(t,"minimumUpdatePeriod",u.Ma,-1),y=u.R(t,"availabilityStartTime",u.jg),g=u.R(t,"timeShiftBufferDepth",u.Ma),v=u.R(t,"maxSegmentDuration",u.Ma),b=t.getAttribute("type")||"static",_=e.g.dash.ignoreSuggestedPresentationDelay,A=null,_||(A=u.R(t,"suggestedPresentationDelay",u.Ma)),e.i?T=e.i.presentationTimeline:(E=Math.max(e.g.dash.defaultPresentationDelay,1.5*m),T=new Ti(y,null!=A?A:E,e.g.dash.autoCorrectDrift));for(var P={zb:"static"!=b,presentationTimeline:T,qa:null,$:null,fa:null,G:null,bandwidth:0,me:!1},C=f,x=Bn.R(t,"mediaPresentationDuration",Bn.Ma),L=[],O=0,D=Bn.Y(t,"Period"),M=0;M<D.length;M++){var Z=D[M];O=Bn.R(Z,"start",Bn.Ma,O);var V=Bn.R(Z,"duration",Bn.Ma),N=null;if(M!=D.length-1){var G=Bn.R(D[M+1],"start",Bn.Ma);null!=G&&(N=G-O)}else null!=x&&(N=x-O);if(G=pe,N&&V&&Math.abs(N-V)>G&&K.v("There is a gap/overlap between Periods",Z),null==N&&(N=V),Z=Ii(e,P,C,{start:O,duration:N,node:Z,ld:null==N||M==D.length-1}),L.push(Z),V=P.qa.id,e.u.includes(V)||(e.u.push(V),e.i&&(e.h.filterNewPeriod(Z),e.i.periods.push(Z))),null==N){M!=D.length-1&&K.v("Skipping Period",M+1,"and any subsequent Periods:","Period",M+1,"does not have a valid start time.",L[M+1]),O=null;break}O+=N}if(null==e.i&&e.h.filterAllPeriods(L),null!=x?(O!=x&&K.v("@mediaPresentationDuration does not match the total duration of all","Periods."),i=L,a=x,o=!1):(i=L,a=O,o=!0),I=a,w=i,T.hc("static"==b),"static"!=b&&o||T.Fa(I||1/0),T.aa()&&!isNaN(e.g.availabilityWindowOverride)&&(g=e.g.availabilityWindowOverride),null==g&&(g=1/0),T.Pd(g),T.ud(v||1),e.i){n.I(0);break}if(e.i={presentationTimeline:T,periods:w,offlineSessionIds:[],minBufferTime:m||0},!T.Pe()){n.I(0);break}return R=u.Y(t,"UTCTiming"),S(n,function(e,t,r){r=r.map((function(e){return{scheme:e.getAttribute("schemeIdUri"),value:e.getAttribute("value")}}));var n=e.g.dash.clockSyncUri;return!r.length&&n&&r.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:n}),le.df(r,function(e){var r=e.scheme;switch(e=e.value,r){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":return Ci(this,t,e,"HEAD");case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":return Ci(this,t,e,"GET");case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":return r=Date.parse(e),isNaN(r)?0:r-Date.now();case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":return K.ba("NTP UTCTiming scheme is not supported"),Promise.reject();default:return K.ba("Unrecognized scheme in UTCTiming element",r),Promise.reject()}}.bind(e)).catch((function(){return K.ba("A UTCTiming element should always be given in live manifests! This content may not play on clients with bad clocks!"),0}))}(e,f,R),4);case 4:if(k=n.B,!e.h)return n.return();T.Ke(k),$(n)}}))}))}(e,t,r)}))}(e,t.data,t.uri)})).then((function(){var r=(Date.now()-t)/1e3;return B(e.F,1,r),r}))}function Ii(e,t,r,n){if(t.qa=Pi(n.node,null,r),t.$=n,t.qa.id||(K.info("No Period ID given for Period with start time "+n.start+", Assigning a default"),t.qa.id="__shaka_period_"+n.start),Bn.Y(n.node,"EventStream").forEach(e.kg.bind(e,n.start,n.duration)),r=Bn.Y(n.node,"AdaptationSet").map(e.ig.bind(e,t)).filter(le.Ra),t.zb){t=[];for(var i=h(r),a=i.next();!a.done;a=i.next())for(var o=(a=h(a.value.tg)).next();!o.done;o=a.next())t.push(o.value);if(t.length!=new Set(t).size)throw new H(2,4,4018)}var s=r.filter((function(e){return!e.Td}));if(r.filter((function(e){return e.Td})).forEach((function(e){var t=e.Td.split(" ");s.forEach((function(r){t.includes(r.id)&&r.streams.forEach((function(t){t.trickModeVideo=e.streams.find((function(e){return dt(t.codecs)[0]==dt(e.codecs)[0]}))}))}))})),t=wi(s,"video"),i=wi(s,"audio"),!t.length&&!i.length)throw new H(2,4,4004);for(r=e.g.disableAudio,i.length&&!r||(i=[null]),r=e.g.disableVideo,t.length&&!r||(t=[null]),r=[],a=0;a<i.length;a++)for(o=0;o<t.length;o++)Ri(e,i[a],t[o],r);if(t=[],!e.g.disableText)for(e=wi(s,"text"),i=0;i<e.length;i++)t.push.apply(t,e[i].streams);return{startTime:n.start,textStreams:t,variants:r}}function wi(e,t){return e.filter((function(e){return e.contentType==t}))}function Ri(e,t,r,n){if(t||r)if(t&&r){var i=t.drmInfos,a=r.drmInfos;if(!i.length||!a.length||0<Vt(i,a).length){a=Vt(t.drmInfos,r.drmInfos);for(var o=0;o<t.streams.length;o++)for(var s=0;s<r.streams.length;s++)i=(r.streams[s].bandwidth||0)+(t.streams[o].bandwidth||0),i={id:e.m++,language:t.language,primary:t.pd||r.pd,audio:t.streams[o],video:r.streams[s],bandwidth:i,drmInfos:a,allowedByApplication:!0,allowedByKeySystem:!0},n.push(i)}}else for(a=t||r,o=0;o<a.streams.length;o++)i=a.streams[o].bandwidth||0,i={id:e.m++,language:a.language||"und",primary:a.pd,audio:t?a.streams[o]:null,video:r?a.streams[o]:null,bandwidth:i,drmInfos:a.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},n.push(i)}function ki(e,t){0>e.C||e.o.V(Math.max(3,e.C-t,Y(e.F)))}function Pi(e,t,r){t=t||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,wd:null,audioSamplingRate:null},r=r||t.xa;var n=Bn.Mb,i=Bn.ff,a=Bn.Y(e,"BaseURL").map(Bn.uc),o=e.getAttribute("contentType")||t.contentType,s=e.getAttribute("mimeType")||t.mimeType,u=e.getAttribute("codecs")||t.codecs;i=Bn.R(e,"frameRate",i)||t.frameRate;for(var c=e.getAttribute("sar")||t.pixelAspectRatio,l=Bn.Y(e,"InbandEventStream"),d=t.emsgSchemeIdUris.slice(),f=(l=h(l)).next();!f.done;f=l.next())f=f.value.getAttribute("schemeIdUri"),d.includes(f)||d.push(f);return l=function(e){for(var t=0;t<e.length;++t){var r=e[t],n=r.getAttribute("schemeIdUri");if(n&&(r=r.getAttribute("value")))switch(n){case"urn:mpeg:dash:outputChannelPositionList:2012":return r.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":var i=parseInt(r,10);if(!i){K.v("Channel parsing failure! Ignoring scheme and value",n,r);continue}return i;case"tag:dolby.com,2014:dash:audio_channel_configuration:2011":case"urn:dolby:dash:audio_channel_configuration:2011":if(!(i=parseInt(r,16))){K.v("Channel parsing failure! Ignoring scheme and value",n,r);continue}for(e=0;i;)1&i&&++e,i>>=1;return e;default:K.v("Unrecognized audio channel scheme:",n,r)}}return null}(l=Bn.Y(e,"AudioChannelConfiguration"))||t.wd,f=Bn.R(e,"audioSamplingRate",n)||t.audioSamplingRate,o||(o=xi(s,u)),{xa:de(r,a),ec:Bn.sc(e,"SegmentBase")||t.ec,Ua:Bn.sc(e,"SegmentList")||t.Ua,gc:Bn.sc(e,"SegmentTemplate")||t.gc,width:Bn.R(e,"width",n)||t.width,height:Bn.R(e,"height",n)||t.height,contentType:o,mimeType:s,codecs:u,frameRate:i,pixelAspectRatio:c,emsgSchemeIdUris:d,id:e.getAttribute("id"),wd:l,audioSamplingRate:f}}function Ci(e,t,r,n){return(t=He(t=de(t,[r]),e.g.retryParameters)).method=n,t=e.h.networkingEngine.request(4,t),Be(e.l,t),t.promise.then((function(e){if("HEAD"==n){if(!e.headers||!e.headers.date)return K.v("UTC timing response is missing","expected date header"),0;e=e.headers.date}else e=ye(e.data);return e=Date.parse(e),isNaN(e)?(K.v("Unable to parse date from UTC timing response"),0):e-Date.now()}))}function xi(e,t){return yr(ct(e,t))?"text":e.split("/")[0]}function Li(e,t,r,n){this.h=e,this.type=t,this.g=r,this.segments=n||null}function Oi(e,t,r,n){this.id=e,this.name=t,this.g=r,this.value=void 0===n?null:n}function Di(e,t){this.name=e,this.value=t}function Mi(e,t,r){return(e=e.getAttribute(t))?e.value:r||null}function Zi(e,t){this.h=t,this.g=e}W("shaka.media.ManifestParser.registerParserByExtension",Ai.Fd),Ai.Qb=function(e,t){Ai.Nb[e]=t},W("shaka.media.ManifestParser.registerParserByMime",Ai.Qb),Ai.ng=function(){var e={};if(ft()){for(var t in Ai.Nb)e[t]=!0;for(var r in Ai.cc)e[r]=!0}t={mpd:"application/dash+xml",m3u8:"application/x-mpegurl",ism:"application/vnd.ms-sstr+xml"};for(var n=(r=h(["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"])).next();!n.done;n=r.next())e[n=n.value]=ft()?!!Ai.Nb[n]:pt(n);for(var i in t)e[i]=ft()?!!Ai.cc[i]:pt(t[i]);return e},Ai.create=function(e,t,r,n){return p((function i(){var a,o;return M(i,(function(i){switch(i.s){case 1:return I(i,2),S(i,Ai.rf(e,t,r,n),4);case 4:return a=i.B,i.return(new a);case 2:throw(o=k(i)).severity=2,o}}))}))},Ai.rf=function(e,t,r,n){return p((function i(){var a,o,s,u,c;return M(i,(function(i){switch(i.s){case 1:if(a=Ai,n){if(o=a.Nb[n.toLowerCase()])return i.return(o);K.v("Could not determine manifest type using MIME type ",n)}if(s=a.getExtension(e)){if(u=a.cc[s])return i.return(u);K.v("Could not determine manifest type for extension ",s)}else K.v("Could not find extension for ",e);if(n){i.I(2);break}return S(i,a.zf(e,t,r),3);case 3:if(n=i.B){if(c=Ai.Nb[n])return i.return(c);K.v("Could not determine manifest type using MIME type",n)}case 2:throw new H(2,4,4e3,e)}}))}))},Ai.zf=function(e,t,r){return p((function n(){var i,a,o;return M(n,(function(n){switch(n.s){case 1:return(i=He([e],r)).method="HEAD",S(n,t.request(0,i).promise,2);case 2:return a=n.B,o=a.headers["content-type"],n.return(o?o.toLowerCase().split(";").shift():"")}}))}))},Ai.getExtension=function(e){return 1==(e=new J(e).pa.split("/").pop().split(".")).length?"":e.pop().toLowerCase()},Ai.isSupported=function(e,t){return!!ft()&&(t in Ai.Nb||Ai.getExtension(e)in Ai.cc)},W("shaka.media.PresentationTimeline",Ti),Ti.prototype.ha=function(){return this.l},Ti.prototype.getDuration=Ti.prototype.ha,Ti.prototype.xf=function(){return this.g},Ti.prototype.getMaxSegmentDuration=Ti.prototype.xf,Ti.prototype.Fa=function(e){this.l=e},Ti.prototype.setDuration=Ti.prototype.Fa,Ti.prototype.Ff=function(){return this.j},Ti.prototype.getPresentationStartTime=Ti.prototype.Ff,Ti.prototype.Ke=function(e){this.u=e},Ti.prototype.setClockOffset=Ti.prototype.Ke,Ti.prototype.hc=function(e){this.A=e},Ti.prototype.setStatic=Ti.prototype.hc,Ti.prototype.Pd=function(e){this.m=e},Ti.prototype.setSegmentAvailabilityDuration=Ti.prototype.Pd,Ti.prototype.Ag=function(e){this.Ic=e},Ti.prototype.setDelay=Ti.prototype.Ag,Ti.prototype.pf=function(){return this.Ic},Ti.prototype.getDelay=Ti.prototype.pf,Ti.prototype.Jb=function(e,t){if(0!=e.length){var r=e[e.length-1].endTime+t;this.vd(e[0].startTime+t),this.g=e.reduce((function(e,t){return Math.max(e,t.endTime-t.startTime)}),this.g),this.h=Math.max(this.h,r),null!=this.j&&this.C&&(this.j=(Date.now()+this.u)/1e3-this.h-this.g),K.K("notifySegments:","maxSegmentDuration="+this.g)}},Ti.prototype.notifySegments=Ti.prototype.Jb,Ti.prototype.vd=function(e){this.i=null==this.i?e:Math.min(this.i,e)},Ti.prototype.notifyMinSegmentStartTime=Ti.prototype.vd,Ti.prototype.ud=function(e){this.g=Math.max(this.g,e),K.K("notifyNewSegmentDuration:","maxSegmentDuration="+this.g)},Ti.prototype.notifyMaxSegmentDuration=Ti.prototype.ud,Ti.prototype.offset=function(e){null!=this.i&&(this.i+=e),null!=this.h&&(this.h+=e)},Ti.prototype.offset=Ti.prototype.offset,Ti.prototype.aa=function(){return 1/0==this.l&&!this.A},Ti.prototype.isLive=Ti.prototype.aa,Ti.prototype.ib=function(){return 1/0!=this.l&&!this.A},Ti.prototype.isInProgress=Ti.prototype.ib,Ti.prototype.$b=function(){if(1/0==this.m)return this.o;var e=this.Db()-this.m;return Math.max(this.o,e)},Ti.prototype.getSegmentAvailabilityStart=Ti.prototype.$b,Ti.prototype.Le=function(e){this.o=e},Ti.prototype.setUserSeekStart=Ti.prototype.Le,Ti.prototype.Db=function(){return this.aa()||this.ib()?Math.min(Math.max(0,(Date.now()+this.u)/1e3-this.g-this.j),this.l):this.l},Ti.prototype.getSegmentAvailabilityEnd=Ti.prototype.Db,Ti.prototype.Zb=function(e){var t=Math.max(this.i,this.o);if(1/0==this.m)return Math.ceil(1e3*t)/1e3;var r=this.Db()-this.m;return e=Math.min(r+e,this.Ka()),Math.max(t,e)},Ti.prototype.getSafeSeekRangeStart=Ti.prototype.Zb,Ti.prototype.Cb=function(){return this.Zb(0)},Ti.prototype.getSeekRangeStart=Ti.prototype.Cb,Ti.prototype.Ka=function(){var e=this.aa()||this.ib()?this.Ic:0;return Math.max(0,this.Db()-e)},Ti.prototype.getSeekRangeEnd=Ti.prototype.Ka,Ti.prototype.Pe=function(){return!(null==this.j||null!=this.h&&this.C)},Ti.prototype.usingPresentationStartTime=Ti.prototype.Pe,W("shaka.dash.DashParser",Si),(n=Si.prototype).configure=function(e){this.g=e},n.start=function(e,t){var r=this;return p((function n(){var i;return M(n,(function(n){switch(n.s){case 1:return r.j=[e],r.h=t,S(n,$i(r),2);case 2:if(i=n.B,r.h&&ki(r,i),!r.h)throw new H(2,7,7001);return n.return(r.i)}}))}))},n.stop=function(){return this.g=this.h=null,this.j=[],this.i=null,this.u=[],this.A={},null!=this.o&&(this.o.stop(),this.o=null),this.l.destroy()},n.update=function(){$i(this).catch(function(e){this.h&&this.h.onError(e)}.bind(this))},n.onExpirationUpdated=function(){},n.ig=function(e,t){if(e.fa=Pi(t,e.qa,null),"image"==e.fa.contentType)return K.v("Skipping Image AdaptationSet",e.fa),null;var r=!1,n=Bn.Y(t,"Role"),i=n.map((function(e){return e.getAttribute("value")})).filter(le.Ra),a=void 0,o="text"==e.fa.contentType;o&&(a="subtitle");for(var s=0;s<n.length;s++){var u=n[s].getAttribute("schemeIdUri");if(null==u||"urn:mpeg:dash:role:2011"==u)switch(u=n[s].getAttribute("value"),u){case"main":r=!0;break;case"caption":case"subtitle":a=u}}var c=null,l=!1;Bn.Y(t,"EssentialProperty").forEach((function(e){"http://dashif.org/guidelines/trickmode"==e.getAttribute("schemeIdUri")?c=e.getAttribute("value"):l=!0})),s=Bn.Y(t,"Accessibility");var d=new Map;for(n={},u=(s=h(s)).next();!u.done;n={Vb:n.Vb},u=s.next()){var f=u.value;u=f.getAttribute("schemeIdUri"),f=f.getAttribute("value"),"urn:scte:dash:cc:cea-608:2015"==u||"urn:scte:dash:cc:cea-708:2015"==u?(n.Vb=1,null!=f?f.split(";").forEach(function(e){return function(t){if(t.includes("=")){var r=(t=t.split("="))[0].startsWith("CC")?t[0]:"CC"+t[0];t=t[1].split(",")[0].split(":").pop()}else r="CC"+e.Vb,e.Vb+=2;d.set(r,Dr(t))}}(n)):d.set("CC1","und")):"urn:mpeg:dash:role:2011"==u&&null!=f&&(i.push(f),"captions"==f&&(a="caption"))}if(l)return null;var p=jn(n=Bn.Y(t,"ContentProtection"),this.g.dash.customScheme,this.g.dash.ignoreDrmInfo);if(n=Dr(t.getAttribute("lang")||"und"),s=t.getAttribute("label"),(u=Bn.Y(t,"Label"))&&u.length&&((u=u[0]).textContent&&(s=u.textContent)),0==(i=(u=Bn.Y(t,"Representation")).map(this.lg.bind(this,e,p,a,n,s,r,i,d)).filter((function(e){return!!e}))).length){if(this.g.dash.ignoreEmptyAdaptationSet||o)return null;throw new H(2,4,4003)}return e.fa.contentType&&"application"!=e.fa.contentType||(e.fa.contentType=xi(i[0].mimeType,i[0].codecs),i.forEach((function(t){t.type=e.fa.contentType}))),i.forEach((function(e){p.drmInfos.forEach((function(t){e.keyId&&t.keyIds.push(e.keyId)}))})),o=u.map((function(e){return e.getAttribute("id")})).filter(le.Ra),{id:e.fa.id||"__fake__"+this.m++,contentType:e.fa.contentType,language:n,pd:r,streams:i,drmInfos:p.drmInfos,Td:c,tg:o}},n.lg=function(e,t,r,n,i,a,o,s,u){if(e.G=Pi(u,e.fa,null),!function(e){var t=e.ec?1:0;if(t+=e.Ua?1:0,t+=e.gc?1:0,0==t)return"text"==e.contentType||"application"==e.contentType||(K.v("Representation does not contain a segment information source:","the Representation must contain one of SegmentBase, SegmentList,",'SegmentTemplate, or explicitly indicate that it is "text".',e),!1);return 1!=t&&(K.v("Representation contains multiple segment information sources:","the Representation should only contain one of SegmentBase,","SegmentList, or SegmentTemplate.",e),e.ec?(K.info("Using SegmentBase by default."),e.Ua=null):K.info("Using SegmentList by default."),e.gc=null),!0}(e.G))return K.v("Skipping Representation",e.G),null;e.bandwidth=Bn.R(u,"bandwidth",Bn.Gc)||0;var c=e.G.contentType;c="text"==c||"application"==c;try{var l=this.ug.bind(this);if(e.G.ec)var d=function(e,t){var r=Number(qn(e,yi,"presentationTimeOffset"))||0,n=qn(e,yi,"timescale"),i=1;n&&(i=Bn.Gc(n)||1),r=r/i||0,n=pi(e,yi);var a=e.G.contentType;if(i=e.G.mimeType.split("/")[1],"text"!=a&&"mp4"!=i&&"webm"!=i)throw K.error("SegmentBase specifies an unsupported container type.",e.G),new H(2,4,4006);if("webm"==i&&!n)throw K.error("SegmentBase does not contain sufficient segment information:","the SegmentBase uses a WebM container,","but does not contain an Initialization element.",e.G),new H(2,4,4005);a=ei(e,yi,"RepresentationIndex");var o=qn(e,yi,"indexRange"),s=e.G.xa;if(o=Bn.Hc(o||""),a){var u=a.getAttribute("sourceURL");u&&(s=de(e.G.xa,[u])),o=Bn.R(a,"range",Bn.Hc,o)}if(!o)throw K.error("SegmentBase does not contain sufficient segment information:","the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",e.G),new H(2,4,4002);return{createSegmentIndex:(i=mi(e,t,n,s,o.start,o.end,i,r)).createSegmentIndex,findSegmentPosition:i.findSegmentPosition,getSegmentReference:i.getSegmentReference,initSegmentReference:n,sa:r}}(e,l);else if(e.G.Ua)d=gi(e,this.A);else if(e.G.gc)d=bi(e,l,this.A,!!this.i);else{var h=e.G.xa,f=e.$.duration||0;d={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(e){return 0<=e&&e<f?1:null},getSegmentReference:function(e){return 1!=e?null:new ni(1,0,f,(function(){return h}),0,null)},initSegmentReference:null,sa:0}}}catch(e){if(c&&4002==e.code)return null;throw e}return u=function(e,t,r,n){var i=jn(e,t,n);if(r.ge)e=1==r.drmInfos.length&&!r.drmInfos[0].keySystem,t=0==i.drmInfos.length,(0==r.drmInfos.length||e&&!t)&&(r.drmInfos=i.drmInfos),r.ge=!1;else if(0<i.drmInfos.length&&(r.drmInfos=r.drmInfos.filter((function(e){return i.drmInfos.some((function(t){return t.keySystem==e.keySystem}))})),0==r.drmInfos.length))throw new H(2,4,4008);return i.be||r.be}(u=Bn.Y(u,"ContentProtection"),this.g.dash.customScheme,t,this.g.dash.ignoreDrmInfo),{id:this.m++,originalId:e.G.id,createSegmentIndex:d.createSegmentIndex,findSegmentPosition:d.findSegmentPosition,getSegmentReference:d.getSegmentReference,initSegmentReference:d.initSegmentReference,presentationTimeOffset:d.sa,mimeType:e.G.mimeType,codecs:e.G.codecs,frameRate:e.G.frameRate,pixelAspectRatio:e.G.pixelAspectRatio,bandwidth:e.bandwidth,width:e.G.width,height:e.G.height,kind:r,encrypted:0<t.drmInfos.length,keyId:u,language:n,label:i,type:e.fa.contentType,primary:a,trickModeVideo:null,emsgSchemeIdUris:e.G.emsgSchemeIdUris,roles:o,channelsCount:e.G.wd,audioSamplingRate:e.G.audioSamplingRate,closedCaptions:s}},n.kg=function(e,t,r){var n=Bn.Mb,i=r.getAttribute("schemeIdUri")||"",a=r.getAttribute("value")||"",o=Bn.R(r,"timescale",n)||1;Bn.Y(r,"Event").forEach(function(r){var s=Bn.R(r,"presentationTime",n)||0,u=Bn.R(r,"duration",n)||0;u=(s=s/o+e)+u/o,null!=t&&(s=Math.min(s,e+t),u=Math.min(u,e+t)),r={schemeIdUri:i,value:a,startTime:s,endTime:u,id:r.getAttribute("id")||"",eventElement:r},this.h.onTimelineRegionAdded(r)}.bind(this))},n.ug=function(e,t,r){return e=Ei(e,t,r,this.g.retryParameters),e=this.h.networkingEngine.request(1,e),Be(this.l,e),e.promise.then((function(e){return e.data}))},Ai.Fd("mpd",Si),Ai.Qb("application/dash+xml",Si),Ai.Qb("video/vnd.mpeg.dash.mpd",Si),Oi.prototype.toString=function(){var e="#"+this.name,t=this.g?this.g.map((function(e){return e.name+"="+(isNaN(Number(e.value))?'"'+e.value+'"':e.value)})):[];return this.value&&t.unshift(this.value),0<t.length&&(e+=":"+t.join(",")),e},Oi.prototype.getAttribute=function(e){var t=this.g.filter((function(t){return t.name==e}));return t.length?t[0]:null};var Vi={Ab:function(e,t){return e.filter((function(e){return e.name==t}))},cb:function(e,t){var r=Vi.Ab(e,t);return r.length?r[0]:null},Zc:function(e,t,r){return e.filter((function(e){var n=e.getAttribute("TYPE");return e=e.getAttribute("GROUP-ID"),n.value==t&&e.value==r}))},Sc:function(e,t){return de([e],[t])[0]},kd:function(e){return/^#(?!EXT)/m.test(e)}};function Ni(e){this.h=e,this.g=0}function Gi(e){Xi(e,/[ \t]+/gm)}function Xi(e,t){t.lastIndex=e.g;var r=t.exec(e.h);return r=null==r?null:{position:r.index,length:r[0].length,wg:r},e.g==e.h.length||null==r||r.position!=e.g?null:(e.g+=r.length,r.wg)}function Wi(e){return e.g==e.h.length?null:(e=Xi(e,/[^ \t\n]*/gm))?e[0]:null}function Ui(){this.g=0}function Fi(e,t,r){var n=(t=(t=ye(t)).replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim()).split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(n[0]))throw new H(2,4,4015);t=0;for(var i=1;i<n.length;i++)if(!Vi.kd(n[i])){var a=Yi(e,n[i]);if(--e.g,ji.includes(a.name)){t=1;break}"EXT-X-STREAM-INF"==a.name&&(i+=1)}for(i=[],a=1;a<n.length;)if(Vi.kd(n[a]))a+=1;else{var o=Yi(e,n[a]);if(Ki.includes(o.name)){if(1!=t)throw new H(2,4,4017);return new Li(r,t,i,e=Bi(e,r,n=n.splice(a,n.length-a),i))}i.push(o),a+=1,"EXT-X-STREAM-INF"==o.name&&(o.g.push(new Di("URI",n[a])),a+=1)}return new Li(r,t,i)}function Bi(e,t,r,n){var i=[],a=[];return r.forEach((function(r){if(/^(#EXT)/.test(r))r=Yi(e,r),ji.includes(r.name)?n.push(r):a.push(r);else{if(Vi.kd(r))return[];r=Vi.Sc(t,r.trim()),i.push(new Zi(r,a)),a=[]}})),i}function Yi(e,t){var r=e.g++,n=t.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!n)throw new H(2,4,4016,t);var i,a=n[1],o=n[2];if(n=[],o){var s;(s=Xi(o=new Ni(o),/^([^,=]+)(?:,|$)/g))&&(i=s[1]);for(var u=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;s=Xi(o,u);)n.push(new Di(s[1],s[2]||s[3]))}return new Oi(r,a,n,i)}var ji="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-MAP EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST".split(" "),Ki="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE".split(" ");function Hi(e){try{var t=Hi.parse(e);return Oe({uri:e,Bd:e,data:t.data,headers:{"content-type":t.contentType}})}catch(e){return xe(e)}}function zi(){var e=this;this.g=this.j=null,this.ea=1,this.L=new Map,this.Z=new Set,this.h=new Map,this.i=null,this.F="",this.C=new Ui,this.X=0,this.m=new Re((function(){!function(e){p((function t(){var r,n;return M(t,(function(t){switch(t.s){case 1:return K.info("Updating manifest..."),e.j?(I(t,2),S(t,e.update(),4)):t.return();case 4:r=e.X,e.m.V(r),R(t,0);break;case 2:if(n=k(t),!e.j)return t.return();n.severity=1,e.j.onError(n),e.m.V(.1),$(t)}}))}))}(e)})),this.l=ya,this.A=null,this.J=0,this.M=1/0,this.o=new Fe,this.P=[],this.u=new Map,this.da=!1}function Ji(e,t){return p((function r(){var n,i,a,o,s,u,c,l,d,h;return M(r,(function(r){switch(r.s){case 1:return n=Vi,i=ga,a=t.We,S(r,pa(e,He([a],e.g.retryParameters),0),2);case 2:if(o=r.B,1!=(s=Fi(e.C,o.data,o.uri)).type)throw new H(2,4,4017);return c=(u=n.cb(s.g,"EXT-X-MEDIA-SEQUENCE"))?Number(u.value):0,l=t.stream,S(r,aa(e,t.Pc,s,c,l.mimeType,l.codecs),3);case 3:d=r.B,t.fc.g=d,h=d[d.length-1],n.cb(s.g,"EXT-X-ENDLIST")&&(fa(e,i.$a),e.i.Fa(h.endTime)),$(r)}}))}))}function Qi(e){e.forEach((function(e){if(e){var t=e.stream.codecs.split(",");t=t.filter((function(e){return"mp4a.40.34"!=e})),e.stream.codecs=t.join(",")}}))}function qi(e,t,r,n,i){return{id:e.ea++,language:t?t.language:"und",primary:!!t&&t.primary||!!r&&r.primary,audio:t,video:r,bandwidth:n,drmInfos:i,allowedByApplication:!0,allowedByKeySystem:!0}}function ea(e,t,r){return p((function n(){var i,a,o,s,u,c,l,d,h,f,p;return M(n,(function(n){switch(n.s){case 1:if(i=ua(t,"URI"),e.h.has(i))return n.return(e.h.get(i));if(a=ua(t,"TYPE").toLowerCase(),o=fe,"subtitles"==a&&(a=o.za),s=Dr(Mi(t,"LANGUAGE","und")),u=Mi(t,"NAME"),c=t.getAttribute("DEFAULT"),l="YES"==c,d=Mi(t,"CHANNELS"),"audio"==a)if(d){var m=d.split("/")[0];m=parseInt(m,10)}else m=null;else m=null;return h=m,f=Mi(t,"CHARACTERISTICS"),S(n,ta(e,i,r,a,s,l,u,h,null,f),2);case 2:return p=n.B,e.h.has(i)?n.return(e.h.get(i)):null==p?n.return(null):(e.L.set(t.id,p),e.h.set(i,p),n.return(p))}}))}))}function ta(e,t,r,n,i,a,o,s,u,c){return p((function l(){var d,f,m,y,g,v,b,_,A,T,E,$,w,P,C,x,L,O,D,Z,V,N,G,X,W,U,F,B;return M(l,(function(l){switch(l.s){case 1:return f=(d=Vi).Sc(e.F,t),S(l,pa(e,He([f],e.g.retryParameters),0),2);case 2:if(m=l.B,f=m.uri,1!=(y=Fi(e.C,m.data,f)).type)throw new H(2,4,4017);g=[],y.segments.forEach((function(e){e=d.Ab(e.h,"EXT-X-KEY"),g.push.apply(g,e)})),v=!1,b=[],_=null;for(var Y=h(g),j=Y.next();!j.done;j=Y.next())if(A=j.value,"NONE"!=(T=ua(A,"METHOD"))){if(v=!0,"AES-128"==T)return K.v("Unsupported HLS Encryption",T),e.da=!0,l.return(null);E=ua(A,"KEYFORMAT"),(w=($=ma[E])?$(A):null)?(w.keyIds.length&&(_=w.keyIds[0]),b.push(w)):K.v("Unsupported HLS KEYFORMAT",E)}if(v&&!b.length)throw new H(2,4,4026);return function(e,t){var r=ga,n=Vi.cb(t.g,"EXT-X-PLAYLIST-TYPE"),i=Vi.cb(t.g,"EXT-X-ENDLIST");i=n&&"VOD"==n.value||i,n=n&&"EVENT"==n.value&&!i,n=!i&&!n,i?fa(e,r.$a):(fa(e,n?r.Wd:r.Se),r=ca(t.g,"EXT-X-TARGETDURATION"),r=Number(r.value),e.J=Math.max(r,e.J),e.M=Math.min(r,e.M))}(e,y),P=function(e,t){if(1==t.length)return t[0];var r=sa(e,t);if(null!=r)return r;throw new H(2,4,4025,t)}(n,r),S(l,function(e,t,r,n){return p((function i(){var a,o,s,u,c,l,d,h,f,p;return M(i,(function(i){switch(i.s){case 1:return a=fe,o=n.segments[0].g,s=new J(o),u=s.pa.split(".").pop(),c=ha[t],(l=c[u])?i.return(l):t==a.za?r&&"vtt"!=r&&"wvtt"!=r?i.return("application/mp4"):i.return("text/vtt"):((d=He([o],e.g.retryParameters)).method="HEAD",S(i,pa(e,d,1),2));case 2:return h=i.B,(f=h.headers["content-type"])?i.return(f.split(";")[0]):(p=c.mp4,i.return(p))}}))}))}(e,n,P,y),3);case 3:return C=l.B,da.includes(C)&&(P=""),L=(x=d.cb(y.g,"EXT-X-MEDIA-SEQUENCE"))?Number(x.value):0,I(l,4),S(l,aa(e,t,y,L,C,P),6);case 6:O=l.B,R(l,5);break;case 4:if(4035==(D=k(l)).code)return K.ba("Skipping unsupported HLS stream",C,t),l.return(null);throw D;case 5:if(Z=O[0].startTime,V=O[O.length-1].endTime,N=V-Z,G=new ai(O),X=ra(y),W=void 0,"text"==n&&(W="subtitle"),U=[],c)for(j=(Y=h(c.split(","))).next();!j.done;j=Y.next())F=j.value,U.push(F);return B={id:e.ea++,originalId:o,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:G.find.bind(G),getSegmentReference:G.get.bind(G),initSegmentReference:X,presentationTimeOffset:0,mimeType:C,codecs:P,kind:W,encrypted:v,keyId:_,language:i,label:o,type:n,primary:a,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:void 0,pixelAspectRatio:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:U,channelsCount:s,audioSamplingRate:null,closedCaptions:u},l.return({stream:B,fc:G,drmInfos:b,Pc:t,We:f,td:Z,Yg:V,duration:N})}}))}))}function ra(e){var t=Vi.Ab(e.g,"EXT-X-MAP");if(!t.length)return null;if(1<t.length)throw new H(2,4,4020);var r=ua(t=t[0],"URI"),n=Vi.Sc(e.h,r);return e=0,r=null,(t=Mi(t,"BYTERANGE"))&&(e=t.split("@"),t=Number(e[0]),r=(e=Number(e[1]))+t-1),new ri((function(){return[n]}),e,r)}function na(e,t,r,n){var i=t.h,a=t.g;t=ca(i,"EXTINF").value.split(","),t=n+Number(t[0]);var o=0,s=null;return(i=Vi.cb(i,"EXT-X-BYTERANGE"))&&(o=i.value.split("@"),i=Number(o[0]),s=(o=o[1]?Number(o[1]):e.g+1)+i-1),new ni(r,n,t,(function(){return[a]}),o,s)}function ia(e){e.i&&(e.P.forEach((function(t){e.i.Jb(t,0)})),e.P=[])}function aa(e,t,r,n,i,a){return p((function o(){var s,u,c,l,d,h,f,m,y,g;return M(o,(function(o){switch(o.s){case 1:return s=r.segments,u=[],c=s[0].g,l=na(null,s[0],n,0),d=ra(r),S(o,function(e,t,r,n,i,a){return p((function o(){var s,u,c,l,d,h,f,p,m;return M(o,(function(o){switch(o.s){case 1:if(e.A){if(s=e.h.get(t),u=s.fc,c=u.get(n.position))return K.K("Found segment start time in previous manifest"),o.return(c.startTime);K.debug("Unable to find segment start time in previous manifest!")}if(K.K("Fetching segment to find start time"),i=i.toLowerCase(),da.includes(i))throw K.ba("Raw formats are not yet supported. Skipping "+i),new H(1,4,4035);if("video/webm"==i)throw K.ba("WebM in HLS is not yet supported. Skipping."),new H(1,4,4035);if("video/mp4"!=i&&"audio/mp4"!=i){o.I(2);break}return l=[oa(e,n)],r&&l.push(oa(e,r)),S(o,Promise.all(l),3);case 3:return d=o.B,h=d[0],f=d[1]||d[0],o.return(function(e,t,r,n){var i=0;if((new Zn).box("moov",Vn).box("trak",Vn).box("mdia",Vn).ma("mdhd",(function(e){e.reader.U(0==e.version?8:16),i=e.reader.N(),e.parser.stop()})).parse(n,!0),!i)throw K.error("Unable to find timescale in init segment!"),new H(2,4,4030,e,t);var a=0,o=!1;if((new Zn).box("moof",Vn).box("traf",Vn).ma("tfdt",(function(e){a=(0==e.version?e.reader.N():e.reader.Pb())/i,o=!0,e.parser.stop()})).parse(r,!0),!o)throw new H(2,4,4030,e,t);return a}(t,h.uri,h.data,f.data));case 2:if("video/mp2t"!=i){o.I(4);break}return S(o,oa(e,n),5);case 5:return p=o.B,o.return(function(e,t,r){function n(){a.seek(o+188),71!=(s=a.ra())&&(a.seek(o+192),s=a.ra()),71!=s&&(a.seek(o+204),s=a.ra()),71!=s&&i(),a.Fe(1)}function i(){throw new H(2,4,4030,e,t)}for(var a=new On(new DataView(r),0),o=0,s=0;;)if(o=a.ka(),71!=(s=a.ra())&&i(),8191==(8191&(r=a.dc())))n();else if(16384&r){if(0!=(r=(48&a.ra())>>4)&&2!=r||i(),3==r&&(r=a.ra(),a.U(r)),1==a.N()>>8)return a.U(3),0!=(r=a.ra()>>6)&&1!=r||i(),0==a.ra()&&i(),(1073741824*((14&(r=a.ra()))>>1)+((65534&a.dc())<<14|(65534&a.dc())>>1))/9e4;n()}else n()}(t,p.uri,p.data));case 4:if("application/mp4"!=i&&!i.startsWith("text/")){o.I(6);break}return S(o,oa(e,n),7);case 7:return m=o.B,o.return(function(e,t,r){return e=ct(e,t),yr(e)?(t=new pr(null),gr(t,e),t.xc(r)):0}(i,a,m.data));case 6:throw new H(2,4,4030,t)}}))}))}(e,t,d,l,i,a),2);case 2:h=o.B,K.debug("First segment",c.split("/").pop(),"starts at",h);for(var v=0;v<s.length;++v)f=s[v],m=u[u.length-1],y=0==v?h:m.endTime,g=na(m,f,n+v,y),u.push(g);return e.P.push(u),ia(e),o.return(u)}}))}))}function oa(e,t){return p((function r(){var n,i,a,o,s,u;return M(r,(function(r){switch(r.s){case 1:return n=1,i=Ei(t.i(),t.h,t.h+2048-1,e.g.retryParameters),a=Ei(t.i(),t.h,t.g,e.g.retryParameters),e.g.hls.useFullSegmentsForStartTime?r.return(pa(e,a,n)):(I(r,2),S(r,pa(e,i,n),4));case 4:return o=r.B,r.return(o);case 2:if(7001==(s=k(r)).code)throw s;return K.ba("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS preflights.",i.uris[0]),S(r,pa(e,a,n),5);case 5:return u=r.B,r.return(u)}}))}))}function sa(e,t){for(var r=la[e],n=0;n<r.length;n++)for(var i=0;i<t.length;i++)if(r[n].test(t[i].trim()))return t[i].trim();return"text"==e?"":null}function ua(e,t){var r=e.getAttribute(t);if(!r)throw new H(2,4,4023,t);return r.value}function ca(e,t){var r=Vi.cb(e,t);if(!r)throw new H(2,4,4024,t);return r}W("shaka.net.DataUriPlugin",Hi),Hi.parse=function(t){var r=t.split(":");if(2>r.length||"data"!=r[0])throw K.error("Bad data URI, failed to parse scheme"),new H(2,1,1004,t);if(2>(r=r.slice(1).join(":").split(",")).length)throw K.error("Bad data URI, failed to extract encoding and MIME type"),new H(2,1,1004,t);var n=r[0];t=e.decodeURIComponent(r.slice(1).join(",")),r=n.split(";"),n=r[0];var i=!1;return 1<r.length&&"base64"==r[r.length-1]&&(i=!0,r.pop()),{data:i?Ee.Ja(t).buffer:be(t),contentType:n}},Ke("data",Hi),W("shaka.hls.HlsParser",zi),(n=zi.prototype).configure=function(e){this.g=e},n.start=function(e,t){var r=this;return p((function n(){var i,a;return M(n,(function(n){switch(n.s){case 1:return r.j=t,S(n,pa(r,He([e],r.g.retryParameters),0),2);case 2:return i=n.B,r.F=i.uri,S(n,function(e,t){return p((function r(){var n,i,a,o,s,u,c,l,d,f,m;return M(r,(function(r){switch(r.s){case 1:if(0!=(n=Fi(e.C,t,e.F)).type)throw new H(2,4,4022);return S(r,function(e,t){return p((function r(){var n,i,a,o,s,u,c,l,d,f,m,y;return M(r,(function(r){switch(r.s){case 1:return n=Vi,i=le,a=t.g,o=n.Ab(t.g,"EXT-X-MEDIA"),s=o.filter(function(e){return"SUBTITLES"==ua(e,"TYPE")}.bind(e)),u=s.map(function(e){var t=this;return p((function r(){var n;return M(r,(function(r){switch(r.s){case 1:return t.g.disableText?r.return(null):(I(r,2),S(r,function(e,t){return p((function r(){var n;return M(r,(function(r){switch(r.s){case 1:return ua(t,"TYPE"),S(r,ea(e,t,[]),2);case 2:return n=r.B,r.return(n.stream)}}))}))}(t,e),4));case 4:return r.return(r.B);case 2:if(n=k(r),t.g.hls.ignoreTextStreamFailures)return r.return(null);throw n}}))}))}.bind(e)),c=o.filter((function(e){return"CLOSED-CAPTIONS"==ua(e,"TYPE")})),function(e,t){for(var r=h(t),n=r.next();!n.done;n=r.next()){ua(n=n.value,"TYPE");var i=Mi(n,"LANGUAGE")||"und";i=Dr(i);var a=ua(n,"GROUP-ID");n=ua(n,"INSTREAM-ID"),e.u.get(a)||e.u.set(a,new Map),e.u.get(a).set(n,i)}}(e,c),S(r,Promise.all(u),2);case 2:return l=r.B,d=n.Ab(a,"EXT-X-STREAM-INF"),f=d.map(function(e){return function(e,t,r){return p((function n(){var i,a,o,s,u,c,l,d,f,m,y,g,v,b,_,A,T,E,$,I,w,R,k,P,C,x,L,O,D;return M(n,(function(n){switch(n.s){case 1:return i=fe,a=Vi,o=[],e.g.disableVideo||o.push("avc1.42E01E"),e.g.disableAudio||o.push("mp4a.40.2"),s=o.join(","),u=Mi(t,"CODECS",s),c=function(e){for(var t=new Set,r=[],n=(e=h(e)).next();!n.done;n=e.next()){var i=dt(n=n.value)[0];t.has(i)?K.debug("Ignoring duplicate codec"):(r.push(n),t.add(i))}return r}(u.split(/\s*,\s*/)),l=t.getAttribute("RESOLUTION"),f=d=null,m=Mi(t,"FRAME-RATE"),y=Number(Mi(t,"AVERAGE-BANDWIDTH"))||Number(ua(t,"BANDWIDTH")),l&&(g=l.value.split("x"),d=g[0],f=g[1]),v=(v=a.Ab(r.g,"EXT-X-MEDIA")).filter((function(e){return"CLOSED-CAPTIONS"!=ua(e,"TYPE")})),v=v.filter((function(e){var t=Mi(e,"URI")||"";return"SUBTITLES"==(Mi(e,"TYPE")||"")||""!=t})),b=Mi(t,"AUDIO"),_=Mi(t,"VIDEO"),b?v=a.Zc(v,"AUDIO",b):_&&(v=a.Zc(v,"VIDEO",_)),(A=sa(i.za,c))&&((T=Mi(t,"SUBTITLES"))&&(E=a.Zc(v,"SUBTITLES",T)).length&&($=e.L.get(E[0].id))&&($.stream.codecs=A),We(c,A)),I=v.map(function(e){return ea(this,e,c)}.bind(e)),w=[],R=[],S(n,Promise.all(I),2);case 2:if(P=(P=n.B).filter((function(e){return null!=e})),b?w=P:_&&(R=P),K.debug("Guessing stream type for",t.toString()),x=!1,w.length||R.length?w.length?(O=ua(t,"URI"),D=w[0].Pc,O==D?(K.debug("Guessing audio-only."),C=i.Sb,x=!0):(K.debug("Guessing video."),C=i.Za)):(K.debug("Guessing audio."),C=i.Sb):1==c.length?(L=sa(i.Za,c),l||m||L?(K.debug("Guessing video-only."),C=i.Za):(K.debug("Guessing audio-only."),C=i.Sb)):(K.debug("Guessing multiplexed audio+video."),C=i.Za,c=[c.join(",")]),x){n.I(3);break}return S(n,function(e,t,r,n){return p((function i(){var a,o,s,u,c;return M(i,(function(i){switch(i.s){case 1:return a=fe,o=ua(t,"URI"),e.h.has(o)?i.return(e.h.get(o)):(s=Mi(t,"CLOSED-CAPTIONS"),u=null,n==a.Za&&s&&"NONE"!=s&&(u=e.u.get(s)),S(i,ta(e,o,r,n,"und",!1,null,null,u,null),2));case 2:return null==(c=i.B)?i.return(null):e.h.has(o)?i.return(e.h.get(o)):(e.h.set(o,c),i.return(c))}}))}))}(e,t,c,C),4);case 4:k=n.B;case 3:if(k)k.stream.type==i.Sb?w=[k]:R=[k];else if(null===k)return K.debug("streamInfo is null"),n.return([]);return R&&Qi(R),w&&Qi(w),n.return(function(e,t,r,n,i,a,o){r.forEach(function(e){(e=e.stream)&&(e.width=Number(i)||void 0,e.height=Number(a)||void 0,e.frameRate=Number(o)||void 0)}.bind(e));var s=!!e.g&&e.g.disableAudio;t.length&&!s||(t=[null]);s=!!e.g&&e.g.disableVideo,(!r.length||s)&&(r=[null]);s=[];for(var u=(t=h(t)).next();!u.done;u=t.next()){u=u.value;for(var c=h(r),l=c.next();!l.done;l=c.next()){var d=l.value;l=u?u.stream:null;var f=d?d.stream:null,p=u?u.drmInfos:null,m=d?d.drmInfos:null;d=(d?d.Pc:"")+" - "+(u?u.Pc:"");var y=void 0;if(l&&f){if(p.length&&m.length&&!(0<Vt(p,m).length)){K.v("Incompatible DRM info in HLS variant. Skipping.");continue}y=Vt(p,m)}else l?y=p:f&&(y=m);e.Z.has(d)?K.debug("Skipping variant which only differs in text streams."):(l=qi(e,l,f,n,y),s.push(l),e.Z.add(d))}}return s}(e,w,R,y,d,f,m))}}))}))}(this,e,t)}.bind(e)),S(r,Promise.all(f),3);case 3:return m=r.B,y=(y=m.reduce(i.Rc,[])).filter((function(e){return null!=e})),r.return({startTime:0,variants:y,textStreams:l.filter((function(e){return null!=e}))})}}))}))}(e,n),2);case 2:if(i=r.B,!e.j)throw new H(2,7,7001);if(e.da&&0==i.variants.length)throw K.info("No stream is created, because we don't support AES-128","encryption yet"),new H(2,4,4034);e.j.filterAllPeriods([i]),a=1/0,o=0,s=1/0;for(var y=h(e.h.values()),g=y.next();!g.done;g=y.next())u=g.value,a=Math.min(a,u.td),o=Math.max(o,u.td),"text"!=u.stream.type&&(s=Math.min(s,u.duration));if(e.l!=ga.$a?(e.i=new Ti(0,3*e.J),e.i.hc(!1)):(e.i=new Ti(null,0),e.i.hc(!0)),ia(e),e.l!=ga.$a){for(e.X=e.M,c=ga,e.l==c.Wd&&(l=e.i.Ic,isNaN(e.g.availabilityWindowOverride)||(l=e.g.availabilityWindowOverride),e.i.Pd(l)),d=0;95443.7176888889<=o;)d+=95443.7176888889,o-=95443.7176888889;if(d)for(K.debug("Offsetting live streams by",d,"to compensate for rollover"),g=(y=h(e.h.values())).next();!g.done;g=y.next())95443.7176888889>(f=g.value).td?(K.K("Offset applied to",f.stream.type),f.stream.presentationTimeOffset=-d,f.fc.offset(d)):K.K("Offset NOT applied to",f.stream.type)}else for(e.i.Fa(s),e.i.offset(-a),g=(y=h(e.h.values())).next();!g.done;g=y.next())(m=g.value).stream.presentationTimeOffset=a,m.fc.offset(-a),oi(m.fc,s);e.A={presentationTimeline:e.i,periods:[i],offlineSessionIds:[],minBufferTime:0},$(r)}}))}))}(r,i.data),3);case 3:return 0<(a=r.X)&&r.m.V(a),n.return(r.A)}}))}))},n.stop=function(){this.m&&(this.m.stop(),this.m=null);var e=[];return this.o&&(e.push(this.o.destroy()),this.o=null),this.g=this.j=null,this.L.clear(),this.Z.clear(),this.h.clear(),this.A=null,Promise.all(e)},n.update=function(){if(this.l!=ga.$a){for(var e=[],t=h(this.h.values()),r=t.next();!r.done;r=t.next())e.push(Ji(this,r.value));return Promise.all(e)}},n.onExpirationUpdated=function(){};var la={audio:[/^vorbis$/,/^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},da=["audio/aac","audio/ac3","audio/ec3","audio/mpeg"],ha={audio:{mp4:"audio/mp4",mp4a:"audio/mp4",m4s:"audio/mp4",m4i:"audio/mp4",m4a:"audio/mp4",m4f:"audio/mp4",cmfa:"audio/mp4",ts:"video/mp2t",aac:"audio/aac",ac3:"audio/ac3",ec3:"audio/ec3",mp3:"audio/mpeg"},video:{mp4:"video/mp4",mp4v:"video/mp4",m4s:"video/mp4",m4i:"video/mp4",m4v:"video/mp4",m4f:"video/mp4",cmfv:"video/mp4",ts:"video/mp2t"},text:{mp4:"application/mp4",m4s:"application/mp4",m4i:"application/mp4",m4f:"application/mp4",cmft:"application/mp4",vtt:"text/vtt",ttml:"application/ttml+xml"}};function fa(e,t){e.l=t,e.i&&e.i.hc(e.l==ga.$a),e.l!=ga.$a||e.m.stop()}function pa(e,t,r){if(!e.o)throw new H(2,7,7001);return t=e.j.networkingEngine.request(r,t),Be(e.o,t),t.promise}var ma={"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(e){var t=ua(e,"METHOD");Ur("HLS SAMPLE-AES-CENC","SAMPLE-AES-CENC will no longer be supported, see Issue #1227");var r=["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"];return r.includes(t)?(t=ua(e,"URI"),t=Hi.parse(t),t=he("com.widevine.alpha",[{initDataType:"cenc",initData:t=new Uint8Array(t.data)}]),(e=Mi(e,"KEYID"))&&(t.keyIds=[e.toLowerCase().substr(2)]),t):(K.error("Widevine in HLS is only supported with [",r.join(", "),"], not",t),null)}},ya="VOD",ga={$a:ya,Se:"EVENT",Wd:"LIVE"};function va(){this.g=new Map}function ba(e,t,r){_a(e,t).text=r}function _a(e,t){return e.g.has(t)||e.g.set(t,new Aa),e.g.get(t)}function Aa(){this.text=this.variant=null}function Ta(e,t){this.g=e,this.h=new Set([e]);for(var r=h(t=t||[]),n=r.next();!n.done;n=r.next())this.add(n.value)}function Ea(e,t){var r;if(!(r=!!e.audio!=!!t.audio||!!e.video!=!!t.video||e.language!=t.language)&&(r=e.audio&&t.audio)){r=e.audio;var n=t.audio;r=!(r.channelsCount==n.channelsCount&&Sa(r,n)&&$a(r.roles,n.roles))}return!r&&(r=e.video&&t.video)&&(r=!(Sa(r=e.video,n=t.video)&&$a(r.roles,n.roles))),!r}function Sa(e,t){if(e.mimeType!=t.mimeType)return!1;var r=e.codecs.split(",").map((function(e){return dt(e)[0]})),n=t.codecs.split(",").map((function(e){return dt(e)[0]}));if(r.length!=n.length)return!1;r.sort(),n.sort();for(var i=0;i<r.length;i++)if(r[i]!=n[i])return!1;return!0}function $a(e,t){var r=new Set(e),n=new Set(t);if(r.delete("main"),n.delete("main"),r.size!=n.size)return!1;for(var i=(r=h(r)).next();!i.done;i=r.next())if(!n.has(i.value))return!1;return!0}function Ia(e){this.g=e,this.h=new wa(e.language,"",e.audio&&e.audio.channelsCount?e.audio.channelsCount:0,"")}function wa(e,t,r,n){this.i=e,this.j=t,this.g=r,this.h=void 0===n?"":n}function Ra(){this.g=Ca,this.h=(new Map).set(Ca,2).set(Pa,1)}function ka(e,t,r){e.h.set(Ca,r).set(Pa,t)}Ai.Fd("m3u8",zi),Ai.Qb("application/x-mpegurl",zi),Ai.Qb("application/vnd.apple.mpegurl",zi),Ta.prototype.add=function(e){return Ea(this.g,e)?(this.h.add(e),!0):(K.v("Rejecting variant - not compatible with root."),!1)},Ta.prototype.values=function(){return this.h.values()},Ia.prototype.create=function(e){var t=this,r=e.filter((function(e){return Ea(t.g,e)}));return r.length?new Ta(r[0],r):this.h.create(e)},wa.prototype.create=function(e){var t=[];t=function(e,t){var r=Dr(t),n=Zr(r,e.map((function(e){return Mr(e)})));return n?e.filter((function(e){return n==Mr(e)})):[]}(e,this.i);var r=e.filter((function(e){return e.primary}));for((e=function(e,t){return e.filter((function(e){return!!e.audio&&(t?e.audio.roles.includes(t):0==e.audio.roles.length)}))}(t=t.length?t:r.length?r:e,this.j)).length?t=e:K.v("No exact match for variant role could be found."),this.g&&((e=Nr.ee(t,this.g)).length?t=e:K.v("No exact match for the channel count could be found.")),this.h&&(e=function(e,t){return e.filter((function(e){return!!e.audio&&e.audio.label.toLowerCase()==t.toLowerCase()}))}(t,this.h),e.length?t=e:K.v("No exact match for variant label could be found.")),e=new Ta(t[0]),r=(t=h(t)).next();!r.done;r=t.next())r=r.value,Ea(e.g,r)&&e.add(r);return e};var Pa=0,Ca=1;function xa(e,t){this.l=e,this.m=Oa(e),this.g=e.g.currentTime,this.j=Date.now()/1e3,this.h=!1,this.o=t,this.i=function(){}}function La(e){this.g=e}function Oa(e){if(e.g.paused||0==e.g.playbackRate||0==e.g.buffered.length)var t=!1;else e:{t=e.g.buffered,e=e.g.currentTime;for(var r=0;r<t.length;r++){var n=t.start(r),i=t.end(r);if(!(e<n-.1||e>i-.5)){t=!0;break e}}t=!1}return t}function Da(e,t,r,n,i){var a=this;this.g=e,this.F=t,this.C=r,this.u=i,this.j=new et,this.o=!1,this.A=e.readyState,this.i=!1,this.h=n,this.m=!1,this.j.H(e,"waiting",(function(){return Ma(a)})),this.l=new Re((function(){Ma(a)})).Oa(.25)}function Ma(e){if(0!=e.g.readyState){if(e.g.seeking){if(!e.o)return}else e.o=!1;if(!e.g.paused||0==e.g.currentTime){var t;if(e.g.readyState!=e.A&&(e.i=!1,e.A=e.g.readyState),!(t=!e.h)){var r=(t=e.h).l,n=Oa(r),i=r.g.currentTime,a=Date.now()/1e3;t.g==i&&t.m==n||(t.j=a,t.g=i,t.m=n,t.h=!1),(n=(i=a-t.j)>=t.o&&n&&!t.h)&&(t.i(t.g,i),t.h=!0,t.g=r.g.currentTime),t=!n}if(t){a=e.C.smallGapLimit,t=e.g.currentTime;e:{if((r=e.g.buffered)&&r.length&&!(1==r.length&&1e-6>r.end(0)-r.start(0)))for(n=navigator.userAgent.match(/Edge\//)||vt("Trident/")||mt()||vt("CrKey")?.5:.1,i=0;i<r.length;i++)if(r.start(i)>t&&(0==i||r.end(i-1)-t<=n)){n=i;break e}n=null}if(null!=n&&(0!=n||e.m)){i=r.start(n);var o=e.F.Ka();if(!(i>=o)){a=(o=i-t)<=a;var s=!1;if(!(.001>o)){if(!a&&!e.i){e.i=!0;var u=new Ze("largegap",{currentTime:t,gapSize:o});u.cancelable=!0,e.u(u),e.C.jumpLargeGaps&&!u.defaultPrevented?s=!0:K.info("Ignoring large gap at",t,"size",o)}(a||s)&&(0==n?K.info("Jumping forward",o,"seconds because of gap before start time of",i):K.info("Jumping forward",o,"seconds because of gap starting at",r.end(n-1),"and ending at",i),e.g.currentTime=i)}}}}}}}function Za(e){var t=this;this.i=e,this.g=new Set,this.h=new Re((function(){Va(t,!1)})).Oa(.25)}function Va(e,t){for(var r=h(e.g),n=r.next();!n.done;n=r.next())n.value.l(e.i.currentTime,t)}function Na(e){for(var t=[],r=(e=h(e)).next();!r.done;r=e.next())for(var n=(r=h(r.value.variants)).next();!n.done;n=r.next())t.push(n.value);return t}function Ga(e,t){for(var r=null,n=h(e),i=n.next();!i.done;i=n.next())t>=(i=i.value).startTime&&(r=i);return r}function Xa(e){this.i=e,this.g=null,this.h=function(){}}function Wa(e){var t=this;this.g=e,this.j=!1,this.i=this.g.wc(),this.h=new Re((function(){t.g.pe(.25*t.i)}))}function Ua(e){e.h.stop();var t=e.j?0:e.i;if(0<=t)try{return void(e.g.wc()!=t&&e.g.Od(t))}catch(e){}e.h.Oa(.25),0!=e.g.wc()&&e.g.Od(0)}function Fa(e,t,r,n){t==HTMLMediaElement.HAVE_NOTHING||e.readyState>=t?n():(t=Ba.get(t),r.ya(e,t,n))}xa.prototype.release=function(){this.l=null,this.i=function(){}},Da.prototype.release=function(){this.j&&(this.j.release(),this.j=null),null!=this.l&&(this.l.stop(),this.l=null),this.h&&(this.h.release(),this.h=null),this.g=this.F=this.u=null},Da.prototype.zd=function(){this.m=!0,Ma(this)},Za.prototype.release=function(){this.h.stop();for(var e=h(this.g),t=e.next();!t.done;t=e.next())t.value.release();this.g.clear()},Xa.prototype.release=function(){this.g=this.i=null,this.h=function(){}},Xa.prototype.l=function(e){var t=this.g,r=this.i.periods;t!=(e=Ga(r,e)||r[0])&&this.h(e),this.g=e},Wa.prototype.release=function(){this.h&&(this.h.stop(),this.h=null),this.g=null},Wa.prototype.set=function(e){this.i=e,Ua(this)},Wa.prototype.vc=function(){return this.g.vc()};var Ba=new Map([[HTMLMediaElement.HAVE_METADATA,"loadedmetadata"],[HTMLMediaElement.HAVE_CURRENT_DATA,"loadeddata"],[HTMLMediaElement.HAVE_FUTURE_DATA,"canplay"],[HTMLMediaElement.HAVE_ENOUGH_DATA,"canplaythrough"]]);function Ya(e,t,r){var n=this;this.g=e,this.l=t,this.j=r,this.m=!1,this.h=new et,this.i=new Ja(e),Fa(this.g,HTMLMediaElement.HAVE_METADATA,this.h,(function(){Ha(n,n.j)}))}function ja(e){return e.m?e.g.currentTime:e.j}function Ka(e,t){0<e.g.readyState?Qa(e.i,t):Fa(e.g,HTMLMediaElement.HAVE_METADATA,e.h,(function(){Ha(e,e.j)}))}function Ha(e,t){.001>Math.abs(e.g.currentTime-t)?za(e):(e.h.ya(e.g,"seeking",(function(){za(e)})),Qa(e.i,0==e.g.currentTime?t:e.g.currentTime))}function za(e){e.m=!0,e.h.H(e.g,"seeking",(function(){return e.l()}))}function Ja(e){var t=this;this.h=e,this.m=10,this.l=this.i=this.j=0,this.g=new Re((function(){0>=t.j?(K.v(["Failed to move playhead from",t.i,"to",t.l].join(" ")),t.g.stop()):t.h.currentTime!=t.i?t.g.stop():(t.h.currentTime=t.l,t.j--)}))}function Qa(e,t){e.i=e.h.currentTime,e.l=t,e.j=e.m,e.h.currentTime=t,e.g.Oa(.1)}function qa(e){var t=this;this.g=e,this.j=!1,this.i=null,this.h=new et,Fa(this.g,HTMLMediaElement.HAVE_CURRENT_DATA,this.h,(function(){null==t.i?t.j=!0:(t.h.ya(t.g,"seeking",(function(){t.j=!0})),t.g.currentTime=Math.max(0,t.g.currentTime+t.i))}))}function eo(e,t,r,n,i,a){var o=this;this.i=e,this.g=t.presentationTimeline,this.J=t.minBufferTime||0,this.m=r,this.F=i,this.u=null,this.j=new Da(e,t.presentationTimeline,r,function(e,t){if(!t.stallEnabled)return null;var r=t.stallSkip,n=new xa(new La(e),t.stallThreshold);return function(e,t){e.i=t}(n,(function(t,n){K.debug("Stall detected at "+t+" for "+n+" seconds."),r?(K.debug("Seeking forward "+r+" seconds to break stall."),e.currentTime+=r):(K.debug("Pausing and unpausing to break stall."),e.pause(),e.play())})),n}(e,r),a),this.h=new Ya(e,(function(){e:{var e=o.j;e.o=!0,e.m=!1,e.i=!1,e=ja(o.h);var t=ro(o,e);if(.001<Math.abs(t-e)){var r=Date.now()/1e3;if(!o.u||o.u<r-1){o.u=r,Ka(o.h,t),e=void 0;break e}}K.K("Seek to "+e),o.F(),e=void 0}return e}),function(e,t){return null==t?t=1/0>e.g.ha()?e.g.Cb():e.g.Ka():0>t&&(t=e.g.Ka()+t),to(e,no(e,t))}(this,n)),this.o=new Re((function(){if(0!=o.i.readyState&&!o.i.paused){var e=ja(o.h),t=o.g.Cb(),r=o.g.Ka();3>r-t&&(t=r-3),e<t&&(t=ro(o,e),K.info("Jumping forward "+(t-e)+" seconds to catch up with the seek range."),o.i.currentTime=t)}})).Oa(.25)}function to(e,t){var r=e.g.ha();return t>=r?r-e.m.durationBackoff:t}function ro(e,t){var r=Kt.bind(null,e.i.buffered),n=Math.max(e.J,e.m.rebufferingGoal),i=e.m.safeSeekOffset,a=e.g.Cb(),o=e.g.Ka(),s=e.g.ha();3>o-a&&(a=o-3);var u=e.g.Zb(n),c=e.g.Zb(i);return n=e.g.Zb(n+i),t>=s?(K.K("Playhead past duration."),to(e,t)):t>o?(K.K("Playhead past end."),o):t<a?r(c)?(K.K("Playhead before start & start is buffered"),c):(K.K("Playhead before start & start is unbuffered"),n):t>=u||r(t)?(K.K("Playhead in safe region or in buffered region."),t):(K.K("Playhead outside safe region & in unbuffered region."),n)}function no(e,t){var r=e.g.Cb();return t<r||t>(r=e.g.Ka())?r:t}function io(e){var t=this;this.h=function(){},this.g=new Set,this.j=e,this.i=new Re((function(){for(var e=t.j(),r=h(t.g),n=r.next();!n.done;n=r.next())(n=n.value).endTime<e.start&&t.g.delete(n)})).Oa(2)}function ao(e){var t=this;this.m=e,this.j=new Map,this.g=function(){},this.h=function(){},this.i=function(){},this.o=[{rb:null,qb:so,hb:function(e,r){return t.g(e,r)}},{rb:oo,qb:so,hb:function(e,r){return t.g(e,r)}},{rb:uo,qb:so,hb:function(e,r){return t.g(e,r)}},{rb:so,qb:oo,hb:function(e,r){return t.h(e,r)}},{rb:so,qb:uo,hb:function(e,r){return t.h(e,r)}},{rb:oo,qb:uo,hb:function(e,r){return t.i(e,r)}},{rb:uo,qb:oo,hb:function(e,r){return t.i(e,r)}}]}Ya.prototype.release=function(){this.h&&(this.h.release(),this.h=null),null!=this.i&&(this.i.release(),this.i=null),this.l=function(){},this.g=null},Ja.prototype.release=function(){this.g&&(this.g.stop(),this.g=null),this.h=null},qa.prototype.release=function(){this.h&&(this.h.release(),this.h=null),this.g=null},qa.prototype.A=function(e){this.i=this.j?this.i:e},qa.prototype.l=function(){return(this.j?this.g.currentTime:this.i)||0},qa.prototype.C=function(){},eo.prototype.release=function(){this.h&&(this.h.release(),this.h=null),this.j&&(this.j.release(),this.j=null),this.o&&(this.o.stop(),this.o=null),this.i=this.h=this.g=this.m=null,this.F=function(){}},eo.prototype.A=function(e){Ka(this.h,e)},eo.prototype.l=function(){var e=ja(this.h);return 0<this.i.readyState&&!this.i.paused?no(this,e):e},eo.prototype.C=function(){this.j.zd()},io.prototype.release=function(){this.h=function(){},this.g.clear(),this.i.stop()},ao.prototype.release=function(){this.m=null,this.j.clear(),this.g=function(){},this.h=function(){},this.i=function(){}},ao.prototype.l=function(e,t){for(var r=h(this.m.g),n=r.next();!n.done;n=r.next()){n=n.value;var i=this.j.get(n),a=e<n.startTime?oo:e>n.endTime?uo:so;this.j.set(n,a);for(var o=h(this.o),s=o.next();!s.done;s=o.next())(s=s.value).rb==i&&s.qb==a&&s.hb(n,t)}};var oo=1,so=2,uo=3;function co(e,t){this.g=t,this.i=e,this.l=null,this.u=1,this.F=Promise.resolve(),this.m=[],this.o=new Map,this.h=new Map,this.C=!1,this.M=null,this.L=this.j=this.A=!1,this.J=0}function lo(e){return fo(e,"audio")}function ho(e){return fo(e,"video")}function fo(e,t){var r=e.h.get(t);return r?r.Ta||r.stream:null}function po(e,t){return p((function r(){var n,i,a,o,s,u,c,l,d;return M(r,(function(r){switch(r.s){case 1:return n=fe,S(r,kr(e.g.T,n.za),2);case 2:return e.J++,e.L=!1,i=e.J,a=e.g.T,o=new Map,s=new Set,o.set(n.za,t),s.add(t),S(r,a.init(o,!1),3);case 3:return e.j?r.return():S(r,To(e,s),4);case 4:if(e.j)return r.return();u=e.g.T.l.isTextVisible()||e.l.alwaysStreamText,e.J!=i||e.h.has(n.za)||e.L||!u||(c=e.g.eb(),l=Po(e,c),d=_o(t,l,0),e.h.set(n.za,d),Oo(e,d,0)),$(r)}}))}))}function mo(e,t){var r=e.h.get("video");if(r){var n=r.stream;if(n)if(K.debug("setTrickPlay",t),t){var i=n.trickModeVideo;i&&!r.Ta&&(K.debug("Engaging trick mode stream",i),go(e,i,!1,0,!1),r.Ta=n)}else(n=r.Ta)&&(K.debug("Restoring non-trick-mode stream",n),r.Ta=null,go(e,n,!0,0,!1))}}function yo(e,t,r,n){var i=!1;if(t.video){var a=go(e,t.video,r,n,!1);i=i||a}return t.audio&&(e=go(e,t.audio,r,n,!1),i=i||e),i}function go(e,t,r,n,i){var a=e.h.get(t.type);if(!a&&"text"==t.type&&e.l.ignoreTextStreamFailures)return po(e,t),!0;if(!a)return!1;var o=Co(e,t),s=Array.from(e.h.values()).every((function(e){return e.oa==a.oa}));return r&&o!=a.oa&&s?(K.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),e.h.forEach((function(t){vo(e,t)})),!0):(a.Ta&&(K.debug("switch during trick play mode",t),t.trickModeVideo?(a.Ta=t,t=t.trickModeVideo,K.debug("switch found trick play stream",t)):(a.Ta=null,K.debug("switch found no special trick play stream"))),!(!(s=e.m[o])||!s.Rb)&&(!(!(s=e.o.get(t.id))||!s.Rb)&&(a.stream!=t||i?("text"==t.type&&Tr(e.g.T,ct(t.mimeType,t.codecs)),a.stream=t,a.Ac=!0,K.debug("switch: switching to Stream "+Vo(a)),function(e,t,r){if(!t.lb)return!1;var n=e.g.eb(),i=$r(e.g.T,t.type),a=$o(e,t,n,i,r);return r=a&&a.g?a.g-a.h:null,a&&!r&&(r=(a.endTime-a.xc())*t.stream.bandwidth/8),!isNaN(r)&&((a=t.stream.initSegmentReference)&&(r+=(a.g?a.g-a.h:null)||0),a=e.g.getBandwidthEstimate(),8*r/a<i-n-Math.max(e.i.minBufferTime||0,e.l.rebufferingGoal)||t.lb.h.g>r)}(e,a,o)&&(K.info("Aborting current segment request to switch."),a.lb.abort()),r&&(a.ab?a.Qc=!0:a.Sa?(a.Wa=!0,a.oc=n,a.Qc=!0):(Do(a),Lo(e,a,!0,n).catch((function(t){e.g&&e.g.onError(t)})))),!0):(K.debug("switch: Stream "+Vo(a)+" already active"),!1))))}function vo(e,t){var r=Vo(t);t.ab?K.debug(r,"clear: already clearing the buffer"):t.Wa?K.debug(r,"clear: already waiting"):t.Sa?(K.debug(r,"clear: currently updating"),t.Wa=!0,t.oc=0):null==Sr(e.g.T,t.type)?(K.debug(r,"clear: nothing buffered"),null==t.Pa&&Oo(e,t,0)):(K.debug(r,"clear: handling right now"),Do(t),Lo(e,t,!1,0).catch((function(t){e.g&&e.g.onError(t)})))}function bo(e,t,r,n,i){return p((function a(){var o,s,u,c,l,d,h;return M(a,(function(a){switch(a.s){case 1:return o=e.g.eb(),s=Po(e,o),u=fe,c=new Map,l=new Set,t&&(c.set(u.Sb,t),l.add(t)),r&&(c.set(u.Za,r),l.add(r)),n&&(c.set(u.za,n),l.add(n)),d=e.g.T,h=e.l.forceTransmuxTS,S(a,d.init(c,h),2);case 2:return e.j?a.return():(function(e){var t=e.i.presentationTimeline.ha();1/0>t?e.g.T.Fa(t):e.g.T.Fa(Math.pow(2,32))}(e),S(a,To(e,l),3));case 3:if(e.j)return a.return();c.forEach((function(t,r){if(!e.h.has(r)){var n=_o(t,s,i);e.h.set(r,n),Oo(e,n,0)}})),$(a)}}))}))}function _o(e,t,r){return{stream:e,type:e.type,Hb:null,La:null,Ta:null,Ac:!0,oa:t,endOfStream:!1,Sa:!1,Pa:null,Wa:!1,oc:0,Qc:!1,ab:!1,Ed:!1,ac:!1,Hd:r||0,lb:null}}function Ao(e,t){var r=e.m[t];if(r)return K.debug("(all) Period "+t+" is being or has been set up"),r.promise;K.debug("(all) setting up Period "+t),r={promise:new me,Rb:!1},e.m[t]=r;for(var n=new Set,i=h(e.i.periods[t].variants),a=i.next();!a.done;a=i.next())(a=a.value).video&&n.add(a.video),a.video&&a.video.trickModeVideo&&n.add(a.video.trickModeVideo),a.audio&&n.add(a.audio);for(a=(i=h(e.i.periods[t].textStreams)).next();!a.done;a=i.next())n.add(a.value);return e.F=e.F.then(function(){if(!this.j)return To(this,n)}.bind(e)).then(function(){this.j||(this.m[t].promise.resolve(),this.m[t].Rb=!0,K.K("(all) setup Period "+t))}.bind(e)).catch(function(e){this.j||(this.m[t].promise.catch((function(){})),this.m[t].promise.reject(),delete this.m[t],K.v("(all) failed to setup Period "+t),this.g.onError(e))}.bind(e)),r.promise}function To(e,t){return p((function r(){var n,i,a,o,s,u,c;return M(r,(function(r){switch(r.s){case 1:n=[];for(var l=h(t),d=l.next();!d.done;d=l.next())i=d.value,(a=e.o.get(i.id))?(K.debug("(all) Stream "+i.id+" is being or has been set up"),n.push(a.promise)):(K.K("(all) setting up Stream "+i.id),e.o.set(i.id,{promise:new me,Rb:!1}),n.push(i.createSegmentIndex()));return I(r,2),S(r,Promise.all(n),4);case 4:if(e.j)return r.return();R(r,3);break;case 2:if(o=k(r),e.j)return r.return();for(d=(r=h(t)).next();!d.done;d=r.next())s=d.value,e.o.get(s.id).promise.catch((function(){})),e.o.get(s.id).promise.reject(),e.o.delete(s.id);throw o;case 3:for(d=(l=h(t)).next();!d.done;d=l.next())u=d.value,(c=e.o.get(u.id)).Rb||(c.promise.resolve(),c.Rb=!0,K.K("(all) setup Stream "+u.id));$(r)}}))}))}function Eo(e,t){if(!e.j){var r=Vo(t);if(!t.Sa&&null!=t.Pa&&!t.ab)if(t.Pa=null,t.Wa)K.debug(r,"skipping update and clearing the buffer"),Lo(e,t,t.Qc,t.oc);else{try{var n=function(e,t){if(Ro(t))return Rr(e.g.T,t.stream.originalId||""),null;var r=Vo(t),n=e.g.eb(),i=So(e,t,n);K.O(r,"timeNeeded="+i);var a=Co(e,t.stream),o=Po(e,i),s=function(e,t,r){return"text"==t?null==(e=e.g).h||e.h<r?0:e.h-Math.max(r,e.g):Ht(e=Ir(e,t),r)}(e.g.T,t.type,n);K.O(r,"update_:","presentationTime="+n,"bufferedAhead="+s);var u=Math.max(e.i.minBufferTime||0,e.l.rebufferingGoal,e.l.bufferingGoal)*e.u;if(i>=e.i.presentationTimeline.ha())return K.debug(r,"buffered to end of presentation"),t.endOfStream=!0,"video"==t.type&&(i=e.h.get("text"))&&"application/cea-608"==i.stream.mimeType&&(i.endOfStream=!0),null;if(t.endOfStream=!1,t.oa=o,o!=a)return K.debug(r,"need Period "+o,"presentationTime="+n,"timeNeeded="+i,"currentPeriodIndex="+a),null;if(s>=u)return K.O(r,"buffering goal met"),.5;if(r=$r(e.g.T,t.type),r=$o(e,t,n,r,a),!r)return 1;var c=1/0;return Array.from(e.h.values()).forEach((function(t){Ro(t)||(t=So(e,t,n),c=Math.min(c,t))})),i>=c+e.i.presentationTimeline.g?1:(t.Hd=0,function(e,t,r,n,i){var a=Vo(t),o=e.i.periods[n];K.K(a,"fetchAndAppend_:","presentationTime="+r,"currentPeriod.startTime="+o.startTime,"reference.position="+i.position,"reference.startTime="+i.startTime,"reference.endTime="+i.endTime);var s=t.stream,u=e.i.presentationTimeline.ha(),c=e.i.periods[n+1];n=function(e,t,r,n,i){if(!t.Ac)return Promise.resolve();var a=Vo(t);return r=e.i.periods[r].startTime-t.stream.presentationTimeOffset,K.K(a,"setting timestamp offset to "+r),K.K(a,"setting append window start to "+n),K.K(a,"setting append window end to "+i),n=function(e,t,r,n,i){return"text"==t?(e.g.A=r,(e=e.g).j=n,e.m=i,Promise.resolve()):Promise.all([Pr(e,t,e.Ve.bind(e,t)),Pr(e,t,e.Cg.bind(e,t,r)),Pr(e,t,e.zg.bind(e,t,n,i))])}(e.g.T,t.type,r,n,i),t.stream.initSegmentReference?(K.K(a,"fetching init segment"),e=xo(e,t,t.stream.initSegmentReference).then(function(e){if(!this.j)return K.K(a,"appending init segment"),wr(this.g.T,t.type,e,null,null,t.stream.closedCaptions&&0<t.stream.closedCaptions.size)}.bind(e)).catch((function(e){return t.Ac=!0,Promise.reject(e)})),Promise.all([n,e])):n}(e,t,n,Math.max(0,o.startTime-.1),c?c.startTime+.01:u),t.Sa=!0,t.Ac=!1,K.O(a,"fetching segment"),u=xo(e,t,i),Promise.all([n,u]).then(function(e){if(!this.j&&!this.A)return function(e,t,r,n,i,a,o){var s=Vo(t),u=i.closedCaptions&&0<i.closedCaptions.size;return null!=i.emsgSchemeIdUris&&0<i.emsgSchemeIdUris.length&&(new Zn).ma("emsg",e.P.bind(e,n,a,i.emsgSchemeIdUris)).parse(o),function(e,t,r){var n=Vo(t);K.O(n,"checking buffer length");var i=Math.max(e.l.bufferBehind,e.i.presentationTimeline.g),a=Sr(e.g.T,t.type);if(null==a)return K.O(n,"buffer behind okay because nothing buffered:","presentationTime="+r,"bufferBehind="+i),Promise.resolve();var o=r-a,s=o-i;return.01>=s?(K.O(n,"buffer behind okay:","presentationTime="+r,"bufferedBehind="+o,"bufferBehind="+i,"underflow="+Math.abs(s)),Promise.resolve()):(K.K(n,"buffer behind too large:","presentationTime="+r,"bufferedBehind="+o,"bufferBehind="+i,"overflow="+s),e.g.T.remove(t.type,a,a+s).then(function(){this.j||K.K(n,"evicted "+s+" seconds")}.bind(e)))}(e,t,r).then(function(){if(!this.j)return K.K(s,"appending media segment"),wr(this.g.T,t.type,o,a.startTime+n.startTime,a.endTime+n.startTime,u)}.bind(e)).then(function(){if(!this.j)return K.O(s,"appended media segment"),t.Hb=i,t.La=a,Promise.resolve()}.bind(e))}(this,t,r,o,s,i,e[1])}.bind(e)).then(function(){this.j||this.A||(t.Sa=!1,t.Ed=!1,t.Wa||this.g.zd(),Oo(this,t,0),function(e,t,r){if(!e.C){var n=Vo(t);if(1==(t=Array.from(e.h.values())).length&&"text"==t[0].type||(e.C=t.every((function(e){return"text"==e.type||!e.Wa&&!e.ab&&e.La}))),e.C){for(K.debug(n,"startup complete"),r=Co(e,r),e.m[r]||Ao(e,r).then(function(){this.j||(K.K(n,"calling onCanSwitch()..."),this.g.te())}.bind(e)).catch(le.Bc),r=0;r<e.i.periods.length;++r)Ao(e,r).catch(le.Bc);e.g.gg&&(K.K(n,"calling onStartupComplete()..."),e.g.gg())}}}(this,t,s),K.K(a,"finished fetch and append"))}.bind(e)).catch(function(e){this.j||this.A||(t.Sa=!1,"text"==t.type&&this.l.ignoreTextStreamFailures?(1001==e.code?K.v(a,"Text stream failed to download. Proceeding without it."):K.v(a,"Text stream failed to parse. Proceeding without it."),this.h.delete("text")):7001==e.code?(t.Sa=!1,t.Pa=null,Oo(this,t,0)):3017==e.code?function(e,t,r){var n=Vo(t);if(Array.from(e.h.values()).some((function(e){return e!=t&&e.Ed})))K.debug(n,"MediaSource threw QuotaExceededError:","waiting for another stream to recover...");else{var i=Math.round(100*e.u);if(20<i)e.u-=.2;else{if(!(4<i))return K.error(n,"MediaSource threw QuotaExceededError too many times"),t.ac=!0,e.A=!0,void e.g.onError(r);e.u-=.04}K.v(n,"MediaSource threw QuotaExceededError:","reducing buffering goals by "+(100-Math.round(100*e.u))+"%"),t.Ed=!0}Oo(e,t,4)}(this,t,e):(K.error(a,"failed fetch and append: code="+e.code),t.ac=!0,e.severity=2,Zo(this,e)))}.bind(e))}(e,t,n,a,r),null)}(e,t);null!=n&&(Oo(e,t,n),t.ac=!1)}catch(t){return void Zo(e,t)}n=Array.from(e.h.values()),function(e,t){var r=Vo(t),n=Co(e,t.stream);if(t.oa!=n){var i=t.oa,a=Array.from(e.h.values());a.every((function(e){return e.oa==i||Ro(e)}))?a.every(ko)?(K.debug(r,"all need Period "+i),Ao(e,i).then(function(){if(!this.j)if(a.every(function(e){var t=ko(e),r=Co(this,e.stream);return!!Ro(e)||t&&e.oa==i&&r!=i}.bind(this))){var e=this.i.periods[i];K.K(r,"calling onChooseStreams()...");var t=this.g.ue(e),n=new Map;t.variant&&t.variant.video&&n.set("video",t.variant.video),t.variant&&t.variant.audio&&n.set("audio",t.variant.audio),t.text&&n.set("text",t.text);for(var o=(t=h(this.h.keys())).next();!o.done;o=t.next())if(o=o.value,!n.has(o)&&"text"!=o)return K.error(r,"invalid Streams chosen: missing "+o+" Stream"),void this.g.onError(new H(2,5,5005));for(o=(t=h(Array.from(n.keys()))).next();!o.done;o=t.next())if(o=o.value,!this.h.has(o)){if("text"!=o)return K.error(r,"invalid Streams chosen: unusable "+o+" Stream"),void this.g.onError(new H(2,5,5005));bo(this,null,null,n.get("text"),e.startTime),n.delete(o)}for(o=(t=h(Array.from(this.h.keys()))).next();!o.done;o=t.next()){o=o.value;var s=this.h.get(o),u=n.get(o);if(u){var c=Ro(s);c&&(s.oa=i,s.Hd=e.startTime),go(this,u,!1,0,!1),c&&Ro(s)||Oo(this,this.h.get(o),0)}else this.h.delete(o)}K.K(r,"calling onCanSwitch()..."),this.g.te()}else K.debug(r,"ignoring transition to Period",i,"since another is happening")}.bind(e)).catch(le.Bc)):K.debug(r,"all MediaStates need Period "+i+", but not all MediaStates are idle"):K.debug(r,"not all MediaStates need Period "+i)}}(e,t),e.C&&n.every((function(e){return e.endOfStream}))&&(K.K(r,"calling endOfStream()..."),e.g.T.endOfStream().then(function(){if(!this.j){var e=this.g.T.ha();0!=e&&e<this.i.presentationTimeline.ha()&&this.i.presentationTimeline.Fa(e)}}.bind(e)))}}}function So(e,t,r){return t.Hb&&t.La?(r=Co(e,t.Hb),e.i.periods[r].startTime+t.La.endTime):Math.max(r,t.Hd)}function $o(e,t,r,n,i){var a=Vo(t);return t.La&&t.stream==t.Hb?(n=t.La.position+1,K.O(a,"next position known:","position="+n),wo(e,t,i,n)):(t.La?(K.K(a,"next position unknown: another Stream buffered"),a=Co(e,t.Hb),a=Io(e,t,e.i.periods[a].startTime+t.La.endTime,i)):(K.K(a,"next position unknown: nothing buffered"),a=Io(e,t,n||r,i)),null==a?null:(r=null,null==n&&(r=wo(e,t,i,Math.max(0,a-1))),r||wo(e,t,i,a)))}function Io(e,t,r,n){var i=Vo(t);return e=e.i.periods[n],K.debug(i,"looking up segment:","presentationTime="+r,"currentPeriod.startTime="+e.startTime),r=Math.max(0,r-e.startTime),null==(t=t.stream.findSegmentPosition(r))&&K.v(i,"cannot find segment:","currentPeriod.startTime="+e.startTime,"lookupTime="+r),t}function wo(e,t,r,n){var i=Vo(t);return r=e.i.periods[r],(t=t.stream.getSegmentReference(n))?(e=(n=e.i.presentationTimeline).$b(),n=n.Db(),r.startTime+t.endTime<e||r.startTime+t.startTime>n?(K.O(i,"segment is not available:","currentPeriod.startTime="+r.startTime,"reference.startTime="+t.startTime,"reference.endTime="+t.endTime,"availabilityStart="+e,"availabilityEnd="+n),null):t):(K.K(i,"segment does not exist:","currentPeriod.startTime="+r.startTime,"position="+n),null)}function Ro(e){return e&&"text"==e.type&&"application/cea-608"==e.stream.mimeType}function ko(e){return!e.Sa&&null==e.Pa&&!e.Wa&&!e.ab}function Po(e,t){var r=Ga(e.i.periods,t+pe);return r?e.i.periods.indexOf(r):0}function Co(e,t){for(var r=e.i.periods,n=0;n<r.length;n++){for(var i=r[n],a=new Set,o=h(i.variants),s=o.next();!s.done;s=o.next())(s=s.value).audio&&a.add(s.audio),s.video&&a.add(s.video),s.video&&s.video.trickModeVideo&&a.add(s.video.trickModeVideo);for(o=(i=h(i.textStreams)).next();!o.done;o=i.next())a.add(o.value);if(a.has(t))return n}return-1}function xo(e,t,r){var n=Ei(r.i(),r.h,r.g,e.l.retryParameters);return K.O("fetching: reference=",r),e=e.g.Ib.request(1,n),t.lb=e,e.promise.then((function(e){return t.lb=null,e.data}))}function Lo(e,t,r,n){return p((function i(){var a,o,s,u;return M(i,(function(i){switch(i.s){case 1:return a=Vo(t),t.Wa=!1,t.Qc=!1,t.oc=0,t.ab=!0,t.Hb=null,t.La=null,K.debug(a,"clearing buffer"),n?(s=e.g.eb(),u=e.g.T.ha(),o=e.g.T.remove(t.type,s+n,u)):o=kr(e.g.T,t.type).then(function(){if(!this.j&&r)return this.g.T.flush(t.type)}.bind(e)),S(i,o,2);case 2:if(e.j)return i.return();K.debug(a,"cleared buffer"),t.ab=!1,t.endOfStream=!1,Oo(e,t,0),$(i)}}))}))}function Oo(e,t,r){var n=Vo(t),i=t.type;"text"!=i||e.h.has(i)?(K.O(n,"updating in "+r+" seconds"),t.Pa=new we((function(){return p((function r(){var n;return M(r,(function(r){switch(r.s){case 1:return I(r,2),S(r,Eo(e,t),4);case 4:R(r,0);break;case 2:n=k(r),e.g&&e.g.onError(n),$(r)}}))}))})).V(r)):K.K(n,"Text stream is unloaded. No update is needed.")}function Do(e){null!=e.Pa&&(e.Pa.stop(),e.Pa=null)}function Mo(e){return p((function t(){return M(t,(function(t){if(1===t.s){if(e.lb)return S(t,e.lb.abort(),0);t.I(0)}}))}))}function Zo(e,t){Pe(e.M).then(function(){this.j||(this.g.onError(t),t.handled||this.l.failureCallback(t))}.bind(e))}function Vo(e){return"("+e.type+":"+e.stream.id+")"}function No(e,t,r,n,i,a){if(200<=r&&299>=r&&202!=r)return{uri:i||n,Bd:n,data:t,headers:e,fromCache:!!e["x-shaka-from-cache"]};i=null;try{i=ve(t)}catch(e){}throw K.debug("HTTP error text:",i),new H(401==r||403==r?2:1,1,1001,n,r,i,e,a)}function Go(e,t,r,n){var i=new Go.h;st(t.headers).forEach((function(e,t){i.append(t,e)}));var a=new Go.g,o={Zd:!1,Oe:!1};if(e=new Ce(e=Go.u(e,r,{body:t.body||void 0,headers:i,method:t.method,signal:a.signal,credentials:t.allowCrossSiteCredentials?"include":void 0},o,n),(function(){return o.Zd=!0,a.abort(),Promise.resolve()})),t=t.retryParameters.timeout){var s=new Re((function(){o.Oe=!0,a.abort()}));s.V(t/1e3),e.finally((function(){s.stop()}))}return e}function Xo(e,t,r,n){var i=new Xo.j,a=Date.now(),o=0;return new Ce(new Promise((function(s,u){for(var c in i.open(t.method,e,!0),i.responseType="arraybuffer",i.timeout=t.retryParameters.timeout,i.withCredentials=t.allowCrossSiteCredentials,i.onabort=function(){u(new H(1,1,7001,e,r))},i.onload=function(t){for(var n=(t=t.target).getAllResponseHeaders().trim().split("\r\n"),i={},a=(n=h(n)).next();!a.done;a=n.next())i[(a=a.value.split(": "))[0].toLowerCase()]=a.slice(1).join(": ");try{var o=No(i,t.response,t.status,e,t.responseURL,r);s(o)}catch(e){u(e)}},i.onerror=function(t){u(new H(1,1,1002,e,t,r))},i.ontimeout=function(){u(new H(1,1,1003,e,r))},i.onprogress=function(e){var t=Date.now();(100<t-a||e.lengthComputable&&e.loaded==e.total)&&(n(t-a,e.loaded-o,e.total-e.loaded),o=e.loaded,a=t)},t.headers)i.setRequestHeader(c.toLowerCase(),t.headers[c]);i.send(t.body)})),(function(){return i.abort(),Promise.resolve()}))}function Wo(){this.g=this.j=this.h=0,this.i=new Map,this.l=0}function Uo(e,t,r){this.m=e,this.h=new Map,this.i=!1,this.l=t,this.j=r,this.g=new Wo}function Fo(e,t,r,n,i,a){var o=function(e,t){e.h+=t;var r=e.l;return e.l++,e.i.set(r,t),r}(e.g,n);n=e.h.get(t)||Promise.resolve(),e.h.set(t,n.then((function(){return p((function t(){var n,s,u,c,l,d;return M(t,(function(t){switch(t.s){case 1:return S(t,function(e,t){return p((function r(){var n;return M(r,(function(r){switch(r.s){case 1:return S(r,e.m.request(1,t).promise,2);case 2:return n=r.B,r.return(n.data)}}))}))}(e,r),2);case 2:if(n=t.B,e.i)throw new H(2,9,7001);if(i)for(var h in s=new Uint8Array(n),(u=new Fn(s)).data)c=Number(h),l=u.data[c],d=u.g[c],e.j(l,d);return e.g.close(o,n.byteLength),h=e.g,e.l(0==h.h?0:h.j/h.h,e.g.g),t.return(a(n))}}))}))})))}function Bo(e,t){var r=this;this.i=e,this.h=e.objectStore(t),this.g=new me,e.onabort=function(e){e.preventDefault(),r.g.reject()},e.onerror=function(e){e.preventDefault(),r.g.reject()},e.oncomplete=function(){r.g.resolve()}}function Yo(e,t){return new Promise((function(r,n){var i=e.h.openCursor();i.onerror=n,i.onsuccess=function(e){if(!(e=e.target.result))return r();t(e.key,e.value,e),e.continue()}}))}function jo(e){this.h=e,this.g=[]}function Ko(e,t){return Ho(e,t,"readwrite")}function Ho(e,t,r){var n=new Bo(r=e.h.transaction([t],r),t);return e.g.push(n),n.promise().then((function(){We(e.g,n)}),(function(){We(e.g,n)})),n}function zo(e,t,r){this.h=new jo(e),this.i=t,this.g=r}function Jo(e){return Promise.reject(new H(2,9,9011,"Cannot add new value to "+e))}function Qo(e,t,r,n){t=(e=Ko(e.h,t)).store();for(var i={},a=(r=h(r)).next();!a.done;i={key:i.key},a=r.next())i.key=a.value,t.delete(i.key).onsuccess=function(e){return function(){return n(e.key)}}(i);return e.promise()}function qo(e,t,r){return p((function n(){var i,a,o,s,u,c,l;return M(n,(function(n){switch(n.s){case 1:for(i=Ho(e.h,t,"readonly"),a=i.store(),o={},s=[],u={},c=h(r),l=c.next();!l.done;u={request:u.request,key:u.key},l=c.next())u.key=l.value,u.request=a.get(u.key),u.request.onsuccess=function(e){return function(){null==e.request.result&&s.push(e.key),o[e.key]=e.request.result}}(u);return S(n,i.promise(),2);case 2:if(s.length)throw new H(2,9,9012,"Could not find values for "+s);return n.return(r.map((function(e){return o[e]})))}}))}))}function es(e){this.g=new jo(e)}function ts(){this.g=new Map}function rs(e,t,r){if(!(e=e.g.get(t)))throw new H(2,9,9013,"Could not find mechanism with name "+t);if(!(t=e.getCells().get(r)))throw new H(2,9,9013,"Could not find cell with name "+r);return t}function ns(e,t){is.set(e,t)}co.prototype.destroy=function(){var e=this;return p((function t(){var r,n;return M(t,(function(t){switch(t.s){case 1:r=[];for(var i=h(e.h.values()),a=i.next();!a.done;a=i.next())Do(n=a.value),r.push(Mo(n));return S(t,Promise.all(r),2);case 2:e.h.clear(),e.o.clear(),e.g=null,e.i=null,e.F=null,e.m=null,e.l=null,e.j=!0,$(t)}}))}))},co.prototype.configure=function(e){this.l=e,this.M=new ke({maxAttempts:Math.max(e.retryParameters.maxAttempts,2),baseDelay:e.retryParameters.baseDelay,backoffFactor:e.retryParameters.backoffFactor,fuzzFactor:e.retryParameters.fuzzFactor,timeout:0},!0)},co.prototype.start=function(){var e=this;return p((function t(){var r,n,i;return M(t,(function(t){switch(t.s){case 1:return r=e.g.eb(),n=Po(e,r),(i=e.g.ue(e.i.periods[n])).variant||i.text?S(t,bo(e,i.variant?i.variant.audio:null,i.variant?i.variant.video:null,i.text,r),2):(K.error("init: no Streams chosen"),t.return(new H(2,5,5005)));case 2:if(e.j)return t.return();K.debug("init: completed initial Stream setup"),e.g&&e.g.Yf&&(K.K("init: calling onInitialStreamsSetup()..."),e.g.Yf()),$(t)}}))}))},co.prototype.P=function(e,t,r,n){var i=n.reader.Cd(),a=n.reader.Cd(),o=n.reader.N(),s=n.reader.N(),u=n.reader.N(),c=n.reader.N();n=n.reader.mb(n.reader.S.byteLength-n.reader.ka()),e=e.startTime+t.startTime+s/o,r.includes(i)&&("urn:mpeg:dash:event:2012"==i?this.g.Zf():this.g.onEvent(new Ze("emsg",{detail:{startTime:e,endTime:e+u/o,schemeIdUri:i,value:a,timescale:o,presentationTimeDelta:s,eventDuration:u,id:c,messageData:n}})))},W("shaka.net.HttpFetchPlugin",Go),Go.u=function(e,t,r,n,i){return p((function a(){var o,s,u,c,l,d,h,f,m,y,g,v;return M(a,(function(a){switch(a.s){case 1:return o=Go.l,s=Go.i,d=l=0,h=Date.now(),I(a,2),S(a,o(e,r),4);case 4:return u=a.B,f=u.clone().body.getReader(),y=(m=u.headers.get("Content-Length"))?parseInt(m,10):0,new s({start:function(e){!function t(){return p((function r(){var n,a,o;return M(r,(function(r){switch(r.s){case 1:return I(r,2),S(r,f.read(),4);case 4:n=r.B,R(r,3);break;case 2:return a=k(r),K.K("error reading from stream",a.message),r.return();case 3:n.done||(l+=n.value.byteLength),(100<(o=Date.now())-h||n.done)&&(i(o-h,l-d,y-l),d=l,h=o),n.done?e.close():(e.enqueue(n.value),t()),$(r)}}))}))}()}}),S(a,u.arrayBuffer(),5);case 5:c=a.B,R(a,3);break;case 2:if(g=k(a),n.Zd)throw new H(1,1,7001,e,t);if(n.Oe)throw new H(1,1,1003,e,t);throw new H(1,1,1002,e,g,t);case 3:return v={},u.headers.forEach((function(e,t){v[t.trim()]=e})),a.return(No(v,c,u.status,e,u.url,t))}}))}))},Go.isSupported=function(){if(!e.ReadableStream)return!1;try{new ReadableStream({})}catch(e){return!1}return!(!e.fetch||!e.AbortController)},Go.isSupported=Go.isSupported,Go.l=e.fetch,Go.g=e.AbortController,Go.i=e.ReadableStream,Go.h=e.Headers,Go.isSupported()&&(Ke("http",Go,2),Ke("https",Go,2)),W("shaka.net.HttpXHRPlugin",Xo),Xo.j=e.XMLHttpRequest,Ke("http",Xo,1),Ke("https",Xo,1),Wo.prototype.close=function(e,t){if(this.i.has(e)){var r=this.i.get(e);this.i.delete(e),this.j+=r,this.g+=t}},Uo.prototype.destroy=function(){return this.i=!0,Promise.all(this.h.values()).then((function(){}),(function(){}))},Bo.prototype.abort=function(){try{this.i.abort()}catch(e){}return this.g.catch((function(){}))},Bo.prototype.store=function(){return this.h},Bo.prototype.promise=function(){return this.g},jo.prototype.destroy=function(){return Promise.all(this.g.map((function(e){return e.abort()})))},(n=zo.prototype).destroy=function(){return this.h.destroy()},n.hasFixedKeySpace=function(){return!0},n.addSegments=function(){return Jo(this.i)},n.removeSegments=function(e,t){return Qo(this,this.i,e,t)},n.getSegments=function(e){var t=this;return p((function r(){var n;return M(r,(function(r){switch(r.s){case 1:return S(r,qo(t,t.i,e),2);case 2:return n=r.B,r.return(n.map((function(e){return t.ae(e)})))}}))}))},n.addManifests=function(){return Jo(this.g)},n.updateManifestExpiration=function(e,t){var r=Ko(this.h,this.g),n=r.store();return n.get(e).onsuccess=function(r){(r=r.target.result)&&(r.expiration=t,n.put(r,e))},r.promise()},n.removeManifests=function(e,t){return Qo(this,this.g,e,t)},n.getManifests=function(e){var t=this;return p((function r(){var n;return M(r,(function(r){switch(r.s){case 1:return S(r,qo(t,t.g,e),2);case 2:return n=r.B,r.return(n.map((function(e){return t.pc(e)})))}}))}))},n.getAllManifests=function(){var e=this;return p((function t(){var r,n;return M(t,(function(t){switch(t.s){case 1:return r=Ho(e.h,e.g,"readonly"),n=new Map,S(t,Yo(r,(function(t,r){n.set(t,e.pc(r))})),2);case 2:return S(t,r.promise(),3);case 3:return t.return(n)}}))}))},n.ae=function(e){return e},n.pc=function(e){return e},n.add=function(e,t){var r=this;return p((function n(){var i,a,o,s;return M(n,(function(n){switch(n.s){case 1:i=Ko(r.h,e),a=i.store(),o=[];for(var u=h(t),c=u.next();!c.done;c=u.next())s=c.value,a.add(s).onsuccess=function(e){o.push(e.target.result)};return S(n,i.promise(),2);case 2:return n.return(o)}}))}))},es.prototype.destroy=function(){return this.g.destroy()},es.prototype.getAll=function(){var e=this;return p((function t(){var r,n;return M(t,(function(t){switch(t.s){case 1:return r=Ho(e.g,"session-ids","readonly"),n=[],S(t,Yo(r,(function(e,t){n.push(t)})),2);case 2:return S(t,r.promise(),3);case 3:return t.return(n)}}))}))},es.prototype.add=function(e){for(var t=Ko(this.g,"session-ids"),r=t.store(),n=(e=h(e)).next();!n.done;n=e.next())r.add(n.value);return t.promise()},es.prototype.remove=function(e){var t=this;return p((function r(){var n;return M(r,(function(r){switch(r.s){case 1:return S(r,Yo(n=Ko(t.g,"session-ids"),(function(t,r,n){0<=e.indexOf(r.sessionId)&&n.delete()})),2);case 2:return S(r,n.promise(),0)}}))}))},ts.prototype.destroy=function(){for(var e=[],t=h(this.g.values()),r=t.next();!r.done;r=t.next())e.push(r.value.destroy());return this.g.clear(),Promise.all(e)},ts.prototype.init=function(){var e=this;is.forEach((function(t,r){var n=t();n?e.g.set(r,n):K.info("Skipping "+r+" as it is not supported on this platform")}));for(var t=[],r=h(this.g.values()),n=r.next();!n.done;n=r.next())t.push(n.value.init());return Promise.all(t)},ts.prototype.erase=function(){var e=this;return p((function t(){var r,n;return M(t,(function(t){switch(t.s){case 1:return r=Array.from(e.g.values()),(n=0<r.length)||is.forEach((function(e){(e=e())&&r.push(e)})),S(t,Promise.all(r.map((function(e){return e.erase()}))),2);case 2:if(!n)return S(t,Promise.all(r.map((function(e){return e.destroy()}))),0);t.I(0)}}))}))},W("shaka.offline.StorageMuxer.register",ns),W("shaka.offline.StorageMuxer.unregister",(function(e){is.delete(e)}));var is=new Map;function as(e){zo.apply(this,arguments)}function os(e){return function(e){var t=e.streams.filter((function(e){return"audio"==e.contentType})),r=e.streams.filter((function(e){return"video"==e.contentType}));if(!t.every((function(e){return e.variantIds}))||!r.every((function(e){return e.variantIds}))){t.forEach((function(e){e.variantIds=[]})),r.forEach((function(e){e.variantIds=[]}));var n=0;if(r.length&&!t.length){K.debug("Found video-only content. Creating variants for video.");var i=n++;r.forEach((function(e){e.variantIds.push(i)}))}if(!r.length&&t.length){K.debug("Found audio-only content. Creating variants for audio.");var a=n++;t.forEach((function(e){e.variantIds.push(a)}))}r.length&&t.length&&(K.debug("Found audio-video content. Creating variants."),t.forEach((function(e){r.forEach((function(t){var r=n++;e.variantIds.push(r),t.variantIds.push(r)}))})))}}(e),e.streams.forEach((function(){})),{startTime:e.startTime,streams:e.streams.map(ss)}}function ss(e){var t=e.initSegmentUri?cs(e.initSegmentUri):null;return{id:e.id,originalId:null,primary:e.primary,presentationTimeOffset:e.presentationTimeOffset,contentType:e.contentType,mimeType:e.mimeType,codecs:e.codecs,frameRate:e.frameRate,pixelAspectRatio:void 0,kind:e.kind,language:e.language,label:e.label,width:e.width,height:e.height,initSegmentKey:t,encrypted:e.encrypted,keyId:e.keyId,segments:e.segments.map(us),variantIds:e.variantIds}}function us(e){var t=cs(e.uri);return{startTime:e.startTime,endTime:e.endTime,dataKey:t}}function cs(e){var t;if((t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(e))||(t=/^offline:segment\/([0-9]+)$/.exec(e)))return Number(t[1]);throw new H(2,9,9004,"Could not parse uri "+e)}function ls(e,t,r,n){zo.call(this,e,t,r),this.j=n}function ds(){this.l=this.i=this.h=this.g=this.j=null}function hs(e,t,r,n){this.g=e,this.l=t,this.j=r,this.i=n,this.h=["offline:",e,"/",t,"/",r,"/",n].join("")}function fs(e){if(null==(e=/^offline:([a-z]+)\/([^/]+)\/([^/]+)\/([0-9]+)$/.exec(e)))return null;var t=e[1];if("manifest"!=t&&"segment"!=t)return null;var r=e[2];if(!r)return null;var n=e[3];return n&&null!=t?new hs(t,r,n,Number(e[4])):null}function ps(e,t){this.h=e,this.g=t}function ms(e,t,r){var n=t.streams.filter((function(e){return"audio"==e.contentType})),i=t.streams.filter((function(e){return"video"==e.contentType}));return n=function(e,t,r){for(var n=new Set,i=h(t),a=i.next();!a.done;a=i.next()){var o=h(a.value.variantIds);for(a=o.next();!a.done;a=o.next())n.add(a.value)}for(i=h(r),a=i.next();!a.done;a=i.next())for(o=h(a.value.variantIds),a=o.next();!a.done;a=o.next())n.add(a.value);for(i=new Map,n=h(n),a=n.next();!a.done;a=n.next())a=a.value,i.set(a,{id:a,language:"",primary:!1,audio:null,video:null,bandwidth:0,drmInfos:[],allowedByApplication:!0,allowedByKeySystem:!0});for(t=h(t),n=t.next();!n.done;n=t.next())for(n=n.value,a=ys(e,n),o=h(n.variantIds),n=o.next();!n.done;n=o.next())(n=i.get(n.value)).language=a.language,n.primary=n.primary||a.primary,n.audio=a;for(r=h(r),t=r.next();!t.done;t=r.next())for(n=t.value,t=ys(e,n),a=h(n.variantIds),n=a.next();!n.done;n=a.next())(n=i.get(n.value)).primary=n.primary||t.primary,n.video=t;return i}(e,n,i),i=t.streams.filter((function(e){return"text"==e.contentType})).map((function(t){return ys(e,t)})),t.streams.forEach((function(n){n=n.segments.map((function(t,r){return gs(e,r,t)})),r.Jb(n,t.startTime)})),{startTime:t.startTime,variants:Array.from(n.values()),textStreams:i}}function ys(e,t){var r=t.segments.map((function(t,r){return gs(e,r,t)})),n=new ai(r);return r={id:t.id,originalId:t.originalId,createSegmentIndex:function(){return Promise.resolve()},findSegmentPosition:function(e){return n.find(e)},getSegmentReference:function(e){return n.get(e)},initSegmentReference:null,presentationTimeOffset:t.presentationTimeOffset,mimeType:t.mimeType,codecs:t.codecs,width:t.width||void 0,height:t.height||void 0,frameRate:t.frameRate||void 0,pixelAspectRatio:t.pixelAspectRatio||void 0,kind:t.kind,encrypted:t.encrypted,keyId:t.keyId,language:t.language,label:t.label||null,type:t.contentType,primary:t.primary,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},null!=t.initSegmentKey&&(r.initSegmentReference=function(e,t){var r=new hs("segment",e.h,e.g,t);return new ri((function(){return[r.toString()]}),0,null)}(e,t.initSegmentKey)),r}function gs(e,t,r){var n=new hs("segment",e.h,e.g,r.dataKey);return new ni(t,r.startTime,r.endTime,(function(){return[n.toString()]}),0,null)}function vs(){this.g=null}function bs(e){var t=fs(e);return t&&"manifest"==t.g?bs.m(e):t&&"segment"==t.g?bs.o(t.key(),t):xe(new H(2,1,9004,e))}function _s(e,t,r){return p((function n(){var i,a,o,s,u,c;return M(n,(function(n){switch(n.s){case 1:i=[];for(var l=[],d=h(r),f=d.next();!f.done;f=d.next()){f=f.value;for(var m=!1,y=h(l),g=y.next();!g.done;g=y.next())if(As((g=g.value).info,f)){g.sessionIds.push(f.sessionId),m=!0;break}m||l.push({info:f,sessionIds:[f.sessionId]})}a=h(l),o=a.next();case 2:if(o.done){n.I(4);break}return s=o.value,u=function(e,t,r){return p((function n(){var i,a,o,s;return M(n,(function(n){switch(n.s){case 1:return i=new Tt({Ib:t,onError:function(){},Dc:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),I(n,2),i.configure(e),S(n,function(e,t,r,n,i,a){var o=new Map;return o.set(t,{audioCapabilities:i,videoCapabilities:a,distinctiveIdentifier:"optional",persistentState:"required",sessionTypes:["persistent-license"],label:t,drmInfos:[{keySystem:t,licenseServerUri:r,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:n,initData:null,keyIds:null}]}),xt(e,o)}(i,r.info.keySystem,r.info.licenseUri,r.info.serverCertificate,r.info.audioCapabilities,r.info.videoCapabilities),4);case 4:R(n,3);break;case 2:return a=k(n),K.v("Error initializing EME",a),S(n,i.destroy(),5);case 5:case 9:return n.return([]);case 3:return I(n,6),S(n,$t(i),8);case 8:R(n,7);break;case 6:return o=k(n),K.v("Error setting server certificate",o),S(n,i.destroy(),9);case 7:return s=[],S(n,Promise.all(r.sessionIds.map((function(e){return p((function t(){var r;return M(t,(function(t){switch(t.s){case 1:return I(t,2),S(t,function(e,t){return p((function r(){var n,i,a;return M(r,(function(r){switch(r.s){case 1:return S(r,Lt(e,t),2);case 2:return(n=r.B)?(i=[],(a=e.h.get(n))&&(a.Ga=new me,i.push(a.Ga)),K.O("Attempting to remove session",t),i.push(n.remove()),S(r,Promise.all(i),0)):(K.O("Ignoring attempt to remove missing session",t),r.return())}}))}))}(i,e),4);case 4:s.push(e),R(t,0);break;case 2:r=k(t),K.v("Error deleting offline session",r),$(t)}}))}))}))),10);case 10:return S(n,i.destroy(),11);case 11:return n.return(s)}}))}))}(e,t,s),S(n,u,5);case 5:c=n.B,i=i.concat(c),o=a.next(),n.I(2);break;case 4:return n.return(i)}}))}))}function As(e,t){function r(e,t){return e.robustness==t.robustness&&e.contentType==t.contentType}return e.keySystem==t.keySystem&&e.licenseUri==t.licenseUri&&Ue(e.audioCapabilities,t.audioCapabilities,r)&&Ue(e.videoCapabilities,t.videoCapabilities,r)}function Ts(e,t){var r={Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null},n=this;this.m=t,this.i=e,this.j=r,this.o=null,this.l=[],this.h=this.g=null,this.u=!0,this.A=Promise.resolve().then((function(){return function(e){return p((function t(){return M(t,(function(t){if(1===t.s){if(e.u){if(0==e.l.length||e.g&&!e.g.gb)var r=!1;else{e.g&&(e.g.Da.kb(),e.g=null);var n=(r=e.l.shift()).create(e.j);n?(r.Da.Kb(),e.g={node:n.node,payload:n.payload,gb:n.gb,Da:r.Da}):r.Da.Ec(),r=!0}return r?r=Promise.resolve():e.g?r=function(e){return p((function t(){var r,n;return M(t,(function(t){switch(t.s){case 1:return e.i=e.m.Af(e.i,e.j,e.g.node,e.g.payload),I(t,2),e.h=e.m.ef(e.i,e.j,e.g.payload),S(t,e.h.promise,4);case 4:e.h=null,e.i==e.g.node&&(e.g.Da.Cc(),e.g=null),R(t,0);break;case 2:return 7001==(r=k(t)).code?e.g.Da.kb():e.g.Da.onError(r),e.g=null,e.h=null,n=e,S(t,e.m.handleError(e.j,r),5);case 5:n.i=t.B,$(t)}}))}))}(e):(e.m.Xf(e.i),e.o=new me,r=e.o),S(t,r,1)}t.I(0)}}))}))}(n)}))}function Es(e,t){var r={Kb:function(){},Cc:function(){},kb:function(){},onError:function(){},Ec:function(){},$g:function(){}};return e.l.push({create:t,Da:r}),e.h&&e.h.abort(),Ss(e),r}function Ss(e){e.o&&(e.o.resolve(),e.o=null)}function $s(e){this.g=null;for(var t=0;t<e.textTracks.length;++t){var r=e.textTracks[t];r.mode="disabled","Shaka Player TextTrack"==r.label&&(this.g=r)}this.g||(this.g=e.addTextTrack("subtitles","Shaka Player TextTrack")),this.g.mode="hidden"}function Is(e){if(e.startTime>=e.endTime)return K.v("Invalid cue times: "+e.startTime+" - "+e.endTime),null;var t=new VTTCue(e.startTime,e.endTime,e.payload);t.lineAlign=e.lineAlign,t.positionAlign=e.positionAlign,e.size&&(t.size=e.size);try{t.align=e.textAlign}catch(e){}return"center"==e.textAlign&&"center"!=t.align&&(t.align="middle"),"vertical-lr"==e.writingMode?t.vertical="lr":"vertical-rl"==e.writingMode&&(t.vertical="rl"),1==e.lineInterpretation&&(t.snapToLines=!1),null!=e.line&&(t.line=e.line),null!=e.position&&(t.position=e.position),t}function ws(e,t){var r=e.mode;e.mode="showing"==r?"showing":"hidden";for(var n=e.cues,i=n.length-1;0<=i;i--){var a=n[i];a&&t(a)&&e.removeCue(a)}e.mode=r}function Rs(e,t,r,n,i){var a,o=i in n,s=!0;for(a in t){var u=i+"."+a,c=o?n[i]:r[a];o||a in r?void 0===t[a]?void 0===c||o?delete e[a]:e[a]=Ge(c):c.constructor==Object&&t[a]&&t[a].constructor==Object?(e[a]||(e[a]=Ge(c)),u=Rs(e[a],t[a],c,n,u),s=s&&u):typeof t[a]!=typeof c||null==t[a]||"function"!=typeof t[a]&&t[a].constructor!=c.constructor?(K.kc("Invalid config, wrong type for "+u),s=!1):("function"==typeof r[a]&&r[a].length!=t[a].length&&K.ba("Unexpected number of arguments for "+u),e[a]=t[a]):(K.kc("Invalid config, unrecognized key "+u),s=!1)}return s}function ks(e,t){for(var r={},n=r,i=0,a=0;!(0>(i=e.indexOf(".",i)));)0!=i&&"\\"==e[i-1]||(n[a=e.substring(a,i).replace(/\\\./g,".")]={},n=n[a],a=i+1),i+=1;return n[e.substring(a).replace(/\\\./g,".")]=t,r}function Ps(){}function Cs(){var e=5e5,t=1/0;navigator.connection&&(navigator.connection.downlink&&(e=1e6*navigator.connection.downlink),navigator.connection.saveData&&(t=360));var r={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1,initDataTransform:Ot,fairPlayTransform:!0,updateExpirationTime:1},n={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},availabilityWindowOverride:NaN,disableAudio:!1,disableVideo:!1,disableText:!1,dash:{customScheme:function(e){if(e)return null},clockSyncUri:"",ignoreDrmInfo:!1,xlinkFailGracefully:!1,defaultPresentationDelay:10,ignoreMinBufferTime:!1,autoCorrectDrift:!0,ignoreSuggestedPresentationDelay:!1,ignoreEmptyAdaptationSet:!1},hls:{ignoreTextStreamFailures:!1,useFullSegmentsForStartTime:!1}},i={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0},failureCallback:function(e){return K.error("Unhandled streaming error",e),[e]},rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,alwaysStreamText:!1,startAtSegmentBoundary:!1,smallGapLimit:.5,jumpLargeGaps:!1,durationBackoff:1,forceTransmuxTS:!1,safeSeekOffset:5,stallEnabled:!0,stallThreshold:1,stallSkip:.1,useNativeHlsOnSafari:!0};(vt("Web0S")||mt()||vt("CrKey"))&&(i.stallSkip=0);var a={trackSelectionCallback:function(e){return p((function t(){return M(t,(function(t){if(1===t.s)return t.return(e)}))}))},progressCallback:function(e,t){return[e,t]},usePersistentLicense:!0},o={drm:r,manifest:n,streaming:i,offline:a,abrFactory:Gr,abr:{enabled:!0,defaultBandwidthEstimate:e,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:t,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0}},preferredAudioLanguage:"",preferredTextLanguage:"",preferredVariantRole:"",preferredTextRole:"",preferredAudioChannelCount:2,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0},playRangeStart:0,playRangeEnd:1/0,textDisplayFactory:function(){return null}};return a.trackSelectionCallback=function(e){return p((function t(){return M(t,(function(t){if(1===t.s)return t.return(function(e,t){var r=e.filter((function(e){return"variant"==e.type})),n=[],i=Zr(t,r.map((function(e){return e.language})));i&&(n=r.filter((function(e){return Dr(e.language)==i}))),0==n.length&&(n=r.filter((function(e){return e.primary}))),0==n.length&&(1<new Set(r.map((function(e){return e.language}))).size&&K.v("Could not choose a good audio track based on language preferences or primary tracks. An arbitrary language will be stored!"),n=r);var a=n.filter((function(e){return e.height&&480>=e.height}));if(a.length&&(a.sort((function(e,t){return t.height-e.height})),n=a.filter((function(e){return e.height==a[0].height}))),r=[],n.length){var o=Math.floor(n.length/2);n.sort((function(e,t){return e.bandwidth-t.bandwidth})),r.push(n[o])}for(n=h(e),o=n.next();!o.done;o=n.next())"text"==(o=o.value).type&&r.push(o);return r}(e,o.preferredAudioLanguage))}))}))},o}function xs(e,t,r){var n={".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",serverCertificate:new Uint8Array(0),individualizationServer:""}};return Rs(e,t,r||Cs(),n,"")}function Ls(){this.g=null,this.h=[]}function Os(e,t){if(null==e.g)e.g={timestamp:Date.now()/1e3,state:t,duration:0};else{var r=Date.now()/1e3;e.g.duration=r-e.g.timestamp,e.g.state!=t&&(e.h.push(e.g),e.g={timestamp:r,state:t,duration:0})}}function Ds(e,t){var r=0;e.g&&e.g.state==t&&(r+=e.g.duration);for(var n=h(e.h),i=n.next();!i.done;i=n.next())r+=(i=i.value).state==t?i.duration:0;return r}function Ms(){this.h=this.i=null,this.g=[]}function Zs(){this.j=this.C=this.m=this.h=this.o=this.u=this.A=this.l=this.F=NaN,this.g=new Ls,this.i=new Ms}function Vs(t,r){var n=this;Ne.call(this),this.o=wu,this.g=null,this.ub=!1,this.l=new et,this.Uc=this.u=this.Tb=this.i=this.C=this.j=this.rc=this.L=this.ic=this.J=this.wb=this.A=this.M=this.m=this.X=null,this.re=1e9,this.lc=new Set,this.yb=!0,this.wa=null,this.qe=!1,this.oe=0,this.va=null,this.Z=new va,this.h=zs(this),this.mc={width:1/0,height:1/0},this.F=null,this.tb=new wa(this.h.preferredAudioLanguage,this.h.preferredVariantRole,this.h.preferredAudioChannelCount),this.ua=this.h.preferredTextLanguage,this.Xa=this.h.preferredTextRole,this.Wc=[],r&&r(this),this.X=function(e){return new Ye((function(t,r){e.u&&e.u.segmentDownloaded(t,r)}))}(this),this.l.H(e,"online",(function(){n.Id()})),this.P={name:"detach"},this.da={name:"attach"},this.Qa={name:"unload"},this.nd={name:"manifest-parser"},this.md={name:"manifest"},this.vb={name:"media-source"},this.ad={name:"drm-engine"},this.ea={name:"load"},this.od={name:"src-equals-drm-engine"},this.xb={name:"src-equals"};var i=new Map;i.set(this.da,(function(e,t){return De(function(e,t,r){return null==t.D&&(t.D=r.D,e.l.H(t.D,"error",(function(){var t=fu(e);t&&e.Va(t)}))),e.g=t.D,Promise.resolve()}(n,e,t))})),i.set(this.P,(function(e){return e.D&&(n.l.ta(e.D,"error"),e.D=null),n.g=null,De(e=Promise.resolve())})),i.set(this.Qa,(function(e){return De(Ws(n,e))})),i.set(this.vb,(function(t){return t=function(t,r){return p((function n(){var i,a,o,s;return M(n,(function(n){switch(n.s){case 1:return i=e.muxjs?new Bt:new Yt,a=t.h.textDisplayFactory,o=new a,t.fd=a,S(n,(s=new br(r.D,i,o)).C,2);case 2:t.M=s,$(n)}}))}))}(n,t),De(t)})),i.set(this.nd,(function(e,t){var r=function(e,t,r){return p((function n(){var i,a,o,s;return M(n,(function(n){switch(n.s){case 1:if(t.Ia=r.Ia,t.mimeType=r.mimeType,t.uri=r.uri,i=t.uri,a=e.X,e.Tb=i,t.Ia){e.C=t.Ia(),n.I(2);break}return o=e,S(n,Ai.create(i,a,e.h.manifest.retryParameters,t.mimeType),3);case 3:o.C=n.B;case 2:s=Ge(e.h.manifest),r.D&&"AUDIO"===r.D.nodeName&&(s.disableVideo=!0),e.C.configure(s),$(n)}}))}))}(n,e,t);return De(r)})),i.set(this.md,(function(e){return function(e,t){var r=t.uri,n=e.X;e.rc=new io((function(){return e.He()})),function(e,t){e.h=t}(e.rc,(function(t){hu(e,"timelineregionadded",t)}));var i={networkingEngine:n,filterNewPeriod:function(t){return e.Xc(t)},filterAllPeriods:function(t){return Js(e,t)},onTimelineRegionAdded:function(t){var r=e.rc;e:{for(var n=h(r.g),i=n.next();!i.done;i=n.next())if((i=i.value).schemeIdUri==t.schemeIdUri&&i.id==t.id&&i.startTime==t.startTime&&i.endTime==t.endTime){n=i;break e}n=null}null==n&&(r.g.add(t),r.h(t))},onEvent:function(t){return e.dispatchEvent(t)},onError:function(t){return e.Va(t)}};return new Ce(Promise.resolve().then((function(){return p((function t(){var n;return M(t,(function(t){switch(t.s){case 1:return n=e,S(t,e.C.start(r,i),2);case 2:if(n.i=t.B,e.dispatchEvent(new Ze("manifestparsed")),0==e.i.periods.length)throw new H(2,4,4014);!function(e){function t(e){return e.video&&e.audio||e.video&&e.video.codecs.includes(",")}e.some((function(e){return e.variants.some(t)}))&&(K.debug("Found variant with audio and video content, so filtering out audio-only content in all periods."),e.forEach((function(e){e.variants=e.variants.filter(t)})))}(e.i.periods),$(t)}}))}))})),(function(){return K.info("Aborting parser step..."),e.C.stop()}))}(n,e)})),i.set(this.ad,(function(e){return e=function(e,t){return p((function r(){return M(r,(function(r){switch(r.s){case 1:return e.m=Us(e,{Ib:e.X,onError:function(t){e.Va(t)},Dc:function(t){pu(e,t)},onExpirationUpdated:function(t,r){mu(e,t,r)},onEvent:function(t){e.dispatchEvent(t)}}),e.m.configure(e.h.drm),S(r,Et(e.m,Na(e.i.periods),e.i.offlineSessionIds),2);case 2:return S(r,e.m.Ub(t.D),3);case 3:Js(e,e.i.periods),$(r)}}))}))}(n,e),De(e)})),i.set(this.ea,(function(e,t){return De(function(e,t,r){return p((function n(){var i,a,o,s,u,c,l,d,f,p;return M(n,(function(n){switch(n.s){case 1:return t.startTime=r.startTime,i=t.D,a=t.uri,e.Tb=a,e.J=new Wa({wc:function(){return t.D.playbackRate},vc:function(){return t.D.defaultPlaybackRate},Od:function(e){t.D.playbackRate=e},pe:function(e){t.D.currentTime+=e}}),e.F=new Zs,o=function(){return ru(e)},s=function(){return tu(e)},e.l.H(i,"playing",o),e.l.H(i,"pause",o),e.l.H(i,"ended",o),e.l.H(i,"ratechange",s),u=e.h.abrFactory,e.u&&e.Uc==u||(e.Uc=u,e.u=new u,e.u.configure(e.h.abr)),function(e,t){for(var r=0;r<t.length;r++){for(var n=t[r],i=new Map,a=h(n.variants),o=a.next();!o.done;o=a.next())if((o=o.value).video&&o.video.closedCaptions)for(var s=h((o=o.video).closedCaptions.keys()),u=s.next();!u.done;u=s.next())if(u=u.value,!i.has(u)){var c={id:e.re++,originalId:u,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,presentationTimeOffset:0,mimeType:"application/cea-608",codecs:"",kind:"caption",encrypted:!1,keyId:null,language:o.closedCaptions.get(u),label:null,type:"text",primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:o.roles,channelsCount:null,audioSamplingRate:null,closedCaptions:null};i.set(u,c)}for(a=(i=h(i.values())).next();!a.done;a=i.next())n.textStreams.push(a.value)}}(e,e.i.periods),e.tb=new wa(e.h.preferredAudioLanguage,e.h.preferredVariantRole,e.h.preferredAudioChannelCount),e.ua=e.h.preferredTextLanguage,e.Xa=e.h.preferredTextRole,function(e,t,r){0<t&&(e.aa()?K.v("|playRangeStart| has been configured for live content. Ignoring the setting."):e.Le(t)),r<e.ha()&&(e.aa()?K.v("|playRangeEnd| has been configured for live content. Ignoring the setting."):e.Fa(r))}(e.i.presentationTimeline,e.h.playRangeStart,e.h.playRangeEnd),e.u.init((function(t,r,n){r=void 0!==r&&r,n=void 0===n?0:n,K.debug("switch_");e:{for(var i=h(e.i.periods),a=i.next();!a.done;a=i.next())if((a=a.value).variants.includes(t)){i=a;break e}i=null}Ks(e,i,t,!0),e.j&&yo(e.j,t,r,n)&&ou(e)})),e.A=function(e,t){return new eo(e.g,e.i,e.h.streaming,t,(function(){e.wb&&Va(e.wb,!0),e.j&&function(e){function t(t){var i=e.g.T;return t="text"==t?null!=(t=i.g).g&&null!=t.h&&r>=t.g&&r<t.h:Kt(t=Ir(i,t),r,n)}var r=e.g.eb(),n=e.l.smallGapLimit,i=!1,a=Po(e,r);if(ot(e.h.values(),(function(e){return e.oa==a})))for(var o=h(e.h.keys()),s=o.next();!s.done;s=o.next())t(s=s.value)||(vo(e,e.h.get(s)),i=!0);else ot(e.h.keys(),t)||(K.debug("(all): seeked: unbuffered seek: clearing all buffers"),e.h.forEach((function(t){vo(e,t)})),i=!0);i||K.debug("(all): seeked: buffered seek: presentationTime="+r)}(e.j),e.L&&Bs(e)}),(function(t){return e.dispatchEvent(t)}))}(e,t.startTime),e.wb=function(e){var t=new Xa(e.i);!function(e,t){e.h=t}(t,(function(){su(e)}));var r=new ao(e.rc);!function(e,t,r,n){e.g=t,e.h=r,e.i=n}(r,(function(t){hu(e,"timelineregionenter",t)}),(function(t){hu(e,"timelineregionexit",t)}),(function(t,r){r||(hu(e,"timelineregionenter",t),hu(e,"timelineregionexit",t))}));var n=new Za(e.g);return n.g.add(t),n.g.add(r),n}(e),c=Math.max(e.i.minBufferTime,e.h.streaming.rebufferingGoal),Fs(e,c),e.j=function(e){return new co(e.i,{eb:function(){return e.A.l()},getBandwidthEstimate:function(){return e.u.getBandwidthEstimate()},T:e.M,Ib:e.X,ue:e.Vf.bind(e),te:e.Ze.bind(e),onError:e.Va.bind(e),onEvent:function(t){return e.dispatchEvent(t)},Zf:e.$f.bind(e),zd:e.eg.bind(e)})}(e),e.j.configure(e.h.streaming),Nr.$d(e.i,e.h.preferredAudioChannelCount),e.o=Ru,e.dispatchEvent(new Ze("streaming")),S(n,e.j.start(),2);case 2:e.h.streaming.startAtSegmentBoundary&&(l=e.A.l(),d=function(e,t){function r(e,t){if(!e)return null;var r=e.findSegmentPosition(t-a.startTime);return null==r?null:(r=e.getSegmentReference(r))?r.startTime+a.startTime:null}var n=lo(e.j),i=ho(e.j),a=Au(e);return n=r(n,t),i=r(i,t),null!=i&&null!=n?Math.max(i,n):null!=i?i:null!=n?n:t}(e,l),e.A.A(d)),e.i.periods.forEach(e.Xc.bind(e)),su(e),ou(e),f=Au(e)||e.i.periods[0],p=f.variants.some((function(e){return e.primary})),e.h.preferredAudioLanguage||p||K.v("No preferred audio language set. We will choose an arbitrary language initially"),nu(e,f.variants),e.l.ya(i,"loadedmetadata",(function(){e.F.h=Date.now()/1e3-r.Rd})),$(n)}}))}))}(n,e,t))})),i.set(this.od,(function(e,t){var r=function(e,t,r){return p((function n(){var i,a;return M(n,(function(n){switch(n.s){case 1:return i=fe,e.m=Us(e,{Ib:e.X,onError:function(t){e.Va(t)},Dc:function(t){pu(e,t)},onExpirationUpdated:function(t,r){mu(e,t,r)},onEvent:function(t){e.dispatchEvent(t)}}),e.m.configure(e.h.drm),a={id:0,language:"und",primary:!1,audio:null,video:{id:0,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,presentationTimeOffset:0,mimeType:r.mimeType?r.mimeType.split(";")[0]:"video/mp4",codecs:r.mimeType?lt(r.mimeType):"",encrypted:!0,keyId:null,language:"und",label:null,type:i.Za,primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},bandwidth:100,drmInfos:[],allowedByApplication:!0,allowedByKeySystem:!0},S(n,Et(e.m,[a],[]),2);case 2:return S(n,e.m.Ub(t.D),0)}}))}))}(n,e,t);return De(r)})),i.set(this.xb,(function(e,t){return function(e,t,r){function n(){return ru(e)}if(t.uri=r.uri,t.startTime=r.startTime,e.Tb=t.uri,e.F=new Zs,e.A=new qa(t.D),null!=t.startTime&&e.A.A(t.startTime),e.J=new Wa({wc:function(){return t.D.playbackRate},vc:function(){return t.D.defaultPlaybackRate},Od:function(e){t.D.playbackRate=e},pe:function(e){t.D.currentTime+=e}}),Fs(e,e.h.streaming.rebufferingGoal),e.l.H(t.D,"playing",n),e.l.H(t.D,"pause",n),e.l.H(t.D,"ended",n),e.l.H(t.D,"ratechange",(function(){return tu(e)})),"none"!=e.g.preload&&e.l.ya(t.D,"loadedmetadata",(function(){e.F.h=Date.now()/1e3-r.Rd})),e.g.audioTracks&&(e.l.H(e.g.audioTracks,"addtrack",(function(){return su(e)})),e.l.H(e.g.audioTracks,"removetrack",(function(){return su(e)})),e.l.H(e.g.audioTracks,"change",(function(){return su(e)}))),e.g.textTracks){var i=e.g.textTracks;e.l.H(i,"addtrack",(function(){return su(e)})),e.l.H(i,"removetrack",(function(){return su(e)})),e.l.H(i,"change",(function(){return su(e)}))}t.D.src=t.uri,(mt()||vt("Web0S"))&&t.D.load(),e.o=ku,e.dispatchEvent(new Ze("streaming"));var a=new me;Fa(e.g,HTMLMediaElement.HAVE_METADATA,e.l,(function(){a.resolve()}));var o=!1;return e.Wc.push((function(){o=!0})),Fa(e.g,HTMLMediaElement.HAVE_CURRENT_DATA,e.l,(function(){return p((function t(){return M(t,(function(t){switch(t.s){case 1:if(o)return t.return();if(function(e){var t=e.h.preferredAudioLanguage;if(""!=t){e.Jd(t);var r=e.h.preferredVariantRole;""!=r&&e.Jd(t,r)}}(e),js(e).find((function(e){return"disabled"!=e.mode}))){t.I(2);break}return S(t,new Promise((function(t){e.l.ya(e.g.textTracks,"change",t),new Re(t).V(1)})),2);case 2:if(o)return t.return();!function(e){var t=e.h.preferredTextLanguage;if(""!=t){e.Kd(t);var r=e.h.preferredTextRole;""!=r&&e.Kd(t,r)}}(e),$(t)}}))}))})),e.g.error?a.reject(fu(e)):"none"==e.g.preload&&(K.ba('With <video preload="none">, the browser will not load anything until play() is called. We are unable to measure load latency in a meaningful way, and we cannot provide track info yet. Please do not use preload="none" with Shaka Player.'),a.resolve()),e.l.ya(e.g,"error",(function(){a.reject(fu(e))})),new Ce(a,(function(){return a.reject(new H(2,7,7001)),Promise.resolve()}))}(n,e,t)})),this.Ya=new Ts(this.P,{Af:function(e,t,r,i){var a=null;return e==n.P&&(a=r==n.P?n.P:n.da),e==n.da&&(a=r==n.P||t.D!=i.D?n.P:r==n.da?n.da:r==n.vb||r==n.ea?n.vb:r==n.xb?n.od:null),e==n.vb&&(a=r==n.ea&&t.D==i.D?n.nd:n.Qa),e==n.nd&&(a=Su(n.ea,n.md,n.Qa,r,t,i)),e==n.md&&(a=Su(n.ea,n.ad,n.Qa,r,t,i)),e==n.ad&&(a=Su(n.ea,n.ea,n.Qa,r,t,i)),e==n.od&&(a=r==n.xb&&t.D==i.D?n.xb:n.Qa),e!=n.ea&&e!=n.xb||(a=n.Qa),e==n.Qa&&(a=i.D&&t.D==i.D?n.da:n.P),a},ef:function(e,t,r){return n.dispatchEvent(new Ze("onstatechange",{state:e.name})),i.get(e)(t,r)},handleError:function(e,t){return p((function r(){return M(r,(function(r){switch(r.s){case 1:return K.v("The walker saw an error:"),t instanceof H?K.v("Error Code:",t.code):(K.v("Error Message:",t.message),K.v("Error Stack:",t.stack)),S(r,Ws(n,e),2);case 2:return r.return(e.D?n.da:n.P)}}))}))},Xf:function(e){n.dispatchEvent(new Ze("onstateidle",{state:e.name}))}}),t&&this.Ub(t,!0)}_(as,zo),as.prototype.updateManifestExpiration=function(e,t){var r=Ko(this.h,this.g),n=r.store(),i=new me;return n.get(e).onsuccess=function(r){(r=r.target.result)?(r.expiration=t,n.put(r),i.resolve()):i.reject(new H(2,9,9012,"Could not find values for "+e))},r.promise().then((function(){return i}))},as.prototype.pc=function(e){return{originalManifestUri:e.originalManifestUri,duration:e.duration,size:e.size,expiration:null==e.expiration?1/0:e.expiration,periods:e.periods.map(os),sessionIds:e.sessionIds,drmInfo:e.drmInfo,appMetadata:e.appMetadata}},as.prototype.ae=function(e){return{data:e.data}},_(ls,zo),ls.prototype.hasFixedKeySpace=function(){return this.j},ls.prototype.addSegments=function(e){return this.j?Jo(this.i):this.add(this.i,e)},ls.prototype.addManifests=function(e){return this.j?Jo(this.g):this.add(this.g,e)},ls.prototype.pc=function(e){return null==e.expiration&&(e.expiration=1/0),e},(n=ds.prototype).init=function(){var t=this,r=new me,n=e.indexedDB.open("shaka_offline_db",4);return n.onsuccess=function(e){e=e.target.result,t.j=e;var n=e.objectStoreNames;n.contains("manifest")&&n.contains("segment")?(K.debug("Mounting v1 idb storage cell"),n=new as(e,"segment","manifest")):n=null,t.g=n,(n=e.objectStoreNames).contains("manifest-v2")&&n.contains("segment-v2")?(K.debug("Mounting v2 idb storage cell"),n=new ls(e,"segment-v2","manifest-v2",!0)):n=null,t.h=n,(n=e.objectStoreNames).contains("manifest-v3")&&n.contains("segment-v3")?(K.debug("Mounting v3 idb storage cell"),n=new ls(e,"segment-v3","manifest-v3",!1)):n=null,t.i=n,e.objectStoreNames.contains("session-ids")?(K.debug("Mounting session ID idb storage cell"),e=new es(e)):e=null,t.l=e,r.resolve()},n.onupgradeneeded=function(e){e=e.target.result;for(var t=h(["segment-v3","manifest-v3","session-ids"]),r=t.next();!r.done;r=t.next())r=r.value,e.objectStoreNames.contains(r)||e.createObjectStore(r,{autoIncrement:!0})},n.onerror=function(e){r.reject(new H(2,9,9001,n.error)),e.preventDefault()},r},n.destroy=function(){var e=this;return p((function t(){return M(t,(function(t){switch(t.s){case 1:if(!e.g){t.I(2);break}return S(t,e.g.destroy(),2);case 2:if(!e.h){t.I(4);break}return S(t,e.h.destroy(),4);case 4:if(!e.i){t.I(6);break}return S(t,e.i.destroy(),6);case 6:if(!e.l){t.I(8);break}return S(t,e.l.destroy(),8);case 8:e.j&&e.j.close(),$(t)}}))}))},n.getCells=function(){var e=new Map;return this.g&&e.set("v1",this.g),this.h&&e.set("v2",this.h),this.i&&e.set("v3",this.i),e},n.getEmeSessionCell=function(){return this.l},n.erase=function(){var t=this;return p((function r(){return M(r,(function(r){switch(r.s){case 1:if(!t.g){r.I(2);break}return S(r,t.g.destroy(),2);case 2:if(!t.h){r.I(4);break}return S(r,t.h.destroy(),4);case 4:if(!t.i){r.I(6);break}return S(r,t.i.destroy(),6);case 6:return t.j&&t.j.close(),S(r,function(){var t=new me,r=e.indexedDB.deleteDatabase("shaka_offline_db");return r.onblocked=function(){K.v("Deleting","shaka_offline_db","is being blocked")},r.onsuccess=function(){t.resolve()},r.onerror=function(e){t.reject(new H(2,9,9001,r.error)),e.preventDefault()},t}(),8);case 8:return t.j=null,t.g=null,t.h=null,t.i=null,S(r,t.init(),0)}}))}))},ns("idb",(function(){return vt("CrKey")||!e.indexedDB?null:new ds})),hs.prototype.Ea=function(){return this.l},hs.prototype.ja=function(){return this.j},hs.prototype.key=function(){return this.i},hs.prototype.toString=function(){return this.h},(n=vs.prototype).configure=function(){},n.start=function(e){var t=this;return p((function r(){var n,i,a,o,s;return M(r,(function(r){switch(r.s){case 1:return n=fs(e),t.g=n,null==n||"manifest"!=n.g?r.return(Promise.reject(new H(2,1,9004,n))):(i=new ts,w(r,2),S(r,i.init(),4));case 4:return S(r,rs(i,n.Ea(),n.ja()),5);case 5:return S(r,r.B.getManifests([n.key()]),6);case 6:return a=r.B,o=a[0],s=new ps(n.Ea(),n.ja()),r.return(function(e,t){var r=new Ti(null,0);r.Fa(t.duration);var n=t.periods.map((function(t){return ms(e,t,r)})),i=t.drmInfo?[t.drmInfo]:[];return t.drmInfo&&n.forEach((function(e){e.variants.forEach((function(e){e.drmInfos=i}))})),{presentationTimeline:r,minBufferTime:2,offlineSessionIds:t.sessionIds,periods:n}}(s,o));case 2:return P(r),S(r,i.destroy(),7);case 7:C(r,0)}}))}))},n.stop=function(){return Promise.resolve()},n.update=function(){},n.onExpirationUpdated=function(e,t){var r=this;return p((function n(){var i,a,o,s,u,c,l,d;return M(n,(function(n){switch(n.s){case 1:return i=r.g,a=new ts,I(n,2,3),S(n,a.init(),5);case 5:return S(n,rs(a,i.Ea(),i.ja()),6);case 6:return S(n,(o=n.B).getManifests([i.key()]),7);case 7:if(s=n.B,u=s[0],c=u.sessionIds.includes(e),l=null==u.expiration||u.expiration>t,!c||!l){n.I(3);break}return K.debug("Updating expiration for stored content"),S(n,o.updateManifestExpiration(i.key(),t),3);case 3:return P(n),S(n,a.destroy(),10);case 10:C(n,0);break;case 2:d=k(n),K.error("There was an error updating",i,d),n.I(3)}}))}))},Ai.Qb("application/x-offline-manifest",vs),W("shaka.offline.OfflineScheme",bs),bs.m=function(e){return Oe(e={uri:e,Bd:e,data:new ArrayBuffer(0),headers:{"content-type":"application/x-offline-manifest"}})},bs.o=function(e,t){var r=new ts;return Oe(void 0).ca((function(){return r.init()})).ca((function(){return rs(r,t.Ea(),t.ja())})).ca((function(e){return e.getSegments([t.key()])})).ca((function(e){return{uri:t,Bd:t,data:e[0].data,headers:{}}})).finally((function(){return r.destroy()}))},Ke("offline",bs),Ts.prototype.destroy=function(){var e=this;return p((function t(){return M(t,(function(t){switch(t.s){case 1:return e.u=!1,e.h&&e.h.abort(),Ss(e),S(t,e.A,2);case 2:e.g&&e.g.Da.kb();for(var r=h(e.l),n=r.next();!n.done;n=r.next())n.value.Da.kb();e.g=null,e.l=[],e.m=null,$(t)}}))}))},W("shaka.text.SimpleTextDisplayer",$s),$s.prototype.remove=function(e,t){return!!this.g&&(ws(this.g,(function(r){return r.startTime<t&&r.endTime>e})),!0)},$s.prototype.remove=$s.prototype.remove,$s.prototype.append=function(e){var t=Is,r=e.map((function(e){if(e.nestedCues.length){var t=e.nestedCues.map((function(e){return e.spacer?"\n":e.payload+" "})).join("").replace(/ $/m,"");(e=e.clone()).nestedCues=[],e.payload=t}return e})),n=[];e=this.g.cues?Array.from(this.g.cues):[];for(var i={},a=(r=h(r)).next();!a.done;i={Fb:i.Fb},a=r.next())i.Fb=a.value,e.some(function(e){return function(t){return t.startTime==e.Fb.startTime&&t.endTime==e.Fb.endTime&&t.text==e.Fb.payload}}(i))||(a=t(i.Fb))&&n.push(a);n.slice().sort((function(e,t){return e.startTime!=t.startTime?e.startTime-t.startTime:e.endTime!=t.endTime?e.endTime-t.startTime:"line"in VTTCue.prototype?n.indexOf(t)-n.indexOf(e):n.indexOf(e)-n.indexOf(t)})).forEach(function(e){this.g.addCue(e)}.bind(this))},$s.prototype.append=$s.prototype.append,$s.prototype.destroy=function(){return this.g&&ws(this.g,(function(){return!0})),this.g=null,Promise.resolve()},$s.prototype.destroy=$s.prototype.destroy,$s.prototype.isTextVisible=function(){return"showing"==this.g.mode},$s.prototype.isTextVisible=$s.prototype.isTextVisible,$s.prototype.setTextVisibility=function(e){this.g.mode=e?"showing":"hidden"},$s.prototype.setTextVisibility=$s.prototype.setTextVisibility,W("shaka.util.ConfigUtils.mergeConfigObjects",Rs),W("shaka.util.ConfigUtils.convertToConfigObject",ks),W("shaka.util.PlayerConfiguration",Ps),Ps.mergeConfigObjects=xs,U(Vs,Ne),W("shaka.Player",Vs),Vs.prototype.destroy=function(){var e=this;return p((function t(){var r;return M(t,(function(t){switch(t.s){case 1:return e.o==Iu?t.return():(e.o=Iu,r=Es(e.Ya,(function(){return{node:e.P,payload:{Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null},gb:!1}})),S(t,new Promise((function(t){r.Kb=function(){K.info("Preparing to destroy walker...")},r.Cc=function(){t(),e.dispatchEvent(new Ze("loaded"))},r.kb=function(){t()},r.onError=function(){t()},r.Ec=function(){t()}})),2));case 2:return S(t,e.Ya.destroy(),3);case 3:if(e.l&&(e.l.release(),e.l=null),e.Uc=null,e.u=null,e.h=null,!e.X){t.I(0);break}return S(t,e.X.destroy(),5);case 5:e.X=null,$(t)}}))}))},Vs.prototype.destroy=Vs.prototype.destroy,Vs.version="v2.5.23";var Ns=["2","5"];Yr=new function(e){this.g=e,this.i=Fr,this.h=Br}(new Wr(Number(Ns[0]),Number(Ns[1])));var Gs=["output-restricted","internal-error"],Xs={};function Ws(e,t){return p((function r(){var n;return M(r,(function(r){switch(r.s){case 1:return e.o!=Iu&&(e.o=wu),n=e.Wc.map((function(e){return e()})),e.Wc=[],S(r,Promise.all(n),2);case 2:if(e.dispatchEvent(new Ze("unloading")),t.Ia=null,t.mimeType=null,t.startTime=null,t.uri=null,t.D&&(e.l.ta(t.D,"loadedmetadata"),e.l.ta(t.D,"playing"),e.l.ta(t.D,"pause"),e.l.ta(t.D,"ended"),e.l.ta(t.D,"ratechange")),e.wb&&(e.wb.release(),e.wb=null),e.ic&&(e.ic.stop(),e.ic=null),!e.C){r.I(3);break}return S(r,e.C.stop(),4);case 4:e.C=null;case 3:if(!e.u){r.I(5);break}return S(r,e.u.stop(),5);case 5:if(!e.j){r.I(7);break}return S(r,e.j.destroy(),8);case 8:e.j=null;case 7:if(e.J&&(e.J.release(),e.J=null),e.A&&(e.A.release(),e.A=null),!e.M){r.I(9);break}return S(r,e.M.destroy(),10);case 10:e.M=null;case 9:if(!t.D||!t.D.src){r.I(11);break}return S(r,new Promise((function(e){return new Re(e).V(.1)})),12);case 12:t.D.removeAttribute("src"),t.D.load();case 11:if(!e.m){r.I(13);break}return S(r,e.m.destroy(),14);case 14:e.m=null;case 13:e.Z.g.clear(),e.Tb=null,e.L=null,e.lc.clear(),e.i=null,e.F=null,e.fd=null,e.yb=!0,eu(e),$(r)}}))}))}function Us(e,t){return new Tt(t,e.h.drm.updateExpirationTime)}function Fs(e,t){e.L=new Ra,e.L.g=Pa,ka(e.L,t,Math.min(.5,t/2)),eu(e),e.ic=new Re((function(){Bs(e)})).Oa(.25)}function Bs(e){switch(e.o){case ku:var t=!!e.g.ended||jt(e.g.buffered)>=e.g.duration-1;break;case Ru:e:if(e.g.ended||Er(e.M))t=!0;else{if(e.i.presentationTimeline.aa()){var r=e.i.presentationTimeline.Db();if(jt(e.g.buffered)>=r){t=!0;break e}}t=!1}break;default:t=!1}var n=Ht(e.g.buffered,e.g.currentTime),i=t,a=(r=e.L).h.get(r.g);t=r.g,n=i||n>=a?Ca:Pa,r.g=n,t!=n&&eu(e)}function Ys(e){if(e.C){var t=Ge(e.h.manifest);e.g&&"AUDIO"===e.g.nodeName&&(t.disableVideo=!0),e.C.configure(t)}if(e.m&&e.m.configure(e.h.drm),e.j){e.j.configure(e.h.streaming);try{e.i.periods.forEach(e.Xc.bind(e))}catch(t){e.Va(t)}var r=lo(e.j),n=ho(e.j);t=Au(e),r=Nr.ie(r,n,t.variants),e.u&&r&&r.allowedByApplication&&r.allowedByKeySystem?nu(e,t.variants):(K.debug("Choosing new streams after changing configuration"),iu(e,t))}if(e.M&&(t=e.h.textDisplayFactory,e.fd!=t)){r=new t;var i=(n=e.M).l;n.l=r,i&&(r.setTextVisibility(i.isTextVisible()),i.destroy()),n.g&&(n.g.i=r),e.fd=t,e.j&&((r=(t=e.j).h.get("text"))&&go(t,r.stream,!0,0,!0))}e.u&&(e.u.configure(e.h.abr),e.h.abr.enabled&&!e.yb?e.u.enable():e.u.disable(),du(e)),e.L&&(t=e.h.streaming.rebufferingGoal,e.i&&(t=Math.max(t,e.i.minBufferTime)),ka(e.L,t,Math.min(.5,t/2)))}function js(e){return Array.from(e.g.textTracks).filter((function(e){return"metadata"!=e.kind&&"chapters"!=e.kind&&"Shaka Player TextTrack"!=e.label}))}function Ks(e,t,r,n){_a(e.Z,t).variant=r,(e=e.F.i).i!=r&&(e.i=r,e.g.push({timestamp:Date.now()/1e3,id:r.id,type:"variant",fromAdaptation:n,bandwidth:r.bandwidth}))}function Hs(e,t,r,n){ba(e.Z,t,r),(e=e.F.i).h!=r&&(e.h=r,e.g.push({timestamp:Date.now()/1e3,id:r.id,type:"text",fromAdaptation:n,bandwidth:null}))}function zs(e){var t=Cs();return t.streaming.failureCallback=function(t){e.aa()&&[1001,1002,1003].includes(t.code)&&(t.severity=1,K.v("Live streaming error. Retrying automatically..."),e.Id())},t.textDisplayFactory=function(){return new $s(e.g)},t}function Js(e,t){var r=e.j?lo(e.j):null,n=e.j?ho(e.j):null;if(t.forEach(Nr.filterNewPeriod.bind(null,e.m,r,n)),r=function(e,t){var r=0;return e.forEach((function(e){r+=t(e)?1:0})),r}(t,(function(e){return e.variants.some(Nr.Gb)})),0==r)throw new H(2,4,4032);if(r<t.length)throw new H(2,4,4011);t.forEach(function(e){Nr.Xd(e.variants,this.h.restrictions,this.mc)&&this.j&&Au(this)==e&&su(this),yu(this,e.variants)}.bind(e))}function Qs(e,t,r,n){return r=void 0!==r&&r,n=void 0===n?0:n,e.yb?(e.wa=t,e.qe=r,e.oe=n,!0):((t=yo(e.j,t,r,n))&&uu(e),t)}function qs(e,t){if(e.yb)return e.va=t,!0;var r=go(e.j,t,!0,0,!1);return r&&cu(e),r}function eu(e){var t=e.jd();if(e.F&&e.L&&e.A){var r=e.J;r.j=t,Ua(r),ru(e)}e.dispatchEvent(new Ze("buffering",{buffering:t}))}function tu(e){var t=e.g.playbackRate;0!=t&&e.J.set(t)}function ru(e){if(e.F&&e.L){var t=e.F.g;e.L.g==Pa?Os(t,"buffering"):e.g.paused?Os(t,"paused"):e.g.ended?Os(t,"ended"):Os(t,"playing")}}function nu(e,t){try{yu(e,t)}catch(t){return e.Va(t),null}var r=t.filter((function(e){return Nr.Gb(e)}));return r=e.tb.create(r),e.u.setVariants(Array.from(r.values())),e.u.chooseVariant()}function iu(e,t){var r=au(e,t,!1),n=Nr.Wb(t.textStreams,e.ua,e.Xa)[0]||null,i=!1;n&&(e.h.streaming.alwaysStreamText||e.zc())&&(Hs(e,t,n,!0),i=qs(e,n)),(r||i)&&ou(e)}function au(e,t,r){r=void 0===r||r;var n=nu(e,t.variants),i=!1;return n&&(Ks(e,t,n,!0),i=Qs(e,n,!0)),r&&i&&ou(e),i}function ou(e){gu(e,new Ze("adaptation"))}function su(e){gu(e,new Ze("trackschanged"))}function uu(e){gu(e,new Ze("variantchanged"))}function cu(e){gu(e,new Ze("textchanged"))}function lu(e){gu(e,new Ze("texttrackvisibility"))}function du(e){gu(e,new Ze("abrstatuschanged",{Zg:e.h.abr.enabled}))}function hu(e,t,r){e.dispatchEvent(new Ze(t,{detail:{schemeIdUri:r.schemeIdUri,value:r.value,startTime:r.startTime,endTime:r.endTime,id:r.id,eventElement:r.eventElement}}))}function fu(e){if(!e.g.error)return null;var t=e.g.error.code;if(1==t)return null;var r=e.g.error.msExtendedCode;return r&&(0>r&&(r+=Math.pow(2,32)),r=r.toString(16)),new H(2,3,3016,t,r,e.g.error.message)}function pu(e,t){if(e.j){var r=Au(e),n=!1,i=Object.keys(t);0==i.length&&K.v("Got a key status event without any key statuses, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");var a=1==i.length&&"00"==i[0];a&&K.v("Got a synthetic key status event, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks."),i.length&&e.i.periods.forEach((function(e){e.variants.forEach((function(e){Nr.Kf(e).forEach((function(r){var i=e.allowedByKeySystem;r.keyId&&(r=t[a?"00":r.keyId],e.allowedByKeySystem=!!r&&!Gs.includes(r)),i!=e.allowedByKeySystem&&(n=!0)}))}))})),i=lo(e.j);var o=ho(e.j);(i=Nr.ie(i,o,r.variants))&&!i.allowedByKeySystem&&(K.debug("Choosing new variants after key status changed"),au(e,r)),n&&(su(e),nu(e,r.variants))}}function mu(e,t,r){e.C&&e.C.onExpirationUpdated&&e.C.onExpirationUpdated(t,r),e.dispatchEvent(new Ze("expirationupdated"))}function yu(e,t){var r=e.m?ut(e.m.da):{},n=Object.keys(r);n=n.length&&"00"==n[0];for(var i=!1,a=!1,o=[],s=[],u=h(t),c=u.next();!c.done;c=u.next()){var l=[];(c=c.value).audio&&l.push(c.audio),c.video&&l.push(c.video);for(var d=(l=h(l)).next();!d.done;d=l.next())if((d=d.value).keyId){var f=r[n?"00":d.keyId];f?Gs.includes(f)&&(s.includes(f)||s.push(f)):o.includes(d.keyId)||o.push(d.keyId)}c.allowedByApplication?c.allowedByKeySystem&&(i=!0):a=!0}if(!i)throw new H(2,4,4012,{hasAppRestrictions:a,missingKeys:o,restrictedKeyStatuses:s})}function gu(e,t){p((function r(){return M(r,(function(r){switch(r.s){case 1:return S(r,Promise.resolve(),2);case 2:e.o!=Iu&&e.dispatchEvent(t),$(r)}}))}))}function vu(e){for(var t=new Set,r=(e=h(e)).next();!r.done;r=e.next())(r=r.value).language?t.add(Dr(r.language)):t.add("und");return t}function bu(e){for(var t=new Map,r=(e=h(e)).next();!r.done;r=e.next()){var n=r.value;r="und";var i=[];for(n.language&&(r=Dr(n.language)),(i="variant"==n.type?n.audioRoles:n.roles)&&i.length||(i=[""]),t.has(r)||t.set(r,new Set),i=(n=h(i)).next();!i.done;i=n.next())i=i.value,t.get(r).add(i)}var a=[];return t.forEach((function(e,t){for(var r=h(e),n=r.next();!n.done;n=r.next())a.push({language:t,role:n.value})})),a}function _u(e){return null==(e=Au(e))?[]:e.variants.filter((function(e){return Nr.Gb(e)}))}function Au(e){for(var t=e.A.l(),r=null,n=(e=h(e.i.periods)).next();!n.done;n=e.next())(n=n.value).startTime<=t&&(r=n);return r}function Tu(e){var t=Au(e);return _a(e.Z,t).variant}function Eu(){return new H(2,7,7e3)}function Su(e,t,r,n,i,a){return n==e&&i.D==a.D&&i.uri==a.uri&&i.mimeType==a.mimeType&&i.Ia==a.Ia?t:r}function $u(e){return new Promise((function(t,r){e.kb=function(){return r(Eu())},e.Cc=function(){return t()},e.onError=function(e){return r(e)},e.Ec=function(){return r(Eu())}}))}Vs.registerSupportPlugin=function(e,t){Xs[e]=t},Vs.isBrowserSupported=function(){if(!(e.Promise&&e.Uint8Array&&Array.prototype.forEach))return!1;var t=gt();return!(t&&12>t||!(e.MediaKeys&&e.navigator&&e.navigator.requestMediaKeySystemAccess&&e.MediaKeySystemAccess&&e.MediaKeySystemAccess.prototype.getConfiguration))&&(!!ft()||pt("application/x-mpegurl"))},Vs.probeSupport=function(){return Mt().then((function(e){for(var t=Ai.ng(),r={},n=h('video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",video/mp4; codecs="av01.0.01M.08",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="opus",audio/mp4; codecs="flac",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="vp09.00.10.08",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",")),i=n.next();!i.done;i=n.next()){r[i=i.value]=ft()?!!yr(i)||(MediaSource.isTypeSupported(i)||$e(i)):pt(i);var a=i.split(";")[0];r[a]=r[a]||r[i]}for(var o in e={manifest:t,media:r,drm:e},Xs)e[o]=Xs[o]();return e}))},Vs.prototype.Ub=function(e,t){if(t=void 0===t||t,this.o==Iu)return Promise.reject(Eu());var r={Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null};r.D=e,ft()||(t=!1);var n=t?this.vb:this.da,i=Es(this.Ya,(function(){return{node:n,payload:r,gb:!1}}));return i.Kb=function(){return K.info("Starting attach...")},$u(i)},Vs.prototype.attach=Vs.prototype.Ub,Vs.prototype.detach=function(){var e=this;if(this.o==Iu)return Promise.reject(Eu());var t=Es(this.Ya,(function(){return{node:e.P,payload:{Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null},gb:!1}}));return t.Kb=function(){return K.info("Starting detach...")},$u(t)},Vs.prototype.detach=Vs.prototype.detach,Vs.prototype.Ud=function(e){var t=this;if(e=void 0===e||e,this.o==Iu)return Promise.reject(Eu());ft()||(e=!1);var r={Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null},n=Es(this.Ya,(function(n){var i=n.D&&e?t.vb:n.D?t.da:t.P;return r.D=n.D,{node:i,payload:r,gb:!1}}));return n.Kb=function(){return K.info("Starting unload...")},$u(n)},Vs.prototype.unload=Vs.prototype.Ud,Vs.prototype.load=function(e,t,r){if(this.o==Iu)return Promise.reject(Eu());this.dispatchEvent(new Ze("loading"));var n={Ia:null,D:null,mimeType:null,startTime:null,Rd:null,uri:null};n.uri=e,n.Rd=Date.now()/1e3,r&&"string"!=typeof r&&(Ur("Loading with a manifest parser factory","Please register a manifest parser and for the mime-type."),n.Ia=function(){return new r}),r&&"string"==typeof r&&(n.mimeType=r),void 0!==t&&(n.startTime=t);var i=function(e,t){if(t.Ia)return!1;if(!ft())return!0;var r=t.mimeType,n=t.uri||"";return r||(r={mp4:"video/mp4",m4v:"video/mp4",m4a:"audio/mp4",webm:"video/webm",weba:"audio/webm",mkv:"video/webm",ts:"video/mp2t",ogv:"video/ogg",ogg:"audio/ogg",mpg:"video/mpeg",mpeg:"video/mpeg",m3u8:"application/x-mpegurl",mp3:"audio/mpeg",aac:"audio/aac",flac:"audio/flac",wav:"audio/wav"}[Ai.getExtension(n)]),!!r&&(""!=(t.D||bt()).canPlayType(r)&&(!Ai.isSupported(n,r)||yt()&&e.h.streaming.useNativeHlsOnSafari))}(this,n)?this.xb:this.ea,a=Es(this.Ya,(function(e){return null==e.D?null:(n.D=e.D,{node:i,payload:n,gb:!0})}));return a.Kb=function(){return K.info("Starting load of "+e+"...")},new Promise((function(e,t){a.Ec=function(){return t(new H(2,7,7002))},a.Cc=function(){return e()},a.kb=function(){return t(Eu())},a.onError=function(e){return t(e)}}))},Vs.prototype.load=Vs.prototype.load,Vs.prototype.configure=function(e,t){2==arguments.length&&"string"==typeof e&&(e=ks(e,t));var r=xs(this.h,e,zs(this));return Ys(this),r},Vs.prototype.configure=Vs.prototype.configure,Vs.prototype.getConfiguration=function(){var e=zs(this);return xs(e,this.h,zs(this)),e},Vs.prototype.getConfiguration=Vs.prototype.getConfiguration,Vs.prototype.vg=function(){for(var e in this.h)delete this.h[e];xs(this.h,zs(this),zs(this)),Ys(this)},Vs.prototype.resetConfiguration=Vs.prototype.vg,Vs.prototype.tf=function(){return this.o},Vs.prototype.getLoadMode=Vs.prototype.tf,Vs.prototype.yf=function(){return this.g},Vs.prototype.getMediaElement=Vs.prototype.yf,Vs.prototype.Yb=function(){return this.X},Vs.prototype.getNetworkingEngine=Vs.prototype.Yb,Vs.prototype.tc=function(){return this.Tb},Vs.prototype.getAssetUri=Vs.prototype.tc,Vs.prototype.wf=function(){return Ur("getManifestUri",'Please use "getAssetUri" instead.'),this.tc()},Vs.prototype.getManifestUri=Vs.prototype.wf,Vs.prototype.aa=function(){return this.i?this.i.presentationTimeline.aa():!(!this.g||!this.g.src)&&1/0==this.g.duration},Vs.prototype.isLive=Vs.prototype.aa,Vs.prototype.ib=function(){return!!this.i&&this.i.presentationTimeline.ib()},Vs.prototype.isInProgress=Vs.prototype.ib,Vs.prototype.Qf=function(){if(this.i){if(!this.i.periods.length)return!1;var e=this.i.periods[0].variants;return!!e.length&&!e[0].video}return!(!this.g||!this.g.src)&&(this.g.videoTracks?0==this.g.videoTracks.length:0==this.g.videoHeight)},Vs.prototype.isAudioOnly=Vs.prototype.Qf,Vs.prototype.He=function(){if(this.i){var e=this.i.presentationTimeline;return{start:e.Cb(),end:e.Ka()}}return this.g&&this.g.src&&(e=this.g.seekable).length?{start:e.start(0),end:e.end(e.length-1)}:{start:0,end:0}},Vs.prototype.seekRange=Vs.prototype.He,Vs.prototype.keySystem=function(){return Rt(this.drmInfo())},Vs.prototype.keySystem=Vs.prototype.keySystem,Vs.prototype.drmInfo=function(){return this.m?this.m.g:null},Vs.prototype.drmInfo=Vs.prototype.drmInfo,Vs.prototype.Xb=function(){return this.m?this.m.Xb():1/0},Vs.prototype.getExpiration=Vs.prototype.Xb,Vs.prototype.jd=function(){return!!this.L&&this.L.g==Pa},Vs.prototype.isBuffering=Vs.prototype.jd,Vs.prototype.Cf=function(){if(this.J){var e=this.J;e=e.j?0:e.i}else e=0;return e},Vs.prototype.getPlaybackRate=Vs.prototype.Cf,Vs.prototype.Mg=function(e){0==e?K.ba("A trick play rate of 0 is unsupported!"):(this.g.paused&&this.g.play(),this.J&&this.J.set(e),this.o==Ru&&mo(this.j,1<Math.abs(e)))},Vs.prototype.trickPlay=Vs.prototype.Mg,Vs.prototype.$e=function(){var e=this.J.vc();this.o==ku&&this.J.set(e),this.o==Ru&&(this.J.set(e),mo(this.j,!1))},Vs.prototype.cancelTrickPlay=Vs.prototype.$e,Vs.prototype.ed=function(){if(this.i&&this.A){for(var e=Tu(this),t=[],r=h(_u(this)),n=r.next();!n.done;n=r.next()){n=n.value;var i=Nr.Oc(n);i.active=n==e,t.push(i)}return t}return this.g&&this.g.audioTracks?Array.from(this.g.audioTracks).map((function(e){return Nr.je(e)})):[]},Vs.prototype.getVariantTracks=Vs.prototype.ed,Vs.prototype.Eb=function(){if(this.i&&this.A){for(var e=function(e){var t=Au(e);if(null==t)return null;if(!_a(e.Z,t).text){var r=Nr.Wb(t.textStreams,e.ua,e.Xa);r.length&&ba(e.Z,t,r[0])}return _a(e.Z,t).text}(this),t=[],r=h(function(e){var t=Au(e);return null==t?[]:t.textStreams.filter((function(t){return!e.lc.has(t)}))}(this)),n=r.next();!n.done;n=r.next()){n=n.value;var i=Nr.Kc(n);i.active=n==e,t.push(i)}return t}return this.g&&this.g.src&&this.g.textTracks?js(this).map((function(e){return Nr.Of(e)})):[]},Vs.prototype.getTextTracks=Vs.prototype.Eb,Vs.prototype.Ld=function(e){if(this.i&&this.j){var t=Au(this),r=t.textStreams.find((function(t){return t.id==e.id}));r?(Hs(this,t,r,!1),qs(this,r),this.ua=r.language):K.error("No stream with id",e.id)}else if(this.g&&this.g.src&&this.g.textTracks){for(r=(t=h(t=js(this))).next();!r.done;r=t.next())r=r.value,Nr.gd(r)==e.id?r.mode=this.ub?"showing":"hidden":r.mode="disabled";cu(this)}},Vs.prototype.selectTextTrack=Vs.prototype.Ld,Vs.prototype.xg=function(){Ur("selectEmbeddedTextTrack","If closed captions are signaled in the manifest, a text stream will be created to represent them. Please use SelectTextTrack.");var e=this.Eb().filter((function(e){return"application/cea-608"==e.mimeType}));0<e.length?this.Ld(e[0]):K.v("Unable to find the text track embedded in the video.")},Vs.prototype.selectEmbeddedTextTrack=Vs.prototype.xg,Vs.prototype.Rg=function(){Ur("usingEmbeddedTextTrack","If closed captions are signaled in the manifest, a text stream will be created to represent them. There should be no reason to know if the player is playing embedded text.");var e=this.Eb().filter((function(e){return e.active}))[0];return!!e&&"application/cea-608"==e.mimeType},Vs.prototype.usingEmbeddedTextTrack=Vs.prototype.Rg,Vs.prototype.Ie=function(e,t,r){if(r=void 0===r?0:r,this.i&&this.j){var n=Au(this);this.h.abr.enabled&&K.ba("Changing tracks while abr manager is enabled will likely result in the selected track being overriden. Consider disabling abr before calling selectVariantTrack().");var i=n.variants.find((function(t){return t.id==e.id}));i?Nr.Gb(i)?(Ks(this,n,i,!1),Qs(this,i,t,r),this.tb=new Ia(i),nu(this,n.variants)):K.error("Unable to switch to restricted track",e.id):K.error("No variant with id",e.id)}else if(this.g&&this.g.audioTracks){for(r=(t=h(t=Array.from(this.g.audioTracks))).next();!r.done;r=t.next())r=r.value,Nr.gd(r)==e.id&&(r.enabled=!0);uu(this)}},Vs.prototype.selectVariantTrack=Vs.prototype.Ie,Vs.prototype.nf=function(){return bu(this.ed())},Vs.prototype.getAudioLanguagesAndRoles=Vs.prototype.nf,Vs.prototype.Jf=function(){return bu(this.Eb())},Vs.prototype.getTextLanguagesAndRoles=Vs.prototype.Jf,Vs.prototype.mf=function(){return Array.from(vu(this.ed()))},Vs.prototype.getAudioLanguages=Vs.prototype.mf,Vs.prototype.If=function(){return Array.from(vu(this.Eb()))},Vs.prototype.getTextLanguages=Vs.prototype.If,Vs.prototype.Jd=function(e,t){if(this.i&&this.A){var r=Au(this);if(this.tb=new wa(e,t||"",0,""),!this.h.abr.enabled){var n=function(e,t){return e.video||t.video?e.video&&t.video?Math.abs((e.video.height||0)-(t.video.height||0))+Math.abs((e.video.width||0)-(t.video.width||0)):1/0:0},i=Au(this)||this.i.periods[0],a=_a(this.Z,i).variant,o=this.tb.create(i.variants);i=null;for(var s=(o=h(o.values())).next();!s.done;s=o.next())s=s.value,(!i||n(i,a)>n(s,a))&&(i=s);if(i)return r=Nr.Oc(i),void this.Ie(r,!0)}au(this,r)}else if(this.g&&this.g.audioTracks){for(i=Array.from(this.g.audioTracks),r=Dr(e),a=n=null,o=(i=h(i)).next();!o.done;o=i.next())o=o.value,Dr((s=Nr.je(o)).language)==r&&(n=o,t?s.roles.includes(t)&&(a=o):0==s.roles.length&&(a=o));a?(a.enabled=!0,uu(this)):n&&(n.enabled=!0,uu(this))}},Vs.prototype.selectAudioLanguage=Vs.prototype.Jd,Vs.prototype.Kd=function(e,t){if(this.i&&this.A){var r=Au(this);this.ua=e,this.Xa=t||"";var n=Nr.Wb(r.textStreams,this.ua,this.Xa)[0]||null;n&&(Hs(this,r,n,!1),(this.h.streaming.alwaysStreamText||this.zc())&&qs(this,n))}else{var i=Dr(e);(r=this.Eb().filter((function(e){return Dr(e.language)==i&&(!t||e.roles.includes(t))}))[0])&&this.Ld(r)}},Vs.prototype.selectTextLanguage=Vs.prototype.Kd,Vs.prototype.yg=function(e){if(this.i&&this.A){for(var t=Au(this),r=null,n=h(_u(this)),i=n.next();!i.done;i=n.next())if((i=i.value).audio.label==e){r=i;break}null==r?K.v("No variants were found with label: "+e+". Ignoring the request to switch."):(this.tb=new wa(r.language,"",0,e),au(this,t))}},Vs.prototype.selectVariantsByLabel=Vs.prototype.yg,Vs.prototype.zc=function(){var e=this.ub;return this.M?this.M.l.isTextVisible():this.g&&this.g.src&&this.g.textTracks?js(this).some((function(e){return"showing"==e.mode})):e},Vs.prototype.isTextTrackVisible=Vs.prototype.zc,Vs.prototype.Bg=function(e){var t=this;return p((function r(){var n,i,a,o;return M(r,(function(r){switch(r.s){case 1:if(t.ub==(n=!!e))return r.return();if(t.ub=n,t.o!=Ru){if(t.g&&t.g.src&&t.g.textTracks)for(var s=h(js(t)),u=s.next();!u.done;u=s.next())"disabled"!=(i=u.value).mode&&(i.mode=n?"showing":"hidden");r.I(2);break}if(t.M.l.setTextVisibility(n),t.h.streaming.alwaysStreamText){r.I(2);break}if(!n){!function(e){e.L=!0;var t=e.h.get("text");t&&(Do(t),Mo(t).catch((function(){})),e.h.delete("text"))}(t.j),r.I(2);break}if(fo(t.j,"text")){r.I(2);break}if(a=Au(t),!(0<(o=Nr.Wb(a.textStreams,t.ua,t.Xa)).length)){r.I(2);break}return S(r,po(t.j,o[0]),2);case 2:lu(t),$(r)}}))}))},Vs.prototype.setTextTrackVisibility=Vs.prototype.Bg,Vs.prototype.Ef=function(){if(!this.aa())return K.v("getPlayheadTimeAsDate is for live streams!"),null;var e=this.Ya.j,t=0;if(this.A)t=this.A.l();else if(e){if(null==e.startTime)return new Date;t=e.startTime}return this.i?new Date(1e3*(this.i.presentationTimeline.j+this.g.currentTime)):this.g&&this.g.getStartDate?(e=this.g.getStartDate(),isNaN(e.getTime())?(K.v("EXT-X-PROGRAM-DATETIME required to get playhead time as Date!"),null):new Date(e.getTime()+1e3*t)):(K.v("No way to get playhead time as Date!"),null)},Vs.prototype.getPlayheadTimeAsDate=Vs.prototype.Ef,Vs.prototype.Gf=function(){if(!this.aa())return K.v("getPresentationStartTimeAsDate is for live streams!"),null;if(this.i)return new Date(1e3*this.i.presentationTimeline.j);if(this.g&&this.g.getStartDate){var e=this.g.getStartDate();return isNaN(e.getTime())?(K.v("EXT-X-PROGRAM-DATETIME required to get presentation start time as Date!"),null):e}return K.v("No way to get presentation start time as Date!"),null},Vs.prototype.getPresentationStartTimeAsDate=Vs.prototype.Gf,Vs.prototype.bd=function(){var e={total:[],audio:[],video:[],text:[]};return this.o==ku&&(e.total=zt(this.g.buffered)),this.o==Ru&&this.M.bd(e),e},Vs.prototype.getBufferedInfo=Vs.prototype.bd,Vs.prototype.getStats=function(){if(this.o!=Ru&&this.o!=ku)return{width:NaN,height:NaN,streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,corruptedFrames:NaN,estimatedBandwidth:NaN,loadLatency:NaN,playTime:NaN,pauseTime:NaN,bufferingTime:NaN,licenseTime:NaN,switchHistory:[],stateHistory:[]};ru(this);var e=this.g;if(e.getVideoPlaybackQuality){e=e.getVideoPlaybackQuality();var t=this.F,r=Number(e.totalVideoFrames);t.A=Number(e.droppedVideoFrames),t.u=r,this.F.o=Number(e.corruptedVideoFrames)}this.m?e=(e=this.m).P?e.P:NaN:e=NaN,this.F.m=e,this.o==Ru&&((e=Tu(this))&&(this.F.C=e.bandwidth),e&&e.video&&(t=this.F,r=e.video.height||NaN,t.F=e.video.width||NaN,t.l=r),e=this.u.getBandwidthEstimate(),this.F.j=e);var n=this.F;e=n.F,t=n.l,r=n.C;for(var i=n.u,a=n.A,o=n.o,s=n.j,u=n.h,c=Ds(n.g,"playing"),l=Ds(n.g,"paused"),d=Ds(n.g,"buffering"),f=n.m,p=function(e){function t(e){return{timestamp:e.timestamp,state:e.state,duration:e.duration}}for(var r=[],n=h(e.h),i=n.next();!i.done;i=n.next())r.push(t(i.value));return e.g&&r.push(t(e.g)),r}(n.g),m=[],y=(n=h(n.i.g)).next();!y.done;y=n.next())y=y.value,m.push({timestamp:y.timestamp,id:y.id,type:y.type,fromAdaptation:y.fromAdaptation,bandwidth:y.bandwidth});return{width:e,height:t,streamBandwidth:r,decodedFrames:i,droppedFrames:a,corruptedFrames:o,estimatedBandwidth:s,loadLatency:u,playTime:c,pauseTime:l,bufferingTime:d,licenseTime:f,stateHistory:p,switchHistory:m}},Vs.prototype.getStats=Vs.prototype.getStats,Vs.prototype.addTextTrack=function(e,t,r,n,i,a){var o=this;return p((function s(){var u,c,l,d,h,f,p,m,y;return M(s,(function(s){switch(s.s){case 1:if(o.o==ku)throw K.error("Cannot add text when loaded with src="),Error("State error!");if(o.o!=Ru)throw K.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");if(u=Au(o),c=fe,l=o.i.periods.indexOf(u),h=(d=l+1)>=o.i.periods.length?o.i.presentationTimeline.ha():o.i.periods[d].startTime,1/0==(f=h-u.startTime))throw new H(1,4,4033);return p=new ni(1,0,f,(function(){return[e]}),0,null),m={id:o.re++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return 1},getSegmentReference:function(e){return 1==e?p:null},initSegmentReference:null,presentationTimeOffset:0,mimeType:n,codecs:i||"",kind:r,encrypted:!1,keyId:null,language:t,label:a||null,type:c.za,primary:!1,frameRate:void 0,pixelAspectRatio:void 0,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,audioSamplingRate:null,closedCaptions:null},o.lc.add(m),u.textStreams.push(m),S(s,po(o.j,m),2);case 2:return(y=fo(o.j,"text"))&&ba(o.Z,u,y),o.lc.delete(m),K.debug("Choosing new streams after adding a text stream"),iu(o,u),su(o),s.return(Nr.Kc(m))}}))}))},Vs.prototype.addTextTrack=Vs.prototype.addTextTrack,Vs.prototype.Nd=function(e,t){this.mc.width=e,this.mc.height=t},Vs.prototype.setMaxHardwareResolution=Vs.prototype.Nd,Vs.prototype.Id=function(){if(this.o==Ru){var e=this.j;if(e.j)K.error("Unable to retry after StreamingEngine is destroyed!"),e=!1;else if(e.A)K.error("Unable to retry after StreamingEngine encountered a fatal error!"),e=!1;else{for(var t=h(e.h.values()),r=t.next();!r.done;r=t.next()){var n=Vo(r=r.value);r.ac&&(K.info(n,"Retrying after failure..."),r.ac=!1,Oo(e,r,.1))}e=!0}}else e=!1;return e},Vs.prototype.retryStreaming=Vs.prototype.Id,Vs.prototype.uf=function(){return this.i},Vs.prototype.getManifest=Vs.prototype.uf,Vs.prototype.vf=function(){return this.C?this.C.constructor:null},Vs.prototype.getManifestParserFactory=Vs.prototype.vf,(n=Vs.prototype).Xc=function(e){var t=this.j?lo(this.j):null,r=this.j?ho(this.j):null;if(Nr.filterNewPeriod(this.m,t,r,e),!(t=e.variants).some(Nr.Gb))throw new H(2,4,4011);if(yu(this,e.variants),Nr.Xd(t,this.h.restrictions,this.mc)&&this.j&&Au(this)==e&&su(this),(e=this.m?this.m.g:null)&&this.m.o)for(r=(t=h(t)).next();!r.done;r=t.next())for(var n=(r=h(r.value.drmInfos)).next();!n.done;n=r.next())if((n=n.value).keySystem==e.keySystem)for(var i=(n=h(n.initData||[])).next();!i.done;i=n.next())i=i.value,wt(this.m,i.initDataType,i.initData)},n.Vf=function(e){K.debug("onChooseStreams_",e);try{K.O("onChooseStreams_, choosing variant from ",e.variants),K.O("onChooseStreams_, choosing text from ",e.textStreams),this.yb=!0,this.u.disable(),du(this),K.debug("Choosing new streams after period changed");var t=nu(this,e.variants),r=Nr.Wb(e.textStreams,this.ua,this.Xa)[0]||null;this.wa&&(e.variants.includes(this.wa)&&(t=this.wa),this.wa=null),this.va&&(e.textStreams.includes(this.va)&&(r=this.va),this.va=null),t&&Ks(this,e,t,!0),r&&Hs(this,e,r,!0);var n=this.j,i=n.h.get("video");if(i)var a=n.i.periods[i.oa];else{var o=n.h.get("audio");a=o?n.i.periods[o.oa]:null}var s=t?t.audio:null;if(!a&&r){var u;if(u=s){e=r;var c=Dr(this.h.preferredTextLanguage),l=Dr(s.language),d=Dr(e.language);u=Lr(d,c)&&!Lr(l,d)}u&&(this.ub=!0),this.ub&&this.M.l.setTextVisibility(!0),lu(this)}var h=this.h.streaming.alwaysStreamText||this.zc()?{variant:t,text:r}:{variant:t,text:null};return K.O("onChooseStreams_, chose variant ",h.variant),K.O("onChooseStreams_, chose text ",h.text),h}catch(e){return this.Va(e),{variant:null,text:null}}},n.Ze=function(){K.debug("canSwitch_"),this.yb=!1,this.h.abr.enabled&&(this.u.enable(),du(this)),this.wa&&(yo(this.j,this.wa,this.qe,this.oe),uu(this),this.wa=null),this.va&&(go(this.j,this.va,!0,0,!1),cu(this),this.va=null)},n.$f=function(){this.C&&this.C.update&&this.C.update()},n.eg=function(){this.A&&this.A.C()},n.Va=function(e){if(this.o!=Iu){var t=new Ze("error",{detail:e});this.dispatchEvent(t),t.defaultPrevented&&(e.handled=!0)}};var Iu=0,wu=1,Ru=2,ku=3;function Pu(e,t){var r=ms(new ps(e.Ea(),e.ja()),t.periods[0],new Ti(null,0)),n=t.appMetadata||{};return r=Cu(r),{offlineUri:e.toString(),originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,expiration:t.expiration,tracks:r,appMetadata:n}}function Cu(e){for(var t=[],r=Nr.Bf(e.variants),n=(r=h(r)).next();!n.done;n=r.next())t.push(Nr.Oc(n.value));for(r=(e=h(e.textStreams)).next();!r.done;r=e.next())t.push(Nr.Kc(r.value));return t}function xu(){this.g={}}function Lu(e,t){var r=t.audio,n=t.video;if(r&&!n&&(e.g[r.id]=r.bandwidth||t.bandwidth),!r&&n&&(e.g[n.id]=n.bandwidth||t.bandwidth),r&&n){var i=r.bandwidth||393216,a=n.bandwidth||t.bandwidth-i;0>=a&&(K.v("Audio bit rate consumes variants bandwidth. Setting video bandwidth to match variant's bandwidth."),a=t.bandwidth),e.g[r.id]=i,e.g[n.id]=a}}function Ou(e,t){var r=e.g[t];return null==r&&(r=0,K.error("Asking for bitrate of stream not given to the estimator")),0==r&&K.v("Using bitrate of 0, this stream won't affect progress"),r}function Du(e){this.g=!1,this.h=new me,this.i=e}function Mu(e){var t=new Vu;e.periods.forEach((function(e,r){var n=Gu(e.variants);if(0==r)for(var i=(n=h(n.g)).next();!i.done;i=n.next())t.add(i.value);else!function(e,t){e.g=e.g.filter((function(e){return Nu(t,e)}))}(t,n)}));for(var r=(e=h(e.periods)).next();!r.done;r=e.next())(r=r.value).variants=r.variants.filter((function(e){return Nu(t,new Zu(e))}))}function Zu(e){var t=e.audio;e=e.video,this.h=t?t.mimeType:null,this.g=t?t.codecs.split(".")[0]:null,this.j=e?e.mimeType:null,this.i=e?e.codecs.split(".")[0]:null}function Vu(){this.g=[]}function Nu(e,t){return e.g.some((function(e){return t.h==e.h&&t.g==e.g&&t.j==e.j&&t.i==e.i}))}function Gu(e){for(var t=new Vu,r=(e=h(e)).next();!r.done;r=e.next())t.add(new Zu(r.value));return t}function Xu(e){var t=this;if(e&&e.constructor!=Vs)throw new H(2,9,9008);this.h=this.g=null,e?(this.g=e.h,this.h=e.Yb()):(this.g=Cs(),this.h=new Ye),this.j=!1,this.i=[],this.l=[];var r=!e;this.m=new Du((function(){return p((function e(){var n;return M(e,(function(e){switch(e.s){case 1:return n=function(){},S(e,Promise.all(t.l.map((function(e){return e.then(n,n)}))),2);case 2:if(!r){e.I(3);break}return S(e,t.h.destroy(),3);case 3:t.g=null,t.h=null,$(e)}}))}))}))}function Wu(){if(ft())e:{for(var e=h(is.values()),t=e.next();!t.done;t=e.next())if(t=(t=t.value)()){t.destroy(),e=!0;break e}e=!1}else e=!1;return e}function Uu(e,t){for(var r=[],n=h(e.periods),i=n.next();!i.done;i=n.next())for(var a=(i=h(i.value.streams)).next();!a.done;a=i.next())a=a.value,t&&"video"==a.contentType?r.push({contentType:ct(a.mimeType,a.codecs),robustness:e.drmInfo.videoRobustness}):t||"audio"!=a.contentType||r.push({contentType:ct(a.mimeType,a.codecs),robustness:e.drmInfo.audioRobustness});return r}function Fu(e,t,r){return p((function n(){return M(n,(function(n){if(1===n.s)return S(n,function(e,t,r,n){return p((function i(){var a,o,s;return M(i,(function(i){switch(i.s){case 1:return n.drmInfo?(a=function(e){var t=Array.from(e.g.keys());if(!t.length)throw new H(2,9,9e3,"No supported storage mechanisms found");return e.g.get(t[0]).getEmeSessionCell()}(r),o=n.sessionIds.map((function(e){return{sessionId:e,keySystem:n.drmInfo.keySystem,licenseUri:n.drmInfo.licenseServerUri,serverCertificate:n.drmInfo.serverCertificate,audioCapabilities:Uu(n,!1),videoCapabilities:Uu(n,!0)}})),S(i,_s(t,e,o),2)):i.return();case 2:return s=i.B,S(i,a.remove(s),3);case 3:return S(i,a.add(o.filter((function(e){return-1==s.indexOf(e.sessionId)}))),0)}}))}))}(e.h,e.g.drm,r,t),0)}))}))}function Bu(e,t,r,n){function i(){s+=1,e.g.offline.progressCallback(u,s/o)}var a=function(e){var t=[];return e.periods.forEach((function(e){e.streams.forEach((function(e){null!=e.initSegmentKey&&t.push(e.initSegmentKey),e.segments.forEach((function(e){t.push(e.dataKey)}))}))})),t}(n),o=a.length+1,s=0,u=Pu(r,n);return Promise.all([t.removeSegments(a,i),t.removeManifests([r.key()],i)])}function Yu(e,t,r,n,i,a){var o={id:a.id,originalId:a.originalId,primary:a.primary,presentationTimeOffset:a.presentationTimeOffset||0,contentType:a.type,mimeType:a.mimeType,codecs:a.codecs,frameRate:a.frameRate,pixelAspectRatio:a.pixelAspectRatio,kind:a.kind,language:a.language,label:a.label,width:a.width||null,height:a.height||null,initSegmentKey:null,encrypted:a.encrypted,keyId:a.keyId,segments:[],variantIds:[]};i=i.presentationTimeline.$b();var s=a.id,u=a.initSegmentReference;return u&&(u=Ei(u.i(),u.h,u.g,e.g.streaming.retryParameters),Fo(t,s,u,.5*Ou(n,a.id),!0,(function(t){return p((function n(){var i;return M(n,(function(n){switch(n.s){case 1:return S(n,r.addSegments([{data:t}]),2);case 2:i=n.B,e.i.push(i[0]),o.initSegmentKey=i[0],$(n)}}))}))}))),function(e,t,r){for(var n=null==(t=e.findSegmentPosition(t))?null:e.getSegmentReference(t);n;)r(n),n=e.getSegmentReference(++t)}(a,i,(function(i){var u=Ei(i.i(),i.h,i.g,e.g.streaming.retryParameters);Fo(t,s,u,function(e,t,r){return r=r.endTime-r.startTime,Ou(e,t)*r}(n,a.id,i),!1,(function(t){return p((function n(){var a;return M(n,(function(n){switch(n.s){case 1:return S(n,r.addSegments([{data:t}]),2);case 2:a=n.B,e.i.push(a[0]),o.segments.push({startTime:i.startTime,endTime:i.endTime,dataKey:a[0]}),$(n)}}))}))}))})),o}function ju(e){if(e.m.g)throw new H(2,9,7001)}function Ku(){if(!Wu())throw new H(2,9,9e3)}function Hu(e,t){return p((function r(){return M(r,(function(r){switch(r.s){case 1:return e.l.push(t),w(r,2),S(r,t,4);case 4:return r.return(r.B);case 2:P(r),We(e.l,t),C(r,0)}}))}))}function zu(e){var t=new Set(e.variants.map((function(e){return e.video}))),r=new Set(e.variants.map((function(e){return e.audio})));e=e.textStreams,1<t.size&&K.v("Multiple video tracks selected to be stored");for(var n=(t=h(r)).next();!n.done;n=t.next()){n=n.value;for(var i=h(r),a=i.next();!a.done;a=i.next())n!=(a=a.value)&&n.language==a.language&&K.v("Similar audio tracks were selected to be stored",n.id,a.id)}for(t=(r=h(e)).next();!t.done;t=r.next())for(t=t.value,i=(n=h(e)).next();!i.done;i=n.next())t!=(i=i.value)&&t.language==i.language&&K.v("Similar text tracks were selected to be stored",t.id,i.id)}Vs.LoadMode={DESTROYED:Iu,NOT_LOADED:wu,MEDIA_SOURCE:Ru,SRC_EQUALS:ku},Du.prototype.destroy=function(){var e=this;return this.g?this.h:(this.g=!0,this.i().then((function(){e.h.resolve()}),(function(){e.h.resolve()})))},Vu.prototype.add=function(e){Nu(this,e)||this.g.push(e)},W("shaka.offline.Storage",Xu),Xu.support=Wu,Xu.prototype.destroy=function(){return this.m.destroy()},Xu.prototype.destroy=Xu.prototype.destroy,Xu.prototype.configure=function(e,t){2==arguments.length&&"string"==typeof e&&(e=ks(e,t));var r=e,n=!1;return null!=r.trackSelectionCallback&&(n=!0,r.offline=r.offline||{},r.offline.trackSelectionCallback=r.trackSelectionCallback,delete r.trackSelectionCallback),null!=r.progressCallback&&(n=!0,r.offline=r.offline||{},r.offline.progressCallback=r.progressCallback,delete r.progressCallback),null!=r.usePersistentLicense&&(n=!0,r.offline=r.offline||{},r.offline.usePersistentLicense=r.usePersistentLicense,delete r.usePersistentLicense),n&&Ur("Storage.configure with OfflineConfig","Please configure storage with a player configuration."),xs(this.g,e)},Xu.prototype.configure=Xu.prototype.configure,Xu.prototype.getConfiguration=function(){var e=Cs();return xs(e,this.g,Cs()),e},Xu.prototype.getConfiguration=Xu.prototype.getConfiguration,Xu.prototype.Yb=function(){return this.h},Xu.prototype.getNetworkingEngine=Xu.prototype.Yb,Xu.prototype.store=function(e,t,r){var n=this;return Hu(this,function(e,t,r,n){return p((function i(){var a,o,s,u,c,l,d,f,m;return M(i,(function(i){switch(i.s){case 1:return Ku(),e.j?i.return(Promise.reject(new H(2,9,9006))):(e.j=!0,S(i,function(e,t,r){return p((function n(){var i,a,o,s,u,c;return M(n,(function(n){switch(n.s){case 1:return i=null,a=e.h,o={networkingEngine:a,filterAllPeriods:function(){},filterNewPeriod:function(){},onTimelineRegionAdded:function(){},onEvent:function(){},onError:function(e){i=e}},S(n,r(),2);case 2:return(s=n.B).configure(e.g.manifest),ju(e),w(n,3),S(n,s.start(t,o),5);case 5:return u=n.B,ju(e),c=function(e){for(var t=new Set,r=(e=h(e.periods)).next();!r.done;r=e.next()){for(var n=h((r=r.value).textStreams),i=n.next();!i.done;i=n.next())t.add(i.value);for(n=(r=h(r.variants)).next();!n.done;n=r.next())(n=n.value).audio&&t.add(n.audio),n.video&&t.add(n.video)}return t}(u),S(n,Promise.all(at(c,(function(e){return e.createSegmentIndex()}))),6);case 6:if(ju(e),i)throw i;return n.return(u);case 3:return P(n),S(n,s.stop(),7);case 7:C(n,0)}}))}))}(e,t,n),2));case 2:if(a=i.B,ju(e),!(!a.presentationTimeline.aa()&&!a.presentationTimeline.ib()))throw new H(2,9,9005,t);return o=null,s=new ts,c=u=null,I(i,3,4),S(i,function(e,t,r){return p((function n(){var i,a,o;return M(n,(function(n){switch(n.s){case 1:return i=new Tt({Ib:e.h,onError:r,Dc:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),a=Na(t.periods),o=e.g,i.configure(o.drm),S(n,function(e,t,r){return e.F=[],e.L=r,St(e,t)}(i,a,o.offline.usePersistentLicense),2);case 2:return S(n,$t(i),3);case 3:return S(n,It(i),4);case 4:return n.return(i)}}))}))}(e,a,(function(e){c=c||e})),6);case 6:if(o=i.B,ju(e),c)throw c;return S(i,function(e,t,r){return p((function n(){var i,a;return M(n,(function(n){switch(n.s){case 1:return i={width:1/0,height:1/0},function(e,t,r){for(var n=(e=h(e.periods)).next();!n.done;n=e.next())(n=n.value).variants=n.variants.filter((function(e){return Nr.rd(e,t,r)}))}(t,e.g.restrictions,i),function(e){for(var t=(e=h(e.periods)).next();!t.done;t=e.next())(t=t.value).variants=t.variants.filter((function(e){var t=!0;return e.audio&&(t=t&&Ar(e.audio)),e.video&&(t=t&&Ar(e.video)),t}))}(t),function(e,t){for(var r=h(e.periods),n=r.next();!n.done;n=r.next())(n=n.value).variants=n.variants.filter((function(e){return Zt(t,e)}))}(t,r),Mu(t),a=e.g.preferredAudioChannelCount,Nr.$d(t,a),S(n,function(e,t){return p((function r(){var n,i,a,o;return M(r,(function(r){switch(r.s){case 1:n=null,i=h(e.periods),a=i.next();case 2:if(a.done){r.I(0);break}return o=a.value,n&&(o.variants=o.variants.filter((function(e){return Nu(n,new Zu(e))}))),S(r,t(o),5);case 5:n=Gu(o.variants),a=i.next(),r.I(2)}}))}))}(t,(function(t){return p((function r(){var n,i,a,o,s,u,c,l;return M(r,(function(r){switch(r.s){case 1:n=Nr,i=[];for(var d=h(t.variants),f=d.next();!f.done;f=d.next())a=f.value,i.push(n.Oc(a));for(f=(d=h(t.textStreams)).next();!f.done;f=d.next())o=f.value,i.push(n.Kc(o));return S(r,e.g.offline.trackSelectionCallback(i),2);case 2:for(s=r.B,u=new Set,c=new Set,f=(d=h(s)).next();!f.done;f=d.next())"variant"==(l=f.value).type&&u.add(l.id),"text"==l.type&&c.add(l.id);t.variants=t.variants.filter((function(e){return u.has(e.id)})),t.textStreams=t.textStreams.filter((function(e){return c.has(e.id)})),$(r)}}))}))})),2);case 2:(function(e){if(0==e.periods.length)throw new H(2,4,4014);for(var t=(e=h(e.periods)).next();!t.done;t=e.next())zu(t.value)})(t),$(n)}}))}))}(e,a,o),7);case 7:return S(i,s.init(),8);case 8:return ju(e),S(i,function(e){var t=null;if(e.g.forEach((function(e,r){e.getCells().forEach((function(e,n){e.hasFixedKeySpace()||t||(t={path:{Ea:r,ja:n},ja:e})}))})),t)return t;throw new H(2,9,9013,"Could not find a cell that supports add-operations")}(s),9);case 9:return u=i.B,ju(e),S(i,function(e,t,r,n,i,a){return p((function o(){var s,u,c,l,d,f,m,y,g,v;return M(o,(function(o){switch(o.s){case 1:return s=function(e,t,r){var n=null==t.expiration?1/0:t.expiration;return{offlineUri:null,originalManifestUri:e,duration:t.presentationTimeline.ha(),size:0,expiration:n,tracks:t=Cu(t.periods[0]),appMetadata:r}}(i,n,a),u=n.periods.some((function(e){return e.variants.some((function(e){return e.drmInfos&&e.drmInfos.length}))})),c=n.periods.some((function(e){return e.variants.some((function(e){return e.drmInfos.some((function(e){return e.initData&&e.initData.length}))}))})),d=null,(l=u&&!c)&&(f=r.g,d=Ju.get(f.keySystem)),m=new Uo(e.h,(function(t,r){s.size=r,e.g.offline.progressCallback(s,t)}),(function(t,n){l&&e.g.offline.usePersistentLicense&&d==n&&wt(r,"cenc",t)})),w(o,2),g=y=function(e,t,r,n,i,a,o){var s=new xu,u=i.periods.map((function(n){return function(e,t,r,n,i,a){for(var o=h(a.variants),s=o.next();!s.done;s=o.next())Lu(n,s.value);for(o=h(a.textStreams),s=o.next();!s.done;s=o.next())n.g[s.value.id]=52;o=function(e){for(var t=new Set,r=h(e.textStreams),n=r.next();!n.done;n=r.next())t.add(n.value);for(e=h(e.variants),r=e.next();!r.done;r=e.next())(r=r.value).audio&&t.add(r.audio),r.video&&t.add(r.video);return t}(a);var u=new Map;for(o=h(o),s=o.next();!s.done;s=o.next()){var c=Yu(e,t,r,n,i,s=s.value);u.set(s.id,c)}return a.variants.forEach((function(e){e.audio&&u.get(e.audio.id).variantIds.push(e.id),e.video&&u.get(e.video.id).variantIds.push(e.id)})),{startTime:a.startTime,streams:Array.from(u.values())}}(e,t,r,s,i,n)})),c=n.g,l=e.g.offline.usePersistentLicense;return c&&l&&(c.initData=[]),{originalManifestUri:a,duration:i.presentationTimeline.ha(),size:0,expiration:n.Xb(),periods:u,sessionIds:l?Pt(n):[],drmInfo:c,appMetadata:o}}(e,m,t,r,n,i,a),S(o,function(e){return p((function t(){return M(t,(function(t){switch(t.s){case 1:return S(t,Promise.all(e.h.values()),2);case 2:return t.return(e.g.g)}}))}))}(m),4);case 4:if(g.size=o.B,y.expiration=r.Xb(),v=Pt(r),y.sessionIds=e.g.offline.usePersistentLicense?v:[],u&&e.g.offline.usePersistentLicense&&!v.length)throw new H(2,9,9007);return o.return(y);case 2:return P(o),S(o,m.destroy(),5);case 5:C(o,0)}}))}))}(e,u.ja,o,a,t,r),10);case 10:if(l=i.B,ju(e),c)throw c;return S(i,u.ja.addManifests([l]),11);case 11:return d=i.B,ju(e),f=new hs("manifest",u.path.Ea,u.path.ja,d[0]),i.return(Pu(f,l));case 4:return P(i),e.j=!1,e.i=[],S(i,s.destroy(),12);case 12:if(!o){i.I(13);break}return S(i,o.destroy(),13);case 13:C(i,0);break;case 3:if(m=k(i),!u){i.I(15);break}return S(i,u.ja.removeSegments(e.i,(function(){})),15);case 15:throw c||m}}))}))}(this,e,t||{},(function(){return p((function t(){var i,a;return M(t,(function(t){switch(t.s){case 1:return r&&"string"!=typeof r?(Ur("Storing with a manifest parser factory","Please register a manifest parser and for the mime-type."),i=r,t.return(new i)):S(t,Ai.create(e,n.h,n.g.manifest.retryParameters,r),2);case 2:return a=t.B,t.return(a)}}))}))})))},Xu.prototype.store=Xu.prototype.store,Xu.prototype.Hf=function(){return this.j},Xu.prototype.getStoreInProgress=Xu.prototype.Hf,Xu.prototype.remove=function(e){return Hu(this,function(e,t){return p((function r(){var n,i,a,o,s,u;return M(r,(function(r){switch(r.s){case 1:return Ku(),null==(n=fs(t))||"manifest"!=n.g?r.return(Promise.reject(new H(2,9,9004,t))):(i=n,a=new ts,w(r,2),S(r,a.init(),4));case 4:return S(r,rs(a,i.Ea(),i.ja()),5);case 5:return S(r,(o=r.B).getManifests([i.key()]),6);case 6:return s=r.B,u=s[0],S(r,Promise.all([Fu(e,u,a),Bu(e,o,i,u)]),2);case 2:return P(r),S(r,a.destroy(),8);case 8:C(r,0)}}))}))}(this,e))},Xu.prototype.remove=Xu.prototype.remove,Xu.prototype.sg=function(){return Hu(this,function(e){return p((function t(){var r,n,i,a,o,s,u,c,l;return M(t,(function(t){switch(t.s){case 1:return Ku(),r=e.h,n=e.g.drm,i=new ts,a=!1,w(t,2),S(t,i.init(),4);case 4:for(o=[],function(e,t){e.g.forEach((function(e){t(e.getEmeSessionCell())}))}(i,(function(e){return o.push(e)})),s=Promise.resolve(),u={},c=h(o),l=c.next();!l.done;u={Jc:u.Jc},l=c.next())u.Jc=l.value,s=s.then(function(e){return function(){return p((function t(){var i,o;return M(t,(function(t){switch(t.s){case 1:return S(t,e.Jc.getAll(),2);case 2:return i=t.B,S(t,_s(n,r,i),3);case 3:return o=t.B,S(t,e.Jc.remove(o),4);case 4:o.length!=i.length&&(a=!0),$(t)}}))}))}}(u));return S(t,s,2);case 2:return P(t),S(t,i.destroy(),6);case 6:C(t,3);break;case 3:return t.return(!a)}}))}))}(this))},Xu.prototype.removeEmeSessions=Xu.prototype.sg,Xu.prototype.list=function(){return Hu(this,p((function e(){var t,r,n;return M(e,(function(e){switch(e.s){case 1:return Ku(),t=[],r=new ts,w(e,2),S(e,r.init(),4);case 4:return n=Promise.resolve(),function(e,t){e.g.forEach((function(e,r){e.getCells().forEach((function(e,n){t({Ea:r,ja:n},e)}))}))}(r,(function(e,r){n=n.then((function(){return p((function n(){return M(n,(function(n){switch(n.s){case 1:return S(n,r.getAllManifests(),2);case 2:n.B.forEach((function(r,n){var i=Pu(new hs("manifest",e.Ea,e.ja,n),r);t.push(i)})),$(n)}}))}))}))})),S(e,n,2);case 2:return P(e),S(e,r.destroy(),6);case 6:C(e,3);break;case 3:return e.return(t)}}))})))},Xu.prototype.list=Xu.prototype.list,Xu.deleteAll=function(){return p((function e(){var t;return M(e,(function(e){switch(e.s){case 1:return t=new ts,w(e,2),S(e,t.erase(),2);case 2:return P(e),S(e,t.destroy(),5);case 5:C(e,0)}}))}))};var Ju=(new Map).set("org.w3.clearkey","1077efecc0b24d02ace33c1e52e2fb4b").set("com.widevine.alpha","edef8ba979d64acea3c827dcd51d21ed").set("com.microsoft.playready","9a04f07998404286ab92e65be0885f95").set("com.adobe.primetime","f239e769efa348509c16a903c6932efb");Xs.offline=Wu,W("shaka.polyfill.installAll",(function(){for(var e=0;e<ec.length;++e)try{ec[e].Xe()}catch(e){K.ba("Error installing polyfill!",e)}}));var Qu,qu,ec=[];function tc(e,t){for(var r={priority:t=t||0,Xe:e},n=0;n<ec.length;n++)if(ec[n].priority<t)return void ec.splice(n,0,r);ec.push(r)}function rc(e){var t=e.type.replace(/^(webkit|moz|MS)/,"").toLowerCase();if("function"==typeof Event)var r=new Event(t,e);else(r=document.createEvent("Event")).initEvent(t,e.bubbles,e.cancelable);e.target.dispatchEvent(r)}function nc(e,t,r){if("input"==e&&"range"===this.type)e="change";HTMLInputElement.prototype.originalAddEventListener.call(this,e,t,r)}function ic(){var e=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(t){for(var r=[],n=0;n<arguments.length;++n)r[n]=arguments[n];return(r=e.apply(this,r)).abort=function(){},r}}function ac(e,t){K.debug("PatchedMediaKeysApple.requestMediaKeySystemAccess");try{var r=new oc(e,t);return Promise.resolve(r)}catch(e){return Promise.reject(e)}}function oc(e,t){if(K.debug("PatchedMediaKeysApple.MediaKeySystemAccess"),this.keySystem=e,e.startsWith("com.apple.fps"))for(var r=h(t),n=r.next();!n.done;n=r.next()){var i=n.value;if("required"==i.persistentState)n=null;else{n={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:i.initDataTypes,sessionTypes:["temporary"],label:i.label};var a=!1,o=!1;if(i.audioCapabilities)for(var s=h(i.audioCapabilities),u=s.next();!u.done;u=s.next())if((u=u.value).contentType){a=!0;var c=u.contentType.split(";")[0];WebKitMediaKeys.isTypeSupported(this.keySystem,c)&&(n.audioCapabilities.push(u),o=!0)}if(i.videoCapabilities)for(u=(i=h(i.videoCapabilities)).next();!u.done;u=i.next())(s=u.value).contentType&&(a=!0,u=s.contentType.split(";")[0],WebKitMediaKeys.isTypeSupported(this.keySystem,u)&&(n.videoCapabilities.push(s),o=!0));a||(o=WebKitMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),n=o?n:null}if(n)return void(this.g=n)}throw(r=Error("Unsupported keySystem")).name="NotSupportedError",r.code=DOMException.NOT_SUPPORTED_ERR,r}function sc(e){K.debug("PatchedMediaKeysApple.setMediaKeys");var t=this.mediaKeys;return t&&t!=e&&cc(t,null),delete this.mediaKeys,(this.mediaKeys=e)?cc(e,this):Promise.resolve()}function uc(e){K.debug("PatchedMediaKeysApple.MediaKeys"),this.h=new WebKitMediaKeys(e),this.g=new et}function cc(e,t){if(e.g.nb(),!t)return Promise.resolve();e.g.H(t,"webkitneedkey",dc);try{return Fa(t,HTMLMediaElement.HAVE_METADATA,e.g,(function(){t.webkitSetMediaKeys(e.h)})),Promise.resolve()}catch(e){return Promise.reject(e)}}function lc(e){K.debug("PatchedMediaKeysApple.MediaKeySession"),Ne.call(this),this.h=null,this.l=e,this.i=this.g=null,this.j=new et,this.sessionId="",this.expiration=NaN,this.closed=new me,this.keyStatuses=new fc}function dc(e){if(K.debug("PatchedMediaKeysApple.onWebkitNeedKey_",e),e=new Uint8Array(e.initData),new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!0)+4!=e.byteLength)throw new RangeError("Malformed FairPlay init data");e=be(e=ge(e.subarray(4),!0));var t=new Event("encrypted");t.initDataType="skd",t.initData=e,this.dispatchEvent(t)}function hc(e,t){var r=e.keyStatuses;r.size=null==t?0:1,r.g=t,e.dispatchEvent(new Ze("keystatuseschange"))}function fc(){this.size=0,this.g=void 0}function pc(e,t){K.debug("PatchedMediaKeysMs.requestMediaKeySystemAccess");try{var r=new mc(e,t);return Promise.resolve(r)}catch(e){return Promise.reject(e)}}function mc(e,t){K.debug("PatchedMediaKeysMs.MediaKeySystemAccess"),this.keySystem=e;for(var r=!1,n=0;n<t.length;++n){var i=t[n],a={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:i.initDataTypes,sessionTypes:["temporary"],label:i.label},o=!1;if(i.audioCapabilities)for(var s=0;s<i.audioCapabilities.length;++s){var u=i.audioCapabilities[s];if(u.contentType){o=!0;var c=u.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,c)&&(a.audioCapabilities.push(u),r=!0)}}if(i.videoCapabilities)for(s=0;s<i.videoCapabilities.length;++s)(u=i.videoCapabilities[s]).contentType&&(o=!0,c=u.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,c)&&(a.videoCapabilities.push(u),r=!0));if(o||(r=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==i.persistentState&&(r=!1),r)return void(this.g=a)}throw(r=Error("Unsupported keySystem")).name="NotSupportedError",r.code=DOMException.NOT_SUPPORTED_ERR,r}function yc(e){K.debug("PatchedMediaKeysMs.setMediaKeys");var t=this.mediaKeys;return t&&t!=e&&vc(t,null),delete this.mediaKeys,(this.mediaKeys=e)?vc(e,this):Promise.resolve()}function gc(e){K.debug("PatchedMediaKeysMs.MediaKeys"),this.h=new MSMediaKeys(e),this.g=new et}function vc(e,t){if(e.g.nb(),!t)return Promise.resolve();e.g.H(t,"msneedkey",_c);try{return Fa(t,HTMLMediaElement.HAVE_METADATA,e.g,(function(){t.msSetMediaKeys(e.h)})),Promise.resolve()}catch(e){return Promise.reject(e)}}function bc(e){K.debug("PatchedMediaKeysMs.MediaKeySession"),Ne.call(this),this.i=null,this.l=e,this.h=this.g=null,this.j=new et,this.sessionId="",this.expiration=NaN,this.closed=new me,this.keyStatuses=new Tc}function _c(e){if(K.debug("PatchedMediaKeysMs.onMsNeedKey_",e),e.initData){var t=document.createEvent("CustomEvent");t.initCustomEvent("encrypted",!1,!1,null),t.initDataType="cenc",t.initData=function(e){if(!e)return e;var t=new Fn(e);if(1>=t.data.length)return e;e=[];for(var r={},n=(t=h(t.data)).next();!n.done;r={yc:r.yc},n=t.next())r.yc=n.value,e.some(function(e){return function(t){return Ee.Ha(t,e.yc)}}(r))||e.push(r.yc);return Ee.concat.apply(Ee,e instanceof Array?e:function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(h(e)))}(e.initData).buffer,this.dispatchEvent(t)}}function Ac(e,t){var r=e.keyStatuses;r.size=null==t?0:1,r.g=t,e.dispatchEvent(new Ze("keystatuseschange"))}function Tc(){this.size=0,this.g=void 0}function Ec(){return K.debug("PatchedMediaKeysNop.requestMediaKeySystemAccess"),Promise.reject(Error("The key system specified is not supported."))}function Sc(e){return K.debug("PatchedMediaKeysNop.setMediaKeys"),null==e?Promise.resolve():Promise.reject(Error("MediaKeys not supported."))}function $c(){throw new TypeError("Illegal constructor.")}function Ic(){throw new TypeError("Illegal constructor.")}W("shaka.polyfill.register",tc),tc((function(){Gl()}),-1),tc((function(){if(e.Document){var t=Element.prototype;t.requestFullscreen=t.requestFullscreen||t.mozRequestFullScreen||t.msRequestFullscreen||t.webkitRequestFullscreen,(t=Document.prototype).exitFullscreen=t.exitFullscreen||t.mozCancelFullScreen||t.msExitFullscreen||t.webkitCancelFullScreen,"fullscreenElement"in document||(Object.defineProperty(document,"fullscreenElement",{get:function(){return document.mozFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement||document.webkitFullscreenElement}}),Object.defineProperty(document,"fullscreenEnabled",{get:function(){return document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled}})),document.addEventListener("webkitfullscreenchange",rc),document.addEventListener("webkitfullscreenerror",rc),document.addEventListener("mozfullscreenchange",rc),document.addEventListener("mozfullscreenerror",rc),document.addEventListener("MSFullscreenChange",rc),document.addEventListener("MSFullscreenError",rc)}})),tc((function(){K.debug("InputEvent.install"),vt("Trident/")&&!HTMLInputElement.prototype.originalAddEventListener&&(K.info("Patching input event support on IE."),HTMLInputElement.prototype.originalAddEventListener=HTMLInputElement.prototype.addEventListener,HTMLInputElement.prototype.addEventListener=nc)})),tc((function(){navigator.languages||Object.defineProperty(navigator,"languages",{get:function(){return navigator.language?[navigator.language]:["en"]}})})),tc((function(){K.debug("mathRound.install")})),tc((function(){K.debug("MediaSource.install");var t=gt();e.MediaSource?e.cast&&cast.__platform__&&cast.__platform__.canDisplayType?(K.info("Patching Chromecast MSE bugs."),function(){var e=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(t){var r=t.split(/ *; */);return r.shift(),r.some((function(e){return e.startsWith("codecs=")}))?cast.__platform__.canDisplayType(t):e(t)}}()):t?(function(){var e=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(t){return"mp2t"!=t.split(/ *; */)[0].split("/")[1].toLowerCase()&&e(t)}}(),12>=t?(K.info("Patching Safari 11 & 12 MSE bugs."),ic(),function(){var e=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(t,r){return e.call(this,t,r-.001)}}()):(K.info("Patching Safari 13 MSE bugs."),ic())):vt("Tizen 2")||vt("Tizen 3")||vt("Tizen 4")?function(){var e=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(t){return"opus"!=dt(t)[0]&&e(t)}}():K.info("Using native MSE as-is."):K.info("No MSE implementation available.")})),oc.prototype.createMediaKeys=function(){K.debug("PatchedMediaKeysApple.MediaKeySystemAccess.createMediaKeys");var e=new uc(this.keySystem);return Promise.resolve(e)},oc.prototype.getConfiguration=function(){return K.debug("PatchedMediaKeysApple.MediaKeySystemAccess.getConfiguration"),this.g},uc.prototype.createSession=function(e){if(K.debug("PatchedMediaKeysApple.MediaKeys.createSession"),"temporary"!=(e=e||"temporary"))throw new TypeError("Session type "+e+" is unsupported on this platform.");return new lc(this.h)},uc.prototype.setServerCertificate=function(e){return K.debug("PatchedMediaKeysApple.MediaKeys.setServerCertificate"),Promise.resolve(!0)},U(lc,Ne),(n=lc.prototype).generateRequest=function(e,t){K.debug("PatchedMediaKeysApple.MediaKeySession.generateRequest"),this.g=new me;try{this.h=this.l.createSession("video/mp4",new Uint8Array(t)),this.sessionId=this.h.sessionId||"",this.j.H(this.h,"webkitkeymessage",this.Gg.bind(this)),this.j.H(this.h,"webkitkeyadded",this.Eg.bind(this)),this.j.H(this.h,"webkitkeyerror",this.Fg.bind(this)),hc(this,"status-pending")}catch(e){this.g.reject(e)}return this.g},n.load=function(){return K.debug("PatchedMediaKeysApple.MediaKeySession.load"),Promise.reject(Error("MediaKeySession.load not yet supported"))},n.update=function(e){K.debug("PatchedMediaKeysApple.MediaKeySession.update"),this.i=new me;try{this.h.update(new Uint8Array(e))}catch(e){this.i.reject(e)}return this.i},n.close=function(){K.debug("PatchedMediaKeysApple.MediaKeySession.close");try{this.h.close(),this.closed.resolve(),this.j.nb()}catch(e){this.closed.reject(e)}return this.closed},n.remove=function(){return K.debug("PatchedMediaKeysApple.MediaKeySession.remove"),Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},n.Gg=function(e){K.debug("PatchedMediaKeysApple.onWebkitKeyMessage_",e),this.g&&(this.g.resolve(),this.g=null),this.dispatchEvent(new Ze("message",{messageType:null==this.keyStatuses.g?"license-request":"license-renewal",message:e.message.buffer}))},n.Eg=function(e){K.debug("PatchedMediaKeysApple.onWebkitKeyAdded_",e),this.i&&(hc(this,"usable"),this.i.resolve(),this.i=null)},n.Fg=function(e){if(K.debug("PatchedMediaKeysApple.onWebkitKeyError_",e),(e=Error("EME PatchedMediaKeysApple key error")).errorCode=this.h.error,null!=this.g)this.g.reject(e),this.g=null;else if(null!=this.i)this.i.reject(e),this.i=null;else switch(this.h.error.code){case WebKitMediaKeyError.MEDIA_KEYERR_OUTPUT:case WebKitMediaKeyError.MEDIA_KEYERR_HARDWARECHANGE:hc(this,"output-not-allowed");break;default:hc(this,"internal-error")}},(n=fc.prototype).forEach=function(e){this.g&&e(this.g,Qu)},n.get=function(e){if(this.has(e))return this.g},n.has=function(e){var t=Qu;return!(!this.g||!Ee.Ha(new Uint8Array(e),new Uint8Array(t)))},n.entries=function(){},n.keys=function(){},n.values=function(){},tc((function(){e.HTMLVideoElement&&e.WebKitMediaKeys&&(K.info("Using Apple-prefixed EME"),Qu=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=sc,e.MediaKeys=uc,e.MediaKeySystemAccess=oc,navigator.requestMediaKeySystemAccess=ac)})),mc.prototype.createMediaKeys=function(){K.debug("PatchedMediaKeysMs.MediaKeySystemAccess.createMediaKeys");var e=new gc(this.keySystem);return Promise.resolve(e)},mc.prototype.getConfiguration=function(){return K.debug("PatchedMediaKeysMs.MediaKeySystemAccess.getConfiguration"),this.g},gc.prototype.createSession=function(e){if(K.debug("PatchedMediaKeysMs.MediaKeys.createSession"),"temporary"!=(e=e||"temporary"))throw new TypeError("Session type "+e+" is unsupported on this platform.");return new bc(this.h)},gc.prototype.setServerCertificate=function(){return K.debug("PatchedMediaKeysMs.MediaKeys.setServerCertificate"),Promise.resolve(!1)},U(bc,Ne),(n=bc.prototype).generateRequest=function(e,t){K.debug("PatchedMediaKeysMs.MediaKeySession.generateRequest"),this.g=new me;try{this.i=this.l.createSession("video/mp4",new Uint8Array(t),null),this.j.H(this.i,"mskeymessage",this.dg.bind(this)),this.j.H(this.i,"mskeyadded",this.bg.bind(this)),this.j.H(this.i,"mskeyerror",this.cg.bind(this)),Ac(this,"status-pending")}catch(e){this.g.reject(e)}return this.g},n.load=function(){return K.debug("PatchedMediaKeysMs.MediaKeySession.load"),Promise.reject(Error("MediaKeySession.load not yet supported"))},n.update=function(e){K.debug("PatchedMediaKeysMs.MediaKeySession.update"),this.h=new me;try{this.i.update(new Uint8Array(e))}catch(e){this.h.reject(e)}return this.h},n.close=function(){K.debug("PatchedMediaKeysMs.MediaKeySession.close");try{this.i.close(),this.closed.resolve(),this.j.nb()}catch(e){this.closed.reject(e)}return this.closed},n.remove=function(){return K.debug("PatchedMediaKeysMs.MediaKeySession.remove"),Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},n.dg=function(e){K.debug("PatchedMediaKeysMs.onMsKeyMessage_",e),this.g&&(this.g.resolve(),this.g=null),this.dispatchEvent(new Ze("message",{messageType:null==this.keyStatuses.g?"license-request":"license-renewal",message:e.message.buffer}))},n.bg=function(e){K.debug("PatchedMediaKeysMs.onMsKeyAdded_",e),this.g?(K.debug("Simulating completion for a PR persistent license."),Ac(this,"usable"),this.g.resolve(),this.g=null):this.h&&(Ac(this,"usable"),this.h.resolve(),this.h=null)},n.cg=function(e){if(K.debug("PatchedMediaKeysMs.onMsKeyError_",e),(e=Error("EME PatchedMediaKeysMs key error")).errorCode=this.i.error,null!=this.g)this.g.reject(e),this.g=null;else if(null!=this.h)this.h.reject(e),this.h=null;else switch(this.i.error.code){case MSMediaKeyError.MS_MEDIA_KEYERR_OUTPUT:case MSMediaKeyError.MS_MEDIA_KEYERR_HARDWARECHANGE:Ac(this,"output-not-allowed");break;default:Ac(this,"internal-error")}},(n=Tc.prototype).forEach=function(e){this.g&&e(this.g,qu)},n.get=function(e){if(this.has(e))return this.g},n.has=function(e){var t=qu;return!(!this.g||!Ee.Ha(new Uint8Array(e),new Uint8Array(t)))},n.entries=function(){},n.keys=function(){},n.values=function(){},tc((function(){!e.HTMLVideoElement||!e.MSMediaKeys||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(K.info("Using ms-prefixed EME v20140218"),qu=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=yc,e.MediaKeys=gc,e.MediaKeySystemAccess=mc,navigator.requestMediaKeySystemAccess=pc)})),$c.prototype.createSession=function(){},$c.prototype.setServerCertificate=function(){},Ic.prototype.getConfiguration=function(){},Ic.prototype.createMediaKeys=function(){},tc((function(){!e.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(K.info("EME not available."),navigator.requestMediaKeySystemAccess=Ec,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Sc,e.MediaKeys=$c,e.MediaKeySystemAccess=Ic)}),-10);var wc,Rc="";function kc(e){return Rc?Rc+e.charAt(0).toUpperCase()+e.slice(1):e}function Pc(e,t){K.debug("PatchedMediaKeysWebkit.requestMediaKeySystemAccess");try{var r=new xc(e,t);return Promise.resolve(r)}catch(e){return Promise.reject(e)}}function Cc(e){K.debug("PatchedMediaKeysWebkit.setMediaKeys");var t=this.mediaKeys;return t&&t!=e&&Oc(t,null),delete this.mediaKeys,(this.mediaKeys=e)&&Oc(e,this),Promise.resolve()}function xc(e,t){K.debug("PatchedMediaKeysWebkit.MediaKeySystemAccess"),this.g=this.keySystem=e;var r=!1;"org.w3.clearkey"==e&&(this.g="webkit-org.w3.clearkey",r=!1);var n=!1,i=document.getElementsByTagName("video");i=i.length?i[0]:document.createElement("video");for(var a=0;a<t.length;++a){var o=t[a],s={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:o.initDataTypes,sessionTypes:["temporary"],label:o.label},u=!1;if(o.audioCapabilities)for(var c=0;c<o.audioCapabilities.length;++c){var l=o.audioCapabilities[c];if(l.contentType){u=!0;var d=l.contentType.split(";")[0];i.canPlayType(d,this.g)&&(s.audioCapabilities.push(l),n=!0)}}if(o.videoCapabilities)for(c=0;c<o.videoCapabilities.length;++c)(l=o.videoCapabilities[c]).contentType&&(u=!0,i.canPlayType(l.contentType,this.g)&&(s.videoCapabilities.push(l),n=!0));if(u||(n=i.canPlayType("video/mp4",this.g)||i.canPlayType("video/webm",this.g)),"required"==o.persistentState&&(r?(s.persistentState="required",s.sessionTypes=["persistent-license"]):n=!1),n)return void(this.h=s)}throw r="Unsupported keySystem","org.w3.clearkey"!=e&&"com.widevine.alpha"!=e||(r="None of the requested configurations were supported."),(r=Error(r)).name="NotSupportedError",r.code=DOMException.NOT_SUPPORTED_ERR,r}function Lc(e){K.debug("PatchedMediaKeysWebkit.MediaKeys"),this.l=e,this.h=null,this.g=new et,this.i=[],this.j={}}function Oc(e,t){e.h=t,e.g.nb();var r=Rc;t&&(e.g.H(t,r+"needkey",e.hg.bind(e)),e.g.H(t,r+"keymessage",e.Jg.bind(e)),e.g.H(t,r+"keyadded",e.Hg.bind(e)),e.g.H(t,r+"keyerror",e.Ig.bind(e)))}function Dc(e,t){var r=e.j[t];return r?(K.debug("PatchedMediaKeysWebkit.MediaKeys.findSession_",r),r):(r=e.i.shift())?(r.sessionId=t,e.j[t]=r,K.debug("PatchedMediaKeysWebkit.MediaKeys.findSession_",r),r):null}function Mc(e,t,r){K.debug("PatchedMediaKeysWebkit.MediaKeySession"),Ne.call(this),this.j=e,this.m=!1,this.g=this.h=null,this.i=t,this.l=r,this.sessionId="",this.expiration=NaN,this.closed=new me,this.keyStatuses=new Nc}function Zc(e,t,r){if(e.m)return Promise.reject(Error("The session is already initialized."));e.m=!0;try{if("persistent-license"==e.l)if(r)var n=new Uint8Array(be("LOAD_SESSION|"+r));else{var i=be("PERSISTENT|"),a=new Uint8Array(i.byteLength+t.byteLength);a.set(new Uint8Array(i),0),a.set(new Uint8Array(t),i.byteLength),n=a}else n=new Uint8Array(t)}catch(e){return Promise.reject(e)}e.h=new me;var o=kc("generateKeyRequest");try{e.j[o](e.i,n)}catch(t){if("InvalidStateError"!=t.name)return e.h=null,Promise.reject(t);new Re((function(){try{e.j[o](e.i,n)}catch(t){e.h.reject(t),e.h=null}})).V(.01)}return e.h}function Vc(e,t){var r=e.keyStatuses;r.size=null==t?0:1,r.g=t,e.dispatchEvent(new Ze("keystatuseschange"))}function Nc(){this.size=0,this.g=void 0}function Gc(e){if("picture-in-picture"==(e=e.target).webkitPresentationMode){document.pictureInPictureElement=e;var t=new Event("enterpictureinpicture");e.dispatchEvent(t)}else document.pictureInPictureElement==e&&(document.pictureInPictureElement=null),t=new Event("leavepictureinpicture"),e.dispatchEvent(t)}function Xc(){return this.webkitSupportsPresentationMode("picture-in-picture")?(this.webkitSetPresentationMode("picture-in-picture"),document.pictureInPictureElement=this,Promise.resolve()):Promise.reject(Error("PiP not allowed by video element"))}function Wc(){var e=document.pictureInPictureElement;return e?(e.webkitSetPresentationMode("inline"),document.pictureInPictureElement=null,Promise.resolve()):Promise.reject(Error("No picture in picture element found"))}function Uc(){return!!this.hasAttribute("disablePictureInPicture")||!this.webkitSupportsPresentationMode("picture-in-picture")}function Fc(e){e?this.setAttribute("disablePictureInPicture",""):this.removeAttribute("disablePictureInPicture")}function Bc(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function Yc(t,r,n){return new e.TextTrackCue(t,r,n)}function jc(t,r,n){return new e.TextTrackCue(t+"-"+r+"-"+n,t,r,n)}function Kc(){}xc.prototype.createMediaKeys=function(){K.debug("PatchedMediaKeysWebkit.MediaKeySystemAccess.createMediaKeys");var e=new Lc(this.g);return Promise.resolve(e)},xc.prototype.getConfiguration=function(){return K.debug("PatchedMediaKeysWebkit.MediaKeySystemAccess.getConfiguration"),this.h},(n=Lc.prototype).createSession=function(e){if(K.debug("PatchedMediaKeysWebkit.MediaKeys.createSession"),"temporary"!=(e=e||"temporary")&&"persistent-license"!=e)throw new TypeError("Session type "+e+" is unsupported on this platform.");var t=this.h||document.createElement("video");return t.src||(t.src="about:blank"),e=new Mc(t,this.l,e),this.i.push(e),e},n.setServerCertificate=function(){return K.debug("PatchedMediaKeysWebkit.MediaKeys.setServerCertificate"),Promise.resolve(!1)},n.hg=function(e){K.debug("PatchedMediaKeysWebkit.onWebkitNeedKey_",e);var t=document.createEvent("CustomEvent");t.initCustomEvent("encrypted",!1,!1,null),t.initDataType="cenc",e.initData instanceof ArrayBuffer?t.initData=e.initData:t.initData=e.initData.buffer,this.h.dispatchEvent(t)},n.Jg=function(e){K.debug("PatchedMediaKeysWebkit.onWebkitKeyMessage_",e);var t=Dc(this,e.sessionId);t?(e=new Ze("message",{messageType:null==t.keyStatuses.g?"licenserequest":"licenserenewal",message:e.message}),K.debug("PatchedMediaKeysWebkit.MediaKeySession.generated"),t.h&&(t.h.resolve(),t.h=null),t.dispatchEvent(e)):K.error("Session not found",e.sessionId)},n.Hg=function(e){K.debug("PatchedMediaKeysWebkit.onWebkitKeyAdded_",e),(e=Dc(this,e.sessionId))&&(K.debug("PatchedMediaKeysWebkit.MediaKeySession.ready"),Vc(e,"usable"),e.g&&e.g.resolve(),e.g=null)},n.Ig=function(e){K.debug("PatchedMediaKeysWebkit.onWebkitKeyError_",e);var t=Dc(this,e.sessionId);t&&t.handleError(e)},U(Mc,Ne),(n=Mc.prototype).handleError=function(e){K.debug("PatchedMediaKeysWebkit.MediaKeySession.handleError",e);var t=Error("EME v0.1b key error"),r=e.errorCode;r.systemCode=e.systemCode,t.errorCode=r,!e.sessionId&&this.h?(45==e.systemCode&&(t.message="Unsupported session type."),this.h.reject(t),this.h=null):e.sessionId&&this.g?(this.g.reject(t),this.g=null):(t=e.systemCode,e.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?Vc(this,"output-restricted"):Vc(this,1==t?"expired":"internal-error"))},n.Qd=function(e,t){if(this.g)this.g.then(this.Qd.bind(this,e,t)).catch(this.Qd.bind(this,e,t));else{if(this.g=e,"webkit-org.w3.clearkey"==this.i){var r=ye(t),n=JSON.parse(r);"oct"!=n.keys[0].kty&&(this.g.reject(Error("Response is not a valid JSON Web Key Set.")),this.g=null),r=Ee.Ja(n.keys[0].k),n=Ee.Ja(n.keys[0].kid)}else r=new Uint8Array(t),n=null;var i=kc("addKey");try{this.j[i](this.i,r,n,this.sessionId)}catch(e){this.g.reject(e),this.g=null}}},n.generateRequest=function(e,t){return K.debug("PatchedMediaKeysWebkit.MediaKeySession.generateRequest"),Zc(this,t,null)},n.load=function(e){return K.debug("PatchedMediaKeysWebkit.MediaKeySession.load"),"persistent-license"==this.l?Zc(this,null,e):Promise.reject(Error("Not a persistent session."))},n.update=function(e){K.debug("PatchedMediaKeysWebkit.MediaKeySession.update",e);var t=new me;return this.Qd(t,e),t},n.close=function(){if(K.debug("PatchedMediaKeysWebkit.MediaKeySession.close"),"persistent-license"!=this.l){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var e=kc("cancelKeyRequest");try{this.j[e](this.i,this.sessionId)}catch(e){}}return this.closed.resolve(),this.closed},n.remove=function(){return K.debug("PatchedMediaKeysWebkit.MediaKeySession.remove"),"persistent-license"!=this.l?Promise.reject(Error("Not a persistent session.")):this.close()},(n=Nc.prototype).forEach=function(e){this.g&&e(this.g,wc)},n.get=function(e){if(this.has(e))return this.g},n.has=function(e){var t=wc;return!(!this.g||!Ee.Ha(new Uint8Array(e),new Uint8Array(t)))},n.entries=function(){},n.keys=function(){},n.values=function(){},tc((function(){if(!(!e.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration)){if(HTMLMediaElement.prototype.webkitGenerateKeyRequest)K.info("Using webkit-prefixed EME v0.1b"),Rc="webkit";else{if(!HTMLMediaElement.prototype.generateKeyRequest)return;K.info("Using nonprefixed EME v0.1b")}wc=new Uint8Array([0]).buffer,navigator.requestMediaKeySystemAccess=Pc,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Cc,e.MediaKeys=Lc,e.MediaKeySystemAccess=xc}})),tc((function(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;t.requestPictureInPicture&&document.exitPictureInPicture||!t.webkitSupportsPresentationMode||(K.debug("PiPWebkit.install"),document.pictureInPictureEnabled=!0,document.pictureInPictureElement=null,t.requestPictureInPicture=Xc,Object.defineProperty(t,"disablePictureInPicture",{get:Uc,set:Fc,enumerable:!0,configurable:!0}),document.exitPictureInPicture=Wc,document.addEventListener("webkitpresentationmodechanged",Gc,!0))}})),tc((function(){if(K.debug("VideoPlayPromise.install"),e.HTMLMediaElement){var t=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var e=t.apply(this);return e&&e.catch((function(){})),e}}})),tc((function(){if(e.HTMLVideoElement){var t=HTMLVideoElement.prototype;!t.getVideoPlaybackQuality&&"webkitDroppedFrameCount"in t&&(t.getVideoPlaybackQuality=Bc)}})),tc((function(){if(e.VTTCue)K.info("Using native VTTCue.");else if(e.TextTrackCue){var t=TextTrackCue.length;if(3==t)K.info("Using VTTCue polyfill from 3 argument TextTrackCue."),e.VTTCue=Yc;else if(6==t)K.info("Using VTTCue polyfill from 6 argument TextTrackCue."),e.VTTCue=jc;else{try{var r=!!Yc(1,2,"")}catch(e){r=!1}r&&(K.info("Using VTTCue polyfill from 3 argument TextTrackCue."),e.VTTCue=Yc)}}else K.error("VTTCue not available.")})),W("shaka.text.TtmlTextParser",Kc),Kc.prototype.parseInit=function(){},Kc.prototype.parseInit=Kc.prototype.parseInit,Kc.prototype.parseMedia=function(e,t){var r=ye(e),n=[],i=new DOMParser,a=null;if(""==r)return n;try{a=i.parseFromString(r,"text/xml")}catch(e){throw new H(2,2,2005,"Failed to parse TTML.")}if(a){if(r=a.getElementsByTagName("parsererror")[0])throw new H(2,2,2005,r.textContent);if(!(i=a.getElementsByTagName("tt")[0]))throw new H(2,2,2005,"TTML does not contain <tt> tag.");var o=Bn.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","frameRate"),s=Bn.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","subFrameRate"),u=Bn.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","frameRateMultiplier"),c=Bn.getAttributeNS(i,"http://www.w3.org/ns/ttml#parameter","tickRate");if(a=i.getAttribute("xml:space")||"default",r=Bn.getAttributeNS(i,"http://www.w3.org/ns/ttml#styling","extent"),"default"!=a&&"preserve"!=a)throw new H(2,2,2005,"Invalid xml:space value: "+a);a="default"==a,o=new _l(o,s,u,c),s=ul(i.getElementsByTagName("metadata")[0]),u=ul(i.getElementsByTagName("styling")[0]),c=ul(i.getElementsByTagName("layout")[0]);for(var l=[],d=0;d<c.length;d++){var f,p,m=c[d],y=u,g=r,v=new dr,b=m.getAttribute("xml:id");if(b)v.id=b,b=null,g&&(b=Jc.exec(g)||qc.exec(g)),g=b?Number(b[1]):null,b=b?Number(b[2]):null,(f=pl(m,y,"extent"))&&(null!=(f=(p=Jc.exec(f))||qc.exec(f))&&(v.width=null!=g?100*Number(f[1])/g:Number(f[1]),v.height=null!=b?100*Number(f[2])/b:Number(f[2]),v.widthUnits=p||null!=g?hr:0,v.heightUnits=p||null!=b?hr:0)),(m=pl(m,y,"origin"))&&(null!=(f=(p=Jc.exec(m))||qc.exec(m))&&(v.viewportAnchorX=null!=g?100*Number(f[1])/g:Number(f[1]),v.viewportAnchorY=null!=b?100*Number(f[2])/b:Number(f[2]),v.viewportAnchorUnits=p||null!=g?hr:0));else K.v("TtmlTextParser parser encountered a region with no id. Region will be ignored."),v=null;v&&l.push(v)}for(r=cl(i.getElementsByTagName("body")[0]),i=(r=h(r)).next();!i.done;i=r.next())(i=dl(i.value,t.periodStart,o,s,u,c,l,a,!1))&&n.push(i)}return n},Kc.prototype.parseMedia=Kc.prototype.parseMedia;var Hc,zc,Jc=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Qc=/^(\d+px|\d+em)$/,qc=/^(\d+)px (\d+)px$/,el=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,tl=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,rl=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,nl=/^(\d*(?:\.\d*)?)f$/,il=/^(\d*(?:\.\d*)?)t$/,al=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,ol={left:or,center:"center",right:"end",start:or,end:"end"},sl={left:"line-left",center:"center",right:"line-right"};function ul(e){var t=[];if(!e)return t;for(var r=h(e.childNodes),n=r.next();!n.done;n=r.next())(n=n.value).nodeType==Node.ELEMENT_NODE&&"br"!==n.nodeName&&(n=ul(n),t=t.concat(n));return t.length||t.push(e),t}function cl(e){if(!e)return[];for(var t=[],r=(e=h(e.childNodes)).next();!r.done;r=e.next())(r=r.value)instanceof Element&&(r.hasAttribute("begin")?t.push(r):t=t.concat(cl(r)));return t}function ll(e,t){for(var r="",n=h(e.childNodes),i=n.next();!i.done;i=n.next())"br"==(i=i.value).nodeName&&e.childNodes[0]!==i?r+="\n":i.childNodes&&0<i.childNodes.length?r+=ll(i,t):t?r+=i=(i=i.textContent.trim()).replace(/\s+/g," "):r+=i.textContent;return r}function dl(e,t,r,n,i,a,o,s,u){if(u&&"br"==e.nodeName)return(e=new Jt(0,0,"")).spacer=!0,e;var c=/^[\s\n]*$/.test(e.textContent),l=e.nodeType==Node.ELEMENT_NODE&&!e.hasAttribute("begin")&&!e.hasAttribute("end");if(e.nodeType!=Node.ELEMENT_NODE||l&&c||l&&!u)return null;s="default"==(e.getAttribute("xml:space")||(s?"default":"preserve")),c=vl(e.getAttribute("begin"),r),l=vl(e.getAttribute("end"),r);var d=vl(e.getAttribute("dur"),r);if(null==l&&null!=d&&(l=c+d),!u&&(null==c||null==l))throw new H(2,2,2001);if(c=u&&null==c?0:c+t,l=u&&null==l?0:l+t,d="",u=[],Array.from(e.childNodes).find((function(e){return e.nodeType===Node.TEXT_NODE&&/\S+/.test(e.textContent)})))d=ll(e,s);else for(var f=h(e.childNodes),p=f.next();!p.done;p=f.next())(p=dl(p.value,t,r,n,i,a,o,s,!0))&&(p.startTime=p.startTime||c,p.endTime=p.endTime||l,u.push(p));if((t=new Jt(c,l,d)).nestedCues=u,(a=gl(e,"region",a,"")[0])&&a.getAttribute("xml:id")){var m=a.getAttribute("xml:id");t.region=o.filter((function(e){return e.id==m}))[0]}return function(e,t,r,n,i){"rtl"==fl(t,r,i,"direction")&&(e.direction="rtl");var a=fl(t,r,i,"writingMode");"tb"==a||"tblr"==a?e.writingMode="vertical-lr":"tbrl"==a?e.writingMode="vertical-rl":"rltb"==a||"rl"==a?e.direction="rtl":a&&(e.direction=nr),(a=fl(t,r,i,"textAlign"))?(e.positionAlign=sl[a],e.lineAlign=ol[a],e.textAlign=er[a.toUpperCase()]):e.textAlign="start",(a=fl(t,r,i,"displayAlign"))&&(e.displayAlign=rr[a.toUpperCase()]);(a=fl(t,r,i,"color"))&&(e.color=a);(a=fl(t,r,i,"backgroundColor"))&&(e.backgroundColor=a);(a=fl(t,r,i,"fontFamily"))&&(e.fontFamily=a);(a=fl(t,r,i,"fontWeight"))&&"bold"==a&&(e.fontWeight=700),(a=fl(t,r,i,"wrapOption"))&&"noWrap"==a&&(e.wrapLine=!1),(a=fl(t,r,i,"lineHeight"))&&a.match(Qc)&&(e.lineHeight=a),(a=fl(t,r,i,"fontSize"))&&a.match(Qc)&&(e.fontSize=a),(a=fl(t,r,i,"fontStyle"))&&(e.fontStyle=lr[a.toUpperCase()]);if(n){a=n.getAttribute("imageType")||n.getAttribute("imagetype");var o=n.getAttribute("encoding");n=n.textContent.trim(),"PNG"==a&&"Base64"==o&&n&&(e.backgroundImage="data:image/png;base64,"+n)}(r=pl(r,i,"textDecoration"))&&hl(e,r),(t=ml(t,i,"textDecoration"))&&hl(e,t)}(t,e,a,n=gl(e,"backgroundImage",n,"#","http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt")[0],i),t}function hl(e,t){for(var r=t.split(" "),n=0;n<r.length;n++)switch(r[n]){case"underline":e.textDecoration.includes("underline")||e.textDecoration.push("underline");break;case"noUnderline":e.textDecoration.includes("underline")&&We(e.textDecoration,"underline");break;case"lineThrough":e.textDecoration.includes("lineThrough")||e.textDecoration.push("lineThrough");break;case"noLineThrough":e.textDecoration.includes("lineThrough")&&We(e.textDecoration,"lineThrough");break;case"overline":e.textDecoration.includes("overline")||e.textDecoration.push("overline");break;case"noOverline":e.textDecoration.includes("overline")&&We(e.textDecoration,"overline")}}function fl(e,t,r,n){return(e=ml(e,r,n))?e:pl(t,r,n)}function pl(e,t,r){if(!e)return null;for(var n=ul(e),i=0;i<n.length;i++){var a=Bn.getAttributeNS(n[i],"http://www.w3.org/ns/ttml#styling",r);if(a)return a}return yl(e,t,r)}function ml(e,t,r){var n=Bn.getAttributeNS(e,"http://www.w3.org/ns/ttml#styling",r);return n||yl(e,t,r)}function yl(e,t,r){e=gl(e,"style",t,"");for(var n=null,i=0;i<e.length;i++){var a=Bn.getAttributeNS(e[i],"http://www.w3.org/ns/ttml#styling",r);a||(a=ml(e[i],t,r)),a&&(n=a)}return n}function gl(e,t,r,n,i){var a=[];if(!e||1>r.length)return a;var o=e;for(e=null;o&&!(e=i?Bn.getAttributeNS(o,i,t):o.getAttribute(t))&&(o=o.parentNode)instanceof Element;);if(t=e)for(i=(t=h(t=t.split(" "))).next();!i.done;i=t.next())for(i=i.value,o=(e=h(r)).next();!o.done;o=e.next())if(n+(o=o.value).getAttribute("xml:id")==i){a.push(o);break}return a}function vl(e,t){var r=null;if(el.test(e)){r=el.exec(e);var n=Number(r[1]),i=Number(r[2]),a=Number(r[3]),o=Number(r[4]);r=(a+=(o+=(Number(r[5])||0)/t.h)/t.frameRate)+60*i+3600*n}else tl.test(e)?r=bl(tl,e):rl.test(e)?r=bl(rl,e):nl.test(e)?(r=nl.exec(e),r=Number(r[1])/t.frameRate):il.test(e)?(r=il.exec(e),r=Number(r[1])/t.g):al.test(e)&&(r=bl(al,e));return r}function bl(e,t){var r=e.exec(t);return null==r||""==r[0]?null:(Number(r[4])||0)/1e3+(Number(r[3])||0)+60*(Number(r[2])||0)+3600*(Number(r[1])||0)}function _l(e,t,r,n){this.frameRate=Number(e)||30,this.h=Number(t)||1,this.g=Number(n),0==this.g&&(this.g=e?this.frameRate*this.h:1),r&&(e=/^(\d+) (\d+)$/g.exec(r))&&(this.frameRate*=Number(e[1])/Number(e[2]))}function Al(){this.g=new Kc}function Tl(){}function El(e,t,r){var n;if(n=/^align:(start|middle|center|end|left|right)$/.exec(t))t=n[1],e.textAlign="middle"==t?qt:er[t.toUpperCase()];else if(n=/^vertical:(lr|rl)$/.exec(t))e.writingMode="lr"==n[1]?"vertical-lr":"vertical-rl";else if(n=/^size:([\d.]+)%$/.exec(t))e.size=Number(n[1]);else if(n=/^position:([\d.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(t))e.position=Number(n[1]),n[2]&&(t=n[2],e.positionAlign="line-left"==t||"start"==t?"line-left":"line-right"==t||"end"==t?"line-right":"center");else{if(!(n=/^region:(.*)$/.exec(t))){e:{if(r=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(t))e.lineInterpretation=1,e.line=Number(r[1]),r[2]&&(e.lineAlign=sr[r[2].toUpperCase()]);else{if(!(r=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(t))){e=!1;break e}e.lineInterpretation=ar,e.line=Number(r[1]),r[2]&&(e.lineAlign=sr[r[2].toUpperCase()])}e=!0}return e}(t=function(e,t){var r=e.filter((function(e){return e.id==t}));return r.length?r[0]:(K.v("VTT parser could not find a region with id: ",t," The region will be ignored."),null)}(r,n[1]))&&(e.region=t)}return!0}function Sl(e){if(null==(e=Xi(e,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g)))return null;var t=Number(e[2]),r=Number(e[3]);return 59<t||59<r?null:Number(e[4])/1e3+r+60*t+3600*(Number(e[1])||0)}function $l(){this.g=null}function Il(e,t,r){var n,i,a;return(new Zn).box("payl",Gn((function(e){n=ye(e)}))).box("iden",Gn((function(e){i=ye(e)}))).box("sttg",Gn((function(e){a=ye(e)}))).parse(e),n?function(e,t,r,n,i){if(e=new Jt(n,i,e),t&&(e.id=t),r)for(t=new Ni(r),r=Wi(t);r;)El(e,r,[])||K.v("VTT parser encountered an invalid VTT setting: ",r," The setting will be ignored."),Gi(t),r=Wi(t);return e}(n,i,a,t,r):null}
|
|
19
|
+
/*
|
|
20
|
+
@license
|
|
21
|
+
EME Encryption Scheme Polyfill
|
|
22
|
+
Copyright 2019 Google LLC
|
|
23
|
+
SPDX-License-Identifier: Apache-2.0
|
|
24
|
+
*/
|
|
25
|
+
function wl(){}function Rl(){Hc?console.debug("EmeEncryptionSchemePolyfill: Already installed."):navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration?(Hc=navigator.requestMediaKeySystemAccess,console.debug("EmeEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.requestMediaKeySystemAccess=kl):console.debug("EmeEncryptionSchemePolyfill: EME not found")}function kl(e,t){var r=this;return p((function n(){var i;return M(n,(function(n){switch(n.s){case 1:return console.assert(r==navigator,'bad "this" for requestMediaKeySystemAccess'),S(n,Hc.call(r,e,t),2);case 2:return Vl(i=n.B)?(console.debug("EmeEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.requestMediaKeySystemAccess=Hc,n.return(i)):(console.debug("EmeEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.requestMediaKeySystemAccess=Pl,n.return(Pl.call(r,e,t)))}}))}))}function Pl(e,t){var r=this;return p((function n(){var i,a,o,s,u,c,l,d;return M(n,(function(n){switch(n.s){case 1:console.assert(r==navigator,'bad "this" for requestMediaKeySystemAccess'),i=Zl(e),a=[];for(var f=h(t),p=f.next();!p.done;p=f.next())o=p.value,s=Cl(o.videoCapabilities,i),u=Cl(o.audioCapabilities,i),o.videoCapabilities&&o.videoCapabilities.length&&!s.length||o.audioCapabilities&&o.audioCapabilities.length&&!u.length||((c=Object.assign({},o)).videoCapabilities=s,c.audioCapabilities=u,a.push(c));if(!a.length)throw(l=Error("Unsupported keySystem or supportedConfigurations.")).name="NotSupportedError",l.code=DOMException.NOT_SUPPORTED_ERR,l;return S(n,Hc.call(r,e,a),2);case 2:return d=n.B,n.return(new Ml(d,i))}}))}))}function Cl(e,t){return e?e.filter((function(e){return!e.encryptionScheme||e.encryptionScheme==t})):e}function xl(){}function Ll(){zc?console.debug("McEncryptionSchemePolyfill: Already installed."):navigator.mediaCapabilities?(zc=navigator.mediaCapabilities.decodingInfo,console.debug("McEncryptionSchemePolyfill: Waiting to detect encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=Ol):console.debug("McEncryptionSchemePolyfill: MediaCapabilities not found")}function Ol(e){var t=this;return p((function r(){var n,i;return M(r,(function(r){switch(r.s){case 1:return console.assert(t==navigator.mediaCapabilities,'bad "this" for decodingInfo'),S(r,zc.call(t,e),2);case 2:return n=r.B,e.keySystemConfiguration?(i=n.keySystemAccess)&&Vl(i)?(console.debug("McEncryptionSchemePolyfill: Native encryptionScheme support found."),navigator.mediaCapabilities.decodingInfo=zc,r.return(n)):(console.debug("McEncryptionSchemePolyfill: No native encryptionScheme support found. Patching encryptionScheme support."),navigator.mediaCapabilities.decodingInfo=Dl,r.return(Dl.call(t,e))):r.return(n)}}))}))}function Dl(e){var t=this;return p((function r(){var n,i,a,o,s,u,c,l,d;return M(r,(function(r){switch(r.s){case 1:return console.assert(t==navigator.mediaCapabilities,'bad "this" for decodingInfo'),n=null,e.keySystemConfiguration&&(i=e.keySystemConfiguration,a=i.keySystem,o=i.audio&&i.audio.encryptionScheme,s=i.video&&i.video.encryptionScheme,n=Zl(a),u={powerEfficient:!1,smooth:!1,supported:!1,keySystemAccess:null,configuration:e},o&&o!=n||s&&s!=n)?r.return(u):S(r,zc.call(t,e),2);case 2:if((c=r.B).keySystemAccess){c.keySystemAccess=new Ml(c.keySystemAccess,n),r.I(3);break}if(!e.keySystemConfiguration){r.I(3);break}var h=e.keySystemConfiguration,f=[],p=[];return h.audio&&f.push({robustness:h.audio.robustness||"",contentType:e.audio.contentType}),h.video&&p.push({robustness:h.video.robustness||"",contentType:e.video.contentType}),h={initDataTypes:h.initDataType?[h.initDataType]:[],distinctiveIdentifier:h.distinctiveIdentifier,persistentState:h.persistentState,sessionTypes:h.sessionTypes},f.length&&(h.audioCapabilities=f),p.length&&(h.videoCapabilities=p),l=h,d=c,S(r,navigator.requestMediaKeySystemAccess(e.keySystemConfiguration.keySystem,[l]),5);case 5:d.keySystemAccess=r.B;case 3:return r.return(c)}}))}))}function Ml(e,t){this.h=e,this.g=t,this.keySystem=e.keySystem}function Zl(e){return e.startsWith("com.widevine")||e.startsWith("com.microsoft")||e.startsWith("com.adobe")||e.startsWith("org.w3")?"cenc":e.startsWith("com.apple")?"cbcs-1-9":(console.warn("EmeEncryptionSchemePolyfill: Unknown key system:",e,"Please contribute!"),null)}function Vl(e){var t=(e=e.getConfiguration()).audioCapabilities&&e.audioCapabilities[0];return!(!(e=e.videoCapabilities&&e.videoCapabilities[0]||t)||void 0===e.encryptionScheme)}function Nl(){}function Gl(){Rl(),Ll()}mr["application/ttml+xml"]=Kc,W("shaka.text.Mp4TtmlParser",Al),Al.prototype.parseInit=function(e){var t=!1;if((new Zn).box("moov",Vn).box("trak",Vn).box("mdia",Vn).box("minf",Vn).box("stbl",Vn).ma("stsd",Nn).box("stpp",(function(e){t=!0,e.parser.stop()})).parse(e),!t)throw new H(2,2,2007)},Al.prototype.parseInit=Al.prototype.parseInit,Al.prototype.parseMedia=function(e,t){var r=!1,n=[];if((new Zn).box("mdat",Gn(function(e){r=!0,n=n.concat(this.g.parseMedia(e,t))}.bind(this))).parse(e),!r)throw new H(2,2,2007);return n},Al.prototype.parseMedia=Al.prototype.parseMedia,mr['application/mp4; codecs="stpp"']=Al,mr['application/mp4; codecs="stpp.ttml.im1t"']=Al,mr['application/mp4; codecs="stpp.TTML.im1t"']=Al,W("shaka.text.VttTextParser",Tl),Tl.prototype.parseInit=function(){},Tl.prototype.parseInit=Tl.prototype.parseInit,Tl.prototype.parseMedia=function(e,t){var r=ye(e);if(r=(r=r.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n")).split(/\n{2,}/m),!/^WEBVTT($|[ \t\n])/m.test(r[0]))throw new H(2,2,2e3);var n=t.segmentStart;if(null==n&&(n=0,r[0].includes("X-TIMESTAMP-MAP"))){var i=r[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),a=r[0].match(/MPEGTS:(\d+)/m);if(i&&a){if(null==(n=Sl(new Ni(i[1]))))throw new H(2,2,2e3);n=t.periodStart+(Number(a[1])/9e4-n)}}a=[];var o=r[0].split("\n");for(i=1;i<o.length;i++)if(/^Region:/.test(o[i])){var s=new Ni(o[i]),u=new dr;Wi(s),Gi(s);for(var c=Wi(s);c;){var l;e:{var d=u,h=c;if(l=/^id=(.*)$/.exec(h))d.id=l[1];else if(l=/^width=(\d{1,2}|100)%$/.exec(h))d.width=Number(l[1]);else if(l=/^lines=(\d+)$/.exec(h))d.height=Number(l[1]),d.heightUnits=2;else if(l=/^regionanchor=(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(h))d.regionAnchorX=Number(l[1]),d.regionAnchorY=Number(l[2]);else if(l=/^viewportanchor=(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(h))d.viewportAnchorX=Number(l[1]),d.viewportAnchorY=Number(l[2]);else{if(!/^scroll=up$/.exec(h)){l=!1;break e}d.scroll="up"}l=!0}l||K.v("VTT parser encountered an invalid VTTRegion setting: ",c," The setting will be ignored."),Gi(s),c=Wi(s)}a.push(u)}for(i=[],s=1;s<r.length;s++){if(l=o=r[s].split("\n"),d=n,o=a,1==l.length&&!l[0]||/^NOTE($|[ \t])/.test(l[0])||"STYLE"==l[0])o=null;else{u=null,l[0].includes("--\x3e")||(u=l[0],l.splice(0,1)),h=Sl(c=new Ni(l[0]));var f=Xi(c,/[ \t]+--\x3e[ \t]+/g),p=Sl(c);if(null==h||null==f||null==p)throw new H(2,2,2001);for(l=new Jt(h+d,p+d,l.slice(1).join("\n").trim()),Gi(c),d=Wi(c);d;)El(l,d,o)||K.v("VTT parser encountered an invalid VTT setting: ",d," The setting will be ignored."),Gi(c),d=Wi(c);null!=u&&(l.id=u),o=l}o&&i.push(o)}return i},Tl.prototype.parseMedia=Tl.prototype.parseMedia,mr["text/vtt"]=Tl,mr['text/vtt; codecs="vtt"']=Tl,mr['text/vtt; codecs="wvtt"']=Tl,W("shaka.text.Mp4VttParser",$l),$l.prototype.parseInit=function(e){var t=!1;if((new Zn).box("moov",Vn).box("trak",Vn).box("mdia",Vn).ma("mdhd",function(e){0==e.version?(e.reader.U(4),e.reader.U(4),this.g=e.reader.N(),e.reader.U(4)):(e.reader.U(8),e.reader.U(8),this.g=e.reader.N(),e.reader.U(8)),e.reader.U(4)}.bind(this)).box("minf",Vn).box("stbl",Vn).ma("stsd",Nn).box("wvtt",(function(){t=!0})).parse(e),!this.g)throw new H(2,2,2008);if(!t)throw new H(2,2,2008)},$l.prototype.parseInit=$l.prototype.parseInit,$l.prototype.parseMedia=function(e,t){var r=this;if(!this.g)throw K.error("No init segment for MP4+VTT!"),new H(2,2,2008);var n,i=0,a=[],o=[],s=!1,u=!1,c=!1,l=null;if((new Zn).box("moof",Vn).box("traf",Vn).ma("tfdt",(function(e){s=!0,i=0==e.version?e.reader.N():e.reader.Pb()})).ma("tfhd",(function(e){var t=e.flags;(e=e.reader).U(4),1&t&&e.U(8),2&t&&e.U(4),l=8&t?e.N():null})).ma("trun",(function(e){u=!0;var t=e.version,r=e.flags,n=(e=e.reader).N();1&r&&e.U(4),4&r&&e.U(4);for(var i=[],o=0;o<n;o++){var s={duration:null,sampleSize:null,Sd:null};256&r&&(s.duration=e.N()),512&r&&(s.sampleSize=e.N()),1024&r&&e.U(4),2048&r&&(s.Sd=0==t?e.N():e.De()),i.push(s)}a=i})).box("mdat",Gn((function(e){c=!0,n=e}))).parse(e),!c&&!s&&!u)throw new H(2,2,2008);var d=i,h=new On(new DataView(n.buffer,n.byteOffset,n.byteLength),0);return a.forEach((function(e){var n=e.duration||l,a=e.Sd?i+e.Sd:d;d=a+(n||0);var s=0;do{var u=h.N();s+=u;var c=h.N(),f=null;"vttc"==(c=Wn(c))?8<u&&(f=h.mb(u-8)):("vtte"!=c&&K.error("Unknown box "+c+"! Skipping!"),h.U(u-8)),n?f&&o.push(Il(f,t.periodStart+a/r.g,t.periodStart+d/r.g)):K.error("WVTT sample duration unknown, and no default found!")}while(e.sampleSize&&s<e.sampleSize)})),o.filter(le.Ra)},$l.prototype.parseMedia=$l.prototype.parseMedia,mr['application/mp4; codecs="wvtt"']=$l,W("shaka.util.Dom.createHTMLElement",(function(e){return document.createElement(e)})),W("shaka.util.Dom.createVideoElement",(function(){var e=document.createElement("video");return e.muted=!0,e.width=600,e.height=400,e})),W("shaka.util.Dom.asHTMLElement",(function(e){return e})),W("shaka.util.Dom.asHTMLMediaElement",(function(e){return e})),W("shaka.util.Dom.removeAllChildren",(function(e){for(;e.firstChild;)e.removeChild(e.firstChild)})),W("EmeEncryptionSchemePolyfill",wl),wl.install=Rl,W("McEncryptionSchemePolyfill",xl),xl.install=Ll,Ml.prototype.getConfiguration=function(){var e=this.h.getConfiguration();if(e.videoCapabilities)for(var t=h(e.videoCapabilities),r=t.next();!r.done;r=t.next())r.value.encryptionScheme=this.g;if(e.audioCapabilities)for(r=(t=h(e.audioCapabilities)).next();!r.done;r=t.next())r.value.encryptionScheme=this.g;return e},Ml.prototype.createMediaKeys=function(){return this.h.createMediaKeys()},W("EncryptionSchemePolyfills",Nl),Nl.install=Gl,void 0!==r&&r.gf&&(r.gf=Nl)}.call(r,t,t,void 0),r.shaka)e[n]=r.shaka[n]}()}(shakaPlayer_compiled);var Shaka=getDefaultExportFromCjs(shakaPlayer_compiled);class ShakaJsPlugin extends BasePlugin{constructor(e){super(e),__publicField(this,"onAdaptation_",(()=>{this.shakaplayer.getVariantTracks().forEach((function(e){if(e.active)for(let t=0;t<this.content.length;++t){const r=this.content[t];r.value===e.id?r.selected=!0:r.selected=!1}}))})),Shaka.polyfill.installAll()}static get pluginName(){return"ShakaPlugin"}static get defaultConfig(){return{shakaOpts:{}}}static isSupported(){return Shaka.Player.isBrowserSupported()}afterCreate(){this.content=[],this.url=this.player.config.url,Shaka.Player.isBrowserSupported()&&this.on(URL_CHANGE,(e=>{/^blob/.test(e)||(this.url=e,this.loadUrl(e))}))}beforePlayerInit(){if(!Shaka.Player.isBrowserSupported())throw new Error("Browser not supported!");this._initShaka()}destroy(){this.shakaplayer&&(this.shakaplayer.destroy(),this.shakaplayer=null)}_initShaka(){const{player:e}=this;this.shakaplayer=new Shaka.Player(e.video),this.shakaplayer.addEventListener("error",(e=>{console.error("Error code",e.detail.code,"object",e.detail)})),this.config.shakaOpts&&this.shakaplayer.configure(this.config.shakaOpts),this.shakaplayer.getNetworkingEngine().registerRequestFilter(((e,t)=>{e===Shaka.net.NetworkingEngine.RequestType.LICENSE&&(t.headers["CWIP-Auth-Header"]="VGhpc0lzQVRlc3QK")})),this.shakaplayer.addEventListener("adaptation",this.onAdaptation_);this.shakaplayer.configure({abr:{enabled:!1}}),this.loadUrl(this.url)}loadUrl(e){this.shakaplayer.load(e).then((()=>{console.log(" this.onTracksChanged_"),this.onTracksChanged_()})).catch((e=>{console.trace("event",e),console.error("Error code",e.detail.code,"object",e.detail)}))}onTracksChanged_(){this.updateVariantTracks_()}updateVariantTracks_(){const e=this.shakaplayer.getVariantTracks();e.sort((function(e,t){return e.bandwidth-t.bandwidth})),this.updateTrackOptions_(e)}updateTrackOptions_(e){const t={variant:function(e){let t="";return e.width&&e.height&&(t+=e.height+"P"),t}};this.content=[],e.forEach((e=>{const r={};r.textContent=t[e.type](e),r.track=e,r.value=e.id,r.selected=e.active,this.content.push(r)})),this.updateDefinition()}updateDefinition(){"mobile"!==sniffer.device&&console.log("updateDefinition",this.content)}}function ownKeys2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys2(Object(r),!0).forEach((function(t){_defineProperty$2(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys2(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime$1(){_regeneratorRuntime$1=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,d;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function asyncGeneratorStep$1(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator$1(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep$1(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep$1(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck$2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$2(e,t,r){return t&&_defineProperties$2(e.prototype,t),r&&_defineProperties$2(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$2(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits$1(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf$1(e,t)}function _getPrototypeOf$1(e){return(_getPrototypeOf$1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf$1(e,t){return(_setPrototypeOf$1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct$1(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _assertThisInitialized$1(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn$1(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized$1(e)}function _createSuper$1(e){var t=_isNativeReflectConstruct$1();return function(){var r,n=_getPrototypeOf$1(e);if(t){var i=_getPrototypeOf$1(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn$1(this,r)}}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf$1(e)););return e}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=_superPropBase(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},_get.apply(this,arguments)}function _slicedToArray$1(e,t){return _arrayWithHoles$1(e)||_iterableToArrayLimit$1(e,t)||_unsupportedIterableToArray$1(e,t)||_nonIterableRest$1()}function _toConsumableArray$1(e){return _arrayWithoutHoles$1(e)||_iterableToArray$1(e)||_unsupportedIterableToArray$1(e)||_nonIterableSpread$1()}function _arrayWithoutHoles$1(e){if(Array.isArray(e))return _arrayLikeToArray$1(e)}function _arrayWithHoles$1(e){if(Array.isArray(e))return e}function _iterableToArray$1(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit$1(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}function _unsupportedIterableToArray$1(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray$1(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray$1(e,t):void 0}}function _arrayLikeToArray$1(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread$1(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest$1(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var $$3=_export,fails=fails$V,getOwnPropertyNames4=objectGetOwnPropertyNamesExternal.f,FAILS_ON_PRIMITIVES=fails((function(){return!Object.getOwnPropertyNames(1)}));$$3({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES},{getOwnPropertyNames:getOwnPropertyNames4});var $$2=_export,parseFloat$1=numberParseFloat;$$2({target:"Number",stat:!0,forced:Number.parseFloat!=parseFloat$1},{parseFloat:parseFloat$1});var $$1=_export,fill3=arrayFill$1,addToUnscopables=addToUnscopables$5;$$1({target:"Array",proto:!0},{fill:fill3}),addToUnscopables("fill");var ele,webm="data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABBycc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AAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw",oldIOS=function(){return"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},nativeWakeLock=function(){return"wakeLock"in navigator},NoSleep=function(){function e(){var t=this;_classCallCheck$2(this,e),this.enabled=!1,nativeWakeLock()?(this._wakeLock=null,this.handleVisibilityChange=function(){null!==t._wakeLock&&t.visible&&t.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):oldIOS()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"mp4",mp4),this._addSourceToVideo(this.noSleepVideo,"webm",webm),this.noSleepVideo.addEventListener("loadedmetadata",(function(){t.noSleepVideo&&(t.noSleepVideo.duration<=1?t.noSleepVideo.setAttribute("loop",""):(t.onTimeupdate=function(){t.noSleepVideo.currentTime>.5&&(t.noSleepVideo.currentTime=Math.random())},t.noSleepVideo.addEventListener("timeupdate",t.onTimeupdate)))})))}return _createClass$2(e,[{key:"_addSourceToVideo",value:function(e,t,r){var n=document.createElement("source");n.src=r,n.type="video/".concat(t),e.appendChild(n)}},{key:"visible",get:function(){return"visible"===document.visibilityState}},{key:"isEnabled",get:function(){return this.enabled}},{key:"enable",value:function(){var e,t=this;if(nativeWakeLock()&&this.visible)return navigator.wakeLock.request("screen").then((function(e){t._wakeLock=e,t.enabled=!0,t._wakeLock.addEventListener("release",(function(){}))})).catch((function(){t.enabled=!1}));if(oldIOS())return this.disable(),console.warn("\n NoSleep enabled for older iOS devices. This can interrupt\n active or long-running network requests from completing successfully.\n See https://github.com/richtr/NoSleep.js/issues/15 for more details.\n "),this.noSleepTimer=window.setInterval((function(){document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();if(null!==(e=this.noSleepVideo)&&void 0!==e&&e.paused){var r=this.noSleepVideo.play();return r&&r.then((function(e){return t.enabled=!0,e})).catch((function(e){console.log("noSleep: ",e.message),t.enabled=!1}))}}},{key:"disable",value:function(){nativeWakeLock()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):oldIOS()?this.noSleepTimer&&(console.warn("\n NoSleep now disabled for older iOS devices.\n "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}},{key:"toPlay",value:function(){if(this.noSleepVideo&&this.noSleepVideo.paused){var e=performance.now();this.lastTs||(this.lastTs=e),e-this.lastTs>1e4&&(this.enable(),this.lastTs=e)}}},{key:"destroy",value:function(){this.disable(),this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange)),this.onTimeupdate&&this.noSleepVideo.removeEventListener("timeupdate",this.onTimeupdate),this.noSleepVideo=null}}]),e}();function initBgSilenceAudio(){if(!document.querySelector("#hackAudioPP")){var e=document.createElement("div");e.innerHTML="<audio id='hackAudioPP'></audio>",document.body.appendChild(e);var t=e.children.item(0);t.controls=!1,t.preload="auto",t.innerHTML="<source src=".concat("data:audio/mpeg;base64,//uQxAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAACcQCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA//////////////////////////////////////////////////////////////////8AAABhTEFNRTMuMTAwA8MAAAAAAAAAABQgJAUHQQAB9AAAAnGMHkkIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//sQxAADgnABGiAAQBCqgCRMAAgEAH///////////////7+n/9FTuQsQH//////2NG0jWUGlio5gLQTOtIoeR2WX////X4s9Atb/JRVCbBUpeRUq//////////////////9RUi0f2jn/+xDECgPCjAEQAABN4AAANIAAAAQVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ==",' type="audio/mpeg"></source>'),t.muted=!0,t.loop=!0,t.play().catch((function(){}))}}function playSlienceAudio(){var e=ele||(ele=document.querySelector("#hackAudioPP"));e?!1===e.paused&&!1===e.muted||(e.muted=!1,e.play().catch((function(e){console.log("bgAudio: ",e.message)}))):initBgSilenceAudio()}function pauseSlienceAudio(){var e=ele||(ele=document.querySelector("#hackAudioPP"));e&&e.pause()}var DevLogger=function(){function e(){var t=this;_classCallCheck$2(this,e);try{var r=/xgd=(\d)/.exec(document.cookie);this._status=!!r,this._level=r&&r[1]}catch(e){this._status=!1}["group","groupEnd","log","warn","error"].forEach((function(e){t[e]=function(r,n,i,a,o,s,u,c,l,d){var h;if(t._status){var f=r,p=[n,i,a,o,s,u,c,l,d].filter((function(e){return void 0!==e}));(h=console)[e].apply(h,["["+f+"]:"].concat(_toConsumableArray$1(p)))}}}))}return _createClass$2(e,[{key:"enable",get:function(){return this._status}},{key:"long",get:function(){return"2"===this._level}}]),e}(),logger=new DevLogger;function debounce(e,t){var r=Date.now(),n=null,i=!0;return function(){for(var a=arguments.length,o=new Array(a),s=0;s<a;s++)o[s]=arguments[s];var u=Date.now();i&&(r=Date.now(),i=!1,e.apply(void 0,o)),u-r>t?(r=u,e.apply(void 0,o)):(n&&window.clearTimeout(n),n=setTimeout((function(){e.apply(void 0,o)}),t))}}function getAvcc(e,t){if(e&&t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r}}function promiseDelayed(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.resolve=e,r.reject=t,r}var EleName="xg-video",simdCanused=!1;try{simdCanused=WebAssembly&&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]))}catch(e){}var decodeCapacity={preloadDecoder:!1,reuseWasmDecoder:!0,reuseMseForAudio:!1,preciseSeek:0,h264WithWebcodec:!0,lowDecodeThreshold:100,wasmFallbackToAsm:!1,audioWithMse:!0,canUseThreadMode:!1,disabledWhenErrorOccur:!0,disabledDuration:43200,evaluateVVCount:0,disabledByLowdecodePrecent:.5,maxDecodeOnceWasm:simdCanused?6:8,maxDecodeOnceFirstTime:8,maxDecodeOnceWebcodec:20};function getEleName(){return EleName}function setEleName(e){EleName=e}function setDecodeCapacity(e){decodeCapacity=Object.assign({},decodeCapacity,e)}function getDecodeCapacaity(){return decodeCapacity}function getDecoderUrls(){var e="undefined"!=typeof customElements&&customElements.get(EleName);return e?{H264_DECODER_URL:e.h264Url,ASM_H264_DECODER_URL:e.h264AsmUrl,H265_DECODER_URL:e.h265Url,H265_THREAD_DECODER_URL:e.h265ThreadUrl,H265_SIMD_DECODER_URL:e.h265SimdUrl,ASM_H265_DECODER_URL:e.h265AsmUrl}:{}}function simdSupported(){if("undefined"==typeof customElements)return!1;var e=customElements.get(EleName);return simdCanused&&!(null==e||!e.h265SimdUrl)}function threadSupported(){if("undefined"==typeof customElements)return!1;var e=customElements.get(EleName);return!!window.SharedArrayBuffer&&!(null==e||!e.h265ThreadUrl)}var _softDecodeSupport=!1;try{var _localStorage,_localStorage$getItem;_softDecodeSupport="1"===(null===(_localStorage=localStorage)||void 0===_localStorage||null===(_localStorage$getItem=_localStorage.getItem)||void 0===_localStorage$getItem?void 0:_localStorage$getItem.call(_localStorage,"_sds"))}catch(e){}function softDecodeSupported(){if("undefined"==typeof customElements)return!1;if(_softDecodeSupport)return!0;var e=!1,t=!1;try{var r=new(window.AudioContext||window.webkitAudioContext);r.close(),r=null,e=!0}catch(e){}try{for(var n=document.createElement("canvas"),i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],a=0;a<i.length;a++){var o=n.getContext(i[a]);if(o){o=null,n=null,t=!0;break}}_softDecodeSupport=e&&t&&!!WebAssembly,localStorage.setItem("_sds",_softDecodeSupport?1:0)}catch(e){}return _softDecodeSupport}function getDeviceCapacity(){return{simd:simdCanused,thread:threadSupported(),nbCpu:navigator.hardwareConcurrency}}var vv=0,lowdecodeVV=0,lowdecodePercent=0,disabledHevc=!1;function updateVV(){vv++}function getVV(){return vv}function updateLowdecodeVV(){lowdecodeVV++}function getLowdecodeVV(){return lowdecodeVV}function getLowdecodePercent(){return lowdecodePercent}function _getDisabledByEvaluateVV(){return!!disabledHevc||0!==getDecodeCapacaity().evaluateVVCount&&(vv===getDecodeCapacaity().evaluateVVCount&&(lowdecodePercent=lowdecodeVV/vv),lowdecodePercent>=getDecodeCapacaity().disabledByLowdecodePrecent&&(disabledHevc=!0),disabledHevc)}function persistenceDisabledStatus(e){localStorage.setItem("xgv_dis",e),2===e&&localStorage.setItem("xgv_dist",(new Date).getTime())}function getDisabledStatus(){if(!0===_getDisabledByEvaluateVV())return!0;var e=localStorage.getItem("xgv_dis");if(!e)return!1;if("1"===e)return!0;if("2"===e){var t=localStorage.getItem("xgv_dist")||0;if(t=Number(t),((new Date).getTime()-t)/1e3<getDecodeCapacaity().disabledDuration)return!0;cleanDisabledStatus()}}function cleanDisabledStatus(){localStorage.removeItem("xgv_dist"),localStorage.removeItem("xgv_dis")}var VIDEO_EVENTS={WAITING:0,CANPLAY:1,PLAY:2,PLAYING:3,PAUSE:4,SEEKING:5,SEEKED:6,LOADEDDATA:7,LOADEDMETADATA:8,TIMEUPDATE:9,DURATION_CHANGE:10,VOLUME_CHANGE:11,PROGRESS:12,ERROR:13,ENDED:14,RESIZE:15,LOADSTART:16,DECODE_FPS:17,LOW_DECODE:18,LARGE_AV_GAP:19,FIRST_FRAME:20},VIDEO_EVENTS_ARR=["waiting","canplay","play","playing","pause","seeking","seeked","loadeddata","loadedmetadata","timeupdate","durationchange","volumechange","progress","error","ended","resize","loadstart","decodefps","lowdecode","largeavgap","firstframe"],Events$2={AUDIO:{AUDIO_READY:"audio_ready",AUDIO_NOT_ALLOWED_AUTOPLAY:"audio_not_allowed_autoplay",AUDIO_WAITING:"audio_waiting",AUDIO_SYNC_DTS:"audio_sync_dts"},VIDEO:{VIDEO_DECODER_INIT:"video_decode_init",VIDEO_READY:"video_ready",VIDEO_WAITING:"video_waiting",AUTO_RUN:"auto_run",DECODE_LOW_FPS:"decode_low_fps",UPDATE_VIDEO_FILLTYPE:"update_video_filltype",UPDATE_VIDEO_COVER_POSITION:"update_video_cover_position"},TIMELINE:{PLAY_EVENT:"play_event",SET_METADATA:"set_metadata",APPEND_CHUNKS:"append_chunks",START_RENDER:"start_render",DO_PLAY:"do_play",DO_PAUSE:"do_pause",DO_SEEK:"do_seek",SET_PLAYBACKRATE:"set_playbackrate",SYNC_DTS:"sync_dts",RESET_BASE_DTS:"reset_base_dts",UPDATE_VOLUME:"update_volume",SINGLE_TRACK:"single_track",DESTROY:"destroy",READY:"ready",UPDATE_GL_OPTIONS:"update_gl_options",SET_VIDEO_DURATION:"set_video_duration",SET_PLAY_MODE:"set_play_mode",UPDATE_CAPABILITY_LEVEL:"update_capability_level",INNER_DEGRADE:"inner_degrade",ADJUST_SEEK_TIME:"adjust_seek_time",CHASE_FRAME:"chase_frame",END_OF_STREAM:"end_of_stream",UPDATE_SEGMENT_END:"update_segment_end"},VIDEO_EVENTS:VIDEO_EVENTS,DECODE_EVENTS:{INIT:"init",READY:"decoderready",REMUX:"remux",INIT_FAILED:"initfailed",DATAREADY:"dataReady",PLAY_FAILED:"playfailed",FRAGMENT_END:"fragmentEnd",APPEND_VIDEO:"appendVideo",FIRST_FRAME:"firstFrame",DECODED:"decoded",RENDE_END:"rendeEnd",CHASE_VIDEO_FRAME:"chaseVideoFrame",CHASE_VIDEO_FRAME_END:"chaseVideoFrameEnd",CHASE_AUDIO_FRAME:"chaseAudioFrame",INIT_SEGMENT:"initSegment",MEDIA_SEGMENT:"mediaSegment",FRAME_MAX_COUNY:"frameMaxCount",FRAME_MIN_COUNY:"frameMinCount"}},BaseRender=function(e){_inherits$1(r,EventEmitter$1);var t=_createSuper$1(r);function r(e,n){var i;return _classCallCheck$2(this,r),(i=t.call(this))._config=e,i._parent=n,i._meta=null,i._ready=!1,i._isLive=!0,i._innerDegrade=!1,i._singleTrack=-1,i}return _createClass$2(r,[{key:"analyse",get:function(){return this._parent.analyse}},{key:"isLive",get:function(){return this._isLive}},{key:"innerDegrade",get:function(){return this._innerDegrade}},{key:"noAudio",get:function(){return 1===this._singleTrack||2===this._singleTrack}},{key:"noVideo",get:function(){return 3===this._singleTrack}},{key:"duration",get:function(){return this._timeRange.duration},set:function(e){this._timeRange&&(this._timeRange.duration=e)}},{key:"_bindEvents",value:function(){var e=this;this._parent.on(Events$2.TIMELINE.APPEND_CHUNKS,this._appendChunk.bind(this)),this._parent.on(Events$2.TIMELINE.RESET_BASE_DTS,this._resetDts.bind(this)),this._parent.on(Events$2.TIMELINE.START_RENDER,this._startRender.bind(this)),this._parent.on(Events$2.TIMELINE.DO_PLAY,this._doPlay.bind(this)),this._parent.on(Events$2.TIMELINE.DO_PAUSE,this._doPause.bind(this)),this._parent.on(Events$2.TIMELINE.DO_SEEK,this._doSeek.bind(this)),this._parent.on(Events$2.TIMELINE.DESTROY,this._destroy.bind(this)),this._parent.on(Events$2.TIMELINE.CHASE_FRAME,this._doChaseFrame.bind(this)),this._parent.on(Events$2.TIMELINE.SINGLE_TRACK,(function(t){e._singleTrack=t})),this._parent.on(Events$2.TIMELINE.SET_PLAY_MODE,(function(t){e._isLive="LIVE"===t})),this._parent.on(Events$2.TIMELINE.INNER_DEGRADE,(function(){e._innerDegrade=!0})),this._parent.on(Events$2.TIMELINE.SET_VIDEO_DURATION,(function(t){e.duration=t}))}}]),r}(),TOLERANCE$2=.5,AudioTimeRange=function(){function e(t){_classCallCheck$2(this,e),this.TAG="AudioTimeRange",this._parent=t,this._buffers=[],this._duration=0,this._baseDts=0,this._lastBuffer=null}return _createClass$2(e,[{key:"isLive",get:function(){return this._parent.isLive}},{key:"duration",get:function(){return this._duration},set:function(e){this._duration=e}},{key:"buffered",get:function(){var e=this;if(this.isLive)return{length:this._duration?1:0,start:function(){return 0},end:function(){return e._duration}};var t=this._mergeBufferRanges();return{length:t.length,start:function(e){var r=t[e];return r?r.start:0},end:function(e){var r=t[e];return r?r.end:1/0}}}},{key:"resetDts",value:function(e){this._baseDts=e}},{key:"_transitionSamples",value:function(e){for(var t=e.numberOfChannels,r=e.length,n=512,i=0;i<t;i++){for(var a=e.getChannelData(i),o=0;o<n;o++)a[o]=a[o]*o/n;for(var s=r-n;s<r;s++)a[s]=a[s]*(r-s)/n}}},{key:"append",value:function(e,t,r,n){-1===this._baseDts&&(this._baseDts=r),this._transitionSamples(e);var i=(r-this._baseDts)/1e3,a=i+t,o={start:i,end:a,startDts:r,source:e,duration:t,delay:n};if(logger.log(this.TAG,"add new buffer range, startDts:".concat(r,", [").concat(o.start," , ").concat(o.end,"]")),!this._buffers.filter((function(e){return e.start===i})).length)return this._buffers.push(o),this.isLive&&(this._duration=a),o.start;console.error("音频重复")}},{key:"deletePassed",value:function(e){return this._buffers=this._buffers.filter((function(t){return t.start>=e})),this._buffers[0]}},{key:"canSeek",value:function(e){var t=this._buffers[this._buffers.length-1];return!!t&&!(t.start<e)}},{key:"_mergeBufferRanges",value:function(){var e=this._buffers.slice().sort((function(e,t){return e.start>t.start?1:-1})),t=e.length,r=[];if(!t)return r;for(var n={start:e[0].start,end:e[0].end},i=1;i<t;i++){var a=e[i];Math.abs(n.end-a.start)<TOLERANCE$2?n.end=a.end:(r.push(n),n={start:a.start,end:a.end})}return r.push(n),r}},{key:"getBuffer",value:function(e){if(this.isLive)return this._buffers.shift();var t=this._buffers.filter((function(t){return t.start<e+TOLERANCE$2&&t.end>e+TOLERANCE$2}))[0];return logger.log(this.TAG,"get audio buffer , currentTime:".concat(e," ,buffer:[").concat(t&&t.start," , ").concat(t&&t.end,"]")),0!==e||t?t:this._buffers[0]}},{key:"hasBuffer",value:function(){var e;return!(null===(e=this._buffers)||void 0===e||!e.length)}}]),e}(),Alaw2lpcm=[-5504,-5248,-6016,-5760,-4480,-4224,-4992,-4736,-7552,-7296,-8064,-7808,-6528,-6272,-7040,-6784,-2752,-2624,-3008,-2880,-2240,-2112,-2496,-2368,-3776,-3648,-4032,-3904,-3264,-3136,-3520,-3392,-22016,-20992,-24064,-23040,-17920,-16896,-19968,-18944,-30208,-29184,-32256,-31232,-26112,-25088,-28160,-27136,-11008,-10496,-12032,-11520,-8960,-8448,-9984,-9472,-15104,-14592,-16128,-15616,-13056,-12544,-14080,-13568,-344,-328,-376,-360,-280,-264,-312,-296,-472,-456,-504,-488,-408,-392,-440,-424,-88,-72,-120,-104,-24,-8,-56,-40,-216,-200,-248,-232,-152,-136,-184,-168,-1376,-1312,-1504,-1440,-1120,-1056,-1248,-1184,-1888,-1824,-2016,-1952,-1632,-1568,-1760,-1696,-688,-656,-752,-720,-560,-528,-624,-592,-944,-912,-1008,-976,-816,-784,-880,-848,5504,5248,6016,5760,4480,4224,4992,4736,7552,7296,8064,7808,6528,6272,7040,6784,2752,2624,3008,2880,2240,2112,2496,2368,3776,3648,4032,3904,3264,3136,3520,3392,22016,20992,24064,23040,17920,16896,19968,18944,30208,29184,32256,31232,26112,25088,28160,27136,11008,10496,12032,11520,8960,8448,9984,9472,15104,14592,16128,15616,13056,12544,14080,13568,344,328,376,360,280,264,312,296,472,456,504,488,408,392,440,424,88,72,120,104,24,8,56,40,216,200,248,232,152,136,184,168,1376,1312,1504,1440,1120,1056,1248,1184,1888,1824,2016,1952,1632,1568,1760,1696,688,656,752,720,560,528,624,592,944,912,1008,976,816,784,880,848],Ulaw2lpcm=[-32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956,-23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764,-15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412,-11900,-11388,-10876,-10364,-9852,-9340,-8828,-8316,-7932,-7676,-7420,-7164,-6908,-6652,-6396,-6140,-5884,-5628,-5372,-5116,-4860,-4604,-4348,-4092,-3900,-3772,-3644,-3516,-3388,-3260,-3132,-3004,-2876,-2748,-2620,-2492,-2364,-2236,-2108,-1980,-1884,-1820,-1756,-1692,-1628,-1564,-1500,-1436,-1372,-1308,-1244,-1180,-1116,-1052,-988,-924,-876,-844,-812,-780,-748,-716,-684,-652,-620,-588,-556,-524,-492,-460,-428,-396,-372,-356,-340,-324,-308,-292,-276,-260,-244,-228,-212,-196,-180,-164,-148,-132,-120,-112,-104,-96,-88,-80,-72,-64,-56,-48,-40,-32,-24,-16,-8,0,32124,31100,30076,29052,28028,27004,25980,24956,23932,22908,21884,20860,19836,18812,17788,16764,15996,15484,14972,14460,13948,13436,12924,12412,11900,11388,10876,10364,9852,9340,8828,8316,7932,7676,7420,7164,6908,6652,6396,6140,5884,5628,5372,5116,4860,4604,4348,4092,3900,3772,3644,3516,3388,3260,3132,3004,2876,2748,2620,2492,2364,2236,2108,1980,1884,1820,1756,1692,1628,1564,1500,1436,1372,1308,1244,1180,1116,1052,988,924,876,844,812,780,748,716,684,652,620,588,556,524,492,460,428,396,372,356,340,324,308,292,276,260,244,228,212,196,180,164,148,132,120,112,104,96,88,80,72,64,56,48,40,32,24,16,8,0],silenceFrame=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 _doubleCheckSampleRateIndex(e,t){var r=(7&e[0])<<1|e[1]>>>7;return r!==t?r:t}function _constructAdtsHeader(e,t){var r=e.sampleRateIndex,n=e.channelCount;r=_doubleCheckSampleRateIndex(e.config,r);var i=new Uint8Array(7);i[0]=255,i[1]=240,i[1]=1|i[1],i[2]=64,i[2]=i[2]|60&r<<2,i[2]=i[2]|1&n>>2,i[3]=192&n<<6;var a=t.byteLength+7;return i[3]=i[3]|3&a>>11,i[4]=255&a>>3,i[5]=224&a<<5,i[5]=31|i[5],i[6]=252,i}function packageAACToAdts(e,t){var r=new Uint8Array(t.data.byteLength+7),n=_constructAdtsHeader(e,t.data);return r.set(n),r.set(t.data,7),r}function concatAdts(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0,n=0,i=e.length;n<i;n++)t&&n%t==0||(r+=e[n].byteLength);for(var a=new Uint8Array(r),o=0,s=0,u=e.length;s<u;s++)t&&s%t==0||(a.set(e[s],o),o+=e[s].byteLength);return a}function _decodeAlaw(e){for(var t=new Uint8Array(2*e.length),r=0,n=0;r<e.length;){var i=Alaw2lpcm[e[r]];if(void 0===i)throw new Error("can not decode g711 alaw data!");t[n]=255&i,t[n+1]=i>>8,r+=1,n+=2}return t}function _decodeUlaw(e){for(var t=new Uint8Array(2*e.length),r=0,n=0;r<e.length;){var i=Ulaw2lpcm[e[r]];if(void 0===i)throw new Error("can not decode g711 ulaw data!");t[n]=255&i,t[n+1]=i>>8,r+=1,n+=2}return t}function decodeG711(e,t){if("g7110a"===t)return _decodeAlaw(e);if("g7110m"===t)return _decodeUlaw(e);throw new Error("no supported format=".concat(t," for g711"))}function _getSampleCount(e,t,r){return e/t/r}function _uint16ToFloat32(e){return e>=32768?-(65536-e)/32768:e/32767}function createAudioBufferFromPcm(e,t,r,n,i){for(var a=_getSampleCount(t.byteLength,r,i),o=e.createBuffer(r,a,n),s=new DataView(t),u=0;u<r;u++)for(var c=o.getChannelData(u),l=void 0,d=0;d<a;d++)l=s.getUint16(d*(2*r)+2*u,!0),c[d]=_uint16ToFloat32(l);return{audioBuffer:o,duration:a/n}}function checkRefillFrame(e){var t=e[0].dts,r=e.filter((function(e){return e.dts===t})).length;if(!(r<=1))for(var n=0;n<r;n++)e[n].data=silenceFrame}var AudioHelper={decodeG711:decodeG711,createAudioBufferFromPcm:createAudioBufferFromPcm,packageAACToAdts:packageAACToAdts,concatAdts:concatAdts,checkRefillFrame:checkRefillFrame},MEDIA_ERR_DECODE$1=3,ERROR_MSG={INIT_AUDIO_ERR:"create new AudioContext error",DECODE_ERR:"audio data decode error"},AudioRender=function(e){_inherits$1(i,BaseRender);var t,r,n=_createSuper$1(i);function i(e,t){var r;return _classCallCheck$2(this,i),_defineProperty$2(_assertThisInitialized$1(r=n.call(this,e,t)),"doPause",r._doPause),r.TAG="AudioRender",r._timeRange=new AudioTimeRange(_assertThisInitialized$1(r)),r._lastTimeLineTime=0,r._sampleQueue=[],r._source=null,r._audioCanAutoplay=!0,r._lastBuffer=null,r._inDecoding=!1,r._endOfStream=!1,r._delay=0,r._isSourceBufferEnd=-1,r._onSourceBufferEnded=r._onSourceBufferEnded.bind(_assertThisInitialized$1(r)),r._initAudioCtx(e.volume||.6),r._bindEvents(),r}return _createClass$2(i,[{key:"baseDts",get:function(){return this._timeRange._baseDts}},{key:"currentTime",get:function(){return this._audioCtx?this._lastTimeLineTime+this._audioCtx.currentTime:0}},{key:"preloadTime",get:function(){return this.isLive?1:0}},{key:"timescale",get:function(){return 1e3}},{key:"buffered",get:function(){return this._timeRange.buffered}},{key:"ctxState",get:function(){return this._audioCtx.state}},{key:"audioCanAutoplay",get:function(){return this._audioCanAutoplay}},{key:"resume",value:function(){if(this._audioCtx&&"suspended"===this._audioCtx.state)return this._audioCtx.resume().catch((function(e){}))}},{key:"canSeek",value:function(e){return this._timeRange.canSeek(e)}},{key:"_assembleErr",value:function(e){var t=new Error(e);return t.code=MEDIA_ERR_DECODE$1,t}},{key:"_emitTimelineEvents",value:function(e,t,r){var n,i;null===(n=this._parent)||void 0===n||null===(i=n.emit)||void 0===i||i.call(n,e,t,r)}},{key:"_initAudioCtx",value:function(e){var t=this;logger.log(this.TAG,"init audioCtx");var r=window.AudioContext||window.webkitAudioContext;return this._audioCtx=new r,this._audioCtx?(this._gainNode=this._audioCtx.createGain(),this._gainNode.gain.value=e,this._gainNode.connect(this._audioCtx.destination),this._audioCanAutoplay="running"===this._audioCtx.state,logger.log(this.TAG,"webAudio state:",this._audioCtx.state),initBgSilenceAudio(),this._bindAudioCtxEvent(),this._audioCtx.suspend()):(logger.warn(this.TAG,"create webaudio error!"),void setTimeout((function(){t._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,t._assembleErr(ERROR_MSG.INIT_AUDIO_ERR))})))}},{key:"_bindAudioCtxEvent",value:function(){var e=this;this._onStateChange=function(){e._audioCtx&&"running"===e._audioCtx.state&&e._ready&&e._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.PLAYING)},this._audioCtx.addEventListener("statechange",this._onStateChange)}},{key:"_bindEvents",value:function(){var e=this;_get(_getPrototypeOf$1(i.prototype),"_bindEvents",this).call(this),this._parent.on(Events$2.DECODE_EVENTS.CHASE_AUDIO_FRAME,this._doChaseFrame.bind(this)),this._parent.on(Events$2.TIMELINE.UPDATE_VOLUME,(function(t){e._gainNode&&(e._gainNode.gain.value=Number.isFinite(t)?t:1,e._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.VOLUME_CHANGE))})),this._parent.on(Events$2.TIMELINE.END_OF_STREAM,(function(){var t;e._endOfStream=!0,e.noAudio||null!==(t=e._timeRange)&&void 0!==t&&t.hasBuffer()||null==e||e._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ENDED)}))}},{key:"_appendChunk",value:function(e,t){if(!this.noAudio){this._meta||(this._meta=t,logger.warn(this.TAG,"audio set metadata",this._meta));var r=t.samples;if(r.length)if(this._sampleQueue=this._sampleQueue.concat(r),t.samples=[],"aac"===this._meta.codecType){if(this._inDecoding)return;this._decodeAACWrapper()}else this._decodeG711()}}},{key:"_resetDts",value:function(e,t){"video"!==t&&this._timeRange.resetDts(e)}},{key:"_doPlay",value:function(){this.noAudio||this._parent.seeking||(this._source||!this.currentTime?this.resume():this._startRender())}},{key:"_doPause",value:function(){this.noAudio||this._audioCtx.suspend()}},{key:"_reInitAudioCtx",value:function(e){var t=this;if(this._lastTimeLineTime=e,this._lastBuffer=null,this._lastAudioBufferInfo=null,this._delay=0,!this._ready||!this._audioCtx.currentTime)return Promise.resolve();var r=this._gainNode.gain.value;return this._audioCtx.close().then((function(){return t._audioCtx.removeEventListener("statechange",t._onStateChange),t._audioCtx=null,t._source&&t._source.removeEventListener("ended",t._onSourceBufferEnded),t._source=null,t._initAudioCtx(r)}))}},{key:"_doSeek",value:function(e){var t=this;this._reInitAudioCtx(e).then((function(){t._getAudioBuffer(!0)})).catch((function(e){}))}},{key:"_doChaseFrame",value:function(e){var t=this,r=e.position,n=this._timeRange.deletePassed(r);n&&(logger.log(this.TAG,"_doChaseFrame","startTime:",n.start,"buffeLength:",this.buffered.end(0)-n.start),this._reInitAudioCtx(n.start).then((function(){t._startRender(),t._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.TIMEUPDATE)})).catch((function(e){})))}},{key:"_decodeAACWrapper",value:(r=_asyncToGenerator$1(_regeneratorRuntime$1().mark((function e(){var t,r,n,i,a,o,s,u,c,l;return _regeneratorRuntime$1().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._sampleQueue.length,r=this._sampleQueue[0],n=this._sampleQueue[t-1],!((i=(n.dts-r.dts)/this.timescale)<1)){e.next=6;break}return e.abrupt("return");case 6:for(a=parseInt(i/3-1)||1,o=parseInt(t/a),s=[],u=0;u<a;u++)u<a-1?s.push(this._sampleQueue.slice(u*o,(u+1)*o)):s.push(this._sampleQueue.slice(u*o));return this._sampleQueue=[],this._inDecoding=!0,e.prev=12,e.next=15,this._decodeCycle(s);case 15:this._isLive||(c=this._timeRange._buffers,(l=c[c.length-1])&&this._emitTimelineEvents(Events$2.TIMELINE.UPDATE_SEGMENT_END,l.end)),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(12),this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,this._assembleErr("ERROR_MSG.DECODE_ERR:".concat(e.t0&&e.t0.message)));case 21:this._inDecoding=!1;case 22:case"end":return e.stop()}}),e,this,[[12,18]])}))),function(){return r.apply(this,arguments)})},{key:"_decodeCycle",value:(t=_asyncToGenerator$1(_regeneratorRuntime$1().mark((function e(t){var r;return _regeneratorRuntime$1().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.shift()){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this._decodeAAC(r);case 5:return e.next=7,this._decodeCycle(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_decodeAAC",value:function(e){var t=this,r=e[0],n=0;AudioHelper.checkRefillFrame(e);var i=e.map((function(e){return AudioHelper.packageAACToAdts(t._meta,e)})),a=AudioHelper.concatAdts(i,0);return new Promise((function(e,i){var o=t._audioCtx.decodeAudioData(a.buffer,(function(i){if(t._timeRange){if(t._lastAudioBufferInfo&&t.isLive){var a=t._lastAudioBufferInfo,o=a.dts+a.duration;(n=r.dts-o)>1&&(t._timeRange._duration+=n/1e3,logger.log(t.TAG,"_decodeAAC","audio data dts is not continue, last end dts:",o,",now start Dts:",r.dts,"delay:",n))}t._lastAudioBufferInfo={duration:Math.floor(1e3*i.duration),dts:r.dts};var s=t._timeRange.append(i,i.duration,r.dts,n/1e3);if(!t._ready){var u=Math.abs(s+i.duration-t.currentTime)<.5;(t.isLive||!u)&&(t._ready=!0,logger.log(t.TAG,"_decodeAAC","set ready true start=",s),t.emit(Events$2.AUDIO.AUDIO_READY,s))}t._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.PROGRESS),t._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.DURATION_CHANGE),e()}}),i);o.catch&&o.catch(i)}))}},{key:"_decodeG711",value:function(){var e=this._sampleQueue.length,t=this._sampleQueue[0];if(!((this._sampleQueue[e-1].dts-t.dts)/this.timescale<.5)){var r=this._sampleQueue.reduce((function(e,t){return e+=t.data.byteLength}),0),n=new Uint8Array(r),i=0,a=0;this._sampleQueue.forEach((function(e,t){0===t&&(i=e.dts),n.set(e.data,a),a+=e.data.byteLength})),this._sampleQueue=[];try{var o=this._meta,s=o.codecType,u=o.channelCount,c=o.sampleSize,l=o.sampleRate,d=AudioHelper.decodeG711(n,s),h=AudioHelper.createAudioBufferFromPcm(this._audioCtx,d.buffer,u,l,c/8),f=h.audioBuffer,p=h.duration,m=this._timeRange.append(f,p,i,0);this._ready||(this._ready=!0,logger.log(this.TAG,"_decodeG711","set ready true"),this.emit(Events$2.AUDIO.AUDIO_READY,m)),this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.PROGRESS),this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.DURATION_CHANGE)}catch(e){this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,this._assembleErr("ERROR_MSG.DECODE_ERR:".concat(e&&e.message)))}}}},{key:"_onSourceBufferEnded",value:function(){this._isSourceBufferEnd=!0,logger.long&&logger.log(this.TAG,"source play end! currentTime:".concat(this.currentTime," , duration:").concat(this.duration)),this._startRender()}},{key:"_ajustSeekTime",value:function(e){var t=this._timeRange.getBuffer(e,0);t&&(logger.log(this.TAG,"ajust seek time to:",t.start),this._lastTimeLineTime=t.start)}},{key:"_getAudioBuffer",value:function(e){var t=this;if(this._timeRange){var r=this._timeRange.getBuffer(this._lastBuffer?this._lastBuffer.end:this.currentTime,0);return r?e?(this._ajustSeekTime(r.start),void this.emit(Events$2.AUDIO.AUDIO_READY)):r:(this._endOfStream||!this._isLive)&&this.currentTime-this.duration>-.5?(this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.TIMEUPDATE),void this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ENDED)):(this._ready=!1,this._audioCtx.suspend(),this.emit(Events$2.AUDIO.AUDIO_WAITING),void(e&&(this._onAudioReady||(this._onAudioReady=function(e){t._ajustSeekTime(e)}),this.removeListener(Events$2.AUDIO.AUDIO_READY,this._onAudioReady),this.once(Events$2.AUDIO.AUDIO_READY,this._onAudioReady))))}}},{key:"_startRender",value:function(e){if(!this.noAudio){if("video"===e&&this.isLive&&this._ready&&!this._isSourceBufferEnd)return console.log(this.TAG,"_startRender, audio currentTime",this.currentTime,"from:",e,"_isSourceBufferEnd:",this._isSourceBufferEnd,"ready:",this._ready),void this._doPlay();var t=this._getAudioBuffer();if(t){"suspended"===this._audioCtx.state&&(this._audioCtx.resume().catch((function(e){})),playSlienceAudio()),this._lastBuffer=t,this._source=null;var r=this._audioCtx.createBufferSource();r.buffer=t.source,r.loop=!1,this._source=r,r.addEventListener("ended",this._onSourceBufferEnded),r.connect(this._gainNode),t.delay&&t.delay>.001&&(this._delay+=t.delay),this.startDts=t.startDts;try{this._isSourceBufferEnd=!1,r.start()}catch(e){}t.startDts&&this._emitTimelineEvents(Events$2.TIMELINE.SYNC_DTS,t.startDts)}}}},{key:"_destroy",value:function(){logger.log(this.TAG,"destroy audio..."),this._source&&this._source.removeEventListener("ended",this._onSourceBufferEnded),this._audioCtx&&"closed"!==this.ctxState&&this._audioCtx.close(),this._audioCtx=null,this._sampleQueue=null,this._timeRange=null,this._parent=null,this.removeAllListeners()}}]),i}();function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty$1(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var TrackType={VIDEO:"video",AUDIO:"audio",METADATA:"metadata"},VideoCodecType={AVC:"avc",HEVC:"hevc"};function concatUint8Array(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t.filter(Boolean);var n=new Uint8Array(t.reduce((function(e,t){return e+t.byteLength}),0)),i=0;return t.forEach((function(e){n.set(e,i),i+=e.byteLength})),n}function parse(e){if(!Array.isArray(e)){for(var t=[],r="",n=0;n<e.length;n++)n%2&&(r=e[n-1]+e[n],t.push(parseInt(r,16)),r="");return t}return e.map((function(e){return parseInt(e,16)}))}function Concat(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.forEach((function(e){t+=e.length}));var a=new e(t),o=0;return n.forEach((function(e){a.set(e,o),o+=e.length})),a}var Buffer$1=function(){function e(){_classCallCheck$1(this,e),this.buffer=new Uint8Array(0)}return _createClass$1(e,[{key:"write",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach((function(t){t?e.buffer=Concat(Uint8Array,e.buffer,t):window.console.warn(t)}))}}],[{key:"writeUint16",value:function(e){return new Uint8Array([e>>8&255,255&e])}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>24,e>>16&255,e>>8&255,255&e])}}]),e}(),UINT32_MAX=Math.pow(2,32)-1,MP4=function(){function e(){_classCallCheck$1(this,e)}return _createClass$1(e,null,[{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=8+(r=r.filter(Boolean)).reduce((function(e,t){return e+t.byteLength}),0),a=new Uint8Array(i);a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4);var o=8;return r.forEach((function(e){a.set(e,o),o+=e.byteLength})),a}},{key:"ftyp",value:function(t){return t.find((function(e){return e.type===TrackType.VIDEO&&e.codecType===VideoCodecType.HEVC}))?e.FTYPHEV1:e.FTYPAVC1}},{key:"initSegment",value:function(t){return concatUint8Array(e.ftyp(t),e.moov(t))}},{key:"pssh",value:function(t){var r=new Uint8Array([1,0,0,0].concat([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75],[0,0,0,1],parse(t.kid),[0,0,0,0]));return e.box(e.types.pssh,r)}},{key:"moov",value:function(t){if(t[0].useEME&&(t[0].encv||t[0].enca)){t[0].pssh||(t[0].pssh={kid:t[0].kid});var r=this.pssh(t[0].pssh);return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale),e.mvex(t)].concat(_toConsumableArray(t.map((function(t){return e.trak(t)}))),[r]))}return e.box.apply(e,[e.types.moov,e.mvhd(t[0].mvhdDurtion||t[0].duration,t[0].mvhdTimecale||t[0].timescale)].concat(_toConsumableArray(t.map((function(t){return e.trak(t)}))),[e.mvex(t)]))}},{key:"mvhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.tkhdDuration||0,t.width,t.height),e.mdia(t))}},{key:"tkhd",value:function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return e.box(e.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,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,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minf(t))}},{key:"mdhd",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,t>>24&255,t>>16&255,t>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"minf",value:function(t){return e.box(e.types.minf,t.type===TrackType.VIDEO?e.VMHD:e.SMHD,e.DINF,e.stbl(t))}},{key:"stbl",value:function(t){var r=[];return t&&t.ext&&t.ext.stss&&r.push(e.stss(t.ext.stss.entries)),e.box(e.types.stbl,e.stsd(t),e.STTS,r[0],e.STSC,e.STSZ,e.STCO)}},{key:"stsd",value:function(t){var r;return r="audio"===t.type?t.useEME&&t.enca?e.enca(t):e.mp4a(t):t.useEME&&t.encv?e.encv(t):e.avc1hev1(t),e.box(e.types.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),r)}},{key:"enca",value:function(t){var r=t.enca.channelCount,n=t.enca.sampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,n>>8&255,255&n,0,0]),a=e.esds(t.config),o=e.sinf(t.enca);return e.box(e.types.enca,i,a,o)}},{key:"encv",value:function(t){var r,n,i=t.sps.length>0?t.sps[0]:[],a=t.pps.length>0?t.pps[0]:[],o=t.width,s=t.height,u=t.sarRatio[0],c=t.sarRatio[1],l=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,o>>8&255,255&o,s>>8&255,255&s,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]),d=new Uint8Array((r=(n=[1,i[1],i[2],i[3],255,225,i.length>>>8&255,255&i.length]).concat.apply(n,_toConsumableArray(i)).concat([1,a.length>>>8&255,255&a.length])).concat.apply(r,_toConsumableArray(a))),h=new Uint8Array([0,0,88,57,0,15,200,192,0,4,86,72]),f=e.sinf(t.encv),p=new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c]);return e.box(e.types.encv,l,e.box(e.types.avcC,d),e.box(e.types.btrt,h),f,e.box(e.types.pasp,p))}},{key:"schi",value:function(t){var r=new Uint8Array([]),n=e.tenc(t);return e.box(e.types.schi,r,n)}},{key:"tenc",value:function(t){var r=new Uint8Array([0,0,0,0,0,0,255&t.default_IsEncrypted,255&t.default_IV_size].concat(parse(t.default_KID)));return e.box(e.types.tenc,r)}},{key:"sinf",value:function(t){var r=new Uint8Array([]),n=new Uint8Array([t.data_format.charCodeAt(0),t.data_format.charCodeAt(1),t.data_format.charCodeAt(2),t.data_format.charCodeAt(3)]),i=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0]),a=e.schi(t);return e.box(e.types.sinf,r,e.box(e.types.frma,n),e.box(e.types.schm,i),a)}},{key:"avc1hev1",value:function(t){var r=t.codecType===VideoCodecType.HEVC,n=r?e.types.hvc1:e.types.avc1,i=r?e.hvcC(t):e.avcC(t),a=[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,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,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,17,17]),i];return r?a.push(e.box(e.types.fiel,new Uint8Array([1,0]))):t.sarRatio&&t.sarRatio.length>1&&a.push(e.pasp(t.sarRatio)),e.box.apply(e,[n].concat(a))}},{key:"avcC",value:function(t){var r,n,i,a=[],o=[];return t.sps.forEach((function(e){i=e.byteLength,a.push(i>>>8&255),a.push(255&i),a.push.apply(a,_toConsumableArray(e))})),t.pps.forEach((function(e){i=e.byteLength,o.push(i>>>8&255),o.push(255&i),o.push.apply(o,_toConsumableArray(e))})),e.box(e.types.avcC,new Uint8Array((r=(n=[1,a[3],a[4],a[5],255,224|t.sps.length]).concat.apply(n,a).concat([t.pps.length])).concat.apply(r,o)))}},{key:"hvcC",value:function(t){var r=t.hvcC;if(r instanceof ArrayBuffer||r instanceof Uint8Array)return r;var n,i=t.vps,a=t.sps,o=t.pps;if(r){var s=r.generalProfileCompatibilityFlags,u=r.generalConstraintIndicatorFlags,c=(i.length&&1)+(a.length&&1)+(o.length&&1);n=[1,r.generalProfileSpace<<6|r.generalTierFlag<<5|r.generalProfileIdc,s>>>24,s>>>16,s>>>8,s,u[0],u[1],u[2],u[3],u[4],u[5],r.generalLevelIdc,240,0,252,252|r.chromaFormatIdc,248|r.bitDepthLumaMinus8,248|r.bitDepthChromaMinus8,0,0,r.numTemporalLayers<<3|r.temporalIdNested<<2|3,c];var l=function(e){var t;n.push(e.length>>8,e.length),(t=n).push.apply(t,_toConsumableArray(e))};i.length&&(n.push(160,0,i.length),i.forEach(l)),a.length&&(n.push(161,0,a.length),a.forEach(l)),o.length&&(n.push(162,0,o.length),o.forEach(l))}else n=[1,1,96,0,0,0,144,0,0,0,0,0,93,240,0,252,253,248,248,0,0,15,3,160,0,1,0,24,64,1,12,1,255,255,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,153,152,9,161,0,1,0,45,66,1,1,1,96,0,0,3,0,144,0,0,3,0,0,3,0,93,160,2,128,128,45,22,89,153,164,147,43,154,128,128,128,130,0,0,3,0,2,0,0,3,0,50,16,162,0,1,0,7,68,1,193,114,180,98,64];return e.box(e.types.hvcC,new Uint8Array(n))}},{key:"pasp",value:function(t){var r=_slicedToArray(t,2),n=r[0],i=r[1];return e.box(e.types.pasp,new Uint8Array([n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,t.sampleRate>>8&255,255&t.sampleRate,0,0]),t.config.length?e.esds(t.config):void 0)}},{key:"esds",value:function(t){var r=t.length;return e.box(e.types.esds,new Uint8Array([0,0,0,0,3,23+r,0,0,0,4,15+r,64,21,0,6,0,0,0,218,192,0,0,218,192,5].concat([r]).concat(t).concat([6,1,2])))}},{key:"mvex",value:function(t){return e.box.apply(e,[e.types.mvex].concat(_toConsumableArray(t.map((function(t){return e.trex(t.id)})))))}},{key:"trex",value:function(t){return e.box(e.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]))}},{key:"trex1",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,2,0,0,0,0,0,0,1,0,0]))}},{key:"trex2",value:function(t){return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,4,0,0,0,0,0,2,0,0,0]))}},{key:"moof",value:function(t){return e.box.apply(e,[e.types.moof,e.mfhd(t[0].samples?t[0].samples[0].gopId:0)].concat(_toConsumableArray(t.map((function(t){return e.traf(t)})))))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"traf",value:function(t){var r=e.tfhd(t.id),n=e.tfdt(t,t.baseMediaDecodeTime),i=0;if(t.isVideo&&t.videoSenc&&t.videoSenc.forEach((function(e){i+=8,e.subsamples&&e.subsamples.length&&(i+=2,i+=6*e.subsamples.length)})),t.videoSencLength=i,t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)){if(t.isVideoEncryption){if(t.isVideo){var a=e.saiz(t),o=e.saio(t),s=e.trun1(t),u=e.senc(t);return e.box(e.types.traf,r,n,a,o,s,u)}if(t.isAudioEncryption){var c=e.sbgp(),l=e.saiz(t),d=e.saio(t),h=e.senc(t),f=e.trun1(t);return e.box(e.types.traf,r,n,c,l,d,h,f)}var p=e.sbgp(),m=e.trun1(t);return e.box(e.types.traf,r,n,p,m)}if(t.isVideo){var y=e.trun1(t);return e.box(e.types.traf,r,n,y)}var g=e.sbgp(),v=e.saiz(t),b=e.saio(t),_=e.senc(t),A=e.trun1(t);return e.box(e.types.traf,r,n,g,v,b,_,A)}var T=e.sdtp(t);return e.box(e.types.traf,r,n,T,e.trun(t.samples,T.byteLength+76))}},{key:"sdtp",value:function(t){var r=new Buffer$1;return t.samples.forEach((function(e){r.write(new Uint8Array(t.isVideo?[e.keyframe?32:16]:[16]))})),e.box(e.types.sdtp,this.extension(0,0),r.buffer)}},{key:"trun1",value:function(t){var r=new Buffer$1,n=Buffer$1.writeUint32(t.samples.length),i=null;if(t.isVideo){var a=t.videoSencLength;i=Buffer$1.writeUint32(16*t.samples.length+a+149),!t.isVideoEncryption&&t.isAudioEncryption&&(i=Buffer$1.writeUint32(16*t.samples.length+92))}else{var o=12*t.samples.length+124;t.isAudioEncryption&&(o=12*t.samples.length+8*t.audioSenc.length+177),i=Buffer$1.writeUint32(o)}return t.samples.forEach((function(e){r.write(Buffer$1.writeUint32(e.duration)),r.write(Buffer$1.writeUint32(e.size)),r.write(Buffer$1.writeUint32(e.keyframe?33554432:65536)),t.isVideo&&r.write(Buffer$1.writeUint32(e.cts?e.cts:0))})),e.box(e.types.trun,this.extension(0,t.flags),n,i,r.buffer)}},{key:"senc",value:function(t){var r=new Buffer$1,n=t.samples.length,i=t.isVideo?16:8,a=t.isVideo?2:0,o=[],s=0;return t.isVideo?(o=t.videoSenc,s=t.videoSencLength):o=t.audioSenc,s=s||i*n,r.write(Buffer$1.writeUint32(16+s),e.types.senc,this.extension(0,a)),r.write(Buffer$1.writeUint32(n)),o.forEach((function(e){for(var t=0;t<e.InitializationVector.length;t++)r.write(new Uint8Array([e.InitializationVector[t]]));e.subsamples&&e.subsamples.length&&(r.write(Buffer$1.writeUint16(e.subsamples.length)),e.subsamples.forEach((function(e){r.write(Buffer$1.writeUint16(e.BytesOfClearData)),r.write(Buffer$1.writeUint32(e.BytesOfProtectedData))})))})),r.buffer}},{key:"saio",value:function(t){var r=12*t.samples.length+141;!t.isVideo&&t.isAudioEncryption&&(r=149);var n=new Uint8Array([1,0,0,0,0,0,0,1,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saio,n)}},{key:"saiz",value:function(t){var r=t.samples.length,n=new Uint8Array([0,0,0,0,16,r>>24&255,r>>16&255,r>>8&255,255&r]);return e.box(e.types.saiz,n)}},{key:"sbgp",value:function(){var t=new Uint8Array([114,111,108,108,0,0,0,1,0,0,1,25,0,0,0,1]);return e.box(e.types.sbgp,this.extension(0,0),t)}},{key:"extension",value:function(e,t){return new Uint8Array([e,t>>16&255,t>>8&255,255&t])}},{key:"tfhd",value:function(t){return e.box(e.types.tfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"tfdt",value:function(t,r){var n=Math.floor(r/(UINT32_MAX+1)),i=Math.floor(r%(UINT32_MAX+1));return t.useEME&&(t.isVideoEncryption||t.isAudioEncryption)?e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])):e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i]))}},{key:"trun",value:function(t,r){var n=t.length,i=12+16*n;r+=8+i;var a=new Uint8Array(i);a.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var o=0;o<n;o++){var s=t[o],u=s.duration,c=s.size,l=s.flag,d=void 0===l?{}:l,h=s.cts,f=void 0===h?0:h;a.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|(null===d.dependsOn||void 0===d.dependsOn?1:d.dependsOn),d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|(null===d.isNonSyncSample||void 0===d.isNonSyncSample?1:d.isNonSyncSample),61440&d.degradationPriority,15&d.degradationPriority,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*o)}return e.box(e.types.trun,a)}},{key:"moovMP4",value:function(t){return e.box.apply(e,[e.types.moov,e.mvhd(t[0].duration,t[0].timescale)].concat(_toConsumableArray(t.map((function(t){return e.trackMP4(t)})))))}},{key:"trackMP4",value:function(t){return e.box(e.types.trak,e.tkhd(t.id,t.duration,t.width,t.height),e.mdiaMP4(t))}},{key:"mdiaMP4",value:function(t){return e.box(e.types.mdia,e.mdhd(t.duration,t.timescale),e.hdlr(t.type),e.minfMP4(t))}},{key:"minfMP4",value:function(t){return e.box(e.types.minf,t.type===TrackType.VIDEO?e.VMHD:e.SMHD,e.DINF,e.stblMP4(t))}},{key:"stblMP4",value:function(t){var r=t.ext,n=[e.stsd(t),e.stts(r.stts),e.stsc(r.stsc),e.stsz(r.stsz),e.stco(r.stco)];return r.stss.length&&n.push(e.stss(r.stss)),r.ctts.length&&n.push(e.ctts(r.ctts)),e.box.apply(e,[e.types.stbl].concat(n))}},{key:"stts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.stts,concatUint8Array(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsc",value:function(t){var r=t.length,n=new Uint8Array(12*r),i=0;return t.forEach((function(e){var t=e.firstChunk,r=e.samplesPerChunk,a=e.sampleDescIndex;n.set([t>>24,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,a>>24,a>>16&255,a>>8&255,255&a],i),i+=12})),e.box(e.types.stsc,concatUint8Array(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stsz",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stsz,concatUint8Array(new Uint8Array([0,0,0,0,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stco",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stco,concatUint8Array(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"stss",value:function(t){var r=t.length,n=new Uint8Array(4*r),i=0;return t.forEach((function(e){n.set([e>>24,e>>16&255,e>>8&255,255&e],i),i+=4})),e.box(e.types.stss,concatUint8Array(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"ctts",value:function(t){var r=t.length,n=new Uint8Array(8*r),i=0;return t.forEach((function(e){var t=e.value,r=e.count;n.set([r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t],i),i+=8})),e.box(e.types.ctts,concatUint8Array(new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r]),n))}},{key:"styp",value:function(){return e.box(e.types.styp,new Uint8Array([109,115,100,104,0,0,0,0,109,115,100,104,109,115,105,120]))}},{key:"sidx",value:function(t){var r=t.timescale,n=t.samples[0].duration,i=n*t.samples.length,a=t.samples[0].sampleOffset*n,o=8;t.samples.forEach((function(e){o+=e.size}));var s=0;if(t.isVideo){var u,c=0;t.videoSenc&&(u=t.videoSenc),t.isVideo&&u.forEach((function(e){c+=8,e.subsamples&&e.subsamples.length&&(c+=2,c+=6*e.subsamples.length)})),t.videoSencLength=c,s=o+141+16*t.samples.length+c,t.useEME&&t.isAudioEncryption&&!t.isVideoEncryption&&(s=o+16*t.samples.length+84)}else s=o+116+12*t.samples.length,t.useEME&&t.isAudioEncryption&&(s=o+169+12*t.samples.length+8*t.audioSenc.length);var l=new Uint8Array([0,0,0,0,0,0,0,255&t.id,r>>24&255,r>>16&255,r>>8&255,255&r,a>>24&255,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,1,0,s>>16&255,s>>8&255,255&s,i>>24&255,i>>16&255,i>>8&255,255&i,144,0,0,0]);return e.box(e.types.sidx,l)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}]),e}();_defineProperty$1(MP4,"types",["avc1","avcC","hvc1","hvcC","dinf","dref","esds","ftyp","hdlr","mdat","mdhd","mdia","mfhd","minf","moof","moov","mp4a","mvex","mvhd","pasp","stbl","stco","stsc","stsd","stsz","stts","tfdt","tfhd","traf","trak","trex","tkhd","vmhd","smhd","ctts","stss","styp","pssh","sidx","sbgp","saiz","saio","senc","trun","encv","enca","sinf","btrt","frma","tenc","schm","schi","mehd","fiel","sdtp"].reduce((function(e,t){return e[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)],e}),Object.create(null))),_defineProperty$1(MP4,"HDLR_TYPES",{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]),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])}),_defineProperty$1(MP4,"FTYPAVC1",MP4.box(MP4.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]))),_defineProperty$1(MP4,"FTYPHEV1",MP4.box(MP4.types.ftyp,new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,104,101,118,49]))),_defineProperty$1(MP4,"DINF",MP4.box(MP4.types.dinf,MP4.box(MP4.types.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])))),_defineProperty$1(MP4,"VMHD",MP4.box(MP4.types.vmhd,new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]))),_defineProperty$1(MP4,"SMHD",MP4.box(MP4.types.smhd,new Uint8Array([0,0,0,0,0,0,0,0]))),_defineProperty$1(MP4,"StblTable",new Uint8Array([0,0,0,0,0,0,0,0])),_defineProperty$1(MP4,"STTS",MP4.box(MP4.types.stts,MP4.StblTable)),_defineProperty$1(MP4,"STSC",MP4.box(MP4.types.stsc,MP4.StblTable)),_defineProperty$1(MP4,"STSZ",MP4.box(MP4.types.stsz,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]))),_defineProperty$1(MP4,"STCO",MP4.box(MP4.types.stco,MP4.StblTable));var Logger$1=function(){function e(t,r){_classCallCheck$1(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]"),e.disabled=r}return _createClass$1(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();_defineProperty$1(Logger$1,"disabled",!0);var FMP4Remuxer=function(){function e(t,r,n){_classCallCheck$1(this,e),this.videoTrack=t,this.audioTrack=r;var i=/Chrome\/([^.]+)/.exec(navigator.userAgent);this.forceFirstIDR=i&&Number(i[1])<50,this.log=new Logger$1("FMP4Remuxer",!n||!n.openLog||!n.openLog)}return _createClass$1(e,[{key:"remux",value:function(){var e,t,r,n,i,a=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.videoTrack,u=this.audioTrack,c=s.exist(),l=u.exist(),d=[];return a&&(o&&o.initMerge?(c&&d.push(this.videoTrack),l&&d.push(this.audioTrack),r=MP4.initSegment(d)):(c&&(e=MP4.initSegment([this.videoTrack])),l&&(t=MP4.initSegment([this.audioTrack])))),c&&s.hasSample()&&(n=this._remuxVideo()),l&&u.hasSample()&&(i=this._remuxAudio()),s.samples=[],u.samples=[],{initSegment:r,videoInitSegment:e,audioInitSegment:t,videoSegment:n,audioSegment:i}}},{key:"_remuxVideo",value:function(){var e=this.videoTrack;this.forceFirstIDR&&(e.samples[0].flag={dependsOn:2,isNonSyncSample:0});var t=e.samples,r=0;t.forEach((function(e){r+=e.units.reduce((function(e,t){return e+t.byteLength}),0),r+=4*e.units.length}));for(var n,i=new Uint8Array(r),a=new DataView(i.buffer),o=function(e,r,o,s){s=t[e];var u=0;s.units.forEach((function(e){a.setUint32(o,e.byteLength),o+=4,i.set(e,o),o+=e.byteLength,u+=4+e.byteLength})),s.size=u,c=o,n=s},s=0,u=t.length,c=0;s<u;s++)o(s,0,c,n);var l=MP4.mdat(i);return concatUint8Array(MP4.moof([e]),l)}},{key:"_remuxAudio",value:function(){var e=this.audioTrack,t=new Uint8Array(e.samples.reduce((function(e,t){return e+t.size}),0));e.samples.reduce((function(e,r){return t.set(r.data,e),e+r.size}),0);var r=MP4.mdat(t);return concatUint8Array(MP4.moof([e]),r)}},{key:"reset",value:function(){this.videoTrack.reset(),this.audioTrack.reset()}}]),e}(),MP4Remuxer=function(){function e(t,r){_classCallCheck$1(this,e),this.videoTrack=t,this.audioTrack=r}return _createClass$1(e,[{key:"remux",value:function(e,t){this.videoTrack=e||this.videoTrack,this.audioTrack=t||this.audioTrack;var r,n,i=(null==e?void 0:e.exist())&&(null==e?void 0:e.hasSample()),a=(null==t?void 0:t.exist())&&(null==t?void 0:t.hasSample());return i&&a?r=this._remuxMix(e,t):i?r=this._remuxTrack(e):a&&(n=this._remuxTrack(t)),e&&(e.samples=[]),t&&(t.samples=[]),{videoSegment:r,audioSegment:n}}},{key:"_remuxMix",value:function(e,t){var r=MP4.ftyp([e,t]),n=this._remuxData(e,r.byteLength+8),i=n.mdatData,a=n.chunkOffset,o=this._remuxData(t,a).mdatData,s=MP4.mdat(concatUint8Array(i,o)),u=MP4.moovMP4([e,t]);return e.ext=void 0,t.ext=void 0,e.samples=[],t.samples=[],concatUint8Array(r,s,u)}},{key:"_remuxTrack",value:function(e){var t=MP4.ftyp([e]),r=this._remuxData(e,t.byteLength+8).mdatData,n=MP4.mdat(r),i=MP4.moovMP4([e]);return e.ext=void 0,e.samples=[],concatUint8Array(t,n,i)}},{key:"_remuxData",value:function(e,t){var r=e.type===TrackType.VIDEO,n=e.samples,i=0;r?n.forEach((function(e){i+=e.units.reduce((function(e,t){return e+t.byteLength}),0),i+=4*e.units.length})):i=n.reduce((function(e,t){return e+t.size}),0);for(var a,o=new Uint8Array(i),s=new DataView(o.buffer),u=e.ext={stts:[],stsc:[],stsz:[],stco:[],stss:[],ctts:[]},c=0,l=0,d=n.length,h=0;h<d;h++){l+=(a=n[h]).duration;var f=r?0:a.size;r?a.units.forEach((function(e){s.setUint32(c,e.byteLength),c+=4,o.set(e,c),c+=e.byteLength,f+=4+e.byteLength})):(o.set(a.data,c),c+=f),a.size=f,u.stsz.push(f),r&&this._fillCttsSamples(u.ctts,a.cts),this._fillSttsSamples(u.stts,a,n[h+1]),this._fillStcoSamples(u.stco,h,1,t),t+=f,r&&a.keyframe&&u.stss.push(h+1)}return e.duration=l,this._fillStscSamples(u.stsc,d,1),{mdatData:o,chunkOffset:t}}},{key:"_fillSttsSamples",value:function(e,t,r){var n=e[e.length-1];r?n&&n.value===t.duration?n.count++:e.push({value:t.duration,count:1}):n?n.count++:e.push({value:40,count:1})}},{key:"_fillCttsSamples",value:function(e,t){var r=e[e.length-1];r&&r.value===t?r.count++:e.push({value:t,count:1})}},{key:"_fillStcoSamples",value:function(e,t,r,n){t%r||e.push(n)}},{key:"_fillStscSamples",value:function(e,t,r){if(t<=r)e.push({firstChunk:1,samplesPerChunk:t,sampleDescIndex:1});else{var n=Math.floor(t/r),i=t%r;e.push({firstChunk:1,samplesPerChunk:r,sampleDescIndex:1}),i&&e.push({firstChunk:n+1,samplesPerChunk:i,sampleDescIndex:1})}}}]),e}();function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var a=t&&t.prototype instanceof h?t:h,o=Object.create(a.prototype),s=new $(i||[]);return n(o,"_invoke",{value:A(e,r,s)}),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d={};function h(){}function f(){}function p(){}var m={};u(m,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==t&&r.call(g,a)&&(m=g);var v=p.prototype=h.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(n,a,o,s){var u=l(e[n],e,a);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(d).then((function(e){c.value=e,o(c)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function A(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=T(o,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function T(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,d;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return f.prototype=p,n(v,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=u(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,u(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},b(_.prototype),u(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new _(c(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(v),u(v,s,"Generator"),u(v,a,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=I,$.prototype={constructor:$,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:I(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}function asyncGeneratorStep(e,t,r,n,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _construct(e,t,r){return(_construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&_setPrototypeOf(i,r.prototype),i}).apply(null,arguments)}function _isNativeFunction(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(e){if(null===e||!_isNativeFunction(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct(e,arguments,_getPrototypeOf(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(r,e)},_wrapNativeSuper(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var i=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function createPublicPromise(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}function nowTime(){try{return parseInt(performance.now(),10)}catch(e){return(new Date).getTime()}}var _ERR_CODE,Buffer2=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"start",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6||1===e.length&&e.start(0)<0?0:e.start(0):0}},{key:"end",value:function(e){return e&&e.length?1===e.length&&e.end(0)-e.start(0)<1e-6?0:e.end(e.length-1):0}},{key:"get",value:function(e){if(e)try{return e.buffered}catch(e){}}},{key:"buffers",value:function(e,t){if(!e||!e.length)return[];for(var r=[],n=0,i=e.length;n<i;n++){var a=r.length;if(a&&t){var o=r[a-1],s=o[1];if(e.start(n)-s<=t){var u=e.end(n);u>s&&(o[1]=u)}else r.push([e.start(n),e.end(n)])}else r.push([e.start(n),e.end(n)])}return r}},{key:"totalLength",value:function(e){return e&&e.length?e.reduce((function(e,t){return e+(t[1]-t[0])}),0):0}},{key:"info",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t||!t.length)return{start:0,end:0,buffers:[]};for(var i=0,a=0,o=0,s=0,u=0,c=0,l=0,d=e.buffers(t,n),h=0,f=d.length;h<f;h++){var p=d[h];if(r+n>=p[0]&&r<p[1])i=p[0],a=p[1],o=h;else{if(r+n<p[0]){s=p[0],u=p[1];break}r+n>p[1]&&(c=p[0],l=p[1])}}return{start:i,end:a,index:o,buffers:d,nextStart:s,nextEnd:u,prevStart:c,prevEnd:l,currentTime:r,behind:r-i,remaining:a?a-r:0,length:e.totalLength&&e.totalLength(d)}}}]),e}(),ERR={MANIFEST:"manifest",NETWORK:"network",NETWORK_TIMEOUT:"network_timeout",DEMUX:"demux",REMUX:"remux",MEDIA:"media",DRM:"drm",OTHER:"other",SUB_TYPES:{FLV:"FLV",HLS:"HLS",MP4:"MP4",FMP4:"FMP4",MSE_ADD_SB:"MSE_ADD_SB",MSE_APPEND_BUFFER:"MSE_APPEND_BUFFER",MSE_OTHER:"MSE_OTHER",MSE_FULL:"MSE_FULL",OPTION:"OPTION"}},ERR_CODE=(_defineProperty(_ERR_CODE={},ERR.MANIFEST,{HLS:1100}),_defineProperty(_ERR_CODE,ERR.NETWORK,2100),_defineProperty(_ERR_CODE,ERR.NETWORK_TIMEOUT,2101),_defineProperty(_ERR_CODE,ERR.DEMUX,{FLV:3100,HLS:3200,MP4:3300,FMP4:3400}),_defineProperty(_ERR_CODE,ERR.REMUX,{FMP4:4100,MP4:4200}),_defineProperty(_ERR_CODE,ERR.MEDIA,{MSE_ADD_SB:5200,MSE_APPEND_BUFFER:5201,MSE_OTHER:5202,MSE_FULL:5203}),_defineProperty(_ERR_CODE,ERR.OTHER,8e3),_ERR_CODE),StreamingError=function(e){_inherits(r,_wrapNativeSuper(Error));var t=_createSuper(r);function r(e,n,i,a,o){var s;return _classCallCheck(this,r),(s=t.call(this,o||(null==i?void 0:i.message))).errorType=e===ERR.NETWORK_TIMEOUT?ERR.NETWORK:e,s.originError=i,s.ext=a,s.errorCode=ERR_CODE[e][n]||ERR_CODE[e],s.errorMessage=s.message,s.errorCode||(s.errorType=ERR.OTHER,s.errorCode=ERR_CODE[s.errorType]),s}return _createClass(r,null,[{key:"create",value:function(e,t,n,i,a){return e instanceof r?e:(e instanceof Error&&(n=e,e=""),e||(e=ERR.OTHER),new r(e,t,n,i,a))}},{key:"network",value:function(e){var t;return new r(null!=e&&e.isTimeout?ERR.NETWORK_TIMEOUT:ERR.NETWORK,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})}}]),r}(),isBrowser="undefined"!=typeof window,Logger=function(){function e(t){_classCallCheck(this,e),this.name=t||"",this._prefix="[".concat(this.name,"]")}return _createClass(e,[{key:"debug",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).debug.apply(t,[this._prefix,nowTime()].concat(n))}}},{key:"log",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).log.apply(t,[this._prefix,nowTime()].concat(n))}}},{key:"warn",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).warn.apply(t,[this._prefix,nowTime()].concat(n))}}},{key:"error",value:function(){var t;if(!e.disabled){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];(t=console).error.apply(t,[this._prefix,nowTime()].concat(n))}}},{key:"table",value:function(){var t;e.disabled||(console.group(this._prefix),(t=console).table.apply(t,arguments),console.groupEnd())}}],[{key:"enable",value:function(){e.disabled=!1}},{key:"disable",value:function(){e.disabled=!0}}]),e}();function getMediaSource(){try{return isBrowser?window.MediaSource:null}catch(e){}}_defineProperty(Logger,"disabled",!0);var MediaSource$1=getMediaSource(),OP_NAME={APPEND:"appendBuffer",REMOVE:"removeBuffer"},MSE=function(){function e(t,r){var n=this;_classCallCheck(this,e),_defineProperty(this,"media",null),_defineProperty(this,"mediaSource",null),_defineProperty(this,"_openPromise",createPublicPromise()),_defineProperty(this,"_queue",Object.create(null)),_defineProperty(this,"_sourceBuffer",Object.create(null)),_defineProperty(this,"_mseFullFlag",{}),_defineProperty(this,"_st",0),_defineProperty(this,"_opst",0),_defineProperty(this,"_logger",null),_defineProperty(this,"_config",null),_defineProperty(this,"_url",null),_defineProperty(this,"_onSBUpdateEnd",(function(e){var t=n._queue[e];if(t){var r=t.shift();if(r){var i=nowTime()-n._opst;n._logger.debug("UpdateEnd",r.opName,i,r.context),r.promise.resolve({name:r.opName,context:r.context,costtime:i}),n._startQueue(e)}}})),_defineProperty(this,"_onSBUpdateError",(function(e,t){var r=n._queue[e];if(r){var i=r[0];i&&(n._logger.error("UpdateError",e,i.opName,i.context),i.promise.reject(new StreamingError(ERR.MEDIA,ERR.SUB_TYPES.MSE_APPEND_BUFFER,t)))}})),this._config=Object.assign(e.getDefaultConfig(),r),t&&this.bindMedia(t),this._logger=new Logger("MSE"),this._config.openLog&&Logger.enable()}var t,r,n;return _createClass(e,[{key:"isOpened",get:function(){var e;return"open"===(null===(e=this.mediaSource)||void 0===e?void 0:e.readyState)}},{key:"url",get:function(){return this._url}},{key:"duration",get:function(){var e;return(null===(e=this.mediaSource)||void 0===e?void 0:e.duration)||-1}},{key:"isEnded",get:function(){return!!this.mediaSource&&"ended"===this.mediaSource.readyState}},{key:"isFull",value:function(t){return t?this._mseFullFlag[t]:this._mseFullFlag[e.VIDEO]}},{key:"updateDuration",value:function(e){var t=this;return this.mediaSource&&this.mediaSource.duration>e?Promise.resolve():this._enqueueBlockingOp((function(){t.isEnded?t._logger.debug("[debug mse] setDuration ended"):t.mediaSource&&(t.mediaSource.duration=e,t._logger.debug("[debug mse] setDuration"))}),"updateDuration")}},{key:"open",value:function(){var e=this;if(this._openPromise.used&&!this.isOpened&&this.mediaSource){var t=this.mediaSource;t.addEventListener("sourceopen",(function r(){var n=nowTime()-e._st;e._logger.debug("MSE OPEN",n),t.removeEventListener("sourceopen",r),e._openPromise.resolve({costtime:n})})),this._openPromise=createPublicPromise()}return this._openPromise}},{key:"bindMedia",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.mediaSource&&!this.media){e.next=3;break}return e.next=3,this.unbindMedia();case 3:if(t&&MediaSource$1){e.next=5;break}throw new Error("Param media or MediaSource does not exist");case 5:return this.media=t,r=this.mediaSource=new MediaSource$1,this._st=nowTime(),n=function e(){var n=nowTime()-i._st;i._logger.debug("MSE OPEN"),r.removeEventListener("sourceopen",e),URL.revokeObjectURL(t.src),i._openPromise.resolve({costtime:n})},r.addEventListener("sourceopen",n),this._url=URL.createObjectURL(r),t.src=this._url,e.abrupt("return",this._openPromise);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"unbindMedia",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r,n,i=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._openPromise.used||this._openPromise.resolve(),t=this.mediaSource){if(Object.keys(this._queue).forEach((function(e){var t=i._queue[e];t&&t.forEach((function(e){return e.promise.resolve}))})),r=!!this.media&&this.media.readyState>=1,n="open"===t.readyState,r&&n)try{t.endOfStream()}catch(e){}Object.keys(this._sourceBuffer).forEach((function(e){try{t.removeSourceBuffer(i._sourceBuffer[e])}catch(e){}}))}if(this.media){this.media.removeAttribute("src");try{this.media.load()}catch(e){}this.media=null}this.mediaSource=null,this._openPromise=createPublicPromise(),this._queue=Object.create(null),this._sourceBuffer=Object.create(null);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"createSource",value:function(e,t){if(!this._sourceBuffer[e]&&this.mediaSource){var r;try{r=this._sourceBuffer[e]=this.mediaSource.addSourceBuffer(t)}catch(e){throw new StreamingError(ERR.MEDIA,ERR.SUB_TYPES.MSE_ADD_SB,e)}r.mimeType=t,r.addEventListener("updateend",this._onSBUpdateEnd.bind(this,e)),r.addEventListener("error",this._onSBUpdateError.bind(this,e))}}},{key:"changeType",value:function(e,t){var r=this,n=this._sourceBuffer[e];return this.mediaSource&&n&&n.mimeType!==t&&"function"==typeof n.changeType?this._enqueueOp(e,(function(){n.changeType(t),n.mimeType=t,r._onSBUpdateEnd(e)})):Promise.resolve()}},{key:"createOrChangeSource",value:function(e,t){return this.createSource(e,t),this.changeType(e,t)}},{key:"append",value:function(e,t,r){var n=this;return t&&t.byteLength&&this._sourceBuffer[e]?this._enqueueOp(e,(function(){var i;n.mediaSource&&(n._logger.debug("MSE APPEND START",r),n._opst=nowTime(),null===(i=n._sourceBuffer[e])||void 0===i||i.appendBuffer(t))}),OP_NAME.APPEND,r):Promise.resolve()}},{key:"remove",value:function(e,t,r,n){var i=this,a=!1;return this._mseFullFlag[e]&&(a=!0),this._enqueueOp(e,(function(){if(i.mediaSource){var a=i._sourceBuffer[e];t>=r||!a?i._onSBUpdateEnd(e):(i._opst=nowTime(),i._logger.debug("MSE REMOVE START",e,t,r,n),a.remove(t,r))}}),OP_NAME.REMOVE,n,a)}},{key:"clearBuffer",value:function(e,t){var r,n=this;return Object.keys(this._sourceBuffer).forEach((function(i){r=n._enqueueOp(i,(function(){if(n.mediaSource){var r=n._sourceBuffer[i];n._logger.debug("MSE clearBuffer START",i,e,t),r.remove(e,t)}}))})),r}},{key:"clearAllBuffer",value:function(){var e,t=this;return Object.keys(this._sourceBuffer).forEach((function(r){e=t._enqueueOp(r,(function(){if(t.mediaSource){var e=t._sourceBuffer[r];t._logger.debug("MSE clearAllBuffer START",r),e.remove(0,Buffer2.end(Buffer2.get(e)))}}))})),e}},{key:"clearOpQueues",value:function(e){var t;this._logger.debug("MSE clearOpQueue START");var r=this._queue[e];if(r&&r[e]&&!(r.length<5)){var n=[];r.forEach((function(e){e.context&&e.context.isinit&&n.push(e)})),this._queue[e]=r.slice(0,2),n.length>0&&(t=this._queue[e]).push.apply(t,n)}}},{key:"endOfStream",value:function(e){var t=this;return this.mediaSource&&"open"===this.mediaSource.readyState?this._enqueueBlockingOp((function(){var r=t.mediaSource;r&&"open"===r.readyState&&(t._logger.debug("MSE endOfStream START"),e?r.endOfStream(e):r.endOfStream())}),"endOfStream"):Promise.resolve()}},{key:"setLiveSeekableRange",value:function(e,t){var r=this.mediaSource;e<0||t<e||null==r||!r.setLiveSeekableRange||"open"!==r.readyState||r.setLiveSeekableRange(e,t)}},{key:"getSourceBuffer",value:function(e){return this._sourceBuffer[e]}},{key:"buffered",value:function(e){return Buffer2.get(this._sourceBuffer[e])}},{key:"bufferStart",value:function(e){return Buffer2.start(this.buffered(e))}},{key:"bufferEnd",value:function(e){return Buffer2.end(this.buffered(e))}},{key:"_enqueueOp",value:function(e,t,r,n,i){var a=this;if(!this.mediaSource)return Promise.resolve();var o=this._queue[e]=this._queue[e]||[],s={exec:t,promise:createPublicPromise(),opName:r,context:n};return i?(o.splice(0,0,s),this._mseFullFlag[e]=!1,this._startQueue(e)):o.push(s),this.isOpened?1===o.length&&this._startQueue(e):this._openPromise.then((function(){1===o.length&&a._startQueue(e)})),s.promise}},{key:"_enqueueBlockingOp",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i,a=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaSource){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:if((n=Object.keys(this._sourceBuffer)).length){e.next=5;break}return e.abrupt("return",t());case 5:return i=[],n.forEach((function(e){var t=a._queue[e],n=createPublicPromise();i.push(n),t.push({exec:function(){return n.resolve()},promise:n,opName:r}),1===t.length&&a._startQueue(e)})),e.abrupt("return",Promise.all(i).then((function(){try{return t()}finally{n.forEach((function(e){var t=a._queue[e],r=a._sourceBuffer[e];null==t||t.shift(),r&&r.updating||a._startQueue(e)}))}})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"_startQueue",value:function(e){var t=this._queue[e];if(t){var r=t[0];if(r&&!this._mseFullFlag[e])try{r.exec()}catch(n){n&&n.message&&n.message.indexOf("SourceBuffer is full")>=0?(this._mseFullFlag[e]=!0,this._logger.error("[MSE error], context,",r.context," ,name,",r.opName,",err,SourceBuffer is full"),r.promise.reject(new StreamingError(ERR.MEDIA,ERR.SUB_TYPES.MSE_FULL,n))):(this._logger.error(n),r.promise.reject(new StreamingError(ERR.MEDIA,ERR.SUB_TYPES.MSE_OTHER,n)),t.shift(),this._startQueue(e))}}}},{key:"setTimeoffset",value:function(e,t,r){var n=this;return this._enqueueOp(e,(function(){t<0&&(t+=.001),n._sourceBuffer[e].timestampOffset=t,n._onSBUpdateEnd(e)}),"setTimeoffset",r)}},{key:"abort",value:function(e,t){var r=this;return this.isOpened?this._enqueueOp(e,(function(){r._sourceBuffer[e].abort(),r._onSBUpdateEnd(e)}),"abort",t):Promise.resolve()}}],[{key:"getDefaultConfig",value:function(){return{openLog:!1}}},{key:"isSupported",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if(!MediaSource$1)return!1;try{return MediaSource$1.isTypeSupported(e)}catch(t){return this._logger.error(e,t),!1}}}]),e}();_defineProperty(MSE,"VIDEO","video"),_defineProperty(MSE,"AUDIO","audio");var AUDIO_ERROR_SUBCODE=3,CODEC_MAP={"mp4a.40.5":1,"mp4a.40.2":2},JUMP_GAP_STEP=.05,MediaCache=function(){function e(){_classCallCheck$2(this,e),_defineProperty$2(this,"_queue",[]),"undefined"!=typeof document&&(this._tempMedia=document.createElement("video"))}return _createClass$2(e,[{key:"tempMedia",get:function(){return this._tempMedia}},{key:"hasCached",get:function(){return-1!==this._queue.findIndex((function(e){return 1===e.codec}))&&-1!==this._queue.findIndex((function(e){return 2===e.codec}))}},{key:"getCachedMedia",value:function(e){var t=this._queue.findIndex((function(t){return t.codec===e}));return-1!==t?this._queue.splice(t,1)[0]:null}},{key:"cacheMedia",value:function(e){var t=e.codec,r=e.media,n=e.mse,i=CODEC_MAP[t];if(this._queue=this._queue.filter((function(e){var t;return e.mse&&!e.mse.isOpened&&e.mse.unbindMedia(),null===(t=e.mse)||void 0===t?void 0:t.isOpened})),!t||this._queue.filter((function(e){return e.codec===i})).length>2)return null==n||n.endOfStream(),void(null==n||n.unbindMedia());this._queue.push({codec:i,media:r,mse:n})}}]),e}(),mediaCache=new MediaCache,AudioMseRender=function(e){_inherits$1(a,BaseRender);var t,r,n,i=_createSuper$1(a);function a(e,t){var r;return _classCallCheck$2(this,a),_defineProperty$2(_assertThisInitialized$1(r=i.call(this,e,t)),"_media",void 0),_defineProperty$2(_assertThisInitialized$1(r),"_isTempMedia",!1),_defineProperty$2(_assertThisInitialized$1(r),"_mse",void 0),_defineProperty$2(_assertThisInitialized$1(r),"_remuxer",null),_defineProperty$2(_assertThisInitialized$1(r),"_codec",""),_defineProperty$2(_assertThisInitialized$1(r),"_sourceCreated",!1),_defineProperty$2(_assertThisInitialized$1(r),"_needInitSegment",!0),_defineProperty$2(_assertThisInitialized$1(r),"_seekNoSideEffect",!1),_defineProperty$2(_assertThisInitialized$1(r),"_startRendered",!1),_defineProperty$2(_assertThisInitialized$1(r),"_firstTimeAppendedBuffer",!1),_defineProperty$2(_assertThisInitialized$1(r),"_sampleQueue",[]),_defineProperty$2(_assertThisInitialized$1(r),"_inProcessing",!1),_defineProperty$2(_assertThisInitialized$1(r),"_duration",0),_defineProperty$2(_assertThisInitialized$1(r),"_mediaCache",mediaCache),_defineProperty$2(_assertThisInitialized$1(r),"_resetDts",(function(){})),_defineProperty$2(_assertThisInitialized$1(r),"_onCanplay",(function(){r._ready||(r._ready=!0,r.emit(Events$2.AUDIO.AUDIO_READY))})),_defineProperty$2(_assertThisInitialized$1(r),"_onPlaying",(function(){r._parent.ready&&(r._audioCanAutoplay=!0,r._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.PLAYING))})),_defineProperty$2(_assertThisInitialized$1(r),"_onWaiting",(function(){if(!r._seekNoSideEffect){try{for(var e,t=r._media.buffered,n=r._media.currentTime,i=0,a=0,o=t.length;a<o;a++)t.start(a)<n&&t.end(a)>n&&(i=t.end(a)-n);if(Math.abs(i)>.5)return;if(Math.abs(r._media.duration-r._media.currentTime)<.3)return r._reuseMse||r._mse.endOfStream(),void(null===(e=_assertThisInitialized$1(r))||void 0===e||e._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ENDED))}catch(e){}r._ready=!1,r.emit(Events$2.AUDIO.AUDIO_WAITING)}})),_defineProperty$2(_assertThisInitialized$1(r),"_onSeeked",(function(){r._seekNoSideEffect||r._isLive?r._seekNoSideEffect=!1:(logger.log(r.TAG,"seeked"),r._ready||(r._media.pause(),r._ready=!0,r.emit(Events$2.AUDIO.AUDIO_READY)))})),_defineProperty$2(_assertThisInitialized$1(r),"_onProgress",(function(){if(r._media.readyState<=1){var e=r._getBufferGap();e>0&&e<1&&(r._media.currentTime+=e+JUMP_GAP_STEP,logger.warn(r.TAG,"progress, gap=",e))}r._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.PROGRESS),r._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.DURATION_CHANGE)})),_defineProperty$2(_assertThisInitialized$1(r),"_onEnded",(function(){var e;logger.log(r.TAG,"ended!"),null===(e=_assertThisInitialized$1(r))||void 0===e||e._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ENDED)})),_defineProperty$2(_assertThisInitialized$1(r),"_onOnceProgress",(function(){if(r._media.buffered.length){var e=r._media.buffered.start(0);e&&(r._media.currentTime=e+JUMP_GAP_STEP,logger.log(r.TAG,"start gap:",e)),r._media.removeEventListener("progress",r._onOnceProgress)}})),_defineProperty$2(_assertThisInitialized$1(r),"_onError",(function(){var e;r._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,r._assembleErr("audio error: ".concat(null===(e=r._media.error)||void 0===e?void 0:e.message),AUDIO_ERROR_SUBCODE))})),_defineProperty$2(_assertThisInitialized$1(r),"_appendChunk",(function(e,t){if(!r.noAudio&&t.samples.length){if(r._codec||(2!==t.objectType&&5!==t.objectType?r._codec="mp4a.40.5":r._codec=t.codec,r._isTempMedia&&r._switchMedia(r._codec)),t.samples.forEach((function(e){e.baseMediaDecodeTime=t.baseMediaDecodeTime,r._sampleQueue.push(e)})),t.samples=[],!r._meta)return r._meta=_objectSpread2(_objectSpread2({},t),{},{exist:function(){return!0},hasSample:function(){return!0},samples:[]}),logger.warn(r.TAG,"audio set metadata",r._meta),void r._doAppendWrapper();r._meta.sampleRate!==t.sampleRate&&(logger.warn(r.TAG,"discontinue: ".concat(r._meta.sampleRate," -> ").concat(t.sampleRate)),r._needInitSegment=!0,Object.keys(t).forEach((function(e){r._meta[e]=t[e]}))),!r._inProcessing&&r._sampleQueue.length&&r._doAppendWrapper()}})),_defineProperty$2(_assertThisInitialized$1(r),"_doAppend",function(){var e=_asyncToGenerator$1(_regeneratorRuntime$1().mark((function e(t){var n,i,a;return _regeneratorRuntime$1().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r._remuxer||(r._remuxer=new FMP4Remuxer({samples:[],exist:function(){return!1}},t)),n=t.samples,r._sourceCreated){e.next=12;break}return r.analyse.addAudioMseOpenStart(),e.next=6,r._mse.open();case 6:r._sourceCreated=!0,logger.log(r.TAG,"video/mp4;codecs=".concat(r._codec)),r._mse.createSource(t.type,"video/mp4;codecs=".concat(r._codec)),r.analyse.addAudioMseOpend(),logger.log(r.TAG,"sb created!"),r._checkAutoPlay();case 12:if(i=r._remuxer.remux(r._needInitSegment),!r._needInitSegment||i.audioInitSegment){e.next=15;break}return e.abrupt("return");case 15:return r._needInitSegment=!1,a=[],i.audioInitSegment&&a.push(r._mse.append(t.type,i.audioInitSegment)),i.audioSegment&&a.push(r._mse.append(t.type,i.audioSegment)),e.abrupt("return",Promise.all(a).then((function(){return n[n.length-1].dts/1e3})).then((function(){r._firstTimeAppendedBuffer||(r._firstTimeAppendedBuffer=!0,r.analyse.addAudioFirstTimeAppended())})));case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),_defineProperty$2(_assertThisInitialized$1(r),"_doPlay",(function(){r._media.play().catch((function(){}))})),_defineProperty$2(_assertThisInitialized$1(r),"_doPause",(function(){r._media.pause()})),_defineProperty$2(_assertThisInitialized$1(r),"_doSeek",(function(e){r._ready=!1,r._media.currentTime=e})),_defineProperty$2(_assertThisInitialized$1(r),"_doChaseFrame",(function(e){var t=e.position;r._seekNoSideEffect=!0,r._media.currentTime=t})),_defineProperty$2(_assertThisInitialized$1(r),"_startRender",(function(){logger.log(r.TAG,"start render"),r._startRendered=!0,r._media.play().catch((function(){}))})),r.TAG="AudioMseRender",r._reuseMse=getDecodeCapacaity().reuseMseForAudio,r._initMedia(),r}return _createClass$2(a,[{key:"isMse",get:function(){return!0}},{key:"media",get:function(){return this._media}},{key:"currentTime",get:function(){return this._media.currentTime}},{key:"buffered",get:function(){return this._media.buffered}},{key:"duration",get:function(){return Number.isNaN(this._media.duration)?1/0:this._media.duration},set:function(e){this._duration=e,this._updateDuration(e)}},{key:"audioCanAutoplay",get:function(){return this._audioCanAutoplay||this.noAudio}},{key:"_initMedia",value:function(){if(!this._reuseMse||!mediaCache.hasCached)return logger.log(this.TAG,"init media and mse directly"),this._media=document.createElement("video"),this._media.autoplay=!0,this._mse=new MSE,this._bindEvents(),this._bindMediaEvents(),void this._mse.bindMedia(this._media);logger.log(this.TAG,"bind media temporary"),this._media=mediaCache.tempMedia,this._bindEvents(),this._isTempMedia=!0}},{key:"_switchMedia",value:function(e){var t=this._media,r=mediaCache.getCachedMedia(CODEC_MAP[e]);r?(logger.warn(this.TAG,"switch to cached media for audio play! codec=".concat(e)),this._media=r.media,this._mse=r.mse,this._bindMediaEvents(),this._updateDuration(this._duration),this._media.currentTime=JUMP_GAP_STEP,this._sourceCreated=!0,this._audioCanAutoplay=!0,this.analyse.addAudioMseOpend()):this._initMedia(),this._media.volume=t.volume,this._media.playbackRate=t.playbackRate,this._isTempMedia=!1}},{key:"_getBufferGap",value:function(){for(var e=this.buffered,t=0,r=e.length;t<r;t++)if(!(e.end(t)<this.currentTime))return e.start(t)-this.currentTime;return 0}},{key:"canSeek",value:function(){return!0}},{key:"resume",value:function(){return this._media.play()}},{key:"pause",value:function(){return this._media.pause()}},{key:"seekNoSideEffect",value:function(e){this._doChaseFrame(e)}},{key:"dump",value:function(){}},{key:"_emitTimelineEvents",value:function(e,t,r){var n,i;null===(n=this._parent)||void 0===n||null===(i=n.emit)||void 0===i||i.call(n,e,t,r)}},{key:"_assembleErr",value:function(e,t){var r=new Error(e);return r.code=3,r.subCode=t,r}},{key:"_bindEvents",value:function(){var e=this;_get(_getPrototypeOf$1(a.prototype),"_bindEvents",this).call(this),this._parent.on(Events$2.DECODE_EVENTS.CHASE_AUDIO_FRAME,this._doChaseFrame),this._parent.on(Events$2.TIMELINE.UPDATE_VOLUME,(function(t){e._media.volume=t,e._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.VOLUME_CHANGE)})),this._parent.on(Events$2.TIMELINE.END_OF_STREAM,(function(){var t;e.reuseMseForAudio||(null===(t=e._mse)||void 0===t||t.endOfStream())})),this._parent.on(Events$2.TIMELINE.SET_PLAYBACKRATE,(function(t){logger.log(e.TAG,"change playbackrate, ",t),e._media.playbackRate=t}))}},{key:"_bindMediaEvents",value:function(){this._media.addEventListener("canplay",this._onCanplay),this._media.addEventListener("playing",this._onPlaying),this._media.addEventListener("waiting",this._onWaiting),this._media.addEventListener("seeked",this._onSeeked),this._media.addEventListener("progress",this._onProgress),this._media.addEventListener("ended",this._onEnded),this._media.addEventListener("progress",this._onOnceProgress),this._media.addEventListener("error",this._onError)}},{key:"_updateDuration",value:(n=_asyncToGenerator$1(_regeneratorRuntime$1().mark((function e(t){return _regeneratorRuntime$1().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._mse){e.next=7;break}if(this._mse.isOpened){e.next=4;break}return e.next=4,this._mse.open();case 4:return e.next=6,this._mse.updateDuration(t);case 6:logger.log(this.TAG,"update duration",t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_doAppendWrapper",value:(r=_asyncToGenerator$1(_regeneratorRuntime$1().mark((function e(){var t;return _regeneratorRuntime$1().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._meta.samples=this._sampleQueue.slice(),this._meta.baseMediaDecodeTime=this._meta.samples[0].baseMediaDecodeTime,this._sampleQueue=[],e.prev=3,this._inProcessing=!0,e.next=7,this._doAppend(this._meta);case 7:if(t=e.sent,this.isLive&&this._emitTimelineEvents(Events$2.TIMELINE.UPDATE_SEGMENT_END,t),this._inProcessing=!1,!this._sampleQueue.length){e.next=13;break}return e.next=13,this._doAppendWrapper();case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,this._assembleErr("audio error: ".concat(null===e.t0||void 0===e.t0?void 0:e.t0.message),AUDIO_ERROR_SUBCODE));case 18:case"end":return e.stop()}}),e,this,[[3,15]])}))),function(){return r.apply(this,arguments)})},{key:"_checkAutoPlay",value:function(){var e=this;this._media.addEventListener("canplay",(function t(){var r=e._media.volume;e._media.volume=Math.min(r,.1);var n=e._media.play();(n=n.then?n:Promise.reject()).then((function(){logger.log(e.TAG,"auto play by checkAutoPlay!"),e._audioCanAutoplay=!0})).catch((function(){logger.warn(e.TAG,"can’t auto play!"),e._audioCanAutoplay=!1,e.emit(Events$2.AUDIO.AUDIO_NOT_ALLOWED_AUTOPLAY)})).finally((function(){e._media.volume=r,e._startRendered||(e._media.pause(),logger.log(e.TAG,"auto paused by checkAutoPlay!")),e._media.removeEventListener("canplay",t)}))}))}},{key:"_destroy",value:(t=_asyncToGenerator$1(_regeneratorRuntime$1().mark((function e(){var t,r,n;return _regeneratorRuntime$1().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(logger.log(this.TAG,"destroy audio render"),this._remuxer=null,this.removeAllListeners(),this._media.removeEventListener("canplay",this._onCanplay),this._media.removeEventListener("playing",this._onPlaying),this._media.removeEventListener("waiting",this._onWaiting),this._media.removeEventListener("seeked",this._onSeeked),this._media.removeEventListener("progress",this._onProgress),this._media.removeEventListener("ended",this._onEnded),this._media.removeEventListener("progress",this._onOnceProgress),this._media.removeEventListener("error",this._onError),this._reuseMse){e.next=17;break}return null===(t=this._mse)||void 0===t||t.endOfStream(),e.next=15,null===(r=this._mse)||void 0===r?void 0:r.unbindMedia();case 15:e.next=20;break;case 17:null===(n=this._mse)||void 0===n||n.clearAllBuffer(),mediaCache.cacheMedia({codec:this._codec,media:this._media,mse:this._mse}),logger.log(this.TAG,"cache media for audio play, codec=",this._codec);case 20:this._meta&&(this._meta.duration=0),this._mse=null,this._media=null;case 23:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}],[{key:"isSupported",value:function(){return getDecodeCapacaity().audioWithMse&&!!window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="mp4a.40.5"')}}]),a}(),TOLERANCE$1=.1,MAX_TOLERANCE=1,VideoTimeRange=function(){function e(t){_classCallCheck$2(this,e),this.TAG="VideoTimeRange",this._parent=t,this._baseDts=0,this._lastDuration=0,this._duration=0,this._bitrate=0,this._totalSize=0,this._buffers=[],this._currentFrameQueue=[],this._frameIndexInQueue=0,this._delayEstimateList=[],this._keyframeQueue=[]}return _createClass$2(e,[{key:"isLive",get:function(){return this._parent.isLive}},{key:"baseDts",get:function(){return this._baseDts}},{key:"duration",get:function(){return this._duration},set:function(e){this._duration=e}},{key:"buffered",get:function(){var e=this;if(this.isLive)return{length:this._duration?1:0,start:function(){return 0},end:function(){return e._duration}};var t=this._mergeBufferRanges();return{length:t.length,start:function(e){var r=t[e];return r?r.start:0},end:function(e){var r=t[e];return r?r.end:1/0}}}},{key:"bufferStart",get:function(){var e;return(null===(e=this._buffers[0])||void 0===e?void 0:e.start)||0}},{key:"frameLength",get:function(){return this._currentFrameQueue.length}},{key:"keyFrameLength",get:function(){return this._keyframeQueue.length}},{key:"totalSize",get:function(){return this._totalSize}},{key:"bitrate",get:function(){return this._bitrate},set:function(e){this._bitrate=e}},{key:"lastDuration",get:function(){return this._lastDuration}},{key:"frames",get:function(){return this._currentFrameQueue}},{key:"getCurrentTime",value:function(e){return this._lastDuration+(e-this._baseDts)/1e3}},{key:"resetDts",value:function(e){this._baseDts=e}},{key:"_mergeBufferRanges",value:function(){var e=this._buffers.sort((function(e,t){return e.start>t.start?1:-1})),t=e.length,r=[];if(!t)return r;for(var n={start:e[0].start,end:e[0].end},i=1;i<t;i++){var a=e[i];Math.abs(n.end-a.start)<TOLERANCE$1?n.end=a.end:(r.push(n),n={start:a.start,end:a.end})}return r.push(n),r}},{key:"_caclBaseDts",value:function(e){-1===this._baseDts&&e&&(this._baseDts=e.dts,logger.log(this.TAG,"set baseDts: ",this._baseDts,"frame len:",this._currentFrameQueue.length))}},{key:"_updateDuration",value:function(e){for(var t=e.length,r=e[t-1],n=0;n<t;n++){var i=e[n];if(i&&i.options&&i.options.meta){var a=e[n-1]||this._currentFrameQueue[this._currentFrameQueue.length-1];a?this._lastDuration+=(a.dts-this._baseDts)/1e3:this._lastDuration=this._duration,logger.log(this.TAG,"updateBaseDts,record lastDuration:",this._lastDuration),this._baseDts=i.dts;break}}r&&(this._duration=(r.dts-this._baseDts)/1e3+this._lastDuration)}},{key:"_estimateBitRate",value:function(e){var t=e.length;if(t<=2){if(this._delayEstimateList=this._delayEstimateList.concat(e),(t=this._delayEstimateList.length)<=30)return;e=this._delayEstimateList,this._delayEstimateList=[]}for(var r=0,n=0;n<t;n++){var i=e[n];r+=i.data?i.data.length:i.units.reduce((function(e,t){return e+t.byteLength}),0)}this._totalSize+=r;var a=r/(e[t-1].dts-e[0].dts);this._bitrate=parseInt(8e3*a)}},{key:"_beforeAppendVodBuffer",value:function(e){var t=this;if(e.length){for(var r=[],n=[],i=0,a=e.length;i<a;i++)e[i].keyframe&&(r.push(n),n=[]),n.push(e[i]);n.length&&r.push(n),r.forEach((function(e){return t._appendVodBuffer(e)}))}}},{key:"_appendVodBuffer",value:function(e){if(e.length){var t=e[0],r=e[e.length-1],n=(t.dts-this._baseDts)/1e3,i=(r.dts-this._baseDts)/1e3;logger.enable&&logger.log(this.TAG,"add new buffer range [".concat(n," , ").concat(i,"]")),this._buffers.filter((function(e){return n>=e.start&&i<=e.end})).length||(this._buffers.push({start:n,end:i,duartion:i-n,frames:e.slice()}),this._buffers.sort((function(e,t){return e.start>t.start?1:-1})),this._afterAppendVodBuffer())}}},{key:"_afterAppendVodBuffer",value:function(){if(this._buffers.filter((function(e){var t;return!(null!==(t=e.frames[0])&&void 0!==t&&t.keyframe)})).length){for(var e=this._buffers,t=this._buffers.length,r=[],n=this._buffers[0],i=1;i<t;i++){var a;null!==(a=e[i].frames[0])&&void 0!==a&&a.keyframe?(r.push(n),n=e[i]):(n.frames=n.frames.concat(e[i].frames),n.end=e[i].end,n.duartion=n.end-n.start)}r.push(n),this._buffers=r}}},{key:"_recordKeyframes",value:function(e){var t=this;e.forEach((function(e){if(e.keyframe){var r=(e.dts-t._baseDts)/1e3;t._keyframeQueue.push({position:r,frame:e})}})),this._keyframeQueue=this._keyframeQueue.sort((function(e,t){return e.position>t.position?1:-1})),this.isLive&&this._keyframeQueue.length>40&&this._keyframeQueue.splice(0,20)}},{key:"toAnnexBNalu",value:function(e){e.forEach((function(e){var t=e.units;if(t){var r=t.reduce((function(e,t){return e+4+t.byteLength}),0),n=new Uint8Array(r),i=0;t.forEach((function(e){n.set([0,0,0,1],i),i+=4,n.set(e,i),i+=e.byteLength})),e.units=null,e.data=n}}))}},{key:"append",value:function(e,t,r){r&&this.toAnnexBNalu(e),this._caclBaseDts(e[0]),t&&this._updateDuration(e),this._estimateBitRate(e),this._recordKeyframes(e),this.isLive?this._currentFrameQueue=this._currentFrameQueue.concat(e):this._beforeAppendVodBuffer(e)}},{key:"updateSegmentEnd",value:function(e){var t=this._buffers[this._buffers.length-1];t&&(Math.abs(t.end-e)<.5||(t.end=e,t.duartion=e-t.start,logger.log(this.TAG,"video data lack, reset end:",e)))}},{key:"getFrame",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.isLive)return this._currentFrameQueue.shift();if(!(e=this._currentFrameQueue[this._frameIndexInQueue])){if(!(e=this._currentFrameQueue[--this._frameIndexInQueue]))return;if(!this.switchBuffer((e.dts-this._baseDts)/1e3,this._frameIndexInQueue++,t))return;return this.getFrame(++t)}return this._frameIndexInQueue++,e}},{key:"getFramesForPreciseSeek",value:function(e){return this._currentFrameQueue.filter((function(t){return t.dts<=e}))}},{key:"updateFrameIndexForPreciseSeek",value:function(e){this._frameIndexInQueue=e}},{key:"switchBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)>=20)){e=e||this.bufferStart;var r=this._buffers.filter((function(t){return t.start<e+TOLERANCE$1&&t.end>=e+TOLERANCE$1}))[0];if(!r){var n=this._buffers.find((function(t){return t.start>=e}));return n&&n.start-e<MAX_TOLERANCE?(this._currentFrameQueue=n.frames.slice(0),this._frameIndexInQueue=0,n):void 0}return r.frames[0].dts>=e?(this._currentFrameQueue=r.frames.slice(0),this._frameIndexInQueue=0,logger.log(this.TAG,"switch video buffer, time:".concat(e," , buffer:[").concat(r.start," , ").concat(r.end,"], index=0")),r):r.frames.length>t?(this._currentFrameQueue=r.frames.slice(0),logger.log(this.TAG,"switch video buffer, in the same gop and more frame got, time:".concat(e," , buffer:[").concat(r.start," , ").concat(r.end,"], index=").concat(t)),r):void logger.log(this.TAG,"switch video buffer, in the same gop and no more frame got, time:".concat(e," , buffer:[").concat(r.start," , ").concat(r.end,"], index=").concat(t))}}},{key:"getSeekStartPosition",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(this._keyframeQueue.forEach((function(r){r.position<=e&&(t=r)})),t)return e-t.position<r?t:void 0}},{key:"nextFrame",value:function(){return this._currentFrameQueue[0]}},{key:"deletePassed",value:function(e){this._currentFrameQueue=this._currentFrameQueue.filter((function(t){return t.dts>=e}))}},{key:"getDtsOfTime",value:function(e){var t=e-this._lastDuration;return this._baseDts+1e3*t}},{key:"clean",value:function(){this._currentFrameQueue=[]}},{key:"destroy",value:function(){this._currentFrameQueue=[],this._buffers=[]}}]),e}();function _checkClose(e){var t;(null===(t=e.buffer)||void 0===t?void 0:t.close)&&e.buffer.close()}var FrameQueue=function(){function e(t){_classCallCheck$2(this,e),this.TAG="FrameQueue",this._parent=t,this._lastGopId=0,this._frames=[]}return _createClass$2(e,[{key:"currentTimeDts",get:function(){return this._parent.preciseVideoDts}},{key:"length",get:function(){return this._frames.length}},{key:"frames",get:function(){return this._frames}},{key:"append",value:function(e){e.info?this._frames.push(e):_checkClose(e)}},{key:"appendVodFrame",value:function(e){this._frames.push(e)}},{key:"nextFrame",value:function(){var e=this._frames.length;return 1===this._parent.noAudio&&e>3&&(this._frames=this._frames.slice(e-2)),this._frames[0]}},{key:"shift",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this._frames.shift();return this.deletePassed(e),t}},{key:"deletePassed",value:function(e){this._frames=this._frames.filter((function(t){return!!(t.info&&t.info.dts>e)||(_checkClose(t),!1)}))}},{key:"empty",value:function(){this._frames.forEach((function(e){return _checkClose(e)})),this._frames=[]}},{key:"destroy",value:function(){this.empty(),this._lastGopId=0}}]),e}(),FrameRenderCache=function(){function e(){_classCallCheck$2(this,e),_defineProperty$2(this,"_queue",[]),_defineProperty$2(this,"TAG","FrameRenderCache")}return _createClass$2(e,[{key:"cacheCvs",value:function(e){this._queue.push(e),logger.log(this.TAG,"cache canvas!")}},{key:"getCachedCvs",value:function(){var e=this._queue.pop();return e&&logger.log(this.TAG,"get cached canvas!"),e}}]),e}(),frameRenderCache=new FrameRenderCache,FrameRender=function(){function e(t,r){_classCallCheck$2(this,e),this.TAG="FrameRender",this.configs=Object.assign({},t),this.parent=r,this.canvas=this.configs.canvas,this.canvas.glInstance=this,this.meta=Object.assign({},this.configs.meta),this.frameRenderCache=frameRenderCache,this._initMeta(),this._initContextGL(),this.contextGL&&(this._initProgram(),this._initBuffers(),this._initTextures())}return _createClass$2(e,[{key:"_initMeta",value:function(){this.chroma=this.meta.chromaFormat,this.height=this.meta.height,this.width=this.meta.width,this.canvas.width===this.meta.width&&this.canvas.height===this.meta.height||(this.canvas.width=this.meta.width,this.canvas.height=this.meta.height,this.parent.emitResizeEvent())}},{key:"_initContextGL",value:function(){if("2d"!==this.configs.type){for(var e=this.canvas,t=null,r=["webgl","experimental-webgl","moz-webgl","webkit-3d"],n=0;!t&&n<r.length;){var i=r[n];try{t=e.getContext(i,this.configs.glCtxOptions),logger.log("FrameRender","use=",i,this.configs.glCtxOptions);break}catch(e){t=null}t&&"function"==typeof t.getParameter||(t=null),++n}this.contextGL=t}else this.ctx=this.canvas.getContext("2d")}},{key:"_initProgram",value:function(){var e=this.contextGL,t=["attribute vec4 vertexPos;","attribute vec4 texturePos;","attribute vec4 uTexturePos;","attribute vec4 vTexturePos;","varying vec2 textureCoord;","varying vec2 uTextureCoord;","varying vec2 vTextureCoord;","void main()","{"," gl_Position = vertexPos;"," textureCoord = texturePos.xy;"," uTextureCoord = uTexturePos.xy;"," vTextureCoord = vTexturePos.xy;","}"].join("\n"),r=["precision highp float;","varying highp vec2 textureCoord;","varying highp vec2 uTextureCoord;","varying highp vec2 vTextureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","uniform mat4 YUV2RGB;","void main(void) {"," highp float y = texture2D(ySampler, textureCoord).r;"," highp float u = texture2D(uSampler, uTextureCoord).r;"," highp float v = texture2D(vSampler, vTextureCoord).r;"," gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n"),n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,t),e.compileShader(n),e.getShaderParameter(n,e.COMPILE_STATUS)||console.log("Vertex shader failed to compile: "+e.getShaderInfoLog(n));var i=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||console.log("Fragment shader failed to compile: "+e.getShaderInfoLog(i));var a=e.createProgram();e.attachShader(a,n),e.attachShader(a,i),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)||console.log("Program failed to compile: "+e.getProgramInfoLog(a)),e.useProgram(a);var o=e.getUniformLocation(a,"YUV2RGB");e.uniformMatrix4fv(o,!1,[1.16438,0,1.59603,-.87079,1.16438,-.39176,-.81297,.52959,1.16438,2.01723,0,-1.08139,0,0,0,1]),this.shaderProgram=a}},{key:"_initBuffers",value:function(){var e=this.contextGL,t=this.shaderProgram,r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var n=e.getAttribLocation(t,"vertexPos");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0);var i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var a=e.getAttribLocation(t,"texturePos");e.enableVertexAttribArray(a),e.vertexAttribPointer(a,2,e.FLOAT,!1,0,0),this.texturePosBuffer=i;var o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var s=e.getAttribLocation(t,"uTexturePos");e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),this.uTexturePosBuffer=o;var u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var c=e.getAttribLocation(t,"vTexturePos");e.enableVertexAttribArray(c),e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0),this.vTexturePosBuffer=u}},{key:"_initTextures",value:function(){var e=this.contextGL,t=this.shaderProgram,r=this._initTexture(),n=e.getUniformLocation(t,"ySampler");e.uniform1i(n,0),this.yTextureRef=r;var i=this._initTexture(),a=e.getUniformLocation(t,"uSampler");e.uniform1i(a,1),this.uTextureRef=i;var o=this._initTexture(),s=e.getUniformLocation(t,"vSampler");e.uniform1i(s,2),this.vTextureRef=o,e.pixelStorei(e.UNPACK_ALIGNMENT,1)}},{key:"_initTexture",value:function(){var e=this.contextGL,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),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),t}},{key:"_drawPictureGL",value:function(e,t,r,n,i){var a=n*r,o=i*r/2;444!==this.chroma&&422!==this.chroma||(o*=2);var s={yData:(e=new Uint8Array(e)).subarray(0,a),uData:e.subarray(a,a+o),vData:e.subarray(a+o,a+o+o)};this._drawPictureGL420(s,t,r,n,i)}},{key:"_drawPictureGL420",value:function(e,t,r,n,i){var a=this.contextGL,o=this.texturePosBuffer,s=this.uTexturePosBuffer,u=this.vTexturePosBuffer,c=this.yTextureRef,l=this.uTextureRef,d=this.vTextureRef,h=e.yData,f=e.uData,p=e.vData,m=n,y=r,g=i,v=r/2;422!==this.chroma&&444!==this.chroma||(v=r);var b=i,_=v,A=this.canvas.width/this.width,T=this.canvas.height/this.height,E=0,S=0,$=this.canvas.width,I=this.canvas.height;A<T?(I=this.height*this.canvas.width/this.width,S=parseInt((this.canvas.height-this.height*this.canvas.width/this.width)/2)):($=this.width*this.canvas.height/this.height,E=parseInt((this.canvas.width-this.width*this.canvas.height/this.height)/2)),a.viewport(E,S,$,I);var w=new Float32Array([1,0,0,0,1,1,0,1]);a.bindBuffer(a.ARRAY_BUFFER,o),a.bufferData(a.ARRAY_BUFFER,w,a.DYNAMIC_DRAW);var R=new Float32Array([1,0,0,0,1,1,0,1]);a.bindBuffer(a.ARRAY_BUFFER,s),a.bufferData(a.ARRAY_BUFFER,R,a.DYNAMIC_DRAW);var k=new Float32Array([1,0,0,0,1,1,0,1]);a.bindBuffer(a.ARRAY_BUFFER,u),a.bufferData(a.ARRAY_BUFFER,k,a.DYNAMIC_DRAW),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,c),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,m,y,0,a.LUMINANCE,a.UNSIGNED_BYTE,h),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,g,v,0,a.LUMINANCE,a.UNSIGNED_BYTE,f),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,d),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,b,_,0,a.LUMINANCE,a.UNSIGNED_BYTE,p),a.drawArrays(a.TRIANGLE_STRIP,0,4)}},{key:"_drawPicture2d",value:function(e){if(e&&this.canvas){this.ctx||(this.ctx=this.canvas.getContext("2d"));var t=e.displayWidth||e.width,r=e.displayHeight||e.height;this.canvas.height===r&&this.canvas.width===t||(this.canvas.height=r,this.canvas.width=t);try{this.ctx.drawImage(e.dom||e,0,0,t,r)}catch(t){console.error(this.TAG,"_drawPicture2d",e,e.dom,t,t.message)}}}},{key:"_resize",value:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.canvas.width=e,this.canvas.height=t,this.parent.emitResizeEvent())}},{key:"render",value:function(e,t,r,n,i){this._resize(t,r),this.contextGL?this._drawPictureGL(e,t,r,n,i):this._drawPicture2d(e)}},{key:"resetMeta",value:function(e){this.meta=Object.assign({},e)}},{key:"updateBind",value:function(e,t){this.parent=e,this.resetMeta(t)}},{key:"destroy",value:function(e){this.parent=null,this.canvas.style.display="none",e&&(this.contextGL&&this.contextGL.clear(this.contextGL.DEPTH_BUFFER_BIT|this.contextGL.COLOR_BUFFER_BIT),frameRenderCache.cacheCvs(this.canvas))}}]),e}(),MAX_QUEUE_LENGTH=5,DecodeEstimate=function(){function e(t){_classCallCheck$2(this,e),_defineProperty$2(this,"_lowDecodeThreshold",getDecodeCapacaity().lowDecodeThreshold/MAX_QUEUE_LENGTH),this.TAG="DecodeEstimate",this._needEstimate=!0,this._parent=t,this._lastDecodeDot=0,this._lastDecodeCost=0,this._lastFrameDts=0,this._dtsDeltas=[],this._decodeCosts=[],this._lowDecodeQueue=[],this._fps=0,this._decodeFps=0,this._gopLength=0,this._webcodec=!1}return _createClass$2(e,[{key:"fps",get:function(){return this._fps}},{key:"decodeFps",get:function(){return this._decodeFps}},{key:"decodeCost",get:function(){return this._lastDecodeCost}},{key:"gopLength",get:function(){return this._gopLength}},{key:"webcodec",set:function(e){this._webcodec=e}},{key:"updateGopCount",value:function(){this._gopLength++}},{key:"needEstimateFps",value:function(){this._needEstimate=!0}},{key:"addDecodeInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{dts:0};this._estimateDecodeFps(e),this._estimateFps(e)}},{key:"resetDecodeDot",value:function(e){this._lastDecodeDot=e||0}},{key:"reset",value:function(){this._decodeCosts=[],this._lowDecodeQueue=[]}},{key:"_estimateFps",value:function(e){if(this._needEstimate)if(this._lastFrameDts){var t=e.dts-this._lastFrameDts;if(this._lastFrameDts=e.dts,!(Math.abs(t)>200)){this._dtsDeltas.push(t);var r=this._dtsDeltas.length;r<MAX_QUEUE_LENGTH||(this._fps=Math.ceil(1e3/this._avg(this._dtsDeltas,r)),logger.log(this.TAG,"estimate fps:",this._fps),this._needEstimate=!1)}}else this._lastFrameDts=e.dts}},{key:"_estimateDecodeFps",value:function(e){if(this._lastDecodeDot){var t=performance.now(),r=t-this._lastDecodeDot;this._lastDecodeDot=t,e.cost=r,this._lastDecodeCost=r,this._decodeCosts.push(r);var n=this._decodeCosts.length;if(!(n<MAX_QUEUE_LENGTH)){var i=this._avg(this._decodeCosts,n);this._decodeFps=Math.floor(1e3/i),this._decodeCosts=[],this._lowDecodeDetect()}}else this._lastDecodeDot=performance.now()}},{key:"_avg",value:function(e,t){var r=e.reduce((function(e,t){return e+=t}),0);return Math.floor(r/t)||1}},{key:"_lowDecodeDetect",value:function(){this._decodeFps?(this._decodeFps<this._fps*this._parent.playbackRate+(this.webcodec?0:3)?this._lowDecodeQueue.push(this._decodeFps):this._lowDecodeQueue.pop(),this._lowDecodeQueue.length>this._lowDecodeThreshold&&(this._lowDecodeQueue=[],logger.log(this.TAG,"解码效率过低,应该降级"),this._parent.emit(Events$2.VIDEO.DECODE_LOW_FPS))):this._parent.emit(Events$2.VIDEO.DECODE_LOW_FPS)}}]),e}(),shell="\n var timer;\n\n function initTimer (interval) {\n destroy()\n clearInterval(timer);\n timer = setInterval(() => {\n self.postMessage({type: 'NEXT_TICK'});\n }, interval)\n }\n\n function destroy () {\n clearInterval(timer);\n }\n\n self.onmessage = function (e) {\n var {type,interval} = e.data;\n switch (type) {\n case 'START':\n initTimer(interval);\n break;\n case 'DESTROY':\n destroy();\n break;\n }\n }\n",timerWorkerCache=[],TickTimer=function(){function e(t){var r=this;_classCallCheck$2(this,e),_defineProperty$2(this,"_doTask",(function(){var e;null===(e=r._task)||void 0===e||e.call(r)})),this._task=t;var n=new Blob([shell],{type:"application/javascript"});this._worker=timerWorkerCache.pop()||new Worker(URL.createObjectURL(n)),this._bindEvent()}return _createClass$2(e,[{key:"_bindEvent",value:function(){this._worker.addEventListener("message",this._doTask)}},{key:"start",value:function(e){(e=parseInt(e))<10&&(e=10),e>60?e=60:e>25&&(e=25),this._worker.postMessage({type:"START",interval:e})}},{key:"stop",value:function(){this._worker.postMessage({type:"DESTROY"})}},{key:"destroy",value:function(){this._worker&&(this._worker.postMessage({type:"DESTROY"}),this._worker.removeEventListener("message",this._doTask),timerWorkerCache.push(this._worker),logger.log("TickTimer","unbind timer event"),this._worker=null,this._task=null)}}]),e}(),HAVE_NOTHING=0,HAVE_METADATA=1,HAVE_CURRENT_DATA=2,HAVE_FUTURE_DATA=3,HAVE_ENOUGH_DATA=4,MEDIA_ERR_DECODE=3,VideoBaseRender=function(e){_inherits$1(r,BaseRender);var t=_createSuper$1(r);function r(e,n){var i;return _classCallCheck$2(this,r),(i=t.call(this,e,n))._timeRange=new VideoTimeRange(_assertThisInitialized$1(i)),i._decodeEstimate=new DecodeEstimate(_assertThisInitialized$1(i)),i._frameQueue=new FrameQueue(_assertThisInitialized$1(i)),i._lastTimeupdate=0,i._renderCost=0,i._canAutoPlay=!0,i._videoDecode=!1,i._inSeeking=!1,i._frameRender=null,i._configuration=null,i._render=i._render.bind(_assertThisInitialized$1(i)),i._tickTimer=new TickTimer(i._render),i._initCanvas(e),i._bindEvents(),i}return _createClass$2(r,[{key:"canAutoPlay",get:function(){return this._canAutoPlay}},{key:"canvas",get:function(){return this._canvas}},{key:"timescale",get:function(){return 1e3}},{key:"fps",get:function(){return this._decodeEstimate.fps||this._meta&&this._meta.fpsNum/this._meta.fpsDen||24}},{key:"decodeFps",get:function(){return this._decodeEstimate.decodeFps}},{key:"decodeCost",get:function(){return this._decodeEstimate.decodeCost}},{key:"renderCost",get:function(){return this._renderCost}},{key:"totalSize",get:function(){return this._timeRange.totalSize}},{key:"bitrate",get:function(){return this._timeRange.bitrate},set:function(e){this._timeRange.bitrate=e}},{key:"gopLength",get:function(){return this._decodeEstimate.gopLength}},{key:"is540p",get:function(){return this._canvas.height<720}},{key:"buffered",get:function(){return this._timeRange.buffered}},{key:"inSeeking",get:function(){return this._inSeeking}},{key:"interval",get:function(){return Math.floor(1e3/this.fps/this.playbackRate)}},{key:"playbackRate",get:function(){return this._playbackRate||1}},{key:"baseDts",get:function(){return this._timeRange.baseDts}},{key:"currentTime",get:function(){return this._timeRange.getCurrentTime(this.preciseVideoDts)}},{key:"timelinePosition",get:function(){return this._parent.timelinePosition}},{key:"lastTimelinePosition",get:function(){return this._lastTimelinePosition||0},set:function(e){this._lastTimelinePosition=e}},{key:"audioSyncDts",get:function(){return this._audioDts||this.baseDts},set:function(e){this._audioDts=e}},{key:"preciseVideoDts",get:function(){return this.audioSyncDts+Math.floor(1e3*(this.timelinePosition-this.lastTimelinePosition))}},{key:"readyState",get:function(){var e=this._frameQueue.length||(this.currentTime?1:0);return e?e>=8?HAVE_ENOUGH_DATA:e>=4?HAVE_FUTURE_DATA:e>=2?HAVE_CURRENT_DATA:HAVE_METADATA:HAVE_NOTHING}},{key:"isHevc",get:function(){return!("hev1.1.6.L93.B0"!==(this._meta||{}).codec)}},{key:"videoDecode",get:function(){return this._videoDecode}},{key:"decoderMode",get:function(){var e;return null===(e=this._decodeController)||void 0===e?void 0:e.decoderMode}},{key:"configuration",get:function(){var e,t;return this._configuration||(this._configuration=this._meta.configuration||getAvcc(null===(e=this._meta)||void 0===e?void 0:e.sps[0],null===(t=this._meta)||void 0===t?void 0:t.pps[0])),this._configuration},set:function(e){this._configuration=e.configuration||getAvcc(e.sps[0],e.pps[0])}},{key:"setSeekingStatus",value:function(e){this._inSeeking=e}},{key:"getDtsOfTime",value:function(e){return this._timeRange.getDtsOfTime(e)}},{key:"updateReady",value:function(){this._whenReady()}},{key:"forceRender",value:function(){this._render(!0)}},{key:"getSeekStartPosition",value:function(e,t){return this._timeRange.getSeekStartPosition(e,t)}},{key:"canSeek",value:function(){throw new Error("need override by children")}},{key:"emitResizeEvent",value:function(){null==this||this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.RESIZE)}},{key:"_assembleErr",value:function(e,t){var r=new Error(e);return r.code=MEDIA_ERR_DECODE,r.subCode=t,r}},{key:"_emitTimelineEvents",value:function(e,t,r){var n;null===(n=this._parent)||void 0===n||n.emit(e,t,r)}},{key:"_initCanvas",value:function(e){e.canvas?this._canvas=e.canvas:this._canvas=frameRenderCache.getCachedCvs()||document.createElement("canvas"),this._canvas.style.margin="auto",this._canvas.style.position="absolute",this._canvas.style.pointerEvents="none"}},{key:"_bindEvents",value:function(){var e=this;_get(_getPrototypeOf$1(r.prototype),"_bindEvents",this).call(this);var t=function(t){var r=t.width,n=t.height,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=e._canvas,s=o.width,u=o.height,c=n*s/u,l=r*u/s,d=r-c,h=n-l,f=d*i+"px",p=h*a+"px";e._canvas.style.left=f,e._canvas.style.top=p,logger.warn(e.TAG,"cvsWidth=".concat(s,", cvsHeight=").concat(u,", scaleCvsWidth=").concat(c,", scaleCvsHeight=").concat(l)),logger.warn(e.TAG,"cover position: deltaX=".concat(d,", deltaY=").concat(h,", width=").concat(r,", height=").concat(n,", pX=").concat(f,", pY=").concat(p))};this._parent.on(Events$2.VIDEO.UPDATE_VIDEO_FILLTYPE,(function(r,n){var i=n.width,a=n.height,o=e._canvas,s=o.width,u=o.height,c=!i||i/a>s/u;if(logger.warn(e.TAG,"UPDATE_VIDEO_FILLTYPE isGapX =",c,"type =",r,s,u,i,a),e._canvas.style.maxWidth="initial",e._canvas.style.maxHeight="initial","cover"===r)return c?(e._canvas.style.left=0,e._canvas.style.top=0,e._canvas.style.height="auto",e._canvas.style.width="100%",void t({width:i,height:a},0,.5)):(e._canvas.style.left=0,e._canvas.style.top=0,e._canvas.style.width="auto",e._canvas.style.height="100%",void t({width:i,height:a},.5,0));if("fill"===r)return e._canvas.style.width="100%",void(e._canvas.style.height="100%");(e._canvas.style.top=0,e._canvas.style.bottom=0,e._canvas.style.left=0,e._canvas.style.right=0,e._canvas.style.maxWidth="100%",e._canvas.style.maxHeight="100%",e._canvas.style.width="initial",e._canvas.style.height="initial",s<i&&u<a)&&(s/i>u/a?e._canvas.style.width="100%":e._canvas.style.height="100%")})),this._parent.on(Events$2.VIDEO.UPDATE_VIDEO_COVER_POSITION,t),this._parent.on(Events$2.TIMELINE.SYNC_DTS,(function(t){var r,n=e._frameQueue.nextFrame(),i=n&&n.info&&n.info.dts;if(e.lastTimelinePosition=e.timelinePosition,e.noAudio){var a=e._timeRange.nextFrame();t=t||i||a&&a.dts||0}if(e.audioSyncDts=t,i&&i-t>500&&e._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.LARGE_AV_GAP,{aDts:t,vDts:i,frameLength:e._frameQueue.length,currentTime:e._parent.currentTime,duration:e._parent.duration}),logger.log(e.TAG,"audio current buffer play finish, next buffer dts=",t,"currentTime:",e._parent.currentTime,"preciseVideoDts:",e.preciseVideoDts,"next video frame dts:",i,"frame length:",e._frameQueue.length),!(e._isLive||null!==(r=e._parent)&&void 0!==r&&r.seeking)){var o=e._timeRange.nextFrame();if(o){var s=(o.dts-o.baseDts)/1e3;e._parent.currentTime-s>1&&(logger.warn(e.TAG,"丢帧!"),e.ajustSeekTime(e._parent.currentTime))}}})),this._parent.on(Events$2.TIMELINE.UPDATE_GL_OPTIONS,(function(t){e._config.glCtxOptions=t})),this._parent.on(Events$2.TIMELINE.UPDATE_SEGMENT_END,this._updateSegmentEnd.bind(this)),this.on(Events$2.VIDEO.AUTO_RUN,this._startRender.bind(this)),this._parent.on(Events$2.TIMELINE.SET_PLAYBACKRATE,(function(t){e._playbackRate=t,e._startRender()}))}},{key:"ajustSeekTime",value:function(){throw new Error("need override by children")}},{key:"_resetDts",value:function(e,t){"audio"!==t&&this._timeRange.resetDts(e)}},{key:"_setMetadata",value:function(e,t){if("audio"!==e){logger.warn(this.TAG,"video set metadata"),this._meta=t;var r=t&&t.frameRate&&t.frameRate.fps;r?logger.log(this.TAG,"detect fps:",r):logger.warn(this.TAG,"no detect fps,start estimate"),this._initDecoder()}}},{key:"_initDecoder",value:function(){throw new Error("need override by children")}},{key:"_whenDecoderReady",value:function(){throw new Error("need override by children")}},{key:"_appendChunk",value:function(){throw new Error("need override by children")}},{key:"_startDecode",value:function(){throw new Error("need override by children")}},{key:"_receiveFrame",value:function(e,t){if(this._parent&&this._timeRange){var r=e.info||{};if(this._decodeEstimate.addDecodeInfo(r),!this._isLive&&((r.output||r.keyframe)&&(this.setSeekingStatus(!1),logger.warn(this.TAG,"set seeking status=",!1)),this.inSeeking))return logger.log(this.TAG,"drop frame"),void _checkClose(e);this._isLive?this._frameQueue.append(e):this._frameQueue.appendVodFrame(e),t&&t(),this._ready||this.readyState>=HAVE_METADATA&&this._whenReady()}}},{key:"_startRender",value:function(){logger.log(this.TAG,"start render"),this._tickTimer.start(this.interval)}},{key:"_render",value:function(){throw new Error("need override by children")}},{key:"_updateSegmentEnd",value:function(){throw new Error("need override by children")}},{key:"_whenReady",value:function(){this._ready=!0,this.emit(Events$2.VIDEO.VIDEO_READY),this.noAudio&&this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.PLAYING)}},{key:"_doPlay",value:function(){this._tickTimer.start()}},{key:"_doPause",value:function(){this._tickTimer.stop()}},{key:"_doSeek",value:function(){this._ready=!1,this._frameQueue.destroy()}},{key:"_doChaseFrame",value:function(){throw new Error("need override by children")}},{key:"destroy",value:function(e){var t,r,n,i;null===(t=this._tickTimer)||void 0===t||t.destroy(),null===(r=this._timeRange)||void 0===r||r.destroy(),null===(n=this._frameQueue)||void 0===n||n.destroy(),null===(i=this._frameRender)||void 0===i||i.destroy(e),this._tickTimer=null,this._canvas=null,this._timeRange=null,this._frameQueue=null,this._frameRender=null,this._decodeEstimate=null,this._parent=null,this.removeAllListeners()}}]),r}(),DEFAULT_PLAYBACKRATE=2,CANVAS_COUNT=45,FRAME_DURATION=25,MAX_VIDEO_HEIGHT=720,MAX_FPS=30,MIN_FPS=15,VideoDecoder=function(e){_inherits$1(r,EventEmitter$1);var t=_createSuper$1(r);function r(e){var n;return _classCallCheck$2(this,r),(n=t.call(this)).TAG="VideoDecoder",n._video=n._createVideo(),n._IsInDecoding=!1,n._fps=0,n._framId=null,n._screenShotNum=0,n._allPicNum=0,n._currentBlob=null,n._basePTS=0,n._totleTime=0,n._isVideoONRun=!0,n.firstEmit=!1,n.ptsArray=[],n._currentCanvasHeight=0,n._canvasList=[],n._realFrameDuration=FRAME_DURATION,n._maxVideoHeight=e.maxVideoHeight||MAX_VIDEO_HEIGHT,n._minFPSTime=0,n._maxFPSTime=0,n._playFailed=!1,n._isPhoneSafari=!1,n._createCanvasList(),n._bindEvents(),n}return _createClass$2(r,[{key:"_createCanvasList",value:function(){this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d",{alpha:!1});for(var e=0;e<CANVAS_COUNT;e++){var t=this._createCanvas(),r=t.dom,n=t.ctx;this._canvasList.push({dom:r,ctx:n})}}},{key:"_createCanvas",value:function(){var e=document.createElement("canvas"),t=e.getContext("2d");return{dom:e,ctx:t}}},{key:"_createVideo",value:function(){var e=document.createElement("video");return e.setAttribute("muted",!0),e.setAttribute("autoplay",!0),e.setAttribute("controls",!0),e.setAttribute("webkit-playsinline",!0),e.setAttribute("playsinline",!0),e.setAttribute("x5-video-player-type","h5"),e.setAttribute("x5-video-player-type","h5-page"),e.style.position="absolute",e}},{key:"_initVideo",value:function(e,t){if(e.blobUrl&&void 0!==e.dts){var r=e.blobUrl;this._currentBlob=r,this._basePTS=e.dts,this._currentDuration=e.duration;try{logger.log(this.TAG,"_initVideo, basePTS:",e.dts),this._setVideoSrc(r,t),this._video.paused&&this._videoPlay("_initVideo")}catch(e){console.error(this.TAG,"_initVideo, load error",e)}}else console.error(this.TAG,"_initVideo","input info is error, blobUrl:",e.blobUrl,"dts:",e.dts)}},{key:"_setVideoSrc",value:function(e,t){try{var r=this._video;r.src=e,r.load(),r.playbackRate=DEFAULT_PLAYBACKRATE}catch(e){console.error(this.TAG,"_setVideoSrc",e)}}},{key:"_videoPlay",value:function(e){var t=this,r=this._video;if(logger.log(this.TAG,"_videoPlay, video is pause:",r.paused,e),r&&r.paused){var n=r.play();void 0!==n&&n.then((function(){t._playFailed=!1,logger.log(t.TAG,"_videoPlay success")})).catch((function(e){console.error(t.TAG,"_videoPlay failed,",e.message),t._playFailed=!0,t.emit(Events$2.DECODE_EVENTS.PLAY_FAILED,t.firstEmit)}))}}},{key:"_removeEvents",value:function(){var e=this._video;e.removeEventListener("playing",this._onPlaying.bind(this)),e.removeEventListener("ended",this._onEnded.bind(this)),e.removeEventListener("error",this._onError.bind(this)),e.removeEventListener("loadeddata",this._onLoadeddata.bind(this)),e.removeEventListener("timeupdate",this._onTimeUpdate.bind(this))}},{key:"_bindEvents",value:function(){var e=this,t=this._video;t?(document.addEventListener("visibilitychange",this._onVisibilityChange.bind(this)),t.addEventListener("playing",this._onPlaying.bind(this)),t.addEventListener("ended",this._onEnded.bind(this)),t.addEventListener("error",this._onError.bind(this)),t.addEventListener("loadeddata",this._onLoadeddata.bind(this)),t.addEventListener("timeupdate",this._onTimeUpdate.bind(this)),t.addEventListener("pause",(function(){logger.log("on pause, currentTime, duration:",e._vCurrentTime,e._vDuration)})),this.on("outputresolutionchange",this._onChange.bind(this)),this.on("fpsreduce",(function(t){e._adaptFrameDuration(t)}))):console.error(this.TAG,"_bindEvents")}},{key:"_onTimeUpdate",value:function(){this._lastCurrentTime=this._vCurrentTime}},{key:"_onVisibilityChange",value:function(){this._isVideoONRun="visible"===document.visibilityState}},{key:"_onChange",value:function(e,t){this._width=e,this._height=t}},{key:"_onPlaying",value:function(){this._IsInDecoding&&(console.warn(this.TAG,"_onPlaying","last video not correct end"),this._framId&&(window.cancelAnimationFrame(this._framId),this._framId=null)),logger.log(this.TAG,"_onPlaying, video duration:",this._vDuration,"currentTime:",this._vCurrentTime,"_lastPts:",this._lastPts),this._isInDecoding=!0,this._lastCurrentTime=this._vCurrentTime,this.ptsArray=[],this.playingTime||(this.playingTime=!0),this._getFrame()}},{key:"_onEnded",value:function(e,t){logger.log(this.TAG,"_onEnded","current fmp4 duration is:",this._vDuration,"_isInDecoding:",this._isInDecoding,"_lastPts:",this._lastPts,"_realFrameDuration:",this._realFrameDuration,"from:",t),this._isInDecoding&&(this._isInDecoding=!1,this._lastMp4Duration=Math.min(this._vDuration,this._vCurrentTime),this._framId&&(logger.log(this.TAG,"_onEnded","cancelAnimationFrame"),window.cancelAnimationFrame(this._framId),this._framId=null),this._decodeFPS=parseInt(this._screenShotNum/(this._vDuration/1e3)),this.emit("fps",this._screenShotNum,this._totleTime,this._vDuration,this._metaFPS,{height:this._currentCanvasHeight,relHeight:this._video.videoHeight}),logger.log("_timePerFrame",this._totleTime/this._screenShotNum),this._timePerFrame=this._totleTime/this._screenShotNum,this._screenShotNum=0,this._allPicNum=0,this._totleTime=0,this._currentBlob&&(URL.revokeObjectURL(this._currentBlob),this._currentBlob=null,this._basePTS=0),this.emit(Events$2.DECODE_EVENTS.FRAGMENT_END,this._decodeFPS,this._video.duration))}},{key:"_onError",value:function(){this._isInDecoding=!1;var e=this._video;console.error("video error:",e.error.code,e.error.message),this.emit("error",e.error,this.firstEmit)}},{key:"_onLoadeddata",value:function(){var e=this,t=this._video;t.currentTime=.001,this.firstEmit||(this._playFailed?(t.style.visibility="hidden",this.emit(Events$2.DECODE_EVENTS.APPEND_VIDEO,t),setTimeout((function(){logger.log(e.TAG,"onloadeddata, setTimeout firstEmit:",e.firstEmit),e._getFirstFrame()}),40)):(logger.log(this.TAG,"onloadeddata, firstEmit:",this.firstEmit),this._getFirstFrame()))}},{key:"_getFirstFrame",value:function(){this.firstTime=Date.now();var e=this._vCurrentTime,t=this._basePTS+e,r=this._getImageData(t).imageData;this.firstEmit=!0,this.emit(Events$2.DECODE_EVENTS.FIRST_FRAME,r,t)}},{key:"_getFrame",value:function(){var e=this._video,t=e.videoWidth,r=e.videoHeight;if(this._allPicNum++,this._isInDecoding){if(t||r){var n=this._vCurrentTime,i=this._basePTS+n;if(this.ptsArray.push(i),this._lastCurrentTime&&this._lastCurrentTime===this._vDuration&&(logger.log(this.TAG,"_getFrame, video ended, lastCurrentTime",this._lastCurrentTime,"duration:",this._vDuration,"isInDecoding:",this._isInDecoding),this._onEnded(null,"getFrame")),this._lastPts&&i<=this._lastPts)return void(this._framId=window.requestAnimationFrame(this._getFrame.bind(this)));if(this._lastPts&&i-this._lastPts<this._realFrameDuration)return void(this._framId=window.requestAnimationFrame(this._getFrame.bind(this)));this._screenShotNum++;var a,o=null,s=Date.now();try{o=(a=this._getImageData(i)).imageData}catch(e){console.error(e,a,this._canvasList.length)}this._lastPts=i;var u=Date.now()-s;return this._totleTime+=u,this.emit(Events$2.DECODE_EVENTS.DECODED,o,i),void(this._framId=window.requestAnimationFrame(this._getFrame.bind(this)))}this._framId=window.requestAnimationFrame(this._getFrame.bind(this))}else this._framId&&(window.cancelAnimationFrame(this._framId),this._framId=null)}},{key:"_getImageData",value:function(){var e,t=this._video,r=t.videoWidth,n=t.videoHeight,i=r,a=n;this._width&&this._height&&(i=this._width,a=this._height),a>this._maxVideoHeight&&(a=this._maxVideoHeight,i=parseInt(a*(r/n))),(e=this._canvasList.shift())||(console.warn(this.TAG,"_getImageData, _canvansList length is 0"),e=this._createCanvas()),e.width=i,e.height=a;var o=e.dom,s=e.ctx;if(this._currentCanvasHeight=a,!o)return{imageData:e};o.width!==i&&(o.width=i,o.height=a);try{n&&r&&i&&a&&s.drawImage(t,0,0,r,n,0,0,i,a)}catch(e){console.error(this.TAG,"_getImageData, drawImage:",e)}return{imageData:e}}},{key:"_adaptFrameDuration",value:function(e){e<MIN_FPS?this._minFPSTime++:this._minFPSTime=0,e>MAX_FPS?this._maxFPSTime++:this._maxFPSTime=0,this._minFPSTime>0&&this._decodeFPS<MIN_FPS&&(this._realFrameDuration-=this._timePerFrame,this._realFrameDuration<15&&(this._realFrameDuration=15),this._minFPSTime=0),this._maxFPSTime>0&&this._decodeFPS>MAX_FPS&&(this._realFrameDuration+=this._timePerFrame,this._maxFPSTime=0)}},{key:"_vDuration",get:function(){return parseInt(1e3*this._video.duration)}},{key:"_vCurrentTime",get:function(){return parseInt(1e3*this._video.currentTime)}},{key:"_reset",value:function(){this._isInDecoding=!1,this._lastPts=0,this._screenShotNum=0,this._allPicNum=0,this._totleTime=0}},{key:"reStartDecode",value:function(){this._video.pause(),this._reset();var e=this._currentBlob,t=this._basePTS;this._framId&&(window.cancelAnimationFrame(this._framId),this._framId=null),this._initVideo({blobUrl:e,dts:t})}},{key:"doSeek",value:function(e){if(this._isInDecoding){if(e<=0)return;var t=this._vCurrentTime/1e3+e>=this._vDuration/1e3?this._vDuration/1e3:this._vCurrentTime/1e3+1;console.error("doSeek",t),this._video.currentTime=t}}},{key:"pause",value:function(){this._isInDecoding&&this._video.pause()}},{key:"play",value:function(){if(this._isInDecoding&&this._video.paused)return logger.log("video play",this._vCurrentTime),this._video.play()}},{key:"startDecode",value:function(e,t,r){this._initVideo(e,r),this._metaFPS=t}},{key:"stopDecode",value:function(){this._video.paused||(this._video.pause(),this._reset())}},{key:"canPlayType",value:function(e){return this._video.canPlayType(e)}},{key:"destroy",value:function(){this._isInDecoding=!1,window.cancelAnimationFrame(this._framId),this._video.pause(),this._removeEvents()}},{key:"videoWidth",get:function(){return this._video?this._video.videoWidth:0}},{key:"videoHeight",get:function(){return this._video?this._video.videoHeight:0}}]),r}(),MAX_FRAMESIZE=40,MIN_FRAMESIZE=25,DEFAULT_FPS=20,LEVELS=[{base:720,level:1},{base:540,level:2},{base:360,level:3},{base:280,level:4}],VideoDecoderController=function(e){_inherits$1(r,EventEmitter$1);var t=_createSuper$1(r);function r(e,n){var i;return _classCallCheck$2(this,r),(i=t.call(this)).TAG="VideoDecoderController",i._decoder=new VideoDecoder(e),i._remux=new MP4Remuxer,i._bindEvents(),i._isInit=!1,i._isDataReady=!1,i._ready=!1,i._blobURLList=[],i._isInDecoding=!1,i._mediaSegmentReady=!1,i._parent=n,i._isDecodePause=!1,i._playSuccess=!0,i._isVideoOnRun=!0,i._startDts=0,i._fDuration=0,i._minFPSTime=0,i._lastPts=0,i._frameLengthPerFragment=0,i._gopBufferLength=0,i._maxGopDuration=0,i._minGopDuration=0,i._currentLevel=-1,i._endLevel=e.endLevel||2,i.currentFragmentDuration=0,i._handleKeyFrameVideo=i._handleKeyFrameVideo.bind(_assertThisInitialized$1(i)),i}return _createClass$2(r,[{key:"_bindEvents",value:function(){var e=this;document.addEventListener("visibilitychange",this._onVisibilityChange.bind(this)),this._decoder.on(Events$2.DECODE_EVENTS.APPEND_VIDEO,this._onAppendVideo.bind(this)),this._decoder.on(Events$2.DECODE_EVENTS.PLAY_FAILED,this._onPlayFailed.bind(this)),this._decoder.on("error",this._onError.bind(this)),this._decoder.on(Events$2.DECODE_EVENTS.DECODED,this._onDecoded.bind(this)),this._decoder.on(Events$2.DECODE_EVENTS.FIRST_FRAME,this._onFirstFrame.bind(this)),this._decoder.on(Events$2.DECODE_EVENTS.FRAGMENT_END,this._onFragmentEnd.bind(this)),this._decoder.on("fps",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var i=[e._metaFPS].concat(r,[e._frameLengthPerFragment]);e.emit.apply(e,["fps"].concat(_toConsumableArray$1(i)))})),this.on("keyFrame",this._handleKeyFrameVideo)}},{key:"_onRemuxed",value:function(e){var t={blobUrl:this._createBlobURL(e),dts:this.currentFragmentDts,duration:this.currentFragmentDuration,frameDuration:Math.floor(1e3/this._metaFPS)};this._recordGopDuration(this.currentFragmentDuration),this._pushBlob(t),logger.log(this.TAG,"_onRemuxed","maxgopduration:",this._maxGopDuration,"_gopBufferLength:",this._gopBufferLength),!this._isDataReady&&this._gopBufferLength>=this._maxGopDuration&&this._checkDataReady()}},{key:"_onPlayFailed",value:function(e){this._isInDecoding=!1,this._parent.emit(Events$2.DECODE_EVENTS.PLAY_FAILED,e)}},{key:"_onAppendVideo",value:function(e){this._parent.emit(Events$2.DECODE_EVENTS.APPEND_VIDEO,e)}},{key:"_onVisibilityChange",value:function(){this._isVideoOnRun="visible"===document.visibilityState}},{key:"_onDecoded",value:function(e,t){this._frameLengthPerFragment++;var r=this._buildFrameInfo(e,t);this._parent.emit(Events$2.DECODE_EVENTS.DECODED,r),this._lastPts=t}},{key:"_onFirstFrame",value:function(e,t){var r=this._buildFrameInfo(e,t);this._parent.emit(Events$2.DECODE_EVENTS.FIRST_FRAME,r)}},{key:"_onFragmentEnd",value:function(e,t){var r=this;logger.log(this.TAG,"_onFragmentEnd ,_isDecodePause:",this._isDecodePause,"decodeFPS:",e),e&&this._reduceResolution(e),this._isInDecoding=!1,this._inDecodeId=-1,this._currentInfo=null,this._frameLengthPerFragment=0,this._getBlobLength()&&!this._isDecodePause?this.startDecode():this.loadNextHandle=setInterval((function(){r._getBlobLength()&&!r._isDecodePause&&r._isVideoOnRun&&!r._isInDecoding&&(logger.log(r.TAG,"_onFragmentEnd, setInterval start next mp4 decode"),r.startDecode(),clearInterval(r.loadNextHandle))}))}},{key:"_onError",value:function(e,t){this._isInDecoding=!1,this._parent.emit("error",e,t)}},{key:"_checkReady",value:function(){this._isDataReady&&this._isInit&&(this.ready=!0,logger.log(this.TAG,"checkReady trigger ready"),this._parent.emit(Events$2.DECODE_EVENTS.READY))}},{key:"_checkDataReady",value:function(){this._isDataReady=!0,this._checkReady()}},{key:"_reduceResolution",value:function(e){if(logger.log(this.TAG,"_reduceResolution","currentLevel:",this._currentLevel,"endLevel:",this._endLevel),this._videoHeight>720&&(logger.log(this.TAG,"_reduceResolution","trigger DECODE_LOW_FPS"),this._parent.emit(Events$2.VIDEO.DECODE_LOW_FPS)),e&&e<DEFAULT_FPS?(this._minFPSTime++,this._decoder.emit("fpsreduce",e)):this._minFPSTime=0,this._currentLevel>=this._endLevel)return logger.log(this.TAG,"_reduceResolution","trigger DECODE_LOW_FPS",this._currentLevel,this._endLevel),void this._parent.emit(Events$2.VIDEO.DECODE_LOW_FPS);if(this._minFPSTime>2){var t,r=this._videoWidth,n=this._videoHeight;if(t=this._findLevel(n,this._currentLevel)){if(this._currentLevel=t.level,4===this._currentLevel)return logger.log(this.TAG,"_reduceResolution","trigger DECODE_LOW_FPS, _currentLevel: ",this._currentLevel),void this._parent.emit(Events$2.VIDEO.DECODE_LOW_FPS);this.width=t.base*(r/n),this.height=t.base,this._decoder.emit("outputresolutionchange",this.width,this.height)}this._minFPSTime=0}}},{key:"_findLevel",value:function(e,t){return LEVELS.find((function(r){return r.base<e&&r.level>t}))}},{key:"_buildFrameInfo",value:function(e,t){try{var r=e.width,n=e.height;return{msg:"DECODED",width:r,height:n,buffer:e,yLinesize:r,uvLinesize:r/2,info:{baseDts:void 0,dts:t,gopId:0,isGop:void 0,key:!1,pts:t},type:"rgb"}}catch(e){logger.log(this.TAG,e)}}},{key:"_pushBlob",value:function(e){logger.log("push blob",e.dts,e.duration),e&&e.duration&&(this._gopBufferLength+=e.duration),this._blobURLList.push(e)}},{key:"_shiftBlob",value:function(){var e=this._blobURLList.shift();return e&&e.duration&&(this._gopBufferLength-=e.duration),e}},{key:"_filterBlob",value:function(e){var t=this;this._blobURLList=this._blobURLList.filter((function(r){return r.dts<e&&(URL.revokeObjectURL(r.blobUrl),r.duration&&(t._gopBufferLength-=r.duration)),r.dts>=e}))}},{key:"_emptyBlobList",value:function(){this._blobURLList=[],this._gopBufferLength=0}},{key:"_getBlobLength",value:function(){return this._blobURLList.length}},{key:"_handleKeyFrameVideo",value:function(e){try{var t=this._parent._timeRange.frames||[];if(this._parent._timeRange.clean(),!t.length)return;var r=t[0].dts,n=t[t.length-1].dts,i=r-this.endDts;logger.log(this.TAG,"_handleKeyFrameVideo","startDts:",r,"endDts:",n,"samples length:",t.length),this.endDts&&i>Math.floor(1e3/this._metaFPS)+1&&logger.log(this.TAG,"_handleKeyFrame, keyFrame dts:",r,"sample length:",t.length,"endDts:",n,"delay:",i);var a=n-r;if(this._fDuration||(this._fDuration=a),a<1500)return void logger.log(this.TAG,"_handleKeyFrame gopDuration :",a,"sample length:",t.length,"gopStartDts:",r,"gopEndDts:",n);if(this.firstDts||(this.firstDts=t[0].dts),this.currentFragmentDts=t[0].dts,this.currentFragmentDuration=this._getFragmentDuration(t),this.endDts=n,this.currentFragmentDts<this._startDts)return console.warn(this.TAG,"_handleKeyFrameVideo","currentFragmentDts < this._startDts",this.currentFragmentDts,this._startDts),void(t=[]);this.startRemux(t),t=[]}catch(e){console.error(this.TAG,"_handleKeyFrameVideo",e)}}},{key:"_getFragmentDuration",value:function(e){var t=0,r=0;return e[0].keyframe||console.error(this.TAG,"_getFragmentDuration","gop firstFrame is not keyframe"),e.forEach((function(n,i){n.keyframe&&i&&(t+=e[i-1].dts-e[r].dts,r=i)})),t+=e[e.length-1].dts-e[r].dts}},{key:"_createBlobURL",value:function(e){if(e){var t=new window.Blob([e.buffer],{type:"video/mp4"});return window.URL.createObjectURL(t)}}},{key:"_recordGopDuration",value:function(e){var t=e;this._minGopDuration||(this._minGopDuration=t),t>this._maxGopDuration&&(this._maxGopDuration=t),t<this._minGopDuration&&(this._minGopDuration=t)}},{key:"checkMaxFrames",value:function(e){"number"==typeof e&&(this._isDecodePause=e>MAX_FRAMESIZE,this._playSuccess&&this._isDecodePause&&this._decoder.pause())}},{key:"checkMinFrames",value:function(e){var t=this;if("number"==typeof e&&(this._isDecodePause=!(e<MIN_FRAMESIZE),!this._isDecodePause)){var r=this._decoder.play();void 0!==r?r.then((function(){t._playSuccess=!0})).catch((function(){t._playSuccess=!1})):setTimeout((function(){t._playSuccess=!0}),20)}}},{key:"frameRendend",value:function(e){if(e.dom){if(e.dom.width=0,e.dom.height=0,this._decoder._canvasList.length>MAX_FRAMESIZE)return;this._decoder._canvasList.push(e)}else logger.error(this.TAG,"_onRendend","imageObj. is error",e)}},{key:"checkValidBlob",value:function(e){this._filterBlob(e)}},{key:"chaseVideoFrame",value:function(e){logger.log(this.TAG,e,e.frame.dts,this.currentFragmentDts);var t=e.frame.dts;if(this._startDts=t,t===this.currentFragmentDts){if(logger.log(this.TAG,"_onChaseFrame","_inDecodeId:",this._inDecodeId,"currentFragmentDts:",this.currentFragmentDts),this._inDecodeId>0&&this._inDecodeId<t)return logger.log(this.TAG,"_onChaseFrame, _inDecodeId > 0 && _inDecodeId < startDts, _inDecodeId:",this._inDecodeId,"startDts:",t),this.stopDecode(),this._filterBlob(t),void this.startDecode();if(this._inDecodeId===t)return logger.log(this.TAG,"_onChaseFrame, _inDecodeId === startDts, startDts:",t),this.stopDecode(),void this.reStrartDecode(this._currentInfo);-1===this._inDecodeId&&(logger.log(this.TAG,"_onChaseFrame","_inDecodeId==-1"),this.startDecode())}t>this.currentFragmentDts&&(logger.log(this.TAG,"_onChaseFrame, startDts > currentFragmentDts, startDts:",t,"currentFragmentDts:",this.currentFragmentDts),this.stopDecode(),this._emptyBlobList()),t<this.currentFragmentDts&&(logger.log(this.TAG,"_onChaseFrame, startDts < currentFragmentDts, startDts:",t,"currentFragmentDts:",this.currentFragmentDts),t>this._inDecodeId&&(this._filterBlob(t),this.stopDecode(),this.startDecode()))}},{key:"init",value:function(e){this._isInit||(this._metaFPS=e.fpsNum/e.fpsDen||25,this._videoWidth=e.width,this._videoHeight=e.height,this._width=this._videoWidth,this._height=this._videoHeight,this._frameDuration=parseInt(1e3/this._metaFPS),this._isInit=!0,logger.log("".concat(this.TAG," has inited")),this._isInit=!0,this._checkReady())}},{key:"reStrartDecode",value:function(e){if(e)try{logger.log(this.TAG,"reStrartDecode"),this._isInDecoding=!0,this._inDecodeId=e.dts,this._currentInfo=e,this._decoder.startDecode(e,this._metaFPS,this._startTime),this._startTime=0}catch(e){console.error("load error",e)}}},{key:"stopDecode",value:function(){this._isInDecoding=!1,this._inDecodeId=-1,this._currentInfo=null,this._frameLengthPerFragment=0,this._decoder.stopDecode()}},{key:"startDecode",value:function(){if(this._isInDecoding)logger.log(this.TAG,"startDecode","this decoder is in decoding");else{var e=this._getBlobLength();if(this._decoder&&e){logger.log(this.TAG,"startDecode","blob url length:",e);var t=this._shiftBlob()||{};try{logger.log(this.TAG,"startDecode",t.dts,t.duration),this._isInDecoding=!0,this._inDecodeId=t.dts,this._currentInfo=t,this._decoder.startDecode(t,this._metaFPS)}catch(e){console.error(this.TAG,"startDecode","load error",e)}}}}},{key:"canSeek",value:function(e){var t=e.frame.dts;return!!(this.currentFragmentDts>=t&&this._isInDecoding)&&(this._inDecodeId!==t&&this._inDecodeId<t)}},{key:"startRemux",value:function(e){if(logger.log("startRemux samples length:",e.length),e.length){var t=this._parent._meta;t.samples=e;var r=this._remux.remux(t).videoSegment;this._onRemuxed(r)}else console.error("frame length is 0")}},{key:"canPlayType",value:function(e){if(this._decoder)try{return this._decoder.canPlayType('video/mp4;codecs="'+e.codec+'"')}catch(e){console.error(e)}}},{key:"destroy",value:function(){this._blobURLList=[],this._decoder.destroy()}},{key:"empty",value:function(){if(logger.log("empty"),this._decoder){var e=this._decoder._canvasList;return logger.log(this.TAG,"empty >>>>>>>>>>>>>>>>>>length:",e.length),e.forEach((function(e){e.dom&&(logger.log("clear >>>>>>>>>>>>>>>>>>"),e.dom.width=0,e.dom.height=0,e.dom=null)})),e.length}}},{key:"isIDLE",get:function(){return logger.log(this.TAG,"isIDEL","blob length:",this._getBlobLength(),"_isInDecoding:",this._isInDecoding,"isVideoOnRun:",this._isVideoOnRun,"_isDecodePause",this._isDecodePause),!this._getBlobLength()&&!this._isInDecoding&&this._isVideoOnRun}},{key:"ready",get:function(){return this._ready},set:function(e){this._ready=e}},{key:"remux",get:function(){return this._remux}},{key:"isInit",get:function(){return this._isInit}}]),r}(),VideoRenderFromVideo=function(e){_inherits$1(r,VideoBaseRender);var t=_createSuper$1(r);function r(e,n){var i;return _classCallCheck$2(this,r),(i=t.call(this,e,n)).TAG="VideoRenderFromVideo",i._videoDecodeController=new VideoDecoderController(e,_assertThisInitialized$1(i)),i._canAutoPlay=!0,i._videoDecode=e.videoDecode,i._chaseToFrame=null,i}return _createClass$2(r,[{key:"videoDecode",get:function(){return this._videoDecode},set:function(e){this._videoDecode=e}},{key:"_bindEvents",value:function(){var e=this;_get(_getPrototypeOf$1(r.prototype),"_bindEvents",this).call(this),this.on("keyFrame",this._onKeyFrame.bind(this)),this.on(Events$2.DECODE_EVENTS.READY,this._onReady.bind(this)),this.on(Events$2.DECODE_EVENTS.DECODED,this._onDecoded.bind(this)),this.on(Events$2.DECODE_EVENTS.PLAY_FAILED,this._onPlayFailed.bind(this)),this.on("error",this._onError.bind(this)),this.on(Events$2.DECODE_EVENTS.APPEND_VIDEO,this._onAppendVideo.bind(this)),this.on(Events$2.DECODE_EVENTS.FIRST_FRAME,this._onFirstFrame.bind(this)),this._parent.on(Events$2.DECODE_EVENTS.CHASE_VIDEO_FRAME,this._onChaseVideoFrame.bind(this)),this._parent.on(Events$2.TIMELINE.SYNC_DTS,this._onTimeLineSyncDTS.bind(this)),window.addEventListener("unload",(function(){e._empty()}))}},{key:"_onTimeLineSyncDTS",value:function(e){this._videoDecodeController.checkValidBlob(e)}},{key:"_onChaseVideoFrame",value:function(e){this._doChaseVideoFrame(e)}},{key:"_onAppendVideo",value:function(e){try{this._parent._parent.appendChild(e)}catch(e){cosole.error(this.TAG,"onAppendVideo",e)}}},{key:"_onKeyFrame",value:function(){logger.log(this.TAG,"_onKeyFrame, keyframe"),this._videoDecodeController.emit("keyFrame")}},{key:"_onError",value:function(e,t){console.error(this.TAG,"decoder error",e,t),t||this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,this._assembleErr(e&&e.message))}},{key:"_onReady",value:function(){if(!this._frameRender){var e=Object.assign(this._config,{meta:this._meta,canvas:this._canvas,type:"2d"});try{this._frameRender=new FrameRender(e,this)}catch(e){this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,this._assembleErr(e&&e.message))}}this._startDecode()}},{key:"_onFirstFrame",value:function(e){logger.log(this.TAG,"onFirstFrame"),this._receiveFrame(e),this._firstFrame=!0}},{key:"_onDecoded",value:function(e){var t=this;if(this._inChaseFrame){if(this.chaseFrameAfter++,1===this.chaseFrameAfter&&this._chaseToFrame){if(this._parent.emit(Events$2.DECODE_EVENTS.CHASE_VIDEO_FRAME_END,this._chaseToFrame),this._frameQueue.length)this._frameQueue.frames.forEach((function(e){t._videoDecodeController.frameRendend(e.buffer)}));this._frameQueue.empty(),this._videoDecodeController.checkMinFrames(this._frameQueue.length),this._timeRange.deletePassed(this._chaseToFrame.frame.dts),this._inChaseFrame=!1,this._chaseToFrame=null,console.warn(this.TAG,"onDecoded","_inChaseFrame end")}}else this.chaseFrameAfter=0;this._receiveFrame(e)}},{key:"_onPlayFailed",value:function(e){console.warn(this.TAG,"onPlayFailed, this._ready:",this._ready,",firstEmit:",e,",frame length:",this._frameQueue.length),this._ready||e||this._whenReady(),this._canAutoPlay=!1}},{key:"canSeek",value:function(e){return this._videoDecodeController.canSeek(e)}},{key:"_initDecoder",value:function(){this._isInit||(logger.log(this.TAG,"_initDecoder"),this._videoDecodeController.isInit||this._videoDecodeController.init(this._meta),this._isInit=!0)}},{key:"_receiveFrame",value:function(e){_get(_getPrototypeOf$1(r.prototype),"_receiveFrame",this).call(this,e),this._videoDecodeController.checkMaxFrames(this._frameQueue._frames.length)}},{key:"_setMetadata",value:function(e){logger.warn(this.TAG,"video set metadata",e),this._meta=e;var t=e.fpsNum/e.fpsDen;t?logger.log(this.TAG,"detect fps:",t):logger.warn(this.TAG,"no detect fps,start estimate"),this._initDecoder(e)}},{key:"_doChaseVideoFrame",value:function(e){this._inChaseFrame=!0,this._chaseToFrame=e,this._videoDecodeController.chaseVideoFrame(e)}},{key:"_appendChunk",value:function(e){this._meta||this._setMetadata(e);for(var t=e.samples.slice(),r=t.length,n=0;n<r;n++){var i=t.shift();i.keyframe&&this.emit("keyFrame"),this._timeRange.append([i],this.noAudio,!1)}}},{key:"_startDecode",value:function(){this._videoDecodeController.startDecode()}},{key:"_checkToDecode",value:function(){this._startDecode()}},{key:"_startRender",value:function(){logger.log(this.TAG,"_startRender interval",this.interval),this._tickTimer.start(this.interval)}},{key:"_render",value:function(e){var t=this,r=this._frameQueue.nextFrame(),n=this.preciseVideoDts;if(r&&this._timeRange){var i=r.info;if(!i)return this._frameQueue.shift(),void console.error("not info");this._renderDts=i.dts;var a=i.dts-n;if(a<-150){this.lastPrecise;var o=this._frameQueue.frames,s=this._getDeleteFrames(o,n),u=s.deleteFrames,c=s.useFrames;return o.splice(0),c.forEach((function(e){o.push(e)})),u.forEach((function(e){t._videoDecodeController.frameRendend(e.buffer)})),this._videoDecodeController.emit("renderDelay",a,this._frameQueue._frames.length),void this._videoDecodeController.checkMinFrames(this._frameQueue.length)}if(!(!e&&a>30&&a<6e4)){Math.abs(this._lastTimeupdate-i.dts)>250&&(this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.TIMEUPDATE),this._lastTimeupdate=i.dts),logger.long&&logger.log(this.TAG,"render delay:".concat(a," , timelinePosition:").concat(n," , dts:").concat(i.dts," , cost:").concat(i.cost," , gopID:").concat(i.gopId," , rest:").concat(this._frameQueue.length,", buffer frame:").concat(this._timeRange.frameLength));var l=performance.now();this._frameRender.render(r.buffer,r.width,r.height,r.yLinesize,r.uvLinesize),this.hasFirstFrame||e||(this.hasFirstFrame=!0,this._parent.emit(Events$2.TIMELINE.PLAY_EVENT,"firstframe")),this._videoDecodeController.frameRendend(r.buffer),this._frameQueue.shift(),this._videoDecodeController.checkMinFrames(this._frameQueue.length),this._videoDecodeController.emit("renderDelay",a,this._frameQueue._frames.length),this._renderCost=performance.now()-l,e||(this.lastTime&&(this.lastPrecise,Date.now(),this.lastTime),this.lastFrameinfo=i.dts,this.lastPrecise=n,this.lastTime=Date.now(),this.lastAudioTime=this._parent.audioRender.currentTime)}}else{if(this._videoDecodeController.checkMinFrames(this._frameQueue._frames.length),this._parent._paused)return;if(!this._firstFrame)return void logger.log(this.TAG,"_render","not first frame return");var d=this._videoDecodeController;if(logger.log(this.TAG,",lack frame, _inDecoding:",this._videoDecodeController._isInDecoding,this._videoDecodeController._isDecodePause,",_frameQueue.length:",this._frameQueue.length),!this._frameQueue.length&&d.isIDLE){this._ready=!1;var h=this._parent.audioRender;console.warn(this.TAG,"trigger video waiting vdecode, preciseVideoDts:",n,h.currentTime,h.duration,h.buffered.end(0),h.baseDts),this.emit(Events$2.VIDEO.VIDEO_WAITING)}this._checkToDecode()}}},{key:"_updateSegmentEnd",value:function(){}},{key:"_destroy",value:function(e){this._empty(),_get(_getPrototypeOf$1(r.prototype),"destroy",this).call(this,e),this._videoDecodeController.destroy()}},{key:"_doPause",value:function(){logger.log(this.TAG,">>>>>>>>doPause"),this._tickTimer.stop()}},{key:"_getDeleteFrames",value:function(e,t){var r=[],n=[];return e.forEach((function(e){e.info&&e.info.dts>t?n.push(e):e.info&&e.info.dts<=t&&r.push(e)})),{deleteFrames:r,useFrames:n}}},{key:"_empty",value:function(){this._videoDecodeController&&(this._videoDecodeController.empty(),this._frameQueue.frames.forEach((function(e){e.buffer&&e.buffer.dom&&(e.buffer.dom.width=0,e.buffer.dom.height=0,e.buffer.dom=null)})))}}]),r}(),DecodeController=function(e){_inherits$1(r,EventEmitter$1);var t=_createSuper$1(r);function r(e){var n;return _classCallCheck$2(this,r),_defineProperty$2(_assertThisInitialized$1(n=t.call(this)),"_parent",null),_defineProperty$2(_assertThisInitialized$1(n),"_decoderReady",!1),_defineProperty$2(_assertThisInitialized$1(n),"_inDecoding",!1),_defineProperty$2(_assertThisInitialized$1(n),"_toDecodeFirstframe",!0),_defineProperty$2(_assertThisInitialized$1(n),"_id",(new Date).getMilliseconds()),_defineProperty$2(_assertThisInitialized$1(n),"_workerErrorCallback",null),_defineProperty$2(_assertThisInitialized$1(n),"_workerMessageCallback",null),_defineProperty$2(_assertThisInitialized$1(n),"_decoderWorker",null),n._parent=e,n}return _createClass$2(r,[{key:"analyse",get:function(){return this._parent.analyse}},{key:"inDecoding",get:function(){return this._inDecoding}},{key:"decoderMode",get:function(){return this._decoderMode}},{key:"decoderReady",get:function(){return this._decoderReady}},{key:"needToDecode",get:function(){return this._inDecoding?0:this._continueDecodeThreshold}},{key:"maxDecodeOnce",get:function(){return this._maxDecodeOnce}},{key:"meta",get:function(){var e;return null===(e=this._parent)||void 0===e?void 0:e._meta},set:function(e){this._parent&&(this._parent._meta=e)}},{key:"init",value:function(e,t){this._workerMessageCallback=e,this._workerErrorCallback=t,this._initWorker()}},{key:"_initWorker",value:function(){throw new Error("need override by children")}},{key:"checkToDecode",value:function(e){this.webcodec?e<=this.needToDecode&&this.doDecode():!this._inDecoding&&e<=this.needToDecode&&this.doDecode()}},{key:"doDecode",value:function(){var e=this,t=this._getFramesToDecode();t&&t.length&&this.meta&&(this._toDecodeFirstframe&&(this._toDecodeFirstframe=!1,this.analyse.addFirstFrameToDecode()),this._avccpushed||this._initDecoderWithConfiguration(this._decoderWorker,this.meta),logger.enable&&logger.log(this.TAG,"doDecode ".concat(t.length," frames")),t.forEach((function(t){e._doDecodeInternal(t)})),this._inDecoding=!0,this._decoderWorker.postMessage({msg:"finish_flag"}))}},{key:"preciseSeek",value:function(e){var t,r,n,i,a=this,o=1e3*e,s=null===(t=this._parent)||void 0===t||null===(r=t._timeRange)||void 0===r?void 0:r.getFramesForPreciseSeek(o),u=s.length;u<this.maxDecodeOnce?this.doDecode():(null===(n=this._parent)||void 0===n||null===(i=n._timeRange)||void 0===i||i.updateFrameIndexForPreciseSeek(u),logger.enable&&logger.log(this.TAG,"doDecode ".concat(s.length," frames for precise seek")),s.forEach((function(e,t){a._doDecodeInternal(e,!0,t>=u-6)})),this._inDecoding=!0,this._decoderWorker.postMessage({msg:"finish_flag"}))}},{key:"_getFramesToDecode",value:function(){var e=this._parent,t=e._timeRange,r=e._decodeEstimate;if(this._decoderReady&&t){var n=t.frameLength;if(n){var i=this._toDecodeFirstframe?getDecodeCapacaity().maxDecodeOnceFirstTime:this.maxDecodeOnce;1===n&&r.resetDecodeDot(performance.now());for(var a=[];i>0;){var o=t&&t.getFrame();if(!o)break;a.push(o),o.gopId&&o.gopId-1==0&&r.updateGopCount(),i--}return a}}}},{key:"_doDecodeInternal",value:function(e,t,r){null!=e&&e.meta&&(this.meta=e.meta,logger.warn(this.TAG,"detect metadata! flush decoder"),this._initDecoderWithConfiguration(this.__decoderWorker,e.meta));var n={dts:e.dts,pts:e.pts||e.dts+e.cts,keyframe:e.keyframe,gopId:e.gopId,id:this._id};t&&(n.preciseSeek=!0,n.output=r);var i=e.data.slice();this._decoderWorker.postMessage({msg:"decode",data:i,info:n},[i.buffer])}},{key:"_initDecoderWithConfiguration",value:function(){throw new Error("need override by children")}},{key:"flushDecoder",value:function(){this._decoderWorker.postMessage({msg:"flush"})}},{key:"destroy",value:function(){throw new Error("need override by children")}}]),r}(),encodedJs$3="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3ZhciBlPW51bGwsdD1bXSxzPTAsYT0hMTtzZWxmLmFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLChmdW5jdGlvbihvKXtzd2l0Y2goby5kYXRhLm1zZyl7Y2FzZSJjb25maWd1cmF0aW9uIjplPW5ldyBzZWxmLlZpZGVvRGVjb2Rlcih7b3V0cHV0OmZ1bmN0aW9uKG8pe2E9ITAscyYmY2xlYXJUaW1lb3V0KHMpO3ZhciBuPXQuc2hpZnQoKTtuP3NlbGYucG9zdE1lc3NhZ2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pKTt2YXIgZD1uLmJ5dGVMZW5ndGgtNCxjPW5ldyBEYXRhVmlldyhuZXcgQXJyYXlCdWZmZXIoNCkpO2Muc2V0VWludDMyKDAsZCwhMSksbi5zZXQobmV3IFVpbnQ4QXJyYXkoYy5idWZmZXIpLDApLGkua2V5ZnJhbWUmJmUuZmx1c2goKTt2YXIgcj1uZXcgc2VsZi5FbmNvZGVkVmlkZW9DaHVuayh7dHlwZTppLmtleWZyYW1lPyJrZXkiOiJkZWx0YSIsdGltZXN0YW1wOmkucHRzLGRhdGE6bn0pO2UuZGVjb2RlKHIpO2JyZWFrO2Nhc2UiZGVzdHJveSI6ZSYmKGUuZmx1c2goKSxlLmNsb3NlKCkpLGNsZWFyVGltZW91dChzKTticmVhaztjYXNlImNoZWNrRGVjb2RlIjpzZWxmLnBvc3RNZXNzYWdlKHt0eXBlOiJDSEVDS19UT19ERUNPREUiLGRhdGE6MD09PU1hdGguYWJzKGUuZGVjb2RlUXVldWVTaXplLXQubGVuZ3RoKX0pfX0pKX0oKTsK",blob$3="undefined"!=typeof window&&window.Blob&&new Blob([atob(encodedJs$3)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$3(){var e=blob$3&&(window.URL||window.webkitURL).createObjectURL(blob$3);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+encodedJs$3,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var MAX_DECODE_ONCE_DEFAULT$1=getDecodeCapacaity().maxDecodeOnceWebcodec,WebCodecDecodeController=function(e){_inherits$1(r,DecodeController);var t=_createSuper$1(r);function r(){var e;_classCallCheck$2(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return _defineProperty$2(_assertThisInitialized$1(e=t.call.apply(t,[this].concat(i))),"TAG","WebCodecController"),_defineProperty$2(_assertThisInitialized$1(e),"_decoderMode",5),_defineProperty$2(_assertThisInitialized$1(e),"_maxDecodeOnce",MAX_DECODE_ONCE_DEFAULT$1),_defineProperty$2(_assertThisInitialized$1(e),"_continueDecodeThreshold",MAX_DECODE_ONCE_DEFAULT$1/2),_defineProperty$2(_assertThisInitialized$1(e),"_avccpushed",!1),e}return _createClass$2(r,[{key:"webcodec",get:function(){return!0}},{key:"needToDecode",get:function(){return this._inDecoding?(this._checkToDecode(),0):this._continueDecodeThreshold}},{key:"_initWorker",value:function(){var e=this;logger.log(this.TAG,"start init webcodec worker");var t=new WorkerWrapper$3;t.onMessage=function(t){var r,n;switch(t.data.type){case"DECODER_READY":logger.log(e.TAG,"webcodec worker ready "),e._decoderReady=!0,e._workerMessageCallback({type:"DECODER_READY"});break;case"DECODED":if(e._inDecoding=!0,(null===(r=t.data)||void 0===r||null===(n=r.info)||void 0===n?void 0:n.id)!==e._id)return;e._workerMessageCallback({type:"RECEIVE_FRAME",data:t.data});break;case"BATCH_FINISH_FLAG":if(e._inDecoding=!1,!e._workerMessageCallback)return;e._workerMessageCallback({type:"BATCH_FINISH"});break;case"CHECK_TO_DECODE":e._inDecoding=t.data.data;break;case"FAILED":e._whenError(t.data.message)}},t.onError=function(t){var r,n,i=null===(r=e._parent)||void 0===r||null===(n=r._parent)||void 0===n?void 0:n._parent;i&&i.removeChild(i.querySelector("canvas")),e._whenError(t.message)},t.addEventListener("message",t.onMessage),t.addEventListener("error",t.onError),this._decoderWorker=t,this._initDecoderWithConfiguration(t,this._parent.configuration)}},{key:"_whenError",value:function(e){r.canUse=!1,this._workerErrorCallback(e)}},{key:"_initDecoderWithConfiguration",value:function(e,t){e.postMessage({msg:"configuration",data:{codec:this._parent._meta.codec,codedHeight:this._parent._meta.height,codedWidth:this._parent._meta.width,description:t}}),this._avccpushed=!0}},{key:"_checkToDecode",value:function(){this._decoderWorker.postMessage({msg:"checkDecode"})}},{key:"destroy",value:function(){var e=this._decoderWorker;e.removeEventListener("message",e.onMessage),e.removeEventListener("error",e.onError),e.postMessage({msg:"destroy"}),e.terminate(),this._decoderWorker=null}}],[{key:"isSupported",value:function(){return getDecode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NnKXtpZigiaW5pdCIhPT10Lm1zZyYmInByZWxvYWQiIT09dC5tc2cmJiFkZWNvZGVyKXJldHVybjtzd2l0Y2godC5tc2cpe2Nhc2UicHJlbG9hZCI6aW5pdCh0LnVybCk7YnJlYWs7Y2FzZSJpbml0IjpzZWxmLm1ldGE9dC5tZXRhLGluaXQodC51cmwpO2JyZWFrO2Nhc2UidXBkYXRlbWV0YSI6c2VsZi5tZXRhPXQubWV0YSxkZWNvZGVyLnVwZGF0ZU1ldGEodC5tZXRhKTticmVhaztjYXNlImluaXREZWNvZGVyIjpkZWNvZGVyLmRlY29kZSh0LmRhdGEpO2JyZWFrO2Nhc2UiZGVjb2RlIjpkZWNvZGVyLmRlY29kZSh0LmRhdGEsdC5pbmZvKTticmVhaztjYXNlImZsdXNoIjpkZWNvZGVyLmZsdXNoKCk7YnJlYWs7Y2FzZSJmaW5pc2hfZmxhZyI6c2VsZi5wb3N0TWVzc2FnZSh7bXNnOiJCQVRDSF9GSU5JU0hfRkxBRyJ9KTticmVhaztjYXNlImRlc3RvcnkiOmRlY29kZXIuZGVzdHJveSgpfX1lbHNlIHNlbGYucG9zdE1lc3NhZ2Uoe21zZzoiRVJST1I6aW52YWxpZCBtZXNzYWdlIn0pfX0pKCk7Cg==",blob$2="undefined"!=typeof window&&window.Blob&&new Blob([atob(encodedJs$2)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$2(){var e=blob$2&&(window.URL||window.webkitURL).createObjectURL(blob$2);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+encodedJs$2,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var encodedJs$1="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHNoaW1JbXBvcnRTY3JpcHRzKHNyYyl7cmV0dXJuIGZldGNoKHNyYykudGhlbigoZnVuY3Rpb24oZSl7cmV0dXJuIGUudGV4dCgpfSkpLnRoZW4oKGZ1bmN0aW9uKHRleHQpe3N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FrO2Nhc2UiZGVzdG9yeSI6ZGVjb2Rlci5kZXN0cm95KCl9fX0pKCk7Cg==",blob$1="undefined"!=typeof window&&window.Blob&&new Blob([atob(encodedJs$1)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper$1(){var e=blob$1&&(window.URL||window.webkitURL).createObjectURL(blob$1);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+encodedJs$1,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var encodedJs="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIHNoaW1JbXBvcnRTY3JpcHRzKHNyYyl7cmV0dXJuIGZldGNoKHNyYykudGhlbigoZnVuY3Rpb24oZSl7cmV0dXJuIGUudGV4dCgpfSkpLnRoZW4oKGZ1bmN0aW9uKHRleHQpe3NlbGYuZXhwb3J0cz17fSxldmFsKHRleHQpLHNlbGYubT1leHBvcnRzLm19KSl9dmFyIE1BWF9TVFJFQU1fQlVGRkVSX0xFTkdUSD0xMDQ4NTc2LGluaXRUcz0wLERlY29kZXI9ZnVuY3Rpb24oZSl7dGhpcy5pbml0ZWQ9ITEsdGhpcy5zZWxmPWUsdGhpcy5tZXRhPWUubWV0YSx0aGlzLmluZm9saXN0PVtdLGUucGFyX2Jyb2Fkd2F5T25Ccm9hZHdheUluaXRlZD10aGlzLmJyb2Fkd2F5T25Ccm9hZHdheUluaXRlZC5iaW5kKHRoaXMpLGUucGFyX2Jyb2Fkd2F5T25QaWN0dXJlRGVjb2RlZD10aGlzLmJyb2Fkd2F5T25QaWN0dXJlRGVjb2RlZC5iaW5kKHRoaXMpfSxkZWNvZGVyO2Z1bmN0aW9uIG9uUG9zdFJ1bigpeyhkZWNvZGVyPW5ldyBEZWNvZGVyKHRoaXMpKS5pbml0KCl9RGVjb2Rlci5wcm90b3R5cGUudG9VOEFycmF5PWZ1bmN0aW9uKGUsdCl7cmV0dXJuIE1vZHVsZS5IRUFQVTguc3ViYXJyYXkoZSx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jb2Rlci5kZWNvZGUodC5kYXRhKTticmVhaztjYXNlImRlY29kZSI6ZGVjb2Rlci5kZWNvZGUodC5kYXRhLHQuaW5mbyk7YnJlYWs7Y2FzZSJmaW5pc2hfZmxhZyI6c2VsZi5wb3N0TWVzc2FnZSh7bXNnOiJCQVRDSF9GSU5JU0hfRkxBRyJ9KTticmVhaztjYXNlImRlc3RvcnkiOmRlY29kZXIuZGVzdHJveSgpfX19KSgpOwo=",blob="undefined"!=typeof window&&window.Blob&&new Blob([atob(encodedJs)],{type:"text/javascript;charset=utf-8"});function WorkerWrapper(){var e=blob&&(window.URL||window.webkitURL).createObjectURL(blob);try{return e?new Worker(e,{}):new Worker("data:application/javascript;base64,"+encodedJs,{type:"module"})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var DecoderCache=function(){function e(){_classCallCheck$2(this,e),_defineProperty$2(this,"_queue",[]),_defineProperty$2(this,"_pendingDecoder",null),_defineProperty$2(this,"TAG","DecoderCache")}return _createClass$2(e,[{key:"genDecoder",value:function(e){return this._initDecoder(e)}},{key:"_initDecoder",value:function(e){var t=this,r=getDecodeCapacaity(),n=r.preloadDecoder,i=r.maxDecodeOnceWasm;e=e||n;var a,o,s=getDecoderUrls(),u=s.H264_DECODER_URL,c=s.H265_SIMD_DECODER_URL,l=s.H265_DECODER_URL,d=s.H265_THREAD_DECODER_URL,h=1;if("h265"===e&&(simdSupported()?(a=new WorkerWrapper$2,o=c,h=2):threadSupported()&&getDecodeCapacaity().canUseThreadMode?(a=new WorkerWrapper$1,o=d,h=1):(a=new WorkerWrapper$2,o=l,h=3)),"h264"===e&&(a=new WorkerWrapper,o=u,h=3),!a)return Promise.resolve();var f=promiseDelayed();a.postMessage({msg:"preload",batchDecodeCount:i,url:o}),this._pendingDecoder=a,a.id=Date.now()+parseInt(1e3*Math.random()),a.isHevc="h265"===e,a.using=!1,a.ready=!1,logger.log(this.TAG,"start init decoder worker, id=",a.id,"hevc=",a.isHevc,"mode=",h);var p=function e(r){t._pendingDecoder=null;var n=r.data.msg;switch("DECODER_READY"!==n&&"INIT_FAILED"!==n||(a.removeEventListener("message",e),a.removeEventListener("error",m)),n){case"DECODER_READY":logger.log(t.TAG,"decoder worker inited!, id=",a.id,"cost:",r.data.cost),a.ready=!0,a.using||t._queue.push(a),f.resolve();break;case"INIT_FAILED":logger.log(t.TAG,"decoder worker init failed!",r.data.log),f.reject(r.data.log)}},m=function e(t){a.removeEventListener("message",p),a.removeEventListener("error",e),f.reject(null==t?void 0:t.message)};return a.addEventListener("message",p),a.addEventListener("error",m),f}},{key:"cacheDecoder",value:function(e){e.using=!1,e.ready=!0,e.id||(e.id=Date.now()+parseInt(1e3*Math.random())),this._queue.push(e),logger.log(this.TAG,"cache decoder, id=",e.id),"h265"===getDecodeCapacaity().preloadDecoder&&1===this._queue.filter((function(e){return!e.using&&e.isHevc})).length&&this.genDecoder("h265")}},{key:"getCachedDecoder",value:function(e){var t,r=this._queue.findIndex((function(t){return!t.using&&t.isHevc===e}));if(-1!==r&&(t=this._queue.splice(r,1)[0]),!t&&this._pendingDecoder&&(t=this._pendingDecoder,this._pendingDecoder=null),t)return t.using=!0,logger.warn(this.TAG,"get cached decoder, id=".concat(t.id,", ready=").concat(t.ready)),t}}]),e}(),decoderCache=new DecoderCache,MAX_DECODE_ONCE_DEFAULT=getDecodeCapacaity().maxDecodeOnceWasm,WasmDecodeController=function(e){_inherits$1(r,DecodeController);var t=_createSuper$1(r);function r(){var e;_classCallCheck$2(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return _defineProperty$2(_assertThisInitialized$1(e=t.call.apply(t,[this].concat(i))),"TAG","WasmController"),_defineProperty$2(_assertThisInitialized$1(e),"_avccpushed",!1),_defineProperty$2(_assertThisInitialized$1(e),"_maxDecodeOnce",MAX_DECODE_ONCE_DEFAULT),_defineProperty$2(_assertThisInitialized$1(e),"_continueDecodeThreshold",MAX_DECODE_ONCE_DEFAULT/2),_defineProperty$2(_assertThisInitialized$1(e),"_wasmInitCost",0),_defineProperty$2(_assertThisInitialized$1(e),"_threadSupported",threadSupported()&&getDecodeCapacaity().canUseThreadMode),_defineProperty$2(_assertThisInitialized$1(e),"_simdSuppported",simdSupported()),_defineProperty$2(_assertThisInitialized$1(e),"_decoderMode",window.WebAssembly?3:4),e}return _createClass$2(r,[{key:"wasmInitCost",get:function(){var e;return null===(e=this._decoderWorker)||void 0===e?void 0:e._wasmInitCost}},{key:"isHevc",get:function(){var e;return null===(e=this._parent)||void 0===e?void 0:e.isHevc}},{key:"_selectDecodeWorker",value:function(){this.analyse.addWasmInit();var e,t=getDecoderUrls(),r=t.H264_DECODER_URL,n=t.H265_DECODER_URL,i=t.H265_THREAD_DECODER_URL,a=t.H265_SIMD_DECODER_URL,o=t.ASM_H264_DECODER_URL,s=t.ASM_H265_DECODER_URL;return logger.log(this.TAG,"start init wasm worker:",performance.now(),"hevc:",this.isHevc,"decoderMode:",this._decoderMode),this.isHevc?(e=1===this._decoderMode?i:2===this._decoderMode?a:3===this._decoderMode?n:s)?{decoder:1===this._decoderMode?new WorkerWrapper$1:new WorkerWrapper$2,url:e}:void this._workerErrorCallback("no found decoder url, decodeMode:".concat(this._decoderMode)):(e=4===this._decoderMode?o:r)?{decoder:new WorkerWrapper,url:e}:void this._workerErrorCallback("no found decoder url, decodeMode:".concat(this._decoderMode))}},{key:"_initWorker",value:function(){this.isHevc&&(this._threadSupported&&(this._decoderMode=1),this._simdSuppported&&(this._decoderMode=2)),this._initDecodeWorkerInternal()}},{key:"_initDecodeWorkerInternal",value:function(){var e=decoderCache.getCachedDecoder(this.isHevc);if(e)return logger.warn(this.TAG,"select decoder from cache"),this.analyse.addWasmInit(),this._avccpushed=!1,this._bindWorkerEvent(e),this._decoderWorker=e,void(e.ready&&(this._decoderReady=!0,this._initDecoderWithConfiguration(e,this.meta),this._workerMessageCallback({type:"DECODER_READY",data:e}),logger.log(this.TAG,"decoder ready!")));var t=this._selectDecodeWorker()||{},r=t.decoder,n=t.url;r&&(this._avccpushed=!1,this._bindWorkerEvent(r),r.isHevc=this.isHevc,r.postMessage({msg:"init",meta:this.meta,batchDecodeCount:MAX_DECODE_ONCE_DEFAULT,url:n}),this._decoderWorker=r)}},{key:"_bindWorkerEvent",value:function(e){var t=this,r=function(r,n){logger.log(t.TAG,"worker failed: ",r,n),t._terminateWorker(e),t._decoderWorker=null,!1===getDecodeCapacaity().wasmFallbackToAsm||4===t._decoderMode?t._workerErrorCallback(r):(t._decoderMode=1===t._decoderMode||2===t._decoderMode?3:4,t._initDecodeWorkerInternal())};e._onMessage=function(n){var i,a;switch(n.data.msg){case"DECODER_READY":if(logger.log(t.TAG,"wasm worker ready!","cost:",n.data.cost),t._decoderReady=!0,e._wasmInitCost=parseInt(n.data.cost),!t.meta)return;t._avccpushed||t._initDecoderWithConfiguration(e,t.meta),t.emit(Events$2.VIDEO.VIDEO_DECODER_INIT,e),t._workerMessageCallback({type:"DECODER_READY",data:e});break;case"DECODED":if(t._inDecoding=!0,(null===(i=n.data)||void 0===i||null===(a=i.info)||void 0===a?void 0:a.id)!==t._id)return;t._workerMessageCallback({type:"RECEIVE_FRAME",data:n.data});break;case"BATCH_FINISH_FLAG":if(t._inDecoding=!1,!t._workerMessageCallback)return;t._workerMessageCallback({type:"BATCH_FINISH"});break;case"INIT_FAILED":r(n.data.log,1)}},e._onError=function(e){r(e.message,2)},e.addEventListener("message",e._onMessage),e.addEventListener("error",e._onError)}},{key:"_initDecoderWithConfiguration",value:function(e,t){logger.log(this.TAG,"init decoder with configuration"),this._avccpushed=!0,e.postMessage({msg:"updatemeta",meta:t});var r=[t.rawVps||t.vps[0],t.rawSps||t.sps[0],t.rawPps||t.pps[0]].filter(Boolean),n=r.reduce((function(e,t){return e+(t.byteLength+4)}),0),i=new Uint8Array(n),a=0;r.forEach((function(e){i.set([0,0,0,1],a),a+=4,i.set(e,a),a+=e.byteLength})),e.postMessage({msg:"initDecoder",data:i})}},{key:"destroy",value:function(){if(this._decoderWorker)return getDecodeCapacaity().reuseWasmDecoder?(this._offWorkerBind(this._decoderWorker),void decoderCache.cacheDecoder(this._decoderWorker)):void this._terminateWorker(this._decoderWorker)}},{key:"_offWorkerBind",value:function(e){e.removeEventListener("message",e._onMessage),e.removeEventListener("error",e._onError),e.postMessage({msg:"flush"}),e._onMessage=null,e._onError=null,logger.log(this.TAG,"flush decoder and unbind worker event")}},{key:"_terminateWorker",value:function(e){this._offWorkerBind(e),e.postMessage({msg:"destroy"}),e.terminate(),logger.log(this.TAG,"destroy decoder worker")}}]),r}(),DECODER_ERROR_SUBCODE=1,WEBGL_ERROR_SUBCODE=2,VideoRenderWithDecoder=function(e){_inherits$1(r,VideoBaseRender);var t=_createSuper$1(r);function r(){var e;_classCallCheck$2(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return _defineProperty$2(_assertThisInitialized$1(e=t.call.apply(t,[this].concat(i))),"TAG","VideoRenderWithDecoder"),_defineProperty$2(_assertThisInitialized$1(e),"_hideRenderFlag",0),_defineProperty$2(_assertThisInitialized$1(e),"_recentMeta",null),_defineProperty$2(_assertThisInitialized$1(e),"_inChaseFrame",!1),_defineProperty$2(_assertThisInitialized$1(e),"_decoderErrorCallback",(function(t){e._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,e._assembleErr(t,DECODER_ERROR_SUBCODE))})),_defineProperty$2(_assertThisInitialized$1(e),"_decoderMessageCallback",(function(t){var r,n,i,a=t.type,o=t.data;switch(a){case"DECODER_READY":if(e.analyse.addWasmReady(),!e._frameRender){var s=Object.assign(e._config,{meta:e._meta,canvas:e._canvas,type:e._decodeController.webcodec?"2d":""});try{e._canvas.glInstance?(e._frameRender=e._canvas.glInstance,e._frameRender.updateBind(_assertThisInitialized$1(e),e._meta),logger.warn(e.TAG,"reuse canvas and context")):(e._frameRender=new FrameRender(s,_assertThisInitialized$1(e)),logger.log(e.TAG,"create frameRender with config",s))}catch(t){e._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,e._assembleErr(t&&t.message,WEBGL_ERROR_SUBCODE))}}e._startDecode();break;case"RECEIVE_FRAME":if(e._inChaseFrame&&(null===(r=e._decodeController)||void 0===r||!r.webcodec))return;e._receiveFrame(o);break;case"BATCH_FINISH":null===(n=_assertThisInitialized$1(e))||void 0===n||n._decodeEstimate.resetDecodeDot(),e._inChaseFrame&&(e._inChaseFrame=!1,e._frameQueue.empty()),e._ready||e.inSeeking||null===(i=e._decodeController)||void 0===i||!i.decoderReady||e._startDecode()}})),e}return _createClass$2(r,[{key:"wasmInitCost",get:function(){var e;return null===(e=this._decodeController)||void 0===e?void 0:e.wasmInitCost}},{key:"hevcThread",get:function(){return 1===this.decodeMode}},{key:"lowlatency",get:function(){return this._parent.lowlatency}},{key:"nextFrameTime",get:function(){var e=this._frameQueue.nextFrame();return(e&&e.info&&e.info.dts||0)/1e3}},{key:"ajustSeekTime",value:function(e,t){var r;logger.log(this.TAG,"ajust seek time: ",e),this._frameQueue.empty(),null===(r=this._decodeController)||void 0===r||r.flushDecoder(),this._switchVideoBuffer(e,t)}},{key:"canSeek",value:function(){return!0}},{key:"_appendChunk",value:function(e){var t;if(!this.noVideo&&this._timeRange){if(this._meta){if(this._recentMeta.width!==e.width||this._recentMeta.height!==e.height){logger.warn(this.TAG,"metadata changed! width: ".concat(this._recentMeta.width," -> ").concat(e.width,", height: ").concat(this._recentMeta.height," -> ").concat(e.height));var r=e.samples[0];r&&(this._recentMeta=r.meta=Object.assign({},e,{samples:null}))}}else{this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.LOADEDMETADATA),this._recentMeta=this._meta=Object.assign({},e,{samples:null}),logger.warn(this.TAG,"video set metadata",this._meta,"configuration:",this.configuration);var n=e.fpsNum/e.fpsDen;n?logger.log(this.TAG,"detect fps:",n):logger.warn(this.TAG,"no detect fps,start estimate"),this._selectDecoder(),this._initDecoder()}if(this._timeRange.append(e.samples,this._isLive&&this.noAudio,!this.videoDecode),e.samples=[],!this.inSeeking){var i;if(this.isLive||this._timeRange.frameLength||this._switchVideoBuffer(this._parent.currentTime),!this._ready&&null!==(t=this._decodeController)&&void 0!==t&&t.decoderReady)!this.noAudio&&null!==(i=this._decodeController)&&void 0!==i&&i.inDecoding||this._startDecode();this.noAudio&&this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.DURATION_CHANGE)}}}},{key:"_selectDecoder",value:function(){if(!this.isHevc&&WebCodecDecodeController.isSupported())return this._decodeController=new WebCodecDecodeController(this),void(this._decodeEstimate.webcodec=!0);this._decodeController=new WasmDecodeController(this)}},{key:"_initDecoder",value:function(){var e;null===(e=this._decodeController)||void 0===e||e.init(this._decoderMessageCallback,this._decoderErrorCallback)}},{key:"_startDecode",value:function(){var e;null===(e=this._decodeController)||void 0===e||e.doDecode()}},{key:"_switchVideoBuffer",value:function(e,t){var r=this._timeRange.switchBuffer(e);if(r){var n;if(this.noAudio&&this._parent.emit(Events$2.TIMELINE.SYNC_DTS,this.getDtsOfTime(r.start)),t)return void(null===(n=this._decodeController)||void 0===n||n.preciseSeek(e));this._startDecode(t)}}},{key:"_checkToDecode",value:function(){var e;this.inSeeking||null===(e=this._decodeController)||void 0===e||e.checkToDecode(this._frameQueue.length)}},{key:"_render",value:function(e){var t;if(!this.noVideo){var r=this._frameQueue&&this._frameQueue.nextFrame();if(r){var n=r.info;if(!n)return this._frameQueue.shift(),void console.error("not info");this._renderDts=n.dts;var i=n.dts-this.preciseVideoDts;if(!(!e&&i>0&&i<6e4)){this._frameQueue.shift(this.preciseVideoDts),Math.abs(this._lastTimeupdate-n.dts)>250&&(this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.TIMEUPDATE,{pts:n.originPts/90}),this._lastTimeupdate=n.dts),logger.long&&logger.log(this.TAG,"render delay:".concat(i," , timelinePosition:").concat(this.preciseVideoDts," , dts:").concat(n.dts," , cost:").concat(n.cost," , gopID:").concat(n.gopId," , rest:").concat(this._frameQueue.length,", buffer frame:").concat(this._timeRange.frameLength));var a=performance.now();this._hideRenderFlag++,("visible"===document.visibilityState||this._hideRenderFlag%15)&&this._frameRender.render(r.buffer,r.width,r.height,r.yLinesize,r.uvLinesize),null!==(t=this._decodeController)&&void 0!==t&&t.webcodec&&r.buffer.close(),this._renderCost=performance.now()-a,this._checkToDecode()}}else{var o;if(logger.log(this.TAG,"lack frame, ","inDecoding:",null===(o=this._decodeController)||void 0===o?void 0:o.inDecoding),this._checkToDecode(),this.noAudio){var s;if(!this.isLive&&Math.abs(this.currentTime-this.duration)<.5)return null==this||this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.TIMEUPDATE),null==this||this._emitTimelineEvents(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ENDED),void(null===(s=this._timeRange)||void 0===s||s.clean());this._timeRange.frameLength||(this._ready=!1,this.emit(Events$2.VIDEO.VIDEO_WAITING))}}}}},{key:"_updateSegmentEnd",value:function(e){var t;null===(t=this._timeRange)||void 0===t||t.updateSegmentEnd(e)}},{key:"_doChaseFrame",value:function(e){var t=e.frame;this._inChaseFrame=!0,this._timeRange.deletePassed(t.dts),this._frameQueue.empty(),this.noAudio&&this._parent.emit(Events$2.TIMELINE.SYNC_DTS,t.dts)}},{key:"_destroy",value:function(e){var t;logger.log(this.TAG,"destroy video render"),_get(_getPrototypeOf$1(r.prototype),"destroy",this).call(this,e),null===(t=this._decodeController)||void 0===t||t.destroy(),this._decodeController=null}}]),r}(),TOLERANCE=.1,TimeLine=function(e){_inherits$1(r,EventEmitter$1);var t=_createSuper$1(r);function r(e,n){var i;return _classCallCheck$2(this,r),(i=t.call(this)).TAG="TimeLine",i._parent=n,i._seeking=!1,i.audioRender=AudioMseRender.isSupported()?new AudioMseRender(e,_assertThisInitialized$1(i)):new AudioRender(e,_assertThisInitialized$1(i)),i.videoRender=new VideoRenderWithDecoder(e,_assertThisInitialized$1(i)),i._readyStatus={audio:!1,video:!1},i._paused=!0,i._switchToMultiWorker=!1,i._lowdecodeEmited=!1,i._startPlayed=!1,i._emitReady=!1,i._lastSeekTime=1e-4,i._singleTrack=-1,i._bindEvent(),i._decodeVideo=e.video,i}return _createClass$2(r,[{key:"analyse",get:function(){return this._parent.analyse}},{key:"ready",get:function(){return this._readyStatus.video&&this._readyStatus.audio}},{key:"played",get:function(){var e=this;return{length:this.currentTime?1:0,start:function(){return 0},end:function(){return e.currentTime}}}},{key:"noAudio",get:function(){return 1===this._singleTrack||2===this._singleTrack}},{key:"isLive",get:function(){return this._parent.live}},{key:"seeking",get:function(){return this._seeking}},{key:"decodeFps",get:function(){return this.videoRender.decodeFps}},{key:"decodeCost",get:function(){return this.videoRender.decodeCost}},{key:"renderCost",get:function(){return this.videoRender.renderCost}},{key:"wasmInitCost",get:function(){return this.videoRender.wasmInitCost}},{key:"fps",get:function(){return this.videoRender.fps}},{key:"totalSize",get:function(){return this.videoRender.totalSize}},{key:"bitrate",get:function(){return this.videoRender.bitrate}},{key:"gopLength",get:function(){return this.videoRender.gopLength}},{key:"currentTime",get:function(){return this.noAudio?this.paused?this.videoRender.nextFrameTime:this.videoRender.currentTime:this.audioRender.currentTime}},{key:"timelinePosition",get:function(){return this.noAudio?performance.now()/1e3:this.audioRender.currentTime}},{key:"canvas",get:function(){return this.videoRender.canvas}},{key:"readyState",get:function(){return this.videoRender.readyState}},{key:"buffered",get:function(){var e=this;return this.noAudio?this.videoRender.buffered:this.isLive?this.audioRender.buffered:{length:this.audioRender.buffered.length,start:function(t){return Math.max(e.audioRender.buffered.start(t),e.videoRender.buffered.start(t))},end:function(t){return Math.min(e.audioRender.buffered.end(t),e.videoRender.buffered.end(t))}}}},{key:"duration",get:function(){return this.noAudio?this.videoRender.duration:this.isLive?this.audioRender.duration:Math.min(this.audioRender.duration,this.videoRender.duration)}},{key:"paused",get:function(){return this._paused},set:function(e){this._paused=e}},{key:"lowlatency",get:function(){return this._parent.lowlatency}},{key:"decoderMode",get:function(){return this.videoRender.decoderMode}},{key:"currentAudioCanAutoplay",get:function(){return this.audioRender.audioCanAutoplay}},{key:"_getController",value:function(e,t){return e?new VideoRenderFromVideo(t,this):new VideoRenderWithDecoder(t,this)}},{key:"_checkInBuffer",value:function(){for(var e=this.buffered,t=0,r=e.length;t<r;t++)if(e.start(t)<=this.currentTime+TOLERANCE&&e.end(t)>=this.currentTime)return!0;return!1}},{key:"_resetReadyStatus",value:function(){this._readyStatus.audio=!1,this._readyStatus.video=!1}},{key:"_bindEvent",value:function(){var e=this;this.on(Events$2.DECODE_EVENTS.REMUX,(function(t){e.videoRender.setRemux(t)})),this.on(Events$2.DECODE_EVENTS.CHASE_VIDEO_FRAME_END,(function(t){e.emit(Events$2.DECODE_EVENTS.CHASE_AUDIO_FRAME,t)})),this.audioRender.on(Events$2.AUDIO.AUDIO_READY,(function(){logger.log(e.TAG,"audio ready! seeking=",e._seeking),e._seeking&&setTimeout((function(){try{var t=e.videoRender.getSeekStartPosition(e.currentTime,1/0);if(e.audioRender.isMse&&t)return getDecodeCapacaity().preciseSeek>e.duration&&e.currentTime>TOLERANCE?(e.audioRender.seekNoSideEffect({position:e.currentTime+TOLERANCE}),void e.videoRender.ajustSeekTime(e.currentTime,!0)):(e.audioRender.seekNoSideEffect({position:t.position+TOLERANCE}),void e.videoRender.ajustSeekTime(t.position));e.videoRender.ajustSeekTime(e.currentTime)}catch(e){}}),10),e._readyStatus.video&&e._startRender(),e._readyStatus.audio=!0,e._startPlayed||e.analyse.addAudioReady()})),this.audioRender.on(Events$2.AUDIO.AUDIO_NOT_ALLOWED_AUTOPLAY,(function(){e._emitReady&&e.pause()})),this.audioRender.on(Events$2.AUDIO.AUDIO_WAITING,(function(){!e.noAudio&&e.currentTime&&(logger.warn(e.TAG,"lack data, audio waiting,currentTime:",e.currentTime),e.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.TIMEUPDATE),e.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.WAITING),e.emit(Events$2.TIMELINE.DO_PAUSE),e._readyStatus.audio=!1)})),this.videoRender.on(Events$2.VIDEO.VIDEO_WAITING,(function(){logger.warn(e.TAG,"lack data, video waiting"),e.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.WAITING),e.emit(Events$2.TIMELINE.DO_PAUSE),e._readyStatus.video=!1})),this.videoRender.on(Events$2.VIDEO.VIDEO_READY,(function(){logger.log(e.TAG,"video ready!"),e._startPlayed||e.analyse.addVideoReady(),e._readyStatus.audio&&e._startRender("video"),e._readyStatus.video=!0})),this.videoRender.on(Events$2.VIDEO.DECODE_LOW_FPS,(function(){e.currentTime<2||(e.analyse.increaseLowDecodeCount(),e._lowdecodeEmited||(updateLowdecodeVV(),e._lowdecodeEmited=!0),e.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.LOW_DECODE))})),this.on(Events$2.TIMELINE.SINGLE_TRACK,(function(t){e._singleTrack=t,1!==t&&2!==t||(e._readyStatus.audio=!0),3===t&&(e._readyStatus.video=!0),e.emit(Events$2.TIMELINE.SYNC_DTS,0)})),this.on(Events$2.TIMELINE.DESTROY,(function(){e.removeAllListeners(),e.videoRender=null,e.audioRender=null})),this.on(Events$2.TIMELINE.DO_PLAY,(function(){e.emit(Events$2.TIMELINE.START_RENDER),e._paused=!1,e._lastSeekTime=1e-4,e.noAudio&&e.emit(Events$2.TIMELINE.SYNC_DTS,0)}))}},{key:"_startRender",value:function(e){if(!this._parent.error&&this.videoRender){if(this.noAudio&&this.emit(Events$2.TIMELINE.SYNC_DTS,0),this.videoRender.forceRender(),!this.isLive&&this._paused&&this.seeking&&this._checkInBuffer())return logger.log(this.TAG,"set seeking = false"),this._seeking=!1,this.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.SEEKED),void logger.groupEnd();this._startPlayed||(this.analyse.addFirstframe(),this.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.LOADEDDATA),this.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.FIRST_FRAME),this._startPlayed=!0),logger.log(this.TAG,"emit canplay"),this.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.CANPLAY),this._parent.autoplay?(logger.warn(this.TAG,"startRender: time=",this.currentTime,"paused:",this.paused,"seeking:",this.seeking),this.emit(Events$2.TIMELINE.START_RENDER,e)):(this._parent.autoplay=!0,this.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.PAUSE)),this.emit(Events$2.TIMELINE.READY),this._emitReady=!0,this._seeking&&this._checkInBuffer()&&(logger.log(this.TAG,"set seeking = false"),this._seeking=!1,this.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.SEEKED),logger.groupEnd())}}},{key:"_checkHlsTracks",value:function(e){if(!(null==e?void 0:e.samples[0])){if(!this.buffered.length){var t=new Error("lack video sample");t.code=3,this.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,t)}return!1}return!0}},{key:"appendBuffer",value:function(e,t){this.emit(Events$2.TIMELINE.APPEND_CHUNKS,e,t),this.noAudio&&this._seeking&&this.videoRender.ajustSeekTime(this.currentTime)}},{key:"play",value:function(){var e=this;return new Promise((function(t,r){var n=e.currentAudioCanAutoplay;e.noAudio?n=!0:e.audioRender&&e.audioRender.resume().then((function(){if(logger.log(e.TAG,"audio render resumed, pause status: ".concat(e._paused,", audioCanAutoplay:").concat(e.currentAudioCanAutoplay)),e._paused||!e.currentAudioCanAutoplay)return n=!1,void e.emit(Events$2.TIMELINE.DO_PAUSE);n=!0})).catch((function(){})),setTimeout((function(){return logger.log(e.TAG,"play() timer done, resumed=".concat(n,", paused=").concat(e.paused)),n?e.videoRender&&!e.videoRender.canAutoPlay?(console.warn("video render an't autoplay"),e.pause(),void t()):(e._paused=!1,void t()):e.paused?void 0:(logger.log(e.TAG,"audioCtx can't autoplay"),e.pause(),void r({name:"NotAllowedError"}))}),e.audioRender.isMse?10:60)}))}},{key:"pause",value:function(){this._paused||!this.ready&&!this._seeking||(this.emit(Events$2.TIMELINE.DO_PAUSE),this._paused=!0,this.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.PAUSE))}},{key:"seek",value:function(e){var t=this;if(this._seeking&&logger.groupEnd(),this.isLive){if(this.currentTime<TOLERANCE||!this.currentAudioCanAutoplay||this.paused)return;var r=this.videoRender.getSeekStartPosition(e,this._parent.preloadTime+1);if(r){if(r.position<this.currentTime)return;var n=this.audioRender.canSeek(r.position),i=this.videoRender.canSeek(r);if(!n||!i)return void logger.log(this.TAG,"seek, !!!!!!!!!can not seek, audioCanSeek:",n,"videoCanSeek:",i);logger.warn(this.TAG,"seek, chase frame to time: ",r.position,"currentTime:",this.currentTime,"duration:",this.duration),this.videoRender.videoDecode?(this.audioRender.doPause(),r.position=r.position-1.5,this.emit(Events$2.DECODE_EVENTS.CHASE_VIDEO_FRAME,r)):this.emit(Events$2.TIMELINE.CHASE_FRAME,r)}}else this._lastSeekTime!==e&&(e&&Math.abs(this._lastSeekTime-e)<=.2||(this._lastSeekTime=e,e>=this.duration&&(e=this.duration-1),e<0&&(e=0),logger.group(this.TAG,"start seek to:".concat(e,", set seeking status=true")),this._seeking=!0,this.videoRender.setSeekingStatus(!0),this.noAudio?(this.emit(Events$2.TIMELINE.SYNC_DTS,this.videoRender.getDtsOfTime(e)),this.videoRender.ajustSeekTime(e)):this._resetReadyStatus(),this.emit(Events$2.TIMELINE.DO_SEEK,e),new Promise((function(e){t.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.SEEKING),e()}))))}}]),r}(),$=_export,$entries=objectToArray.entries;$({target:"Object",stat:!0},{entries:function(e){return $entries(e)}});var AnalyseDots={FIRST_DATA:1,AUDIO_MSE_OPEN_START:2,AUDIO_MSE_OPEND:3,AUDIO_FIRSTTIME_APPENDED:4,AUDIO_READY:5,WASM_WORKER_INIT:6,WASM_WORKER_READY:7,FIRST_FRAME_TODECODE:8,VIDEO_READY:9,FIRST_FRAME:10,WAITIGN:11,SEEKING:12,SEEKED:13},AnalyseDotsFlat=Object.entries(AnalyseDots),Analyse=function(){function e(){_classCallCheck$2(this,e),_defineProperty$2(this,"_dot",[]),_defineProperty$2(this,"_currentLowDecodeCount",0)}return _createClass$2(e,[{key:"getBootStats",value:function(){var e,t=(null===(e=this._dot[0])||void 0===e?void 0:e.dot)||0;return this._dot.map((function(e){return{action:AnalyseDotsFlat.filter((function(t){return t[1]===e.action}))[0][1],dot:parseInt(e.dot-t)}}))}},{key:"getStats",value:function(e){var t,r=this.getBootStats();return{bootStats:r,bitrate:Math.abs(e.bitrate/1e3),decodeFps:e.decodeFps,fps:e.fps,playbackRate:e.playbackRate,firstframe:null===(t=r.filter((function(e){return 10===e.action}))[0])||void 0===t?void 0:t.dot,width:e.videoWidth,height:e.videoHeight,decoderMode:e.decoderMode,vv:getVV(),lowdecodeVV:getLowdecodeVV(),h265FailureRate:Number((100*getLowdecodePercent()).toFixed(2)),currentLowDecodeCount:this._currentLowDecodeCount}}},{key:"seekElapses",value:function(){for(var e=this.getBootStats(),t=[],r=0,n=0,i=e.length;n<i;n++){var a=e[n];a.action===AnalyseDots.SEEKING&&(r=a.dot),a.action===AnalyseDots.SEEKED&&t.push(a.dot-r)}return t}},{key:"addFirstData",value:function(){this._dot.push({action:AnalyseDots.FIRST_DATA,dot:this._getTimestap()})}},{key:"addAudioBoundMedia",value:function(){this._dot.push({action:AnalyseDots.AUDIO_BOUND_MEDIA,dot:this._getTimestap()})}},{key:"addAudioMseOpenStart",value:function(){this._dot.push({action:AnalyseDots.AUDIO_MSE_OPEN_START,dot:this._getTimestap()})}},{key:"addAudioMseOpend",value:function(){this._dot.push({action:AnalyseDots.AUDIO_MSE_OPEND,dot:this._getTimestap()})}},{key:"addAudioFirstTimeAppended",value:function(){this._dot.push({action:AnalyseDots.AUDIO_FIRSTTIME_APPENDED,dot:this._getTimestap()})}},{key:"addAudioReady",value:function(){this._dot.push({action:AnalyseDots.AUDIO_READY,dot:this._getTimestap()})}},{key:"addWasmInit",value:function(){this._dot.push({action:AnalyseDots.WASM_WORKER_INIT,dot:this._getTimestap()})}},{key:"addWasmReady",value:function(){this._dot.push({action:AnalyseDots.WASM_WORKER_READY,dot:this._getTimestap()})}},{key:"addFirstFrameToDecode",value:function(){this._dot.push({action:AnalyseDots.FIRST_FRAME_TODECODE,dot:this._getTimestap()})}},{key:"addVideoReady",value:function(){this._dot.push({action:AnalyseDots.VIDEO_READY,dot:this._getTimestap()})}},{key:"addFirstframe",value:function(){this._dot.push({action:AnalyseDots.FIRST_FRAME,dot:this._getTimestap()})}},{key:"addWaiting",value:function(){this._dot.push({action:AnalyseDots.WAITIGN,dot:this._getTimestap()})}},{key:"addSeeking",value:function(){this._dot.push({action:AnalyseDots.SEEKING,dot:this._getTimestap()})}},{key:"addSeeked",value:function(){this._dot.push({action:AnalyseDots.SEEKED,dot:this._getTimestap()})}},{key:"_getTimestap",value:function(){return performance.now()}},{key:"increaseLowDecodeCount",value:function(){this._currentLowDecodeCount++}},{key:"reset",value:function(){this._currentLowDecodeCount=0,this._dot=[]}}]),e}(),VIDEO_DECODE_MODE_VALUE="7",SINGLE_TRACK_TYPE={LOW_LATENCY:1,NO_AUDIO:2,NO_VIDEO:3},Parent="undefined"!=typeof HTMLElement?HTMLElement:function(){},XGVideo=function(e){_inherits$1(r,Parent);var t=_createSuper$1(r);function r(){var e;return _classCallCheck$2(this,r),(e=t.call(this)).TAG="XGVideo",e._proxyProps(),e._isLive=!0,e._vMeta=null,e._aMeta=null,e._resizeObserver=null,e._eventsBackup=[],e._hevc="h265"===getDecodeCapacaity().preloadDecoder,e._hevc||(e._degradeVideo=document.createElement("video")),e._debounceSeek=debounce(e._seek.bind(_assertThisInitialized$1(e)),300),e._onTouchEnd=e._onTouchEnd.bind(_assertThisInitialized$1(e)),e.analyse=new Analyse,e}return _createClass$2(r,[{key:"_proxyProps",value:function(){var e=this;Object.getOwnPropertyNames(r.prototype).forEach((function(t){if(/^__/.test(t)){var r=t.replace("__","");Object.defineProperty(e,r,{get:function(){try{return this[t]}catch(e){}return 0},set:function(e){try{this[t]=e}catch(e){}}})}}))}},{key:"addEventListener",value:function(e,t,n){_get(_getPrototypeOf$1(r.prototype),"addEventListener",this).call(this,e,t,n),this._degradeVideo&&this._eventsBackup.push([e,t,n])}},{key:"removeEventListener",value:function(e,t,n){_get(_getPrototypeOf$1(r.prototype),"removeEventListener",this).call(this,e,t,n),this._degradeVideo&&(this._eventsBackup=this._eventsBackup.filter((function(r){return!(r.eventName===e&&r.handler===t&&r.capture===n)})))}},{key:"setAttribute",value:function(e,t){var n;_get(_getPrototypeOf$1(r.prototype),"setAttribute",this).call(this,e,t),"src"!==e&&(null===(n=this._degradeVideo)||void 0===n||n.setAttribute(e,t))}},{key:"_init",value:function(){this.analyse.reset(),this.timeline=new TimeLine({volume:this.volume,canvas:this.querySelector("canvas"),videoContext:this.videoContext,videoDecode:this.videoDecode,maxVideoHeight:this.getAttribute("maxVideoHeight"),endLevel:parseInt(this.getAttribute("endLevel"))},this),logger.log(this.TAG,"timeline init"),this._noSleep=new NoSleep,this._logFirstFrame=!1,this._playRequest=null,this._degradeVideoUserGestured=!1,this._bindEvents(),this._vMeta&&!this.videoDecode&&this.setVideoMeta(this._vMeta),this._glCtxOptions&&(this.glCtxOptions=this._glCtxOptions),this.timeline&&(this.innerDegrade&&this.timeline.emit(Events$2.TIMELINE.INNER_DEGRADE),this.timeline.emit(Events$2.TIMELINE.SET_PLAY_MODE,this._isLive?"LIVE":"VOD"),this.timeline.emit(Events$2.TIMELINE.SET_PLAYBACKRATE,this.playbackRate),this.muted=this.muted)}},{key:"_bindEvents",value:function(){var e=this;this.timeline.on(Events$2.TIMELINE.PLAY_EVENT,(function(t,r){var n;t===VIDEO_EVENTS.LOADEDDATA&&(e.querySelector("canvas")||(logger.log(e.TAG,"_bindEvents, appendChild canvas"),e.appendChild(e.canvas)),e.canvas.style.display="block",null===(n=e.timeline)||void 0===n||n.emit(Events$2.TIMELINE.SET_PLAYBACKRATE,e.playbackRate));if(t!==VIDEO_EVENTS.LOADEDMETADATA&&t!==VIDEO_EVENTS.RESIZE||Promise.resolve().then((function(){e.updateVideoPostion()})),t===VIDEO_EVENTS.ERROR){if(logger.warn(e.TAG,"detect error:",null==r?void 0:r.message),e.pause(),e._disabled(!0),e.innerDegrade||5===e.decoderMode)return e.degradeInfo={decodeFps:e.decodeFps,bitrate:e.bitrate,wasmInitCost:e.wasmInitCost,fps:e.fps,url:e.src,msg:null==r?void 0:r.message,decoderMode:e.decoderMode},void e._innerDispatchEvent("lowdecode");e._err=r}if(t===VIDEO_EVENTS.LOW_DECODE)return e._disabled(),e.degradeInfo={decodeFps:e.decodeFps,bitrate:e.bitrate,wasmInitCost:e.wasmInitCost,fps:e.fps,url:e.src,decoderMode:e.decoderMode},void e._innerDispatchEvent(VIDEO_EVENTS_ARR[t],e.degradeInfo);if(t===VIDEO_EVENTS.LARGE_AV_GAP&&(e.unsyncInfo=r),t===VIDEO_EVENTS.ENDED){if(e.paused)return;e.pause()}t===VIDEO_EVENTS.PROGRESS&&e._noSleep.toPlay(),t===VIDEO_EVENTS.WAITING&&e.analyse.addWaiting(),t===VIDEO_EVENTS.SEEKING&&e.analyse.addSeeking(),t===VIDEO_EVENTS.SEEKED&&e.analyse.addSeeked(),e._innerDispatchEvent(VIDEO_EVENTS_ARR[t],r)}))}},{key:"_disabled",value:function(e){(this.innerDegrade||e)&&(e?getDecodeCapacaity().disabledWhenErrorOccur&&persistenceDisabledStatus(1):getDecodeCapacaity().evaluateVVCount||(this.decodeFps/this.fps<=.6&&this.bitrate<2e6?persistenceDisabledStatus(1):persistenceDisabledStatus(2)))}},{key:"degrade",value:function(e){var t=this;!!this.querySelector("canvas")?this.replaceChild(this._degradeVideo,this.canvas):this.appendChild(this._degradeVideo),this.destroy(),this._eventsBackup.forEach((function(e){var n,i=_slicedToArray$1(e,3),a=i[0],o=i[1],s=i[2];_get(_getPrototypeOf$1(r.prototype),"removeEventListener",t).call(t,a,o,s),null===(n=t._degradeVideo)||void 0===n||n.addEventListener(a,o,s)})),this._eventsBackup=[],e&&(this._degradeVideo.muted=!1,this._degradeVideo.src=e,this._degradeVideo.load())}},{key:"disconnectedCallback",value:function(){logger.log(this.TAG,"video disconnected"),document.removeEventListener("touchend",this._onTouchEnd,!0),this.destroy(!0),this._resizeObserver&&this._resizeObserver.disconnect(this)}},{key:"connectedCallback",value:function(){var e=this;logger.log(this.TAG,"video connected to document",performance.now()),this.timeline||this._init(),this.style.width="100%",this.style.height="100%",this.style.position="absolute",this.style.left="0px",this.style.top="0px",document.addEventListener("touchend",this._onTouchEnd,!0),ResizeObserver&&(this._resizeObserver=new ResizeObserver((function(t){var r;null!==(r=e.timeline)&&void 0!==r&&r.ready&&e.updateVideoPostion()})),this._resizeObserver.observe(this))}},{key:"_onTouchEnd",value:function(){playSlienceAudio(),this._degradeVideoInteract(),this._noSleep&&this._noSleep.enable()}},{key:"_degradeVideoInteract",value:function(){var e=this;if(this._degradeVideo&&(1===this.innerDegrade||3===this.innerDegrade)){if(this._degradeVideoUserGestured)return;var t=this._degradeVideo.play();t&&t.then((function(){e._degradeVideo.pause(),e._degradeVideoUserGestured=!0})).catch((function(e){console.log("degrade video: ",e.message)}))}}},{key:"play",value:function(e){var t=this;if(this.timeline){logger.log(this.TAG,"play() called, ready:".concat(this.timeline.ready,", paused:").concat(this.timeline.paused,", force:").concat(e)),this._degradeVideoInteract();var r=0;if(this.timeline.ready&&this.timeline.paused||e){if(e=e||this._isLive,this._playRequest=null,!e)return this.timeline.emit(Events$2.TIMELINE.DO_PLAY),this._innerDispatchEvent("play"),Promise.resolve();this.destroy(),this._init(),r=setTimeout((function(){try{t._innerDispatchEvent("waiting")}catch(e){}}),300)}return this._playRequest||!this.timeline.ready||this.timeline.paused?(logger.log(this.TAG,"request play!"),this._playRequest=this._playRequest||new Promise((function(e,n){t.timeline._paused=!1,t._innerDispatchEvent("play"),t._noSleep.enable(),t.timeline.once("ready",(function(){logger.log(t.TAG,"timeline emit ready"),clearTimeout(r),t.timeline.play().then(e).catch(n).finally((function(){t._playRequest=null}))}))})),this.autoplay=!0,this._playRequest):Promise.resolve()}}},{key:"pause",value:function(){this._playRequest=null,this.timeline&&this.timeline.pause();try{this._noSleep.disable(),pauseSlienceAudio()}catch(e){}}},{key:"load",value:function(){}},{key:"appendBuffer",value:function(e,t){if(this.timeline&&!this._err){if(!this._logFirstFrame){var r=e&&e.samples[0],n=t&&t.samples[0];if(!r&&!n)return;if(r||n){var i=(null==e?void 0:e.duration)/((null==e?void 0:e.formatTimescale)||1/0),a=(null==t?void 0:t.duration)/((null==t?void 0:t.formatTimescale)||1/0);logger.warn(this.TAG,"video firstDts:".concat(r&&r.dts," , audio firstDts:").concat(n&&n.dts," videoTrack.duration=").concat(i,", audioTrack.duration=").concat(a)),this._logFirstFrame=!0,(i||a)&&(this.setPlayMode("VOD"),this.timeline.emit(Events$2.TIMELINE.SET_PLAY_MODE,this._isLive?"LIVE":"VOD"),this.duration=Math.min(i||a,a||i)),this.analyse.addFirstData()}this.lowlatency&&(logger.warn(this.TAG,"single track! type=",SINGLE_TRACK_TYPE.LOW_LATENCY),this.timeline.emit(Events$2.TIMELINE.SINGLE_TRACK,SINGLE_TRACK_TYPE.LOW_LATENCY)),t.exist()||(logger.warn(this.TAG,"single track! type=",SINGLE_TRACK_TYPE.NO_AUDIO),this.timeline.emit(Events$2.TIMELINE.SINGLE_TRACK,SINGLE_TRACK_TYPE.NO_AUDIO)),e.exist()||(logger.warn(this.TAG,"single track! type=",SINGLE_TRACK_TYPE.NO_VIDEO),this.timeline.emit(Events$2.TIMELINE.SINGLE_TRACK,SINGLE_TRACK_TYPE.NO_VIDEO))}e.formatTimescale&&e.samples.forEach((function(t){t.dts=Math.floor(t.dts/e.formatTimescale*1e3),t.pts=Math.floor(t.pts/e.formatTimescale*1e3)})),t.formatTimescale&&t.samples.forEach((function(e){e.dts=Math.floor(e.dts/t.formatTimescale*1e3),e.pts=Math.floor(e.pts/t.formatTimescale*1e3)})),this.timeline.appendBuffer(e,t)}}},{key:"setAudioMeta",value:function(e){this._aMeta=e,this.timeline.emit(Events$2.TIMELINE.SET_METADATA,"audio",e)}},{key:"setVideoMeta",value:function(e){!this._isLive&&this._vMeta||(this.timeline.emit(Events$2.TIMELINE.SET_METADATA,"video",e),this._vMeta=e)}},{key:"setDecodeMode",value:function(e){this.setAttribute("decodeMode",e)}},{key:"setPlayMode",value:function(e){this._isLive="LIVE"===e}},{key:"endOfStream",value:function(){var e;this.currentTime&&(null===(e=this.timeline)||void 0===e||e.emit(Events$2.TIMELINE.END_OF_STREAM))}},{key:"updateVideoPostion",value:function(){var e;null===(e=this.timeline)||void 0===e||e.emit(Events$2.VIDEO.UPDATE_VIDEO_FILLTYPE,this.xgfillType,this.containerLayout)}},{key:"_innerDispatchEvent",value:function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}},{key:"destroy",value:function(e){this.timeline&&(this._noSleep.destroy(),logger.log(this.TAG,"call destroy"),this.timeline.emit(Events$2.TIMELINE.DESTROY,e),this.querySelector("video")&&this.removeChild(this.querySelector("video")),this.timeline=null,this._err=null,this._noSleep=null,this._eventsBackup=null)}},{key:"updateObjectPosition",value:function(e,t){this.timeline.emit(Events$2.VIDEO.UPDATE_VIDEO_COVER_POSITION,this.containerLayout,e,t),this._degradeVideo&&(this._degradeVideo.style.objectPosition="".concat(100*e,"% ").concat(100*t,"%"))}},{key:"setVideoDecode",value:function(){logger.log(this.TAG,"set videoDecode",this.videoDecode),this.videoDecode&&this.timeline&&this.timeline.videoRender&&(this.timeline.videoRender.videoDecode=this.videoDecode)}},{key:"live",get:function(){return this._isLive}},{key:"lowlatency",get:function(){return"true"===this.getAttribute("lowlatency")},set:function(e){this.setAttribute("lowlatency",e)}},{key:"autoplay",get:function(){return"true"===this.getAttribute("autoplay")},set:function(e){this.setAttribute("autoplay",e)}},{key:"__canvas",get:function(){return this.timeline.canvas}},{key:"__ended",get:function(){return Math.abs(this.currentTime-this.duration)<.5}},{key:"__width",get:function(){return this.getAttribute("width")||this.videoWidth},set:function(e){var t="number"==typeof e?"".concat(e,"px"):e;this.setAttribute("width",t),this.canvas.width=e}},{key:"__height",get:function(){return this.getAttribute("height")},set:function(e){var t="number"==typeof e?"".concat(e,"px"):e;this.setAttribute("height",t),this.canvas.height=e}},{key:"__videoWidth",get:function(){return this.canvas.width}},{key:"__videoHeight",get:function(){return this.canvas.height}},{key:"__volume",get:function(){return Number(this.getAttribute("volume"))},set:function(e){e<=0&&(e=0),e>=1&&(e=1),this.setAttribute("volume",e),this.muted||this.timeline.emit(Events$2.TIMELINE.UPDATE_VOLUME,e)}},{key:"__muted",get:function(){return"true"===this.getAttribute("muted")},set:function(e){this.setAttribute("muted",e),this._degradeVideoInteract(),this._noSleep.enable(),this.timeline.emit(Events$2.TIMELINE.UPDATE_VOLUME,e?0:this.volume)}},{key:"__currentTime",get:function(){if(!this.timeline)return 0;var e=this.timeline.currentTime,t=this.timeline.duration;return Math.min(e,t)},set:function(e){this._debounceSeek(e)}},{key:"_seek",value:function(e){this.timeline&&(this.buffered.length||this.play(),this.paused&&!this._isLive&&0===e&&this.play(),this.timeline.seek(Number(e)))}},{key:"__duration",get:function(){return this._isLive?1/0:this.timeline.duration},set:function(e){this.timeline.emit(Events$2.TIMELINE.SET_VIDEO_DURATION,e),this._innerDispatchEvent("durationchange")}},{key:"__seeking",get:function(){return this.timeline.seeking}},{key:"__paused",get:function(){return this.timeline.paused}},{key:"__fps",get:function(){return this.timeline.fps}},{key:"__decodeFps",get:function(){return this.timeline.decodeFps}},{key:"__decodeCost",get:function(){return parseInt(this.timeline.decodeCost)}},{key:"__renderCost",get:function(){return this.timeline.renderCost}},{key:"__wasmInitCost",get:function(){return this.timeline.wasmInitCost}},{key:"__totalSize",get:function(){return this.timeline.totalSize}},{key:"__bitrate",get:function(){return this.timeline.bitrate}},{key:"__gopLength",get:function(){return this.timeline.gopLength}},{key:"__readyState",get:function(){return this.timeline.readyState}},{key:"__buffered",get:function(){return this.timeline.buffered}},{key:"__decoderMode",get:function(){return this.timeline.decoderMode}},{key:"src",get:function(){return this.getAttribute("src")||""},set:function(e){logger.log(this.TAG,"set src ",e),this.setAttribute("src",e),this._vMeta=null,this.play(!0),this.timeline||this._init(),this._innerDispatchEvent("loadstart"),updateVV()}},{key:"currentSrc",get:function(){return this.getAttribute("src")||""}},{key:"playbackRate",get:function(){return parseFloat(this.getAttribute("playbackrate")||1)},set:function(e){var t;this.setAttribute("playbackrate",e),null===(t=this.timeline)||void 0===t||t.emit(Events$2.TIMELINE.SET_PLAYBACKRATE,e)}},{key:"networkState",get:function(){return 1}},{key:"preloadTime",get:function(){var e=this.getAttribute("preloadtime");if(e){var t=Number.parseFloat(e);if(t>0&&!Number.isNaN(t))return t}return 1/0},set:function(e){e&&Number(e)>0&&this.setAttribute("preloadtime",e)}},{key:"innerDegrade",get:function(){var e=this.getAttribute("innerdegrade");return parseInt(e)}},{key:"__glCtxOptions",set:function(e){this._glCtxOptions=e,this.timeline.emit(Events$2.TIMELINE.UPDATE_GL_OPTIONS,e)}},{key:"__error",get:function(){return this._err},set:function(e){this.timeline.emit(Events$2.TIMELINE.PLAY_EVENT,VIDEO_EVENTS.ERROR,e)}},{key:"degradeVideo",get:function(){return this._degradeVideo}},{key:"degradeInfo",get:function(){return this._deradeInfo},set:function(e){this._deradeInfo=e}},{key:"unsyncInfo",get:function(){return this._unsyncInfo},set:function(e){this._unsyncInfo=e}},{key:"xgfillType",get:function(){return this.parentNode.getAttribute("data-xgfill")}},{key:"containerLayout",get:function(){var e=this.parentNode;return{width:e.clientWidth,height:e.clientHeight}}},{key:"videoDecode",get:function(){return this.getAttribute("decodeMode")===VIDEO_DECODE_MODE_VALUE}},{key:"audioMedia",get:function(){var e,t;return null===(e=this.timeline)||void 0===e||null===(t=e.audioRender)||void 0===t?void 0:t.media}},{key:"getStats",value:function(){return this.analyse.getStats(this)}},{key:"getSeekElapses",value:function(){return this.analyse.seekElapses()}},{key:"dump",value:function(){var e=this.buffered;return console.log(e),new Array(e.length).fill(0).map((function(t,r){return[e.start(r),e.end(r)]}))}}],[{key:"version",get:function(){return"0.1.16"}},{key:"init",value:function(e){var t=e.h264Url,n=e.h264AsmUrl,i=e.h265AsmUrl,a=e.h265Url,o=e.h265ThreadUrl,s=e.h265SimdUrl;r.h264Url=t,r.h265Url=a,r.h265AsmUrl=i,r.h264AsmUrl=n,r.h265ThreadUrl=o,r.h265SimdUrl=s}},{key:"getDecodeCapacity",value:function(){return getDecodeCapacaity()}},{key:"getDeviceCapacity",value:function(){return getDeviceCapacity()}},{key:"setDecodeCapacity",value:function(e){setDecodeCapacity(e),e.preloadDecoder&&decoderCache.genDecoder().catch((function(){}))}},{key:"genDecoder",value:function(e){return decoderCache.genDecoder(e)}},{key:"cleanDisabled",value:function(){cleanDisabledStatus()}},{key:"isSupported",value:function(){return!!softDecodeSupported()&&!1===getDisabledStatus()}}]),r}();_defineProperty$2(XGVideo,"decoderCache",decoderCache);var H264_DECODER_URL="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/decoder/1.1.1/h264/decoder.js",ASM_H264_DECODER_URL="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/decoder/1.1.1/h264/decoder_asm.js",H265_SIMD_DECODER_URL="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/codec/high/decoder_1656041798666.js",H265_THREAD_DECODER_URL="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/codec/main/decoder.js",H265_DECODER_URL="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/codec/base/decoder.js",ASM_H265_DECODER_URL="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/codec/high/decoder_asm.js";XGVideo.init({h264Url:H264_DECODER_URL,h264AsmUrl:ASM_H264_DECODER_URL,h265Url:H265_DECODER_URL,h265SimdUrl:H265_SIMD_DECODER_URL,h265ThreadUrl:H265_THREAD_DECODER_URL,h265AsmUrl:ASM_H265_DECODER_URL}),XGVideo.setEleName=function(e){setEleName(e);var t=function(e){_inherits$1(r,XGVideo);var t=_createSuper$1(r);function r(){return _classCallCheck$2(this,r),t.apply(this,arguments)}return _createClass$2(r)}();customElements.get(getEleName())||customElements.define(getEleName(),t)};try{customElements.get(getEleName())||customElements.define(getEleName(),XGVideo)}catch(e){}const error=window.VePlayer.error;var LiveErrorCode=(e=>(e[e.INVALID_PARAMETER=210]="INVALID_PARAMETER",e))(LiveErrorCode||{});error.Level;const ErrorCode={...LiveErrorCode,...error.ErrorCode};error.ERROR_INFO,error.Level.Fatal;const event=window.VePlayer.event,Events$1={...event.Events,TIME_SHIFT_CHANGE:"time_shift_change",REFRESH_CLICK:"refresh_click"};var live=Object.freeze({__proto__:null,ErrorCode:ErrorCode,Events:Events$1});const setModuleSystem=window.VePlayer.setModuleSystem;window.VePlayer.Codec,window.VePlayer.DecodeType,window.VePlayer.Degradation,window.VePlayer.POSITIONS,window.VePlayer.register,window.VePlayer.EN,window.VePlayer.ZH_CN;const Plugin=window.VePlayer.Plugin,Sniffer=window.VePlayer.Sniffer;window.VePlayer.DynamicModule;const util=window.VePlayer.util;window.VePlayer.load,setModuleSystem("esm"),util.isMseSupported,util.isSoftDecodeSupported;const formatTime=function(e){let t=Math.floor(e/3600);const r=e%3600;let n=Math.floor(r/60),i=Math.round(r%60);return n=n.toString().padStart(2,"0"),i=i.toString().padStart(2,"0"),t>0?(t=t.toString().padStart(2,"0"),`${t}:${n}:${i}`):`${n}:${i}`},addUrlParam=(e,t)=>{if(!t)return e;const r=e.startsWith("//");r&&(e=location.protocol+e);try{const n=new URL(e);return Object.entries(t).forEach((([e,t])=>{null==n||n.searchParams.set(e,t)})),`${r?"":n.protocol}//${n.host}${n.pathname}${n.search}`}catch(t){return console.warn("URL 格式有误,请检查",t),e}};var timeShift="";const{POSITIONS:POSITIONS}=Plugin,{Events:Events}=live,MAX_SHIFT=604800,MIN_SHIFT=6;class TimeShift extends Plugin{constructor(){super(...arguments),__publicField(this,"_isMobile","mobile"===Sniffer.device),__publicField(this,"_playedBar",null),__publicField(this,"_progressBtn",null),__publicField(this,"_tooltip",null),__publicField(this,"_backToLiveBtn",null),__publicField(this,"_localInitTime",0),__publicField(this,"_timeShiftInitRange",0),__publicField(this,"_timeShiftOffset",0),__publicField(this,"_isProgressMoving",!1),__publicField(this,"_liveUrl",""),__publicField(this,"_stopPropagation",(e=>{util.stopPropagation(e),util.event(e)}))}static get pluginName(){return"timeShift"}static get defaultConfig(){return{position:POSITIONS.CONTROLS_CENTER,liveStartTime:Date.now()/1e3,maxShiftOffset:0,currentTime:Date.now()/1e3}}get _timeShiftLimit(){const e=this._timeShiftInitRange+Math.floor(Date.now()/1e3-this._localInitTime),{maxShiftOffset:t}=this.config??{};return e>604800?604800:t&&e>t?t:e}registerLanguageTexts(){return{backToLive:{jp:"ライブに戻る",en:"Back to live",zh:"返回直播","zh-hk":"返回直播"}}}updateLang(){this._backToLiveBtn&&(this._backToLiveBtn.innerHTML=this.langText.backToLive)}afterCreate(){this._liveUrl=this.player.config.url,this._playedBar=this.find(".xgplayer-progress-played"),this._progressBtn=this.find(".xgplayer-progress-btn"),this._tooltip=this.find(".xgplayer-shift-progress-point");const{liveStartTime:e,currentTime:t}=this.config??{};this._localInitTime=Math.floor(Date.now()/1e3),this._timeShiftInitRange=Math.floor(t-e),this._createBackLiveBtDom(),this._initEvents(),this._bindDomEvents()}backToLive(){this._liveUrl&&(this._switchUrl(this._liveUrl),this._timeShiftOffset=0,this._toggleBackButton(!1),this.player.emit(Events.TIME_SHIFT_CHANGE,!1))}destroy(){var e,t,r;if(this.off(Events.TIME_UPDATE,this._handleTimeUpdate.bind(this)),this._isMobile){this.unbind("touchstart",this._handleMouseDown);const r=this.player.controls;r&&(null==(e=r.root)||e.removerEventListener("touchmove",util.stopPropagation),null==(t=r.center)||t.removerEventListener("touchend",util.stopPropagation))}else this.unbind("mousedown",this._handleMouseDown),this.unbind("mouseenter",this._handleMouseEnter);this._backToLiveBtn&&(null==(r=this.player.root)||r.removeChild(this._backToLiveBtn),this._backToLiveBtn=null)}render(){return`\n <xg-progress class="xgplayer-progress ${"bottom"===(this.player.controls?this.player.controls.config.mode:"")?"xgplayer-progress-bottom":""} xgplayer-shift">\n <xg-back-live-bt class="xgplayer-back-live-bt"></xg-back-live-bt>\n <xg-outer class="xgplayer-progress-outer">\n <xg-inners class="progress-list">\n <xg-inner class="xgplayer-progress-inner" style="flex: 1">\n <xg-cache class="xgplayer-progress-cache" style="width: 100%;"></xg-cache>\n <xg-played class="xgplayer-progress-played" style="width: 100%;"></xg-played>\n </xg-inner>\n </xg-inners>\n <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>\n <xg-point class="xgplayer-shift-progress-point">00:00</xg-point>\n </xg-outer>\n </xg-progress>\n `}_initEvents(){this.on(Events.TIME_UPDATE,this._handleTimeUpdate.bind(this))}_bindDomEvents(){var e,t;if(this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseEnter=this._handleMouseEnter.bind(this),this._handleMouseLeave=this._handleMouseLeave.bind(this),this._tipsUpdate=this._tipsUpdate.bind(this),this._isMobile){this.bind("touchstart",this._handleMouseDown);const r=this.player.controls;r&&(null==(e=r.root)||e.addEventListener("touchmove",util.stopPropagation),null==(t=r.center)||t.addEventListener("touchend",util.stopPropagation))}else this.bind("mousedown",this._handleMouseDown),this.bind("mouseenter",this._handleMouseEnter)}_handleTimeUpdate(){this._isProgressMoving||this._progressUpdate()}_handleMouseDown(e){e.target!==this._backToLiveBtn&&(this._stopPropagation(e),this._focus(),this._progressBtn&&util.addClass(this._progressBtn,"active"),this._timeShiftOffset=this._getProgressOffset(e).progressOffset,this._progressUpdate(),this._isProgressMoving=!0,this._isMobile?(this.bind("touchmove",this._handleMouseMove),this.bind("touchend",this._handleMouseUp)):(document.addEventListener("mousemove",this._handleMouseMove,!1),document.addEventListener("mouseup",this._handleMouseUp,!1)))}_handleMouseMove(e){this._stopPropagation(e),this._timeShiftOffset=this._getProgressOffset(e).progressOffset,this._progressUpdate()}_handleMouseUp(e){this._stopPropagation(e),this._isProgressMoving=!1,this._progressBtn&&util.removeClass(this._progressBtn,"active"),this._changeTimeUrl(),this._isMobile?(this.unbind("touchmove",this._handleMouseMove),this.unbind("touchend",this._handleMouseUp)):(document.removeEventListener("mousemove",this._handleMouseMove,!1),document.removeEventListener("mouseup",this._handleMouseUp,!1))}_handleMouseEnter(e){this.bind("mouseleave",this._handleMouseLeave),this.bind("mousemove",this._tipsUpdate),this._tipsUpdate(e),this._focus()}_handleMouseLeave(){this.unbind("mouseleave",this._handleMouseLeave),this.unbind("mousemove",this._tipsUpdate),this._blur()}_focus(){this.player.controls.pauseAutoHide(),util.addClass(this.root,"active")}_blur(){this.player.controls.recoverAutoHide(),util.removeClass(this.root,"active")}_getProgressPercent(e){const{player:t}=this,{width:r,height:n,top:i,left:a}=this.root.getBoundingClientRect(),o=util.getEventPos(e,t.zoom);let s,u,c;90===t.rotateDeg?(s=n,u=i,c=o.clientY):(s=r,u=a,c=o.clientX);let l=c-u;l=l>s?s:l<0?0:l;let d=l/s;return d=d<0?0:d>1?1:d,d}_getProgressOffset(e){const t=this._getProgressPercent(e);return{progressOffset:Math.floor(this._timeShiftLimit*(1-t)),percent:t}}_tipsUpdate(e){const{progressOffset:t,percent:r}=this._getProgressOffset(e);this._tooltip&&(this._tooltip.style.left=100*r+"%",this._tooltip.innerHTML=`-${formatTime(t)}`)}_progressUpdate(){if(!this._progressBtn||!this._playedBar)return;const e=Math.floor(this._timeShiftLimit-this._timeShiftOffset)/this._timeShiftLimit;this._progressBtn.style.left=100*e+"%",this._playedBar.style.width=100*e+"%"}_switchUrl(e){this.player.src=e,this.player.config.url=e}_changeTimeUrl(){let e="";this._toggleBackButton(!0);const t=this._timeShiftOffset<6?6:this._timeShiftOffset;e=addUrlParam(this._liveUrl,{timeshift:t}),this._switchUrl(e),this.player.emit(Events.TIME_SHIFT_CHANGE,!0)}_createBackLiveBtDom(){var e;this._backToLiveBtn||(this._backToLiveBtn=util.createDom("xg-back-live-bt",this.langText.backToLive,void 0,"xgplayer-back-live-bt"),this._backToLiveBtn.addEventListener("click",(()=>{this.backToLive()})),null==(e=this.player.root)||e.appendChild(this._backToLiveBtn))}_toggleBackButton(e){this._backToLiveBtn&&(this._backToLiveBtn.style.display=e?"flex":"none")}}export{FlvPlugin as flv,HlsPlugin as hls,Mp4EncryptPlayer as mp4,RtsPlugin as rtm,ShakaJsPlugin as shaka,TimeShift as timeShift,XGVideo as xgvideo};
|
|
26
|
+
//# sourceMappingURL=esm/index.production.js.map
|