@volcengine/veplayer-plugin 2.6.0-rc.3 → 2.6.0-rc.5

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.
@@ -0,0 +1,2 @@
1
+ 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$s=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal&&commonjsGlobal)||function(){return this}()||commonjsGlobal||Function("return this")(),fails$A=function(e){try{return!!e()}catch(e){return!0}},fails$z=fails$A,functionBindNative=!fails$z((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),NATIVE_BIND$4=functionBindNative,FunctionPrototype$3=Function.prototype,apply$7=FunctionPrototype$3.apply,call$A=FunctionPrototype$3.call,functionApply="object"==typeof Reflect&&Reflect.apply||(NATIVE_BIND$4?call$A.bind(apply$7):function(){return call$A.apply(apply$7,arguments)}),NATIVE_BIND$3=functionBindNative,FunctionPrototype$2=Function.prototype,call$z=FunctionPrototype$2.call,uncurryThisWithBind=NATIVE_BIND$3&&FunctionPrototype$2.bind.bind(call$z,call$z),functionUncurryThis=NATIVE_BIND$3?uncurryThisWithBind:function(e){return function(){return call$z.apply(e,arguments)}},uncurryThis$E=functionUncurryThis,toString$i=uncurryThis$E({}.toString),stringSlice$5=uncurryThis$E("".slice),classofRaw$2=function(e){return stringSlice$5(toString$i(e),8,-1)},classofRaw$1=classofRaw$2,uncurryThis$D=functionUncurryThis,functionUncurryThisClause=function(e){if("Function"===classofRaw$1(e))return uncurryThis$D(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$r=$documentAll$1.IS_HTMLDDA?function(e){return"function"==typeof e||e===documentAll$1}:function(e){return"function"==typeof e},objectGetOwnPropertyDescriptor={},fails$y=fails$A,descriptors=!fails$y((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),NATIVE_BIND$2=functionBindNative,call$y=Function.prototype.call,functionCall=NATIVE_BIND$2?call$y.bind(call$y):function(){return call$y.apply(call$y,arguments)},objectPropertyIsEnumerable={},$propertyIsEnumerable$2={}.propertyIsEnumerable,getOwnPropertyDescriptor$b=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor$b&&!$propertyIsEnumerable$2.call({1:2},1);objectPropertyIsEnumerable.f=NASHORN_BUG?function(e){var t=getOwnPropertyDescriptor$b(this,e);return!!t&&t.enumerable}:$propertyIsEnumerable$2;var match,version,createPropertyDescriptor$8=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},uncurryThis$C=functionUncurryThis,fails$x=fails$A,classof$h=classofRaw$2,$Object$5=Object,split$3=uncurryThis$C("".split),indexedObject=fails$x((function(){return!$Object$5("z").propertyIsEnumerable(0)}))?function(e){return"String"==classof$h(e)?split$3(e,""):$Object$5(e)}:$Object$5,isNullOrUndefined$7=function(e){return null==e},isNullOrUndefined$6=isNullOrUndefined$7,$TypeError$m=TypeError,requireObjectCoercible$8=function(e){if(isNullOrUndefined$6(e))throw $TypeError$m("Can't call method on "+e);return e},IndexedObject$3=indexedObject,requireObjectCoercible$7=requireObjectCoercible$8,toIndexedObject$c=function(e){return IndexedObject$3(requireObjectCoercible$7(e))},isCallable$q=isCallable$r,$documentAll=documentAll_1,documentAll=$documentAll.all,isObject$m=$documentAll.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:isCallable$q(e)||e===documentAll}:function(e){return"object"==typeof e?null!==e:isCallable$q(e)},path$x={},path$w=path$x,global$r=global$s,isCallable$p=isCallable$r,aFunction=function(e){return isCallable$p(e)?e:void 0},getBuiltIn$j=function(e,t){return arguments.length<2?aFunction(path$w[e])||aFunction(global$r[e]):path$w[e]&&path$w[e][t]||global$r[e]&&global$r[e][t]},uncurryThis$B=functionUncurryThis,objectIsPrototypeOf=uncurryThis$B({}.isPrototypeOf),engineUserAgent="undefined"!=typeof navigator&&String(navigator.userAgent)||"",global$q=global$s,userAgent$6=engineUserAgent,process$4=global$q.process,Deno$1=global$q.Deno,versions=process$4&&process$4.versions||Deno$1&&Deno$1.version,v8=versions&&versions.v8;v8&&(version=(match=v8.split("."))[0]>0&&match[0]<4?1:+(match[0]+match[1])),!version&&userAgent$6&&(!(match=userAgent$6.match(/Edge\/(\d+)/))||match[1]>=74)&&(match=userAgent$6.match(/Chrome\/(\d+)/))&&(version=+match[1]);var engineV8Version=version,V8_VERSION$3=engineV8Version,fails$w=fails$A,global$p=global$s,$String$5=global$p.String,symbolConstructorDetection=!!Object.getOwnPropertySymbols&&!fails$w((function(){var e=Symbol();return!$String$5(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&V8_VERSION$3&&V8_VERSION$3<41})),NATIVE_SYMBOL$5=symbolConstructorDetection,useSymbolAsUid=NATIVE_SYMBOL$5&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,getBuiltIn$i=getBuiltIn$j,isCallable$o=isCallable$r,isPrototypeOf$s=objectIsPrototypeOf,USE_SYMBOL_AS_UID$1=useSymbolAsUid,$Object$4=Object,isSymbol$5=USE_SYMBOL_AS_UID$1?function(e){return"symbol"==typeof e}:function(e){var t=getBuiltIn$i("Symbol");return isCallable$o(t)&&isPrototypeOf$s(t.prototype,$Object$4(e))},$String$4=String,tryToString$8=function(e){try{return $String$4(e)}catch(e){return"Object"}},isCallable$n=isCallable$r,tryToString$7=tryToString$8,$TypeError$l=TypeError,aCallable$l=function(e){if(isCallable$n(e))return e;throw $TypeError$l(tryToString$7(e)+" is not a function")},aCallable$k=aCallable$l,isNullOrUndefined$5=isNullOrUndefined$7,getMethod$3=function(e,t){var r=e[t];return isNullOrUndefined$5(r)?void 0:aCallable$k(r)},call$x=functionCall,isCallable$m=isCallable$r,isObject$l=isObject$m,$TypeError$k=TypeError,ordinaryToPrimitive$1=function(e,t){var r,n;if("string"===t&&isCallable$m(r=e.toString)&&!isObject$l(n=call$x(r,e)))return n;if(isCallable$m(r=e.valueOf)&&!isObject$l(n=call$x(r,e)))return n;if("string"!==t&&isCallable$m(r=e.toString)&&!isObject$l(n=call$x(r,e)))return n;throw $TypeError$k("Can't convert object to primitive value")},shared$7={exports:{}},isPure=!0,global$o=global$s,defineProperty$e=Object.defineProperty,defineGlobalProperty$1=function(e,t){try{defineProperty$e(global$o,e,{value:t,configurable:!0,writable:!0})}catch(r){global$o[e]=t}return t},global$n=global$s,defineGlobalProperty=defineGlobalProperty$1,SHARED="__core-js_shared__",store$3=global$n[SHARED]||defineGlobalProperty(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.30.2",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.2/LICENSE",source:"https://github.com/zloirock/core-js"});var sharedExports=shared$7.exports,requireObjectCoercible$6=requireObjectCoercible$8,$Object$3=Object,toObject$d=function(e){return $Object$3(requireObjectCoercible$6(e))},uncurryThis$A=functionUncurryThis,toObject$c=toObject$d,hasOwnProperty=uncurryThis$A({}.hasOwnProperty),hasOwnProperty_1=Object.hasOwn||function(e,t){return hasOwnProperty(toObject$c(e),t)},uncurryThis$z=functionUncurryThis,id$1=0,postfix=Math.random(),toString$h=uncurryThis$z(1..toString),uid$4=function(e){return"Symbol("+(void 0===e?"":e)+")_"+toString$h(++id$1+postfix,36)},global$m=global$s,shared$6=sharedExports,hasOwn$n=hasOwnProperty_1,uid$3=uid$4,NATIVE_SYMBOL$4=symbolConstructorDetection,USE_SYMBOL_AS_UID=useSymbolAsUid,Symbol$5=global$m.Symbol,WellKnownSymbolsStore$2=shared$6("wks"),createWellKnownSymbol=USE_SYMBOL_AS_UID?Symbol$5.for||Symbol$5:Symbol$5&&Symbol$5.withoutSetter||uid$3,wellKnownSymbol$r=function(e){return hasOwn$n(WellKnownSymbolsStore$2,e)||(WellKnownSymbolsStore$2[e]=NATIVE_SYMBOL$4&&hasOwn$n(Symbol$5,e)?Symbol$5[e]:createWellKnownSymbol("Symbol."+e)),WellKnownSymbolsStore$2[e]},call$w=functionCall,isObject$k=isObject$m,isSymbol$4=isSymbol$5,getMethod$2=getMethod$3,ordinaryToPrimitive=ordinaryToPrimitive$1,wellKnownSymbol$q=wellKnownSymbol$r,$TypeError$j=TypeError,TO_PRIMITIVE=wellKnownSymbol$q("toPrimitive"),toPrimitive$7=function(e,t){if(!isObject$k(e)||isSymbol$4(e))return e;var r,n=getMethod$2(e,TO_PRIMITIVE);if(n){if(void 0===t&&(t="default"),r=call$w(n,e,t),!isObject$k(r)||isSymbol$4(r))return r;throw $TypeError$j("Can't convert object to primitive value")}return void 0===t&&(t="number"),ordinaryToPrimitive(e,t)},toPrimitive$6=toPrimitive$7,isSymbol$3=isSymbol$5,toPropertyKey$4=function(e){var t=toPrimitive$6(e,"string");return isSymbol$3(t)?t:t+""},global$l=global$s,isObject$j=isObject$m,document$3=global$l.document,EXISTS$1=isObject$j(document$3)&&isObject$j(document$3.createElement),documentCreateElement$1=function(e){return EXISTS$1?document$3.createElement(e):{}},DESCRIPTORS$l=descriptors,fails$v=fails$A,createElement$1=documentCreateElement$1,ie8DomDefine=!DESCRIPTORS$l&&!fails$v((function(){return 7!=Object.defineProperty(createElement$1("div"),"a",{get:function(){return 7}}).a})),DESCRIPTORS$k=descriptors,call$v=functionCall,propertyIsEnumerableModule$2=objectPropertyIsEnumerable,createPropertyDescriptor$7=createPropertyDescriptor$8,toIndexedObject$b=toIndexedObject$c,toPropertyKey$3=toPropertyKey$4,hasOwn$m=hasOwnProperty_1,IE8_DOM_DEFINE$1=ie8DomDefine,$getOwnPropertyDescriptor$2=Object.getOwnPropertyDescriptor;objectGetOwnPropertyDescriptor.f=DESCRIPTORS$k?$getOwnPropertyDescriptor$2:function(e,t){if(e=toIndexedObject$b(e),t=toPropertyKey$3(t),IE8_DOM_DEFINE$1)try{return $getOwnPropertyDescriptor$2(e,t)}catch(e){}if(hasOwn$m(e,t))return createPropertyDescriptor$7(!call$v(propertyIsEnumerableModule$2.f,e,t),e[t])};var fails$u=fails$A,isCallable$l=isCallable$r,replacement=/#|\.prototype\./,isForced$2=function(e,t){var r=data[normalize(e)];return r==POLYFILL||r!=NATIVE&&(isCallable$l(t)?fails$u(t):!!t)},normalize=isForced$2.normalize=function(e){return String(e).replace(replacement,".").toLowerCase()},data=isForced$2.data={},NATIVE=isForced$2.NATIVE="N",POLYFILL=isForced$2.POLYFILL="P",isForced_1=isForced$2,uncurryThis$y=functionUncurryThisClause,aCallable$j=aCallable$l,NATIVE_BIND$1=functionBindNative,bind$w=functionUncurryThisClause(functionUncurryThisClause.bind),functionBindContext=function(e,t){return aCallable$j(e),void 0===t?e:NATIVE_BIND$1?bind$w(e,t):function(){return e.apply(t,arguments)}},objectDefineProperty={},DESCRIPTORS$j=descriptors,fails$t=fails$A,v8PrototypeDefineBug=DESCRIPTORS$j&&fails$t((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),isObject$i=isObject$m,$String$3=String,$TypeError$i=TypeError,anObject$i=function(e){if(isObject$i(e))return e;throw $TypeError$i($String$3(e)+" is not an object")},DESCRIPTORS$i=descriptors,IE8_DOM_DEFINE=ie8DomDefine,V8_PROTOTYPE_DEFINE_BUG$1=v8PrototypeDefineBug,anObject$h=anObject$i,toPropertyKey$2=toPropertyKey$4,$TypeError$h=TypeError,$defineProperty$1=Object.defineProperty,$getOwnPropertyDescriptor$1=Object.getOwnPropertyDescriptor,ENUMERABLE="enumerable",CONFIGURABLE$1="configurable",WRITABLE="writable";objectDefineProperty.f=DESCRIPTORS$i?V8_PROTOTYPE_DEFINE_BUG$1?function(e,t,r){if(anObject$h(e),t=toPropertyKey$2(t),anObject$h(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$h(e),t=toPropertyKey$2(t),anObject$h(r),IE8_DOM_DEFINE)try{return $defineProperty$1(e,t,r)}catch(e){}if("get"in r||"set"in r)throw $TypeError$h("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var DESCRIPTORS$h=descriptors,definePropertyModule$4=objectDefineProperty,createPropertyDescriptor$6=createPropertyDescriptor$8,createNonEnumerableProperty$9=DESCRIPTORS$h?function(e,t,r){return definePropertyModule$4.f(e,t,createPropertyDescriptor$6(1,r))}:function(e,t,r){return e[t]=r,e},global$k=global$s,apply$6=functionApply,uncurryThis$x=functionUncurryThisClause,isCallable$k=isCallable$r,getOwnPropertyDescriptor$a=objectGetOwnPropertyDescriptor.f,isForced$1=isForced_1,path$v=path$x,bind$v=functionBindContext,createNonEnumerableProperty$8=createNonEnumerableProperty$9,hasOwn$l=hasOwnProperty_1,wrapConstructor=function(e){var t=function(r,n,a){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,a)}return apply$6(e,this,arguments)};return t.prototype=e.prototype,t},_export=function(e,t){var r,n,a,i,s,o,l,c,u,h=e.target,d=e.global,f=e.stat,p=e.proto,y=d?global$k:f?global$k[h]:(global$k[h]||{}).prototype,g=d?path$v:path$v[h]||createNonEnumerableProperty$8(path$v,h,{})[h],v=g.prototype;for(i in t)n=!(r=isForced$1(d?i:h+(f?".":"#")+i,e.forced))&&y&&hasOwn$l(y,i),o=g[i],n&&(l=e.dontCallGetSet?(u=getOwnPropertyDescriptor$a(y,i))&&u.value:y[i]),s=n&&l?l:t[i],n&&typeof o==typeof s||(c=e.bind&&n?bind$v(s,global$k):e.wrap&&n?wrapConstructor(s):p&&isCallable$k(s)?uncurryThis$x(s):s,(e.sham||s&&s.sham||o&&o.sham)&&createNonEnumerableProperty$8(c,"sham",!0),createNonEnumerableProperty$8(g,i,c),p&&(hasOwn$l(path$v,a=h+"Prototype")||createNonEnumerableProperty$8(path$v,a,{}),createNonEnumerableProperty$8(path$v[a],i,s),e.real&&v&&(r||!v[i])&&createNonEnumerableProperty$8(v,i,s)))},ceil$1=Math.ceil,floor$4=Math.floor,mathTrunc=Math.trunc||function(e){var t=+e;return(t>0?floor$4:ceil$1)(t)},trunc2=mathTrunc,toIntegerOrInfinity$7=function(e){var t=+e;return t!=t||0===t?0:trunc2(t)},toIntegerOrInfinity$6=toIntegerOrInfinity$7,max$4=Math.max,min$4=Math.min,toAbsoluteIndex$4=function(e,t){var r=toIntegerOrInfinity$6(e);return r<0?max$4(r+t,0):min$4(r,t)},toIntegerOrInfinity$5=toIntegerOrInfinity$7,min$3=Math.min,toLength$3=function(e){return e>0?min$3(toIntegerOrInfinity$5(e),9007199254740991):0},toLength$2=toLength$3,lengthOfArrayLike$c=function(e){return toLength$2(e.length)},toIndexedObject$a=toIndexedObject$c,toAbsoluteIndex$3=toAbsoluteIndex$4,lengthOfArrayLike$b=lengthOfArrayLike$c,createMethod$6=function(e){return function(t,r,n){var a,i=toIndexedObject$a(t),s=lengthOfArrayLike$b(i),o=toAbsoluteIndex$3(n,s);if(e&&r!=r){for(;s>o;)if((a=i[o++])!=a)return!0}else for(;s>o;o++)if((e||o in i)&&i[o]===r)return e||o||0;return!e&&-1}},arrayIncludes={includes:createMethod$6(!0),indexOf:createMethod$6(!1)},hiddenKeys$6={},uncurryThis$w=functionUncurryThis,hasOwn$k=hasOwnProperty_1,toIndexedObject$9=toIndexedObject$c,indexOf$7=arrayIncludes.indexOf,hiddenKeys$5=hiddenKeys$6,push$j=uncurryThis$w([].push),objectKeysInternal=function(e,t){var r,n=toIndexedObject$9(e),a=0,i=[];for(r in n)!hasOwn$k(hiddenKeys$5,r)&&hasOwn$k(n,r)&&push$j(i,r);for(;t.length>a;)hasOwn$k(n,r=t[a++])&&(~indexOf$7(i,r)||push$j(i,r));return i},enumBugKeys$3=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],internalObjectKeys$1=objectKeysInternal,enumBugKeys$2=enumBugKeys$3,objectKeys$4=Object.keys||function(e){return internalObjectKeys$1(e,enumBugKeys$2)},$$1N=_export,toObject$b=toObject$d,nativeKeys=objectKeys$4,fails$s=fails$A,FAILS_ON_PRIMITIVES$2=fails$s((function(){nativeKeys(1)}));$$1N({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES$2},{keys:function(e){return nativeKeys(toObject$b(e))}});var path$u=path$x,keys$6=path$u.Object.keys,parent$2H=keys$6,keys$5=parent$2H,parent$2G=keys$5,keys$4=parent$2G,parent$2F=keys$4,keys$3=parent$2F,keys$2=keys$3,_Object$keys$1=getDefaultExportFromCjs(keys$2),wellKnownSymbol$p=wellKnownSymbol$r,TO_STRING_TAG$4=wellKnownSymbol$p("toStringTag"),test$2={};test$2[TO_STRING_TAG$4]="z";var toStringTagSupport="[object z]"===String(test$2),TO_STRING_TAG_SUPPORT$2=toStringTagSupport,isCallable$j=isCallable$r,classofRaw=classofRaw$2,wellKnownSymbol$o=wellKnownSymbol$r,TO_STRING_TAG$3=wellKnownSymbol$o("toStringTag"),$Object$2=Object,CORRECT_ARGUMENTS="Arguments"==classofRaw(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(e){}},classof$g=TO_STRING_TAG_SUPPORT$2?classofRaw:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=tryGet(t=$Object$2(e),TO_STRING_TAG$3))?r:CORRECT_ARGUMENTS?classofRaw(t):"Object"==(n=classofRaw(t))&&isCallable$j(t.callee)?"Arguments":n},classof$f=classof$g,$String$2=String,toString$g=function(e){if("Symbol"===classof$f(e))throw TypeError("Cannot convert a Symbol value to a string");return $String$2(e)},objectDefineProperties={},DESCRIPTORS$g=descriptors,V8_PROTOTYPE_DEFINE_BUG=v8PrototypeDefineBug,definePropertyModule$3=objectDefineProperty,anObject$g=anObject$i,toIndexedObject$8=toIndexedObject$c,objectKeys$3=objectKeys$4;objectDefineProperties.f=DESCRIPTORS$g&&!V8_PROTOTYPE_DEFINE_BUG?Object.defineProperties:function(e,t){anObject$g(e);for(var r,n=toIndexedObject$8(t),a=objectKeys$3(t),i=a.length,s=0;i>s;)definePropertyModule$3.f(e,r=a[s++],n[r]);return e};var activeXDocument,getBuiltIn$h=getBuiltIn$j,html$2=getBuiltIn$h("document","documentElement"),shared$5=sharedExports,uid$2=uid$4,keys$1=shared$5("keys"),sharedKey$4=function(e){return keys$1[e]||(keys$1[e]=uid$2(e))},anObject$f=anObject$i,definePropertiesModule$1=objectDefineProperties,enumBugKeys$1=enumBugKeys$3,hiddenKeys$4=hiddenKeys$6,html$1=html$2,documentCreateElement=documentCreateElement$1,sharedKey$3=sharedKey$4,GT=">",LT="<",PROTOTYPE$1="prototype",SCRIPT="script",IE_PROTO$1=sharedKey$3("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("iframe"),r="java"+SCRIPT+":";return t.style.display="none",html$1.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$1.length;e--;)delete NullProtoObject[PROTOTYPE$1][enumBugKeys$1[e]];return NullProtoObject()};hiddenKeys$4[IE_PROTO$1]=!0;var objectCreate=Object.create||function(e,t){var r;return null!==e?(EmptyConstructor[PROTOTYPE$1]=anObject$f(e),r=new EmptyConstructor,EmptyConstructor[PROTOTYPE$1]=null,r[IE_PROTO$1]=e):r=NullProtoObject(),void 0===t?r:definePropertiesModule$1.f(r,t)},objectGetOwnPropertyNames={},internalObjectKeys=objectKeysInternal,enumBugKeys=enumBugKeys$3,hiddenKeys$3=enumBugKeys.concat("length","prototype");objectGetOwnPropertyNames.f=Object.getOwnPropertyNames||function(e){return internalObjectKeys(e,hiddenKeys$3)};var objectGetOwnPropertyNamesExternal={},toPropertyKey$1=toPropertyKey$4,definePropertyModule$2=objectDefineProperty,createPropertyDescriptor$5=createPropertyDescriptor$8,createProperty$6=function(e,t,r){var n=toPropertyKey$1(t);n in e?definePropertyModule$2.f(e,n,createPropertyDescriptor$5(0,r)):e[n]=r},toAbsoluteIndex$2=toAbsoluteIndex$4,lengthOfArrayLike$a=lengthOfArrayLike$c,createProperty$5=createProperty$6,$Array$3=Array,max$3=Math.max,arraySliceSimple=function(e,t,r){for(var n=lengthOfArrayLike$a(e),a=toAbsoluteIndex$2(t,n),i=toAbsoluteIndex$2(void 0===r?n:r,n),s=$Array$3(max$3(i-a,0)),o=0;a<i;a++,o++)createProperty$5(s,o,e[a]);return s.length=o,s},classof$e=classofRaw$2,toIndexedObject$7=toIndexedObject$c,$getOwnPropertyNames$1=objectGetOwnPropertyNames.f,arraySlice$8=arraySliceSimple,windowNames="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],getWindowNames=function(e){try{return $getOwnPropertyNames$1(e)}catch(e){return arraySlice$8(windowNames)}};objectGetOwnPropertyNamesExternal.f=function(e){return windowNames&&"Window"==classof$e(e)?getWindowNames(e):$getOwnPropertyNames$1(toIndexedObject$7(e))};var objectGetOwnPropertySymbols={};objectGetOwnPropertySymbols.f=Object.getOwnPropertySymbols;var createNonEnumerableProperty$7=createNonEnumerableProperty$9,defineBuiltIn$8=function(e,t,r,n){return n&&n.enumerable?e[t]=r:createNonEnumerableProperty$7(e,t,r),e},defineProperty$d=objectDefineProperty,defineBuiltInAccessor$5=function(e,t,r){return defineProperty$d.f(e,t,r)},wellKnownSymbolWrapped={},wellKnownSymbol$n=wellKnownSymbol$r;wellKnownSymbolWrapped.f=wellKnownSymbol$n;var set$d,get$8,has$7,path$t=path$x,hasOwn$j=hasOwnProperty_1,wrappedWellKnownSymbolModule$1=wellKnownSymbolWrapped,defineProperty$c=objectDefineProperty.f,wellKnownSymbolDefine=function(e){var t=path$t.Symbol||(path$t.Symbol={});hasOwn$j(t,e)||defineProperty$c(t,e,{value:wrappedWellKnownSymbolModule$1.f(e)})},call$u=functionCall,getBuiltIn$g=getBuiltIn$j,wellKnownSymbol$m=wellKnownSymbol$r,defineBuiltIn$7=defineBuiltIn$8,symbolDefineToPrimitive=function(){var e=getBuiltIn$g("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=wellKnownSymbol$m("toPrimitive");t&&!t[n]&&defineBuiltIn$7(t,n,(function(e){return call$u(r,this)}),{arity:1})},TO_STRING_TAG_SUPPORT$1=toStringTagSupport,classof$d=classof$g,objectToString=TO_STRING_TAG_SUPPORT$1?{}.toString:function(){return"[object "+classof$d(this)+"]"},TO_STRING_TAG_SUPPORT=toStringTagSupport,defineProperty$b=objectDefineProperty.f,createNonEnumerableProperty$6=createNonEnumerableProperty$9,hasOwn$i=hasOwnProperty_1,toString$f=objectToString,wellKnownSymbol$l=wellKnownSymbol$r,TO_STRING_TAG$2=wellKnownSymbol$l("toStringTag"),setToStringTag$9=function(e,t,r,n){if(e){var a=r?e:e.prototype;hasOwn$i(a,TO_STRING_TAG$2)||defineProperty$b(a,TO_STRING_TAG$2,{configurable:!0,value:t}),n&&!TO_STRING_TAG_SUPPORT&&createNonEnumerableProperty$6(a,"toString",toString$f)}},global$j=global$s,isCallable$i=isCallable$r,WeakMap$1=global$j.WeakMap,weakMapBasicDetection=isCallable$i(WeakMap$1)&&/native code/.test(String(WeakMap$1)),NATIVE_WEAK_MAP=weakMapBasicDetection,global$i=global$s,isObject$h=isObject$m,createNonEnumerableProperty$5=createNonEnumerableProperty$9,hasOwn$h=hasOwnProperty_1,shared$4=sharedStore,sharedKey$2=sharedKey$4,hiddenKeys$2=hiddenKeys$6,OBJECT_ALREADY_INITIALIZED="Object already initialized",TypeError$5=global$i.TypeError,WeakMap=global$i.WeakMap,enforce=function(e){return has$7(e)?get$8(e):set$d(e,{})},getterFor=function(e){return function(t){var r;if(!isObject$h(t)||(r=get$8(t)).type!==e)throw TypeError$5("Incompatible receiver, "+e+" required");return r}};if(NATIVE_WEAK_MAP||shared$4.state){var store$1=shared$4.state||(shared$4.state=new WeakMap);store$1.get=store$1.get,store$1.has=store$1.has,store$1.set=store$1.set,set$d=function(e,t){if(store$1.has(e))throw TypeError$5(OBJECT_ALREADY_INITIALIZED);return t.facade=e,store$1.set(e,t),t},get$8=function(e){return store$1.get(e)||{}},has$7=function(e){return store$1.has(e)}}else{var STATE=sharedKey$2("state");hiddenKeys$2[STATE]=!0,set$d=function(e,t){if(hasOwn$h(e,STATE))throw TypeError$5(OBJECT_ALREADY_INITIALIZED);return t.facade=e,createNonEnumerableProperty$5(e,STATE,t),t},get$8=function(e){return hasOwn$h(e,STATE)?e[STATE]:{}},has$7=function(e){return hasOwn$h(e,STATE)}}var internalState={set:set$d,get:get$8,has:has$7,enforce:enforce,getterFor:getterFor},classof$c=classofRaw$2,isArray$d=Array.isArray||function(e){return"Array"==classof$c(e)},uncurryThis$v=functionUncurryThis,isCallable$h=isCallable$r,store=sharedStore,functionToString=uncurryThis$v(Function.toString);isCallable$h(store.inspectSource)||(store.inspectSource=function(e){return functionToString(e)});var inspectSource$2=store.inspectSource,uncurryThis$u=functionUncurryThis,fails$r=fails$A,isCallable$g=isCallable$r,classof$b=classof$g,getBuiltIn$f=getBuiltIn$j,inspectSource$1=inspectSource$2,noop=function(){},empty=[],construct$6=getBuiltIn$f("Reflect","construct"),constructorRegExp=/^\s*(?:class|function)\b/,exec$4=uncurryThis$u(constructorRegExp.exec),INCORRECT_TO_STRING=!constructorRegExp.exec(noop),isConstructorModern=function(e){if(!isCallable$g(e))return!1;try{return construct$6(noop,empty,e),!0}catch(e){return!1}},isConstructorLegacy=function(e){if(!isCallable$g(e))return!1;switch(classof$b(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return INCORRECT_TO_STRING||!!exec$4(constructorRegExp,inspectSource$1(e))}catch(e){return!0}};isConstructorLegacy.sham=!0;var isConstructor$4=!construct$6||fails$r((function(){var e;return isConstructorModern(isConstructorModern.call)||!isConstructorModern(Object)||!isConstructorModern((function(){e=!0}))||e}))?isConstructorLegacy:isConstructorModern,isArray$c=isArray$d,isConstructor$3=isConstructor$4,isObject$g=isObject$m,wellKnownSymbol$k=wellKnownSymbol$r,SPECIES$5=wellKnownSymbol$k("species"),$Array$2=Array,arraySpeciesConstructor$1=function(e){var t;return isArray$c(e)&&(t=e.constructor,(isConstructor$3(t)&&(t===$Array$2||isArray$c(t.prototype))||isObject$g(t)&&null===(t=t[SPECIES$5]))&&(t=void 0)),void 0===t?$Array$2:t},arraySpeciesConstructor=arraySpeciesConstructor$1,arraySpeciesCreate$3=function(e,t){return new(arraySpeciesConstructor(e))(0===t?0:t)},bind$u=functionBindContext,uncurryThis$t=functionUncurryThis,IndexedObject$2=indexedObject,toObject$a=toObject$d,lengthOfArrayLike$9=lengthOfArrayLike$c,arraySpeciesCreate$2=arraySpeciesCreate$3,push$i=uncurryThis$t([].push),createMethod$5=function(e){var t=1==e,r=2==e,n=3==e,a=4==e,i=6==e,s=7==e,o=5==e||i;return function(l,c,u,h){for(var d,f,p=toObject$a(l),y=IndexedObject$2(p),g=bind$u(c,u),v=lengthOfArrayLike$9(y),m=0,$=h||arraySpeciesCreate$2,S=t?$(l,v):r||s?$(l,0):void 0;v>m;m++)if((o||m in y)&&(f=g(d=y[m],m,p),e))if(t)S[m]=f;else if(f)switch(e){case 3:return!0;case 5:return d;case 6:return m;case 2:push$i(S,d)}else switch(e){case 4:return!1;case 7:push$i(S,d)}return i?-1:n||a?a:S}},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)},$$1M=_export,global$h=global$s,call$t=functionCall,uncurryThis$s=functionUncurryThis,DESCRIPTORS$f=descriptors,NATIVE_SYMBOL$3=symbolConstructorDetection,fails$q=fails$A,hasOwn$g=hasOwnProperty_1,isPrototypeOf$r=objectIsPrototypeOf,anObject$e=anObject$i,toIndexedObject$6=toIndexedObject$c,toPropertyKey=toPropertyKey$4,$toString$2=toString$g,createPropertyDescriptor$4=createPropertyDescriptor$8,nativeObjectCreate=objectCreate,objectKeys$2=objectKeys$4,getOwnPropertyNamesModule$2=objectGetOwnPropertyNames,getOwnPropertyNamesExternal=objectGetOwnPropertyNamesExternal,getOwnPropertySymbolsModule$3=objectGetOwnPropertySymbols,getOwnPropertyDescriptorModule$3=objectGetOwnPropertyDescriptor,definePropertyModule$1=objectDefineProperty,definePropertiesModule=objectDefineProperties,propertyIsEnumerableModule$1=objectPropertyIsEnumerable,defineBuiltIn$6=defineBuiltIn$8,defineBuiltInAccessor$4=defineBuiltInAccessor$5,shared$3=sharedExports,sharedKey$1=sharedKey$4,hiddenKeys$1=hiddenKeys$6,uid$1=uid$4,wellKnownSymbol$j=wellKnownSymbol$r,wrappedWellKnownSymbolModule=wellKnownSymbolWrapped,defineWellKnownSymbol$l=wellKnownSymbolDefine,defineSymbolToPrimitive$1=symbolDefineToPrimitive,setToStringTag$8=setToStringTag$9,InternalStateModule$7=internalState,$forEach$1=arrayIteration.forEach,HIDDEN=sharedKey$1("hidden"),SYMBOL="Symbol",PROTOTYPE="prototype",setInternalState$7=InternalStateModule$7.set,getInternalState$2=InternalStateModule$7.getterFor(SYMBOL),ObjectPrototype$2=Object[PROTOTYPE],$Symbol=global$h.Symbol,SymbolPrototype=$Symbol&&$Symbol[PROTOTYPE],TypeError$4=global$h.TypeError,QObject=global$h.QObject,nativeGetOwnPropertyDescriptor$1=getOwnPropertyDescriptorModule$3.f,nativeDefineProperty=definePropertyModule$1.f,nativeGetOwnPropertyNames=getOwnPropertyNamesExternal.f,nativePropertyIsEnumerable=propertyIsEnumerableModule$1.f,push$h=uncurryThis$s([].push),AllSymbols=shared$3("symbols"),ObjectPrototypeSymbols=shared$3("op-symbols"),WellKnownSymbolsStore$1=shared$3("wks"),USE_SETTER=!QObject||!QObject[PROTOTYPE]||!QObject[PROTOTYPE].findChild,setSymbolDescriptor=DESCRIPTORS$f&&fails$q((function(){return 7!=nativeObjectCreate(nativeDefineProperty({},"a",{get:function(){return nativeDefineProperty(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=nativeGetOwnPropertyDescriptor$1(ObjectPrototype$2,t);n&&delete ObjectPrototype$2[t],nativeDefineProperty(e,t,r),n&&e!==ObjectPrototype$2&&nativeDefineProperty(ObjectPrototype$2,t,n)}:nativeDefineProperty,wrap=function(e,t){var r=AllSymbols[e]=nativeObjectCreate(SymbolPrototype);return setInternalState$7(r,{type:SYMBOL,tag:e,description:t}),DESCRIPTORS$f||(r.description=t),r},$defineProperty=function(e,t,r){e===ObjectPrototype$2&&$defineProperty(ObjectPrototypeSymbols,t,r),anObject$e(e);var n=toPropertyKey(t);return anObject$e(r),hasOwn$g(AllSymbols,n)?(r.enumerable?(hasOwn$g(e,HIDDEN)&&e[HIDDEN][n]&&(e[HIDDEN][n]=!1),r=nativeObjectCreate(r,{enumerable:createPropertyDescriptor$4(0,!1)})):(hasOwn$g(e,HIDDEN)||nativeDefineProperty(e,HIDDEN,createPropertyDescriptor$4(1,{})),e[HIDDEN][n]=!0),setSymbolDescriptor(e,n,r)):nativeDefineProperty(e,n,r)},$defineProperties=function(e,t){anObject$e(e);var r=toIndexedObject$6(t),n=objectKeys$2(r).concat($getOwnPropertySymbols(r));return $forEach$1(n,(function(t){DESCRIPTORS$f&&!call$t($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$t(nativePropertyIsEnumerable,this,t);return!(this===ObjectPrototype$2&&hasOwn$g(AllSymbols,t)&&!hasOwn$g(ObjectPrototypeSymbols,t))&&(!(r||!hasOwn$g(this,t)||!hasOwn$g(AllSymbols,t)||hasOwn$g(this,HIDDEN)&&this[HIDDEN][t])||r)},$getOwnPropertyDescriptor=function(e,t){var r=toIndexedObject$6(e),n=toPropertyKey(t);if(r!==ObjectPrototype$2||!hasOwn$g(AllSymbols,n)||hasOwn$g(ObjectPrototypeSymbols,n)){var a=nativeGetOwnPropertyDescriptor$1(r,n);return!a||!hasOwn$g(AllSymbols,n)||hasOwn$g(r,HIDDEN)&&r[HIDDEN][n]||(a.enumerable=!0),a}},$getOwnPropertyNames=function(e){var t=nativeGetOwnPropertyNames(toIndexedObject$6(e)),r=[];return $forEach$1(t,(function(e){hasOwn$g(AllSymbols,e)||hasOwn$g(hiddenKeys$1,e)||push$h(r,e)})),r},$getOwnPropertySymbols=function(e){var t=e===ObjectPrototype$2,r=nativeGetOwnPropertyNames(t?ObjectPrototypeSymbols:toIndexedObject$6(e)),n=[];return $forEach$1(r,(function(e){!hasOwn$g(AllSymbols,e)||t&&!hasOwn$g(ObjectPrototype$2,e)||push$h(n,AllSymbols[e])})),n};NATIVE_SYMBOL$3||(defineBuiltIn$6(SymbolPrototype=($Symbol=function(){if(isPrototypeOf$r(SymbolPrototype,this))throw TypeError$4("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?$toString$2(arguments[0]):void 0,t=uid$1(e),r=function(e){this===ObjectPrototype$2&&call$t(r,ObjectPrototypeSymbols,e),hasOwn$g(this,HIDDEN)&&hasOwn$g(this[HIDDEN],t)&&(this[HIDDEN][t]=!1),setSymbolDescriptor(this,t,createPropertyDescriptor$4(1,e))};return DESCRIPTORS$f&&USE_SETTER&&setSymbolDescriptor(ObjectPrototype$2,t,{configurable:!0,set:r}),wrap(t,e)})[PROTOTYPE],"toString",(function(){return getInternalState$2(this).tag})),defineBuiltIn$6($Symbol,"withoutSetter",(function(e){return wrap(uid$1(e),e)})),propertyIsEnumerableModule$1.f=$propertyIsEnumerable$1,definePropertyModule$1.f=$defineProperty,definePropertiesModule.f=$defineProperties,getOwnPropertyDescriptorModule$3.f=$getOwnPropertyDescriptor,getOwnPropertyNamesModule$2.f=getOwnPropertyNamesExternal.f=$getOwnPropertyNames,getOwnPropertySymbolsModule$3.f=$getOwnPropertySymbols,wrappedWellKnownSymbolModule.f=function(e){return wrap(wellKnownSymbol$j(e),e)},DESCRIPTORS$f&&defineBuiltInAccessor$4(SymbolPrototype,"description",{configurable:!0,get:function(){return getInternalState$2(this).description}})),$$1M({global:!0,constructor:!0,wrap:!0,forced:!NATIVE_SYMBOL$3,sham:!NATIVE_SYMBOL$3},{Symbol:$Symbol}),$forEach$1(objectKeys$2(WellKnownSymbolsStore$1),(function(e){defineWellKnownSymbol$l(e)})),$$1M({target:SYMBOL,stat:!0,forced:!NATIVE_SYMBOL$3},{useSetter:function(){USE_SETTER=!0},useSimple:function(){USE_SETTER=!1}}),$$1M({target:"Object",stat:!0,forced:!NATIVE_SYMBOL$3,sham:!DESCRIPTORS$f},{create:$create,defineProperty:$defineProperty,defineProperties:$defineProperties,getOwnPropertyDescriptor:$getOwnPropertyDescriptor}),$$1M({target:"Object",stat:!0,forced:!NATIVE_SYMBOL$3},{getOwnPropertyNames:$getOwnPropertyNames}),defineSymbolToPrimitive$1(),setToStringTag$8($Symbol,SYMBOL),hiddenKeys$1[HIDDEN]=!0;var NATIVE_SYMBOL$2=symbolConstructorDetection,symbolRegistryDetection=NATIVE_SYMBOL$2&&!!Symbol.for&&!!Symbol.keyFor,$$1L=_export,getBuiltIn$e=getBuiltIn$j,hasOwn$f=hasOwnProperty_1,toString$e=toString$g,shared$2=sharedExports,NATIVE_SYMBOL_REGISTRY$1=symbolRegistryDetection,StringToSymbolRegistry=shared$2("string-to-symbol-registry"),SymbolToStringRegistry$1=shared$2("symbol-to-string-registry");$$1L({target:"Symbol",stat:!0,forced:!NATIVE_SYMBOL_REGISTRY$1},{for:function(e){var t=toString$e(e);if(hasOwn$f(StringToSymbolRegistry,t))return StringToSymbolRegistry[t];var r=getBuiltIn$e("Symbol")(t);return StringToSymbolRegistry[t]=r,SymbolToStringRegistry$1[r]=t,r}});var $$1K=_export,hasOwn$e=hasOwnProperty_1,isSymbol$2=isSymbol$5,tryToString$6=tryToString$8,shared$1=sharedExports,NATIVE_SYMBOL_REGISTRY=symbolRegistryDetection,SymbolToStringRegistry=shared$1("symbol-to-string-registry");$$1K({target:"Symbol",stat:!0,forced:!NATIVE_SYMBOL_REGISTRY},{keyFor:function(e){if(!isSymbol$2(e))throw TypeError(tryToString$6(e)+" is not a symbol");if(hasOwn$e(SymbolToStringRegistry,e))return SymbolToStringRegistry[e]}});var uncurryThis$r=functionUncurryThis,arraySlice$7=uncurryThis$r([].slice),uncurryThis$q=functionUncurryThis,isArray$b=isArray$d,isCallable$f=isCallable$r,classof$a=classofRaw$2,toString$d=toString$g,push$g=uncurryThis$q([].push),getJsonReplacerFunction=function(e){if(isCallable$f(e))return e;if(isArray$b(e)){for(var t=e.length,r=[],n=0;n<t;n++){var a=e[n];"string"==typeof a?push$g(r,a):"number"!=typeof a&&"Number"!=classof$a(a)&&"String"!=classof$a(a)||push$g(r,toString$d(a))}var i=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(isArray$b(this))return t;for(var n=0;n<i;n++)if(r[n]===e)return t}}},$$1J=_export,getBuiltIn$d=getBuiltIn$j,apply$5=functionApply,call$s=functionCall,uncurryThis$p=functionUncurryThis,fails$p=fails$A,isCallable$e=isCallable$r,isSymbol$1=isSymbol$5,arraySlice$6=arraySlice$7,getReplacerFunction=getJsonReplacerFunction,NATIVE_SYMBOL$1=symbolConstructorDetection,$String$1=String,$stringify=getBuiltIn$d("JSON","stringify"),exec$3=uncurryThis$p(/./.exec),charAt$5=uncurryThis$p("".charAt),charCodeAt$2=uncurryThis$p("".charCodeAt),replace$5=uncurryThis$p("".replace),numberToString$1=uncurryThis$p(1..toString),tester=/[\uD800-\uDFFF]/g,low=/^[\uD800-\uDBFF]$/,hi=/^[\uDC00-\uDFFF]$/,WRONG_SYMBOLS_CONVERSION=!NATIVE_SYMBOL$1||fails$p((function(){var e=getBuiltIn$d("Symbol")();return"[null]"!=$stringify([e])||"{}"!=$stringify({a:e})||"{}"!=$stringify(Object(e))})),ILL_FORMED_UNICODE=fails$p((function(){return'"\\udf06\\ud834"'!==$stringify("\udf06\ud834")||'"\\udead"'!==$stringify("\udead")})),stringifyWithSymbolsFix=function(e,t){var r=arraySlice$6(arguments),n=getReplacerFunction(t);if(isCallable$e(n)||void 0!==e&&!isSymbol$1(e))return r[1]=function(e,t){if(isCallable$e(n)&&(t=call$s(n,this,$String$1(e),t)),!isSymbol$1(t))return t},apply$5($stringify,null,r)},fixIllFormed=function(e,t,r){var n=charAt$5(r,t-1),a=charAt$5(r,t+1);return exec$3(low,e)&&!exec$3(hi,a)||exec$3(hi,e)&&!exec$3(low,n)?"\\u"+numberToString$1(charCodeAt$2(e,0),16):e};$stringify&&$$1J({target:"JSON",stat:!0,arity:3,forced:WRONG_SYMBOLS_CONVERSION||ILL_FORMED_UNICODE},{stringify:function(e,t,r){var n=arraySlice$6(arguments),a=apply$5(WRONG_SYMBOLS_CONVERSION?stringifyWithSymbolsFix:$stringify,null,n);return ILL_FORMED_UNICODE&&"string"==typeof a?replace$5(a,tester,fixIllFormed):a}});var $$1I=_export,NATIVE_SYMBOL=symbolConstructorDetection,fails$o=fails$A,getOwnPropertySymbolsModule$2=objectGetOwnPropertySymbols,toObject$9=toObject$d,FORCED$a=!NATIVE_SYMBOL||fails$o((function(){getOwnPropertySymbolsModule$2.f(1)}));$$1I({target:"Object",stat:!0,forced:FORCED$a},{getOwnPropertySymbols:function(e){var t=getOwnPropertySymbolsModule$2.f;return t?t(toObject$9(e)):[]}});var path$s=path$x,getOwnPropertySymbols$5=path$s.Object.getOwnPropertySymbols,parent$2E=getOwnPropertySymbols$5,getOwnPropertySymbols$4=parent$2E,parent$2D=getOwnPropertySymbols$4,getOwnPropertySymbols$3=parent$2D,parent$2C=getOwnPropertySymbols$3,getOwnPropertySymbols$2=parent$2C,getOwnPropertySymbols$1=getOwnPropertySymbols$2,_Object$getOwnPropertySymbols$1=getDefaultExportFromCjs(getOwnPropertySymbols$1),fails$n=fails$A,wellKnownSymbol$i=wellKnownSymbol$r,V8_VERSION$2=engineV8Version,SPECIES$4=wellKnownSymbol$i("species"),arrayMethodHasSpeciesSupport$5=function(e){return V8_VERSION$2>=51||!fails$n((function(){var t=[];return(t.constructor={})[SPECIES$4]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},$$1H=_export,$filter=arrayIteration.filter,arrayMethodHasSpeciesSupport$4=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT$3=arrayMethodHasSpeciesSupport$4("filter");$$1H({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$3},{filter:function(e){return $filter(this,e,arguments.length>1?arguments[1]:void 0)}});var path$r=path$x,entryVirtual$n=function(e){return path$r[e+"Prototype"]},entryVirtual$m=entryVirtual$n,filter$6=entryVirtual$m("Array").filter,isPrototypeOf$q=objectIsPrototypeOf,method$k=filter$6,ArrayPrototype$i=Array.prototype,filter$5=function(e){var t=e.filter;return e===ArrayPrototype$i||isPrototypeOf$q(ArrayPrototype$i,e)&&t===ArrayPrototype$i.filter?method$k:t},parent$2B=filter$5,filter$4=parent$2B,parent$2A=filter$4,filter$3=parent$2A,parent$2z=filter$3,filter$2=parent$2z,filter$1=filter$2,_filterInstanceProperty$1=getDefaultExportFromCjs(filter$1),getOwnPropertyDescriptor$9={exports:{}},$$1G=_export,fails$m=fails$A,toIndexedObject$5=toIndexedObject$c,nativeGetOwnPropertyDescriptor=objectGetOwnPropertyDescriptor.f,DESCRIPTORS$e=descriptors,FORCED$9=!DESCRIPTORS$e||fails$m((function(){nativeGetOwnPropertyDescriptor(1)}));$$1G({target:"Object",stat:!0,forced:FORCED$9,sham:!DESCRIPTORS$e},{getOwnPropertyDescriptor:function(e,t){return nativeGetOwnPropertyDescriptor(toIndexedObject$5(e),t)}});var path$q=path$x,Object$4=path$q.Object,getOwnPropertyDescriptor$8=getOwnPropertyDescriptor$9.exports=function(e,t){return Object$4.getOwnPropertyDescriptor(e,t)};Object$4.getOwnPropertyDescriptor.sham&&(getOwnPropertyDescriptor$8.sham=!0);var getOwnPropertyDescriptorExports=getOwnPropertyDescriptor$9.exports,parent$2y=getOwnPropertyDescriptorExports,getOwnPropertyDescriptor$7=parent$2y,parent$2x=getOwnPropertyDescriptor$7,getOwnPropertyDescriptor$6=parent$2x,parent$2w=getOwnPropertyDescriptor$6,getOwnPropertyDescriptor$5=parent$2w,getOwnPropertyDescriptor$4=getOwnPropertyDescriptor$5,_Object$getOwnPropertyDescriptor$1=getDefaultExportFromCjs(getOwnPropertyDescriptor$4),DESCRIPTORS$d=descriptors,isArray$a=isArray$d,$TypeError$g=TypeError,getOwnPropertyDescriptor$3=Object.getOwnPropertyDescriptor,SILENT_ON_NON_WRITABLE_LENGTH_SET=DESCRIPTORS$d&&!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$a(e)&&!getOwnPropertyDescriptor$3(e,"length").writable)throw $TypeError$g("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},$TypeError$f=TypeError,MAX_SAFE_INTEGER=9007199254740991,doesNotExceedSafeInteger$3=function(e){if(e>MAX_SAFE_INTEGER)throw $TypeError$f("Maximum allowed index exceeded");return e},$$1F=_export,toObject$8=toObject$d,lengthOfArrayLike$8=lengthOfArrayLike$c,setArrayLength$1=arraySetLength,doesNotExceedSafeInteger$2=doesNotExceedSafeInteger$3,fails$l=fails$A,INCORRECT_TO_LENGTH=fails$l((function(){return 4294967297!==[].push.call({length:4294967296},1)})),properErrorOnNonWritableLength=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}},FORCED$8=INCORRECT_TO_LENGTH||!properErrorOnNonWritableLength();$$1F({target:"Array",proto:!0,arity:1,forced:FORCED$8},{push:function(e){var t=toObject$8(this),r=lengthOfArrayLike$8(t),n=arguments.length;doesNotExceedSafeInteger$2(r+n);for(var a=0;a<n;a++)t[r]=arguments[a],r++;return setArrayLength$1(t,r),r}});var IteratorPrototype$1,PrototypeOfArrayIteratorPrototype,arrayIterator,entryVirtual$l=entryVirtual$n,push$f=entryVirtual$l("Array").push,isPrototypeOf$p=objectIsPrototypeOf,method$j=push$f,ArrayPrototype$h=Array.prototype,push$e=function(e){var t=e.push;return e===ArrayPrototype$h||isPrototypeOf$p(ArrayPrototype$h,e)&&t===ArrayPrototype$h.push?method$j:t},parent$2v=push$e,push$d=parent$2v,parent$2u=push$d,push$c=parent$2u,parent$2t=push$c,push$b=parent$2t,push$a=push$b,_pushInstanceProperty=getDefaultExportFromCjs(push$a),iterators={},DESCRIPTORS$c=descriptors,hasOwn$d=hasOwnProperty_1,FunctionPrototype$1=Function.prototype,getDescriptor=DESCRIPTORS$c&&Object.getOwnPropertyDescriptor,EXISTS=hasOwn$d(FunctionPrototype$1,"name"),PROPER=EXISTS&&"something"===function(){}.name,CONFIGURABLE=EXISTS&&(!DESCRIPTORS$c||DESCRIPTORS$c&&getDescriptor(FunctionPrototype$1,"name").configurable),functionName={EXISTS:EXISTS,PROPER:PROPER,CONFIGURABLE:CONFIGURABLE},fails$k=fails$A,correctPrototypeGetter=!fails$k((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),hasOwn$c=hasOwnProperty_1,isCallable$d=isCallable$r,toObject$7=toObject$d,sharedKey=sharedKey$4,CORRECT_PROTOTYPE_GETTER$1=correctPrototypeGetter,IE_PROTO=sharedKey("IE_PROTO"),$Object$1=Object,ObjectPrototype$1=$Object$1.prototype,objectGetPrototypeOf=CORRECT_PROTOTYPE_GETTER$1?$Object$1.getPrototypeOf:function(e){var t=toObject$7(e);if(hasOwn$c(t,IE_PROTO))return t[IE_PROTO];var r=t.constructor;return isCallable$d(r)&&t instanceof r?r.prototype:t instanceof $Object$1?ObjectPrototype$1:null},fails$j=fails$A,isCallable$c=isCallable$r,isObject$f=isObject$m,create$c=objectCreate,getPrototypeOf$8=objectGetPrototypeOf,defineBuiltIn$5=defineBuiltIn$8,wellKnownSymbol$h=wellKnownSymbol$r,ITERATOR$9=wellKnownSymbol$h("iterator"),BUGGY_SAFARI_ITERATORS$1=!1;[].keys&&("next"in(arrayIterator=[].keys())?(PrototypeOfArrayIteratorPrototype=getPrototypeOf$8(getPrototypeOf$8(arrayIterator)))!==Object.prototype&&(IteratorPrototype$1=PrototypeOfArrayIteratorPrototype):BUGGY_SAFARI_ITERATORS$1=!0);var NEW_ITERATOR_PROTOTYPE=!isObject$f(IteratorPrototype$1)||fails$j((function(){var e={};return IteratorPrototype$1[ITERATOR$9].call(e)!==e}));isCallable$c((IteratorPrototype$1=NEW_ITERATOR_PROTOTYPE?{}:create$c(IteratorPrototype$1))[ITERATOR$9])||defineBuiltIn$5(IteratorPrototype$1,ITERATOR$9,(function(){return this}));var iteratorsCore={IteratorPrototype:IteratorPrototype$1,BUGGY_SAFARI_ITERATORS:BUGGY_SAFARI_ITERATORS$1},IteratorPrototype=iteratorsCore.IteratorPrototype,create$b=objectCreate,createPropertyDescriptor$3=createPropertyDescriptor$8,setToStringTag$7=setToStringTag$9,Iterators$6=iterators,returnThis$1=function(){return this},iteratorCreateConstructor=function(e,t,r,n){var a=t+" Iterator";return e.prototype=create$b(IteratorPrototype,{next:createPropertyDescriptor$3(+!n,r)}),setToStringTag$7(e,a,!1,!0),Iterators$6[a]=returnThis$1,e},uncurryThis$o=functionUncurryThis,aCallable$i=aCallable$l,functionUncurryThisAccessor=function(e,t,r){try{return uncurryThis$o(aCallable$i(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},isCallable$b=isCallable$r,$String=String,$TypeError$e=TypeError,aPossiblePrototype$1=function(e){if("object"==typeof e||isCallable$b(e))return e;throw $TypeError$e("Can't set "+$String(e)+" as a prototype")},uncurryThisAccessor=functionUncurryThisAccessor,anObject$d=anObject$i,aPossiblePrototype=aPossiblePrototype$1,objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=uncurryThisAccessor(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return anObject$d(r),aPossiblePrototype(n),t?e(r,n):r.__proto__=n,r}}():void 0),$$1E=_export,call$r=functionCall,FunctionName=functionName,createIteratorConstructor$1=iteratorCreateConstructor,getPrototypeOf$7=objectGetPrototypeOf,setToStringTag$6=setToStringTag$9,defineBuiltIn$4=defineBuiltIn$8,wellKnownSymbol$g=wellKnownSymbol$r,Iterators$5=iterators,IteratorsCore=iteratorsCore,PROPER_FUNCTION_NAME$1=FunctionName.PROPER;FunctionName.CONFIGURABLE,IteratorsCore.IteratorPrototype;var BUGGY_SAFARI_ITERATORS=IteratorsCore.BUGGY_SAFARI_ITERATORS,ITERATOR$8=wellKnownSymbol$g("iterator"),KEYS="keys",VALUES="values",ENTRIES="entries",returnThis=function(){return this},iteratorDefine=function(e,t,r,n,a,i,s){createIteratorConstructor$1(r,t,n);var o,l,c,u=function(e){if(e===a&&y)return y;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)}},h=t+" Iterator",d=!1,f=e.prototype,p=f[ITERATOR$8]||f["@@iterator"]||a&&f[a],y=!BUGGY_SAFARI_ITERATORS&&p||u(a),g="Array"==t&&f.entries||p;if(g&&(o=getPrototypeOf$7(g.call(new e)))!==Object.prototype&&o.next&&(setToStringTag$6(o,h,!0,!0),Iterators$5[h]=returnThis),PROPER_FUNCTION_NAME$1&&a==VALUES&&p&&p.name!==VALUES&&(d=!0,y=function(){return call$r(p,this)}),a)if(l={values:u(VALUES),keys:i?y:u(KEYS),entries:u(ENTRIES)},s)for(c in l)(BUGGY_SAFARI_ITERATORS||d||!(c in f))&&defineBuiltIn$4(f,c,l[c]);else $$1E({target:t,proto:!0,forced:BUGGY_SAFARI_ITERATORS||d},l);return s&&f[ITERATOR$8]!==y&&defineBuiltIn$4(f,ITERATOR$8,y,{name:a}),Iterators$5[t]=y,l},createIterResultObject$3=function(e,t){return{value:e,done:t}},toIndexedObject$4=toIndexedObject$c,Iterators$4=iterators,InternalStateModule$6=internalState;objectDefineProperty.f;var defineIterator$2=iteratorDefine,createIterResultObject$2=createIterResultObject$3,ARRAY_ITERATOR="Array Iterator",setInternalState$6=InternalStateModule$6.set,getInternalState$1=InternalStateModule$6.getterFor(ARRAY_ITERATOR);defineIterator$2(Array,"Array",(function(e,t){setInternalState$6(this,{type:ARRAY_ITERATOR,target:toIndexedObject$4(e),index:0,kind:t})}),(function(){var e=getInternalState$1(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"),Iterators$4.Arguments=Iterators$4.Array;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},DOMIterables$3=domIterables,global$g=global$s,classof$9=classof$g,createNonEnumerableProperty$4=createNonEnumerableProperty$9,Iterators$3=iterators,wellKnownSymbol$f=wellKnownSymbol$r,TO_STRING_TAG$1=wellKnownSymbol$f("toStringTag");for(var COLLECTION_NAME in DOMIterables$3){var Collection=global$g[COLLECTION_NAME],CollectionPrototype=Collection&&Collection.prototype;CollectionPrototype&&classof$9(CollectionPrototype)!==TO_STRING_TAG$1&&createNonEnumerableProperty$4(CollectionPrototype,TO_STRING_TAG$1,COLLECTION_NAME),Iterators$3[COLLECTION_NAME]=Iterators$3.Array}var fails$i=fails$A,arrayMethodIsStrict$7=function(e,t){var r=[][e];return!!r&&fails$i((function(){r.call(null,t||function(){return 1},1)}))},$forEach=arrayIteration.forEach,arrayMethodIsStrict$6=arrayMethodIsStrict$7,STRICT_METHOD$4=arrayMethodIsStrict$6("forEach"),arrayForEach=STRICT_METHOD$4?[].forEach:function(e){return $forEach(this,e,arguments.length>1?arguments[1]:void 0)},$$1D=_export,forEach$8=arrayForEach;$$1D({target:"Array",proto:!0,forced:[].forEach!=arrayForEach},{forEach:arrayForEach});var entryVirtual$k=entryVirtual$n,forEach$7=entryVirtual$k("Array").forEach,parent$2s=forEach$7,forEach$6=parent$2s,classof$8=classof$g,hasOwn$b=hasOwnProperty_1,isPrototypeOf$o=objectIsPrototypeOf,method$i=forEach$6,ArrayPrototype$g=Array.prototype,DOMIterables$2={DOMTokenList:!0,NodeList:!0},forEach$5=function(e){var t=e.forEach;return e===ArrayPrototype$g||isPrototypeOf$o(ArrayPrototype$g,e)&&t===ArrayPrototype$g.forEach||hasOwn$b(DOMIterables$2,classof$8(e))?method$i:t},parent$2r=forEach$5,forEach$4=parent$2r,parent$2q=forEach$4,forEach$3=parent$2q,forEach$2=forEach$3,_forEachInstanceProperty$1=getDefaultExportFromCjs(forEach$2),getBuiltIn$c=getBuiltIn$j,uncurryThis$n=functionUncurryThis,getOwnPropertyNamesModule$1=objectGetOwnPropertyNames,getOwnPropertySymbolsModule$1=objectGetOwnPropertySymbols,anObject$c=anObject$i,concat$9=uncurryThis$n([].concat),ownKeys$3=getBuiltIn$c("Reflect","ownKeys")||function(e){var t=getOwnPropertyNamesModule$1.f(anObject$c(e)),r=getOwnPropertySymbolsModule$1.f;return r?concat$9(t,r(e)):t},$$1C=_export,DESCRIPTORS$b=descriptors,ownKeys$2=ownKeys$3,toIndexedObject$3=toIndexedObject$c,getOwnPropertyDescriptorModule$2=objectGetOwnPropertyDescriptor,createProperty$4=createProperty$6;$$1C({target:"Object",stat:!0,sham:!DESCRIPTORS$b},{getOwnPropertyDescriptors:function(e){for(var t,r,n=toIndexedObject$3(e),a=getOwnPropertyDescriptorModule$2.f,i=ownKeys$2(n),s={},o=0;i.length>o;)void 0!==(r=a(n,t=i[o++]))&&createProperty$4(s,t,r);return s}});var path$p=path$x,getOwnPropertyDescriptors$5=path$p.Object.getOwnPropertyDescriptors,parent$2p=getOwnPropertyDescriptors$5,getOwnPropertyDescriptors$4=parent$2p,parent$2o=getOwnPropertyDescriptors$4,getOwnPropertyDescriptors$3=parent$2o,parent$2n=getOwnPropertyDescriptors$3,getOwnPropertyDescriptors$2=parent$2n,getOwnPropertyDescriptors$1=getOwnPropertyDescriptors$2,_Object$getOwnPropertyDescriptors$1=getDefaultExportFromCjs(getOwnPropertyDescriptors$1),defineProperties$7={exports:{}},$$1B=_export,DESCRIPTORS$a=descriptors,defineProperties$6=objectDefineProperties.f;$$1B({target:"Object",stat:!0,forced:Object.defineProperties!==defineProperties$6,sham:!DESCRIPTORS$a},{defineProperties:defineProperties$6});var path$o=path$x,Object$3=path$o.Object,defineProperties$5=defineProperties$7.exports=function(e,t){return Object$3.defineProperties(e,t)};Object$3.defineProperties.sham&&(defineProperties$5.sham=!0);var definePropertiesExports=defineProperties$7.exports,parent$2m=definePropertiesExports,defineProperties$4=parent$2m,parent$2l=defineProperties$4,defineProperties$3=parent$2l,parent$2k=defineProperties$3,defineProperties$2=parent$2k,defineProperties$1=defineProperties$2,_Object$defineProperties$1=getDefaultExportFromCjs(defineProperties$1),defineProperty$a={exports:{}},$$1A=_export,DESCRIPTORS$9=descriptors,defineProperty$9=objectDefineProperty.f;$$1A({target:"Object",stat:!0,forced:Object.defineProperty!==defineProperty$9,sham:!DESCRIPTORS$9},{defineProperty:defineProperty$9});var path$n=path$x,Object$2=path$n.Object,defineProperty$8=defineProperty$a.exports=function(e,t,r){return Object$2.defineProperty(e,t,r)};Object$2.defineProperty.sham&&(defineProperty$8.sham=!0);var definePropertyExports=defineProperty$a.exports,parent$2j=definePropertyExports,defineProperty$7=parent$2j,parent$2i=defineProperty$7,defineProperty$6=parent$2i,parent$2h=defineProperty$6,defineProperty$5=parent$2h,defineProperty$4=defineProperty$5,_Object$defineProperty$1=getDefaultExportFromCjs(defineProperty$4),$$1z=_export,fails$h=fails$A,isArray$9=isArray$d,isObject$e=isObject$m,toObject$6=toObject$d,lengthOfArrayLike$7=lengthOfArrayLike$c,doesNotExceedSafeInteger$1=doesNotExceedSafeInteger$3,createProperty$3=createProperty$6,arraySpeciesCreate$1=arraySpeciesCreate$3,arrayMethodHasSpeciesSupport$3=arrayMethodHasSpeciesSupport$5,wellKnownSymbol$e=wellKnownSymbol$r,V8_VERSION$1=engineV8Version,IS_CONCAT_SPREADABLE=wellKnownSymbol$e("isConcatSpreadable"),IS_CONCAT_SPREADABLE_SUPPORT=V8_VERSION$1>=51||!fails$h((function(){var e=[];return e[IS_CONCAT_SPREADABLE]=!1,e.concat()[0]!==e})),isConcatSpreadable=function(e){if(!isObject$e(e))return!1;var t=e[IS_CONCAT_SPREADABLE];return void 0!==t?!!t:isArray$9(e)},FORCED$7=!IS_CONCAT_SPREADABLE_SUPPORT||!arrayMethodHasSpeciesSupport$3("concat");$$1z({target:"Array",proto:!0,arity:1,forced:FORCED$7},{concat:function(e){var t,r,n,a,i,s=toObject$6(this),o=arraySpeciesCreate$1(s,0),l=0;for(t=-1,n=arguments.length;t<n;t++)if(isConcatSpreadable(i=-1===t?s:arguments[t]))for(a=lengthOfArrayLike$7(i),doesNotExceedSafeInteger$1(l+a),r=0;r<a;r++,l++)r in i&&createProperty$3(o,l,i[r]);else doesNotExceedSafeInteger$1(l+1),createProperty$3(o,l++,i);return o.length=l,o}});var defineWellKnownSymbol$k=wellKnownSymbolDefine;defineWellKnownSymbol$k("asyncIterator");var defineWellKnownSymbol$j=wellKnownSymbolDefine;defineWellKnownSymbol$j("hasInstance");var defineWellKnownSymbol$i=wellKnownSymbolDefine;defineWellKnownSymbol$i("isConcatSpreadable");var defineWellKnownSymbol$h=wellKnownSymbolDefine;defineWellKnownSymbol$h("iterator");var defineWellKnownSymbol$g=wellKnownSymbolDefine;defineWellKnownSymbol$g("match");var defineWellKnownSymbol$f=wellKnownSymbolDefine;defineWellKnownSymbol$f("matchAll");var defineWellKnownSymbol$e=wellKnownSymbolDefine;defineWellKnownSymbol$e("replace");var defineWellKnownSymbol$d=wellKnownSymbolDefine;defineWellKnownSymbol$d("search");var defineWellKnownSymbol$c=wellKnownSymbolDefine;defineWellKnownSymbol$c("species");var defineWellKnownSymbol$b=wellKnownSymbolDefine;defineWellKnownSymbol$b("split");var defineWellKnownSymbol$a=wellKnownSymbolDefine,defineSymbolToPrimitive=symbolDefineToPrimitive;defineWellKnownSymbol$a("toPrimitive"),defineSymbolToPrimitive();var getBuiltIn$b=getBuiltIn$j,defineWellKnownSymbol$9=wellKnownSymbolDefine,setToStringTag$5=setToStringTag$9;defineWellKnownSymbol$9("toStringTag"),setToStringTag$5(getBuiltIn$b("Symbol"),"Symbol");var defineWellKnownSymbol$8=wellKnownSymbolDefine;defineWellKnownSymbol$8("unscopables");var global$f=global$s,setToStringTag$4=setToStringTag$9;setToStringTag$4(global$f.JSON,"JSON",!0);var path$m=path$x,symbol$5=path$m.Symbol,parent$2g=symbol$5,symbol$4=parent$2g,defineWellKnownSymbol$7=wellKnownSymbolDefine;defineWellKnownSymbol$7("dispose");var parent$2f=symbol$4,symbol$3=parent$2f,defineWellKnownSymbol$6=wellKnownSymbolDefine;defineWellKnownSymbol$6("asyncDispose");var $$1y=_export,getBuiltIn$a=getBuiltIn$j,uncurryThis$m=functionUncurryThis,Symbol$4=getBuiltIn$a("Symbol"),keyFor2=Symbol$4.keyFor,thisSymbolValue$1=uncurryThis$m(Symbol$4.prototype.valueOf);$$1y({target:"Symbol",stat:!0},{isRegistered:function(e){try{return void 0!==keyFor2(thisSymbolValue$1(e))}catch(e){return!1}}});for(var $$1x=_export,shared=sharedExports,getBuiltIn$9=getBuiltIn$j,uncurryThis$l=functionUncurryThis,isSymbol=isSymbol$5,wellKnownSymbol$d=wellKnownSymbol$r,Symbol$3=getBuiltIn$9("Symbol"),$isWellKnown=Symbol$3.isWellKnown,getOwnPropertyNames4=getBuiltIn$9("Object","getOwnPropertyNames"),thisSymbolValue=uncurryThis$l(Symbol$3.prototype.valueOf),WellKnownSymbolsStore=shared("wks"),i=0,symbolKeys=getOwnPropertyNames4(Symbol$3),symbolKeysLength=symbolKeys.length;i<symbolKeysLength;i++)try{var symbolKey=symbolKeys[i];isSymbol(Symbol$3[symbolKey])&&wellKnownSymbol$d(symbolKey)}catch(e){}$$1x({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(e){if($isWellKnown&&$isWellKnown(e))return!0;try{for(var t=thisSymbolValue(e),r=0,n=getOwnPropertyNames4(WellKnownSymbolsStore),a=n.length;r<a;r++)if(WellKnownSymbolsStore[n[r]]==t)return!0}catch(e){}return!1}});var defineWellKnownSymbol$5=wellKnownSymbolDefine;defineWellKnownSymbol$5("matcher");var defineWellKnownSymbol$4=wellKnownSymbolDefine;defineWellKnownSymbol$4("metadataKey");var defineWellKnownSymbol$3=wellKnownSymbolDefine;defineWellKnownSymbol$3("observable");var defineWellKnownSymbol$2=wellKnownSymbolDefine;defineWellKnownSymbol$2("metadata");var defineWellKnownSymbol$1=wellKnownSymbolDefine;defineWellKnownSymbol$1("patternMatch");var defineWellKnownSymbol=wellKnownSymbolDefine;defineWellKnownSymbol("replaceAll");var parent$2e=symbol$3,symbol$2=parent$2e,symbol$1=symbol$2,_Symbol$1=getDefaultExportFromCjs(symbol$1),uncurryThis$k=functionUncurryThis,toIntegerOrInfinity$4=toIntegerOrInfinity$7,toString$c=toString$g,requireObjectCoercible$5=requireObjectCoercible$8,charAt$4=uncurryThis$k("".charAt),charCodeAt$1=uncurryThis$k("".charCodeAt),stringSlice$4=uncurryThis$k("".slice),createMethod$4=function(e){return function(t,r){var n,a,i=toString$c(requireObjectCoercible$5(t)),s=toIntegerOrInfinity$4(r),o=i.length;return s<0||s>=o?e?"":void 0:(n=charCodeAt$1(i,s))<55296||n>56319||s+1===o||(a=charCodeAt$1(i,s+1))<56320||a>57343?e?charAt$4(i,s):n:e?stringSlice$4(i,s,s+2):a-56320+(n-55296<<10)+65536}},stringMultibyte={codeAt:createMethod$4(!1),charAt:createMethod$4(!0)},charAt$3=stringMultibyte.charAt,toString$b=toString$g,InternalStateModule$5=internalState,defineIterator$1=iteratorDefine,createIterResultObject$1=createIterResultObject$3,STRING_ITERATOR="String Iterator",setInternalState$5=InternalStateModule$5.set,getInternalState=InternalStateModule$5.getterFor(STRING_ITERATOR);defineIterator$1(String,"String",(function(e){setInternalState$5(this,{type:STRING_ITERATOR,string:toString$b(e),index:0})}),(function(){var e,t=getInternalState(this),r=t.string,n=t.index;return n>=r.length?createIterResultObject$1(void 0,!0):(e=charAt$3(r,n),t.index+=e.length,createIterResultObject$1(e,!1))}));var WrappedWellKnownSymbolModule$2=wellKnownSymbolWrapped,iterator$5=WrappedWellKnownSymbolModule$2.f("iterator"),parent$2d=iterator$5,iterator$4=parent$2d,parent$2c=iterator$4,iterator$3=parent$2c,parent$2b=iterator$3,iterator$2=parent$2b,iterator$1=iterator$2,_Symbol$iterator$1=getDefaultExportFromCjs(iterator$1);function _typeof(e){return(_typeof="function"==typeof _Symbol$1&&"symbol"==typeof _Symbol$iterator$1?function(e){return typeof e}:function(e){return e&&"function"==typeof _Symbol$1&&e.constructor===_Symbol$1&&e!==_Symbol$1.prototype?"symbol":typeof e})(e)}var WrappedWellKnownSymbolModule$1=wellKnownSymbolWrapped,toPrimitive$5=WrappedWellKnownSymbolModule$1.f("toPrimitive"),parent$2a=toPrimitive$5,toPrimitive$4=parent$2a,parent$29=toPrimitive$4,toPrimitive$3=parent$29,parent$28=toPrimitive$3,toPrimitive$2=parent$28,toPrimitive$1=toPrimitive$2,_Symbol$toPrimitive$1=getDefaultExportFromCjs(toPrimitive$1);function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[_Symbol$toPrimitive$1];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 _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?_Object$defineProperty$1(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ownKeys$1(e,t){var r=_Object$keys$1(e);if(_Object$getOwnPropertySymbols$1){var n=_Object$getOwnPropertySymbols$1(e);t&&(n=_filterInstanceProperty$1(n).call(n,(function(t){return _Object$getOwnPropertyDescriptor$1(e,t).enumerable}))),_pushInstanceProperty(r).apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r,n,a=null!=arguments[t]?arguments[t]:{};t%2?_forEachInstanceProperty$1(r=ownKeys$1(Object(a),!0)).call(r,(function(t){_defineProperty(e,t,a[t])})):_Object$getOwnPropertyDescriptors$1?_Object$defineProperties$1(e,_Object$getOwnPropertyDescriptors$1(a)):_forEachInstanceProperty$1(n=ownKeys$1(Object(a))).call(n,(function(t){_Object$defineProperty$1(e,t,_Object$getOwnPropertyDescriptor$1(a,t))}))}return e}var classof$7=classof$g,getMethod$1=getMethod$3,isNullOrUndefined$4=isNullOrUndefined$7,Iterators$2=iterators,wellKnownSymbol$c=wellKnownSymbol$r,ITERATOR$7=wellKnownSymbol$c("iterator"),getIteratorMethod$a=function(e){if(!isNullOrUndefined$4(e))return getMethod$1(e,ITERATOR$7)||getMethod$1(e,"@@iterator")||Iterators$2[classof$7(e)]},getIteratorMethod$9=getIteratorMethod$a,getIteratorMethod_1=getIteratorMethod$9,parent$27=getIteratorMethod_1,getIteratorMethod$8=parent$27,parent$26=getIteratorMethod$8,getIteratorMethod$7=parent$26,parent$25=getIteratorMethod$7,getIteratorMethod$6=parent$25,getIteratorMethod$5=getIteratorMethod$6,_getIteratorMethod$1=getDefaultExportFromCjs(getIteratorMethod$5),$$1w=_export,isArray$8=isArray$d;$$1w({target:"Array",stat:!0},{isArray:isArray$8});var path$l=path$x,isArray$7=path$l.Array.isArray,parent$24=isArray$7,isArray$6=parent$24,parent$23=isArray$6,isArray$5=parent$23,parent$22=isArray$5,isArray$4=parent$22,isArray$3=isArray$4,_Array$isArray$1=getDefaultExportFromCjs(isArray$3),$$1v=_export,isArray$2=isArray$d,isConstructor$2=isConstructor$4,isObject$d=isObject$m,toAbsoluteIndex$1=toAbsoluteIndex$4,lengthOfArrayLike$6=lengthOfArrayLike$c,toIndexedObject$2=toIndexedObject$c,createProperty$2=createProperty$6,wellKnownSymbol$b=wellKnownSymbol$r,arrayMethodHasSpeciesSupport$2=arrayMethodHasSpeciesSupport$5,nativeSlice=arraySlice$7,HAS_SPECIES_SUPPORT$2=arrayMethodHasSpeciesSupport$2("slice"),SPECIES$3=wellKnownSymbol$b("species"),$Array$1=Array,max$2=Math.max;$$1v({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$2},{slice:function(e,t){var r,n,a,i=toIndexedObject$2(this),s=lengthOfArrayLike$6(i),o=toAbsoluteIndex$1(e,s),l=toAbsoluteIndex$1(void 0===t?s:t,s);if(isArray$2(i)&&(r=i.constructor,(isConstructor$2(r)&&(r===$Array$1||isArray$2(r.prototype))||isObject$d(r)&&null===(r=r[SPECIES$3]))&&(r=void 0),r===$Array$1||void 0===r))return nativeSlice(i,o,l);for(n=new(void 0===r?$Array$1:r)(max$2(l-o,0)),a=0;o<l;o++,a++)o in i&&createProperty$2(n,a,i[o]);return n.length=a,n}});var entryVirtual$j=entryVirtual$n,slice$6=entryVirtual$j("Array").slice,isPrototypeOf$n=objectIsPrototypeOf,method$h=slice$6,ArrayPrototype$f=Array.prototype,slice$5=function(e){var t=e.slice;return e===ArrayPrototype$f||isPrototypeOf$n(ArrayPrototype$f,e)&&t===ArrayPrototype$f.slice?method$h:t},parent$21=slice$5,slice$4=parent$21,parent$20=slice$4,slice$3=parent$20,parent$1$=slice$3,slice$2=parent$1$,slice$1=slice$2,_sliceInstanceProperty$1=getDefaultExportFromCjs(slice$1),call$q=functionCall,anObject$b=anObject$i,getMethod=getMethod$3,iteratorClose$4=function(e,t,r){var n,a;anObject$b(e);try{if(!(n=getMethod(e,"return"))){if("throw"===t)throw r;return r}n=call$q(n,e)}catch(e){a=!0,n=e}if("throw"===t)throw r;if(a)throw n;return anObject$b(n),r},anObject$a=anObject$i,iteratorClose$3=iteratorClose$4,callWithSafeIterationClosing$1=function(e,t,r,n){try{return n?t(anObject$a(r)[0],r[1]):t(r)}catch(t){iteratorClose$3(e,"throw",t)}},wellKnownSymbol$a=wellKnownSymbol$r,Iterators$1=iterators,ITERATOR$6=wellKnownSymbol$a("iterator"),ArrayPrototype$e=Array.prototype,isArrayIteratorMethod$2=function(e){return void 0!==e&&(Iterators$1.Array===e||ArrayPrototype$e[ITERATOR$6]===e)},call$p=functionCall,aCallable$h=aCallable$l,anObject$9=anObject$i,tryToString$5=tryToString$8,getIteratorMethod$4=getIteratorMethod$a,$TypeError$d=TypeError,getIterator$3=function(e,t){var r=arguments.length<2?getIteratorMethod$4(e):t;if(aCallable$h(r))return anObject$9(call$p(r,e));throw $TypeError$d(tryToString$5(e)+" is not iterable")},bind$t=functionBindContext,call$o=functionCall,toObject$5=toObject$d,callWithSafeIterationClosing=callWithSafeIterationClosing$1,isArrayIteratorMethod$1=isArrayIteratorMethod$2,isConstructor$1=isConstructor$4,lengthOfArrayLike$5=lengthOfArrayLike$c,createProperty$1=createProperty$6,getIterator$2=getIterator$3,getIteratorMethod$3=getIteratorMethod$a,$Array=Array,arrayFrom$1=function(e){var t=toObject$5(e),r=isConstructor$1(this),n=arguments.length,a=n>1?arguments[1]:void 0,i=void 0!==a;i&&(a=bind$t(a,n>2?arguments[2]:void 0));var s,o,l,c,u,h,d=getIteratorMethod$3(t),f=0;if(!d||this===$Array&&isArrayIteratorMethod$1(d))for(s=lengthOfArrayLike$5(t),o=r?new this(s):$Array(s);s>f;f++)h=i?a(t[f],f):t[f],createProperty$1(o,f,h);else for(u=(c=getIterator$2(t,d)).next,o=r?new this:[];!(l=call$o(u,c)).done;f++)h=i?callWithSafeIterationClosing(c,a,[l.value,f],!0):l.value,createProperty$1(o,f,h);return o.length=f,o},wellKnownSymbol$9=wellKnownSymbol$r,ITERATOR$5=wellKnownSymbol$9("iterator"),SAFE_CLOSING=!1;try{var called=0,iteratorWithReturn={next:function(){return{done:!!called++}},return:function(){SAFE_CLOSING=!0}};iteratorWithReturn[ITERATOR$5]=function(){return this},Array.from(iteratorWithReturn,(function(){throw 2}))}catch(e){}var checkCorrectnessOfIteration$2=function(e,t){if(!t&&!SAFE_CLOSING)return!1;var r=!1;try{var n={};n[ITERATOR$5]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},$$1u=_export,from$8=arrayFrom$1,checkCorrectnessOfIteration$1=checkCorrectnessOfIteration$2,INCORRECT_ITERATION=!checkCorrectnessOfIteration$1((function(e){Array.from(e)}));$$1u({target:"Array",stat:!0,forced:INCORRECT_ITERATION},{from:from$8});var path$k=path$x,from$7=path$k.Array.from,parent$1_=from$7,from$6=parent$1_,parent$1Z=from$6,from$5=parent$1Z,parent$1Y=from$5,from$4=parent$1Y,from$3=from$4,_Array$from$1=getDefaultExportFromCjs(from$3);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 _unsupportedIterableToArray(e,t){var r;if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=_sliceInstanceProperty$1(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?_Array$from$1(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _createForOfIteratorHelper(e,t){var r=void 0!==_Symbol$1&&_getIteratorMethod$1(e)||e["@@iterator"];if(!r){if(_Array$isArray$1(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}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 i,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw i}}}}function _arrayWithoutHoles(e){if(_Array$isArray$1(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if(void 0!==_Symbol$1&&null!=_getIteratorMethod$1(e)||null!=e["@@iterator"])return _Array$from$1(e)}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 _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithHoles(e){if(_Array$isArray$1(e))return e}function _iterableToArrayLimit(e,t){var r=null==e?null:void 0!==_Symbol$1&&_getIteratorMethod$1(e)||e["@@iterator"];if(null!=r){var n,a,i,s,o=[],l=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(_pushInstanceProperty(o).call(o,n.value),o.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw a}}return o}}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.")}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}var hasOwn$a=hasOwnProperty_1,isDataDescriptor$1=function(e){return void 0!==e&&(hasOwn$a(e,"value")||hasOwn$a(e,"writable"))},$$1t=_export,call$n=functionCall,isObject$c=isObject$m,anObject$8=anObject$i,isDataDescriptor=isDataDescriptor$1,getOwnPropertyDescriptorModule$1=objectGetOwnPropertyDescriptor,getPrototypeOf$6=objectGetPrototypeOf;function get$7(e,t){var r,n,a=arguments.length<3?e:arguments[2];return anObject$8(e)===a?e[t]:(r=getOwnPropertyDescriptorModule$1.f(e,t))?isDataDescriptor(r)?r.value:void 0===r.get?void 0:call$n(r.get,a):isObject$c(n=getPrototypeOf$6(e))?get$7(n,t,a):void 0}$$1t({target:"Reflect",stat:!0},{get:get$7});var path$j=path$x,get$6=path$j.Reflect.get,parent$1X=get$6,get$5=parent$1X,parent$1W=get$5,get$4=parent$1W,parent$1V=get$4,get$3=parent$1V,get$2=get$3,_Reflect$get=getDefaultExportFromCjs(get$2),uncurryThis$j=functionUncurryThis,aCallable$g=aCallable$l,isObject$b=isObject$m,hasOwn$9=hasOwnProperty_1,arraySlice$5=arraySlice$7,NATIVE_BIND=functionBindNative,$Function=Function,concat$8=uncurryThis$j([].concat),join$3=uncurryThis$j([].join),factories={},construct$5=function(e,t,r){if(!hasOwn$9(factories,t)){for(var n=[],a=0;a<t;a++)n[a]="a["+a+"]";factories[t]=$Function("C,a","return new C("+join$3(n,",")+")")}return factories[t](e,r)},functionBind=NATIVE_BIND?$Function.bind:function(e){var t=aCallable$g(this),r=t.prototype,n=arraySlice$5(arguments,1),a=function(){var r=concat$8(n,arraySlice$5(arguments));return this instanceof a?construct$5(t,r.length,r):t.apply(e,r)};return isObject$b(r)&&(a.prototype=r),a},$$1s=_export,bind$s=functionBind;$$1s({target:"Function",proto:!0,forced:Function.bind!==bind$s},{bind:bind$s});var entryVirtual$i=entryVirtual$n,bind$r=entryVirtual$i("Function").bind,isPrototypeOf$m=objectIsPrototypeOf,method$g=bind$r,FunctionPrototype=Function.prototype,bind$q=function(e){var t=e.bind;return e===FunctionPrototype||isPrototypeOf$m(FunctionPrototype,e)&&t===FunctionPrototype.bind?method$g:t},parent$1U=bind$q,bind$p=parent$1U,parent$1T=bind$p,bind$o=parent$1T,parent$1S=bind$o,bind$n=parent$1S,bind$m=bind$n,_bindInstanceProperty$1=getDefaultExportFromCjs(bind$m),$$1r=_export,setPrototypeOf$6=objectSetPrototypeOf;$$1r({target:"Object",stat:!0},{setPrototypeOf:setPrototypeOf$6});var path$i=path$x,setPrototypeOf$5=path$i.Object.setPrototypeOf,parent$1R=setPrototypeOf$5,setPrototypeOf$4=parent$1R,parent$1Q=setPrototypeOf$4,setPrototypeOf$3=parent$1Q,parent$1P=setPrototypeOf$3,setPrototypeOf$2=parent$1P,setPrototypeOf$1=setPrototypeOf$2,_Object$setPrototypeOf=getDefaultExportFromCjs(setPrototypeOf$1),$$1q=_export,fails$g=fails$A,toObject$4=toObject$d,nativeGetPrototypeOf=objectGetPrototypeOf,CORRECT_PROTOTYPE_GETTER=correctPrototypeGetter,FAILS_ON_PRIMITIVES$1=fails$g((function(){nativeGetPrototypeOf(1)}));$$1q({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES$1,sham:!CORRECT_PROTOTYPE_GETTER},{getPrototypeOf:function(e){return nativeGetPrototypeOf(toObject$4(e))}});var path$h=path$x,getPrototypeOf$5=path$h.Object.getPrototypeOf,parent$1O=getPrototypeOf$5,getPrototypeOf$4=parent$1O,parent$1N=getPrototypeOf$4,getPrototypeOf$3=parent$1N,parent$1M=getPrototypeOf$3,getPrototypeOf$2=parent$1M,getPrototypeOf$1=getPrototypeOf$2,_Object$getPrototypeOf=getDefaultExportFromCjs(getPrototypeOf$1);function _getPrototypeOf(e){var t;return(_getPrototypeOf=_Object$setPrototypeOf?_bindInstanceProperty$1(t=_Object$getPrototypeOf).call(t):function(e){return e.__proto__||_Object$getPrototypeOf(e)})(e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _get(){var e;"undefined"!=typeof Reflect&&_Reflect$get?_get=_bindInstanceProperty$1(e=_Reflect$get).call(e):_get=function(e,t,r){var n=_superPropBase(e,t);if(n){var a=_Object$getOwnPropertyDescriptor$1(n,t);return a.get?a.get.call(arguments.length<3?e:r):a.value}};return _get.apply(this,arguments)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var internalMetadata={exports:{}},fails$f=fails$A,arrayBufferNonExtensible=fails$f((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),fails$e=fails$A,isObject$a=isObject$m,classof$6=classofRaw$2,ARRAY_BUFFER_NON_EXTENSIBLE=arrayBufferNonExtensible,$isExtensible=Object.isExtensible,FAILS_ON_PRIMITIVES=fails$e((function(){$isExtensible(1)})),objectIsExtensible=FAILS_ON_PRIMITIVES||ARRAY_BUFFER_NON_EXTENSIBLE?function(e){return!!isObject$a(e)&&((!ARRAY_BUFFER_NON_EXTENSIBLE||"ArrayBuffer"!=classof$6(e))&&(!$isExtensible||$isExtensible(e)))}:$isExtensible,fails$d=fails$A,freezing=!fails$d((function(){return Object.isExtensible(Object.preventExtensions({}))})),$$1p=_export,uncurryThis$i=functionUncurryThis,hiddenKeys=hiddenKeys$6,isObject$9=isObject$m,hasOwn$8=hasOwnProperty_1,defineProperty$3=objectDefineProperty.f,getOwnPropertyNamesModule=objectGetOwnPropertyNames,getOwnPropertyNamesExternalModule=objectGetOwnPropertyNamesExternal,isExtensible2=objectIsExtensible,uid=uid$4,FREEZING=freezing,REQUIRED=!1,METADATA=uid("meta"),id=0,setMetadata=function(e){defineProperty$3(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.f,t=uncurryThis$i([].splice),r={};r[METADATA]=1,e(r).length&&(getOwnPropertyNamesModule.f=function(r){for(var n=e(r),a=0,i=n.length;a<i;a++)if(n[a]===METADATA){t(n,a,1);break}return n},$$1p({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:getOwnPropertyNamesExternalModule.f}))},meta=internalMetadata.exports={enable:enable,fastKey:fastKey$1,getWeakData:getWeakData,onFreeze:onFreeze};hiddenKeys[METADATA]=!0;var internalMetadataExports=internalMetadata.exports,bind$l=functionBindContext,call$m=functionCall,anObject$7=anObject$i,tryToString$4=tryToString$8,isArrayIteratorMethod=isArrayIteratorMethod$2,lengthOfArrayLike$4=lengthOfArrayLike$c,isPrototypeOf$l=objectIsPrototypeOf,getIterator$1=getIterator$3,getIteratorMethod$2=getIteratorMethod$a,iteratorClose$2=iteratorClose$4,$TypeError$c=TypeError,Result=function(e,t){this.stopped=e,this.result=t},ResultPrototype=Result.prototype,iterate$u=function(e,t,r){var n,a,i,s,o,l,c,u=r&&r.that,h=!(!r||!r.AS_ENTRIES),d=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),y=bind$l(t,u),g=function(e){return n&&iteratorClose$2(n,"normal",e),new Result(!0,e)},v=function(e){return h?(anObject$7(e),p?y(e[0],e[1],g):y(e[0],e[1])):p?y(e,g):y(e)};if(d)n=e.iterator;else if(f)n=e;else{if(!(a=getIteratorMethod$2(e)))throw $TypeError$c(tryToString$4(e)+" is not iterable");if(isArrayIteratorMethod(a)){for(i=0,s=lengthOfArrayLike$4(e);s>i;i++)if((o=v(e[i]))&&isPrototypeOf$l(ResultPrototype,o))return o;return new Result(!1)}n=getIterator$1(e,a)}for(l=d?e.next:n.next;!(c=call$m(l,n)).done;){try{o=v(c.value)}catch(e){iteratorClose$2(n,"throw",e)}if("object"==typeof o&&o&&isPrototypeOf$l(ResultPrototype,o))return o}return new Result(!1)},isPrototypeOf$k=objectIsPrototypeOf,$TypeError$b=TypeError,anInstance$5=function(e,t){if(isPrototypeOf$k(t,e))return e;throw $TypeError$b("Incorrect invocation")},$$1o=_export,global$e=global$s,InternalMetadataModule=internalMetadataExports,fails$c=fails$A,createNonEnumerableProperty$3=createNonEnumerableProperty$9,iterate$t=iterate$u,anInstance$4=anInstance$5,isCallable$a=isCallable$r,isObject$8=isObject$m,setToStringTag$3=setToStringTag$9,defineProperty$2=objectDefineProperty.f,forEach$1=arrayIteration.forEach,DESCRIPTORS$8=descriptors,InternalStateModule$4=internalState,setInternalState$4=InternalStateModule$4.set,internalStateGetterFor$1=InternalStateModule$4.getterFor,collection$2=function(e,t,r){var n,a=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),s=a?"set":"add",o=global$e[e],l=o&&o.prototype,c={};if(DESCRIPTORS$8&&isCallable$a(o)&&(i||l.forEach&&!fails$c((function(){(new o).entries().next()})))){var u=(n=t((function(t,r){setInternalState$4(anInstance$4(t,u),{type:e,collection:new o}),null!=r&&iterate$t(r,t[s],{that:t,AS_ENTRIES:a})}))).prototype,h=internalStateGetterFor$1(e);forEach$1(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in l)||i&&"clear"==e||createNonEnumerableProperty$3(u,e,(function(r,n){var a=h(this).collection;if(!t&&i&&!isObject$8(r))return"get"==e&&void 0;var s=a[e](0===r?0:r,n);return t?this:s}))})),i||defineProperty$2(u,"size",{configurable:!0,get:function(){return h(this).collection.size}})}else n=r.getConstructor(t,e,a,s),InternalMetadataModule.enable();return setToStringTag$3(n,e,!1,!0),c[e]=n,$$1o({global:!0,forced:!0},c),i||r.setStrong(n,e,a),n},defineBuiltIn$3=defineBuiltIn$8,defineBuiltIns$2=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:defineBuiltIn$3(e,n,t[n],r);return e},getBuiltIn$8=getBuiltIn$j,defineBuiltInAccessor$3=defineBuiltInAccessor$5,wellKnownSymbol$8=wellKnownSymbol$r,DESCRIPTORS$7=descriptors,SPECIES$2=wellKnownSymbol$8("species"),setSpecies$2=function(e){var t=getBuiltIn$8(e);DESCRIPTORS$7&&t&&!t[SPECIES$2]&&defineBuiltInAccessor$3(t,SPECIES$2,{configurable:!0,get:function(){return this}})},create$a=objectCreate,defineBuiltInAccessor$2=defineBuiltInAccessor$5,defineBuiltIns$1=defineBuiltIns$2,bind$k=functionBindContext,anInstance$3=anInstance$5,isNullOrUndefined$3=isNullOrUndefined$7,iterate$s=iterate$u,defineIterator=iteratorDefine,createIterResultObject=createIterResultObject$3,setSpecies$1=setSpecies$2,DESCRIPTORS$6=descriptors,fastKey=internalMetadataExports.fastKey,InternalStateModule$3=internalState,setInternalState$3=InternalStateModule$3.set,internalStateGetterFor=InternalStateModule$3.getterFor,collectionStrong$2={getConstructor:function(e,t,r,n){var a=e((function(e,a){anInstance$3(e,i),setInternalState$3(e,{type:t,index:create$a(null),first:void 0,last:void 0,size:0}),DESCRIPTORS$6||(e.size=0),isNullOrUndefined$3(a)||iterate$s(a,e[n],{that:e,AS_ENTRIES:r})})),i=a.prototype,s=internalStateGetterFor(t),o=function(e,t,r){var n,a,i=s(e),o=l(e,t);return o?o.value=r:(i.last=o={index:a=fastKey(t,!0),key:t,value:r,previous:n=i.last,next:void 0,removed:!1},i.first||(i.first=o),n&&(n.next=o),DESCRIPTORS$6?i.size++:e.size++,"F"!==a&&(i.index[a]=o)),e},l=function(e,t){var r,n=s(e),a=fastKey(t);if("F"!==a)return n.index[a];for(r=n.first;r;r=r.next)if(r.key==t)return r};return defineBuiltIns$1(i,{clear:function(){for(var e=s(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$6?e.size=0:this.size=0},delete:function(e){var t=this,r=s(t),n=l(t,e);if(n){var a=n.next,i=n.previous;delete r.index[n.index],n.removed=!0,i&&(i.next=a),a&&(a.previous=i),r.first==n&&(r.first=a),r.last==n&&(r.last=i),DESCRIPTORS$6?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=s(this),n=bind$k(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!!l(this,e)}}),defineBuiltIns$1(i,r?{get:function(e){var t=l(this,e);return t&&t.value},set:function(e,t){return o(this,0===e?0:e,t)}}:{add:function(e){return o(this,e=0===e?0:e,e)}}),DESCRIPTORS$6&&defineBuiltInAccessor$2(i,"size",{configurable:!0,get:function(){return s(this).size}}),a},setStrong:function(e,t,r){var n=t+" Iterator",a=internalStateGetterFor(t),i=internalStateGetterFor(n);defineIterator(e,t,(function(e,t){setInternalState$3(this,{type:n,target:e,state:a(e),kind:t,last:void 0})}),(function(){for(var e=i(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$1(t)}},collection$1=collection$2,collectionStrong$1=collectionStrong$2;collection$1("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),collectionStrong$1);var path$g=path$x,map$c=path$g.Map,parent$1L=map$c,map$b=parent$1L,parent$1K=map$b,map$a=parent$1K,isConstructor3=isConstructor$4,tryToString$3=tryToString$8,$TypeError$a=TypeError,aConstructor$3=function(e){if(isConstructor3(e))return e;throw $TypeError$a(tryToString$3(e)+" is not a constructor")},bind$j=functionBindContext,call$l=functionCall,aCallable$f=aCallable$l,aConstructor$2=aConstructor$3,isNullOrUndefined$2=isNullOrUndefined$7,iterate$r=iterate$u,push$9=[].push,collectionFrom=function(e){var t,r,n,a,i=arguments.length,s=i>1?arguments[1]:void 0;return aConstructor$2(this),(t=void 0!==s)&&aCallable$f(s),isNullOrUndefined$2(e)?new this:(r=[],t?(n=0,a=bind$j(s,i>2?arguments[2]:void 0),iterate$r(e,(function(e){call$l(push$9,r,a(e,n++))}))):iterate$r(e,push$9,{that:r}),new this(r))},$$1n=_export,from$2=collectionFrom;$$1n({target:"Map",stat:!0,forced:!0},{from:from$2});var arraySlice$4=arraySlice$7,collectionOf=function(){return new this(arraySlice$4(arguments))},$$1m=_export,of$1=collectionOf;$$1m({target:"Map",stat:!0,forced:!0},{of:of$1});var tryToString$2=tryToString$8,aMap$e=function(e){if("object"==typeof e&&"size"in e&&"has"in e&&"get"in e&&"set"in e&&"delete"in e&&"entries"in e)return e;throw TypeError(tryToString$2(e)+" is not a map")},caller$2=function(e,t){return 1==t?function(t,r){return t[e](r)}:function(t,r,n){return t[e](r,n)}},getBuiltIn$7=getBuiltIn$j,caller$1=caller$2,Map$5=getBuiltIn$7("Map"),mapHelpers={Map:Map$5,set:caller$1("set",2),get:caller$1("get",1),has:caller$1("has",1),remove:caller$1("delete",1),proto:Map$5.prototype},$$1l=_export,aMap$d=aMap$e,remove$3=mapHelpers.remove;$$1l({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=aMap$d(this),r=!0,n=0,a=arguments.length;n<a;n++)e=remove$3(t,arguments[n]),r=r&&e;return!!r}});var $$1k=_export,aMap$c=aMap$e,MapHelpers$4=mapHelpers,get$1=MapHelpers$4.get,has$6=MapHelpers$4.has,set$c=MapHelpers$4.set;$$1k({target:"Map",proto:!0,real:!0,forced:!0},{emplace:function(e,t){var r,n,a=aMap$c(this);return has$6(a,e)?(r=get$1(a,e),"update"in t&&(r=t.update(r,e,a),set$c(a,e,r)),r):(n=t.insert(e,a),set$c(a,e,n),n)}});var call$k=functionCall,iterateSimple$8=function(e,t,r){for(var n,a,i=r||e.next;!(n=call$k(i,e)).done;)if(void 0!==(a=t(n.value)))return a},iterateSimple$7=iterateSimple$8,mapIterate=function(e,t,r){return r?iterateSimple$7(e.entries(),(function(e){return t(e[1],e[0])})):e.forEach(t)},$$1j=_export,bind$i=functionBindContext,aMap$b=aMap$e,iterate$q=mapIterate;$$1j({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=aMap$b(this),r=bind$i(e,arguments.length>1?arguments[1]:void 0);return!1!==iterate$q(t,(function(e,n){if(!r(e,n,t))return!1}),!0)}});var $$1i=_export,bind$h=functionBindContext,aMap$a=aMap$e,MapHelpers$3=mapHelpers,iterate$p=mapIterate,Map$4=MapHelpers$3.Map,set$b=MapHelpers$3.set;$$1i({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=aMap$a(this),r=bind$h(e,arguments.length>1?arguments[1]:void 0),n=new Map$4;return iterate$p(t,(function(e,a){r(e,a,t)&&set$b(n,a,e)})),n}});var $$1h=_export,bind$g=functionBindContext,aMap$9=aMap$e,iterate$o=mapIterate;$$1h({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=aMap$9(this),r=bind$g(e,arguments.length>1?arguments[1]:void 0),n=iterate$o(t,(function(e,n){if(r(e,n,t))return{value:e}}),!0);return n&&n.value}});var $$1g=_export,bind$f=functionBindContext,aMap$8=aMap$e,iterate$n=mapIterate;$$1g({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=aMap$8(this),r=bind$f(e,arguments.length>1?arguments[1]:void 0),n=iterate$n(t,(function(e,n){if(r(e,n,t))return{key:n}}),!0);return n&&n.key}});var $$1f=_export,call$j=functionCall,uncurryThis$h=functionUncurryThis,isCallable$9=isCallable$r,aCallable$e=aCallable$l,iterate$m=iterate$u,Map$3=mapHelpers.Map,push$8=uncurryThis$h([].push);$$1f({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){var r=new(isCallable$9(this)?this:Map$3);aCallable$e(t);var n=aCallable$e(r.has),a=aCallable$e(r.get),i=aCallable$e(r.set);return iterate$m(e,(function(e){var s=t(e);call$j(n,r,s)?push$8(call$j(a,r,s),e):call$j(i,r,s,[e])})),r}});var sameValueZero$1=function(e,t){return e===t||e!=e&&t!=t},$$1e=_export,sameValueZero=sameValueZero$1,aMap$7=aMap$e,iterate$l=mapIterate;$$1e({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return!0===iterate$l(aMap$7(this),(function(t){if(sameValueZero(t,e))return!0}),!0)}});var $$1d=_export,call$i=functionCall,iterate$k=iterate$u,isCallable$8=isCallable$r,aCallable$d=aCallable$l,Map$2=mapHelpers.Map;$$1d({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new(isCallable$8(this)?this:Map$2);aCallable$d(t);var n=aCallable$d(r.set);return iterate$k(e,(function(e){call$i(n,r,t(e),e)})),r}});var $$1c=_export,aMap$6=aMap$e,iterate$j=mapIterate;$$1c({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){var t=iterate$j(aMap$6(this),(function(t,r){if(t===e)return{key:r}}),!0);return t&&t.key}});var $$1b=_export,bind$e=functionBindContext,aMap$5=aMap$e,MapHelpers$2=mapHelpers,iterate$i=mapIterate,Map$1=MapHelpers$2.Map,set$a=MapHelpers$2.set;$$1b({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=aMap$5(this),r=bind$e(e,arguments.length>1?arguments[1]:void 0),n=new Map$1;return iterate$i(t,(function(e,a){set$a(n,r(e,a,t),e)})),n}});var $$1a=_export,bind$d=functionBindContext,aMap$4=aMap$e,MapHelpers$1=mapHelpers,iterate$h=mapIterate,Map=MapHelpers$1.Map,set$9=MapHelpers$1.set;$$1a({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=aMap$4(this),r=bind$d(e,arguments.length>1?arguments[1]:void 0),n=new Map;return iterate$h(t,(function(e,a){set$9(n,a,r(e,a,t))})),n}});var $$19=_export,aMap$3=aMap$e,iterate$g=iterate$u,set$8=mapHelpers.set;$$19({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=aMap$3(this),r=arguments.length,n=0;n<r;)iterate$g(arguments[n++],(function(e,r){set$8(t,e,r)}),{AS_ENTRIES:!0});return t}});var $$18=_export,aCallable$c=aCallable$l,aMap$2=aMap$e,iterate$f=mapIterate,$TypeError$9=TypeError;$$18({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=aMap$2(this),r=arguments.length<2,n=r?void 0:arguments[1];if(aCallable$c(e),iterate$f(t,(function(a,i){r?(r=!1,n=a):n=e(n,a,i,t)})),r)throw $TypeError$9("Reduce of empty map with no initial value");return n}});var $$17=_export,bind$c=functionBindContext,aMap$1=aMap$e,iterate$e=mapIterate;$$17({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=aMap$1(this),r=bind$c(e,arguments.length>1?arguments[1]:void 0);return!0===iterate$e(t,(function(e,n){if(r(e,n,t))return!0}),!0)}});var $$16=_export,aCallable$b=aCallable$l,aMap=aMap$e,MapHelpers=mapHelpers,$TypeError$8=TypeError,get=MapHelpers.get,has$5=MapHelpers.has,set$7=MapHelpers.set;$$16({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=aMap(this),n=arguments.length;aCallable$b(t);var a=has$5(r,e);if(!a&&n<3)throw $TypeError$8("Updating absent value");var i=a?get(r,e):aCallable$b(n>2?arguments[2]:void 0)(e,r);return set$7(r,e,t(i,e,r)),r}});var call$h=functionCall,aCallable$a=aCallable$l,isCallable$7=isCallable$r,anObject$6=anObject$i,$TypeError$7=TypeError,mapUpsert=function(e,t){var r,n=anObject$6(this),a=aCallable$a(n.get),i=aCallable$a(n.has),s=aCallable$a(n.set),o=arguments.length>2?arguments[2]:void 0;if(!isCallable$7(t)&&!isCallable$7(o))throw $TypeError$7("At least one callback required");return call$h(i,n,e)?(r=call$h(a,n,e),isCallable$7(t)&&(r=t(r),call$h(s,n,e,r))):isCallable$7(o)&&(r=o(),call$h(s,n,e,r)),r},$$15=_export,upsert$1=mapUpsert;$$15({target:"Map",proto:!0,real:!0,forced:!0},{upsert:upsert$1});var $$14=_export,upsert2=mapUpsert;$$14({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:upsert2});var parent$1J=map$a,map$9=parent$1J,map$8=map$9,_Map$1=getDefaultExportFromCjs(map$8),$$13=_export,DESCRIPTORS$5=descriptors,create$9=objectCreate;$$13({target:"Object",stat:!0,sham:!DESCRIPTORS$5},{create:create$9});var path$f=path$x,Object$1=path$f.Object,create$8=function(e,t){return Object$1.create(e,t)},parent$1I=create$8,create$7=parent$1I,parent$1H=create$7,create$6=parent$1H,parent$1G=create$6,create$5=parent$1G,create$4=create$5,_Object$create$1=getDefaultExportFromCjs(create$4);function _setPrototypeOf(e,t){var r;return(_setPrototypeOf=_Object$setPrototypeOf?_bindInstanceProperty$1(r=_Object$setPrototypeOf).call(r):function(e,t){return e.__proto__=t,e})(e,t)}var $$12=_export,uncurryThis$g=functionUncurryThisClause,$indexOf=arrayIncludes.indexOf,arrayMethodIsStrict$5=arrayMethodIsStrict$7,nativeIndexOf=uncurryThis$g([].indexOf),NEGATIVE_ZERO$1=!!nativeIndexOf&&1/nativeIndexOf([1],1,-0)<0,FORCED$6=NEGATIVE_ZERO$1||!arrayMethodIsStrict$5("indexOf");$$12({target:"Array",proto:!0,forced:FORCED$6},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return NEGATIVE_ZERO$1?nativeIndexOf(this,e,t)||0:$indexOf(this,e,t)}});var entryVirtual$h=entryVirtual$n,indexOf$6=entryVirtual$h("Array").indexOf,isPrototypeOf$j=objectIsPrototypeOf,method$f=indexOf$6,ArrayPrototype$d=Array.prototype,indexOf$5=function(e){var t=e.indexOf;return e===ArrayPrototype$d||isPrototypeOf$j(ArrayPrototype$d,e)&&t===ArrayPrototype$d.indexOf?method$f:t},parent$1F=indexOf$5,indexOf$4=parent$1F,parent$1E=indexOf$4,indexOf$3=parent$1E,parent$1D=indexOf$3,indexOf$2=parent$1D,indexOf$1=indexOf$2,_indexOfInstanceProperty$1=getDefaultExportFromCjs(indexOf$1);function _isNativeFunction(e){var t;return-1!==_indexOfInstanceProperty$1(t=Function.toString.call(e)).call(t,"[native code]")}var $$11=_export,getBuiltIn$6=getBuiltIn$j,apply$4=functionApply,bind$b=functionBind,aConstructor$1=aConstructor$3,anObject$5=anObject$i,isObject$7=isObject$m,create$3=objectCreate,fails$b=fails$A,nativeConstruct=getBuiltIn$6("Reflect","construct"),ObjectPrototype=Object.prototype,push$7=[].push,NEW_TARGET_BUG=fails$b((function(){function e(){}return!(nativeConstruct((function(){}),[],e)instanceof e)})),ARGS_BUG=!fails$b((function(){nativeConstruct((function(){}))})),FORCED$5=NEW_TARGET_BUG||ARGS_BUG;$$11({target:"Reflect",stat:!0,forced:FORCED$5,sham:FORCED$5},{construct:function(e,t){aConstructor$1(e),anObject$5(t);var r=arguments.length<3?e:aConstructor$1(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$4(push$7,n,t),new(apply$4(bind$b,e,n))}var a=r.prototype,i=create$3(isObject$7(a)?a:ObjectPrototype),s=apply$4(e,i,t);return isObject$7(s)?s:i}});var path$e=path$x,construct$4=path$e.Reflect.construct,parent$1C=construct$4,construct$3=parent$1C,parent$1B=construct$3,construct$2=parent$1B,parent$1A=construct$2,construct$1=parent$1A,construct2=construct$1,_Reflect$construct=getDefaultExportFromCjs(construct2);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){var n;_isNativeReflectConstruct()?_construct=_bindInstanceProperty$1(n=_Reflect$construct).call(n):_construct=function(e,t,r){var n=[null];_pushInstanceProperty(n).apply(n,t);var a=new(_bindInstanceProperty$1(Function).apply(e,n));return r&&_setPrototypeOf(a,r.prototype),a};return _construct.apply(null,arguments)}function _wrapNativeSuper(e){var t="function"==typeof _Map$1?new _Map$1: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$1(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(r,e)},_wrapNativeSuper(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$1(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),_Object$defineProperty$1(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}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 a=_getPrototypeOf(this).constructor;r=_Reflect$construct(n,arguments,a)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}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$1(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),_Object$defineProperty$1(e,"prototype",{writable:!1}),e}var keys3=keys$2,_Object$keys=getDefaultExportFromCjs(keys3),getOwnPropertySymbols2=getOwnPropertySymbols$1,_Object$getOwnPropertySymbols=getDefaultExportFromCjs(getOwnPropertySymbols2),filter3=filter$1,_filterInstanceProperty=getDefaultExportFromCjs(filter3),getOwnPropertyDescriptor$2=getOwnPropertyDescriptor$4,_Object$getOwnPropertyDescriptor=getDefaultExportFromCjs(getOwnPropertyDescriptor$2),forEach2=forEach$2,_forEachInstanceProperty=getDefaultExportFromCjs(forEach2),getOwnPropertyDescriptors2=getOwnPropertyDescriptors$1,_Object$getOwnPropertyDescriptors=getDefaultExportFromCjs(getOwnPropertyDescriptors2),defineProperties4=defineProperties$1,_Object$defineProperties=getDefaultExportFromCjs(defineProperties4),defineProperty$1=defineProperty$4,_Object$defineProperty=getDefaultExportFromCjs(defineProperty$1),symbol=symbol$1,_Symbol=getDefaultExportFromCjs(symbol),iterator=iterator$1,_Symbol$iterator=getDefaultExportFromCjs(iterator),isArray$1=isArray$3,_Array$isArray=getDefaultExportFromCjs(isArray$1),getIteratorMethod$1=getIteratorMethod$5,_getIteratorMethod=getDefaultExportFromCjs(getIteratorMethod$1),from$1=from$3,_Array$from=getDefaultExportFromCjs(from$1),slice2=slice$1,_sliceInstanceProperty=getDefaultExportFromCjs(slice2),toPrimitive=toPrimitive$1,_Symbol$toPrimitive=getDefaultExportFromCjs(toPrimitive),indexOf2=indexOf$1,_indexOfInstanceProperty=getDefaultExportFromCjs(indexOf2),entryVirtual$g=entryVirtual$n,concat$7=entryVirtual$g("Array").concat,isPrototypeOf$i=objectIsPrototypeOf,method$e=concat$7,ArrayPrototype$c=Array.prototype,concat$6=function(e){var t=e.concat;return e===ArrayPrototype$c||isPrototypeOf$i(ArrayPrototype$c,e)&&t===ArrayPrototype$c.concat?method$e:t},parent$1z=concat$6,concat$5=parent$1z,parent$1y=concat$5,concat$4=parent$1y,parent$1x=concat$4,concat$3=parent$1x,concat$2=concat$3,concat$1=concat$2,_concatInstanceProperty=getDefaultExportFromCjs(concat$1),$$10=_export,$some=arrayIteration.some,arrayMethodIsStrict$4=arrayMethodIsStrict$7,STRICT_METHOD$3=arrayMethodIsStrict$4("some");$$10({target:"Array",proto:!0,forced:!STRICT_METHOD$3},{some:function(e){return $some(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$f=entryVirtual$n,some$6=entryVirtual$f("Array").some,isPrototypeOf$h=objectIsPrototypeOf,method$d=some$6,ArrayPrototype$b=Array.prototype,some$5=function(e){var t=e.some;return e===ArrayPrototype$b||isPrototypeOf$h(ArrayPrototype$b,e)&&t===ArrayPrototype$b.some?method$d:t},parent$1w=some$5,some$4=parent$1w,parent$1v=some$4,some$3=parent$1v,parent$1u=some$3,some$2=parent$1u,some$1=some$2,some3=some$1,_someInstanceProperty=getDefaultExportFromCjs(some3),$$$=_export,$map=arrayIteration.map,arrayMethodHasSpeciesSupport$1=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT$1=arrayMethodHasSpeciesSupport$1("map");$$$({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$1},{map:function(e){return $map(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$e=entryVirtual$n,map$7=entryVirtual$e("Array").map,isPrototypeOf$g=objectIsPrototypeOf,method$c=map$7,ArrayPrototype$a=Array.prototype,map$6=function(e){var t=e.map;return e===ArrayPrototype$a||isPrototypeOf$g(ArrayPrototype$a,e)&&t===ArrayPrototype$a.map?method$c:t},parent$1t=map$6,map$5=parent$1t,parent$1s=map$5,map$4=parent$1s,parent$1r=map$4,map$3=parent$1r,map$2=map$3,map$1=map$2,_mapInstanceProperty=getDefaultExportFromCjs(map$1),toIntegerOrInfinity$3=toIntegerOrInfinity$7,toString$a=toString$g,requireObjectCoercible$4=requireObjectCoercible$8,$RangeError$1=RangeError,stringRepeat=function(e){var t=toString$a(requireObjectCoercible$4(this)),r="",n=toIntegerOrInfinity$3(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$1=toLength$3,toString$9=toString$g,$repeat=stringRepeat,requireObjectCoercible$3=requireObjectCoercible$8,repeat2=uncurryThis$f($repeat),stringSlice$3=uncurryThis$f("".slice),ceil=Math.ceil,createMethod$3=function(e){return function(t,r,n){var a,i,s=toString$9(requireObjectCoercible$3(t)),o=toLength$1(r),l=s.length,c=void 0===n?" ":toString$9(n);return o<=l||""==c?s:((i=repeat2(c,ceil((a=o-l)/c.length))).length>a&&(i=stringSlice$3(i,0,a)),e?s+i:i+s)}},stringPad={start:createMethod$3(!1),end:createMethod$3(!0)},userAgent$5=engineUserAgent,stringPadWebkitBug=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent$5),$$_=_export,$padStart=stringPad.start,WEBKIT_BUG=stringPadWebkitBug;$$_({target:"String",proto:!0,forced:WEBKIT_BUG},{padStart:function(e){return $padStart(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$d=entryVirtual$n,padStart$6=entryVirtual$d("String").padStart,isPrototypeOf$f=objectIsPrototypeOf,method$b=padStart$6,StringPrototype$3=String.prototype,padStart$5=function(e){var t=e.padStart;return"string"==typeof e||e===StringPrototype$3||isPrototypeOf$f(StringPrototype$3,e)&&t===StringPrototype$3.padStart?method$b:t},parent$1q=padStart$5,padStart$4=parent$1q,parent$1p=padStart$4,padStart$3=parent$1p,parent$1o=padStart$3,padStart$2=parent$1o,padStart$1=padStart$2,padStart2=padStart$1,_padStartInstanceProperty=getDefaultExportFromCjs(padStart2),engineIsBun="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,$TypeError$6=TypeError,validateArgumentsLength$5=function(e,t){if(e<t)throw $TypeError$6("Not enough arguments");return e},global$d=global$s,apply$3=functionApply,isCallable$6=isCallable$r,ENGINE_IS_BUN=engineIsBun,USER_AGENT=engineUserAgent,arraySlice$3=arraySlice$7,validateArgumentsLength$4=validateArgumentsLength$5,Function$2=global$d.Function,WRAP=/MSIE .\./.test(USER_AGENT)||ENGINE_IS_BUN&&function(){var e=global$d.Bun.version.split(".");return e.length<3||0==e[0]&&(e[1]<3||3==e[1]&&0==e[2])}(),schedulersFix$2=function(e,t){var r=t?2:1;return WRAP?function(n,a){var i=validateArgumentsLength$4(arguments.length,1)>r,s=isCallable$6(n)?n:Function$2(n),o=i?arraySlice$3(arguments,r):[],l=i?function(){apply$3(s,this,o)}:s;return t?e(l,a):e(l)}:e},$$Z=_export,global$c=global$s,schedulersFix$1=schedulersFix$2,setInterval$5=schedulersFix$1(global$c.setInterval,!0);$$Z({global:!0,bind:!0,forced:global$c.setInterval!==setInterval$5},{setInterval:setInterval$5});var $$Y=_export,global$b=global$s,schedulersFix=schedulersFix$2,setTimeout$6=schedulersFix(global$b.setTimeout,!0);$$Y({global:!0,bind:!0,forced:global$b.setTimeout!==setTimeout$6},{setTimeout:setTimeout$6});var path$d=path$x,setInterval$4=path$d.setInterval,parent$1n=setInterval$4,setInterval$3=parent$1n,parent$1m=setInterval$3,setInterval$2=parent$1m,setInterval$1=setInterval$2,setInterval=setInterval$1,_setInterval=getDefaultExportFromCjs(setInterval),bind$a=bind$m,_bindInstanceProperty=getDefaultExportFromCjs(bind$a),path$c=path$x,setTimeout$5=path$c.setTimeout,parent$1l=setTimeout$5,setTimeout$4=parent$1l,parent$1k=setTimeout$4,setTimeout$3=parent$1k,setTimeout$2=setTimeout$3,setTimeout$1=setTimeout$2,_setTimeout=getDefaultExportFromCjs(setTimeout$1),tryToString$1=tryToString$8,$TypeError$5=TypeError,deletePropertyOrThrow$2=function(e,t){if(!delete e[t])throw $TypeError$5("Cannot delete property "+tryToString$1(t)+" of "+tryToString$1(e))},$$X=_export,toObject$3=toObject$d,toAbsoluteIndex=toAbsoluteIndex$4,toIntegerOrInfinity$2=toIntegerOrInfinity$7,lengthOfArrayLike$3=lengthOfArrayLike$c,setArrayLength=arraySetLength,doesNotExceedSafeInteger=doesNotExceedSafeInteger$3,arraySpeciesCreate=arraySpeciesCreate$3,createProperty=createProperty$6,deletePropertyOrThrow$1=deletePropertyOrThrow$2,arrayMethodHasSpeciesSupport=arrayMethodHasSpeciesSupport$5,HAS_SPECIES_SUPPORT=arrayMethodHasSpeciesSupport("splice"),max$1=Math.max,min$2=Math.min;$$X({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT},{splice:function(e,t){var r,n,a,i,s,o,l=toObject$3(this),c=lengthOfArrayLike$3(l),u=toAbsoluteIndex(e,c),h=arguments.length;for(0===h?r=n=0:1===h?(r=0,n=c-u):(r=h-2,n=min$2(max$1(toIntegerOrInfinity$2(t),0),c-u)),doesNotExceedSafeInteger(c+r-n),a=arraySpeciesCreate(l,n),i=0;i<n;i++)(s=u+i)in l&&createProperty(a,i,l[s]);if(a.length=n,r<n){for(i=u;i<c-n;i++)o=i+r,(s=i+n)in l?l[o]=l[s]:deletePropertyOrThrow$1(l,o);for(i=c;i>c-n+r;i--)deletePropertyOrThrow$1(l,i-1)}else if(r>n)for(i=c-n;i>u;i--)o=i+r-1,(s=i+n-1)in l?l[o]=l[s]:deletePropertyOrThrow$1(l,o);for(i=0;i<r;i++)l[i+u]=arguments[i+2];return setArrayLength(l,c-n+r),a}});var entryVirtual$c=entryVirtual$n,splice$7=entryVirtual$c("Array").splice,isPrototypeOf$e=objectIsPrototypeOf,method$a=splice$7,ArrayPrototype$9=Array.prototype,splice$6=function(e){var t=e.splice;return e===ArrayPrototype$9||isPrototypeOf$e(ArrayPrototype$9,e)&&t===ArrayPrototype$9.splice?method$a:t},parent$1j=splice$6,splice$5=parent$1j,parent$1i=splice$5,splice$4=parent$1i,parent$1h=splice$4,splice$3=parent$1h,splice$2=splice$3,splice$1=splice$2,_spliceInstanceProperty=getDefaultExportFromCjs(splice$1),$$W=_export,$every=arrayIteration.every,arrayMethodIsStrict$3=arrayMethodIsStrict$7,STRICT_METHOD$2=arrayMethodIsStrict$3("every");$$W({target:"Array",proto:!0,forced:!STRICT_METHOD$2},{every:function(e){return $every(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$b=entryVirtual$n,every$6=entryVirtual$b("Array").every,isPrototypeOf$d=objectIsPrototypeOf,method$9=every$6,ArrayPrototype$8=Array.prototype,every$5=function(e){var t=e.every;return e===ArrayPrototype$8||isPrototypeOf$d(ArrayPrototype$8,e)&&t===ArrayPrototype$8.every?method$9:t},parent$1g=every$5,every$4=parent$1g,parent$1f=every$4,every$3=parent$1f,parent$1e=every$3,every$2=parent$1e,every$1=every$2,every3=every$1,_everyInstanceProperty=getDefaultExportFromCjs(every3),whitespaces$4="\t\n\v\f\r                 \u2028\u2029\ufeff",uncurryThis$e=functionUncurryThis,requireObjectCoercible$2=requireObjectCoercible$8,toString$8=toString$g,whitespaces$3=whitespaces$4,replace$4=uncurryThis$e("".replace),ltrim=RegExp("^["+whitespaces$3+"]+"),rtrim=RegExp("(^|[^"+whitespaces$3+"])["+whitespaces$3+"]+$"),createMethod$2=function(e){return function(t){var r=toString$8(requireObjectCoercible$2(t));return 1&e&&(r=replace$4(r,ltrim,"")),2&e&&(r=replace$4(r,rtrim,"$1")),r}},stringTrim={start:createMethod$2(1),end:createMethod$2(2),trim:createMethod$2(3)},global$a=global$s,fails$a=fails$A,uncurryThis$d=functionUncurryThis,toString$7=toString$g,trim$8=stringTrim.trim,whitespaces$2=whitespaces$4,charAt$2=uncurryThis$d("".charAt),$parseFloat$1=global$a.parseFloat,Symbol$2=global$a.Symbol,ITERATOR$4=Symbol$2&&Symbol$2.iterator,FORCED$4=1/$parseFloat$1(whitespaces$2+"-0")!=-1/0||ITERATOR$4&&!fails$a((function(){$parseFloat$1(Object(ITERATOR$4))})),numberParseFloat=FORCED$4?function(e){var t=trim$8(toString$7(e)),r=$parseFloat$1(t);return 0===r&&"-"==charAt$2(t,0)?-0:r}:$parseFloat$1,$$V=_export,$parseFloat=numberParseFloat;$$V({global:!0,forced:parseFloat!=numberParseFloat},{parseFloat:numberParseFloat});var path$b=path$x,_parseFloat$6=path$b.parseFloat,parent$1d=_parseFloat$6,_parseFloat$5=parent$1d,parent$1c=_parseFloat$5,_parseFloat$4=parent$1c,parent$1b=_parseFloat$4,_parseFloat$3=parent$1b,_parseFloat$2=_parseFloat$3,_parseFloat=_parseFloat$2,_parseFloat$1=getDefaultExportFromCjs(_parseFloat),PROPER_FUNCTION_NAME=functionName.PROPER,fails$9=fails$A,whitespaces$1=whitespaces$4,non="​…᠎",stringTrimForced=function(e){return fails$9((function(){return!!whitespaces$1[e]()||non[e]()!==non||PROPER_FUNCTION_NAME&&whitespaces$1[e].name!==e}))},$$U=_export,$trim=stringTrim.trim,forcedStringTrimMethod=stringTrimForced;$$U({target:"String",proto:!0,forced:forcedStringTrimMethod("trim")},{trim:function(){return $trim(this)}});var entryVirtual$a=entryVirtual$n,trim$7=entryVirtual$a("String").trim,isPrototypeOf$c=objectIsPrototypeOf,method$8=trim$7,StringPrototype$2=String.prototype,trim$6=function(e){var t=e.trim;return"string"==typeof e||e===StringPrototype$2||isPrototypeOf$c(StringPrototype$2,e)&&t===StringPrototype$2.trim?method$8:t},parent$1a=trim$6,trim$5=parent$1a,parent$19=trim$5,trim$4=parent$19,parent$18=trim$4,trim$3=parent$18,trim$2=trim$3,trim$1=trim$2,_trimInstanceProperty=getDefaultExportFromCjs(trim$1),global$9=global$s,fails$8=fails$A,uncurryThis$c=functionUncurryThis,toString$6=toString$g,trim2=stringTrim.trim,whitespaces=whitespaces$4,$parseInt$1=global$9.parseInt,Symbol$1=global$9.Symbol,ITERATOR$3=Symbol$1&&Symbol$1.iterator,hex=/^[+-]?0x/i,exec$2=uncurryThis$c(hex.exec),FORCED$3=8!==$parseInt$1(whitespaces+"08")||22!==$parseInt$1(whitespaces+"0x16")||ITERATOR$3&&!fails$8((function(){$parseInt$1(Object(ITERATOR$3))})),numberParseInt=FORCED$3?function(e,t){var r=trim2(toString$6(e));return $parseInt$1(r,t>>>0||(exec$2(hex,r)?16:10))}:$parseInt$1,$$T=_export,$parseInt=numberParseInt;$$T({global:!0,forced:parseInt!=numberParseInt},{parseInt:numberParseInt});var path$a=path$x,_parseInt$6=path$a.parseInt,parent$17=_parseInt$6,_parseInt$5=parent$17,parent$16=_parseInt$5,_parseInt$4=parent$16,parent$15=_parseInt$4,_parseInt$3=parent$15,_parseInt$2=_parseInt$3,_parseInt=_parseInt$2,_parseInt$1=getDefaultExportFromCjs(_parseInt),arraySlice$2=arraySliceSimple,floor$3=Math.floor,mergeSort=function(e,t){var r=e.length,n=floor$3(r/2);return r<8?insertionSort(e,t):merge2(e,mergeSort(arraySlice$2(e,0,n),t),mergeSort(arraySlice$2(e,n),t),t)},insertionSort=function(e,t){for(var r,n,a=e.length,i=1;i<a;){for(n=i,r=e[i];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==i++&&(e[n]=r)}return e},merge2=function(e,t,r,n){for(var a=t.length,i=r.length,s=0,o=0;s<a||o<i;)e[s+o]=s<a&&o<i?n(t[s],r[o])<=0?t[s++]:r[o++]:s<a?t[s++]:r[o++];return e},arraySort$1=mergeSort,userAgent$4=engineUserAgent,firefox=userAgent$4.match(/firefox\/(\d+)/i),engineFfVersion=!!firefox&&+firefox[1],UA=engineUserAgent,engineIsIeOrEdge=/MSIE|Trident/.test(UA),userAgent$3=engineUserAgent,webkit=userAgent$3.match(/AppleWebKit\/(\d+)\./),engineWebkitVersion=!!webkit&&+webkit[1],$$S=_export,uncurryThis$b=functionUncurryThis,aCallable$9=aCallable$l,toObject$2=toObject$d,lengthOfArrayLike$2=lengthOfArrayLike$c,deletePropertyOrThrow=deletePropertyOrThrow$2,toString$5=toString$g,fails$7=fails$A,internalSort=arraySort$1,arrayMethodIsStrict$2=arrayMethodIsStrict$7,FF=engineFfVersion,IE_OR_EDGE=engineIsIeOrEdge,V8=engineV8Version,WEBKIT=engineWebkitVersion,test$1=[],nativeSort=uncurryThis$b(test$1.sort),push$6=uncurryThis$b(test$1.push),FAILS_ON_UNDEFINED=fails$7((function(){test$1.sort(void 0)})),FAILS_ON_NULL=fails$7((function(){test$1.sort(null)})),STRICT_METHOD$1=arrayMethodIsStrict$2("sort"),STABLE_SORT=!fails$7((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,a="";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$1.push({k:t+n,v:r})}for(test$1.sort((function(e,t){return t.v-e.v})),n=0;n<test$1.length;n++)t=test$1[n].k.charAt(0),a.charAt(a.length-1)!==t&&(a+=t);return"DGBEFHACIJK"!==a}})),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$5(t)>toString$5(r)?1:-1}};$$S({target:"Array",proto:!0,forced:FORCED$2},{sort:function(e){void 0!==e&&aCallable$9(e);var t=toObject$2(this);if(STABLE_SORT)return void 0===e?nativeSort(t):nativeSort(t,e);var r,n,a=[],i=lengthOfArrayLike$2(t);for(n=0;n<i;n++)n in t&&push$6(a,t[n]);for(internalSort(a,getSortCompare(e)),r=lengthOfArrayLike$2(a),n=0;n<r;)t[n]=a[n++];for(;n<i;)deletePropertyOrThrow(t,n++);return t}});var entryVirtual$9=entryVirtual$n,sort$6=entryVirtual$9("Array").sort,isPrototypeOf$b=objectIsPrototypeOf,method$7=sort$6,ArrayPrototype$7=Array.prototype,sort$5=function(e){var t=e.sort;return e===ArrayPrototype$7||isPrototypeOf$b(ArrayPrototype$7,e)&&t===ArrayPrototype$7.sort?method$7:t},parent$14=sort$5,sort$4=parent$14,parent$13=sort$4,sort$3=parent$13,parent$12=sort$3,sort$2=parent$12,sort$1=sort$2,sort2=sort$1,_sortInstanceProperty=getDefaultExportFromCjs(sort2),global$8=global$s,globalIsFinite=global$8.isFinite,numberIsFinite$1=Number.isFinite||function(e){return"number"==typeof e&&globalIsFinite(e)},$$R=_export,numberIsFinite=numberIsFinite$1;$$R({target:"Number",stat:!0},{isFinite:numberIsFinite});var path$9=path$x,_isFinite$5=path$9.Number.isFinite,parent$11=_isFinite$5,_isFinite$4=parent$11,parent$10=_isFinite$4,_isFinite$3=parent$10,parent$$=_isFinite$3,_isFinite$2=parent$$,_isFinite$1=_isFinite$2,_isFinite=_isFinite$1,_Number$isFinite=getDefaultExportFromCjs(_isFinite),isObject$6=isObject$m,floor$2=Math.floor,isIntegralNumber$2=Number.isInteger||function(e){return!isObject$6(e)&&isFinite(e)&&floor$2(e)===e},$$Q=_export,isIntegralNumber$1=isIntegralNumber$2,abs=Math.abs;$$Q({target:"Number",stat:!0},{isSafeInteger:function(e){return isIntegralNumber$1(e)&&abs(e)<=9007199254740991}});var path$8=path$x,isSafeInteger$5=path$8.Number.isSafeInteger,parent$_=isSafeInteger$5,isSafeInteger$4=parent$_,parent$Z=isSafeInteger$4,isSafeInteger$3=parent$Z,parent$Y=isSafeInteger$3,isSafeInteger$2=parent$Y,isSafeInteger$1=isSafeInteger$2,isSafeInteger2=isSafeInteger$1,_Number$isSafeInteger=getDefaultExportFromCjs(isSafeInteger2),$$P=_export;$$P({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991});var maxSafeInteger$5=9007199254740991,parent$X=maxSafeInteger$5,maxSafeInteger$4=parent$X,parent$W=maxSafeInteger$4,maxSafeInteger$3=parent$W,parent$V=maxSafeInteger$3,maxSafeInteger$2=parent$V,maxSafeInteger$1=maxSafeInteger$2,maxSafeInteger=maxSafeInteger$1,_Number$MAX_SAFE_INTEGER=getDefaultExportFromCjs(maxSafeInteger),DESCRIPTORS$4=descriptors,uncurryThis$a=functionUncurryThis,call$g=functionCall,fails$6=fails$A,objectKeys$1=objectKeys$4,getOwnPropertySymbolsModule=objectGetOwnPropertySymbols,propertyIsEnumerableModule=objectPropertyIsEnumerable,toObject$1=toObject$d,IndexedObject$1=indexedObject,$assign=Object.assign,defineProperty5=Object.defineProperty,concat2=uncurryThis$a([].concat),objectAssign=!$assign||fails$6((function(){if(DESCRIPTORS$4&&1!==$assign({b:1},$assign(defineProperty5({},"a",{enumerable:!0,get:function(){defineProperty5(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$1($assign({},t)).join("")!=n}))?function(e,t){for(var r=toObject$1(e),n=arguments.length,a=1,i=getOwnPropertySymbolsModule.f,s=propertyIsEnumerableModule.f;n>a;)for(var o,l=IndexedObject$1(arguments[a++]),c=i?concat2(objectKeys$1(l),i(l)):objectKeys$1(l),u=c.length,h=0;u>h;)o=c[h++],DESCRIPTORS$4&&!call$g(s,l,o)||(r[o]=l[o]);return r}:$assign,$$O=_export,assign$7=objectAssign;$$O({target:"Object",stat:!0,arity:2,forced:Object.assign!==assign$7},{assign:assign$7});var path$7=path$x,assign$6=path$7.Object.assign,parent$U=assign$6,assign$5=parent$U,parent$T=assign$5,assign$4=parent$T,parent$S=assign$4,assign$3=parent$S,assign$2=assign$3,assign$1=assign$2,_Object$assign=getDefaultExportFromCjs(assign$1),aCallable$8=aCallable$l,toObject=toObject$d,IndexedObject=indexedObject,lengthOfArrayLike$1=lengthOfArrayLike$c,$TypeError$4=TypeError,createMethod$1=function(e){return function(t,r,n,a){aCallable$8(r);var i=toObject(t),s=IndexedObject(i),o=lengthOfArrayLike$1(i),l=e?o-1:0,c=e?-1:1;if(n<2)for(;;){if(l in s){a=s[l],l+=c;break}if(l+=c,e?l<0:o<=l)throw $TypeError$4("Reduce of empty array with no initial value")}for(;e?l>=0:o>l;l+=c)l in s&&(a=r(a,s[l],l,i));return a}},arrayReduce={left:createMethod$1(!1),right:createMethod$1(!0)},classof$5=classofRaw$2,engineIsNode="undefined"!=typeof process&&"process"==classof$5(process),$$N=_export,$reduce=arrayReduce.left,arrayMethodIsStrict$1=arrayMethodIsStrict$7,CHROME_VERSION=engineV8Version,IS_NODE$4=engineIsNode,CHROME_BUG=!IS_NODE$4&&engineV8Version>79&&engineV8Version<83,FORCED$1=CHROME_BUG||!arrayMethodIsStrict$1("reduce");$$N({target:"Array",proto:!0,forced:FORCED$1},{reduce:function(e){var t=arguments.length;return $reduce(this,e,t,t>1?arguments[1]:void 0)}});var entryVirtual$8=entryVirtual$n,reduce$6=entryVirtual$8("Array").reduce,isPrototypeOf$a=objectIsPrototypeOf,method$6=reduce$6,ArrayPrototype$6=Array.prototype,reduce$5=function(e){var t=e.reduce;return e===ArrayPrototype$6||isPrototypeOf$a(ArrayPrototype$6,e)&&t===ArrayPrototype$6.reduce?method$6:t},parent$R=reduce$5,reduce$4=parent$R,parent$Q=reduce$4,reduce$3=parent$Q,parent$P=reduce$3,reduce$2=parent$P,reduce$1=reduce$2,reduce3=reduce$1,_reduceInstanceProperty=getDefaultExportFromCjs(reduce3),isObject$5=isObject$m,classof$4=classofRaw$2,wellKnownSymbol$7=wellKnownSymbol$r,MATCH$1=wellKnownSymbol$7("match"),isRegexp=function(e){var t;return isObject$5(e)&&(void 0!==(t=e[MATCH$1])?!!t:"RegExp"==classof$4(e))},isRegExp=isRegexp,$TypeError$3=TypeError,notARegexp=function(e){if(isRegExp(e))throw $TypeError$3("The method doesn't accept regular expressions");return e},wellKnownSymbol$6=wellKnownSymbol$r,MATCH=wellKnownSymbol$6("match"),correctIsRegexpLogic=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[MATCH]=!1,"/./"[e](t)}catch(e){}}return!1},$$M=_export,uncurryThis$9=functionUncurryThisClause;objectGetOwnPropertyDescriptor.f;var toLength=toLength$3,toString$4=toString$g,notARegExp$1=notARegexp,requireObjectCoercible$1=requireObjectCoercible$8,correctIsRegExpLogic$1=correctIsRegexpLogic,nativeStartsWith=uncurryThis$9("".startsWith),stringSlice$2=uncurryThis$9("".slice),min$1=Math.min,CORRECT_IS_REGEXP_LOGIC=correctIsRegExpLogic$1("startsWith");$$M({target:"String",proto:!0,forced:!CORRECT_IS_REGEXP_LOGIC},{startsWith:function(e){var t=toString$4(requireObjectCoercible$1(this));notARegExp$1(e);var r=toLength(min$1(arguments.length>1?arguments[1]:void 0,t.length)),n=toString$4(e);return nativeStartsWith?nativeStartsWith(t,n,r):stringSlice$2(t,r,r+n.length)===n}});var entryVirtual$7=entryVirtual$n,startsWith$6=entryVirtual$7("String").startsWith,isPrototypeOf$9=objectIsPrototypeOf,method$5=startsWith$6,StringPrototype$1=String.prototype,startsWith$5=function(e){var t=e.startsWith;return"string"==typeof e||e===StringPrototype$1||isPrototypeOf$9(StringPrototype$1,e)&&t===StringPrototype$1.startsWith?method$5:t},parent$O=startsWith$5,startsWith$4=parent$O,parent$N=startsWith$4,startsWith$3=parent$N,parent$M=startsWith$3,startsWith$2=parent$M,startsWith$1=startsWith$2,startsWith2=startsWith$1,_startsWithInstanceProperty=getDefaultExportFromCjs(startsWith2),hasOwn$7=hasOwnProperty_1,ownKeys2=ownKeys$3,getOwnPropertyDescriptorModule=objectGetOwnPropertyDescriptor,definePropertyModule=objectDefineProperty,copyConstructorProperties$1=function(e,t,r){for(var n=ownKeys2(t),a=definePropertyModule.f,i=getOwnPropertyDescriptorModule.f,s=0;s<n.length;s++){var o=n[s];hasOwn$7(e,o)||r&&hasOwn$7(r,o)||a(e,o,i(t,o))}},isObject$4=isObject$m,createNonEnumerableProperty$2=createNonEnumerableProperty$9,installErrorCause$1=function(e,t){isObject$4(t)&&"cause"in t&&createNonEnumerableProperty$2(e,"cause",t.cause)},uncurryThis$8=functionUncurryThis,$Error$1=Error,replace$3=uncurryThis$8("".replace),TEST=String($Error$1("zxcasd").stack),V8_OR_CHAKRA_STACK_ENTRY=/\n\s*at [^:]*:[^\n]*/,IS_V8_OR_CHAKRA_STACK=V8_OR_CHAKRA_STACK_ENTRY.test(TEST),errorStackClear=function(e,t){if(IS_V8_OR_CHAKRA_STACK&&"string"==typeof e&&!$Error$1.prepareStackTrace)for(;t--;)e=replace$3(e,V8_OR_CHAKRA_STACK_ENTRY,"");return e},fails$5=fails$A,createPropertyDescriptor$2=createPropertyDescriptor$8,errorStackInstallable=!fails$5((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",createPropertyDescriptor$2(1,7)),7!==e.stack)})),createNonEnumerableProperty$1=createNonEnumerableProperty$9,clearErrorStack=errorStackClear,ERROR_STACK_INSTALLABLE=errorStackInstallable,captureStackTrace=Error.captureStackTrace,errorStackInstall=function(e,t,r,n){ERROR_STACK_INSTALLABLE&&(captureStackTrace?captureStackTrace(e,t):createNonEnumerableProperty$1(e,"stack",clearErrorStack(r,n)))},toString$3=toString$g,normalizeStringArgument$1=function(e,t){return void 0===e?arguments.length<2?"":t:toString$3(e)},$$L=_export,isPrototypeOf$8=objectIsPrototypeOf,getPrototypeOf2=objectGetPrototypeOf,setPrototypeOf=objectSetPrototypeOf,copyConstructorProperties=copyConstructorProperties$1,create$2=objectCreate,createNonEnumerableProperty=createNonEnumerableProperty$9,createPropertyDescriptor$1=createPropertyDescriptor$8,installErrorCause=installErrorCause$1,installErrorStack=errorStackInstall,iterate$d=iterate$u,normalizeStringArgument=normalizeStringArgument$1,wellKnownSymbol$5=wellKnownSymbol$r,TO_STRING_TAG=wellKnownSymbol$5("toStringTag"),$Error=Error,push$5=[].push,$AggregateError=function(e,t){var r,n=isPrototypeOf$8(AggregateErrorPrototype,this);setPrototypeOf?r=setPrototypeOf($Error(),n?getPrototypeOf2(this):AggregateErrorPrototype):(r=n?this:create$2(AggregateErrorPrototype),createNonEnumerableProperty(r,TO_STRING_TAG,"Error")),void 0!==t&&createNonEnumerableProperty(r,"message",normalizeStringArgument(t)),installErrorStack(r,$AggregateError,r.stack,1),arguments.length>2&&installErrorCause(r,arguments[2]);var a=[];return iterate$d(e,push$5,{that:a}),createNonEnumerableProperty(r,"errors",a),r};setPrototypeOf?setPrototypeOf($AggregateError,$Error):copyConstructorProperties($AggregateError,$Error,{name:!0});var AggregateErrorPrototype=$AggregateError.prototype=create$2($Error.prototype,{constructor:createPropertyDescriptor$1(1,$AggregateError),message:createPropertyDescriptor$1(1,""),name:createPropertyDescriptor$1(1,"AggregateError")});$$L({global:!0,constructor:!0,arity:2},{AggregateError:$AggregateError});var $location,defer,channel,port,anObject$4=anObject$i,aConstructor=aConstructor$3,isNullOrUndefined$1=isNullOrUndefined$7,wellKnownSymbol$4=wellKnownSymbol$r,SPECIES$1=wellKnownSymbol$4("species"),speciesConstructor$2=function(e,t){var r,n=anObject$4(e).constructor;return void 0===n||isNullOrUndefined$1(r=anObject$4(n)[SPECIES$1])?t:aConstructor(r)},userAgent$2=engineUserAgent,engineIsIos=/(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2),global$7=global$s,apply$2=functionApply,bind$9=functionBindContext,isCallable$5=isCallable$r,hasOwn$6=hasOwnProperty_1,fails$4=fails$A,html=html$2,arraySlice$1=arraySlice$7,createElement=documentCreateElement$1,validateArgumentsLength$3=validateArgumentsLength$5,IS_IOS$1=engineIsIos,IS_NODE$3=engineIsNode,set$6=global$7.setImmediate,clear=global$7.clearImmediate,process$3=global$7.process,Dispatch=global$7.Dispatch,Function$1=global$7.Function,MessageChannel=global$7.MessageChannel,String$1=global$7.String,counter=0,queue$2={},ONREADYSTATECHANGE="onreadystatechange";fails$4((function(){$location=global$7.location}));var run=function(e){if(hasOwn$6(queue$2,e)){var t=queue$2[e];delete queue$2[e],t()}},runner=function(e){return function(){run(e)}},eventListener=function(e){run(e.data)},globalPostMessageDefer=function(e){global$7.postMessage(String$1(e),$location.protocol+"//"+$location.host)};set$6&&clear||(set$6=function(e){validateArgumentsLength$3(arguments.length,1);var t=isCallable$5(e)?e:Function$1(e),r=arraySlice$1(arguments,1);return queue$2[++counter]=function(){apply$2(t,void 0,r)},defer(counter),counter},clear=function(e){delete queue$2[e]},IS_NODE$3?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=eventListener,defer=bind$9(port.postMessage,port)):global$7.addEventListener&&isCallable$5(global$7.postMessage)&&!global$7.importScripts&&$location&&"file:"!==$location.protocol&&!fails$4(globalPostMessageDefer)?(defer=globalPostMessageDefer,global$7.addEventListener("message",eventListener,!1)):defer=ONREADYSTATECHANGE in createElement("script")?function(e){html.appendChild(createElement("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this),run(e)}}:function(e){setTimeout(runner(e),0)});var task$1={set:set$6,clear:clear},Queue$2=function(){this.head=null,this.tail=null};Queue$2.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var notify$1,toggle,node,promise$6,then,queue$1=Queue$2,userAgent$1=engineUserAgent,engineIsIosPebble=/ipad|iphone|ipod/i.test(userAgent$1)&&"undefined"!=typeof Pebble,userAgent=engineUserAgent,engineIsWebosWebkit=/web0s(?!.*chrome)/i.test(userAgent),global$6=global$s,bind$8=functionBindContext,getOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,macrotask=task$1.set,Queue$1=queue$1,IS_IOS=engineIsIos,IS_IOS_PEBBLE=engineIsIosPebble,IS_WEBOS_WEBKIT=engineIsWebosWebkit,IS_NODE$2=engineIsNode,MutationObserver=global$6.MutationObserver||global$6.WebKitMutationObserver,document$2=global$6.document,process$2=global$6.process,Promise$1=global$6.Promise,queueMicrotaskDescriptor=getOwnPropertyDescriptor$1(global$6,"queueMicrotask"),microtask$1=queueMicrotaskDescriptor&&queueMicrotaskDescriptor.value;if(!microtask$1){var queue=new Queue$1,flush=function(){var e,t;for(IS_NODE$2&&(e=process$2.domain)&&e.exit();t=queue.get();)try{t()}catch(e){throw queue.head&&notify$1(),e}e&&e.enter()};IS_IOS||IS_NODE$2||IS_WEBOS_WEBKIT||!MutationObserver||!document$2?!IS_IOS_PEBBLE&&Promise$1&&Promise$1.resolve?((promise$6=Promise$1.resolve(void 0)).constructor=Promise$1,then=bind$8(promise$6.then,promise$6),notify$1=function(){then(flush)}):IS_NODE$2?notify$1=function(){process$2.nextTick(flush)}:(macrotask=bind$8(macrotask,global$6),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}),microtask$1=function(e){queue.head||notify$1(),queue.add(e)}}var microtask_1=microtask$1,hostReportErrors$1=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},perform$6=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},global$5=global$s,promiseNativeConstructor=global$5.Promise,engineIsDeno="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,IS_DENO$1=engineIsDeno,IS_NODE$1=engineIsNode,engineIsBrowser=!IS_DENO$1&&!IS_NODE$1&&"object"==typeof window&&"object"==typeof document,global$4=global$s,NativePromiseConstructor$5=promiseNativeConstructor,isCallable$4=isCallable$r,isForced=isForced_1,inspectSource=inspectSource$2,wellKnownSymbol$3=wellKnownSymbol$r,IS_BROWSER=engineIsBrowser,IS_DENO=engineIsDeno,V8_VERSION=engineV8Version,NativePromisePrototype$2=NativePromiseConstructor$5&&NativePromiseConstructor$5.prototype,SPECIES=wellKnownSymbol$3("species"),SUBCLASSING=!1,NATIVE_PROMISE_REJECTION_EVENT$1=isCallable$4(global$4.PromiseRejectionEvent),FORCED_PROMISE_CONSTRUCTOR$5=isForced("Promise",(function(){var e=inspectSource(NativePromiseConstructor$5),t=e!==String(NativePromiseConstructor$5);if(!t&&66===V8_VERSION)return!0;if(!NativePromisePrototype$2.catch||!NativePromisePrototype$2.finally)return!0;if(!V8_VERSION||V8_VERSION<51||!/native code/.test(e)){var r=new NativePromiseConstructor$5((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[SPECIES]=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$7=aCallable$l,$TypeError$2=TypeError,PromiseCapability=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw $TypeError$2("Bad Promise constructor");t=e,r=n})),this.resolve=aCallable$7(t),this.reject=aCallable$7(r)};newPromiseCapability$2.f=function(e){return new PromiseCapability(e)};var $$K=_export,IS_NODE=engineIsNode,global$3=global$s,call$f=functionCall,defineBuiltIn$2=defineBuiltIn$8,setToStringTag$2=setToStringTag$9,setSpecies=setSpecies$2,aCallable$6=aCallable$l,isCallable$3=isCallable$r,isObject$3=isObject$m,anInstance$2=anInstance$5,speciesConstructor$1=speciesConstructor$2,task=task$1.set,microtask=microtask_1,hostReportErrors=hostReportErrors$1,perform$5=perform$6,Queue=queue$1,InternalStateModule$2=internalState,NativePromiseConstructor$4=promiseNativeConstructor,PromiseConstructorDetection=promiseConstructorDetection,newPromiseCapabilityModule$6=newPromiseCapability$2,PROMISE="Promise",FORCED_PROMISE_CONSTRUCTOR$4=PromiseConstructorDetection.CONSTRUCTOR,NATIVE_PROMISE_REJECTION_EVENT=PromiseConstructorDetection.REJECTION_EVENT;PromiseConstructorDetection.SUBCLASSING;var Internal,OwnPromiseCapability,PromiseWrapper,getInternalPromiseState=InternalStateModule$2.getterFor(PROMISE),setInternalState$2=InternalStateModule$2.set,NativePromisePrototype$1=NativePromiseConstructor$4&&NativePromiseConstructor$4.prototype,PromiseConstructor=NativePromiseConstructor$4,PromisePrototype=NativePromisePrototype$1,TypeError$3=global$3.TypeError,document$1=global$3.document,process$1=global$3.process,newPromiseCapability$1=newPromiseCapabilityModule$6.f,newGenericPromiseCapability=newPromiseCapability$1,DISPATCH_EVENT=!!(document$1&&document$1.createEvent&&global$3.dispatchEvent),UNHANDLED_REJECTION="unhandledrejection",REJECTION_HANDLED="rejectionhandled",PENDING=0,FULFILLED=1,REJECTED=2,HANDLED=1,UNHANDLED=2,isThenable=function(e){var t;return!(!isObject$3(e)||!isCallable$3(t=e.then))&&t},callReaction=function(e,t){var r,n,a,i=t.value,s=t.state==FULFILLED,o=s?e.ok:e.fail,l=e.resolve,c=e.reject,u=e.domain;try{o?(s||(t.rejection===UNHANDLED&&onHandleUnhandled(t),t.rejection=HANDLED),!0===o?r=i:(u&&u.enter(),r=o(i),u&&(u.exit(),a=!0)),r===e.promise?c(TypeError$3("Promise-chain cycle")):(n=isThenable(r))?call$f(n,r,l,c):l(r)):c(i)}catch(e){u&&!a&&u.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,a;DISPATCH_EVENT?((n=document$1.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),global$3.dispatchEvent(n)):n={promise:t,reason:r},!NATIVE_PROMISE_REJECTION_EVENT&&(a=global$3["on"+e])?a(n):e===UNHANDLED_REJECTION&&hostReportErrors("Unhandled promise rejection",r)},onUnhandled=function(e){call$f(task,global$3,(function(){var t,r=e.facade,n=e.value;if(isUnhandled(e)&&(t=perform$5((function(){IS_NODE?process$1.emit("unhandledRejection",n,r):dispatchEvent(UNHANDLED_REJECTION,r,n)})),e.rejection=IS_NODE||isUnhandled(e)?UNHANDLED:HANDLED,t.error))throw t.value}))},isUnhandled=function(e){return e.rejection!==HANDLED&&!e.parent},onHandleUnhandled=function(e){call$f(task,global$3,(function(){var t=e.facade;IS_NODE?process$1.emit("rejectionHandled",t):dispatchEvent(REJECTION_HANDLED,t,e.value)}))},bind$7=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$3("Promise can't be resolved itself");var n=isThenable(t);n?microtask((function(){var r={done:!1};try{call$f(n,t,bind$7(internalResolve,r,e),bind$7(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)}}};FORCED_PROMISE_CONSTRUCTOR$4&&(PromisePrototype=(PromiseConstructor=function(e){anInstance$2(this,PromisePrototype),aCallable$6(e),call$f(Internal,this);var t=getInternalPromiseState(this);try{e(bind$7(internalResolve,t),bind$7(internalReject,t))}catch(e){internalReject(t,e)}}).prototype,(Internal=function(e){setInternalState$2(this,{type:PROMISE,done:!1,notified:!1,parent:!1,reactions:new Queue,rejection:!1,state:PENDING,value:void 0})}).prototype=defineBuiltIn$2(PromisePrototype,"then",(function(e,t){var r=getInternalPromiseState(this),n=newPromiseCapability$1(speciesConstructor$1(this,PromiseConstructor));return r.parent=!0,n.ok=!isCallable$3(e)||e,n.fail=isCallable$3(t)&&t,n.domain=IS_NODE?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$7(internalResolve,t),this.reject=bind$7(internalReject,t)},newPromiseCapabilityModule$6.f=newPromiseCapability$1=function(e){return e===PromiseConstructor||e===PromiseWrapper?new OwnPromiseCapability(e):newGenericPromiseCapability(e)}),$$K({global:!0,constructor:!0,wrap:!0,forced:FORCED_PROMISE_CONSTRUCTOR$4},{Promise:PromiseConstructor}),setToStringTag$2(PromiseConstructor,PROMISE,!1,!0),setSpecies(PROMISE);var NativePromiseConstructor$3=promiseNativeConstructor,checkCorrectnessOfIteration=checkCorrectnessOfIteration$2,FORCED_PROMISE_CONSTRUCTOR$3=promiseConstructorDetection.CONSTRUCTOR,promiseStaticsIncorrectIteration=FORCED_PROMISE_CONSTRUCTOR$3||!checkCorrectnessOfIteration((function(e){NativePromiseConstructor$3.all(e).then(void 0,(function(){}))})),$$J=_export,call$e=functionCall,aCallable$5=aCallable$l,newPromiseCapabilityModule$5=newPromiseCapability$2,perform$4=perform$6,iterate$c=iterate$u,PROMISE_STATICS_INCORRECT_ITERATION$3=promiseStaticsIncorrectIteration;$$J({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION$3},{all:function(e){var t=this,r=newPromiseCapabilityModule$5.f(t),n=r.resolve,a=r.reject,i=perform$4((function(){var r=aCallable$5(t.resolve),i=[],s=0,o=1;iterate$c(e,(function(e){var l=s++,c=!1;o++,call$e(r,t,e).then((function(e){c||(c=!0,i[l]=e,--o||n(i))}),a)})),--o||n(i)}));return i.error&&a(i.value),r.promise}});var $$I=_export,FORCED_PROMISE_CONSTRUCTOR$2=promiseConstructorDetection.CONSTRUCTOR,NativePromiseConstructor$2=promiseNativeConstructor;promiseNativeConstructor&&promiseNativeConstructor.prototype,$$I({target:"Promise",proto:!0,forced:FORCED_PROMISE_CONSTRUCTOR$2,real:!0},{catch:function(e){return this.then(void 0,e)}});var $$H=_export,call$d=functionCall,aCallable$4=aCallable$l,newPromiseCapabilityModule$4=newPromiseCapability$2,perform$3=perform$6,iterate$b=iterate$u,PROMISE_STATICS_INCORRECT_ITERATION$2=promiseStaticsIncorrectIteration;$$H({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION$2},{race:function(e){var t=this,r=newPromiseCapabilityModule$4.f(t),n=r.reject,a=perform$3((function(){var a=aCallable$4(t.resolve);iterate$b(e,(function(e){call$d(a,t,e).then(r.resolve,n)}))}));return a.error&&n(a.value),r.promise}});var $$G=_export,call$c=functionCall,newPromiseCapabilityModule$3=newPromiseCapability$2,FORCED_PROMISE_CONSTRUCTOR$1=promiseConstructorDetection.CONSTRUCTOR;$$G({target:"Promise",stat:!0,forced:FORCED_PROMISE_CONSTRUCTOR$1},{reject:function(e){var t=newPromiseCapabilityModule$3.f(this);return call$c(t.reject,void 0,e),t.promise}});var anObject$3=anObject$i,isObject$2=isObject$m,newPromiseCapability=newPromiseCapability$2,promiseResolve$2=function(e,t){if(anObject$3(e),isObject$2(t)&&t.constructor===e)return t;var r=newPromiseCapability.f(e);return(0,r.resolve)(t),r.promise},$$F=_export,getBuiltIn$5=getBuiltIn$j,IS_PURE$1=isPure,NativePromiseConstructor$1=promiseNativeConstructor,FORCED_PROMISE_CONSTRUCTOR=promiseConstructorDetection.CONSTRUCTOR,promiseResolve$1=promiseResolve$2,PromiseConstructorWrapper=getBuiltIn$5("Promise"),CHECK_WRAPPER=!FORCED_PROMISE_CONSTRUCTOR;$$F({target:"Promise",stat:!0,forced:IS_PURE$1},{resolve:function(e){return promiseResolve$1(CHECK_WRAPPER&&this===PromiseConstructorWrapper?NativePromiseConstructor$1:this,e)}});var $$E=_export,call$b=functionCall,aCallable$3=aCallable$l,newPromiseCapabilityModule$2=newPromiseCapability$2,perform$2=perform$6,iterate$a=iterate$u,PROMISE_STATICS_INCORRECT_ITERATION$1=promiseStaticsIncorrectIteration;$$E({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION$1},{allSettled:function(e){var t=this,r=newPromiseCapabilityModule$2.f(t),n=r.resolve,a=r.reject,i=perform$2((function(){var r=aCallable$3(t.resolve),a=[],i=0,s=1;iterate$a(e,(function(e){var o=i++,l=!1;s++,call$b(r,t,e).then((function(e){l||(l=!0,a[o]={status:"fulfilled",value:e},--s||n(a))}),(function(e){l||(l=!0,a[o]={status:"rejected",reason:e},--s||n(a))}))})),--s||n(a)}));return i.error&&a(i.value),r.promise}});var $$D=_export,call$a=functionCall,aCallable$2=aCallable$l,getBuiltIn$4=getBuiltIn$j,newPromiseCapabilityModule$1=newPromiseCapability$2,perform$1=perform$6,iterate$9=iterate$u,PROMISE_STATICS_INCORRECT_ITERATION=promiseStaticsIncorrectIteration,PROMISE_ANY_ERROR="No one promise resolved";$$D({target:"Promise",stat:!0,forced:PROMISE_STATICS_INCORRECT_ITERATION},{any:function(e){var t=this,r=getBuiltIn$4("AggregateError"),n=newPromiseCapabilityModule$1.f(t),a=n.resolve,i=n.reject,s=perform$1((function(){var n=aCallable$2(t.resolve),s=[],o=0,l=1,c=!1;iterate$9(e,(function(e){var u=o++,h=!1;l++,call$a(n,t,e).then((function(e){h||c||(c=!0,a(e))}),(function(e){h||c||(h=!0,s[u]=e,--l||i(new r(s,PROMISE_ANY_ERROR)))}))})),--l||i(new r(s,PROMISE_ANY_ERROR))}));return s.error&&i(s.value),n.promise}});var $$C=_export,NativePromiseConstructor=promiseNativeConstructor,fails$3=fails$A,getBuiltIn$3=getBuiltIn$j,isCallable$2=isCallable$r,speciesConstructor=speciesConstructor$2,promiseResolve=promiseResolve$2,NativePromisePrototype=NativePromiseConstructor&&NativePromiseConstructor.prototype,NON_GENERIC=!!NativePromiseConstructor&&fails$3((function(){NativePromisePrototype.finally.call({then:function(){}},(function(){}))}));$$C({target:"Promise",proto:!0,real:!0,forced:NON_GENERIC},{finally:function(e){var t=speciesConstructor(this,getBuiltIn$3("Promise")),r=isCallable$2(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)}});var path$6=path$x,promise$5=path$6.Promise,parent$L=promise$5,promise$4=parent$L,parent$K=promise$4,promise$3=parent$K,$$B=_export,newPromiseCapabilityModule=newPromiseCapability$2,perform=perform$6;$$B({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=newPromiseCapabilityModule.f(this),r=perform(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var parent$J=promise$3,promise$2=parent$J,promise$1=promise$2,promise=promise$1,_Promise=getDefaultExportFromCjs(promise),fails$2=fails$A,wellKnownSymbol$2=wellKnownSymbol$r,DESCRIPTORS$3=descriptors,IS_PURE=isPure,ITERATOR$2=wellKnownSymbol$2("iterator"),urlConstructorDetection=!fails$2((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.size&&(IS_PURE||!DESCRIPTORS$3)||!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$2]||"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})),uncurryThis$7=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=RangeError,exec$1=uncurryThis$7(regexSeparators.exec),floor$1=Math.floor,fromCharCode=String.fromCharCode,charCodeAt=uncurryThis$7("".charCodeAt),join$2=uncurryThis$7([].join),push$4=uncurryThis$7([].push),replace$2=uncurryThis$7("".replace),split$2=uncurryThis$7("".split),toLowerCase$1=uncurryThis$7("".toLowerCase),ucs2decode=function(e){for(var t=[],r=0,n=e.length;r<n;){var a=charCodeAt(e,r++);if(a>=55296&&a<=56319&&r<n){var i=charCodeAt(e,r++);56320==(64512&i)?push$4(t,((1023&a)<<10)+(1023&i)+65536):(push$4(t,a),r--)}else push$4(t,a)}return t},digitToBasic=function(e){return e+22+75*(e<26)},adapt=function(e,t,r){var n=0;for(e=r?floor$1(e/damp):e>>1,e+=floor$1(e/t);e>baseMinusTMin*tMax>>1;)e=floor$1(e/baseMinusTMin),n+=base;return floor$1(n+(baseMinusTMin+1)*e/(e+skew))},encode=function(e){var t,r,n=[],a=(e=ucs2decode(e)).length,i=initialN,s=0,o=initialBias;for(t=0;t<e.length;t++)(r=e[t])<128&&push$4(n,fromCharCode(r));var l=n.length,c=l;for(l&&push$4(n,delimiter);c<a;){var u=maxInt;for(t=0;t<e.length;t++)(r=e[t])>=i&&r<u&&(u=r);var h=c+1;if(u-i>floor$1((maxInt-s)/h))throw $RangeError(OVERFLOW_ERROR);for(s+=(u-i)*h,i=u,t=0;t<e.length;t++){if((r=e[t])<i&&++s>maxInt)throw $RangeError(OVERFLOW_ERROR);if(r==i){for(var d=s,f=base;;){var p=f<=o?tMin:f>=o+tMax?tMax:f-o;if(d<p)break;var y=d-p,g=base-p;push$4(n,fromCharCode(digitToBasic(p+y%g))),d=floor$1(y/g),f+=base}push$4(n,fromCharCode(digitToBasic(d))),o=adapt(s,h,c==l),s=0,c++}}s++,i++}return join$2(n,"")},stringPunycodeToAscii=function(e){var t,r,n=[],a=split$2(replace$2(toLowerCase$1(e),regexSeparators,"."),".");for(t=0;t<a.length;t++)r=a[t],push$4(n,exec$1(regexNonASCII,r)?"xn--"+encode(r):r);return join$2(n,".")},$$A=_export,global$2=global$s,call$9=functionCall,uncurryThis$6=functionUncurryThis,DESCRIPTORS$2=descriptors,USE_NATIVE_URL$2=urlConstructorDetection,defineBuiltIn$1=defineBuiltIn$8,defineBuiltInAccessor$1=defineBuiltInAccessor$5,defineBuiltIns=defineBuiltIns$2,setToStringTag$1=setToStringTag$9,createIteratorConstructor=iteratorCreateConstructor,InternalStateModule$1=internalState,anInstance$1=anInstance$5,isCallable$1=isCallable$r,hasOwn$5=hasOwnProperty_1,bind$6=functionBindContext,classof$3=classof$g,anObject$2=anObject$i,isObject$1=isObject$m,$toString$1=toString$g,create$1=objectCreate,createPropertyDescriptor=createPropertyDescriptor$8,getIterator=getIterator$3,getIteratorMethod=getIteratorMethod$a,validateArgumentsLength$2=validateArgumentsLength$5,wellKnownSymbol$1=wellKnownSymbol$r,arraySort=arraySort$1,ITERATOR$1=wellKnownSymbol$1("iterator"),URL_SEARCH_PARAMS="URLSearchParams",URL_SEARCH_PARAMS_ITERATOR=URL_SEARCH_PARAMS+"Iterator",setInternalState$1=InternalStateModule$1.set,getInternalParamsState=InternalStateModule$1.getterFor(URL_SEARCH_PARAMS),getInternalIteratorState=InternalStateModule$1.getterFor(URL_SEARCH_PARAMS_ITERATOR),getOwnPropertyDescriptor5=Object.getOwnPropertyDescriptor,safeGetBuiltIn=function(e){if(!DESCRIPTORS$2)return global$2[e];var t=getOwnPropertyDescriptor5(global$2,e);return t&&t.value},nativeFetch=safeGetBuiltIn("fetch"),NativeRequest=safeGetBuiltIn("Request"),Headers=safeGetBuiltIn("Headers"),RequestPrototype=NativeRequest&&NativeRequest.prototype,HeadersPrototype=Headers&&Headers.prototype,RegExp$1=global$2.RegExp,TypeError$2=global$2.TypeError,decodeURIComponent$1=global$2.decodeURIComponent,encodeURIComponent$1=global$2.encodeURIComponent,charAt$1=uncurryThis$6("".charAt),join$1=uncurryThis$6([].join),push$3=uncurryThis$6([].push),replace$1=uncurryThis$6("".replace),shift$1=uncurryThis$6([].shift),splice2=uncurryThis$6([].splice),split$1=uncurryThis$6("".split),stringSlice$1=uncurryThis$6("".slice),plus=/\+/g,sequences=Array(4),percentSequence=function(e){return sequences[e-1]||(sequences[e-1]=RegExp$1("((?:%[\\da-f]{2}){"+e+"})","gi"))},percentDecode=function(e){try{return decodeURIComponent$1(e)}catch(t){return e}},deserialize=function(e){var t=replace$1(e,plus," "),r=4;try{return decodeURIComponent$1(t)}catch(e){for(;r;)t=replace$1(t,percentSequence(r--),percentDecode);return t}},find$7=/[!'()~]|%20/g,replacements={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},replacer=function(e){return replacements[e]},serialize=function(e){return replace$1(encodeURIComponent$1(e),find$7,replacer)},URLSearchParamsIterator=createIteratorConstructor((function(e,t){setInternalState$1(this,{type:URL_SEARCH_PARAMS_ITERATOR,iterator:getIterator(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$1(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===charAt$1(e,0)?stringSlice$1(e,1):e:$toString$1(e)))};URLSearchParamsState.prototype={type:URL_SEARCH_PARAMS,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,a,i,s,o,l=getIteratorMethod(e);if(l)for(r=(t=getIterator(e,l)).next;!(n=call$9(r,t)).done;){if(i=(a=getIterator(anObject$2(n.value))).next,(s=call$9(i,a)).done||(o=call$9(i,a)).done||!call$9(i,a).done)throw TypeError$2("Expected sequence with length 2");push$3(this.entries,{key:$toString$1(s.value),value:$toString$1(o.value)})}else for(var c in e)hasOwn$5(e,c)&&push$3(this.entries,{key:c,value:$toString$1(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=split$1(e,"&"),a=0;a<n.length;)(t=n[a++]).length&&(r=split$1(t,"="),push$3(this.entries,{key:deserialize(shift$1(r)),value:deserialize(join$1(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],push$3(r,serialize(e.key)+"="+serialize(e.value));return join$1(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var URLSearchParamsConstructor=function(){anInstance$1(this,URLSearchParamsPrototype);var e=setInternalState$1(this,new URLSearchParamsState(arguments.length>0?arguments[0]:void 0));DESCRIPTORS$2||(this.length=e.entries.length)},URLSearchParamsPrototype=URLSearchParamsConstructor.prototype;if(defineBuiltIns(URLSearchParamsPrototype,{append:function(e,t){validateArgumentsLength$2(arguments.length,2);var r=getInternalParamsState(this);push$3(r.entries,{key:$toString$1(e),value:$toString$1(t)}),DESCRIPTORS$2||this.length++,r.updateURL()},delete:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this),r=t.entries,n=$toString$1(e),a=0;a<r.length;)r[a].key===n?splice2(r,a,1):a++;DESCRIPTORS$2||(this.length=r.length),t.updateURL()},get:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$1(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$1(e),n=[],a=0;a<t.length;a++)t[a].key===r&&push$3(n,t[a].value);return n},has:function(e){validateArgumentsLength$2(arguments.length,1);for(var t=getInternalParamsState(this).entries,r=$toString$1(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),a=n.entries,i=!1,s=$toString$1(e),o=$toString$1(t),l=0;l<a.length;l++)(r=a[l]).key===s&&(i?splice2(a,l--,1):(i=!0,r.value=o));i||push$3(a,{key:s,value:o}),DESCRIPTORS$2||(this.length=a.length),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$6(e,arguments.length>1?arguments[1]:void 0),a=0;a<r.length;)n((t=r[a++]).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$1(URLSearchParamsPrototype,ITERATOR$1,URLSearchParamsPrototype.entries,{name:"entries"}),defineBuiltIn$1(URLSearchParamsPrototype,"toString",(function(){return getInternalParamsState(this).serialize()}),{enumerable:!0}),DESCRIPTORS$2&&defineBuiltInAccessor$1(URLSearchParamsPrototype,"size",{get:function(){return getInternalParamsState(this).entries.length},configurable:!0,enumerable:!0}),setToStringTag$1(URLSearchParamsConstructor,URL_SEARCH_PARAMS),$$A({global:!0,constructor:!0,forced:!USE_NATIVE_URL$2},{URLSearchParams:URLSearchParamsConstructor}),!USE_NATIVE_URL$2&&isCallable$1(Headers)){var headersHas=uncurryThis$6(HeadersPrototype.has),headersSet=uncurryThis$6(HeadersPrototype.set),wrapRequestOptions=function(e){if(isObject$1(e)){var t,r=e.body;if(classof$3(r)===URL_SEARCH_PARAMS)return t=e.headers?new Headers(e.headers):new Headers,headersHas(t,"content-type")||headersSet(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),create$1(e,{body:createPropertyDescriptor(0,$toString$1(r)),headers:createPropertyDescriptor(0,t)})}return e};if(isCallable$1(nativeFetch)&&$$A({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return nativeFetch(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})}}),isCallable$1(NativeRequest)){var RequestConstructor=function(e){return anInstance$1(this,RequestPrototype),new NativeRequest(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})};RequestPrototype.constructor=RequestConstructor,RequestConstructor.prototype=RequestPrototype,$$A({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:RequestConstructor})}}var EOF,web_urlSearchParams_constructor={URLSearchParams:URLSearchParamsConstructor,getState:getInternalParamsState},$$z=_export,DESCRIPTORS$1=descriptors,USE_NATIVE_URL$1=urlConstructorDetection,global$1=global$s,bind$5=functionBindContext,uncurryThis$5=functionUncurryThis,defineBuiltIn=defineBuiltIn$8,defineBuiltInAccessor=defineBuiltInAccessor$5,anInstance=anInstance$5,hasOwn$4=hasOwnProperty_1,assign2=objectAssign,arrayFrom=arrayFrom$1,arraySlice=arraySliceSimple,codeAt=stringMultibyte.codeAt,toASCII=stringPunycodeToAscii,$toString=toString$g,setToStringTag=setToStringTag$9,validateArgumentsLength$1=validateArgumentsLength$5,URLSearchParamsModule=web_urlSearchParams_constructor,InternalStateModule=internalState,setInternalState=InternalStateModule.set,getInternalURLState=InternalStateModule.getterFor("URL"),URLSearchParams$1=URLSearchParamsModule.URLSearchParams,getInternalSearchParamsState=URLSearchParamsModule.getState,NativeURL=global$1.URL,TypeError$1=global$1.TypeError,parseInt$1=global$1.parseInt,floor=Math.floor,pow=Math.pow,charAt=uncurryThis$5("".charAt),exec=uncurryThis$5(/./.exec),join=uncurryThis$5([].join),numberToString=uncurryThis$5(1..toString),pop=uncurryThis$5([].pop),push$2=uncurryThis$5([].push),replace=uncurryThis$5("".replace),shift=uncurryThis$5([].shift),split=uncurryThis$5("".split),stringSlice=uncurryThis$5("".slice),toLowerCase=uncurryThis$5("".toLowerCase),unshift=uncurryThis$5([].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_C0_CONTROL_OR_SPACE=/^[\u0000-\u0020]+/,TRAILING_C0_CONTROL_OR_SPACE=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,TAB_AND_NEW_LINE=/[\t\n\r]/g,parseIPv4=function(e){var t,r,n,a,i,s,o,l=split(e,".");if(l.length&&""==l[l.length-1]&&l.length--,(t=l.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(a=l[n]))return e;if(i=10,a.length>1&&"0"==charAt(a,0)&&(i=exec(HEX_START,a)?16:8,a=stringSlice(a,8==i?1:2)),""===a)s=0;else{if(!exec(10==i?DEC:8==i?OCT:HEX,a))return e;s=parseInt$1(a,i)}push$2(r,s)}for(n=0;n<t;n++)if(s=r[n],n==t-1){if(s>=pow(256,5-t))return null}else if(s>255)return null;for(o=pop(r),n=0;n<r.length;n++)o+=r[n]*pow(256,3-n);return o},parseIPv6=function(e){var t,r,n,a,i,s,o,l=[0,0,0,0,0,0,0,0],c=0,u=null,h=0,d=function(){return charAt(e,h)};if(":"==d()){if(":"!=charAt(e,1))return;h+=2,u=++c}for(;d();){if(8==c)return;if(":"!=d()){for(t=r=0;r<4&&exec(HEX,d());)t=16*t+parseInt$1(d(),16),h++,r++;if("."==d()){if(0==r)return;if(h-=r,c>6)return;for(n=0;d();){if(a=null,n>0){if(!("."==d()&&n<4))return;h++}if(!exec(DIGIT,d()))return;for(;exec(DIGIT,d());){if(i=parseInt$1(d(),10),null===a)a=i;else{if(0==a)return;a=10*a+i}if(a>255)return;h++}l[c]=256*l[c]+a,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==d()){if(h++,!d())return}else if(d())return;l[c++]=t}else{if(null!==u)return;h++,u=++c}}if(null!==u)for(s=c-u,c=7;0!=c&&s>0;)o=l[c],l[c--]=l[u+s-1],l[u+--s]=o;else if(8!=c)return;return l},findLongestZeroSequence=function(e){for(var t=null,r=1,n=null,a=0,i=0;i<8;i++)0!==e[i]?(a>r&&(t=n,r=a),n=null,a=0):(null===n&&(n=i),++a);return a>r&&(t=n,r=a),t},serializeHost=function(e){var t,r,n,a;if("number"==typeof e){for(t=[],r=0;r<4;r++)unshift(t,e%256),e=floor(e/256);return join(t,".")}if("object"==typeof e){for(t="",n=findLongestZeroSequence(e),r=0;r<8;r++)a&&0===e[r]||(a&&(a=!1),n===r?(t+=r?":":"::",a=!0):(t+=numberToString(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},C0ControlPercentEncodeSet={},fragmentPercentEncodeSet=assign2({},C0ControlPercentEncodeSet,{" ":1,'"':1,"<":1,">":1,"`":1}),pathPercentEncodeSet=assign2({},fragmentPercentEncodeSet,{"#":1,"?":1,"{":1,"}":1}),userinfoPercentEncodeSet=assign2({},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$4(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(ALPHA,charAt(e,0))&&(":"==(r=charAt(e,1))||!t&&"|"==r)},startsWithWindowsDriveLetter=function(e){var t;return e.length>1&&isWindowsDriveLetter(stringSlice(e,0,2))&&(2==e.length||"/"===(t=charAt(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,a,i,s=$toString(e);if(t){if(a=this.parse(s))throw TypeError$1(a);this.searchParams=null}else{if(void 0!==r&&(n=new URLState(r,!0)),a=this.parse(s,null,n))throw TypeError$1(a);(i=getInternalSearchParamsState(new URLSearchParams$1)).bindURL(this),this.searchParams=i}};URLState.prototype={type:"URL",parse:function(e,t,r){var n,a,i,s,o=this,l=t||SCHEME_START,c=0,u="",h=!1,d=!1,f=!1;for(e=$toString(e),t||(o.scheme="",o.username="",o.password="",o.host=null,o.port=null,o.path=[],o.query=null,o.fragment=null,o.cannotBeABaseURL=!1,e=replace(e,LEADING_C0_CONTROL_OR_SPACE,""),e=replace(e,TRAILING_C0_CONTROL_OR_SPACE,"$1")),e=replace(e,TAB_AND_NEW_LINE,""),n=arrayFrom(e);c<=n.length;){switch(a=n[c],l){case SCHEME_START:if(!a||!exec(ALPHA,a)){if(t)return INVALID_SCHEME;l=NO_SCHEME;continue}u+=toLowerCase(a),l=SCHEME;break;case SCHEME:if(a&&(exec(ALPHANUMERIC,a)||"+"==a||"-"==a||"."==a))u+=toLowerCase(a);else{if(":"!=a){if(t)return INVALID_SCHEME;u="",l=NO_SCHEME,c=0;continue}if(t&&(o.isSpecial()!=hasOwn$4(specialSchemes,u)||"file"==u&&(o.includesCredentials()||null!==o.port)||"file"==o.scheme&&!o.host))return;if(o.scheme=u,t)return void(o.isSpecial()&&specialSchemes[o.scheme]==o.port&&(o.port=null));u="","file"==o.scheme?l=FILE:o.isSpecial()&&r&&r.scheme==o.scheme?l=SPECIAL_RELATIVE_OR_AUTHORITY:o.isSpecial()?l=SPECIAL_AUTHORITY_SLASHES:"/"==n[c+1]?(l=PATH_OR_AUTHORITY,c++):(o.cannotBeABaseURL=!0,push$2(o.path,""),l=CANNOT_BE_A_BASE_URL_PATH)}break;case NO_SCHEME:if(!r||r.cannotBeABaseURL&&"#"!=a)return INVALID_SCHEME;if(r.cannotBeABaseURL&&"#"==a){o.scheme=r.scheme,o.path=arraySlice(r.path),o.query=r.query,o.fragment="",o.cannotBeABaseURL=!0,l=FRAGMENT;break}l="file"==r.scheme?FILE:RELATIVE;continue;case SPECIAL_RELATIVE_OR_AUTHORITY:if("/"!=a||"/"!=n[c+1]){l=RELATIVE;continue}l=SPECIAL_AUTHORITY_IGNORE_SLASHES,c++;break;case PATH_OR_AUTHORITY:if("/"==a){l=AUTHORITY;break}l=PATH;continue;case RELATIVE:if(o.scheme=r.scheme,a==EOF)o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,o.path=arraySlice(r.path),o.query=r.query;else if("/"==a||"\\"==a&&o.isSpecial())l=RELATIVE_SLASH;else if("?"==a)o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,o.path=arraySlice(r.path),o.query="",l=QUERY;else{if("#"!=a){o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,o.path=arraySlice(r.path),o.path.length--,l=PATH;continue}o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,o.path=arraySlice(r.path),o.query=r.query,o.fragment="",l=FRAGMENT}break;case RELATIVE_SLASH:if(!o.isSpecial()||"/"!=a&&"\\"!=a){if("/"!=a){o.username=r.username,o.password=r.password,o.host=r.host,o.port=r.port,l=PATH;continue}l=AUTHORITY}else l=SPECIAL_AUTHORITY_IGNORE_SLASHES;break;case SPECIAL_AUTHORITY_SLASHES:if(l=SPECIAL_AUTHORITY_IGNORE_SLASHES,"/"!=a||"/"!=charAt(u,c+1))continue;c++;break;case SPECIAL_AUTHORITY_IGNORE_SLASHES:if("/"!=a&&"\\"!=a){l=AUTHORITY;continue}break;case AUTHORITY:if("@"==a){h&&(u="%40"+u),h=!0,i=arrayFrom(u);for(var p=0;p<i.length;p++){var y=i[p];if(":"!=y||f){var g=percentEncode(y,userinfoPercentEncodeSet);f?o.password+=g:o.username+=g}else f=!0}u=""}else if(a==EOF||"/"==a||"?"==a||"#"==a||"\\"==a&&o.isSpecial()){if(h&&""==u)return INVALID_AUTHORITY;c-=arrayFrom(u).length+1,u="",l=HOST}else u+=a;break;case HOST:case HOSTNAME:if(t&&"file"==o.scheme){l=FILE_HOST;continue}if(":"!=a||d){if(a==EOF||"/"==a||"?"==a||"#"==a||"\\"==a&&o.isSpecial()){if(o.isSpecial()&&""==u)return INVALID_HOST;if(t&&""==u&&(o.includesCredentials()||null!==o.port))return;if(s=o.parseHost(u))return s;if(u="",l=PATH_START,t)return;continue}"["==a?d=!0:"]"==a&&(d=!1),u+=a}else{if(""==u)return INVALID_HOST;if(s=o.parseHost(u))return s;if(u="",l=PORT,t==HOSTNAME)return}break;case PORT:if(!exec(DIGIT,a)){if(a==EOF||"/"==a||"?"==a||"#"==a||"\\"==a&&o.isSpecial()||t){if(""!=u){var v=parseInt$1(u,10);if(v>65535)return INVALID_PORT;o.port=o.isSpecial()&&v===specialSchemes[o.scheme]?null:v,u=""}if(t)return;l=PATH_START;continue}return INVALID_PORT}u+=a;break;case FILE:if(o.scheme="file","/"==a||"\\"==a)l=FILE_SLASH;else{if(!r||"file"!=r.scheme){l=PATH;continue}if(a==EOF)o.host=r.host,o.path=arraySlice(r.path),o.query=r.query;else if("?"==a)o.host=r.host,o.path=arraySlice(r.path),o.query="",l=QUERY;else{if("#"!=a){startsWithWindowsDriveLetter(join(arraySlice(n,c),""))||(o.host=r.host,o.path=arraySlice(r.path),o.shortenPath()),l=PATH;continue}o.host=r.host,o.path=arraySlice(r.path),o.query=r.query,o.fragment="",l=FRAGMENT}}break;case FILE_SLASH:if("/"==a||"\\"==a){l=FILE_HOST;break}r&&"file"==r.scheme&&!startsWithWindowsDriveLetter(join(arraySlice(n,c),""))&&(isWindowsDriveLetter(r.path[0],!0)?push$2(o.path,r.path[0]):o.host=r.host),l=PATH;continue;case FILE_HOST:if(a==EOF||"/"==a||"\\"==a||"?"==a||"#"==a){if(!t&&isWindowsDriveLetter(u))l=PATH;else if(""==u){if(o.host="",t)return;l=PATH_START}else{if(s=o.parseHost(u))return s;if("localhost"==o.host&&(o.host=""),t)return;u="",l=PATH_START}continue}u+=a;break;case PATH_START:if(o.isSpecial()){if(l=PATH,"/"!=a&&"\\"!=a)continue}else if(t||"?"!=a)if(t||"#"!=a){if(a!=EOF&&(l=PATH,"/"!=a))continue}else o.fragment="",l=FRAGMENT;else o.query="",l=QUERY;break;case PATH:if(a==EOF||"/"==a||"\\"==a&&o.isSpecial()||!t&&("?"==a||"#"==a)){if(isDoubleDot(u)?(o.shortenPath(),"/"==a||"\\"==a&&o.isSpecial()||push$2(o.path,"")):isSingleDot(u)?"/"==a||"\\"==a&&o.isSpecial()||push$2(o.path,""):("file"==o.scheme&&!o.path.length&&isWindowsDriveLetter(u)&&(o.host&&(o.host=""),u=charAt(u,0)+":"),push$2(o.path,u)),u="","file"==o.scheme&&(a==EOF||"?"==a||"#"==a))for(;o.path.length>1&&""===o.path[0];)shift(o.path);"?"==a?(o.query="",l=QUERY):"#"==a&&(o.fragment="",l=FRAGMENT)}else u+=percentEncode(a,pathPercentEncodeSet);break;case CANNOT_BE_A_BASE_URL_PATH:"?"==a?(o.query="",l=QUERY):"#"==a?(o.fragment="",l=FRAGMENT):a!=EOF&&(o.path[0]+=percentEncode(a,C0ControlPercentEncodeSet));break;case QUERY:t||"#"!=a?a!=EOF&&("'"==a&&o.isSpecial()?o.query+="%27":o.query+="#"==a?"%23":percentEncode(a,C0ControlPercentEncodeSet)):(o.fragment="",l=FRAGMENT);break;case FRAGMENT:a!=EOF&&(o.fragment+=percentEncode(a,fragmentPercentEncodeSet))}c++}},parseHost:function(e){var t,r,n;if("["==charAt(e,0)){if("]"!=charAt(e,e.length-1))return INVALID_HOST;if(!(t=parseIPv6(stringSlice(e,1,-1))))return INVALID_HOST;this.host=t}else if(this.isSpecial()){if(e=toASCII(e),exec(FORBIDDEN_HOST_CODE_POINT,e))return INVALID_HOST;if(null===(t=parseIPv4(e)))return INVALID_HOST;this.host=t}else{if(exec(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$4(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,a=e.host,i=e.port,s=e.path,o=e.query,l=e.fragment,c=t+":";return null!==a?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=serializeHost(a),null!==i&&(c+=":"+i)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?s[0]:s.length?"/"+join(s,"/"):"",null!==o&&(c+="?"+o),null!==l&&(c+="#"+l),c},setHref:function(e){var t=this.parse(e);if(t)throw TypeError$1(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(e)+":",SCHEME_START)},getUsername:function(){return this.username},setUsername:function(e){var t=arrayFrom($toString(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(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(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=$toString(e))?this.port=null:this.parse(e,PORT))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+join(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(e))?this.query=null:("?"==charAt(e,0)&&(e=stringSlice(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(e))?("#"==charAt(e,0)&&(e=stringSlice(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(this,URLPrototype),r=validateArgumentsLength$1(arguments.length,1)>1?arguments[1]:void 0,n=setInternalState(t,new URLState(e,!1,r));DESCRIPTORS$1||(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$1&&(defineBuiltInAccessor(URLPrototype,"href",accessorDescriptor("serialize","setHref")),defineBuiltInAccessor(URLPrototype,"origin",accessorDescriptor("getOrigin")),defineBuiltInAccessor(URLPrototype,"protocol",accessorDescriptor("getProtocol","setProtocol")),defineBuiltInAccessor(URLPrototype,"username",accessorDescriptor("getUsername","setUsername")),defineBuiltInAccessor(URLPrototype,"password",accessorDescriptor("getPassword","setPassword")),defineBuiltInAccessor(URLPrototype,"host",accessorDescriptor("getHost","setHost")),defineBuiltInAccessor(URLPrototype,"hostname",accessorDescriptor("getHostname","setHostname")),defineBuiltInAccessor(URLPrototype,"port",accessorDescriptor("getPort","setPort")),defineBuiltInAccessor(URLPrototype,"pathname",accessorDescriptor("getPathname","setPathname")),defineBuiltInAccessor(URLPrototype,"search",accessorDescriptor("getSearch","setSearch")),defineBuiltInAccessor(URLPrototype,"searchParams",accessorDescriptor("getSearchParams")),defineBuiltInAccessor(URLPrototype,"hash",accessorDescriptor("getHash","setHash"))),defineBuiltIn(URLPrototype,"toJSON",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),defineBuiltIn(URLPrototype,"toString",(function(){return getInternalURLState(this).serialize()}),{enumerable:!0}),NativeURL){var nativeCreateObjectURL=NativeURL.createObjectURL,nativeRevokeObjectURL=NativeURL.revokeObjectURL;nativeCreateObjectURL&&defineBuiltIn(URLConstructor,"createObjectURL",bind$5(nativeCreateObjectURL,NativeURL)),nativeRevokeObjectURL&&defineBuiltIn(URLConstructor,"revokeObjectURL",bind$5(nativeRevokeObjectURL,NativeURL))}setToStringTag(URLConstructor,"URL"),$$z({global:!0,constructor:!0,forced:!USE_NATIVE_URL$1,sham:!DESCRIPTORS$1},{URL:URLConstructor});var $$y=_export,getBuiltIn$2=getBuiltIn$j,fails$1=fails$A,validateArgumentsLength=validateArgumentsLength$5,toString$2=toString$g,USE_NATIVE_URL=urlConstructorDetection,URL$1=getBuiltIn$2("URL"),THROWS_WITHOUT_ARGUMENTS=USE_NATIVE_URL&&fails$1((function(){URL$1.canParse()}));$$y({target:"URL",stat:!0,forced:!THROWS_WITHOUT_ARGUMENTS},{canParse:function(e){var t=validateArgumentsLength(arguments.length,1),r=toString$2(e),n=t<2||void 0===arguments[1]?void 0:toString$2(arguments[1]);try{return!!new URL$1(r,n)}catch(e){return!1}}});var path$5=path$x,url$5=path$5.URL,parent$I=url$5,url$4=parent$I,parent$H=url$4,url$3=parent$H,parent$G=url$3,url$2=parent$G,url$1=url$2,url=url$1,_URL=getDefaultExportFromCjs(url),create4=create$4,_Object$create=getDefaultExportFromCjs(create4),apply$1=functionApply,toIndexedObject$1=toIndexedObject$c,toIntegerOrInfinity$1=toIntegerOrInfinity$7,lengthOfArrayLike=lengthOfArrayLike$c,arrayMethodIsStrict=arrayMethodIsStrict$7,min=Math.min,$lastIndexOf=[].lastIndexOf,NEGATIVE_ZERO=!!$lastIndexOf&&1/[1].lastIndexOf(1,-0)<0,STRICT_METHOD=arrayMethodIsStrict("lastIndexOf"),FORCED=NEGATIVE_ZERO||!STRICT_METHOD,arrayLastIndexOf=FORCED?function(e){if(NEGATIVE_ZERO)return apply$1($lastIndexOf,this,arguments)||0;var t=toIndexedObject$1(this),r=lengthOfArrayLike(t),n=r-1;for(arguments.length>1&&(n=min(n,toIntegerOrInfinity$1(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:$lastIndexOf,$$x=_export,lastIndexOf$7=arrayLastIndexOf;$$x({target:"Array",proto:!0,forced:arrayLastIndexOf!==[].lastIndexOf},{lastIndexOf:arrayLastIndexOf});var entryVirtual$6=entryVirtual$n,lastIndexOf$6=entryVirtual$6("Array").lastIndexOf,isPrototypeOf$7=objectIsPrototypeOf,method$4=lastIndexOf$6,ArrayPrototype$5=Array.prototype,lastIndexOf$5=function(e){var t=e.lastIndexOf;return e===ArrayPrototype$5||isPrototypeOf$7(ArrayPrototype$5,e)&&t===ArrayPrototype$5.lastIndexOf?method$4:t},parent$F=lastIndexOf$5,lastIndexOf$4=parent$F,parent$E=lastIndexOf$4,lastIndexOf$3=parent$E,parent$D=lastIndexOf$3,lastIndexOf$2=parent$D,lastIndexOf$1=lastIndexOf$2,lastIndexOf2=lastIndexOf$1,_lastIndexOfInstanceProperty=getDefaultExportFromCjs(lastIndexOf2),$$w=_export,uncurryThis$4=functionUncurryThis,isArray2=isArray$d,nativeReverse=uncurryThis$4([].reverse),test=[1,2];$$w({target:"Array",proto:!0,forced:String(test)===String(test.reverse())},{reverse:function(){return isArray2(this)&&(this.length=this.length),nativeReverse(this)}});var entryVirtual$5=entryVirtual$n,reverse$6=entryVirtual$5("Array").reverse,isPrototypeOf$6=objectIsPrototypeOf,method$3=reverse$6,ArrayPrototype$4=Array.prototype,reverse$5=function(e){var t=e.reverse;return e===ArrayPrototype$4||isPrototypeOf$6(ArrayPrototype$4,e)&&t===ArrayPrototype$4.reverse?method$3:t},parent$C=reverse$5,reverse$4=parent$C,parent$B=reverse$4,reverse$3=parent$B,parent$A=reverse$3,reverse$2=parent$A,reverse$1=reverse$2,reverse2=reverse$1,_reverseInstanceProperty=getDefaultExportFromCjs(reverse2),$$v=_export,uncurryThis$3=functionUncurryThis,$Date=Date,thisTimeValue=uncurryThis$3($Date.prototype.getTime);$$v({target:"Date",stat:!0},{now:function(){return thisTimeValue(new $Date)}});var path$4=path$x,now$5=path$4.Date.now,parent$z=now$5,now$4=parent$z,parent$y=now$4,now$3=parent$y,parent$x=now$3,now$2=parent$x,now$1=now$2,now2=now$1,_Date$now=getDefaultExportFromCjs(now2),path$3=path$x,apply=functionApply;path$3.JSON||(path$3.JSON={stringify:JSON.stringify});var stringify$5=function(e,t,r){return apply(path$3.JSON.stringify,null,arguments)},parent$w=stringify$5,stringify$4=parent$w,parent$v=stringify$4,stringify$3=parent$v,parent$u=stringify$3,stringify$2=parent$u,stringify$1=stringify$2,stringify2=stringify$1,_JSON$stringify=getDefaultExportFromCjs(stringify2),anObject$1=anObject$i,regexpFlags=function(){var e=anObject$1(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},call$8=functionCall,hasOwn$3=hasOwnProperty_1,isPrototypeOf$5=objectIsPrototypeOf,regExpFlags=regexpFlags,RegExpPrototype$1=RegExp.prototype,regexpGetFlags=function(e){var t=e.flags;return void 0!==t||"flags"in RegExpPrototype$1||hasOwn$3(e,"flags")||!isPrototypeOf$5(RegExpPrototype$1,e)?t:call$8(regExpFlags,e)},getRegExpFlags=regexpGetFlags,flags$6=getRegExpFlags,isPrototypeOf$4=objectIsPrototypeOf,flags$5=flags$6,RegExpPrototype=RegExp.prototype,flags_1=function(e){return e===RegExpPrototype||isPrototypeOf$4(RegExpPrototype,e)?flags$5(e):e.flags},parent$t=flags_1,flags$4=parent$t,parent$s=flags$4,flags$3=parent$s,parent$r=flags$3,flags$2=parent$r,flags$1=flags$2,flags=flags$1,_flagsInstanceProperty=getDefaultExportFromCjs(flags),$$u=_export;$$u({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{EPSILON:Math.pow(2,-52)});var epsilon$5=Math.pow(2,-52),parent$q=epsilon$5,epsilon$4=parent$q,parent$p=epsilon$4,epsilon$3=parent$p,parent$o=epsilon$3,epsilon$2=parent$o,epsilon$1=epsilon$2,epsilon=epsilon$1,_Number$EPSILON=getDefaultExportFromCjs(epsilon),map2=map$8,_Map=getDefaultExportFromCjs(map2),collection=collection$2,collectionStrong=collectionStrong$2;collection("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),collectionStrong);var path$2=path$x,set$5=path$2.Set,parent$n=set$5,set$4=parent$n,tryToString=tryToString$8,aSet$g=function(e){if("object"==typeof e&&"size"in e&&"has"in e&&"add"in e&&"delete"in e&&"keys"in e)return e;throw TypeError(tryToString(e)+" is not a set")},getBuiltIn$1=getBuiltIn$j,caller=caller$2,Set$5=getBuiltIn$1("Set"),SetPrototype=Set$5.prototype,setHelpers={Set:Set$5,add:caller("add",1),has:caller("has",1),remove:caller("delete",1),proto:SetPrototype},iterateSimple$6=iterateSimple$8,setIterate=function(e,t,r){return r?iterateSimple$6(e.keys(),t):e.forEach(t)},SetHelpers$5=setHelpers,iterate$8=setIterate,Set$4=SetHelpers$5.Set,add$6=SetHelpers$5.add,setClone=function(e){var t=new Set$4;return iterate$8(e,(function(e){add$6(t,e)})),t},setSize=function(e){return e.size},aCallable$1=aCallable$l,anObject=anObject$i,call$7=functionCall,toIntegerOrInfinity=toIntegerOrInfinity$7,$TypeError$1=TypeError,max=Math.max,SetRecord=function(e,t,r,n){this.set=e,this.size=t,this.has=r,this.keys=n};SetRecord.prototype={getIterator:function(){return anObject(call$7(this.keys,this.set))},includes:function(e){return call$7(this.has,this.set,e)}};var getSetRecord$7=function(e){anObject(e);var t=+e.size;if(t!=t)throw $TypeError$1("Invalid size");return new SetRecord(e,max(toIntegerOrInfinity(t),0),aCallable$1(e.has),aCallable$1(e.keys))},aSet$f=aSet$g,SetHelpers$4=setHelpers,clone$2=setClone,size$4=setSize,getSetRecord$6=getSetRecord$7,iterateSet$2=setIterate,iterateSimple$5=iterateSimple$8,has$4=SetHelpers$4.has,remove$2=SetHelpers$4.remove,setDifference=function(e){var t=aSet$f(this),r=getSetRecord$6(e),n=clone$2(t);return size$4(t)<=r.size?iterateSet$2(t,(function(e){r.includes(e)&&remove$2(n,e)})):iterateSimple$5(r.getIterator(),(function(e){has$4(t,e)&&remove$2(n,e)})),n},setMethodAcceptSetLike$7=function(){return!1},$$t=_export,difference2=setDifference,setMethodAcceptSetLike$6=setMethodAcceptSetLike$7;$$t({target:"Set",proto:!0,real:!0,forced:!setMethodAcceptSetLike$6()},{difference:difference2});var aSet$e=aSet$g,SetHelpers$3=setHelpers,size$3=setSize,getSetRecord$5=getSetRecord$7,iterateSet$1=setIterate,iterateSimple$4=iterateSimple$8,Set$3=SetHelpers$3.Set,add$5=SetHelpers$3.add,has$3=SetHelpers$3.has,setIntersection=function(e){var t=aSet$e(this),r=getSetRecord$5(e),n=new Set$3;return size$3(t)>r.size?iterateSimple$4(r.getIterator(),(function(e){has$3(t,e)&&add$5(n,e)})):iterateSet$1(t,(function(e){r.includes(e)&&add$5(n,e)})),n},$$s=_export,intersection2=setIntersection,setMethodAcceptSetLike$5=setMethodAcceptSetLike$7,INCORRECT=!setMethodAcceptSetLike$5();$$s({target:"Set",proto:!0,real:!0,forced:INCORRECT},{intersection:intersection2});var aSet$d=aSet$g,has$2=setHelpers.has,size$2=setSize,getSetRecord$4=getSetRecord$7,iterateSet=setIterate,iterateSimple$3=iterateSimple$8,iteratorClose$1=iteratorClose$4,setIsDisjointFrom=function(e){var t=aSet$d(this),r=getSetRecord$4(e);if(size$2(t)<=r.size)return!1!==iterateSet(t,(function(e){if(r.includes(e))return!1}),!0);var n=r.getIterator();return!1!==iterateSimple$3(n,(function(e){if(has$2(t,e))return iteratorClose$1(n,"normal",!1)}))},$$r=_export,isDisjointFrom2=setIsDisjointFrom,setMethodAcceptSetLike$4=setMethodAcceptSetLike$7;$$r({target:"Set",proto:!0,real:!0,forced:!setMethodAcceptSetLike$4()},{isDisjointFrom:isDisjointFrom2});var aSet$c=aSet$g,size$1=setSize,iterate$7=setIterate,getSetRecord$3=getSetRecord$7,setIsSubsetOf=function(e){var t=aSet$c(this),r=getSetRecord$3(e);return!(size$1(t)>r.size)&&!1!==iterate$7(t,(function(e){if(!r.includes(e))return!1}),!0)},$$q=_export,isSubsetOf2=setIsSubsetOf,setMethodAcceptSetLike$3=setMethodAcceptSetLike$7;$$q({target:"Set",proto:!0,real:!0,forced:!setMethodAcceptSetLike$3()},{isSubsetOf:isSubsetOf2});var aSet$b=aSet$g,has$1=setHelpers.has,size2=setSize,getSetRecord$2=getSetRecord$7,iterateSimple$2=iterateSimple$8,iteratorClose=iteratorClose$4,setIsSupersetOf=function(e){var t=aSet$b(this),r=getSetRecord$2(e);if(size2(t)<r.size)return!1;var n=r.getIterator();return!1!==iterateSimple$2(n,(function(e){if(!has$1(t,e))return iteratorClose(n,"normal",!1)}))},$$p=_export,isSupersetOf2=setIsSupersetOf,setMethodAcceptSetLike$2=setMethodAcceptSetLike$7;$$p({target:"Set",proto:!0,real:!0,forced:!setMethodAcceptSetLike$2()},{isSupersetOf:isSupersetOf2});var aSet$a=aSet$g,SetHelpers$2=setHelpers,clone$1=setClone,getSetRecord$1=getSetRecord$7,iterateSimple$1=iterateSimple$8,add$4=SetHelpers$2.add,has2=SetHelpers$2.has,remove$1=SetHelpers$2.remove,setSymmetricDifference=function(e){var t=aSet$a(this),r=getSetRecord$1(e).getIterator(),n=clone$1(t);return iterateSimple$1(r,(function(e){has2(t,e)?remove$1(n,e):add$4(n,e)})),n},$$o=_export,symmetricDifference2=setSymmetricDifference,setMethodAcceptSetLike$1=setMethodAcceptSetLike$7;$$o({target:"Set",proto:!0,real:!0,forced:!setMethodAcceptSetLike$1()},{symmetricDifference:symmetricDifference2});var aSet$9=aSet$g,add$3=setHelpers.add,clone=setClone,getSetRecord=getSetRecord$7,iterateSimple=iterateSimple$8,setUnion=function(e){var t=aSet$9(this),r=getSetRecord(e).getIterator(),n=clone(t);return iterateSimple(r,(function(e){add$3(n,e)})),n},$$n=_export,union2=setUnion,setMethodAcceptSetLike=setMethodAcceptSetLike$7;$$n({target:"Set",proto:!0,real:!0,forced:!setMethodAcceptSetLike()},{union:union2});var parent$m=set$4,set$3=parent$m,$$m=_export,from3=collectionFrom;$$m({target:"Set",stat:!0,forced:!0},{from:from3});var $$l=_export,of2=collectionOf;$$l({target:"Set",stat:!0,forced:!0},{of:of2});var $$k=_export,aSet$8=aSet$g,add$2=setHelpers.add;$$k({target:"Set",proto:!0,real:!0,forced:!0},{addAll:function(){for(var e=aSet$8(this),t=0,r=arguments.length;t<r;t++)add$2(e,arguments[t]);return e}});var $$j=_export,aSet$7=aSet$g,remove=setHelpers.remove;$$j({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=aSet$7(this),r=!0,n=0,a=arguments.length;n<a;n++)e=remove(t,arguments[n]),r=r&&e;return!!r}});var $$i=_export,bind$4=functionBindContext,aSet$6=aSet$g,iterate$6=setIterate;$$i({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=aSet$6(this),r=bind$4(e,arguments.length>1?arguments[1]:void 0);return!1!==iterate$6(t,(function(e){if(!r(e,e,t))return!1}),!0)}});var classof$2=classof$g,hasOwn$2=hasOwnProperty_1,isNullOrUndefined=isNullOrUndefined$7,wellKnownSymbol=wellKnownSymbol$r,Iterators=iterators,ITERATOR=wellKnownSymbol("iterator"),$Object=Object,isIterable$1=function(e){if(isNullOrUndefined(e))return!1;var t=$Object(e);return void 0!==t[ITERATOR]||"@@iterator"in t||hasOwn$2(Iterators,classof$2(t))},getBuiltIn=getBuiltIn$j,isCallable=isCallable$r,isIterable=isIterable$1,isObject=isObject$m,Set$2=getBuiltIn("Set"),isSetLike=function(e){return isObject(e)&&"number"==typeof e.size&&isCallable(e.has)&&isCallable(e.keys)},toSetLike$7=function(e){return isSetLike(e)?e:isIterable(e)?new Set$2(e):e},$$h=_export,call$6=functionCall,toSetLike$6=toSetLike$7,$difference=setDifference;$$h({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){return call$6($difference,this,toSetLike$6(e))}});var $$g=_export,bind$3=functionBindContext,aSet$5=aSet$g,SetHelpers$1=setHelpers,iterate$5=setIterate,Set$1=SetHelpers$1.Set,add$1=SetHelpers$1.add;$$g({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=aSet$5(this),r=bind$3(e,arguments.length>1?arguments[1]:void 0),n=new Set$1;return iterate$5(t,(function(e){r(e,e,t)&&add$1(n,e)})),n}});var $$f=_export,bind$2=functionBindContext,aSet$4=aSet$g,iterate$4=setIterate;$$f({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=aSet$4(this),r=bind$2(e,arguments.length>1?arguments[1]:void 0),n=iterate$4(t,(function(e){if(r(e,e,t))return{value:e}}),!0);return n&&n.value}});var $$e=_export,call$5=functionCall,toSetLike$5=toSetLike$7,$intersection=setIntersection;$$e({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){return call$5($intersection,this,toSetLike$5(e))}});var $$d=_export,call$4=functionCall,toSetLike$4=toSetLike$7,$isDisjointFrom=setIsDisjointFrom;$$d({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){return call$4($isDisjointFrom,this,toSetLike$4(e))}});var $$c=_export,call$3=functionCall,toSetLike$3=toSetLike$7,$isSubsetOf=setIsSubsetOf;$$c({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){return call$3($isSubsetOf,this,toSetLike$3(e))}});var $$b=_export,call$2=functionCall,toSetLike$2=toSetLike$7,$isSupersetOf=setIsSupersetOf;$$b({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){return call$2($isSupersetOf,this,toSetLike$2(e))}});var $$a=_export,uncurryThis$2=functionUncurryThis,aSet$3=aSet$g,iterate$3=setIterate,toString$1=toString$g,arrayJoin=uncurryThis$2([].join),push$1=uncurryThis$2([].push);$$a({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=aSet$3(this),r=void 0===e?",":toString$1(e),n=[];return iterate$3(t,(function(e){push$1(n,e)})),arrayJoin(n,r)}});var $$9=_export,bind$1=functionBindContext,aSet$2=aSet$g,SetHelpers=setHelpers,iterate$2=setIterate,Set=SetHelpers.Set,add=SetHelpers.add;$$9({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=aSet$2(this),r=bind$1(e,arguments.length>1?arguments[1]:void 0),n=new Set;return iterate$2(t,(function(e){add(n,r(e,e,t))})),n}});var $$8=_export,aCallable=aCallable$l,aSet$1=aSet$g,iterate$1=setIterate,$TypeError=TypeError;$$8({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=aSet$1(this),r=arguments.length<2,n=r?void 0:arguments[1];if(aCallable(e),iterate$1(t,(function(a){r?(r=!1,n=a):n=e(n,a,a,t)})),r)throw $TypeError("Reduce of empty set with no initial value");return n}});var $$7=_export,bind2=functionBindContext,aSet=aSet$g,iterate=setIterate;$$7({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=aSet(this),r=bind2(e,arguments.length>1?arguments[1]:void 0);return!0===iterate(t,(function(e){if(r(e,e,t))return!0}),!0)}});var $$6=_export,call$1=functionCall,toSetLike$1=toSetLike$7,$symmetricDifference=setSymmetricDifference;$$6({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){return call$1($symmetricDifference,this,toSetLike$1(e))}});var $$5=_export,call=functionCall,toSetLike=toSetLike$7,$union=setUnion;$$5({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){return call($union,this,toSetLike(e))}});var parent$l=set$3,set$2=parent$l,set$1=set$2,set2=set$1,_Set=getDefaultExportFromCjs(set2),$$4=_export,$includes=arrayIncludes.includes,fails=fails$A,BROKEN_ON_SPARSE=fails((function(){return!Array(1).includes()}));$$4({target:"Array",proto:!0,forced:BROKEN_ON_SPARSE},{includes:function(e){return $includes(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$4=entryVirtual$n,includes$7=entryVirtual$4("Array").includes,$$3=_export,uncurryThis$1=functionUncurryThis,notARegExp=notARegexp,requireObjectCoercible=requireObjectCoercible$8,toString4=toString$g,correctIsRegExpLogic=correctIsRegexpLogic,stringIndexOf=uncurryThis$1("".indexOf);$$3({target:"String",proto:!0,forced:!correctIsRegExpLogic("includes")},{includes:function(e){return!!~stringIndexOf(toString4(requireObjectCoercible(this)),toString4(notARegExp(e)),arguments.length>1?arguments[1]:void 0)}});var entryVirtual$3=entryVirtual$n,includes$6=entryVirtual$3("String").includes,isPrototypeOf$3=objectIsPrototypeOf,arrayMethod=includes$7,stringMethod=includes$6,ArrayPrototype$3=Array.prototype,StringPrototype=String.prototype,includes$5=function(e){var t=e.includes;return e===ArrayPrototype$3||isPrototypeOf$3(ArrayPrototype$3,e)&&t===ArrayPrototype$3.includes?arrayMethod:"string"==typeof e||e===StringPrototype||isPrototypeOf$3(StringPrototype,e)&&t===StringPrototype.includes?stringMethod:t},parent$k=includes$5,includes$4=parent$k,parent$j=includes$4,includes$3=parent$j,parent$i=includes$3,includes$2=parent$i,includes$1=includes$2,includes4=includes$1,_includesInstanceProperty=getDefaultExportFromCjs(includes4),$$2=_export,isIntegralNumber=isIntegralNumber$2;$$2({target:"Number",stat:!0},{isInteger:isIntegralNumber});var path$1=path$x,isInteger$5=path$1.Number.isInteger,parent$h=isInteger$5,isInteger$4=parent$h,parent$g=isInteger$4,isInteger$3=parent$g,parent$f=isInteger$3,isInteger$2=parent$f,isInteger$1=isInteger$2,isInteger2=isInteger$1,_Number$isInteger=getDefaultExportFromCjs(isInteger2),DESCRIPTORS=descriptors,uncurryThis=functionUncurryThis,objectKeys=objectKeys$4,toIndexedObject=toIndexedObject$c,$propertyIsEnumerable=objectPropertyIsEnumerable.f,propertyIsEnumerable3=uncurryThis($propertyIsEnumerable),push2=uncurryThis([].push),createMethod=function(e){return function(t){for(var r,n=toIndexedObject(t),a=objectKeys(n),i=a.length,s=0,o=[];i>s;)r=a[s++],DESCRIPTORS&&!propertyIsEnumerable3(n,r)||push2(o,e?[r,n[r]]:n[r]);return o}},objectToArray={entries:createMethod(!0),values:createMethod(!1)},$$1=_export,$entries=objectToArray.entries;$$1({target:"Object",stat:!0},{entries:function(e){return $entries(e)}});var path=path$x,entries$c=path.Object.entries,parent$e=entries$c,entries$b=parent$e,parent$d=entries$b,entries$a=parent$d,parent$c=entries$a,entries$9=parent$c,entries$8=entries$9,entries$7=entries$8,_Object$entries=getDefaultExportFromCjs(entries$7),entryVirtual$2=entryVirtual$n,entries$6=entryVirtual$2("Array").entries,parent$b=entries$6,entries$5=parent$b,classof$1=classof$g,hasOwn$1=hasOwnProperty_1,isPrototypeOf$2=objectIsPrototypeOf,method$2=entries$5,ArrayPrototype$2=Array.prototype,DOMIterables$1={DOMTokenList:!0,NodeList:!0},entries$4=function(e){var t=e.entries;return e===ArrayPrototype$2||isPrototypeOf$2(ArrayPrototype$2,e)&&t===ArrayPrototype$2.entries||hasOwn$1(DOMIterables$1,classof$1(e))?method$2:t},parent$a=entries$4,entries$3=parent$a,parent$9=entries$3,entries$2=parent$9,entries$1=entries$2,entries3=entries$1,_entriesInstanceProperty=getDefaultExportFromCjs(entries3),$=_export,$find=arrayIteration.find,FIND="find",SKIPS_HOLES=!0;FIND in[]&&Array(1)[FIND]((function(){SKIPS_HOLES=!1})),$({target:"Array",proto:!0,forced:SKIPS_HOLES},{find:function(e){return $find(this,e,arguments.length>1?arguments[1]:void 0)}});var entryVirtual$1=entryVirtual$n,find$6=entryVirtual$1("Array").find,isPrototypeOf$1=objectIsPrototypeOf,method$1=find$6,ArrayPrototype$1=Array.prototype,find$5=function(e){var t=e.find;return e===ArrayPrototype$1||isPrototypeOf$1(ArrayPrototype$1,e)&&t===ArrayPrototype$1.find?method$1:t},parent$8=find$5,find$4=parent$8,parent$7=find$4,find$3=parent$7,parent$6=find$3,find$2=parent$6,find$1=find$2,find4=find$1,_findInstanceProperty=getDefaultExportFromCjs(find4),entryVirtual=entryVirtual$n,values$6=entryVirtual("Array").values,parent$5=values$6,values$5=parent$5,classof=classof$g,hasOwn2=hasOwnProperty_1,isPrototypeOf=objectIsPrototypeOf,method=values$5,ArrayPrototype=Array.prototype,DOMIterables={DOMTokenList:!0,NodeList:!0},values$4=function(e){var t=e.values;return e===ArrayPrototype||isPrototypeOf(ArrayPrototype,e)&&t===ArrayPrototype.values||hasOwn2(DOMIterables,classof(e))?method:t},parent$4=values$4,values$3=parent$4,parent$3=values$3,values$2=parent$3,values$1=values$2,values2=values$1,_valuesInstanceProperty=getDefaultExportFromCjs(values2),WrappedWellKnownSymbolModule=wellKnownSymbolWrapped,toStringTag$5=WrappedWellKnownSymbolModule.f("toStringTag"),parent$2=toStringTag$5,toStringTag$4=parent$2,parent$1=toStringTag$4,toStringTag$3=parent$1,parent=toStringTag$3,toStringTag$2=parent,toStringTag$1=toStringTag$2,toStringTag=toStringTag$1,_Symbol$toStringTag=getDefaultExportFromCjs(toStringTag),index_min$1={exports:{}};!function(e){var t,r,n;function a(e,t){var r=_Object$keys(e);if(_Object$getOwnPropertySymbols){var n=_Object$getOwnPropertySymbols(e);t&&(n=_filterInstanceProperty(n).call(n,(function(t){return _Object$getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?_forEachInstanceProperty(r=a(Object(i),!0)).call(r,(function(t){u(e,t,i[t])})):_Object$getOwnPropertyDescriptors?_Object$defineProperties(e,_Object$getOwnPropertyDescriptors(i)):_forEachInstanceProperty(n=a(Object(i))).call(n,(function(t){_Object$defineProperty(e,t,_Object$getOwnPropertyDescriptor(i,t))}))}return e}function s(e){return(s="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 o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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,f(n.key),n)}}function c(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),_Object$defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,r){return(t=f(t))in e?_Object$defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){return function(e){if(_Array$isArray(e))return d(e)}(e)||function(e){if(void 0!==_Symbol&&null!=_getIteratorMethod(e)||null!=e["@@iterator"])return _Array$from(e)}(e)||function(e,t,r){if(e){if("string"==typeof e)return d(e,t);var n=_sliceInstanceProperty(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?_Array$from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e)||function(){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 d(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 f(e){var t=function(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)}(e,"string");return"symbol"==_typeof(t)?t:String(t)}var p="undefined"!=typeof window&&window.location&&_indexOfInstanceProperty(t=window.location.href).call(t,"xgplayerdebugger=1")>-1,y={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},g="%c[xgplayer]",v={config:{debug:p?3:0},logInfo:function(e){for(var t,r,n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];this.config.debug>=3&&(r=console).log.apply(r,_concatInstanceProperty(t=[g,y.info,e]).call(t,a))},logWarn:function(e){for(var t,r,n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];this.config.debug>=1&&(r=console).warn.apply(r,_concatInstanceProperty(t=[g,y.warn,e]).call(t,a))},logError:function(e){var t;if(!(this.config.debug<1)){for(var r,n=this.config.debug>=2?"trace":"error",a=arguments.length,i=new Array(a>1?a-1:0),s=1;s<a;s++)i[s-1]=arguments[s];(t=console)[n].apply(t,_concatInstanceProperty(r=[g,y.error,e]).call(r,i))}}},m=function(){function e(t){o(this,e),this.bufferedList=t}return c(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}(),$={};function S(e,t){for(var r=0,n=t.length;r<n;r++)if(_indexOfInstanceProperty(e).call(e,t[r])>-1)return!0;return!1}function I(e,t,r){for(var n,a,i=arguments.length,s=new Array(i>3?i-3:0),o=3;o<i;o++)s[o-3]=arguments[o];var l=t.call.apply(t,_concatInstanceProperty(n=[e]).call(n,s));r&&"function"==typeof r&&(l&&l.then?l.then((function(){for(var t,n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];r.call.apply(r,_concatInstanceProperty(t=[e]).call(t,a))})):r.call.apply(r,_concatInstanceProperty(a=[e]).call(a,s)))}function _(e,t){var r,n=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),_bindInstanceProperty(r=function(){var r,a=arguments,i=this;if(n.pre)try{var s,o;(o=n.pre).call.apply(o,_concatInstanceProperty(s=[this]).call(s,_sliceInstanceProperty(Array.prototype).call(arguments)))}catch(t){var l,c;throw t.message=_concatInstanceProperty(l=_concatInstanceProperty(c="[pluginName: ".concat(this.pluginName,":")).call(c,e,":pre error] >> ")).call(l,t.message),t}if(this.__hooks&&this.__hooks[e])try{var u,d,f=b(this,e,t);f?f.then?f.then((function(e){var r;!1!==e&&I.apply(void 0,_concatInstanceProperty(r=[i,t,n.next]).call(r,h(a)))})).catch((function(e){throw e})):I.apply(void 0,_concatInstanceProperty(u=[this,t,n.next]).call(u,_sliceInstanceProperty(Array.prototype).call(arguments))):void 0===f&&I.apply(void 0,_concatInstanceProperty(d=[this,t,n.next]).call(d,_sliceInstanceProperty(Array.prototype).call(arguments)))}catch(t){var p,y;throw t.message=_concatInstanceProperty(p=_concatInstanceProperty(y="[pluginName: ".concat(this.pluginName,":")).call(y,e,"] >> ")).call(p,t.message),t}else I.apply(void 0,_concatInstanceProperty(r=[this,t,n.next]).call(r,_sliceInstanceProperty(Array.prototype).call(arguments)))}).call(r,this)}function E(e,t){var r=this.__hooks;if(!r||!_Array$isArray(r[e]))return-1;for(var n=r[e],a=0;a<n.length;a++)if(n[a]===t)return a;return-1}function T(e,t){var r=this.__hooks;if(r)return r.hasOwnProperty(e)?(_Array$isArray(r[e])||(r[e]=[]),-1===E.call(this,e,t)&&r[e].push(t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function P(e,t){var r=this.__hooks;if(r){if(_Array$isArray(r[e])){var n=r[e],a=E.call(this,e,t);-1!==a&&_spliceInstanceProperty(n).call(n,a,1)}delete r[e]}}function b(e,t,r){for(var n,a=arguments.length,i=new Array(a>3?a-3:0),s=3;s<a;s++)i[s-3]=arguments[s];if(e.__hooks&&_Array$isArray(e.__hooks[t])){var o,l=e.__hooks[t],c=-1,u=function e(t,r,n){for(var a,i,s,o=arguments.length,u=new Array(o>3?o-3:0),h=3;h<o;h++)u[h-3]=arguments[h];if(c++,0===l.length||c===l.length)return n.call.apply(n,_concatInstanceProperty(a=[t,t]).call(a,u));var d=l[c],f=d.call.apply(d,_concatInstanceProperty(i=[t,t]).call(i,u));return f&&f.then?f.then((function(a){var i;return!1===a?null:e.apply(void 0,_concatInstanceProperty(i=[t,r,n]).call(i,u))})).catch((function(e){console.warn("[runHooks]".concat(r," reject"),e.message)})):!1!==f?e.apply(void 0,_concatInstanceProperty(s=[t,r,n]).call(s,u)):void 0};return u.apply(void 0,_concatInstanceProperty(o=[e,t,r]).call(o,i))}return r.call.apply(r,_concatInstanceProperty(n=[e,e]).call(n,i))}function k(e,t){var r;v.logError(_concatInstanceProperty(r="[".concat(e,"] event or callback cant be undefined or null when call ")).call(r,t))}$.createDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(t);return i.className=a,i.innerHTML=r,_forEachInstanceProperty(e=_Object$keys(n)).call(e,(function(e){var r=e,a=n[e];"video"===t||"audio"===t||"live-video"===t?a&&i.setAttribute(r,a):i.setAttribute(r,a)})),i},$.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,a=document.createElement("div");a.innerHTML=e;var i=a.children;return a=null,i.length>0?(i=i[0],r&&$.addClass(i,r),t&&_forEachInstanceProperty(n=_Object$keys(t)).call(n,(function(e){i.setAttribute(e,t[e])})),i):null}catch(e){return v.logError("util.createDomFromHtml",e),null}},$.hasClass=function(e,t){if(!e||!t)return!1;try{return _someInstanceProperty(Array.prototype).call(e.classList,(function(e){return e===t}))}catch(n){var r=e.className&&"object"===s(e.className)?e.getAttribute("class"):e.className;return r&&!!r.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},$.addClass=function(e,t){if(e&&t)try{var r;_forEachInstanceProperty(r=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(r,(function(t){t&&e.classList.add(t)}))}catch(r){$.hasClass(e,t)||(e.className&&"object"===s(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},$.removeClass=function(e,t){if(e&&t)try{var r;_forEachInstanceProperty(r=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(r,(function(t){t&&e.classList.remove(t)}))}catch(r){var n;$.hasClass(e,t)&&_forEachInstanceProperty(n=t.split(/\s+/g)).call(n,(function(t){var r=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===s(e.className)?e.setAttribute("class",e.getAttribute("class").replace(r," ")):e.className=e.className.replace(r," ")}))}},$.toggleClass=function(e,t){var r;e&&_forEachInstanceProperty(r=t.split(/\s+/g)).call(r,(function(t){$.hasClass(e,t)?$.removeClass(e,t):$.addClass(e,t)}))},$.classNames=function(){for(var e=arguments,t=[],r=function(r){var n;"String"===$.typeOf(e[r])?t.push(e[r]):"Object"===$.typeOf(e[r])&&_mapInstanceProperty(n=_Object$keys(e[r])).call(n,(function(n){e[r][n]&&t.push(n)}))},n=0;n<arguments.length;n++)r(n);return t.join(" ")},$.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){v.logError("util.findDom",n),0===_indexOfInstanceProperty(r).call(r,"#")&&(e=t.getElementById(_sliceInstanceProperty(r).call(r,1)))}return e},$.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},$.padStart=function(e,t,r){for(var n=String(r),a=t>>0,i=Math.ceil(a/n.length),s=[],o=String(e);i--;)s.push(n);return s.join("").substring(0,a-o.length)+o},$.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=_padStartInstanceProperty($).call($,Math.floor(e/3600),2,0),r=_padStartInstanceProperty($).call($,Math.floor((e-3600*t)/60),2,0),n=_padStartInstanceProperty($).call($,Math.floor(e-3600*t-60*r),2,0);return("00"===t?[r,n]:[t,r,n]).join(":")},$.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},$.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},$.deepCopy=function(e,t){var r;if("Object"===$.typeOf(t)&&"Object"===$.typeOf(e))return _forEachInstanceProperty(r=_Object$keys(t)).call(r,(function(r){var n;"Object"!==$.typeOf(t[r])||t[r]instanceof Node?"Array"===$.typeOf(t[r])?e[r]="Array"===$.typeOf(e[r])?_concatInstanceProperty(n=e[r]).call(n,t[r]):t[r]:e[r]=t[r]:void 0===e[r]||void 0===e[r]?e[r]=t[r]:$.deepCopy(e[r],t[r])})),e},$.deepMerge=function(e,t){var r;return _mapInstanceProperty(r=_Object$keys(t)).call(r,(function(r){var n;"Array"===$.typeOf(t[r])&&"Array"===$.typeOf(e[r])?"Array"===$.typeOf(e[r])&&(n=e[r]).push.apply(n,h(t[r])):$.typeOf(e[r])!==$.typeOf(t[r])||null===e[r]||"Object"!==$.typeOf(e[r])||t[r]instanceof window.Node?null!==t[r]&&(e[r]=t[r]):$.deepMerge(e[r],t[r])})),e},$.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},$.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return _forEachInstanceProperty(Array.prototype).call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},$.setInterval=function(e,t,r,n){e._interval[t]||(e._interval[t]=_setInterval(_bindInstanceProperty(r).call(r,e),n))},$.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},$.setTimeout=function(e,t,r){e._timers||(e._timers=[]);var n=_setTimeout((function(){t(),$.clearTimeout(e,n)}),r);return e._timers.push(n),n},$.clearTimeout=function(e,t){var r=e._timers;if("Array"===$.typeOf(r)){for(var n=0;n<r.length;n++)if(r[n]===t){_spliceInstanceProperty(r).call(r,n,1),clearTimeout(t);break}}else clearTimeout(t)},$.clearAllTimers=function(e){var t=e._timers;"Array"===$.typeOf(t)&&(_mapInstanceProperty(t).call(t,(function(e){clearTimeout(e)})),e._timerIds=[])},$.createImgBtn=function(e,t,r,n){var a,i,s,o,l,c,u,h,d,f,p,y,g=$.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));return g.style.backgroundImage='url("'.concat(t,'")'),r&&n&&(_everyInstanceProperty(a=["px","rem","em","pt","dp","vw","vh","vm","%"]).call(a,(function(e){var t,a;return!(_indexOfInstanceProperty(r).call(r,e)>-1&&_indexOfInstanceProperty(n).call(n,e)>-1&&(f=_parseFloat$1(_trimInstanceProperty(t=_sliceInstanceProperty(r).call(r,0,_indexOfInstanceProperty(r).call(r,e))).call(t)),p=_parseFloat$1(_trimInstanceProperty(a=_sliceInstanceProperty(n).call(n,0,_indexOfInstanceProperty(n).call(n,e))).call(a)),y=e,1))})),g.style.width=_concatInstanceProperty(i="".concat(f)).call(i,y),g.style.height=_concatInstanceProperty(s="".concat(p)).call(s,y),g.style.backgroundSize=_concatInstanceProperty(o=_concatInstanceProperty(l=_concatInstanceProperty(c="".concat(f)).call(c,y," ")).call(l,p)).call(o,y),g.style.margin="start"===e?_concatInstanceProperty(u=_concatInstanceProperty(h=_concatInstanceProperty(d="-".concat(p/2)).call(d,y," auto auto -")).call(h,f/2)).call(u,y):"auto 5px auto 5px"),g},$.Hex2RGBA=function(e,t){var r,n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var a="#";e.replace(/[0-9A-F]/gi,(function(e){a+=e+e})),e=a}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(_parseInt$1(e,16))})),_concatInstanceProperty(r="rgba(".concat(n.join(","),", ")).call(r,t,")")):"rgba(255, 255, 255, 0.1)"},$.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},$.checkIsFunction=function(e){return e&&"function"==typeof e},$.checkIsObject=function(e){return null!==e&&"object"===s(e)},$.hide=function(e){e.style.display="none"},$.show=function(e,t){e.style.display=t||"block"},$.isUndefined=function(e){if(null==e)return!0},$.isNotNull=function(e){return!(null==e)},$.setStyleFromCsstext=function(e,t){var r,n;t&&("String"===$.typeOf(t)?_mapInstanceProperty(r=t.replace(/\s+/g,"").split(";")).call(r,(function(t){if(t){var r=t.split(":");r.length>1&&(e.style[r[0]]=r[1])}})):_mapInstanceProperty(n=_Object$keys(t)).call(n,(function(r){e.style[r]=t[r]})))},$.filterStyleFromText=function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["width","height","top","left","bottom","right","position","z-index","padding","margin","transform"],n=e.style.cssText;if(!n)return{};var a=n.replace(/\s+/g,"").split(";"),i={},s={};return _mapInstanceProperty(a).call(a,(function(e){if(e){var t=e.split(":");t.length>1&&(S(t[0],r)?i[t[0]]=t[1]:s[t[0]]=t[1])}})),e.setAttribute("style",""),_mapInstanceProperty(t=_Object$keys(s)).call(t,(function(t){e.style[t]=s[t]})),i},$.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var r=t.replace(/\s+/g,"").split(";"),n={};return _mapInstanceProperty(r).call(r,(function(e){if(e){var t=e.split(":");t.length>1&&(n[t[0]]=t[1])}})),n},$.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}},$.stopPropagation=function(e){e&&e.stopPropagation()},$.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},$.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},$.checkTouchSupport=function(){return"ontouchstart"in window},$.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)});_sortInstanceProperty(r).call(r,(function(e,t){return e.start-t.start||t.end-e.end}));var a=[];if(t)for(var i=0;i<r.length;i++){var s=a.length;if(s){var o=a[s-1].end;r[i].start-o<t?r[i].end>o&&(a[s-1].end=r[i].end):a.push(r[i])}else a.push(r[i])}else a=r;return new m(a)},$.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}},$.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},$.getHostFromUrl=function(e){if("String"!==$.typeOf(e))return"";var t=e.split("/"),r="";return t.length>3&&t[2]&&(r=t[2]),r},$.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},$.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},$.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},$.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=_parseInt$1(e)}catch(t){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=_parseInt$1(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)}))},$.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},$.adjustTimeByDuration=function(e,t,r){return t&&e&&(e>t||r&&e<t)?t:e},$.createPositionBar=function(e,t){var r=$.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(r),r},$.getTransformStyle=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(t.scale||1),translate:_concatInstanceProperty(e="".concat(t.x||0,"%, ")).call(e,t.y||0,"%"),rotate:"".concat(t.rotate||0,"deg")},a=_Object$keys(n);return _forEachInstanceProperty(a).call(a,(function(e){var t,a=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),i=_concatInstanceProperty(t="".concat(e,"(")).call(t,n[e],")");a.test(r)?(a.lastIndex=-1,r=r.replace(a,i)):r+="".concat(i," ")})),r},$.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},$.getIndexByTime=function(e,t){var r=t.length,n=-1;if(r<1)return n;if(e<=t[0].end||r<2)n=0;else if(e>t[r-1].end)n=r-1;else for(var a=1;a<r;a++)if(e>t[a-1].end&&e<=t[a].end){n=a;break}return n},$.getOffsetCurrentTime=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=-1;if((n=r>=0&&r<t.length?r:$.getIndexByTime(e,t))<0)return-1;var a=t.length,i=t[n],s=i.start,o=i.end,l=i.cTime,c=i.offset;return e<s?l:e>=s&&e<=o?e-c:e>o&&n>=a-1?o:-1},$.getCurrentTimeByOffset=function(e,t){var r=-1;if(!t||t.length<0)return e;for(var n=0;n<t.length;n++)if(e<=t[n].duration){r=n;break}if(-1!==r){var a=t[r].start;return r-1<0?a+e:a+(e-t[r-1].duration)}return e};var A,R=function(){function e(t){o(this,e),$.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&_mapInstanceProperty(t).call(t,(function(t){e.__hooks[t]=null})),_Object$defineProperty(e,"hooks",{get:function(){var t;return e.__hooks&&_mapInstanceProperty(t=_Object$keys(e.__hooks)).call(t,(function(t){if(e.__hooks[t])return t}))}})}(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}return c(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=$.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)&&_forEachInstanceProperty(e).call(e,(function(e){r.__events[e]=t,r.player.on(e,t)})):k(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)&&_forEachInstanceProperty(e).call(e,(function(n){r.__onceEvents[n]=t,r.player.once(e,t)})):k(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)&&_forEachInstanceProperty(e).call(e,(function(n){delete r.__events[e],r.player.off(n,t)})):k(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e,t=this;_forEachInstanceProperty(e=["__events","__onceEvents"]).call(e,(function(e){var r;_forEachInstanceProperty(r=_Object$keys(t[e])).call(r,(function(r){t[e][r]&&t.off(r,t[e][r]),r&&delete t[e][r]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t;if(this.player){for(var r,n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];(t=this.player).emit.apply(t,_concatInstanceProperty(r=[e]).call(r,a))}}},{key:"emitUserAction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var n=i(i({},r),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,n)}}},{key:"hook",value:function(e,t){var r;return _.call.apply(_,_concatInstanceProperty(r=[this]).call(r,_sliceInstanceProperty(Array.prototype).call(arguments)))}},{key:"useHooks",value:function(e,t){for(var r,n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];return T.call.apply(T,_concatInstanceProperty(r=[this]).call(r,_sliceInstanceProperty(Array.prototype).call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var r,n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];return P.call.apply(P,_concatInstanceProperty(r=[this]).call(r,_sliceInstanceProperty(Array.prototype).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,t=this,r=this.player,n=this.pluginName;this.offAll(),$.clearAllTimers(this),$.checkIsFunction(this.destroy)&&this.destroy(),_mapInstanceProperty(e=["player","playerConfig","pluginName","logger","__args","__hooks"]).call(e,(function(e){t[e]=null})),r.unRegisterPlugin(n),this.__hooks=null}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&_Object$defineProperty(e,r,t[r])}},{key:"defineMethod",value:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&"function"==typeof t[r]&&_Object$defineProperty(e,r,{configurable:!0,value:t[r]})}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}(),O=_Number$isFinite||function(e){return"number"==typeof e&&isFinite(e)},L=_Number$isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=C},C=_Number$MAX_SAFE_INTEGER||9007199254740991,D=((A={}).NETWORK_ERROR="networkError",A.MEDIA_ERROR="mediaError",A.KEY_SYSTEM_ERROR="keySystemError",A.MUX_ERROR="muxError",A.OTHER_ERROR="otherError",A),w=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.ASSET_LIST_LOAD_ERROR="assetListLoadError",e.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",e.ASSET_LIST_PARSING_ERROR="assetListParsingError",e.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.ATTACH_MEDIA_ERROR="attachMediaError",e.UNKNOWN="unknown",e}({}),x=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFERED_TO_END="hlsBufferedToEnd",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e.ASSET_LIST_LOADING="hlsAssetListLoading",e.ASSET_LIST_LOADED="hlsAssetListLoaded",e.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",e.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",e.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",e.INTERSTITIAL_STARTED="hlsInterstitialStarted",e.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",e.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",e.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",e.INTERSTITIAL_ENDED="hlsInterstitialEnded",e.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",e.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",e.EVENT_CUE_ENTER="hlsEventCueEnter",e}({}),M="manifest",N="level",F="audioTrack",U="subtitleTrack",B="main",j="audio",G="subtitle",K=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;_classCallCheck(this,e),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=r,this.totalWeight_=n}return _createClass(e,[{key:"sample",value:function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}},{key:"getTotalWeight",value:function(){return this.totalWeight_}},{key:"getEstimate",value:function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}]),e}(),H=function(){function e(t,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;_classCallCheck(this,e),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K(t),this.fast_=new K(r),this.defaultTTFB_=a,this.ttfb_=new K(t)}return _createClass(e,[{key:"update",value:function(e,t){var r=this.slow_,n=this.fast_,a=this.ttfb_;r.halfLife!==e&&(this.slow_=new K(e,r.getEstimate(),r.getTotalWeight())),n.halfLife!==t&&(this.fast_=new K(t,n.getEstimate(),n.getTotalWeight())),a.halfLife!==e&&(this.ttfb_=new K(e,a.getEstimate(),a.getTotalWeight()))}},{key:"sample",value:function(e,t){var r=(e=Math.max(e,this.minDelayMs_))/1e3,n=8*t/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}},{key:"sampleTTFB",value:function(e){var t=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(r,Math.max(e,5))}},{key:"canEstimate",value:function(){return this.fast_.getTotalWeight()>=this.minWeight_}},{key:"getEstimate",value:function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}},{key:"getEstimateTTFB",value:function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}},{key:"defaultEstimate",get:function(){return this.defaultEstimate_}},{key:"destroy",value:function(){}}]),e}();function V(e,t,r){return n=function(e,t){if("object"!=_typeof(e)||!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)}(t,"string"),(t="symbol"==_typeof(n)?n:n+"")in e?_Object$defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e;var n}function W(){var e;return W=_Object$assign?_bindInstanceProperty(e=_Object$assign).call(e):function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},W.apply(null,arguments)}function Y(e,t){var r=_Object$keys(e);if(_Object$getOwnPropertySymbols){var n=_Object$getOwnPropertySymbols(e);t&&(n=_filterInstanceProperty(n).call(n,(function(t){return _Object$getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r,n,a=null!=arguments[t]?arguments[t]:{};t%2?_forEachInstanceProperty(r=Y(Object(a),!0)).call(r,(function(t){V(e,t,a[t])})):_Object$getOwnPropertyDescriptors?_Object$defineProperties(e,_Object$getOwnPropertyDescriptors(a)):_forEachInstanceProperty(n=Y(Object(a))).call(n,(function(t){_Object$defineProperty(e,t,_Object$getOwnPropertyDescriptor(a,t))}))}return e}var z=_createClass((function e(t,r){var n,a,i,s,o;_classCallCheck(this,e),this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;var l="[".concat(t,"]:");this.trace=X,this.debug=_bindInstanceProperty(n=r.debug).call(n,null,l),this.log=_bindInstanceProperty(a=r.log).call(a,null,l),this.warn=_bindInstanceProperty(i=r.warn).call(i,null,l),this.info=_bindInstanceProperty(s=r.info).call(s,null,l),this.error=_bindInstanceProperty(o=r.error).call(o,null,l)})),X=function(){},Q={trace:X,debug:X,log:X,warn:X,info:X,error:X};function J(){return W({},Q)}function Z(e,t,r){var n,a,i,s,o;return t[e]?_bindInstanceProperty(n=t[e]).call(n,t):(a=e,i=r,(o=self.console[a])?_bindInstanceProperty(o).call(o,self.console,_concatInstanceProperty(s="".concat(i?"["+i+"] ":"","[")).call(s,a,"] >")):X)}var ee=J(),te=ee;function re(){if("undefined"!=typeof self)return(!(arguments.length>0&&void 0!==arguments[0])||arguments[0]||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function ne(e,t){var r=_Object$keys(e),n=_Object$keys(t),a=r.length,i=n.length;return!a||!i||a===i&&!_someInstanceProperty(r).call(r,(function(e){return-1===_indexOfInstanceProperty(n).call(n,e)}))}var ae={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function ie(e,t){var r,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return!_someInstanceProperty(r=e.split(",")).call(r,(function(e){return!se(e,t,n)}))}function se(e,t){var r,n=re(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);return null!=(r=null==n?void 0:n.isTypeSupported(oe(e,t)))&&r}function oe(e,t){var r;return _concatInstanceProperty(r="".concat(t,"/mp4;codecs=")).call(r,e)}function le(e){if(e){var t=e.substring(0,4);return ae.video[t]}return 2}function ce(e){var t;return _reduceInstanceProperty(t=e.split(",")).call(t,(function(e,t){var r=ae.video[t];return r?(2*r+e)/(e?3:2):(ae.audio[t]+e)/(e?2:1)}),0)}var ue={},he=/flac|opus|mp4a\.40\.34/i;function de(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.replace(he,(function(e){return function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(ue[e])return ue[e];for(var r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e],n=0;n<r.length;n++){var a;if(se(r[n],"audio",t))return ue[e]=r[n],r[n];if("mp3"===r[n]&&null!=(a=re(t))&&a.isTypeSupported("audio/mpeg"))return""}return e}(e.toLowerCase(),t)}))}function fe(e,t){var r;if(e&&(e.length>4||-1!==_indexOfInstanceProperty(r=["ac-3","ec-3","alac","fLaC","Opus"]).call(r,e)))return e;if(t){var n=t.split(",");if(n.length>1){if(e)for(var a=n.length;a--;)if(n[a].substring(0,4)===e.substring(0,4))return n[a];return n[0]}}return t||e}function pe(e){if(_startsWithInstanceProperty(e).call(e,"av01.")){for(var t=e.split("."),r=["0","111","01","01","01","0"],n=t.length;n>4&&n<10;n++)t[n]=r[n-4];return t.join(".")}return e}function ye(e){var t=re(e)||{isTypeSupported:function(){return!1}};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}var ge={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},ve={};function me(e,t,r,n,a,i){var s,o=e.audioCodec?e.audioGroups:null,l=null==i?void 0:i.audioCodec,c=null==i?void 0:i.channels,u=c?_parseInt$1(c):l?1/0:2,h=null;if(null!=o&&o.length)try{h=1===o.length&&o[0]?t.groups[o[0]].channels:_reduceInstanceProperty(o).call(o,(function(e,r){if(r){var n,a=t.groups[r];if(!a)throw new Error("Audio track group ".concat(r," not found"));_forEachInstanceProperty(n=_Object$keys(a.channels)).call(n,(function(t){e[t]=(e[t]||0)+a.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(n,30)||"SDR"!==e.videoRange&&e.videoRange!==r||e.bitrate>Math.max(a,8e6))||!!h&&O(u)&&_someInstanceProperty(s=_Object$keys(h)).call(s,(function(e){return _parseInt$1(e)>u}))}function $e(e,t,r){var n,a=e.videoCodec,i=e.audioCodec;if(!a&&!i||!r)return _Promise.resolve(ge);var s=[];if(a){var o,l={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},c=e.videoRange;"SDR"!==c&&(l.transferFunction=c.toLowerCase()),s.push.apply(s,_mapInstanceProperty(o=a.split(",")).call(o,(function(e){return{type:"media-source",video:q(q({},l),{},{contentType:oe(pe(e),"video")})}})))}return i&&e.audioGroups&&_forEachInstanceProperty(n=e.audioGroups).call(n,(function(e){var r,n;e&&(null==(n=t.groups[e])||_forEachInstanceProperty(r=n.tracks).call(r,(function(t){if(t.groupId===e){var r,n=t.channels||"",a=_parseFloat$1(n);O(a)&&a>2&&s.push.apply(s,_mapInstanceProperty(r=i.split(",")).call(r,(function(e){return{type:"media-source",audio:{contentType:oe(e,"audio"),channels:""+a}}})))}})))})),_Promise.all(_mapInstanceProperty(s).call(s,(function(e){var t=function(e){var t=e.audio,r=e.video,n=r||t;if(n){var a,i,s,o,l,c,u,h=n.contentType.split('"')[1];if(r)return _concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o=_concatInstanceProperty(l="r".concat(r.height,"x")).call(l,r.width,"f")).call(o,Math.ceil(r.framerate))).call(s,r.transferFunction||"sd","_")).call(i,h,"_")).call(a,Math.ceil(r.bitrate/1e5));if(t)return _concatInstanceProperty(c=_concatInstanceProperty(u="c".concat(t.channels)).call(u,t.spatialRendering?"s":"n","_")).call(c,h)}return""}(e);return ve[t]||(ve[t]=r.decodingInfo(e))}))).then((function(e){return{supported:!_someInstanceProperty(e).call(e,(function(e){return!e.supported})),configurations:s,decodingInfoResults:e}})).catch((function(e){return{supported:!1,configurations:s,decodingInfoResults:[],error:e}}))}var Se=["NONE","TYPE-0","TYPE-1",null],Ie=["SDR","PQ","HLG"],_e="",Ee="YES",Te="v2";function Pe(e){var t=e.canSkipUntil,r=e.canSkipDateRanges,n=e.age;return t&&n<t/2?r?Te:Ee:_e}var be=function(){function e(t,r,n){_classCallCheck(this,e),this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=r,this.skip=n}return _createClass(e,[{key:"addDirectives",value:function(e){var t=new _URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}]),e}(),ke=function(){function e(t){var r,n;_classCallCheck(this,e),this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=_mapInstanceProperty(r=_filterInstanceProperty(n=[t.videoCodec,t.audioCodec]).call(n,(function(e){return!!e}))).call(r,(function(e){return e.substring(0,4)})).join(","),this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}return _createClass(e,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"averageBitrate",get:function(){return this._avgBitrate||this.realBitrate||this.bitrate}},{key:"attrs",get:function(){return this._attrs[0]}},{key:"codecs",get:function(){return this.attrs.CODECS||""}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"videoRange",get:function(){return this.attrs["VIDEO-RANGE"]||"SDR"}},{key:"score",get:function(){return this.attrs.optionalFloat("SCORE",0)}},{key:"uri",get:function(){return this.url[0]||""}},{key:"hasAudioGroup",value:function(e){return Ae(this._audioGroups,e)}},{key:"hasSubtitleGroup",value:function(e){return Ae(this._subtitleGroups,e)}},{key:"audioGroups",get:function(){return this._audioGroups}},{key:"subtitleGroups",get:function(){return this._subtitleGroups}},{key:"addGroupId",value:function(e,t){if(t)if("audio"===e){var r=this._audioGroups;r||(r=this._audioGroups=[]),-1===_indexOfInstanceProperty(r).call(r,t)&&r.push(t)}else if("text"===e){var n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),-1===_indexOfInstanceProperty(n).call(n,t)&&n.push(t)}}},{key:"urlId",get:function(){return 0},set:function(e){}},{key:"audioGroupIds",get:function(){return this.audioGroups?[this.audioGroupId]:void 0}},{key:"textGroupIds",get:function(){return this.subtitleGroups?[this.textGroupId]:void 0}},{key:"audioGroupId",get:function(){var e;return null==(e=this.audioGroups)?void 0:e[0]}},{key:"textGroupId",get:function(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}},{key:"addFallback",value:function(){}}]),e}();function Ae(e,t){return!(!t||!e)&&-1!==_indexOfInstanceProperty(e).call(e,t)}function Re(e,t){var r=!1,n=[];if(e&&(r="SDR"!==e,n=[e]),t){var a="SDR"!==(n=t.allowedVideoRanges||_sliceInstanceProperty(Ie).call(Ie,0)).join("")&&!t.videoCodec;(r=void 0!==t.preferHDR?t.preferHDR:a&&function(){if("function"==typeof matchMedia){var e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}())||(n=["SDR"])}return{preferHDR:r,allowedVideoRanges:n}}function Oe(e,t){var r;te.log(_concatInstanceProperty(r='[abr] start candidates with "'.concat(e,'" ignored because ')).call(r,t))}function Le(e){return _reduceInstanceProperty(e).call(e,(function(e,t){var r=e.groups[t.groupId];r||(r=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(t);var n=t.channels||"2";return r.channels[n]=(r.channels[n]||0)+1,r.hasDefault=r.hasDefault||t.default,r.hasAutoSelect=r.hasAutoSelect||t.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Ce(e){return e?{lang:e.lang,assocLang:e.assocLang,characteristics:e.characteristics,channels:e.channels,audioCodec:e.audioCodec}:e}function De(e,t,r){if("attrs"in e){var n=_indexOfInstanceProperty(t).call(t,e);if(-1!==n)return n}for(var a=0;a<t.length;a++)if(we(e,t[a],r))return a;return-1}function we(e,t,r){var n=e.groupId,a=e.name,i=e.lang,s=e.assocLang,o=e.characteristics,l=e.default,c=e.forced;return(void 0===n||t.groupId===n)&&(void 0===a||t.name===a)&&(void 0===i||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--";return e.length===t.length?e===t:_startsWithInstanceProperty(e).call(e,t)||_startsWithInstanceProperty(t).call(t,e)}(i,t.lang))&&(void 0===i||t.assocLang===s)&&(void 0===l||t.default===l)&&(void 0===c||t.forced===c)&&(void 0===o||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split(","),n=t.split(",");return r.length===n.length&&!_someInstanceProperty(r).call(r,(function(e){return-1===_indexOfInstanceProperty(n).call(n,e)}))}(o,t.characteristics))&&(void 0===r||r(e,t))}function xe(e,t){var r=e.audioCodec,n=e.channels;return!(void 0!==r&&(t.audioCodec||"").substring(0,4)!==r.substring(0,4)||void 0!==n&&n!==(t.channels||"2"))}function Me(e,t,r){for(var n=t;n>-1;n--)if(r(e[n]))return n;for(var a=t+1;a<e.length;a++)if(r(e[a]))return a;return-1}function Ne(e,t){var r;return!!e&&e!==(null==(r=t.levels[t.loadLevel])?void 0:r.uri)}var Fe=function(e,t){for(var r=0,n=e.length-1,a=null,i=null;r<=n;){var s=t(i=e[a=(r+n)/2|0]);if(s>0)r=a+1;else{if(!(s<0))return i;n=a-1}}return null};function Ue(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.005,i=null;if(e){i=t[1+e.sn-t[0].sn]||null;var s=e.endDTS-r;s>0&&s<15e-7&&(r+=15e-7),i&&e.level!==i.level&&i.end<=e.end&&(i=t[2+e.sn-t[0].sn]||null)}else 0===r&&0===t[0].start&&(i=t[0]);if(i&&((!e||e.level===i.level)&&0===Be(r,n,i)||function(e,t,r){if(t&&0===t.start&&t.level<e.level&&(t.endPTS||0)>0){var n,a=_reduceInstanceProperty(n=t.tagList).call(n,(function(e,t){return"INF"===t[0]&&(e+=_parseFloat$1(t[1])),e}),r);return e.start<=a}return!1}(i,e,Math.min(a,n))))return i;var o=Fe(t,_bindInstanceProperty(Be).call(Be,null,r,n));return!o||o===e&&i?i:o}function Be(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;if(r.start<=e&&r.start+r.duration>e)return 0;var n=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-n<=e?1:r.start-n>e&&r.start?-1:0}function je(e,t,r){var n=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-n>e}function Ge(e,t){return Fe(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}function Ke(e){switch(e.details){case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_TIMEOUT:case w.LEVEL_LOAD_TIMEOUT:case w.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function He(e,t){var r=Ke(t);return e.default[(r?"timeout":"error")+"Retry"]}function Ve(e,t){var r="linear"===e.backoff?1:Math.pow(2,t);return Math.min(r*e.retryDelayMs,e.maxRetryDelayMs)}function We(e){return q(q({},e),{errorRetry:null,timeoutRetry:null})}function Ye(e,t,r,n){if(!e)return!1;var a,i=null==n?void 0:n.code,s=t<e.maxNumRetry&&(0===(a=i)&&!1===navigator.onLine||!!a&&(a<400||a>499)||!!r);return e.shouldRetry?e.shouldRetry(e,t,r,n,s):s}var qe=0,ze=2,Xe=3,Qe=5,Je=0,Ze=1,et=2;function tt(e){var t={action:qe,flags:Je};return e&&(t.resolved=!0),t}var rt="NOT_LOADED",nt="APPENDING",at="PARTIAL",it="OK",st=function(){function e(t){_classCallCheck(this,e),this.activePartLists=_Object$create(null),this.endListFragments=_Object$create(null),this.fragments=_Object$create(null),this.timeRanges=_Object$create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=t,this._registerListeners()}return _createClass(e,[{key:"_registerListeners",value:function(){var e=this.hls;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.BUFFER_APPENDED,this.onBufferAppended,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this),e.on(x.FRAG_LOADED,this.onFragLoaded,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.BUFFER_APPENDED,this.onBufferAppended,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this),e.off(x.FRAG_LOADED,this.onFragLoaded,this)}},{key:"destroy",value:function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}},{key:"getAppendedFrag",value:function(e,t){var r=this.activePartLists[t];if(r)for(var n=r.length;n--;){var a=r[n];if(!a)break;var i=a.end;if(a.start<=e&&null!==i&&e<=i)return a}return this.getBufferedFrag(e,t)}},{key:"getBufferedFrag",value:function(e,t){return this.getFragAtPos(e,t,!0)}},{key:"getFragAtPos",value:function(e,t,r){for(var n=this.fragments,a=_Object$keys(n),i=a.length;i--;){var s=n[a[i]];if((null==s?void 0:s.body.type)===t&&(!r||s.buffered)){var o=s.body;if(o.start<=e&&e<=o.end)return o}}return null}},{key:"detectEvictedFragments",value:function(e,t,r,n,a){var i,s=this;this.timeRanges&&(this.timeRanges[e]=t);var o=(null==n?void 0:n.fragment.sn)||-1;_forEachInstanceProperty(i=_Object$keys(this.fragments)).call(i,(function(n){var i,l=s.fragments[n];if(l&&!(o>=l.body.sn))if(l.buffered||l.loaded&&!a){var c=l.range[e];c&&(0!==c.time.length?_someInstanceProperty(i=c.time).call(i,(function(e){var r=!s.isTimeBuffered(e.startPTS,e.endPTS,t);return r&&s.removeFragment(l.body),r})):s.removeFragment(l.body))}else l.body.type===r&&s.removeFragment(l.body)}))}},{key:"detectPartialFragments",value:function(e){var t,r=this,n=this.timeRanges;if(n&&"initSegment"!==e.frag.sn){var a=e.frag,i=lt(a),s=this.fragments[i];if(!(!s||s.buffered&&a.gap)){var o=!a.relurl;_forEachInstanceProperty(t=_Object$keys(n)).call(t,(function(t){var i=a.elementaryStreams[t];if(i){var l=n[t],c=o||!0===i.partial;s.range[t]=r.getBufferedTimes(a,e.part,c,l)}})),s.loaded=null,_Object$keys(s.range).length?(s.buffered=!0,(s.body.endList=a.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),ot(s)||this.removeParts(a.sn-1,a.type)):this.removeFragment(s.body)}}}},{key:"removeParts",value:function(e,t){var r=this.activePartLists[t];r&&(this.activePartLists[t]=_filterInstanceProperty(r).call(r,(function(t){return t.fragment.sn>=e})))}},{key:"fragBuffered",value:function(e,t){var r=lt(e),n=this.fragments[r];!n&&t&&(n=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:_Object$create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}},{key:"getBufferedTimes",value:function(e,t,r,n){for(var a={time:[],partial:r},i=e.start,s=e.end,o=e.minEndPTS||s,l=e.maxStartPTS||i,c=0;c<n.length;c++){var u=n.start(c)-this.bufferPadding,h=n.end(c)+this.bufferPadding;if(l>=u&&o<=h){a.time.push({startPTS:Math.max(i,n.start(c)),endPTS:Math.min(s,n.end(c))});break}if(i<h&&s>u){var d=Math.max(i,n.start(c)),f=Math.min(s,n.end(c));f>d&&(a.partial=!0,a.time.push({startPTS:d,endPTS:f}))}else if(s<=u)break}return a}},{key:"getPartialFragment",value:function(e){var t,r,n,a,i=null,s=0,o=this.bufferPadding,l=this.fragments;return _forEachInstanceProperty(t=_Object$keys(l)).call(t,(function(t){var c=l[t];c&&ot(c)&&(n=c.body.start-o,a=c.body.end+o,e>=n&&e<=a&&(r=Math.min(e-n,a-e),s<=r&&(i=c.body,s=r)))})),i}},{key:"isEndListAppended",value:function(e){var t=this.endListFragments[e];return void 0!==t&&(t.buffered||ot(t))}},{key:"getState",value:function(e){var t=lt(e),r=this.fragments[t];return r?r.buffered?ot(r)?at:it:nt:rt}},{key:"isTimeBuffered",value:function(e,t,r){for(var n,a,i=0;i<r.length;i++){if(n=r.start(i)-this.bufferPadding,a=r.end(i)+this.bufferPadding,e>=n&&t<=a)return!0;if(t<=n)return!1}return!1}},{key:"onManifestLoading",value:function(){this.removeAllFragments()}},{key:"onFragLoaded",value:function(e,t){if("initSegment"!==t.frag.sn&&!t.frag.bitrateTest){var r=t.frag,n=t.part?null:t,a=lt(r);this.fragments[a]={body:r,appendedPTS:null,loaded:n,buffered:!1,range:_Object$create(null)}}}},{key:"onBufferAppended",value:function(e,t){var r=t.frag,n=t.part,a=t.timeRanges,i=t.type;if("initSegment"!==r.sn){var s=r.type;if(n){var o=this.activePartLists[s];o||(this.activePartLists[s]=o=[]),o.push(n)}this.timeRanges=a;var l=a[i];this.detectEvictedFragments(i,l,s,n)}}},{key:"onFragBuffered",value:function(e,t){this.detectPartialFragments(t)}},{key:"hasFragment",value:function(e){var t=lt(e);return!!this.fragments[t]}},{key:"hasFragments",value:function(e){var t=this.fragments,r=_Object$keys(t);if(!e)return r.length>0;for(var n=r.length;n--;){var a=t[r[n]];if((null==a?void 0:a.body.type)===e)return!0}return!1}},{key:"hasParts",value:function(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}},{key:"removeFragmentsInRange",value:function(e,t,r,n,a){var i,s=this;n&&!this.hasGaps||_forEachInstanceProperty(i=_Object$keys(this.fragments)).call(i,(function(i){var o=s.fragments[i];if(o){var l=o.body;l.type!==r||n&&!l.gap||l.start<t&&l.end>e&&(o.buffered||a)&&s.removeFragment(l)}}))}},{key:"removeFragment",value:function(e){var t=lt(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var r=this.activePartLists[e.type];if(r){var n=e.sn;this.activePartLists[e.type]=_filterInstanceProperty(r).call(r,(function(e){return e.fragment.sn!==n}))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}},{key:"removeAllFragments",value:function(){var e,t;this.fragments=_Object$create(null),this.endListFragments=_Object$create(null),this.activePartLists=_Object$create(null),this.hasGaps=!1;var r=null==(e=this.hls)||null==(t=e.latestLevelDetails)?void 0:t.partList;r&&_forEachInstanceProperty(r).call(r,(function(e){return e.clearElementaryStreamInfo()}))}}]),e}();function ot(e){var t,r,n;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(r=e.range.audio)?void 0:r.partial)||(null==(n=e.range.audiovideo)?void 0:n.partial))}function lt(e){var t,r;return _concatInstanceProperty(t=_concatInstanceProperty(r="".concat(e.type,"_")).call(r,e.level,"_")).call(t,e.sn)}var ct=0,ut=1,ht=function(){function e(t,r,n){_classCallCheck(this,e),this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=t,this.aesIV=r,this.aesMode=n}return _createClass(e,[{key:"decrypt",value:function(e,t){switch(this.aesMode){case ct:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case ut:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error("[AESCrypto] invalid aes mode ".concat(this.aesMode))}}}]),e}();function dt(e,t,r){return _sliceInstanceProperty(Uint8Array.prototype)?_sliceInstanceProperty(e).call(e,t,r):new Uint8Array(_sliceInstanceProperty(Array.prototype).call(e,t,r))}var ft=function(){function e(){_classCallCheck(this,e),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}return _createClass(e,[{key:"uint8ArrayToUint32Array_",value:function(e){for(var t=new DataView(e),r=new Uint32Array(4),n=0;n<4;n++)r[n]=t.getUint32(4*n);return r}},{key:"initTable",value:function(){var e=this.sBox,t=this.invSBox,r=this.subMix,n=r[0],a=r[1],i=r[2],s=r[3],o=this.invSubMix,l=o[0],c=o[1],u=o[2],h=o[3],d=new Uint32Array(256),f=0,p=0,y=0;for(y=0;y<256;y++)d[y]=y<128?y<<1:y<<1^283;for(y=0;y<256;y++){var g=p^p<<1^p<<2^p<<3^p<<4;g=g>>>8^255&g^99,e[f]=g,t[g]=f;var v=d[f],m=d[v],$=d[m],S=257*d[g]^16843008*g;n[f]=S<<24|S>>>8,a[f]=S<<16|S>>>16,i[f]=S<<8|S>>>24,s[f]=S,S=16843009*$^65537*m^257*v^16843008*f,l[g]=S<<24|S>>>8,c[g]=S<<16|S>>>16,u[g]=S<<8|S>>>24,h[g]=S,f?(f=v^d[d[d[$^v]]],p^=d[d[p]]):f=p=1}}},{key:"expandKey",value:function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,n=0;n<t.length&&r;)r=t[n]===this.key[n],n++;if(!r){this.key=t;var a=this.keySize=t.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);var i,s,o,l,c=this.ksRows=4*(a+6+1),u=this.keySchedule=new Uint32Array(c),h=this.invKeySchedule=new Uint32Array(c),d=this.sBox,f=this.rcon,p=this.invSubMix,y=p[0],g=p[1],v=p[2],m=p[3];for(i=0;i<c;i++)i<a?o=u[i]=t[i]:(l=o,i%a==0?(l=d[(l=l<<8|l>>>24)>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l],l^=f[i/a|0]<<24):a>6&&i%a==4&&(l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l]),u[i]=o=(u[i-a]^l)>>>0);for(s=0;s<c;s++)i=c-s,l=3&s?u[i]:u[i-4],h[s]=s<4||i<=4?l:y[d[l>>>24]]^g[d[l>>>16&255]]^v[d[l>>>8&255]]^m[d[255&l]],h[s]=h[s]>>>0}}},{key:"networkToHostOrderSwap",value:function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}},{key:"decrypt",value:function(e,t,r){for(var n,a,i,s,o,l,c,u,h,d,f,p,y,g,v=this.keySize+6,m=this.invKeySchedule,$=this.invSBox,S=this.invSubMix,I=S[0],_=S[1],E=S[2],T=S[3],P=this.uint8ArrayToUint32Array_(r),b=P[0],k=P[1],A=P[2],R=P[3],O=new Int32Array(e),L=new Int32Array(O.length),C=this.networkToHostOrderSwap;t<O.length;){for(h=C(O[t]),d=C(O[t+1]),f=C(O[t+2]),p=C(O[t+3]),o=h^m[0],l=p^m[1],c=f^m[2],u=d^m[3],y=4,g=1;g<v;g++)n=I[o>>>24]^_[l>>16&255]^E[c>>8&255]^T[255&u]^m[y],a=I[l>>>24]^_[c>>16&255]^E[u>>8&255]^T[255&o]^m[y+1],i=I[c>>>24]^_[u>>16&255]^E[o>>8&255]^T[255&l]^m[y+2],s=I[u>>>24]^_[o>>16&255]^E[l>>8&255]^T[255&c]^m[y+3],o=n,l=a,c=i,u=s,y+=4;n=$[o>>>24]<<24^$[l>>16&255]<<16^$[c>>8&255]<<8^$[255&u]^m[y],a=$[l>>>24]<<24^$[c>>16&255]<<16^$[u>>8&255]<<8^$[255&o]^m[y+1],i=$[c>>>24]<<24^$[u>>16&255]<<16^$[o>>8&255]<<8^$[255&l]^m[y+2],s=$[u>>>24]<<24^$[o>>16&255]<<16^$[l>>8&255]<<8^$[255&c]^m[y+3],L[t]=C(n^b),L[t+1]=C(s^k),L[t+2]=C(i^A),L[t+3]=C(a^R),b=h,k=d,A=f,R=p,t+=4}return L.buffer}}]),e}(),pt=function(){function e(t,r,n){_classCallCheck(this,e),this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=t,this.key=r,this.aesMode=n}return _createClass(e,[{key:"expandKey",value:function(){var e=function(e){switch(e){case ct:return"AES-CBC";case ut:return"AES-CTR";default:throw new Error("[FastAESKey] invalid aes mode ".concat(e))}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}]),e}();function yt(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("undefined"!=typeof TextDecoder){var r=new TextDecoder("utf-8").decode(e);if(t){var n=_indexOfInstanceProperty(r).call(r,"\0");return-1!==n?r.substring(0,n):r}return r.replace(/\0/g,"")}for(var a,i,s,o=e.length,l="",c=0;c<o;){if(0===(a=e[c++])&&t)return l;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(a);break;case 12:case 13:i=e[c++],l+=String.fromCharCode((31&a)<<6|63&i);break;case 14:i=e[c++],s=e[c++],l+=String.fromCharCode((15&a)<<12|(63&i)<<6|(63&s)<<0)}}return l}var gt=function(e){for(var t="",r=0;r<e.length;r++){var n=e[r].toString(16);n.length<2&&(n="0"+n),t+=n}return t};function vt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mt,$t,St,It,_t,Et={exports:{}};mt=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,$t=/^(?=([^\/?#]*))\1([^]*)$/,St=/(?:\/|^)\.(?=\/)/g,It=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,Et.exports=_t={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=_trimInstanceProperty(e).call(e),!(t=_trimInstanceProperty(t).call(t))){if(!r.alwaysNormalize)return e;var n=_t.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=_t.normalizePath(n.path),_t.buildURLFromParts(n)}var a=_t.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=_t.normalizePath(a.path),_t.buildURLFromParts(a)):t;var i=_t.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");if(!i.netLoc&&i.path&&"/"!==i.path[0]){var s=$t.exec(i.path);i.netLoc=s[1],i.path=s[2]}i.netLoc&&!i.path&&(i.path="/");var o={scheme:i.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(o.netLoc=i.netLoc,"/"!==a.path[0]))if(a.path){var l=i.path,c=l.substring(0,_lastIndexOfInstanceProperty(l).call(l,"/")+1)+a.path;o.path=_t.normalizePath(c)}else o.path=i.path,a.params||(o.params=i.params,a.query||(o.query=i.query));return null===o.path&&(o.path=r.alwaysNormalize?_t.normalizePath(a.path):a.path),_t.buildURLFromParts(o)},parseURL:function(e){var t=mt.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){var t;for(e=_reverseInstanceProperty(r=e.split("")).call(r).join("").replace(St,"");e.length!==(e=e.replace(It,"")).length;)var r;return _reverseInstanceProperty(t=e.split("")).call(t).join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};var Tt=Et.exports,Pt=_createClass((function e(){_classCallCheck(this,e),this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}})),bt="audio",kt="video",At="audiovideo",Rt=function(){function e(t){_classCallCheck(this,e),this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof t&&(t={url:t}),this.base=t}return _createClass(e,[{key:"setByteRange",value:function(e,t){var r,n=e.split("@",2);r=1===n.length?(null==t?void 0:t.byteRangeEndOffset)||0:_parseInt$1(n[1]),this._byteRange=[r,_parseInt$1(n[0])+r]}},{key:"baseurl",get:function(){return this.base.url}},{key:"byteRange",get:function(){return null===this._byteRange?[]:this._byteRange}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"elementaryStreams",get:function(){var e;return null===this._streams&&(this._streams=(_defineProperty(e={},bt,null),_defineProperty(e,kt,null),_defineProperty(e,At,null),e)),this._streams},set:function(e){this._streams=e}},{key:"hasStats",get:function(){return null!==this._stats}},{key:"hasStreams",get:function(){return null!==this._streams}},{key:"stats",get:function(){return null===this._stats&&(this._stats=new Pt),this._stats},set:function(e){this._stats=e}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Tt.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}},{key:"clearElementaryStreamInfo",value:function(){var e=this.elementaryStreams;e[bt]=null,e[kt]=null,e[At]=null}}]),e}();function Ot(e){return"initSegment"!==e.sn}var Lt=function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n){var a;return _classCallCheck(this,r),(a=t.call(this,n))._decryptdata=null,a._programDateTime=null,a._ref=null,a._bitrate=void 0,a.rawProgramDateTime=null,a.tagList=[],a.duration=0,a.sn=0,a.levelkeys=void 0,a.type=void 0,a.loader=null,a.keyLoader=null,a.level=-1,a.cc=0,a.startPTS=void 0,a.endPTS=void 0,a.startDTS=void 0,a.endDTS=void 0,a.start=0,a.playlistOffset=0,a.deltaPTS=void 0,a.maxStartPTS=void 0,a.minEndPTS=void 0,a.data=void 0,a.bitrateTest=!1,a.title=null,a.initSegment=null,a.endList=void 0,a.gap=void 0,a.urlId=0,a.type=e,a}return _createClass(r,[{key:"byteLength",get:function(){if(this.hasStats){var e=this.stats.total;if(e)return e}if(this.byteRange){var t=this.byteRange[0],r=this.byteRange[1];if(O(t)&&O(r))return r-t}return null}},{key:"bitrate",get:function(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null},set:function(e){this._bitrate=e}},{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{var t=_Object$keys(this.levelkeys);if(1===t.length)return this._decryptdata=this.levelkeys[t[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;var e=O(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t=_Object$keys(this.levelkeys),r=t.length;if(r>1||1===r&&this.levelkeys[t[0]].encrypted)return!0}return!1}},{key:"programDateTime",get:function(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime},set:function(e){O(e)?this._programDateTime=e:this._programDateTime=this.rawProgramDateTime=null}},{key:"ref",get:function(){return Ot(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}},{key:"addStart",value:function(e){this.setStart(this.start+e)}},{key:"setStart",value:function(e){this.start=e,this._ref&&(this._ref.start=e)}},{key:"setDuration",value:function(e){this.duration=e,this._ref&&(this._ref.duration=e)}},{key:"setKeyFormat",value:function(e){if(this.levelkeys){var t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}},{key:"abortRequests",value:function(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}},{key:"setElementaryStreamInfo",value:function(e,t,r,n,a){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=this.elementaryStreams,o=s[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,a)):s[e]={startPTS:t,endPTS:r,startDTS:n,endDTS:a,partial:i}}}]),r}(Rt),Ct=function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n,a,i,s){var o;_classCallCheck(this,r),(o=t.call(this,a)).fragOffset=0,o.duration=0,o.gap=!1,o.independent=!1,o.relurl=void 0,o.fragment=void 0,o.index=void 0,o.duration=e.decimalFloatingPoint("DURATION"),o.gap=e.bool("GAP"),o.independent=e.bool("INDEPENDENT"),o.relurl=e.enumeratedString("URI"),o.fragment=n,o.index=i;var l=e.enumeratedString("BYTERANGE");return l&&o.setByteRange(l,s),s&&(o.fragOffset=s.fragOffset+s.duration),o}return _createClass(r,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),r}(Rt),Dt=Math.pow(2,32)-1,wt=[].push,xt={video:1,audio:2,id3:3,text:4};function Mt(e){return String.fromCharCode.apply(null,e)}function Nt(e,t){var r=e[t]<<8|e[t+1];return r<0?65536+r:r}function Ft(e,t){var r=Bt(e,t);return r<0?4294967296+r:r}function Ut(e,t){var r=Ft(e,t);return r*=Math.pow(2,32),r+=Ft(e,t+4)}function Bt(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function jt(e,t,r){e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r}function Gt(e,t){var r=[];if(!t.length)return r;for(var n=e.byteLength,a=0;a<n;){var i=Ft(e,a),s=i>1?a+i:n;if(Mt(e.subarray(a+4,a+8))===t[0])if(1===t.length)r.push(e.subarray(a+8,s));else{var o=Gt(e.subarray(a+8,s),_sliceInstanceProperty(t).call(t,1));o.length&&wt.apply(r,o)}a=s}return r}function Kt(e){var t=[],r=e[0],n=8,a=Ft(e,n);n+=4;var i=0,s=0;0===r?(i=Ft(e,n),s=Ft(e,n+4),n+=8):(i=Ut(e,n),s=Ut(e,n+8),n+=16),n+=2;var o=e.length+s,l=Nt(e,n);n+=2;for(var c=0;c<l;c++){var u=n,h=Ft(e,u);u+=4;var d=2147483647&h;if(1==(2147483648&h)>>>31)return te.warn("SIDX has hierarchical references (not supported)"),null;var f=Ft(e,u);u+=4,t.push({referenceSize:d,subsegmentDuration:f,info:{duration:f/a,start:o,end:o+d-1}}),o+=d,n=u+=4}return{earliestPresentationTime:i,timescale:a,version:r,referencesCount:l,references:t}}function Ht(e){for(var t,r=[],n=Gt(e,["moov","trak"]),a=0;a<n.length;a++){var i=n[a],s=Gt(i,["tkhd"])[0];if(s){var o=s[0],l=Ft(s,0===o?12:20),c=Gt(i,["mdia","mdhd"])[0];if(c){var u=Ft(c,0===(o=c[0])?12:20),h=Gt(i,["mdia","hdlr"])[0];if(h){var d=Mt(h.subarray(8,12)),f={soun:bt,vide:kt}[d];if(f){var p=Vt(Gt(i,["mdia","minf","stbl","stsd"])[0]);r[l]={timescale:u,type:f},r[f]=q({timescale:u,id:l},p)}}}}}return _forEachInstanceProperty(t=Gt(e,["moov","mvex","trex"])).call(t,(function(e){var t=Ft(e,4),n=r[t];n&&(n.default={duration:Ft(e,12),flags:Ft(e,20)})})),r}function Vt(e){var t=e.subarray(8),r=t.subarray(86),n=Mt(t.subarray(4,8)),a=n,i="enca"===n||"encv"===n;if(i){var s,o=Gt(t,[n])[0];_forEachInstanceProperty(s=Gt(o.subarray("enca"===n?28:78),["sinf"])).call(s,(function(e){var t=Gt(e,["schm"])[0];if(t){var r=Mt(t.subarray(4,8));if("cbcs"===r||"cenc"===r){var n=Gt(e,["frma"])[0];n&&(a=Mt(n))}}}))}switch(a){case"avc1":case"avc2":case"avc3":case"avc4":var l=Gt(r,["avcC"])[0];a+="."+Yt(l[1])+Yt(l[2])+Yt(l[3]);break;case"mp4a":var c=Gt(t,[n])[0],u=Gt(c.subarray(28),["esds"])[0];if(u&&u.length>7){var h=4;if(3!==u[h++])break;h=Wt(u,h),h+=2;var d=u[h++];if(128&d&&(h+=2),64&d&&(h+=u[h++]),4!==u[h++])break;h=Wt(u,h);var f=u[h++];if(64!==f)break;if(a+="."+Yt(f),h+=12,5!==u[h++])break;h=Wt(u,h);var p=u[h++],y=(248&p)>>3;31===y&&(y+=1+((7&p)<<3)+((224&u[h])>>5)),a+="."+y}break;case"hvc1":case"hev1":var g=Gt(r,["hvcC"])[0],v=g[1],m=["","A","B","C"][v>>6],$=31&v,S=Ft(g,2),I=(32&v)>>5?"H":"L",_=g[12],E=g.subarray(6,12);a+="."+m+$,a+="."+S.toString(16).toUpperCase(),a+="."+I+_;for(var T="",P=E.length;P--;){var b=E[P];(b||T)&&(T="."+b.toString(16).toUpperCase()+T)}a+=T;break;case"dvh1":case"dvhe":var k=Gt(r,["dvcC"])[0],A=k[2]>>1&127,R=k[2]<<5&32|k[3]>>3&31;a+="."+qt(A)+"."+qt(R);break;case"vp09":var O=Gt(r,["vpcC"])[0],L=O[4],C=O[5],D=O[6]>>4&15;a+="."+qt(L)+"."+qt(C)+"."+qt(D);break;case"av01":var w=Gt(r,["av1C"])[0],x=w[1]>>>5,M=31&w[1],N=w[2]>>>7?"H":"M",F=(64&w[2])>>6,U=(32&w[2])>>5,B=2===x&&F?U?12:10:F?10:8,j=(16&w[2])>>4,G=(8&w[2])>>3,K=(4&w[2])>>2,H=3&w[2],V=1,W=1,Y=1,q=0;a+="."+x+"."+qt(M)+N+"."+qt(B)+"."+j+"."+G+K+H+"."+qt(V)+"."+qt(W)+"."+qt(Y)+"."+q}return{codec:a,encrypted:i}}function Wt(e,t){for(var r=t+5;128&e[t++]&&t<r;);return t}function Yt(e){var t;return _sliceInstanceProperty(t="0"+e.toString(16).toUpperCase()).call(t,-2)}function qt(e){return(e<10?"0":"")+e}function zt(e){var t=Gt(e,["schm"])[0];if(t){var r=Mt(t.subarray(4,8));if("cbcs"===r||"cenc"===r)return Gt(e,["schi","tenc"])[0]}return null}function Xt(e){var t=Ft(e,0),r=8;1&t&&(r+=4),4&t&&(r+=4);for(var n=0,a=Ft(e,4),i=0;i<a;i++)256&t&&(n+=Ft(e,r),r+=4),512&t&&(r+=4),1024&t&&(r+=4),2048&t&&(r+=4);return n}function Qt(e,t){var r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Jt(e,t){var r,n=[],a=t.samples,i=t.timescale,s=t.id,o=!1;return _mapInstanceProperty(r=Gt(a,["moof"])).call(r,(function(r){var l,c=r.byteOffset-8;_mapInstanceProperty(l=Gt(r,["traf"])).call(l,(function(r){var l,u,h=_mapInstanceProperty(l=Gt(r,["tfdt"])).call(l,(function(e){var t=e[0],r=Ft(e,4);return 1===t&&(r*=Math.pow(2,32),r+=Ft(e,8)),r/i}))[0];return void 0!==h&&(e=h),_mapInstanceProperty(u=Gt(r,["tfhd"])).call(u,(function(l){var u,h=Ft(l,4),d=16777215&Ft(l,0),f=0,p=0!=(16&d),y=0,g=0!=(32&d),v=8;h===s&&(0!=(1&d)&&(v+=8),0!=(2&d)&&(v+=4),0!=(8&d)&&(f=Ft(l,v),v+=4),p&&(y=Ft(l,v),v+=4),g&&(v+=4),"video"===t.type&&(o=function(e){if(!e)return!1;var t=_indexOfInstanceProperty(e).call(e,"."),r=t<0?e:e.substring(0,t);return"hvc1"===r||"hev1"===r||"dvh1"===r||"dvhe"===r}(t.codec)),_mapInstanceProperty(u=Gt(r,["trun"])).call(u,(function(r){var s=r[0],l=16777215&Ft(r,0),u=0!=(1&l),h=0,d=0!=(4&l),p=0!=(256&l),g=0,v=0!=(512&l),m=0,$=0!=(1024&l),S=0!=(2048&l),I=0,_=Ft(r,4),E=8;u&&(h=Ft(r,E),E+=4),d&&(E+=4);for(var T=h+c,P=0;P<_;P++){if(p?(g=Ft(r,E),E+=4):g=f,v?(m=Ft(r,E),E+=4):m=y,$&&(E+=4),S&&(I=0===s?Ft(r,E):Bt(r,E),E+=4),t.type===kt)for(var b=0;b<m;){var k=Ft(a,T);Zt(o,a[T+=4])&&er(a.subarray(T,T+k),o?2:1,e+I/i,n),T+=k,b+=k+4}e+=g/i}})))}))}))})),n}function Zt(e,t){if(e){var r=t>>1&63;return 39===r||40===r}return 6==(31&t)}function er(e,t,r,n){var a=tr(e),i=0;i+=t;for(var s=0,o=0,l=0;i<a.length;){s=0;do{if(i>=a.length)break;s+=l=a[i++]}while(255===l);o=0;do{if(i>=a.length)break;o+=l=a[i++]}while(255===l);var c=a.length-i,u=i;if(o<c)i+=o;else if(o>c){var h;te.error(_concatInstanceProperty(h="Malformed SEI payload. ".concat(o," is too small, only ")).call(h,c," bytes left to parse."));break}if(4===s){if(181===a[u++]){var d=Nt(a,u);if(u+=2,49===d){var f=Ft(a,u);if(u+=4,1195456820===f){var p=a[u++];if(3===p){var y=a[u++],g=64&y,v=g?2+3*(31&y):0,m=new Uint8Array(v);if(g){m[0]=y;for(var $=1;$<v;$++)m[$]=a[u++]}n.push({type:p,payloadType:s,pts:r,bytes:m})}}}}}else if(5===s&&o>16){for(var S=[],I=0;I<16;I++){var _=a[u++].toString(16);S.push(1==_.length?"0"+_:_),3!==I&&5!==I&&7!==I&&9!==I||S.push("-")}for(var E=o-16,T=new Uint8Array(E),P=0;P<E;P++)T[P]=a[u++];n.push({payloadType:s,pts:r,uuid:S.join(""),userData:yt(T),userDataBytes:T})}}}function tr(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(0===r.length)return e;var a=t-r.length,i=new Uint8Array(a),s=0;for(n=0;n<a;s++,n++)s===r[0]&&(s++,r.shift()),i[n]=e[s];return i}function rr(e,t,r){if(16!==e.byteLength)throw new RangeError("Invalid system id");var n,a;n=new Uint8Array,a=new Uint8Array;var i=new Uint8Array(4);return r&&r.byteLength>0&&new DataView(i.buffer).setUint32(0,r.byteLength,!1),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];for(var a=r.length,i=8,s=a;s--;)i+=r[s].byteLength;var o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=255&i,o.set(e,4),s=0,i=8;s<a;s++)o.set(r[s],i),i+=r[s].byteLength;return o}([112,115,115,104],new Uint8Array([0,0,0,0]),e,a,n,i,r||new Uint8Array)}function nr(e){var t=e.getUint32(0),r=e.byteOffset,n=e.byteLength;if(n<t)return{offset:r,size:n};if(1886614376!==e.getUint32(4))return{offset:r,size:t};var a=e.getUint32(8)>>>24;if(0!==a&&1!==a)return{offset:r,size:t};var i=e.buffer,s=gt(new Uint8Array(i,r+12,16)),o=e.getUint32(28),l=null,c=null;if(0===a){if(t-32<o||o<22)return{offset:r,size:t};c=new Uint8Array(i,r+32,o)}else if(1===a){if(!o||n<r+32+16*o+16)return{offset:r,size:t};l=[];for(var u=0;u<o;u++)l.push(new Uint8Array(i,r+32+16*u,16))}return{version:a,systemId:s,kids:l,data:c,offset:r,size:t}}var ar=function(){function e(t){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).removePKCS7Padding,n=void 0===r||r;if(_classCallCheck(this,e),this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=t.enableSoftwareAES,this.removePKCS7Padding=n,n)try{var a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(e){}this.useSoftware=!this.subtle}return _createClass(e,[{key:"destroy",value:function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}},{key:"isSync",value:function(){return this.useSoftware}},{key:"flush",value:function(){var e=this.currentResult,t=this.remainderData;if(!e||t)return this.reset(),null;var r,n,a,i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(n=(r=i).byteLength,(a=n&&new DataView(r.buffer).getUint8(n-1))?dt(r,0,n-a):r):i}},{key:"reset",value:function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}},{key:"decrypt",value:function(e,t,r,n){var a=this;return this.useSoftware?new _Promise((function(i,s){var o=ArrayBuffer.isView(e)?e:new Uint8Array(e);a.softwareDecrypt(o,t,r,n);var l=a.flush();l?i(l.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(e),t,r,n)}},{key:"softwareDecrypt",value:function(e,t,r,n){var a=this.currentIV,i=this.currentResult,s=this.remainderData;if(n!==ct||16!==t.byteLength)return te.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),s&&(e=Qt(s,e),this.remainderData=null);var o=this.getValidChunk(e);if(!o.length)return null;a&&(r=a);var l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new ft),l.expandKey(t);var c=i;return this.currentResult=l.decrypt(o.buffer,0,r),this.currentIV=dt(o,-16).buffer,c||null}},{key:"webCryptoDecrypt",value:function(e,t,r,n){var a=this;if(this.key!==t||!this.fastAesKey){if(!this.subtle)return _Promise.resolve(this.onWebCryptoError(e,t,r,n));this.key=t,this.fastAesKey=new pt(this.subtle,t,n)}return this.fastAesKey.expandKey().then((function(t){return a.subtle?(a.logOnce("WebCrypto AES decrypt"),new ht(a.subtle,new Uint8Array(r),n).decrypt(e.buffer,t)):_Promise.reject(new Error("web crypto not initialized"))})).catch((function(i){var s;return te.warn(_concatInstanceProperty(s="[decrypter]: WebCrypto Error, disable WebCrypto API, ".concat(i.name,": ")).call(s,i.message)),a.onWebCryptoError(e,t,r,n)}))}},{key:"onWebCryptoError",value:function(e,t,r,n){var a=this.enableSoftwareAES;if(a){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,r,n);var i=this.flush();if(i)return i.buffer}throw new Error("WebCrypto"+(a?" and softwareDecrypt":"")+": failed to decrypt data")}},{key:"getValidChunk",value:function(e){var t=e,r=e.length-e.length%16;return r!==e.length&&(t=dt(e,0,r),this.remainderData=dt(e,r)),t}},{key:"logOnce",value:function(e){this.logEnabled&&(te.log("[decrypter]: ".concat(e)),this.logEnabled=!1)}}]),e}(),ir=Math.pow(2,17),sr=function(){function e(t){_classCallCheck(this,e),this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}return _createClass(e,[{key:"destroy",value:function(){this.loader&&(this.loader.destroy(),this.loader=null)}},{key:"abort",value:function(){this.loader&&this.loader.abort()}},{key:"load",value:function(e,t){var r=this,n=e.url;if(!n)return _Promise.reject(new cr({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(n?"part list":"url")),networkDetails:null}));this.abort();var a=this.config,i=a.fLoader,s=a.loader;return new _Promise((function(o,l){if(r.loader&&r.loader.destroy(),e.gap){var c;if(_someInstanceProperty(c=e.tagList).call(c,(function(e){return"GAP"===e[0]})))return void l(lr(e));e.gap=!1}var u=r.loader=i?new i(a):new s(a),h=or(e);e.loader=u;var d=We(a.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:ir};e.stats=u.stats;var p={onSuccess:function(t,n,a,i){r.resetLoader(e,u);var s=t.data;a.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(_sliceInstanceProperty(s).call(s,0,16)),s=_sliceInstanceProperty(s).call(s,16)),o({frag:e,part:null,payload:s,networkDetails:i})},onError:function(t,a,i,s){var o;r.resetLoader(e,u),l(new cr({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:q({url:n,data:void 0},t),error:new Error(_concatInstanceProperty(o="HTTP Error ".concat(t.code," ")).call(o,t.text)),networkDetails:i,stats:s}))},onAbort:function(t,n,a){r.resetLoader(e,u),l(new cr({type:D.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:a,stats:t}))},onTimeout:function(t,n,a){r.resetLoader(e,u),l(new cr({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after ".concat(f.timeout,"ms")),networkDetails:a,stats:t}))}};t&&(p.onProgress=function(r,n,a,i){return t({frag:e,part:null,payload:a,networkDetails:i})}),u.load(h,f,p)}))}},{key:"loadPart",value:function(e,t,r){var n=this;this.abort();var a=this.config,i=a.fLoader,s=a.loader;return new _Promise((function(o,l){if(n.loader&&n.loader.destroy(),e.gap||t.gap)l(lr(e,t));else{var c=n.loader=i?new i(a):new s(a),u=or(e,t);e.loader=c;var h=We(a.fragLoadPolicy.default),d={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ir};t.stats=c.stats,c.load(u,d,{onSuccess:function(a,i,s,l){n.resetLoader(e,c),n.updateStatsFromPart(e,t);var u={frag:e,part:t,payload:a.data,networkDetails:l};r(u),o(u)},onError:function(r,a,i,s){var o;n.resetLoader(e,c),l(new cr({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:q({url:u.url,data:void 0},r),error:new Error(_concatInstanceProperty(o="HTTP Error ".concat(r.code," ")).call(o,r.text)),networkDetails:i,stats:s}))},onAbort:function(r,a,i){e.stats.aborted=t.stats.aborted,n.resetLoader(e,c),l(new cr({type:D.NETWORK_ERROR,details:w.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:i,stats:r}))},onTimeout:function(r,a,i){n.resetLoader(e,c),l(new cr({type:D.NETWORK_ERROR,details:w.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after ".concat(d.timeout,"ms")),networkDetails:i,stats:r}))}})}}))}},{key:"updateStatsFromPart",value:function(e,t){var r=e.stats,n=t.stats,a=n.total;if(r.loaded+=n.loaded,a){var i=Math.round(e.duration/t.duration),s=Math.min(Math.round(r.loaded/a),i),o=(i-s)*Math.round(r.loaded/s);r.total=r.loaded+o}else r.total=Math.max(r.loaded,r.total);var l=r.loading,c=n.loading;l.start?l.first+=c.first-c.start:(l.start=c.start,l.first=c.first),l.end=c.end}},{key:"resetLoader",value:function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}]),e}();function or(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=r||e,a={frag:e,part:r,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},i=n.byteRangeStartOffset,s=n.byteRangeEndOffset;if(O(i)&&O(s)){var o,l=i,c=s;if("initSegment"===e.sn&&("AES-128"===(t=null==(o=e.decryptdata)?void 0:o.method)||"AES-256"===t)){var u=s-i;u%16&&(c=s+(16-u%16)),0!==i&&(a.resetIV=!0,l=i-16)}a.rangeStart=l,a.rangeEnd=c}return a}function lr(e,t){var r=new Error("GAP ".concat(e.gap?"tag":"attribute"," found")),n={type:D.MEDIA_ERROR,details:w.FRAG_GAP,fatal:!1,frag:e,error:r,networkDetails:null};return t&&(n.part=t),(t||e).stats.aborted=!0,new cr(n)}var cr=function(e){_inherits(r,_wrapNativeSuper(Error));var t=_createSuper(r);function r(e){var n;return _classCallCheck(this,r),(n=t.call(this,e.error.message)).data=void 0,n.data=e,n}return _createClass(r)}(),ur=function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n){var a,i;return _classCallCheck(this,r),(i=t.call(this,e,n))._boundTick=void 0,i._tickTimer=null,i._tickInterval=null,i._tickCallCount=0,i._boundTick=_bindInstanceProperty(a=i.tick).call(a,_assertThisInitialized(i)),i}return _createClass(r,[{key:"destroy",value:function(){this.onHandlerDestroying(),this.onHandlerDestroyed()}},{key:"onHandlerDestroying",value:function(){this.clearNextTick(),this.clearInterval()}},{key:"onHandlerDestroyed",value:function(){}},{key:"hasInterval",value:function(){return!!this._tickInterval}},{key:"hasNextTick",value:function(){return!!this._tickTimer}},{key:"setInterval",value:function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=_setInterval(this._boundTick,e),!0)}},{key:"clearInterval",value:function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}},{key:"clearNextTick",value:function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}},{key:"tick",value:function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}},{key:"tickImmediate",value:function(){this.clearNextTick(),this._tickTimer=_setTimeout(this._boundTick,0)}},{key:"doTick",value:function(){}}]),r}(z),hr=_createClass((function e(t,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];_classCallCheck(this,e),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=r,this.id=n,this.size=a,this.part=i,this.partial=s})),dr={length:0,start:function(){return 0},end:function(){return 0}},fr=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"isBuffered",value:function(t,r){if(t)for(var n=e.getBuffered(t),a=n.length;a--;)if(r>=n.start(a)&&r<=n.end(a))return!0;return!1}},{key:"bufferInfo",value:function(t,r,n){if(t){var a=e.getBuffered(t);if(a.length){for(var i=[],s=0;s<a.length;s++)i.push({start:a.start(s),end:a.end(s)});return e.bufferedInfo(i,r,n)}}return{len:0,start:r,end:r,nextStart:void 0}}},{key:"bufferedInfo",value:function(e,t,r){t=Math.max(0,t),_sortInstanceProperty(e).call(e,(function(e,t){return e.start-t.start||t.end-e.end}));var n=[];if(r)for(var a=0;a<e.length;a++){var i=n.length;if(i){var s=n[i-1].end;e[a].start-s<r?e[a].end>s&&(n[i-1].end=e[a].end):n.push(e[a])}else n.push(e[a])}else n=e;for(var o,l=0,c=t,u=t,h=0;h<n.length;h++){var d=n[h].start,f=n[h].end;if(t+r>=d&&t<f)c=d,l=(u=f)-t;else if(t+r<d){o=d;break}}return{len:l,start:c||0,end:u||0,nextStart:o}}},{key:"getBuffered",value:function(e){try{return e.buffered||dr}catch(e){return te.log("failed to get media.buffered",e),dr}}}]),e}(),pr=/\{\$([a-zA-Z0-9-_]+)\}/g;function yr(e){return pr.test(e)}function gr(e,t){if(null!==e.variableList||e.hasVariableRefs){var r=e.variableList;return t.replace(pr,(function(t){var n=t.substring(2,t.length-1),a=null==r?void 0:r[n];return void 0===a?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'.concat(n,'"'))),t):a}))}return t}function vr(e,t,r){var n,a,i=e.variableList;if(i||(e.variableList=i={}),"QUERYPARAM"in t){n=t.QUERYPARAM;try{var s,o=new _URL(r).searchParams;if(!o.has(n))throw new Error(_concatInstanceProperty(s='"'.concat(n,'" does not match any query parameter in URI: "')).call(s,r,'"'));a=o.get(n)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: ".concat(t.message)))}}else n=t.NAME,a=t.VALUE;n in i?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'.concat(n,'"'))):i[n]=a||""}function mr(e,t,r){var n=t.IMPORT;if(r&&n in r){var a=e.variableList;a||(e.variableList=a={}),a[n]=r[n]}else e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'.concat(n,'"')))}var $r=/^(\d+)x(\d+)$/,Sr=/(.+?)=(".*?"|.*?)(?:,|$)/g,Ir=function(){function e(t,r){_classCallCheck(this,e),"string"==typeof t&&(t=e.parseAttrList(t,r)),W(this,t)}return _createClass(e,[{key:"clientAttrs",get:function(){var e;return _filterInstanceProperty(e=_Object$keys(this)).call(e,(function(e){return"X-"===e.substring(0,2)}))}},{key:"decimalInteger",value:function(e){var t=_parseInt$1(this[e],10);return t>_Number$MAX_SAFE_INTEGER?1/0:t}},{key:"hexadecimalInteger",value:function(e){if(this[e]){var t,r=_sliceInstanceProperty(t=this[e]||"0x").call(t,2);r=(1&r.length?"0":"")+r;for(var n=new Uint8Array(r.length/2),a=0;a<r.length/2;a++)n[a]=_parseInt$1(_sliceInstanceProperty(r).call(r,2*a,2*a+2),16);return n}return null}},{key:"hexadecimalIntegerAsNumber",value:function(e){var t=_parseInt$1(this[e],16);return t>_Number$MAX_SAFE_INTEGER?1/0:t}},{key:"decimalFloatingPoint",value:function(e){return _parseFloat$1(this[e])}},{key:"optionalFloat",value:function(e,t){var r=this[e];return r?_parseFloat$1(r):t}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"enumeratedStringList",value:function(e,t){var r,n=this[e];return _reduceInstanceProperty(r=n?n.split(/[ ,]+/):[]).call(r,(function(e,t){return e[t.toLowerCase()]=!0,e}),t)}},{key:"bool",value:function(e){return"YES"===this[e]}},{key:"decimalResolution",value:function(e){var t=$r.exec(this[e]);if(null!==t)return{width:_parseInt$1(t[1],10),height:_parseInt$1(t[2],10)}}}],[{key:"parseAttrList",value:function(e,t){var r,n,a={};for(Sr.lastIndex=0;null!==(n=Sr.exec(e));){var i,s=_trimInstanceProperty(i=n[1]).call(i),o=n[2],l=0===_indexOfInstanceProperty(o).call(o,'"')&&_lastIndexOfInstanceProperty(o).call(o,'"')===o.length-1,c=!1;if(l)o=_sliceInstanceProperty(o).call(o,1,-1);else switch(s){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":c=!0}if(t&&(l||c))o=gr(t,o);else if(!c&&!l)switch(s){case"CLOSED-CAPTIONS":if("NONE"===o)break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":te.warn(_concatInstanceProperty(r="".concat(e,": attribute ")).call(r,s," is missing quotes"))}a[s]=o}return a}}]),e}();function _r(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e||"SCTE35-CMD"===e}var Er=function(){function e(t,r){var n,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(_classCallCheck(this,e),this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(null==r?void 0:r.tagAnchor)||null,this.tagOrder=null!=(n=null==r?void 0:r.tagOrder)?n:a,r){var i=r.attr;for(var s in i)if(Object.prototype.hasOwnProperty.call(t,s)&&t[s]!==i[s]){var o;te.warn(_concatInstanceProperty(o='DATERANGE tag attribute: "'.concat(s,'" does not match for tags with ID: "')).call(o,t.ID,'"')),this._badValueForSameId=s;break}t=W(new Ir({}),i,t)}if(this.attr=t,r?(this._startDate=r._startDate,this._cue=r._cue,this._endDate=r._endDate,this._dateAtEnd=r._dateAtEnd):this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){var l=(null==r?void 0:r.endDate)||new Date(this.attr["END-DATE"]);O(l.getTime())&&(this._endDate=l)}}return _createClass(e,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"cue",get:function(){var e=this._cue;return void 0===e?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}},{key:"startTime",get:function(){var e,t=this.tagAnchor;return null===t||null===t.programDateTime?(te.warn(_concatInstanceProperty(e='Expected tagAnchor Fragment with PDT set for DateRange "'.concat(this.id,'": ')).call(e,t)),NaN):t.start+(this.startDate.getTime()-t.programDateTime)/1e3}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){var e=this._endDate||this._dateAtEnd;if(e)return e;var t=this.duration;return null!==t?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*t):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var e=this.attr.decimalFloatingPoint("DURATION");if(O(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isInterstitial",get:function(){return"com.apple.hls.interstitial"===this.class}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&O(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}]),e}(),Tr=function(){function e(t){_classCallCheck(this,e),this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}return _createClass(e,[{key:"reloaded",value:function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}},{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&O(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"fragmentStart",get:function(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[0].start:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(_Date$now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"maxPartIndex",get:function(){var e=this.partList;if(e){var t=this.lastPartIndex;if(-1!==t){for(var r=e.length;r--;)if(e[r].index>t)return e[r].index;return t}}return 0}},{key:"lastPartSn",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}},{key:"expired",get:function(){if(this.live&&this.age){var e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}]),e}();function Pr(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function br(e){switch(e){case"AES-128":case"AES-256":return ct;case"AES-256-CTR":return ut;default:throw new Error("invalid full segment method ".concat(e))}}function kr(e){return Uint8Array.from(atob(e),(function(e){return e.charCodeAt(0)}))}function Ar(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(function(e){return e.charCodeAt(0)}))}function Rr(e){var t,r,n=e.split(":"),a=null;if("data"===n[0]&&2===n.length){var i=n[1].split(";"),s=i[i.length-1].split(",");if(2===s.length){var o="base64"===s[0],l=s[1];o?(_spliceInstanceProperty(i).call(i,-1,1),a=kr(l)):(t=Ar(l).subarray(0,16),(r=new Uint8Array(16)).set(t,16-t.length),a=r)}}return a}var Or="undefined"!=typeof self?self:void 0,Lr={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Cr="org.w3.clearkey",Dr="com.apple.streamingkeydelivery",wr="com.microsoft.playready",xr="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Mr(e){switch(e){case Dr:return Lr.FAIRPLAY;case wr:return Lr.PLAYREADY;case xr:return Lr.WIDEVINE;case Cr:return Lr.CLEARKEY}}var Nr="1077efecc0b24d02ace33c1e52e2fb4b",Fr="e2719d58a985b3c9781ab030af78d30e",Ur="9a04f07998404286ab92e65be0885f95",Br="edef8ba979d64acea3c827dcd51d21ed";function jr(e){return e===Br?Lr.WIDEVINE:e===Ur?Lr.PLAYREADY:e===Nr||e===Fr?Lr.CLEARKEY:void 0}function Gr(e){switch(e){case Lr.FAIRPLAY:return Dr;case Lr.PLAYREADY:return wr;case Lr.WIDEVINE:return xr;case Lr.CLEARKEY:return Cr}}function Kr(e){var t,r=e.drmSystems,n=e.widevineLicenseUrl,a=r?_filterInstanceProperty(t=[Lr.FAIRPLAY,Lr.WIDEVINE,Lr.PLAYREADY,Lr.CLEARKEY]).call(t,(function(e){return!!r[e]})):[];return!a[Lr.WIDEVINE]&&n&&a.push(Lr.WIDEVINE),a}var Hr,Vr=null!=Or&&null!=(Hr=Or.navigator)&&Hr.requestMediaKeySystemAccess?_bindInstanceProperty(r=self.navigator.requestMediaKeySystemAccess).call(r,self.navigator):null;function Wr(e){var t,r,n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),a=String.fromCharCode.apply(null,_Array$from(n)),i=a.substring(_indexOfInstanceProperty(a).call(a,"<"),a.length),s=(new DOMParser).parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(s){var o=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(o){var l=kr(o).subarray(0,16);return(r=function(e,t,r){var n=e[t];e[t]=e[r],e[r]=n})(t=l,0,3),r(t,1,2),r(t,4,5),r(t,6,7),l}}return null}var Yr={},qr=function(){function e(t,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;_classCallCheck(this,e),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=r,this.keyFormat=n,this.keyFormatVersions=a,this.iv=i,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&!Pr(t)}return _createClass(e,[{key:"isSupported",value:function(){var e;if(this.method){if(Pr(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case Dr:case xr:case wr:case Cr:return-1!==_indexOfInstanceProperty(e=["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"]).call(e,this.method)}}return!1}},{key:"getDecryptData",value:function(t){if(!this.encrypted||!this.uri)return null;if(Pr(this.method)&&this.uri&&!this.iv){"number"!=typeof t&&(te.warn('missing IV for initialization segment with method="'.concat(this.method,'" - compliance issue')),t=0);var r=function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}(t);return new e(this.method,this.uri,"identity",this.keyFormatVersions,r)}var n=Rr(this.uri);if(n)switch(this.keyFormat){case xr:this.pssh=n,n.length>=22&&(this.keyId=n.subarray(n.length-22,n.length-6));break;case wr:var a=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=rr(a,0,n),this.keyId=Wr(n);break;default:var i=n.subarray(0,16);if(16!==i.length){var s=new Uint8Array(16);s.set(i,16-i.length),i=s}this.keyId=i}if(!this.keyId||16!==this.keyId.byteLength){var o=Yr[this.uri];if(!o){var l=_Object$keys(Yr).length%_Number$MAX_SAFE_INTEGER;o=new Uint8Array(16),new DataView(o.buffer,12,4).setUint32(0,l),Yr[this.uri]=o}this.keyId=o}return this}}],[{key:"clearKeyUriToKeyIdMap",value:function(){Yr={}}}]),e}(),zr=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Xr=/#EXT-X-MEDIA:(.*)/g,Qr=/^#EXT(?:INF|-X-TARGETDURATION):/m,Jr=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Zr=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),en=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"findGroup",value:function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(n.id===t)return n}}},{key:"resolve",value:function(e,t){return Tt.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}},{key:"isMediaPlaylist",value:function(e){return Qr.test(e)}},{key:"parseMasterPlaylist",value:function(t,r){var n,a={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:yr(t)},i=[];for(zr.lastIndex=0;null!=(n=zr.exec(t));)if(n[1]){var s,o=new Ir(n[1],a),l=gr(a,n[2]),c={attrs:o,bitrate:o.decimalInteger("BANDWIDTH")||o.decimalInteger("AVERAGE-BANDWIDTH"),name:o.NAME,url:e.resolve(l,r)},u=o.decimalResolution("RESOLUTION");u&&(c.width=u.width,c.height=u.height),sn(o.CODECS,c),null!=(s=c.unknownCodecs)&&s.length||i.push(c),a.levels.push(c)}else if(n[3]){var h=n[3],d=n[4];switch(h){case"SESSION-DATA":var f=new Ir(d,a),p=f["DATA-ID"];p&&(null===a.sessionData&&(a.sessionData={}),a.sessionData[p]=f);break;case"SESSION-KEY":var y=nn(d,r,a);y.encrypted&&y.isSupported()?(null===a.sessionKeys&&(a.sessionKeys=[]),a.sessionKeys.push(y)):te.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'.concat(d,'"'));break;case"DEFINE":vr(a,new Ir(d,a),r);break;case"CONTENT-STEERING":var g=new Ir(d,a);a.contentSteering={uri:e.resolve(g["SERVER-URI"],r),pathwayId:g["PATHWAY-ID"]||"."};break;case"START":a.startTimeOffset=an(d)}}var v=i.length>0&&i.length<a.levels.length;return a.levels=v?i:a.levels,0===a.levels.length&&(a.playlistParsingError=new Error("no levels found in manifest")),a}},{key:"parseMasterPlaylistMedia",value:function(t,r,n){var a,i={},s=n.levels,o={AUDIO:_mapInstanceProperty(s).call(s,(function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),SUBTITLES:_mapInstanceProperty(s).call(s,(function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),"CLOSED-CAPTIONS":[]},l=0;for(Xr.lastIndex=0;null!==(a=Xr.exec(t));){var c=new Ir(a[1],n),u=c.TYPE;if(u){var h=o[u],d=i[u]||[];i[u]=d;var f=c.LANGUAGE,p=c["ASSOC-LANGUAGE"],y=c.CHANNELS,g=c.CHARACTERISTICS,v=c["INSTREAM-ID"],m={attrs:c,bitrate:0,id:l++,groupId:c["GROUP-ID"]||"",name:c.NAME||f||"",type:u,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:f,url:c.URI?e.resolve(c.URI,r):""};if(p&&(m.assocLang=p),y&&(m.channels=y),g&&(m.characteristics=g),v&&(m.instreamId=v),null!=h&&h.length){var $=e.findGroup(h,m.groupId)||h[0];on(m,$,"audioCodec"),on(m,$,"textCodec")}d.push(m)}}return i}},{key:"parseLevelPlaylist",value:function(e,t,r,n,a,i){var s,o,l,c={url:t},u=new Tr(t),h=u.fragments,d=[],f=null,p=0,y=0,g=0,v=0,m=0,$=null,S=new Lt(n,c),I=-1,_=!1,E=null;for(Jr.lastIndex=0,u.m3u8=e,u.hasVariableRefs=yr(e);null!==(s=Jr.exec(e));){_&&(_=!1,(S=new Lt(n,c)).playlistOffset=g,S.start=g,S.sn=p,S.cc=v,m&&(S.bitrate=m),S.level=r,f&&(S.initSegment=f,f.rawProgramDateTime&&(S.rawProgramDateTime=f.rawProgramDateTime,f.rawProgramDateTime=null),E&&(S.setByteRange(E),E=null)));var T=s[1];if(T){var P;S.duration=_parseFloat$1(T);var b=_sliceInstanceProperty(P=" "+s[2]).call(P,1);S.title=b||null,S.tagList.push(b?["INF",T,b]:["INF",T])}else if(s[3]){if(O(S.duration)){var k;S.playlistOffset=g,S.start=g,l&&un(S,l,u),S.sn=p,S.level=r,S.cc=v,h.push(S);var A=_sliceInstanceProperty(k=" "+s[3]).call(k,1);S.relurl=gr(u,A),ln(S,$,d),$=S,g+=S.duration,p++,y=0,_=!0}}else{var R,L,C;if(!(s=s[0].match(Zr))){te.warn("No matches on slow regex match for level playlist!");continue}for(o=1;o<s.length&&void 0===s[o];o++);var D=_sliceInstanceProperty(R=" "+s[o]).call(R,1),w=_sliceInstanceProperty(L=" "+s[o+1]).call(L,1),x=s[o+2]?_sliceInstanceProperty(C=" "+s[o+2]).call(C,1):null;switch(D){case"BYTERANGE":$?S.setByteRange(w,$):S.setByteRange(w);break;case"PROGRAM-DATE-TIME":S.rawProgramDateTime=w,S.tagList.push(["PROGRAM-DATE-TIME",w]),-1===I&&(I=h.length);break;case"PLAYLIST-TYPE":u.type=w.toUpperCase();break;case"MEDIA-SEQUENCE":p=u.startSN=_parseInt$1(w);break;case"SKIP":var M;u.skippedSegments&&(u.playlistParsingError=new Error("#EXT-X-SKIP MUST NOT appear more than once in a Playlist"));var N=new Ir(w,u),F=N.decimalInteger("SKIPPED-SEGMENTS");if(O(F)){u.skippedSegments+=F;for(var U=F;U--;)h.push(null);p+=F}var B=N.enumeratedString("RECENTLY-REMOVED-DATERANGES");B&&(u.recentlyRemovedDateranges=_concatInstanceProperty(M=u.recentlyRemovedDateranges||[]).call(M,B.split("\t")));break;case"TARGETDURATION":u.targetduration=Math.max(_parseInt$1(w),1);break;case"VERSION":u.version=_parseInt$1(w);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":u.live=!1;break;case"#":(w||x)&&S.tagList.push(x?[w,x]:[w]);break;case"DISCONTINUITY":v++,S.tagList.push(["DIS"]);break;case"GAP":S.gap=!0,S.tagList.push([D]);break;case"BITRATE":S.tagList.push([D,w]),m=1e3*_parseInt$1(w),O(m)?S.bitrate=m:m=0;break;case"DATERANGE":var j=new Ir(w,u),G=new Er(j,u.dateRanges[j.ID],u.dateRangeTagCount);u.dateRangeTagCount++,G.isValid||u.skippedSegments?u.dateRanges[G.id]=G:te.warn('Ignoring invalid DATERANGE tag: "'.concat(w,'"')),S.tagList.push(["EXT-X-DATERANGE",w]);break;case"DEFINE":var K=new Ir(w,u);"IMPORT"in K?mr(u,K,i):vr(u,K,t);break;case"DISCONTINUITY-SEQUENCE":u.startCC=v=_parseInt$1(w);break;case"KEY":var H=nn(w,t,u);if(H.isSupported()){if("NONE"===H.method){l=void 0;break}l||(l={}),l[H.keyFormat]&&(l=W({},l)),l[H.keyFormat]=H}else te.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'.concat(w,'"'));break;case"START":u.startTimeOffset=an(w);break;case"MAP":var V=new Ir(w,u);if(S.duration){var Y=new Lt(n,c);cn(Y,V,r,l),f=Y,S.initSegment=f,f.rawProgramDateTime&&!S.rawProgramDateTime&&(S.rawProgramDateTime=f.rawProgramDateTime)}else{var q=S.byteRangeEndOffset;if(q){var z,X=S.byteRangeStartOffset;E=_concatInstanceProperty(z="".concat(q-X,"@")).call(z,X)}else E=null;cn(S,V,r,l),f=S,_=!0}f.cc=v;break;case"SERVER-CONTROL":var Q=new Ir(w);u.canBlockReload=Q.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=Q.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&Q.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=Q.optionalFloat("PART-HOLD-BACK",0),u.holdBack=Q.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var J=new Ir(w);u.partTarget=J.decimalFloatingPoint("PART-TARGET");break;case"PART":var Z=u.partList;Z||(Z=u.partList=[]);var ee=y>0?Z[Z.length-1]:void 0,re=y++,ne=new Ir(w,u),ae=new Ct(ne,S,c,re,ee);Z.push(ae),S.duration+=ae.duration;break;case"PRELOAD-HINT":var ie=new Ir(w,u);u.preloadHint=ie;break;case"RENDITION-REPORT":var se=new Ir(w,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(se);break;default:te.warn("line parsed but not handled: ".concat(s))}}}$&&!$.relurl?(h.pop(),g-=$.duration,u.partList&&(u.fragmentHint=$)):u.partList&&(ln(S,$,d),S.cc=v,u.fragmentHint=S,l&&un(S,l,u));var oe=h.length,le=h[0],ce=h[oe-1];if((g+=u.skippedSegments*u.targetduration)>0&&oe&&ce){u.averagetargetduration=g/oe;var ue=ce.sn;u.endSN="initSegment"!==ue?ue:0,u.live||(ce.endList=!0),le&&!u.startCC&&(u.startCC=le.cc),I>0&&(function(e,t){for(var r=e[t],n=t;n--;){var a=e[n];if(!a)return;a.programDateTime=r.programDateTime-1e3*a.duration,r=a}}(h,I),le&&d.unshift(le))}else u.endSN=0,u.startCC=0;return u.fragmentHint&&(g+=u.fragmentHint.duration),u.totalduration=g,d.length&&u.dateRangeTagCount&&le&&tn(d,u),u.endCC=v,u}}]),e}();function tn(e,t){for(var r=e.length,n=e[r-1],a=t.live?1/0:t.totalduration,i=_Object$keys(t.dateRanges),s=i.length;s--;){var o=t.dateRanges[i[s]],l=o.startDate.getTime();o.tagAnchor=n.ref;for(var c=r;c--;){var u=rn(t,l,e,c,a);if(-1!==u){o.tagAnchor=t.fragments[u].ref;break}}}}function rn(e,t,r,n,a){var i=r[n];if(i){var s,o=i.programDateTime;if((t>=o||0===n)&&t<=o+1e3*(((null==(s=r[n+1])?void 0:s.start)||a)-i.start)){var l=r[n].sn-e.startSN,c=e.fragments;if(c.length>r.length)for(var u=(r[n+1]||c[c.length-1]).sn-e.startSN;u>l;u--){var h=c[u].programDateTime;if(t>=h&&t<h+1e3*c[u].duration)return u}return l}}return-1}function nn(e,t,r){var n,a,i,s,o=new Ir(e,r),l=null!=(i=o.METHOD)?i:"",c=o.URI,u=o.hexadecimalInteger("IV"),h=o.KEYFORMATVERSIONS,d=null!=(s=o.KEYFORMAT)?s:"identity";c&&o.IV&&!u&&te.error("Invalid IV: ".concat(o.IV));var f=c?en.resolve(c,t):"",p=_filterInstanceProperty(n=_mapInstanceProperty(a=(h||"1").split("/")).call(a,Number)).call(n,_Number$isFinite);return new qr(l,f,d,p,u)}function an(e){var t=new Ir(e).decimalFloatingPoint("TIME-OFFSET");return O(t)?t:null}function sn(e,t){var r,n,a=_filterInstanceProperty(r=(e||"").split(/[ ,]+/)).call(r,(function(e){return e}));_forEachInstanceProperty(n=["video","audio","text"]).call(n,(function(e){var r=_filterInstanceProperty(a).call(a,(function(t){return r=t,!!(n=ae[e])&&!!n[_sliceInstanceProperty(r).call(r,0,4)];var r,n}));r.length&&(t["".concat(e,"Codec")]=r.join(","),a=_filterInstanceProperty(a).call(a,(function(e){return-1===_indexOfInstanceProperty(r).call(r,e)})))})),t.unknownCodecs=a}function on(e,t,r){var n=t[r];n&&(e[r]=n)}function ln(e,t,r){e.rawProgramDateTime?r.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function cn(e,t,r,n){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=r,e.sn="initSegment",n&&(e.levelkeys=n),e.initSegment=null}function un(e,t,r){var n;e.levelkeys=t;var a=r.encryptedFragments;a.length&&a[a.length-1].levelkeys===t||!_someInstanceProperty(n=_Object$keys(t)).call(n,(function(e){return t[e].isCommonEncryption}))||a.push(e)}function hn(e,t){var r=t.startPTS;if(O(r)){var n,a=0;t.sn>e.sn?(a=r-e.start,n=e):(a=e.start-r,n=t),n.duration!==a&&n.setDuration(a)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration):t.setStart(Math.max(e.start-t.duration,0))}function dn(e,t,r,n,a,i){n-r<=0&&(te.warn("Fragment should have a positive duration",t),n=r+t.duration,i=a+t.duration);var s=r,o=n,l=t.startPTS,c=t.endPTS;if(O(l)){var u=Math.abs(l-r);O(t.deltaPTS)?t.deltaPTS=Math.max(u,t.deltaPTS):t.deltaPTS=u,s=Math.max(r,l),r=Math.min(r,l),a=Math.min(a,t.startDTS),o=Math.min(n,c),n=Math.max(n,c),i=Math.max(i,t.endDTS)}var h=r-t.start;0!==t.start&&t.setStart(r),t.setDuration(n-t.start),t.startPTS=r,t.maxStartPTS=s,t.startDTS=a,t.endPTS=n,t.minEndPTS=o,t.endDTS=i;var d,f=t.sn;if(!e||f<e.startSN||f>e.endSN)return 0;var p=f-e.startSN,y=e.fragments;for(y[p]=t,d=p;d>0;d--)hn(y[d],y[d-1]);for(d=p;d<y.length-1;d++)hn(y[d],y[d+1]);return e.fragmentHint&&hn(y[y.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,h}function fn(e,t){for(var r,n,a=null,i=e.fragments,s=i.length-1;s>=0;s--){var o=i[s].initSegment;if(o){a=o;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var l,c=0;!function(e,t,r,n,a){for(var i=t.skippedSegments,s=Math.max(e.startSN,t.startSN)-t.startSN,o=(e.fragmentHint?1:0)+(i?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,l=t.startSN-e.startSN,c=t.fragmentHint?_concatInstanceProperty(n=t.fragments).call(n,t.fragmentHint):t.fragments,u=e.fragmentHint?_concatInstanceProperty(a=e.fragments).call(a,e.fragmentHint):e.fragments,h=s;h<=o;h++){var d=u[l+h],f=c[h];i&&!f&&d&&(f=t.fragments[h]=d),d&&f&&r(d,f)}}(e,t,(function(e,r){e.relurl&&(c=e.cc-r.cc),O(e.startPTS)&&O(e.endPTS)&&(r.setStart(r.startPTS=e.startPTS),r.startDTS=e.startDTS,r.maxStartPTS=e.maxStartPTS,r.endPTS=e.endPTS,r.endDTS=e.endDTS,r.minEndPTS=e.minEndPTS,r.setDuration(e.endPTS-e.startPTS),r.duration&&(l=r),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(r.elementaryStreams=e.elementaryStreams),r.loader=e.loader,e.hasStats&&(r.stats=e.stats),e.initSegment&&(r.initSegment=e.initSegment,a=e.initSegment)}));var u=t.fragmentHint?_concatInstanceProperty(r=t.fragments).call(r,t.fragmentHint):t.fragments;if(a&&_forEachInstanceProperty(u).call(u,(function(e){var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=a)?void 0:t.relurl)||(e.initSegment=a)})),t.skippedSegments)if(t.deltaUpdateFailed=_someInstanceProperty(n=t.fragments).call(n,(function(e){return!e})),t.deltaUpdateFailed){te.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=t.skippedSegments;h--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC||(t.startCC=t.fragments[0].cc)}else{var d;t.canSkipDateRanges&&(t.dateRanges=function(e,t,r){var n=t.dateRanges,a=t.recentlyRemovedDateranges,i=W({},e);a&&_forEachInstanceProperty(a).call(a,(function(e){delete i[e]}));var s=_Object$keys(i).length;return s&&_forEachInstanceProperty(r=_Object$keys(n)).call(r,(function(e){var t=i[e],r=new Er(n[e].attr,t);r.isValid?(i[e]=r,t||(r.tagOrder+=s)):te.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'.concat(_JSON$stringify(n[e].attr),'"'))})),i}(e.dateRanges,t));var f=_filterInstanceProperty(d=e.fragments).call(d,(function(e){return e.rawProgramDateTime}));if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(var p=1;p<u.length;p++)null===u[p].programDateTime&&ln(u[p],u[p-1],f);tn(f,t)}var y=t.fragments;if(c){te.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<y.length;g++)y[g].cc+=c}t.skippedSegments&&(t.startCC=t.fragments[0].cc),function(e,t,r){if(e&&t)for(var n=0,a=0,i=e.length;a<=i;a++){var s=e[a],o=t[a+n];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?r(s,o):n--}}(e.partList,t.partList,(function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),l?dn(t,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS):pn(e,t),y.length&&(t.totalduration=t.edge-y[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;var v=t.advancedDateTime;if(t.advanced&&v){var m=t.edge;t.driftStart||(t.driftStartTime=v,t.driftStart=m),t.driftEndTime=v,t.driftEnd=m}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}function pn(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=t.startSN+t.skippedSegments-e.startSN,a=e.fragments,i=n>=0,s=0;if(i&&n<a.length)s=a[n].start;else if(i&&t.startSN===e.endSN+1)s=e.fragmentEnd;else if(i&&r)s=e.fragmentStart+n*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return;s=e.fragmentStart}yn(t,s)}function yn(e,t){if(t){for(var r=e.fragments,n=e.skippedSegments;n<r.length;n++)r[n].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0,r=1e3*e.targetduration;if(e.updated){var n=e.fragments,a=4;if(n.length&&r*a>t){var i=1e3*n[n.length-1].duration;i<r&&(r=i)}}else r/=2;return Math.round(r)}function vn(e,t,r){return e?mn(e.partList,t,r):null}function mn(e,t,r){if(e)for(var n=e.length;n--;){var a=e[n];if(a.index===r&&a.fragment.sn===t)return a}return null}function $n(e){_forEachInstanceProperty(e).call(e,(function(e,t){var r,n=null==(r=e.details)?void 0:r.fragments;n&&_forEachInstanceProperty(n).call(n,(function(e){e.level=t,e.initSegment&&(e.initSegment.level=t)}))}))}function Sn(e,t){for(var r=0,n=e.length;r<n;r++){var a;if((null==(a=e[r])?void 0:a.cc)===t)return e[r]}return null}function In(e,t){if(e){var r=e.start+t;e.start=e.startPTS=r,e.endPTS=r+e.duration}}function _n(e,t){for(var r=t.fragments,n=0,a=r.length;n<a;n++)In(r[n],e);t.fragmentHint&&In(t.fragmentHint,e),t.alignedSliding=!0}function En(e,t){if(n=e,(r=t)&&n.startCC<r.endCC&&n.endCC>r.startCC){var r,n,a=Math.min(t.endCC,e.endCC),i=Sn(t.fragments,a),s=Sn(e.fragments,a);i&&s&&(te.log("Aligning playlist at start of dicontinuity sequence ".concat(a)),_n(i.start-s.start,e))}}function Tn(e,t){if(e.hasProgramDateTime&&t.hasProgramDateTime){var r=e.fragments,n=t.fragments;if(r.length&&n.length){var a,i,s=Math.min(t.endCC,e.endCC);t.startCC<s&&e.startCC<s&&(a=Sn(n,s),i=Sn(r,s)),a&&i||(i=Sn(r,(a=n[Math.floor(n.length/2)]).cc)||r[Math.floor(r.length/2)]);var o=a.programDateTime,l=i.programDateTime;o&&l&&_n((l-o)/1e3-(i.start-a.start),e)}}}var Pn=function(e){for(var t="",r=e.length,n=0;n<r;n++){var a;t+=_concatInstanceProperty(a="[".concat(e.start(n).toFixed(3),"-")).call(a,e.end(n).toFixed(3),"]")}return t},bn="STOPPED",kn="IDLE",An="KEY_LOADING",Rn="FRAG_LOADING",On="FRAG_LOADING_WAITING_RETRY",Ln="WAITING_TRACK",Cn="PARSING",Dn="PARSED",wn="ENDED",xn="ERROR",Mn="WAITING_INIT_PTS",Nn="WAITING_LEVEL",Fn=function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n,a,i,s){var o;return _classCallCheck(this,r),(o=t.call(this,i,e.logger)).hls=void 0,o.fragPrevious=null,o.fragCurrent=null,o.fragmentTracker=void 0,o.transmuxer=null,o._state=bn,o.playlistType=void 0,o.media=null,o.mediaBuffer=null,o.config=void 0,o.bitrateTest=!1,o.lastCurrentTime=0,o.nextLoadPosition=0,o.startPosition=0,o.startTimeOffset=null,o.retryDate=0,o.levels=null,o.fragmentLoader=void 0,o.keyLoader=void 0,o.levelLastLoaded=null,o.startFragRequested=!1,o.decrypter=void 0,o.initPTS=[],o.buffering=!0,o.loadingParts=!1,o.loopSn=void 0,o.onMediaSeeking=function(){var e,t=_assertThisInitialized(o),r=t.config,n=t.fragCurrent,a=t.media,i=t.mediaBuffer,s=t.state,l=a?a.currentTime:0,c=fr.bufferInfo(i||a,l,r.maxBufferHole);if(o.log(_concatInstanceProperty(e="media seeking to ".concat(O(l)?l.toFixed(3):l,", state: ")).call(e,s)),o.state===wn)o.resetLoadingState();else if(n){var u=r.maxFragLookUpTolerance,h=n.start-u,d=n.start+n.duration+u;if(!c.len||d<c.start||h>c.end){var f=l>d;(l<h||f)&&(f&&n.loader&&(o.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),n.abortRequests(),o.resetLoadingState()),o.fragPrevious=null)}}if(a&&(o.fragmentTracker.removeFragmentsInRange(l,1/0,o.playlistType,!0),l>o.lastCurrentTime&&(o.lastCurrentTime=l),!o.loadingParts)){var p,y=Math.max(c.end,l),g=o.shouldLoadParts(o.getLevelDetails(),y);g&&(o.log(_concatInstanceProperty(p="LL-Part loading ON after seeking to ".concat(l.toFixed(2)," with buffer @")).call(p,y.toFixed(2))),o.loadingParts=g)}o.hls.hasEnoughToStart||c.len||(o.log("setting startPosition to ".concat(l," because of seek before start")),o.nextLoadPosition=o.startPosition=l),o.tickImmediate()},o.onMediaEnded=function(){o.log("setting startPosition to 0 because media ended"),o.startPosition=o.lastCurrentTime=0,o.triggerEnded()},o.playlistType=s,o.hls=e,o.fragmentLoader=new sr(e.config),o.keyLoader=a,o.fragmentTracker=n,o.config=e.config,o.decrypter=new ar(e.config),o}return _createClass(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(x.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(x.ERROR,this.onError,this)}},{key:"doTick",value:function(){this.onTickEnd()}},{key:"onTickEnd",value:function(){}},{key:"startLoad",value:function(e){}},{key:"stopLoad",value:function(){if(this.state!==bn){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=bn}}},{key:"startPositionValue",get:function(){var e=this.nextLoadPosition,t=this.startPosition;return-1===t&&e?e:t}},{key:"bufferingEnabled",get:function(){return this.buffering}},{key:"pauseBuffering",value:function(){this.buffering=!1}},{key:"resumeBuffering",value:function(){this.buffering=!0}},{key:"_streamEnded",value:function(e,t){var r=void 0!==this.config.timelineOffset,n=e.nextStart,a=n&&(!r||n<t.edge);if(t.live||a||!e.end||!this.media)return!1;var i=t.partList;if(null!=i&&i.length){var s=i[i.length-1];return fr.isBuffered(this.media,s.start+s.duration/2)}var o=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(o)}},{key:"getLevelDetails",value:function(){var e;if(this.levels&&null!==this.levelLastLoaded)return null==(e=this.levelLastLoaded)?void 0:e.details}},{key:"onMediaAttached",value:function(e,t){var r=this.media=this.mediaBuffer=t.media;r.removeEventListener("seeking",this.onMediaSeeking),r.removeEventListener("ended",this.onMediaEnded),r.addEventListener("seeking",this.onMediaSeeking),r.addEventListener("ended",this.onMediaEnded);var n=this.config;this.levels&&n.autoStartLoad&&this.state===bn&&this.startLoad(n.startPosition)}},{key:"onMediaDetaching",value:function(e,t){var r=!!t.transferMedia,n=this.media;null!==n&&(n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),n.removeEventListener("seeking",this.onMediaSeeking),n.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!r&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,r?this.resetTransmuxer():(this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()))}},{key:"onManifestLoading",value:function(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}},{key:"onError",value:function(e,t){}},{key:"triggerEnded",value:function(){}},{key:"onManifestLoaded",value:function(e,t){this.startTimeOffset=t.startTimeOffset}},{key:"onHandlerDestroying",value:function(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),_get(_getPrototypeOf(r.prototype),"onHandlerDestroying",this).call(this),this.hls=this.onMediaSeeking=this.onMediaEnded=null}},{key:"onHandlerDestroyed",value:function(){this.state=bn,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,_get(_getPrototypeOf(r.prototype),"onHandlerDestroyed",this).call(this)}},{key:"loadFragment",value:function(e,t,r){var n=this.hls.config;if(n.interstitialsController&&!1!==n.enableInterstitialPlayback&&e.type!==G){var a=this.hls.interstitialsManager,i=null==a?void 0:a.bufferingItem;if(i){var s=i.event;if(s){if(s.appendInPlace||Math.abs(e.start-i.start)>1||0===i.start)return}else{var o;if(e.end<=i.start&&!1===(null==(o=t.details)?void 0:o.live))return;if(e.start>i.end&&i.nextEvent)return}}}this.startFragRequested=!0,this._loadFragForPlayback(e,t,r)}},{key:"_loadFragForPlayback",value:function(e,t,r){var n=this;this._doFragLoad(e,t,r,(function(e){var t,r,a,i=e.frag;if(n.fragContextChanged(i))return n.warn(_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(a="".concat(i.type," sn: ")).call(a,i.sn)).call(r,e.part?" part: "+e.part.index:""," of ")).call(t,n.fragInfo(i,!1,e.part),") was dropped during download.")),void n.fragmentTracker.removeFragment(i);i.stats.chunkCount++,n._handleFragmentLoadProgress(e)})).then((function(e){var t,r,a;if(e){var i=n.state,s=e.frag;n.fragContextChanged(s)?(i===Rn||!n.fragCurrent&&i===Cn)&&(n.fragmentTracker.removeFragment(s),n.state=kn):("payload"in e&&(n.log(_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(a="Loaded ".concat(s.type," sn: ")).call(a,s.sn," of ")).call(r,n.playlistLabel()," ")).call(t,s.level)),n.hls.trigger(x.FRAG_LOADED,e)),n._handleFragmentLoadComplete(e))}})).catch((function(t){n.state!==bn&&n.state!==xn&&(n.warn("Frag error: ".concat((null==t?void 0:t.message)||t)),n.resetFragmentLoading(e))}))}},{key:"clearTrackerIfNeeded",value:function(e){var t,r=this.fragmentTracker;if(r.getState(e)===nt){var n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),i=Math.max(e.duration,a?a.len:this.config.maxBufferLength),s=this.backtrackFragment;(1==(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(i,e.duration))&&r.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?r.removeAllFragments():r.hasParts(e.type)&&(r.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),r.getState(e)===at&&r.removeFragment(e))}},{key:"checkLiveUpdate",value:function(e){if(e.updated&&!e.live){var t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}},{key:"waitForLive",value:function(e){var t=e.details;return(null==t?void 0:t.live)&&"EVENT"!==t.type&&(this.levelLastLoaded!==e||t.expired)}},{key:"flushMainBuffer",value:function(e,t){if(e-t){var r={startOffset:e,endOffset:t,type:arguments.length>2&&void 0!==arguments[2]?arguments[2]:null};this.hls.trigger(x.BUFFER_FLUSHING,r)}}},{key:"_loadInitSegment",value:function(e,t){var r=this;this._doFragLoad(e,t).then((function(e){var t=null==e?void 0:e.frag;if(!t||r.fragContextChanged(t)||!r.levels)throw new Error("init load aborted");return e})).then((function(e){var t=r.hls,n=e.frag,a=e.payload,i=n.decryptdata;if(a&&a.byteLength>0&&null!=i&&i.key&&i.iv&&Pr(i.method)){var s=self.performance.now();return r.decrypter.decrypt(new Uint8Array(a),i.key.buffer,i.iv.buffer,br(i.method)).catch((function(e){throw t.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:n}),e})).then((function(a){var i=self.performance.now();return t.trigger(x.FRAG_DECRYPTED,{frag:n,payload:a,stats:{tstart:s,tdecrypt:i}}),e.payload=a,r.completeInitSegmentLoad(e)}))}return r.completeInitSegmentLoad(e)})).catch((function(t){r.state!==bn&&r.state!==xn&&(r.warn(t),r.resetFragmentLoading(e))}))}},{key:"completeInitSegmentLoad",value:function(e){if(!this.levels)throw new Error("init load aborted, missing levels");var t=e.frag.stats;this.state!==bn&&(this.state=kn),e.frag.data=new Uint8Array(e.payload),t.parsing.start=t.buffering.start=self.performance.now(),t.parsing.end=t.buffering.end=self.performance.now(),this.tick()}},{key:"fragContextChanged",value:function(e){var t=this.fragCurrent;return!e||!t||e.sn!==t.sn||e.level!==t.level}},{key:"fragBufferedComplete",value:function(e,t){var r,n,a,i,s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i="Buffered ".concat(e.type," sn: ")).call(i,e.sn)).call(a,t?" part: "+t.index:""," of ")).call(n,this.fragInfo(e,!1,t)," > buffer:")).call(r,s?Pn(fr.getBuffered(s)):"(detached)",")")),Ot(e)){var o;if(e.type!==G){var l,c=e.elementaryStreams;if(!_someInstanceProperty(l=_Object$keys(c)).call(l,(function(e){return!!c[e]})))return void(this.state=kn)}var u=null==(o=this.levels)?void 0:o[e.level];null!=u&&u.fragmentError&&(this.log("Resetting level fragment error count of ".concat(u.fragmentError," on frag buffered")),u.fragmentError=0)}this.state=kn}},{key:"_handleFragmentLoadComplete",value:function(e){var t=this.transmuxer;if(t){var r=e.frag,n=e.part,a=e.partsLoaded,i=!a||0===a.length||_someInstanceProperty(a).call(a,(function(e){return!e})),s=new hr(r.level,r.sn,r.stats.chunkCount+1,0,n?n.index:-1,!i);t.flush(s)}}},{key:"_handleFragmentLoadProgress",value:function(e){}},{key:"_doFragLoad",value:function(e,t){var r,n,a,i,s,o,l,c,u,h,d=this,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,p=arguments.length>3?arguments[3]:void 0;this.fragCurrent=e;var y=null==t?void 0:t.details;if(!this.levels||!y)throw new Error("frag load aborted, missing level".concat(y?"":" detail","s"));var g=null;!e.encrypted||null!=(h=e.decryptdata)&&h.key?!e.encrypted&&y.encryptedFragments.length&&this.keyLoader.loadClear(e,y.encryptedFragments):(this.log(_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i="Loading key for ".concat(e.sn," of [")).call(i,y.startSN,"-")).call(a,y.endSN,"], ")).call(n,this.playlistLabel()," ")).call(r,e.level)),this.state=An,this.fragCurrent=e,g=this.keyLoader.load(e).then((function(e){if(!d.fragContextChanged(e.frag))return d.hls.trigger(x.KEY_LOADED,e),d.state===An&&(d.state=kn),e})),this.hls.trigger(x.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(g=_Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING"))));var v=this.fragPrevious;if(Ot(e)&&(!v||e.sn!==v.sn)){var m,$,S=this.shouldLoadParts(t.details,e.end);S!==this.loadingParts&&(this.log(_concatInstanceProperty(m=_concatInstanceProperty($="LL-Part loading ".concat(S?"ON":"OFF"," loading sn ")).call($,null==v?void 0:v.sn,"->")).call(m,e.sn)),this.loadingParts=S)}if(f=Math.max(e.start,f||0),this.loadingParts&&Ot(e)){var I=y.partList;if(I&&p){f>e.end&&y.fragmentHint&&(e=y.fragmentHint);var _=this.getNextPart(I,e,f);if(_>-1){var E,T,P,b,k,A,R,L,C,D,w=I[_];return e=this.fragCurrent=w.fragment,this.log(_concatInstanceProperty(E=_concatInstanceProperty(T=_concatInstanceProperty(P=_concatInstanceProperty(b=_concatInstanceProperty(k=_concatInstanceProperty(A=_concatInstanceProperty(R=_concatInstanceProperty(L=_concatInstanceProperty(C="Loading ".concat(e.type," sn: ")).call(C,e.sn," part: ")).call(L,w.index," (")).call(R,_,"/")).call(A,I.length-1,") of ")).call(k,this.fragInfo(e,!1,w),") cc: ")).call(b,e.cc," [")).call(P,y.startSN,"-")).call(T,y.endSN,"], target: ")).call(E,_parseFloat$1(f.toFixed(3)))),this.nextLoadPosition=w.start+w.duration,this.state=Rn,D=g?g.then((function(r){return!r||d.fragContextChanged(r.frag)?null:d.doFragPartsLoad(e,w,t,p)})).catch((function(e){return d.handleFragLoadError(e)})):this.doFragPartsLoad(e,w,t,p).catch((function(e){return d.handleFragLoadError(e)})),this.hls.trigger(x.FRAG_LOADING,{frag:e,part:w,targetBufferTime:f}),null===this.fragCurrent?_Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):D}if(!e.url||this.loadedEndOfParts(I,f))return _Promise.resolve(null)}}if(Ot(e)&&this.loadingParts)this.log("LL-Part loading OFF after next part miss @".concat(f.toFixed(2))),this.loadingParts=!1;else if(!e.url)return _Promise.resolve(null);this.log(_concatInstanceProperty(s=_concatInstanceProperty(o=_concatInstanceProperty(l=_concatInstanceProperty(c=_concatInstanceProperty(u="Loading ".concat(e.type," sn: ")).call(u,e.sn," of ")).call(c,this.fragInfo(e,!1),") cc: ")).call(l,e.cc," ")).call(o,y?"["+y.startSN+"-"+y.endSN+"]":"",", target: ")).call(s,_parseFloat$1(f.toFixed(3)))),O(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Rn;var M,N=this.config.progressive;return M=N&&g?g.then((function(t){return!t||d.fragContextChanged(null==t?void 0:t.frag)?null:d.fragmentLoader.load(e,p)})).catch((function(e){return d.handleFragLoadError(e)})):_Promise.all([this.fragmentLoader.load(e,N?p:void 0),g]).then((function(e){var t=_slicedToArray(e,1)[0];return!N&&t&&p&&p(t),t})).catch((function(e){return d.handleFragLoadError(e)})),this.hls.trigger(x.FRAG_LOADING,{frag:e,targetBufferTime:f}),null===this.fragCurrent?_Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):M}},{key:"doFragPartsLoad",value:function(e,t,r,n){var a=this;return new _Promise((function(i,s){var o,l=[],c=null==(o=r.details)?void 0:o.partList;!function t(o){a.fragmentLoader.loadPart(e,o,n).then((function(n){l[o.index]=n;var s=n.part;a.hls.trigger(x.FRAG_LOADED,n);var u=vn(r.details,e.sn,o.index+1)||mn(c,e.sn,o.index+1);if(!u)return i({frag:e,part:s,partsLoaded:l});t(u)})).catch(s)}(t)}))}},{key:"handleFragLoadError",value:function(e){if("data"in e){var t=e.data;e.data&&t.details===w.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(x.ERROR,t)}else this.hls.trigger(x.ERROR,{type:D.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}},{key:"_handleTransmuxerFlush",value:function(e){var t,r=this.getCurrentContext(e);if(r&&this.state===Cn){var n=r.frag,a=r.part,i=r.level,s=self.performance.now();n.stats.parsing.end=s,a&&(a.stats.parsing.end=s);var o=this.getLevelDetails(),l=o&&n.sn>o.endSN||this.shouldLoadParts(o,n.end);l!==this.loadingParts&&(this.log(_concatInstanceProperty(t="LL-Part loading ".concat(l?"ON":"OFF"," after parsing segment ending @")).call(t,n.end.toFixed(2))),this.loadingParts=l),this.updateLevelTiming(n,a,i,e.partial)}else this.fragCurrent||this.state===bn||this.state===xn||(this.state=kn)}},{key:"shouldLoadParts",value:function(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(null!=e&&e.partList){var r,n,a=e.partList[0];if(t>=a.end+((null==(r=e.fragmentHint)?void 0:r.duration)||0)&&(this.hls.hasEnoughToStart?(null==(n=this.media)?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>a.start-a.fragment.duration)return!0}}return!1}},{key:"getCurrentContext",value:function(e){var t,r,n=this.levels,a=this.fragCurrent,i=e.level,s=e.sn,o=e.part;if(null==n||!n[i])return this.warn(_concatInstanceProperty(t=_concatInstanceProperty(r="Levels object was unset while buffering fragment ".concat(s," of ")).call(r,this.playlistLabel()," ")).call(t,i,". The current chunk will not be buffered.")),null;var l=n[i],c=l.details,u=o>-1?vn(c,s,o):null,h=u?u.fragment:function(e,t,r){if(!e)return null;var n=e.fragments[t-e.startSN];return n||((n=e.fragmentHint)&&n.sn===t?n:t<e.startSN&&r&&r.sn===t?r:null)}(c,s,a);return h?(a&&a!==h&&(h.stats=a.stats),{frag:h,part:u,level:l}):null}},{key:"bufferFragmentData",value:function(e,t,r,n,a){var i;if(e&&this.state===Cn){var s=e.data1,o=e.data2,l=s;if(s&&o&&(l=Qt(s,o)),null!=(i=l)&&i.length){var c={type:e.type,frag:t,part:r,chunkMeta:n,parent:t.type,data:l};if(this.hls.trigger(x.BUFFER_APPENDING,c),e.dropped&&e.independent&&!r){if(a)return;this.flushBufferGap(t)}}}}},{key:"flushBufferGap",value:function(e){var t=this.media;if(t)if(fr.isBuffered(t,t.currentTime)){var r=t.currentTime,n=fr.bufferInfo(t,r,0),a=e.duration,i=Math.min(2*this.config.maxFragLookUpTolerance,.25*a),s=Math.max(Math.min(e.start-i,n.end-i),r+i);e.start-s>i&&this.flushMainBuffer(s,e.start)}else this.flushMainBuffer(0,e.start)}},{key:"getFwdBufferInfo",value:function(e,t){var r,n=this.getLoadPosition();if(!O(n))return null;var a=this.lastCurrentTime>n||null!=(r=this.media)&&r.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,a)}},{key:"getFwdBufferInfoAtPos",value:function(e,t,r,n){var a=fr.bufferInfo(e,t,n);if(0===a.len&&void 0!==a.nextStart){var i=this.fragmentTracker.getBufferedFrag(t,r);if(i&&(a.nextStart<=i.end||i.gap))return fr.bufferInfo(e,t,Math.max(a.nextStart,n))}return a}},{key:"getMaxBufferLength",value:function(e){var t,r=this.config;return t=e?Math.max(8*r.maxBufferSize/e,r.maxBufferLength):r.maxBufferLength,Math.min(t,r.maxMaxBufferLength)}},{key:"reduceMaxBufferLength",value:function(e,t){var r=this.config,n=Math.max(Math.min(e-t,r.maxBufferLength),t),a=Math.max(e-3*t,r.maxMaxBufferLength/2,n);return a>=n&&(r.maxMaxBufferLength=a,this.warn("Reduce max buffer length to ".concat(a,"s")),!0)}},{key:"getAppendedFrag",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:B,n=null==(t=this.fragmentTracker)?void 0:t.getAppendedFrag(e,r);return n&&"fragment"in n?n.fragment:n}},{key:"getNextFragment",value:function(e,t){var r=t.fragments,n=r.length;if(!n)return null;var a=this.config,i=r[0].start,s=a.lowLatencyMode&&!!t.partList,o=null;if(t.live){var l,c=a.initialLiveManifestSize;if(n<c)return this.warn(_concatInstanceProperty(l="Not enough fragments to start playback (have: ".concat(n,", need: ")).call(l,c,")")),null;if(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<i){var u,h,d,f;s&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(t,r);var p=this.hls.startPosition,y=this.hls.liveSyncPosition,g=o?(-1!==p?p:y)||o.start:e;this.log(_concatInstanceProperty(u=_concatInstanceProperty(h=_concatInstanceProperty(d="Setting startPosition to ".concat(g," to match initial live edge. mainStart: ")).call(d,p," liveSyncPosition: ")).call(h,y," frag.start: ")).call(u,null==(f=o)?void 0:f.start)),this.startPosition=this.nextLoadPosition=g}}else e<=i&&(o=r[0]);if(!o){var v=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,v,t)}return this.mapToInitFragWhenRequired(o)}},{key:"isLoopLoading",value:function(e,t){var r=this.fragmentTracker.getState(e);return(r===it||r===at&&!!e.gap)&&this.nextLoadPosition>t}},{key:"getNextFragmentLoopLoading",value:function(e,t,r,n,a){var i=null;if(e.gap&&(i=this.getNextFragment(this.nextLoadPosition,t))&&!i.gap&&r.nextStart){var s=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,n,0);if(null!==s&&r.len+s.len>=a){var o,l=i.sn;return this.loopSn!==l&&(this.log(_concatInstanceProperty(o='buffer full after gaps in "'.concat(n,'" playlist starting at sn: ')).call(o,l)),this.loopSn=l),null}}return this.loopSn=void 0,i}},{key:"mapToInitFragWhenRequired",value:function(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}},{key:"getNextPart",value:function(e,t,r){for(var n=-1,a=!1,i=!0,s=0,o=e.length;s<o;s++){var l=e[s];if(i=i&&!l.independent,n>-1&&r<l.start)break;var c=l.loaded;c?n=-1:(a||l.independent||i)&&l.fragment===t&&(n=s),a=c}return n}},{key:"loadedEndOfParts",value:function(e,t){var r=e[e.length-1];return r&&t>r.start&&r.loaded}},{key:"getInitialLiveFragment",value:function(e,t){var r=this.fragPrevious,n=null;if(r){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: ".concat(r.programDateTime)),n=function(e,t,r){if(null===t||!_Array$isArray(e)||!e.length||!O(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;r=r||0;for(var n=0;n<e.length;++n){var a=e[n];if(je(t,r,a))return a}return null}(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){var a=r.sn+1;if(a>=e.startSN&&a<=e.endSN){var i=t[a-e.startSN];r.cc===i.cc&&(n=i,this.log("Live playlist, switching playlist, load frag with next SN: ".concat(n.sn)))}n||(n=Ge(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: ".concat(n.sn))}}else{var s=this.hls.liveSyncPosition;null!==s&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}},{key:"getFragmentAtPosition",value:function(e,t,r){var n,a,i=this.config,s=this.fragPrevious,o=r.fragments,l=r.endSN,c=r.fragmentHint,u=i.maxFragLookUpTolerance,h=r.partList,d=!!(this.loadingParts&&null!=h&&h.length&&c);if(d&&c&&!this.bitrateTest&&h[h.length-1].fragment.sn===c.sn&&(o=_concatInstanceProperty(o).call(o,c),l=c.sn),n=e<t?Ue(s,o,e,e<this.lastCurrentTime||e>t-u||null!=(a=this.media)&&a.paused||!this.startFragRequested?0:u):o[o.length-1]){var f=n.sn-r.startSN,p=this.fragmentTracker.getState(n);if((p===it||p===at&&n.gap)&&(s=n),s&&n.sn===s.sn&&(!d||h[0].fragment.sn>n.sn||!r.live&&!d)&&s&&n.level===s.level){var y=o[f+1];n=n.sn<l&&this.fragmentTracker.getState(y)!==it?y:null}}return n}},{key:"alignPlaylists",value:function(e,t,r){var n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;var a,i,s=e.fragmentStart,o=!t,l=e.alignedSliding&&O(s);if(o||!l&&!s){var c,u,h;i=e,(a=r)&&(En(i,a),!i.alignedSliding&&a&&Tn(i,a),i.alignedSliding||!a||i.skippedSegments||pn(a,i,!1));var d=e.fragmentStart;return this.log(_concatInstanceProperty(c=_concatInstanceProperty(u=_concatInstanceProperty(h="Live playlist sliding: ".concat(d.toFixed(2)," start-sn: ")).call(h,t?t.startSN:"na","->")).call(u,e.startSN," fragments: ")).call(c,n)),d}return s}},{key:"waitForCdnTuneIn",value:function(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}},{key:"setStartPosition",value:function(e,t){var r=this.startPosition;if(r<t&&(r=-1),-1===r){var n,a,i=null!==this.startTimeOffset,s=i?this.startTimeOffset:e.startTimeOffset;null!==s&&O(s)?(r=t+s,s<0&&(r+=e.edge),r=Math.min(Math.max(t,r),t+e.totalduration),this.log(_concatInstanceProperty(n=_concatInstanceProperty(a="Setting startPosition to ".concat(r," for start time offset ")).call(a,s," found in ")).call(n,i?"multivariant":"media"," playlist")),this.startPosition=r):e.live?(r=this.hls.liveSyncPosition||t,this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=r=0),this.lastCurrentTime=r}this.nextLoadPosition=r}},{key:"getLoadPosition",value:function(){var e,t=this.media,r=0;return null!=(e=this.hls)&&e.hasEnoughToStart&&t?r=t.currentTime:this.nextLoadPosition>=0&&(r=this.nextLoadPosition),r}},{key:"handleFragLoadAborted",value:function(e,t){var r,n,a;this.transmuxer&&e.type===this.playlistType&&Ot(e)&&e.stats.aborted&&(this.warn(_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a="Fragment ".concat(e.sn)).call(a,t?" part "+t.index:""," of ")).call(n,this.playlistLabel()," ")).call(r,e.level," was aborted")),this.resetFragmentLoading(e))}},{key:"resetFragmentLoading",value:function(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===On)||(this.state=kn)}},{key:"onFragmentOrKeyLoadError",value:function(e,t){var r;if(t.chunkMeta&&!t.frag){var n=this.getCurrentContext(t.chunkMeta);n&&(t.frag=n.frag)}var a,i=t.frag;if(i&&i.type===e&&this.levels)if(this.fragContextChanged(i))this.warn(_concatInstanceProperty(r="Frag load error must match current frag to retry ".concat(i.url," > ")).call(r,null==(a=this.fragCurrent)?void 0:a.url));else{var s=t.details===w.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(i,!0);var o=t.errorAction,l=o||{},c=l.action,u=_flagsInstanceProperty(l),h=l.retryCount,d=void 0===h?0:h,f=l.retryConfig,p=!!o&&!!f,y=p&&c===Qe,g=p&&!o.resolved&&u===Ze;if(!y&&g&&Ot(i)&&!i.endList)this.resetFragmentErrors(e),this.treatAsGap(i),o.resolved=!0;else if((y||g)&&d<f.maxNumRetry){var v,m,$,S,I,_;this.resetStartWhenNotLoaded(this.levelLastLoaded);var E=Ve(f,d);this.warn(_concatInstanceProperty(v=_concatInstanceProperty(m=_concatInstanceProperty($=_concatInstanceProperty(S=_concatInstanceProperty(I=_concatInstanceProperty(_="Fragment ".concat(i.sn," of ")).call(_,e," ")).call(I,i.level," errored with ")).call(S,t.details,", retrying loading ")).call($,d+1,"/")).call(m,f.maxNumRetry," in ")).call(v,E,"ms")),o.resolved=!0,this.retryDate=self.performance.now()+E,this.state=On}else if(f&&o){var T;if(this.resetFragmentErrors(e),!(d<f.maxNumRetry))return void this.warn(_concatInstanceProperty(T="".concat(t.details," reached or exceeded max retry (")).call(T,d,")"));s||c===Xe||(o.resolved=!0)}else this.state=c===ze?Nn:xn;this.tickImmediate()}}},{key:"reduceLengthAndFlushBuffer",value:function(e){if(this.state===Cn||this.state===Dn){var t=e.frag,r=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,r),a=n&&n.len>.5;a&&this.reduceMaxBufferLength(n.len,(null==t?void 0:t.duration)||10);var i=!a;return i&&this.warn("Buffer full error while media.currentTime is not buffered, flush ".concat(r," buffer")),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),i}return!1}},{key:"resetFragmentErrors",value:function(e){e===j&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==bn&&(this.state=kn)}},{key:"afterBufferFlushed",value:function(e,t,r){if(e){var n=fr.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,r),this.state===wn&&this.resetLoadingState()}}},{key:"resetLoadingState",value:function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==bn&&(this.state=kn)}},{key:"resetStartWhenNotLoaded",value:function(e){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;var t=e?e.details:null;null!=t&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}},{key:"resetWhenMissingContext",value:function(e){var t,r;this.warn(_concatInstanceProperty(t=_concatInstanceProperty(r="The loading context changed while buffering fragment ".concat(e.sn," of ")).call(r,this.playlistLabel()," ")).call(t,e.level,". This chunk will not be buffered.")),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}},{key:"removeUnbufferedFrags",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}},{key:"updateLevelTiming",value:function(e,t,r,n){var a,i,s,o,l,c=this,u=r.details;if(u){if(!_reduceInstanceProperty(a=_Object$keys(e.elementaryStreams)).call(a,(function(t,a){var i=e.elementaryStreams[a];if(i){var s,o,l=i.endPTS-i.startPTS;if(l<=0)return c.warn(_concatInstanceProperty(s=_concatInstanceProperty(o="Could not parse fragment ".concat(e.sn," ")).call(o,a," duration reliably (")).call(s,l,")")),t||!1;var h=n?0:dn(u,e,i.startPTS,i.endPTS,i.startDTS,i.endDTS);return c.hls.trigger(x.LEVEL_PTS_UPDATED,{details:u,level:r,drift:h,type:a,frag:e,start:i.startPTS,end:i.endPTS}),!0}return t}),!1)&&null===(null==(l=this.transmuxer)?void 0:l.error)){var h,d,f,p,y=new Error(_concatInstanceProperty(h=_concatInstanceProperty(d="Found no media in fragment ".concat(e.sn," of ")).call(d,this.playlistLabel()," ")).call(h,e.level," resetting transmuxer to fallback to playlist timing"));if(0===r.fragmentError&&this.treatAsGap(e,r),this.warn(y.message),this.hls.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:y,frag:e,reason:_concatInstanceProperty(f=_concatInstanceProperty(p="Found no media in msn ".concat(e.sn," of ")).call(p,this.playlistLabel(),' "')).call(f,r.url,'"')}),!this.hls)return;this.resetTransmuxer()}this.state=Dn,this.log(_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o="Parsed ".concat(e.type," sn: ")).call(o,e.sn)).call(s,t?" part: "+t.index:""," of ")).call(i,this.fragInfo(e,!1,t),")")),this.hls.trigger(x.FRAG_PARSED,{frag:e,part:t})}else this.warn("level.details undefined")}},{key:"playlistLabel",value:function(){return this.playlistType===B?"level":"track"}},{key:"fragInfo",value:function(e){var t,r,n,a,i,s,o,l=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],c=arguments.length>2?arguments[2]:void 0;return _concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i="".concat(this.playlistLabel()," ")).call(i,e.level," (")).call(a,c?"part":"frag",":[")).call(n,(null!=(s=l&&!c?e.startPTS:(c||e).start)?s:NaN).toFixed(3),"-")).call(r,(null!=(o=l&&!c?e.endPTS:(c||e).end)?o:NaN).toFixed(3),"]")).call(t,c&&"main"===e.type?"INDEPENDENT="+(c.independent?"YES":"NO"):"")}},{key:"treatAsGap",value:function(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}},{key:"resetTransmuxer",value:function(){var e;null==(e=this.transmuxer)||e.reset()}},{key:"recoverWorkerError",value:function(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}},{key:"state",get:function(){return this._state},set:function(e){var t,r=this._state;r!==e&&(this._state=e,this.log(_concatInstanceProperty(t="".concat(r,"->")).call(t,e)))}}]),r}(ur),Un=function(){function e(){_classCallCheck(this,e),this.chunks=[],this.dataLength=0}return _createClass(e,[{key:"push",value:function(e){this.chunks.push(e),this.dataLength+=e.length}},{key:"flush",value:function(){var e,t=this.chunks,r=this.dataLength;return t.length?(e=1===t.length?t[0]:function(e,t){for(var r=new Uint8Array(t),n=0,a=0;a<e.length;a++){var i=e[a];r.set(i,n),n+=i.length}return r}(t,r),this.reset(),e):new Uint8Array(0)}},{key:"reset",value:function(){this.chunks.length=0,this.dataLength=0}}]),e}(),Bn={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function i(e,t,n,i,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new a(n,i||e,s),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function o(){this._events=new n,this._eventsCount=0}_Object$create&&(n.prototype=_Object$create(null),(new n).__proto__||(r=!1)),o.prototype.eventNames=function(){var e,n,a=[];if(0===this._eventsCount)return a;for(n in e=this._events)t.call(e,n)&&a.push(r?_sliceInstanceProperty(n).call(n,1):n);return _Object$getOwnPropertySymbols?_concatInstanceProperty(a).call(a,_Object$getOwnPropertySymbols(e)):a},o.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 a=0,i=n.length,s=new Array(i);a<i;a++)s[a]=n[a].fn;return s},o.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},o.prototype.emit=function(e,t,n,a,i,s){var o=r?r+e:e;if(!this._events[o])return!1;var l,c,u=this._events[o],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,a),!0;case 5:return u.fn.call(u.context,t,n,a,i),!0;case 6:return u.fn.call(u.context,t,n,a,i,s),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,a);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];u[c].fn.apply(u[c].context,l)}}return!0},o.prototype.on=function(e,t,r){return i(this,e,t,r,!1)},o.prototype.once=function(e,t,r){return i(this,e,t,r,!0)},o.prototype.removeListener=function(e,t,n,a){var i=r?r+e:e;if(!this._events[i])return this;if(!t)return s(this,i),this;var o=this._events[i];if(o.fn)o.fn!==t||a&&!o.once||n&&o.context!==n||s(this,i);else{for(var l=0,c=[],u=o.length;l<u;l++)(o[l].fn!==t||a&&!o[l].once||n&&o[l].context!==n)&&c.push(o[l]);c.length?this._events[i]=1===c.length?c[0]:c:s(this,i)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,e.exports=o}(Bn);var jn=vt(Bn.exports),Gn="1.6.0-beta.2",Kn={};function Hn(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Vn(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128}function Wn(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3]}function Yn(e,t){for(var r=t,n=0;Vn(e,t);)n+=10,n+=Wn(e,t+6),Hn(e,t+10)&&(n+=10),t+=n;if(n>0)return e.subarray(r,r+n)}function qn(e,t){return 255===e[t]&&240==(246&e[t+1])}function zn(e,t){return 1&e[t+1]?7:9}function Xn(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Qn(e,t){return t+1<e.length&&qn(e,t)}function Jn(e,t){if(Qn(e,t)){var r=zn(e,t);if(t+r>=e.length)return!1;var n=Xn(e,t);if(n<=r)return!1;var a=t+n;return a===e.length||Qn(e,a)}return!1}function Zn(e,t,r,n,a){if(!e.samplerate){var i=function(e,t,r,n,a,i,s,o,l){var c=t[r+2],u=c>>2&15;if(!(u>12)){var h=1+(c>>6&3),d=t[r+3]>>6&3|(1&c)<<2,f="mp4a.40."+h,p=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][u],y=u;5!==h&&29!==h||(y-=3);var g=[h<<3|(14&y)>>1,(1&y)<<7|d<<3];return te.log(_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o=_concatInstanceProperty(l="manifest codec:".concat(n,", parsed codec:")).call(l,f,", channels:")).call(o,d,", rate:")).call(s,p," (ADTS object type:")).call(i,h," sampling index:")).call(a,u,")")),{config:g,samplerate:p,channelCount:d,codec:f,parsedCodec:f,manifestCodec:n}}var v=new Error("invalid ADTS sampling index:".concat(u));e.emit(x.ERROR,x.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!0,error:v,reason:v.message})}(t,r,n,a);if(!i)return;W(e,i)}}function ea(e){return 9216e4/e}function ta(e,t,r,n,a){var i,s=n+a*ea(e.samplerate),o=function(e,t){var r=zn(e,t);if(t+r<=e.length){var n=Xn(e,t)-r;if(n>0)return{headerLength:r,frameLength:n}}}(t,r);if(o){var l=o.frameLength,c=o.headerLength,u=c+l,h=Math.max(0,r+u-t.length);h?(i=new Uint8Array(u-c)).set(t.subarray(r+c,t.length),0):i=t.subarray(r+c,r+u);var d={unit:i,pts:s};return h||e.samples.push(d),{sample:d,length:u,missing:h}}var f=t.length-r;return(i=new Uint8Array(f)).set(t.subarray(r,t.length),0),{sample:{unit:i,pts:s},length:f,missing:-1}}function ra(e,t){return Vn(e,t)&&Wn(e,t+6)+10<=e.length-t}function na(e){return function(e,t,r,n){var a,i=(a=e)instanceof ArrayBuffer?a:a.buffer,s=1;"BYTES_PER_ELEMENT"in n&&(s=n.BYTES_PER_ELEMENT);var o,l=(o=e)&&o.buffer instanceof ArrayBuffer&&void 0!==o.byteLength&&void 0!==o.byteOffset?e.byteOffset:0,c=(l+e.byteLength)/s,u=(l+t)/s,h=Math.floor(Math.max(0,Math.min(u,c)));return new n(i,h,Math.floor(Math.min(h+Math.max(r,0),c))-h)}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,Uint8Array)}function aa(e,t){if(e<0)return-aa(-e,t);var r=Math.pow(10,t);if(Math.abs(e*r%1-.5)<_Number$EPSILON){var n=Math.floor(e*r);return(n%2==0?n:n+1)/r}return Math.round(e*r)/r}function ia(e){var t,r,n={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(!(e.size<2))if(3===e.data[0]){var a=_indexOfInstanceProperty(t=e.data.subarray(1)).call(t,0);if(-1!==a){var i=yt(na(e.data,1,a)),s=e.data[2+a],o=_indexOfInstanceProperty(r=e.data.subarray(3+a)).call(r,0);if(-1!==o){var l,c,u=yt(na(e.data,3+a,o));return l="--\x3e"===i?yt(na(e.data,4+a+o)):(c=e.data.subarray(4+a+o))instanceof ArrayBuffer?c:0==c.byteOffset&&c.byteLength==c.buffer.byteLength?c.buffer:new Uint8Array(c).buffer,n.mimeType=i,n.pictureType=s,n.description=u,n.data=l,n}}}else console.log("Ignore frame with unrecognized character encoding")}function sa(e){return"PRIV"===e.type?function(e){if(!(e.size<2)){var t=yt(e.data,!0),r=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:r.buffer}}}(e):"W"===e.type[0]?function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,r=yt(e.data.subarray(t),!0);t+=r.length+1;var n=yt(e.data.subarray(t));return{key:e.type,info:r,data:n}}var a=yt(e.data);return{key:e.type,info:"",data:a}}(e):"APIC"===e.type?ia(e):function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,r=yt(e.data.subarray(t),!0);t+=r.length+1;var n=yt(e.data.subarray(t));return{key:e.type,info:r,data:n}}var a=yt(e.data.subarray(1));return{key:e.type,info:"",data:a}}}(e)}function oa(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=Wn(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}}function la(e){for(var t=0,r=[];Vn(e,t);){var n=Wn(e,t+6);e[t+5]>>6&1&&(t+=10);for(var a=(t+=10)+n;t+10<a;){var i=oa(e.subarray(t)),s=sa(i);s&&r.push(s),t+=i.size+10}Hn(e,t)&&(t+=10)}return r}function ca(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function ua(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],n=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return n/=45,r&&(n+=47721858.84),Math.round(n)}}function ha(e){for(var t=la(e),r=0;r<t.length;r++){var n=t[r];if(ca(n))return ua(n)}}var da=function(e){return e.audioId3="org.id3",e.dateRange="com.apple.quicktime.HLS",e.emsg="https://aomedia.org/emsg/ID3",e.misbklv="urn:misb:KLV:bin:1910.1",e}({});function fa(){return{type:arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",id:-1,pid:-1,inputTimeScale:arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4,sequenceNumber:-1,samples:[],dropped:0}}var pa=function(){function e(){_classCallCheck(this,e),this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}return _createClass(e,[{key:"resetInitSegment",value:function(e,t,r,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}},{key:"resetTimeStamp",value:function(e){this.initPTS=e,this.resetContiguity()}},{key:"resetContiguity",value:function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}},{key:"canParse",value:function(e,t){return!1}},{key:"appendFrame",value:function(e,t,r){}},{key:"demux",value:function(e,t){this.cachedData&&(e=Qt(this.cachedData,e),this.cachedData=null);var r,n=Yn(e,0),a=n?n.length:0,i=this._audioTrack,s=this._id3Track,o=n?ha(n):void 0,l=e.length;for((null===this.basePTS||0===this.frameIndex&&O(o))&&(this.basePTS=ya(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),n&&n.length>0&&s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:da.audioId3,duration:Number.POSITIVE_INFINITY});a<l;){if(this.canParse(e,a)){var c=this.appendFrame(i,e,a);c?(this.frameIndex++,this.lastPTS=c.sample.pts,r=a+=c.length):a=l}else ra(e,a)?(n=Yn(e,a),s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:da.audioId3,duration:Number.POSITIVE_INFINITY}),r=a+=n.length):a++;if(a===l&&r!==l){var u=dt(e,r);this.cachedData?this.cachedData=Qt(this.cachedData,u):this.cachedData=u}}return{audioTrack:i,videoTrack:fa(),id3Track:s,textTrack:fa()}}},{key:"demuxSampleAes",value:function(e,t,r){return _Promise.reject(new Error("[".concat(this,"] This demuxer does not support Sample-AES decryption")))}},{key:"flush",value:function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:fa(),id3Track:this._id3Track,textTrack:fa()}}},{key:"destroy",value:function(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}]),e}(),ya=function(e,t,r){return O(e)?90*e:9e4*t+(r?9e4*r.baseTime/r.timescale:0)},ga=null,va=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],ma=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],$a=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Sa=[0,1,1,4];function Ia(e,t,r,n,a){if(!(r+24>t.length)){var i=_a(t,r);if(i&&r+i.frameLength<=t.length){var s=n+a*(9e4*i.samplesPerFrame/i.sampleRate),o={unit:t.subarray(r,r+i.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=i.channelCount,e.samplerate=i.sampleRate,e.samples.push(o),{sample:o,length:i.frameLength,missing:0}}}}function _a(e,t){var r=e[t+1]>>3&3,n=e[t+1]>>1&3,a=e[t+2]>>4&15,i=e[t+2]>>2&3;if(1!==r&&0!==a&&15!==a&&3!==i){var s=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*va[14*(3===r?3-n:3===n?3:4)+a-1],c=ma[3*(3===r?0:2===r?1:2)+i],u=3===o?1:2,h=$a[r][n],d=Sa[n],f=8*h*d,p=Math.floor(h*l/c+s)*d;if(null===ga){var y=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ga=y?_parseInt$1(y[1]):0}return!!ga&&ga<=87&&2===n&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:c,channelCount:u,frameLength:p,samplesPerFrame:f}}}function Ea(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function Ta(e,t){return t+1<e.length&&Ea(e,t)}function Pa(e,t){if(t+1<e.length&&Ea(e,t)){var r=4,n=_a(e,t),a=r;null!=n&&n.frameLength&&(a=n.frameLength);var i=t+a;return i===e.length||Ta(e,i)}return!1}var ba=function(e,t){var r=0,n=5;t+=n;for(var a=new Uint32Array(1),i=new Uint32Array(1),s=new Uint8Array(1);n>0;){s[0]=e[t];var o=Math.min(n,8),l=8-o;i[0]=4278190080>>>24+l<<l,a[0]=(s[0]&i[0])>>l,r=r?r<<o|a[0]:a[0],t+=1,n-=o}return r},ka=function(e){_inherits(r,e);var t=_createSuper(r);function r(e){var n;return _classCallCheck(this,r),(n=t.call(this)).observer=void 0,n.observer=e,n}return _createClass(r,[{key:"resetInitSegment",value:function(e,t,n,a){_get(_getPrototypeOf(r.prototype),"resetInitSegment",this).call(this,e,t,n,a),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:a,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return t+64<e.length}},{key:"appendFrame",value:function(e,t,r){var n=Aa(e,t,r,this.basePTS,this.frameIndex);if(-1!==n)return{sample:e.samples[e.samples.length-1],length:n,missing:0}}}],[{key:"probe",value:function(e){if(!e)return!1;var t=Yn(e,0);if(!t)return!1;var r=t.length;return 11===e[r]&&119===e[r+1]&&void 0!==ha(t)&&ba(e,r)<16}}]),r}(pa);function Aa(e,t,r,n,a){if(r+8>t.length)return-1;if(11!==t[r]||119!==t[r+1])return-1;var i=t[r+4]>>6;if(i>=3)return-1;var s=[48e3,44100,32e3][i],o=63&t[r+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+i];if(r+l>t.length)return-1;var c=t[r+6]>>5,u=0;2===c?u+=2:(1&c&&1!==c&&(u+=2),4&c&&(u+=2));var h=(t[r+6]<<8|t[r+7])>>12-u&1,d=[2,1,2,3,3,4,4,5][c]+h,f=t[r+5]>>3,p=7&t[r+5],y=new Uint8Array([i<<6|f<<1|p>>2,(3&p)<<6|c<<3|h<<2|o>>4,o<<4&224]),g=n+a*(1536/s*9e4),v=t.subarray(r,r+l);return e.config=y,e.channelCount=d,e.samplerate=s,e.samples.push({unit:v,pts:g}),l}var Ra=/\/emsg[-/]ID3/i;function Oa(e,t){return O(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}var La=function(){function e(t,r,n){_classCallCheck(this,e),this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new ar(r,{removePKCS7Padding:!1})}return _createClass(e,[{key:"decryptBuffer",value:function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,ct)}},{key:"decryptAacSample",value:function(e,t,r){var n,a=this,i=e[t].unit;if(!(i.length<=16)){var s=i.subarray(16,i.length-i.length%16),o=_sliceInstanceProperty(n=s.buffer).call(n,s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(o).then((function(n){var s=new Uint8Array(n);i.set(s,16),a.decrypter.isSync()||a.decryptAacSamples(e,t+1,r)}))}}},{key:"decryptAacSamples",value:function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,r),this.decrypter.isSync())))return}}},{key:"getAvcEncryptedData",value:function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),n=0,a=32;a<e.length-16;a+=160,n+=16)r.set(e.subarray(a,a+16),n);return r}},{key:"getAvcDecryptedUnit",value:function(e,t){for(var r=new Uint8Array(t),n=0,a=32;a<e.length-16;a+=160,n+=16)e.set(r.subarray(n,n+16),a);return e}},{key:"decryptAvcSample",value:function(e,t,r,n,a){var i=this,s=tr(a.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then((function(o){a.data=i.getAvcDecryptedUnit(s,o),i.decrypter.isSync()||i.decryptAvcSamples(e,t,r+1,n)}))}},{key:"decryptAvcSamples",value:function(e,t,r,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length)return void n();for(var a=e[t].units;!(r>=a.length);r++){var i=a[r];if(!(i.data.length<=48||1!==i.type&&5!==i.type||(this.decryptAvcSample(e,t,r,n,i),this.decrypter.isSync())))return}}}}]),e}(),Ca=function(){function e(){_classCallCheck(this,e),this.VideoSample=null}return _createClass(e,[{key:"createVideoSample",value:function(e,t,r){return{key:e,frame:!1,pts:t,dts:r,units:[],length:0}}},{key:"getLastNalUnit",value:function(e){var t,r,n=this.VideoSample;if(n&&0!==n.units.length||(n=e[e.length-1]),null!=(t=n)&&t.units){var a=n.units;r=a[a.length-1]}return r}},{key:"pushAccessUnit",value:function(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var r=t.samples,n=r.length;if(!n)return void t.dropped++;var a=r[n-1];e.pts=a.pts,e.dts=a.dts}t.samples.push(e)}}},{key:"parseNALu",value:function(e,t,r){var n,a,i=t.byteLength,s=e.naluState||0,o=s,l=[],c=0,u=-1,h=0;for(-1===s&&(u=0,h=this.getNALuType(t,0),s=0,c=1);c<i;)if(n=t[c++],s)if(1!==s)if(n)if(1===n){if(a=c-s-1,u>=0){var d={data:t.subarray(u,a),type:h};l.push(d)}else{var f=this.getLastNalUnit(e.samples);f&&(o&&c<=4-o&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-o)),a>0&&(f.data=Qt(f.data,t.subarray(0,a)),f.state=0))}c<i?(u=c,h=this.getNALuType(t,c),s=0):s=-1}else s=0;else s=3;else s=n?0:2;else s=n?0:1;if(u>=0&&s>=0){var p={data:t.subarray(u,i),type:h,state:s};l.push(p)}if(0===l.length){var y=this.getLastNalUnit(e.samples);y&&(y.data=Qt(y.data,t))}return e.naluState=s,l}}]),e}(),Da=function(){function e(t){_classCallCheck(this,e),this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}return _createClass(e,[{key:"loadWord",value:function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,n=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");n.set(e.subarray(r,r+a)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*a,this.bytesAvailable-=a}},{key:"skipBits",value:function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;if(e>32&&te.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>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:"skipEG",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:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}]),e}(),wa=function(e){_inherits(r,e);var t=_createSuper(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass(r,[{key:"parsePES",value:function(e,t,r,n){var a,i=this,s=this.parseNALu(e,r.data,n),o=this.VideoSample,l=!1;r.data=null,o&&s.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),_forEachInstanceProperty(s).call(s,(function(n){var s,c;switch(n.type){case 1:var u=!1;a=!0;var h,d=n.data;if(l&&d.length>4){var f=i.readSliceType(d);2!==f&&4!==f&&7!==f&&9!==f||(u=!0)}u&&null!=(h=o)&&h.frame&&!o.key&&(i.pushAccessUnit(o,e),o=i.VideoSample=null),o||(o=i.VideoSample=i.createVideoSample(!0,r.pts,r.dts)),o.frame=!0,o.key=u;break;case 5:a=!0,null!=(s=o)&&s.frame&&!o.key&&(i.pushAccessUnit(o,e),o=i.VideoSample=null),o||(o=i.VideoSample=i.createVideoSample(!0,r.pts,r.dts)),o.key=!0,o.frame=!0;break;case 6:a=!0,er(n.data,1,r.pts,t.samples);break;case 7:var p,y;a=!0,l=!0;var g=n.data,v=i.readSPS(g);if(!e.sps||e.width!==v.width||e.height!==v.height||(null==(p=e.pixelRatio)?void 0:p[0])!==v.pixelRatio[0]||(null==(y=e.pixelRatio)?void 0:y[1])!==v.pixelRatio[1]){e.width=v.width,e.height=v.height,e.pixelRatio=v.pixelRatio,e.sps=[g];for(var m=g.subarray(1,4),$="avc1.",S=0;S<3;S++){var I=m[S].toString(16);I.length<2&&(I="0"+I),$+=I}e.codec=$}break;case 8:a=!0,e.pps=[n.data];break;case 9:a=!0,e.audFound=!0,null!=(c=o)&&c.frame&&(i.pushAccessUnit(o,e),o=null),o||(o=i.VideoSample=i.createVideoSample(!1,r.pts,r.dts));break;case 12:a=!0;break;default:a=!1}o&&a&&o.units.push(n)})),n&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}},{key:"getNALuType",value:function(e,t){return 31&e[t]}},{key:"readSliceType",value:function(e){var t=new Da(e);return t.readUByte(),t.readUEG(),t.readUEG()}},{key:"skipScalingList",value:function(e,t){for(var r=8,n=8,a=0;a<e;a++)0!==n&&(n=(r+t.readEG()+256)%256),r=0===n?r:n}},{key:"readSPS",value:function(e){var t,r,n,a,i,s,o,l,c,u,h,d=new Da(e),f=0,p=0,y=0,g=0,v=_bindInstanceProperty(t=d.readUByte).call(t,d),m=_bindInstanceProperty(r=d.readBits).call(r,d),$=_bindInstanceProperty(n=d.readUEG).call(n,d),S=_bindInstanceProperty(a=d.readBoolean).call(a,d),I=_bindInstanceProperty(i=d.skipBits).call(i,d),_=_bindInstanceProperty(s=d.skipEG).call(s,d),E=_bindInstanceProperty(o=d.skipUEG).call(o,d),T=_bindInstanceProperty(l=this.skipScalingList).call(l,this);v();var P=v();if(m(5),I(3),v(),E(),100===P||110===P||122===P||244===P||44===P||83===P||86===P||118===P||128===P){var b=$();if(3===b&&I(1),E(),E(),I(1),S())for(u=3!==b?8:12,h=0;h<u;h++)S()&&T(h<6?16:64,d)}E();var k=$();if(0===k)$();else if(1===k)for(I(1),_(),_(),c=$(),h=0;h<c;h++)_();E(),I(1);var A=$(),R=$(),O=m(1);0===O&&I(1),I(1),S()&&(f=$(),p=$(),y=$(),g=$());var L=[1,1];if(S()&&S())switch(v()){case 1:L=[1,1];break;case 2:L=[12,11];break;case 3:L=[10,11];break;case 4:L=[16,11];break;case 5:L=[40,33];break;case 6:L=[24,11];break;case 7:L=[20,11];break;case 8:L=[32,11];break;case 9:L=[80,33];break;case 10:L=[18,11];break;case 11:L=[15,11];break;case 12:L=[64,33];break;case 13:L=[160,99];break;case 14:L=[4,3];break;case 15:L=[3,2];break;case 16:L=[2,1];break;case 255:L=[v()<<8|v(),v()<<8|v()]}return{width:Math.ceil(16*(A+1)-2*f-2*p),height:(2-O)*(R+1)*16-(O?2:4)*(y+g),pixelRatio:L}}}]),r}(Ca),xa=function(e){_inherits(r,e);var t=_createSuper(r);function r(){var e,n;_classCallCheck(this,r);for(var a=arguments.length,i=new Array(a),s=0;s<a;s++)i[s]=arguments[s];return(n=t.call.apply(t,_concatInstanceProperty(e=[this]).call(e,i))).initVPS=null,n}return _createClass(r,[{key:"parsePES",value:function(e,t,r,n){var a,i=this,s=this.parseNALu(e,r.data,n),o=this.VideoSample,l=!1;r.data=null,o&&s.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),_forEachInstanceProperty(s).call(s,(function(n){var s,c;switch(n.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||(o=i.VideoSample=i.createVideoSample(!1,r.pts,r.dts)),o.frame=!0,a=!0;break;case 16:case 17:case 18:case 21:var u;a=!0,l&&null!=(u=o)&&u.frame&&!o.key&&(i.pushAccessUnit(o,e),o=i.VideoSample=null),o||(o=i.VideoSample=i.createVideoSample(!0,r.pts,r.dts)),o.key=!0,o.frame=!0;break;case 19:case 20:a=!0,null!=(s=o)&&s.frame&&!o.key&&(i.pushAccessUnit(o,e),o=i.VideoSample=null),o||(o=i.VideoSample=i.createVideoSample(!0,r.pts,r.dts)),o.key=!0,o.frame=!0;break;case 39:a=!0,er(n.data,2,r.pts,t.samples);break;case 32:if(a=!0,!e.vps){var h=i.readVPS(n.data);e.params=q({},h),i.initVPS=n.data}e.vps=[n.data];break;case 33:if(a=!0,l=!0,"object"==_typeof(e.params)){if(void 0===e.vps||e.vps[0]===i.initVPS||void 0===e.sps||i.matchSPS(e.sps[0],n.data)||(i.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){var d=i.readSPS(n.data);for(var f in e.width=d.width,e.height=d.height,e.pixelRatio=d.pixelRatio,e.codec=d.codecString,e.sps=[],d.params)e.params[f]=d.params[f]}void 0!==e.vps&&e.vps[0]===i.initVPS&&e.sps.push(n.data)}o||(o=i.VideoSample=i.createVideoSample(!0,r.pts,r.dts)),o.key=!0;break;case 34:if(a=!0,"object"==_typeof(e.params)){if(!e.pps){e.pps=[];var p=i.readPPS(n.data);for(var y in p)e.params[y]=p[y]}void 0!==e.vps&&e.vps[0]===i.initVPS&&e.pps.push(n.data)}break;case 35:a=!0,e.audFound=!0,null!=(c=o)&&c.frame&&(i.pushAccessUnit(o,e),o=null),o||(o=i.VideoSample=i.createVideoSample(!1,r.pts,r.dts));break;default:a=!1}o&&a&&o.units.push(n)})),n&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}},{key:"getNALuType",value:function(e,t){return(126&e[t])>>>1}},{key:"ebsp2rbsp",value:function(e){for(var t=new Uint8Array(e.byteLength),r=0,n=0;n<e.byteLength;n++)n>=2&&3===e[n]&&0===e[n-1]&&0===e[n-2]||(t[r]=e[n],r++);return new Uint8Array(t.buffer,0,r)}},{key:"pushAccessUnit",value:function(e,t){_get(_getPrototypeOf(r.prototype),"pushAccessUnit",this).call(this,e,t),this.initVPS&&(this.initVPS=null)}},{key:"readVPS",value:function(e){var t=new Da(e);return t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6),{numTemporalLayers:t.readBits(3)+1,temporalIdNested:t.readBoolean()}}},{key:"readSPS",value:function(e){var t,r,n,a,i=new Da(this.ebsp2rbsp(e));i.readUByte(),i.readUByte(),i.readBits(4);var s=i.readBits(3);i.readBoolean();for(var o=i.readBits(2),l=i.readBoolean(),c=i.readBits(5),u=i.readUByte(),h=i.readUByte(),d=i.readUByte(),f=i.readUByte(),p=i.readUByte(),y=i.readUByte(),g=i.readUByte(),v=i.readUByte(),m=i.readUByte(),$=i.readUByte(),S=i.readUByte(),I=[],_=[],E=0;E<s;E++)I.push(i.readBoolean()),_.push(i.readBoolean());if(s>0)for(var T=s;T<8;T++)i.readBits(2);for(var P=0;P<s;P++)I[P]&&(i.readUByte(),i.readUByte(),i.readUByte(),i.readUByte(),i.readUByte(),i.readUByte(),i.readUByte(),i.readUByte(),i.readUByte(),i.readUByte(),i.readUByte()),_[P]&&i.readUByte();i.readUEG();var b=i.readUEG();3==b&&i.skipBits(1);var k=i.readUEG(),A=i.readUEG(),R=i.readBoolean(),O=0,L=0,C=0,D=0;R&&(O+=i.readUEG(),L+=i.readUEG(),C+=i.readUEG(),D+=i.readUEG());for(var w=i.readUEG(),x=i.readUEG(),M=i.readUEG(),N=i.readBoolean()?0:s;N<=s;N++)i.skipUEG(),i.skipUEG(),i.skipUEG();if(i.skipUEG(),i.skipUEG(),i.skipUEG(),i.skipUEG(),i.skipUEG(),i.skipUEG(),i.readBoolean()&&i.readBoolean())for(var F=0;F<4;F++)for(var U=0;U<(3===F?2:6);U++)if(i.readBoolean()){var B=Math.min(64,1<<4+(F<<1));F>1&&i.readEG();for(var j=0;j<B;j++)i.readEG()}else i.readUEG();i.readBoolean(),i.readBoolean(),i.readBoolean()&&(i.readUByte(),i.skipUEG(),i.skipUEG(),i.readBoolean());for(var G=i.readUEG(),K=0,H=0;H<G;H++){var V=!1;if(0!==H&&(V=i.readBoolean()),V){H===G&&i.readUEG(),i.readBoolean(),i.readUEG();for(var W=0,Y=0;Y<=K;Y++){var q=i.readBoolean(),z=!1;q||(z=i.readBoolean()),(q||z)&&W++}K=W}else{var X=i.readUEG(),Q=i.readUEG();K=X+Q;for(var J=0;J<X;J++)i.readUEG(),i.readBoolean();for(var Z=0;Z<Q;Z++)i.readUEG(),i.readBoolean()}}if(i.readBoolean())for(var ee=i.readUEG(),te=0;te<ee;te++){for(var re=0;re<M+4;re++)i.readBits(1);i.readBits(1)}var ne=0,ae=1,ie=1,se=!0,oe=1,le=0;i.readBoolean(),i.readBoolean();var ce=!1;if(i.readBoolean()){if(i.readBoolean()){var ue=i.readUByte();ue>0&&ue<16?(ae=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][ue-1],ie=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][ue-1]):255===ue&&(ae=i.readBits(16),ie=i.readBits(16))}if(i.readBoolean()&&i.readBoolean(),i.readBoolean()&&(i.readBits(3),i.readBoolean(),i.readBoolean()&&(i.readUByte(),i.readUByte(),i.readUByte())),i.readBoolean()&&(i.readUEG(),i.readUEG()),i.readBoolean(),i.readBoolean(),i.readBoolean(),(ce=i.readBoolean())&&(O+=i.readUEG(),L+=i.readUEG(),C+=i.readUEG(),D+=i.readUEG()),i.readBoolean()&&(oe=i.readBits(32),le=i.readBits(32),i.readBoolean()&&i.readUEG(),i.readBoolean())){var he=i.readBoolean(),de=i.readBoolean(),fe=!1;(he||de)&&((fe=i.readBoolean())&&(i.readUByte(),i.readBits(5),i.readBoolean(),i.readBits(5)),i.readBits(4),i.readBits(4),fe&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(var pe=0;pe<=s;pe++){var ye=!1;(se=i.readBoolean())||i.readBoolean()?i.readEG():ye=i.readBoolean();var ge=ye?1:i.readUEG()+1;if(he)for(var ve=0;ve<ge;ve++)i.readUEG(),i.readUEG(),fe&&(i.readUEG(),i.readUEG()),i.skipBits(1);if(de)for(var me=0;me<ge;me++)i.readUEG(),i.readUEG(),fe&&(i.readUEG(),i.readUEG()),i.skipBits(1)}}i.readBoolean()&&(i.readBoolean(),i.readBoolean(),i.readBoolean(),ne=i.readUEG())}var $e=k,Se=A;if(R||ce){var Ie=1,_e=1;1===b?Ie=_e=2:2==b&&(Ie=2),$e=k-Ie*L-Ie*O,Se=A-_e*D-_e*C}for(var Ee=o?["A","B","C"][o]:"",Te=u<<24|h<<16|d<<8|f,Pe=0,be=0;be<32;be++)Pe=(Pe|(Te>>be&1)<<31-be)>>>0;var ke=Pe.toString(16);return 1===c&&"2"===ke&&(ke="6"),{codecString:_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a="hvc1.".concat(Ee)).call(a,c,".")).call(n,ke,".")).call(r,l?"H":"L")).call(t,S,".B0"),params:{general_tier_flag:l,general_profile_idc:c,general_profile_space:o,general_profile_compatibility_flags:[u,h,d,f],general_constraint_indicator_flags:[p,y,g,v,m,$],general_level_idc:S,bit_depth:w+8,bit_depth_luma_minus8:w,bit_depth_chroma_minus8:x,min_spatial_segmentation_idc:ne,chroma_format_idc:b,frame_rate:{fixed:se,fps:le/oe}},width:$e,height:Se,pixelRatio:[ae,ie]}}},{key:"readPPS",value:function(e){var t=new Da(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);var r=t.readBoolean(),n=t.readBoolean(),a=1;return n&&r?a=0:n?a=3:r&&(a=2),{parallelismType:a}}},{key:"matchSPS",value:function(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}]),r}(Ca),Ma=188,Na=function(){function e(t,r,n,a){_classCallCheck(this,e),this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=r,this.typeSupported=n,this.logger=a,this.videoParser=null}return _createClass(e,[{key:"resetInitSegment",value:function(t,r,n,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._videoTrack.duration=a,this._audioTrack=e.createTrack("audio",a),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=r,this.videoCodec=n}},{key:"resetTimeStamp",value:function(){}},{key:"resetContiguity",value:function(){var e=this._audioTrack,t=this._videoTrack,r=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}},{key:"demux",value:function(t,r){var n,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];a||(this.sampleAes=null);var s=this._videoTrack,o=this._audioTrack,l=this._id3Track,c=this._txtTrack,u=s.pid,h=s.pesData,d=o.pid,f=l.pid,p=o.pesData,y=l.pesData,g=null,v=this.pmtParsed,m=this._pmtId,$=t.length;if(this.remainderData&&($=(t=Qt(this.remainderData,t)).length,this.remainderData=null),$<Ma&&!i)return this.remainderData=t,{audioTrack:o,videoTrack:s,id3Track:l,textTrack:c};var S=Math.max(0,e.syncOffset(t));($-=($-S)%Ma)<t.byteLength&&!i&&(this.remainderData=new Uint8Array(t.buffer,$,t.buffer.byteLength-$));for(var I=0,_=S;_<$;_+=Ma)if(71===t[_]){var E=!!(64&t[_+1]),T=Fa(t,_),P=void 0;if((48&t[_+3])>>4>1){if((P=_+5+t[_+4])===_+Ma)continue}else P=_+4;switch(T){case u:if(E){if(h&&(n=Ka(h,this.logger))){if(null===this.videoParser)switch(s.segmentCodec){case"avc":this.videoParser=new wa;break;case"hevc":this.videoParser=new xa}null!==this.videoParser&&this.videoParser.parsePES(s,c,n,!1)}h={data:[],size:0}}h&&(h.data.push(t.subarray(P,_+Ma)),h.size+=_+Ma-P);break;case d:if(E){if(p&&(n=Ka(p,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break;case"ac3":this.parseAC3PES(o,n)}p={data:[],size:0}}p&&(p.data.push(t.subarray(P,_+Ma)),p.size+=_+Ma-P);break;case f:E&&(y&&(n=Ka(y,this.logger))&&this.parseID3PES(l,n),y={data:[],size:0}),y&&(y.data.push(t.subarray(P,_+Ma)),y.size+=_+Ma-P);break;case 0:E&&(P+=t[P]+1),m=this._pmtId=Ua(t,P);break;case m:var b,k;E&&(P+=t[P]+1);var A=Ba(t,P,this.typeSupported,a,this.observer,this.logger);(u=A.videoPid)>0&&(s.pid=u,s.segmentCodec=A.segmentVideoCodec),(d=A.audioPid)>0&&(o.pid=d,o.segmentCodec=A.segmentAudioCodec),(f=A.id3Pid)>0&&(l.pid=f),null===g||v||(this.logger.warn(_concatInstanceProperty(b=_concatInstanceProperty(k="MPEG-TS PMT found at ".concat(_," after unknown PID '")).call(k,g,"'. Backtracking to sync byte @")).call(b,S," to parse all TS packets.")),g=null,_=S-188),v=this.pmtParsed=!0;break;case 17:case 8191:break;default:g=T}}else I++;I>0&&ja(this.observer,new Error("Found ".concat(I," TS packet/s that do not start with 0x47")),void 0,this.logger),s.pesData=h,o.pesData=p,l.pesData=y;var R={audioTrack:o,videoTrack:s,id3Track:l,textTrack:c};return i&&this.extractRemainingSamples(R),R}},{key:"flush",value:function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e}},{key:"extractRemainingSamples",value:function(e){var t,r=e.audioTrack,n=e.videoTrack,a=e.id3Track,i=e.textTrack,s=n.pesData,o=r.pesData,l=a.pesData;if(s&&(t=Ka(s,this.logger))){if(null===this.videoParser)switch(n.segmentCodec){case"avc":this.videoParser=new wa;break;case"hevc":this.videoParser=new xa}null!==this.videoParser&&(this.videoParser.parsePES(n,i,t,!0),n.pesData=null)}else n.pesData=s;if(o&&(t=Ka(o,this.logger))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,t);break;case"mp3":this.parseMPEGPES(r,t);break;case"ac3":this.parseAC3PES(r,t)}r.pesData=null}else null!=o&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=o;l&&(t=Ka(l,this.logger))?(this.parseID3PES(a,t),a.pesData=null):a.pesData=l}},{key:"demuxSampleAes",value:function(e,t,r){var n=this.demux(e,r,!0,!this.config.progressive),a=this.sampleAes=new La(this.observer,this.config,t);return this.decrypt(n,a)}},{key:"decrypt",value:function(e,t){return new _Promise((function(r){var n=e.audioTrack,a=e.videoTrack;n.samples&&"aac"===n.segmentCodec?t.decryptAacSamples(n.samples,0,(function(){a.samples?t.decryptAvcSamples(a.samples,0,0,(function(){r(e)})):r(e)})):a.samples&&t.decryptAvcSamples(a.samples,0,0,(function(){r(e)}))}))}},{key:"destroy",value:function(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}},{key:"parseAACPES",value:function(e,t){var r,n,a,i=0,s=this.aacOverFlow,o=t.data;if(s){this.aacOverFlow=null;var l=s.missing,c=s.sample.unit.byteLength;if(-1===l)o=Qt(s.sample.unit,o);else{var u=c-l;s.sample.unit.set(o.subarray(0,l),u),e.samples.push(s.sample),i=s.missing}}for(r=i,n=o.length;r<n-1&&!Qn(o,r);r++);if(r!==i){var h,d=r<n-1;if(h=d?"AAC PES did not start with ADTS header,offset:".concat(r):"No ADTS header found in AAC PES",ja(this.observer,new Error(h),d,this.logger),!d)return}if(Zn(e,this.observer,o,r,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!s)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var f=ea(e.samplerate);a=s.sample.pts+f}for(var p,y=0;r<n;){if(r+=(p=ta(e,o,r,a,y)).length,p.missing){this.aacOverFlow=p;break}for(y++;r<n-1&&!Qn(o,r);r++);}}},{key:"parseMPEGPES",value:function(e,t){var r=t.data,n=r.length,a=0,i=0,s=t.pts;if(void 0!==s)for(;i<n;)if(Ta(r,i)){var o=Ia(e,r,i,s,a);if(!o)break;i+=o.length,a++}else i++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}},{key:"parseAC3PES",value:function(e,t){var r=t.data,n=t.pts;if(void 0!==n)for(var a,i=r.length,s=0,o=0;o<i&&(a=Aa(e,r,o,n,s++))>0;)o+=a;else this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS")}},{key:"parseID3PES",value:function(e,t){if(void 0!==t.pts){var r=W({},t,{type:this._videoTrack?da.emsg:da.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}else this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")}}],[{key:"probe",value:function(t,r){var n=e.syncOffset(t);return n>0&&r.warn("MPEG2-TS detected but first sync word found @ offset ".concat(n)),-1!==n}},{key:"syncOffset",value:function(e){for(var t=e.length,r=Math.min(940,t-Ma)+1,n=0;n<r;){for(var a=!1,i=-1,s=0,o=n;o<t;o+=Ma){if(71!==e[o]||t-o!==Ma&&71!==e[o+Ma]){if(s)return-1;break}if(s++,-1===i&&0!==(i=o)&&(r=Math.min(i+18612,e.length-Ma)+1),a||(a=0===Fa(e,o)),a&&s>1&&(0===i&&s>2||o+Ma>r))return i}n++}return-1}},{key:"createTrack",value:function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:xt[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}}]),e}();function Fa(e,t){return((31&e[t+1])<<8)+e[t+2]}function Ua(e,t){return(31&e[t+10])<<8|e[t+11]}function Ba(e,t,r,n,a,i){var s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<o;){var l=Fa(e,t),c=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!n){Ga("ADTS AAC",i);break}case 15:-1===s.audioPid&&(s.audioPid=l);break;case 21:-1===s.id3Pid&&(s.id3Pid=l);break;case 219:if(!n){Ga("H.264",i);break}case 27:-1===s.videoPid&&(s.videoPid=l,s.segmentVideoCodec="avc");break;case 3:case 4:r.mpeg||r.mp3?-1===s.audioPid&&(s.audioPid=l,s.segmentAudioCodec="mp3"):i.log("MPEG audio found, not supported in this browser");break;case 193:if(!n){Ga("AC-3",i);break}case 129:r.ac3?-1===s.audioPid&&(s.audioPid=l,s.segmentAudioCodec="ac3"):i.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===s.audioPid&&c>0)for(var u=t+5,h=c;h>2;){106===e[u]&&(!0!==r.ac3?i.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=l,s.segmentAudioCodec="ac3"));var d=e[u+1]+2;u+=d,h-=d}break;case 194:case 135:return ja(a,new Error("Unsupported EC-3 in M2TS found"),void 0,i),s;case 36:-1===s.videoPid&&(s.videoPid=l,s.segmentVideoCodec="hevc",i.log("HEVC in M2TS found"))}t+=c+5}return s}function ja(e,t,r,n){n.warn("parsing error: ".concat(t.message)),e.emit(x.ERROR,x.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,error:t,reason:t.message})}function Ga(e,t){t.log("".concat(e," with AES-128-CBC encryption found in unencrypted stream"))}function Ka(e,t){var r,n,a,i,s,o=0,l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=Qt(l[0],l[1]),_spliceInstanceProperty(l).call(l,1,1);if(1===((r=l[0])[0]<<16)+(r[1]<<8)+r[2]){if((n=(r[4]<<8)+r[5])&&n>e.size-6)return null;var c=r[7];192&c&&(i=536870912*(14&r[9])+4194304*(255&r[10])+16384*(254&r[11])+128*(255&r[12])+(254&r[13])/2,64&c?i-(s=536870912*(14&r[14])+4194304*(255&r[15])+16384*(254&r[16])+128*(255&r[17])+(254&r[18])/2)>54e5&&(t.warn("".concat(Math.round((i-s)/9e4),"s delta between PTS and DTS, align them")),i=s):s=i);var u=(a=r[8])+9;if(e.size<=u)return null;e.size-=u;for(var h=new Uint8Array(e.size),d=0,f=l.length;d<f;d++){var p=(r=l[d]).byteLength;if(u){if(u>p){u-=p;continue}r=r.subarray(u),p-=u,u=0}h.set(r,o),o+=p}return n&&(n-=a+3),{data:h,pts:i,dts:s,len:n}}return null}var Ha=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{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}(),Va=Math.pow(2,32)-1,Wa=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"init",value:function(){var t;for(t in e.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=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]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:n};var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=i,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,l,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,a))}},{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];for(var a=8,i=r.length,s=i;i--;)a+=r[i].byteLength;var o=new Uint8Array(a);for(o[0]=a>>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=255&a,o.set(e,4),i=0,a=8;i<s;i++)o.set(r[i],a),a+=r[i].byteLength;return o}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){r*=t;var n=Math.floor(r/(Va+1)),a=Math.floor(r%(Va+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(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:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,n){return e.box(e.types.moof,e.mfhd(t),e.traf(n,r))}},{key:"moov",value:function(t){for(var r,n,a=t.length,i=[];a--;)i[a]=e.trak(t[a]);return e.box.apply(null,_concatInstanceProperty(r=_concatInstanceProperty(n=[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)]).call(n,i)).call(r,e.mvex(t)))}},{key:"mvex",value:function(t){for(var r,n=t.length,a=[];n--;)a[n]=e.trex(t[n]);return e.box.apply(null,_concatInstanceProperty(r=[e.types.mvex]).call(r,a))}},{key:"mvhd",value:function(t,r){r*=t;var n=Math.floor(r/(Va+1)),a=Math.floor(r%(Va+1)),i=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,i)}},{key:"sdtp",value:function(t){var r,n,a=t.samples||[],i=new Uint8Array(4+a.length);for(r=0;r<a.length;r++)n=_flagsInstanceProperty(a[r]),i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return e.box(e.types.sdtp,i)}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}},{key:"avc1",value:function(t){var r,n,a,i,s,o,l=[],c=[];for(i=0;i<t.sps.length;i++)o=(s=t.sps[i]).byteLength,l.push(o>>>8&255),l.push(255&o),l=_concatInstanceProperty(l).call(l,_sliceInstanceProperty(Array.prototype).call(s));for(i=0;i<t.pps.length;i++)o=(s=t.pps[i]).byteLength,c.push(o>>>8&255),c.push(255&o),c=_concatInstanceProperty(c).call(c,_sliceInstanceProperty(Array.prototype).call(s));var u=e.box(e.types.avcC,new Uint8Array(_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a=[1,l[3],l[4],l[5],255,224|t.sps.length]).call(a,l)).call(n,[t.pps.length])).call(r,c))),h=t.width,d=t.height,f=t.pixelRatio[0],p=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,h>>8&255,255&h,d>>8&255,255&d,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]),u,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([f>>24,f>>16&255,f>>8&255,255&f,p>>24,p>>16&255,p>>8&255,255&p])))}},{key:"esds",value:function(e){var t,r=e.config;return new Uint8Array(_concatInstanceProperty(t=[0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2]).call(t,_toConsumableArray(r),[6,1,2]))}},{key:"audioStsd",value:function(e){var t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,e.audioStsd(t),e.box(e.types.esds,e.esds(t)))}},{key:"mp3",value:function(t){return e.box(e.types[".mp3"],e.audioStsd(t))}},{key:"ac3",value:function(t){return e.box(e.types["ac-3"],e.audioStsd(t),e.box(e.types.dac3,t.config))}},{key:"stsd",value:function(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?e.box(e.types.stsd,e.STSD,e.mp3(t)):"ac3"===t.segmentCodec?e.box(e.types.stsd,e.STSD,e.ac3(t)):e.box(e.types.stsd,e.STSD,e.mp4a(t)):"avc"===t.segmentCodec?e.box(e.types.stsd,e.STSD,e.avc1(t)):e.box(e.types.stsd,e.STSD,e.hvc1(t))}},{key:"tkhd",value:function(t){var r=t.id,n=t.duration*t.timescale,a=t.width,i=t.height,s=Math.floor(n/(Va+1)),o=Math.floor(n%(Va+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,i>>8&255,255&i,0,0]))}},{key:"traf",value:function(t,r){var n=e.sdtp(t),a=t.id,i=Math.floor(r/(Va+1)),s=Math.floor(r%(Va+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s])),e.trun(t,n.length+16+20+8+16+8+8),n)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,r){var n,a,i,s,o,l,c=t.samples||[],u=c.length,h=12+16*u,d=new Uint8Array(h);for(r+=8+h,d.set(["video"===t.type?1:0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),n=0;n<u;n++)i=(a=c[n]).duration,s=a.size,o=_flagsInstanceProperty(a),l=a.cts,d.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*n);return e.box(e.types.trun,d)}},{key:"initSegment",value:function(t){e.types||e.init();var r=e.moov(t);return Qt(e.FTYP,r)}},{key:"hvc1",value:function(t){for(var r=t.params,n=[t.vps,t.sps,t.pps],a=new Uint8Array([1,r.general_profile_space<<6|(r.general_tier_flag?32:0)|r.general_profile_idc,r.general_profile_compatibility_flags[0],r.general_profile_compatibility_flags[1],r.general_profile_compatibility_flags[2],r.general_profile_compatibility_flags[3],r.general_constraint_indicator_flags[0],r.general_constraint_indicator_flags[1],r.general_constraint_indicator_flags[2],r.general_constraint_indicator_flags[3],r.general_constraint_indicator_flags[4],r.general_constraint_indicator_flags[5],r.general_level_idc,240|r.min_spatial_segmentation_idc>>8,255&r.min_spatial_segmentation_idc,252|r.parallelismType,252|r.chroma_format_idc,248|r.bit_depth_luma_minus8,248|r.bit_depth_chroma_minus8,0,_parseInt$1(r.frame_rate.fps),3|r.temporal_id_nested<<2|r.num_temporal_layers<<3|(r.frame_rate.fixed?64:0),n.length]),i=a.length,s=0;s<n.length;s+=1){i+=3;for(var o=0;o<n[s].length;o+=1)i+=2+n[s][o].length}var l=new Uint8Array(i);l.set(a,0),i=a.length;for(var c=n.length-1,u=0;u<n.length;u+=1){l.set(new Uint8Array([32+u|(u===c?128:0),0,n[u].length]),i),i+=3;for(var h=0;h<n[u].length;h+=1)l.set(new Uint8Array([n[u][h].length>>8,255&n[u][h].length]),i),i+=2,l.set(n[u][h],i),i+=n[u][h].length}var d=e.box(e.types.hvcC,l),f=t.width,p=t.height,y=t.pixelRatio[0],g=t.pixelRatio[1];return e.box(e.types.hvc1,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,f>>8&255,255&f,p>>8&255,255&p,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,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([y>>24,y>>16&255,y>>8&255,255&y,g>>24,g>>16&255,g>>8&255,255&g])))}}]),e}();function Ya(e,t){var r=e*t*(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1);return arguments.length>3&&void 0!==arguments[3]&&arguments[3]?Math.round(r):r}function qa(e){return Ya(e,1e3,1/9e4,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}Wa.types=void 0,Wa.HDLR_TYPES=void 0,Wa.STTS=void 0,Wa.STSC=void 0,Wa.STCO=void 0,Wa.STSZ=void 0,Wa.VMHD=void 0,Wa.SMHD=void 0,Wa.STSD=void 0,Wa.FTYP=void 0,Wa.DINF=void 0;var za,Xa=null,Qa=null,Ja=function(){function e(t,r,n,a){if(_classCallCheck(this,e),this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=r,this.typeSupported=n,this.logger=a,this.ISGenerated=!1,null===Xa){var i=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Xa=i?_parseInt$1(i[1]):0}if(null===Qa){var s=navigator.userAgent.match(/Safari\/(\d+)/i);Qa=s?_parseInt$1(s[1]):0}}return _createClass(e,[{key:"destroy",value:function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}},{key:"resetTimeStamp",value:function(e){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}},{key:"resetNextTimestamp",value:function(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}},{key:"resetInitSegment",value:function(){this.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}},{key:"getVideoStartPts",value:function(e){var t=!1,r=e[0].pts,n=_reduceInstanceProperty(e).call(e,(function(e,n){var a=n.pts,i=a-e;return i<-4294967296&&(t=!0,i=(a=Za(a,r))-e),i>0?e:a}),r);return t&&this.logger.debug("PTS rollover detected"),n}},{key:"remux",value:function(e,t,r,n,a,i,s,o){var l,c,u,h,d,f,p=a,y=a,g=e.pid>-1,v=t.pid>-1,m=t.samples.length,$=e.samples.length>0,S=s&&m>0||m>1;if((!g||$)&&(!v||S)||this.ISGenerated||s){if(this.ISGenerated){var I,_,E,T,P=this.videoTrackConfig;(P&&(t.width!==P.width||t.height!==P.height||(null==(I=t.pixelRatio)?void 0:I[0])!==(null==(_=P.pixelRatio)?void 0:_[0])||(null==(E=t.pixelRatio)?void 0:E[1])!==(null==(T=P.pixelRatio)?void 0:T[1]))||!P&&S||null===this.nextAudioPts&&$)&&this.resetInitSegment()}this.ISGenerated||(u=this.generateIS(e,t,a,i));var b,k=this.isVideoContiguous,A=-1;if(S&&(A=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!k&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,A>0){var R,O;this.logger.warn(_concatInstanceProperty(R="[mp4-remuxer]: Dropped ".concat(A," out of ")).call(R,m," video samples due to a missing keyframe"));var L=this.getVideoStartPts(t.samples);t.samples=_sliceInstanceProperty(O=t.samples).call(O,A),t.dropped+=A,b=y+=(t.samples[0].pts-L)/t.inputTimeScale}else-1===A&&(this.logger.warn("[mp4-remuxer]: No keyframe found out of ".concat(m," video samples")),f=!1);if(this.ISGenerated){if($&&S){var C=this.getVideoStartPts(t.samples),D=(Za(e.samples[0].pts,C)-C)/t.inputTimeScale;p+=Math.max(0,D),y+=Math.max(0,-D)}if($){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,a,i)),c=this.remuxAudio(e,p,this.isAudioContiguous,i,v||S||o===j?y:void 0),S){var w=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,a,i)),l=this.remuxVideo(t,y,k,w)}}else S&&(l=this.remuxVideo(t,y,k,0));l&&(l.firstKeyFrame=A,l.independent=-1!==A,l.firstKeyFramePTS=b)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(d=ei(r,a,this._initPTS,this._initDTS)),n.samples.length&&(h=ti(n,a,this._initPTS))),{audio:c,video:l,initSegment:u,independent:f,text:h,id3:d}}},{key:"generateIS",value:function(e,t,r,n){var a,i,s,o=e.samples,l=t.samples,c=this.typeSupported,u={},h=this._initPTS,d=!h||n,f="audio/mp4";if(d&&(a=i=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":c.mpeg?(f="audio/mpeg",e.codec=""):c.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}u.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&c.mpeg?new Uint8Array(0):Wa.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(s=e.inputTimeScale,h&&s===h.timescale?d=!1:a=i=o[0].pts-Math.round(s*r))}if(t.sps&&t.pps&&l.length){if(t.timescale=t.inputTimeScale,u.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Wa.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(s=t.inputTimeScale,h&&s===h.timescale)d=!1;else{var p=this.getVideoStartPts(l),y=Math.round(s*r);i=Math.min(i,Za(l[0].dts,p)-y),a=Math.min(a,p-y)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(_Object$keys(u).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:a,timescale:s},this._initDTS={baseTime:i,timescale:s}):a=s=void 0,{tracks:u,initPTS:a,timescale:s}}},{key:"remuxVideo",value:function(e,t,r,n){var a,i,s=e.inputTimeScale,o=e.samples,l=[],c=o.length,u=this._initPTS,h=this.nextAvcDts,d=8,f=this.videoSampleDuration,p=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,g=!1;if(!r||null===h){var v=t*s,m=o[0].pts-Za(o[0].dts,o[0].pts);Xa&&null!==h&&Math.abs(v-m-h)<15e3?r=!0:h=v-m}for(var $=u.baseTime*s/u.timescale,S=0;S<c;S++){var I=o[S];I.pts=Za(I.pts-$,h),I.dts=Za(I.dts-$,h),I.dts<o[S>0?S-1:S].dts&&(g=!0)}g&&_sortInstanceProperty(o).call(o,(function(e,t){var r=e.dts-t.dts,n=e.pts-t.pts;return r||n})),a=o[0].dts;var _=(i=o[o.length-1].dts)-a,E=_?Math.round(_/(c-1)):f||e.inputTimeScale/30;if(r){var T,P,b,k,A,R,O=a-h,L=O>E,C=O<-1;if((L||C)&&(L?this.logger.warn(_concatInstanceProperty(T=_concatInstanceProperty(P=_concatInstanceProperty(b="".concat((e.segmentCodec||"").toUpperCase(),": ")).call(b,qa(O,!0)," ms (")).call(P,O,"dts) hole between fragments detected at ")).call(T,t.toFixed(3))):this.logger.warn(_concatInstanceProperty(k=_concatInstanceProperty(A=_concatInstanceProperty(R="".concat((e.segmentCodec||"").toUpperCase(),": ")).call(R,qa(-O,!0)," ms (")).call(A,O,"dts) overlapping between fragments detected at ")).call(k,t.toFixed(3))),!C||h>=o[0].pts||Xa)){var M,N;a=h;var F=o[0].pts-O;if(L)o[0].dts=a,o[0].pts=F;else for(var U=!0,B=0;B<o.length&&!(o[B].dts>F&&U);B++){var j=o[B].pts;if(o[B].dts-=O,o[B].pts-=O,B<o.length-1){var G=o[B+1].pts;U=G<=o[B].pts==G<=j}}this.logger.log(_concatInstanceProperty(M=_concatInstanceProperty(N="Video: Initial PTS/DTS adjusted: ".concat(qa(F,!0),"/")).call(N,qa(a,!0),", delta: ")).call(M,qa(O,!0)," ms"))}}for(var K=0,H=0,V=a=Math.max(0,a),Y=0;Y<c;Y++){for(var q=o[Y],z=q.units,X=z.length,Q=0,J=0;J<X;J++)Q+=z[J].data.length;H+=Q,K+=X,q.length=Q,q.dts<V?(q.dts=V,V+=E/4|0||1):V=q.dts,p=Math.min(q.pts,p),y=Math.max(q.pts,y)}i=o[c-1].dts;var Z,ee=H+4*K+8;try{Z=new Uint8Array(ee)}catch(e){return void this.observer.emit(x.ERROR,x.ERROR,{type:D.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:ee,reason:"fail allocating video mdat ".concat(ee)})}var te=new DataView(Z.buffer);te.setUint32(0,ee),Z.set(Wa.types.mdat,4);for(var re=!1,ne=Number.POSITIVE_INFINITY,ae=Number.POSITIVE_INFINITY,ie=Number.NEGATIVE_INFINITY,se=Number.NEGATIVE_INFINITY,oe=0;oe<c;oe++){for(var le=o[oe],ce=le.units,ue=void 0,he=0,de=0,fe=ce.length;de<fe;de++){var pe=ce[de],ye=pe.data,ge=pe.data.byteLength;te.setUint32(d,ge),d+=4,Z.set(ye,d),d+=ge,he+=4+ge}if(oe<c-1)f=o[oe+1].dts-le.dts,ue=o[oe+1].pts-le.pts;else{var ve=this.config,me=oe>0?le.dts-o[oe-1].dts:E;if(ue=oe>0?le.pts-o[oe-1].pts:E,ve.stretchShortVideoTrack&&null!==this.nextAudioPts){var $e,Se=Math.floor(ve.maxBufferHole*s),Ie=(n?p+n*s:this.nextAudioPts)-le.pts;Ie>Se?((f=Ie-me)<0?f=me:re=!0,this.logger.log(_concatInstanceProperty($e="[mp4-remuxer]: It is approximately ".concat(Ie/90," ms to the next segment; using duration ")).call($e,f/90," ms for the last video frame."))):f=me}else f=me}var _e=Math.round(le.pts-le.dts);ne=Math.min(ne,f),ie=Math.max(ie,f),ae=Math.min(ae,ue),se=Math.max(se,ue),l.push(new ri(le.key,f,he,_e))}if(l.length)if(Xa){if(Xa<70){var Ee=_flagsInstanceProperty(l[0]);Ee.dependsOn=2,Ee.isNonSync=0}}else if(Qa&&se-ae<ie-ne&&E/ie<.025&&0===l[0].cts){this.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Te=a,Pe=0,be=l.length;Pe<be;Pe++){var ke=Te+l[Pe].duration,Ae=Te+l[Pe].cts;if(Pe<be-1){var Re=ke+l[Pe+1].cts;l[Pe].duration=Re-Ae}else l[Pe].duration=Pe?l[Pe-1].duration:E;l[Pe].cts=0,Te=ke}}f=re||!f?E:f,this.nextAvcDts=h=i+f,this.videoSampleDuration=f,this.isVideoContiguous=!0;var Oe={data1:Wa.moof(e.sequenceNumber++,a,W({},e,{samples:l})),data2:Z,startPTS:p/s,endPTS:(y+f)/s,startDTS:a/s,endDTS:h/s,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Oe}},{key:"getSamplesPerFrame",value:function(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}},{key:"remuxAudio",value:function(e,t,r,n,a){var i=e.inputTimeScale,s=i/(e.samplerate?e.samplerate:i),o=this.getSamplesPerFrame(e),l=o*s,c=this._initPTS,u="mp3"===e.segmentCodec&&this.typeSupported.mpeg,h=[],d=void 0!==a,f=e.samples,p=u?0:8,y=this.nextAudioPts||-1,g=t*i,v=c.baseTime*i/c.timescale;if(this.isAudioContiguous=r=r||f.length&&y>0&&(n&&Math.abs(g-y)<9e3||Math.abs(Za(f[0].pts-v,g)-y)<20*l),_forEachInstanceProperty(f).call(f,(function(e){e.pts=Za(e.pts-v,g)})),!r||y<0){if(!(f=_filterInstanceProperty(f).call(f,(function(e){return e.pts>=0}))).length)return;y=0===a?0:n&&!d?Math.max(0,g):f[0].pts}if("aac"===e.segmentCodec)for(var m=this.config.maxAudioFramesDrift,$=0,S=y;$<f.length;$++){var I,_=f[$],E=_.pts,T=E-S,P=Math.abs(1e3*T/i);if(T<=-m*l&&d)0===$&&(this.logger.warn(_concatInstanceProperty(I="Audio frame @ ".concat((E/i).toFixed(3),"s overlaps nextAudioPts by ")).call(I,Math.round(1e3*T/i)," ms.")),this.nextAudioPts=y=S=E);else if(T>=m*l&&P<1e4&&d){var b,k,A=Math.round(T/l);(S=E-A*l)<0&&(A--,S+=l),0===$&&(this.nextAudioPts=y=S),this.logger.warn(_concatInstanceProperty(b=_concatInstanceProperty(k="[mp4-remuxer]: Injecting ".concat(A," audio frame @ ")).call(k,(S/i).toFixed(3),"s due to ")).call(b,Math.round(1e3*T/i)," ms gap."));for(var R=0;R<A;R++){var O=Math.max(S,0),L=Ha.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);L||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),L=_.unit.subarray()),_spliceInstanceProperty(f).call(f,$,0,{unit:L,pts:O}),S+=l,$++}}_.pts=S,S+=l}for(var C,M=null,N=null,F=0,U=f.length;U--;)F+=f[U].unit.byteLength;for(var B=0,j=f.length;B<j;B++){var G=f[B],K=G.unit,H=G.pts;if(null!==N)h[B-1].duration=Math.round((H-N)/s);else{if(r&&"aac"===e.segmentCodec&&(H=y),M=H,!(F>0))return;F+=p;try{C=new Uint8Array(F)}catch(e){return void this.observer.emit(x.ERROR,x.ERROR,{type:D.MUX_ERROR,details:w.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:F,reason:"fail allocating audio mdat ".concat(F)})}u||(new DataView(C.buffer).setUint32(0,F),C.set(Wa.types.mdat,4))}C.set(K,p);var V=K.byteLength;p+=V,h.push(new ri(!0,o,V,0)),N=H}var Y=h.length;if(Y){var q=h[h.length-1];this.nextAudioPts=y=N+s*q.duration;var z=u?new Uint8Array(0):Wa.moof(e.sequenceNumber++,M/s,W({},e,{samples:h}));e.samples=[];var X=M/i,Q=y/i,J={data1:z,data2:C,startPTS:X,endPTS:Q,startDTS:X,endDTS:Q,type:"audio",hasAudio:!0,hasVideo:!1,nb:Y};return this.isAudioContiguous=!0,J}}}]),e}();function Za(e,t){var r;if(null===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}function ei(e,t,r,n){var a=e.samples.length;if(a){for(var i=e.inputTimeScale,s=0;s<a;s++){var o=e.samples[s];o.pts=Za(o.pts-r.baseTime*i/r.timescale,t*i)/i,o.dts=Za(o.dts-n.baseTime*i/n.timescale,t*i)/i}var l=e.samples;return e.samples=[],{samples:l}}}function ti(e,t,r){var n,a=e.samples.length;if(a){for(var i=e.inputTimeScale,s=0;s<a;s++){var o=e.samples[s];o.pts=Za(o.pts-r.baseTime*i/r.timescale,t*i)/i}_sortInstanceProperty(n=e.samples).call(n,(function(e,t){return e.pts-t.pts}));var l=e.samples;return e.samples=[],{samples:l}}}var ri=_createClass((function e(t,r,n,a){_classCallCheck(this,e),this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=r,this.size=n,this.cts=a,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}));function ni(e,t){var r=null==e?void 0:e.codec;return r&&r.length>4?r:t===bt?"ec-3"===r||"ac-3"===r||"alac"===r?r:"fLaC"===r||"Opus"===r?de(r,!1):(te.warn('Unhandled audio codec "'.concat(r,'" in mp4 MAP')),r||"mp4a"):(te.warn('Unhandled video codec "'.concat(r,'" in mp4 MAP')),r||"avc1")}try{var ai;za=_bindInstanceProperty(ai=self.performance.now).call(ai,self.performance)}catch(e){za=_Date$now}var ii=[{demux:function(){function e(t,r){_classCallCheck(this,e),this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=r}return _createClass(e,[{key:"resetTimeStamp",value:function(){}},{key:"resetInitSegment",value:function(e,t,r,n){var a=this.videoTrack=fa("video",1),i=this.audioTrack=fa("audio",1),s=this.txtTrack=fa("text",1);if(this.id3Track=fa("id3",1),this.timeOffset=0,null!=e&&e.byteLength){var o=Ht(e);if(o.video){var l=o.video,c=l.id,u=l.timescale,h=l.codec;a.id=c,a.timescale=s.timescale=u,a.codec=h}if(o.audio){var d=o.audio,f=d.id,p=d.timescale,y=d.codec;i.id=f,i.timescale=p,i.codec=y}s.id=xt.text,a.sampleDuration=0,a.duration=i.duration=n}}},{key:"resetContiguity",value:function(){this.remainderData=null}},{key:"demux",value:function(e,t){this.timeOffset=t;var r=e,n=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=Qt(this.remainderData,e));var i=function(e){var t={valid:null,remainder:null},r=Gt(e,["moof"]);if(r.length<2)return t.remainder=e,t;var n=r[r.length-1];return t.valid=dt(e,0,n.byteOffset-8),t.remainder=dt(e,n.byteOffset-8),t}(r);this.remainderData=i.remainder,n.samples=i.valid||new Uint8Array}else n.samples=r;var s=this.extractID3Track(n,t);return a.samples=Jt(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}},{key:"flush",value:function(){var e=this.timeOffset,t=this.videoTrack,r=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;var n=this.extractID3Track(t,this.timeOffset);return r.samples=Jt(e,t),{videoTrack:t,audioTrack:fa(),id3Track:n,textTrack:fa()}}},{key:"extractID3Track",value:function(e,t){var r=this,n=this.id3Track;if(e.samples.length){var a=Gt(e.samples,["emsg"]);a&&_forEachInstanceProperty(a).call(a,(function(e){var a,i=function(e){var t=e[0],r="",n="",a=0,i=0,s=0,o=0,l=0,c=0;if(0===t){for(;"\0"!==Mt(e.subarray(c,c+1));)r+=Mt(e.subarray(c,c+1)),c+=1;for(r+=Mt(e.subarray(c,c+1)),c+=1;"\0"!==Mt(e.subarray(c,c+1));)n+=Mt(e.subarray(c,c+1)),c+=1;n+=Mt(e.subarray(c,c+1)),c+=1,a=Ft(e,12),i=Ft(e,16),o=Ft(e,20),l=Ft(e,24),c=28}else if(1===t){a=Ft(e,c+=4);var u=Ft(e,c+=4),h=Ft(e,c+=4);for(c+=4,s=Math.pow(2,32)*u+h,L(s)||(s=_Number$MAX_SAFE_INTEGER,te.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ft(e,c),l=Ft(e,c+=4),c+=4;"\0"!==Mt(e.subarray(c,c+1));)r+=Mt(e.subarray(c,c+1)),c+=1;for(r+=Mt(e.subarray(c,c+1)),c+=1;"\0"!==Mt(e.subarray(c,c+1));)n+=Mt(e.subarray(c,c+1)),c+=1;n+=Mt(e.subarray(c,c+1)),c+=1}return{schemeIdUri:r,value:n,timeScale:a,presentationTime:s,presentationTimeDelta:i,eventDuration:o,id:l,payload:e.subarray(c,e.byteLength)}}(e);if(Ra.test(i.schemeIdUri)){var s=Oa(i,t),o=4294967295===i.eventDuration?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;o<=.001&&(o=Number.POSITIVE_INFINITY);var l=i.payload;n.samples.push({data:l,len:l.byteLength,dts:s,pts:s,type:da.emsg,duration:o})}else if(r.config.enableEmsgKLVMetadata&&_startsWithInstanceProperty(a=i.schemeIdUri).call(a,"urn:misb:KLV:bin:1910.1")){var c=Oa(i,t);n.samples.push({data:i.payload,len:i.payload.byteLength,dts:c,pts:c,type:da.misbklv,duration:Number.POSITIVE_INFINITY})}}))}return n}},{key:"demuxSampleAes",value:function(e,t,r){return _Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}},{key:"destroy",value:function(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}],[{key:"probe",value:function(e){return function(e){for(var t=e.byteLength,r=0;r<t;){var n=Ft(e,r);if(n>8&&109===e[r+4]&&111===e[r+5]&&111===e[r+6]&&102===e[r+7])return!0;r=n>1?r+n:t}return!1}(e)}}]),e}(),remux:function(){function e(t,r,n,a){_classCallCheck(this,e),this.logger=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.logger=a}return _createClass(e,[{key:"destroy",value:function(){}},{key:"resetTimeStamp",value:function(e){this.initPTS=e,this.lastEndTime=null}},{key:"resetNextTimestamp",value:function(){this.lastEndTime=null}},{key:"resetInitSegment",value:function(e,t,r,n){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(function(e,t,r){if(!e||!t)return e;var n=t.keyId;return n&&t.isCommonEncryption&&_forEachInstanceProperty(r=Gt(e,["moov","trak"])).call(r,(function(e){var t=Gt(e,["mdia","minf","stbl","stsd"])[0].subarray(8),r=Gt(t,["enca"]),a=r.length>0;a||(r=Gt(t,["encv"])),_forEachInstanceProperty(r).call(r,(function(e){var t;_forEachInstanceProperty(t=Gt(a?e.subarray(28):e.subarray(78),["sinf"])).call(t,(function(e){var t=zt(e);if(t){var r,i,s=t.subarray(8,24);_someInstanceProperty(s).call(s,(function(e){return 0!==e}))||(te.log(_concatInstanceProperty(r=_concatInstanceProperty(i="[eme] Patching keyId in 'enc".concat(a?"a":"v",">sinf>>tenc' box: ")).call(i,gt(s)," -> ")).call(r,gt(n))),t.set(n,8))}}))}))})),e}(e,n)),this.emitInitSegment=!0}},{key:"generateInitSegment",value:function(e){var t=this.audioCodec,r=this.videoCodec;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var n=this.initData=Ht(e);n.audio&&(t=ni(n.audio,bt)),n.video&&(r=ni(n.video,kt));var a={};n.audio&&n.video?a.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:e,id:"main"}:n.audio?a.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?a.video={container:"video/mp4",codec:r,initSegment:e,id:"main"}:this.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a}},{key:"remux",value:function(e,t,r,n,a,i){var s,o,l,c,u=this.initPTS,h=this.lastEndTime,d={audio:void 0,video:void 0,text:n,id3:r,initSegment:void 0};O(h)||(h=this.lastEndTime=a||0);var f=t.samples;if(null==f||!f.length)return d;var p={initPTS:void 0,timescale:1},y=this.initData;if(null!=(l=y)&&l.length||(this.generateInitSegment(f),y=this.initData),null==(c=y)||!c.length)return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),d;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1);var g,v,m=function(e,t){for(var r=0,n=0,a=0,i=Gt(e,["moof","traf"]),s=0;s<i.length;s++){var o=i[s],l=Gt(o,["tfhd"])[0],c=t[Ft(l,4)];if(c){var u=c.default,h=Ft(l,0)|(null==u?void 0:_flagsInstanceProperty(u)),d=null==u?void 0:u.duration;8&h&&(d=Ft(l,2&h?12:8));for(var f=c.timescale||9e4,p=Gt(o,["trun"]),y=0;y<p.length;y++)!(r=Xt(p[y]))&&d&&(r=d*Ft(p[y],4)),c.type===kt?n+=r/f:c.type===bt&&(a+=r/f)}}if(0===n&&0===a){for(var g=1/0,v=0,m=0,$=Gt(e,["sidx"]),S=0;S<$.length;S++){var I=Kt($[S]);if(null!=I&&I.references){var _;g=Math.min(g,I.earliestPresentationTime/I.timescale);var E=_reduceInstanceProperty(_=I.references).call(_,(function(e,t){return e+t.info.duration||0}),0);m=(v=Math.max(v,E+I.earliestPresentationTime/I.timescale))-g}}if(m&&O(m))return m}return n||a}(f,y),$=(g=y,_reduceInstanceProperty(v=Gt(f,["moof","traf"])).call(v,(function(e,t){var r,n=Gt(t,["tfdt"])[0],a=n[0],i=_reduceInstanceProperty(r=Gt(t,["tfhd"])).call(r,(function(e,t){var r=Ft(t,4),i=g[r];if(i){var s=Ft(n,4);if(1===a){if(s===Dt)return te.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;s*=Dt+1,s+=Ft(n,8)}var o=s/(i.timescale||9e4);if(O(o)&&(null===e||o<e))return o}return e}),null);return null!==i&&O(i)&&(null===e||i<e)?i:e}),null)),S=null===$?a:$;(function(e,t,r,n){if(null===e)return!0;var a=Math.max(n,1),i=t-e.baseTime/e.timescale;return Math.abs(i-r)>a}(u,S,a,m)||p.timescale!==u.timescale&&i)&&(p.initPTS=S-a,u&&1===u.timescale&&this.logger.warn(_concatInstanceProperty(s=_concatInstanceProperty(o="Adjusting initPTS @".concat(a," from ")).call(o,u.baseTime/u.timescale," to ")).call(s,p.initPTS)),this.initPTS=u={baseTime:p.initPTS,timescale:1});var I=e?S-u.baseTime/u.timescale:h,_=I+m;!function(e,t,r,n){_forEachInstanceProperty(n=Gt(t,["moof","traf"])).call(n,(function(t){var n;_forEachInstanceProperty(n=Gt(t,["tfhd"])).call(n,(function(n){var a,i=Ft(n,4),s=e[i];if(s){var o=s.timescale||9e4;_forEachInstanceProperty(a=Gt(t,["tfdt"])).call(a,(function(e){var t=e[0],n=r*o;if(n){var a=Ft(e,4);if(0===t)a-=n,jt(e,4,a=Math.max(a,0));else{a*=Math.pow(2,32),a+=Ft(e,8),a-=n,a=Math.max(a,0);var i=Math.floor(a/(Dt+1)),s=Math.floor(a%(Dt+1));jt(e,4,i),jt(e,8,s)}}}))}}))}))}(y,f,u.baseTime/u.timescale),m>0?this.lastEndTime=_:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var E=!!y.audio,T=!!y.video,P="";E&&(P+="audio"),T&&(P+="video");var b={data1:f,startPTS:I,startDTS:I,endPTS:_,endDTS:_,type:P,hasAudio:E,hasVideo:T,nb:1,dropped:0};return d.audio="audio"===b.type?b:void 0,d.video="audio"!==b.type?b:void 0,d.initSegment=p,d.id3=ei(r,a,u,u),n.samples.length&&(d.text=ti(n,a,u)),d}}]),e}()},{demux:Na,remux:Ja},{demux:function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n){var a;return _classCallCheck(this,r),(a=t.call(this)).observer=void 0,a.config=void 0,a.observer=e,a.config=n,a}return _createClass(r,[{key:"resetInitSegment",value:function(e,t,n,a){_get(_getPrototypeOf(r.prototype),"resetInitSegment",this).call(this,e,t,n,a),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:a,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return(n=t)+5<(r=e).length&&qn(r,n)&&Xn(r,n)<=r.length-n;var r,n}},{key:"appendFrame",value:function(e,t,r){Zn(e,this.observer,t,r,e.manifestCodec);var n=ta(e,t,r,this.basePTS,this.frameIndex);if(n&&0===n.missing)return n}}],[{key:"probe",value:function(e,t){if(!e)return!1;var r=Yn(e,0),n=(null==r?void 0:r.length)||0;if(Pa(e,n))return!1;for(var a=e.length;n<a;n++)if(Jn(e,n))return t.log("ADTS sync word found !"),!0;return!1}}]),r}(pa),remux:Ja},{demux:function(e){_inherits(r,e);var t=_createSuper(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass(r,[{key:"resetInitSegment",value:function(e,t,n,a){_get(_getPrototypeOf(r.prototype),"resetInitSegment",this).call(this,e,t,n,a),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:a,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return Ea(r=e,n=t)&&4<=r.length-n;var r,n}},{key:"appendFrame",value:function(e,t,r){if(null!==this.basePTS)return Ia(e,t,r,this.basePTS,this.frameIndex)}}],[{key:"probe",value:function(e){if(!e)return!1;var t=Yn(e,0),r=(null==t?void 0:t.length)||0;if(t&&11===e[r]&&119===e[r+1]&&void 0!==ha(t)&&ba(e,r)<=16)return!1;for(var n=e.length;r<n;r++)if(Pa(e,r))return te.log("MPEG Audio sync word found !"),!0;return!1}}]),r}(pa),remux:Ja}];_spliceInstanceProperty(ii).call(ii,2,0,{demux:ka,remux:Ja});var si=function(){function e(t,r,n,a,i,s){_classCallCheck(this,e),this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=t,this.typeSupported=r,this.config=n,this.id=i,this.logger=s}return _createClass(e,[{key:"configure",value:function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}},{key:"push",value:function(e,t,r,n){var a=this,i=r.transmuxing;i.executeStart=za();var s=new Uint8Array(e),o=this.currentTransmuxState,l=this.transmuxConfig;n&&(this.currentTransmuxState=n);var c,u,h=n||o,d=h.contiguous,f=h.discontinuity,p=h.trackSwitch,y=h.accurateTimeOffset,g=h.timeOffset,v=h.initSegmentChange,m=l.audioCodec,$=l.videoCodec,S=l.defaultInitPts,I=l.duration,_=l.initSegmentData,E=(c=t,u=null,s.byteLength>0&&null!=(null==c?void 0:c.key)&&null!==c.iv&&null!=c.method&&(u=c),u);if(E&&Pr(E.method)){var T=this.getDecrypter(),P=br(E.method);if(!T.isSync())return this.asyncResult=!0,this.decryptionPromise=T.webCryptoDecrypt(s,E.key.buffer,E.iv.buffer,P).then((function(e){var t=a.push(e,null,r);return a.decryptionPromise=null,t})),this.decryptionPromise;var b=T.softwareDecrypt(s,E.key.buffer,E.iv.buffer,P);if(r.part>-1){var k=T.flush();b=k?k.buffer:k}if(!b)return i.executeEnd=za(),oi(r);s=new Uint8Array(b)}var A=this.needsProbing(f,p);if(A){var R=this.configureTransmuxer(s);if(R)return this.logger.warn("[transmuxer] ".concat(R.message)),this.observer.emit(x.ERROR,x.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,fatal:!1,error:R,reason:R.message}),i.executeEnd=za(),oi(r)}(f||p||v||A)&&this.resetInitSegment(_,m,$,I,t),(f||v||A)&&this.resetInitialTimestamp(S),d||this.resetContiguity();var O=this.transmux(s,E,g,y,r);this.asyncResult=li(O);var L=this.currentTransmuxState;return L.contiguous=!0,L.discontinuity=!1,L.trackSwitch=!1,i.executeEnd=za(),O}},{key:"flush",value:function(e){var t=this,r=e.transmuxing;r.executeStart=za();var n=this.decrypter,a=this.currentTransmuxState,i=this.decryptionPromise;if(i)return this.asyncResult=!0,i.then((function(){return t.flush(e)}));var s=[],o=a.timeOffset;if(n){var l=n.flush();l&&s.push(this.push(l.buffer,null,e))}var c=this.demuxer,u=this.remuxer;if(!c||!u){r.executeEnd=za();var h=[oi(e)];return this.asyncResult?_Promise.resolve(h):h}var d=c.flush(o);return li(d)?(this.asyncResult=!0,d.then((function(r){return t.flushRemux(s,r,e),s}))):(this.flushRemux(s,d,e),this.asyncResult?_Promise.resolve(s):s)}},{key:"flushRemux",value:function(e,t,r){var n,a,i,s,o=t.audioTrack,l=t.videoTrack,c=t.id3Track,u=t.textTrack,h=this.currentTransmuxState,d=h.accurateTimeOffset,f=h.timeOffset;this.logger.log(_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s="[transmuxer.ts]: Flushed ".concat(this.id," sn: ")).call(s,r.sn)).call(i,r.part>-1?" part: "+r.part:""," of ")).call(a,this.id===B?"level":"track"," ")).call(n,r.level));var p=this.remuxer.remux(o,l,c,u,f,d,!0,this.id);e.push({remuxResult:p,chunkMeta:r}),r.transmuxing.executeEnd=za()}},{key:"resetInitialTimestamp",value:function(e){var t=this.demuxer,r=this.remuxer;t&&r&&(t.resetTimeStamp(e),r.resetTimeStamp(e))}},{key:"resetContiguity",value:function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}},{key:"resetInitSegment",value:function(e,t,r,n,a){var i=this.demuxer,s=this.remuxer;i&&s&&(i.resetInitSegment(e,t,r,n),s.resetInitSegment(e,t,r,a))}},{key:"destroy",value:function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}},{key:"transmux",value:function(e,t,r,n,a){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,r,n,a):this.transmuxUnencrypted(e,r,n,a)}},{key:"transmuxUnencrypted",value:function(e,t,r,n){var a=this.demuxer.demux(e,t,!1,!this.config.progressive),i=a.audioTrack,s=a.videoTrack,o=a.id3Track,l=a.textTrack;return{remuxResult:this.remuxer.remux(i,s,o,l,t,r,!1,this.id),chunkMeta:n}}},{key:"transmuxSampleAes",value:function(e,t,r,n,a){var i=this;return this.demuxer.demuxSampleAes(e,t,r).then((function(e){return{remuxResult:i.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,r,n,!1,i.id),chunkMeta:a}}))}},{key:"configureTransmuxer",value:function(e){for(var t,r=this.config,n=this.observer,a=this.typeSupported,i=0,s=ii.length;i<s;i++){var o;if(null!=(o=ii[i].demux)&&o.probe(e,this.logger)){t=ii[i];break}}if(!t)return new Error("Failed to find demuxer by probing fragment data");var l=this.demuxer,c=this.remuxer,u=t.remux,h=t.demux;c&&c instanceof u||(this.remuxer=new u(n,r,a,this.logger)),l&&l instanceof h||(this.demuxer=new h(n,r,a,this.logger),this.probe=h.probe)}},{key:"needsProbing",value:function(e,t){return!this.demuxer||!this.remuxer||e||t}},{key:"getDecrypter",value:function(){var e=this.decrypter;return e||(e=this.decrypter=new ar(this.config)),e}}]),e}(),oi=function(e){return{remuxResult:{},chunkMeta:e}};function li(e){return"then"in e&&e.then instanceof Function}var ci=_createClass((function e(t,r,n,a,i){_classCallCheck(this,e),this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=r,this.initSegmentData=n,this.duration=a,this.defaultInitPts=i||null})),ui=_createClass((function e(t,r,n,a,i,s){_classCallCheck(this,e),this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=t,this.contiguous=r,this.accurateTimeOffset=n,this.trackSwitch=a,this.timeOffset=i,this.initSegmentChange=s})),hi=0,di=function(){function e(t,r,n,a){var i=this;_classCallCheck(this,e),this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=hi++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=function(e){var t=e.data,r=i.hls;if(r&&null!=t&&t.event&&t.instanceNo===i.instanceNo)switch(t.event){case"init":var n,a=null==(n=i.workerContext)?void 0:n.objectURL;a&&_URL.revokeObjectURL(a);break;case"transmuxComplete":i.handleTransmuxComplete(t.data);break;case"flush":i.onFlush(t.data);break;case"workerLog":r.logger[t.data.logType]&&r.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=i.frag,t.data.part=i.part,t.data.id=i.id,r.trigger(t.event,t.data)}},this.onWorkerError=function(e){var t,r;if(i.hls){var n=new Error(_concatInstanceProperty(t=_concatInstanceProperty(r="".concat(e.message," (")).call(r,e.filename,":")).call(t,e.lineno,")"));i.hls.config.enableWorker=!1,i.hls.logger.warn('Error in "'.concat(i.id,'" Web Worker, fallback to inline')),i.hls.trigger(x.ERROR,{type:D.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:n})}};var s=t.config;this.hls=t,this.id=r,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=a;var o=function(e,t){(t=t||{}).frag=i.frag||void 0,e===x.ERROR&&(t.parent=i.id,t.part=i.part,i.error=t.error),i.hls.trigger(e,t)};this.observer=new jn,this.observer.on(x.FRAG_DECRYPTED,o),this.observer.on(x.ERROR,o);var l=ye(s.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){var c=this.hls.logger;if(s.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{var u;s.workerPath?(c.log(_concatInstanceProperty(u="loading Web Worker ".concat(s.workerPath,' for "')).call(u,r,'"')),this.workerContext=function(e){var t=Kn[e];if(t)return t.clientCount++,t;var r=new _URL(e,self.location.href).href,n={worker:new self.Worker(r),scriptURL:r,clientCount:1};return Kn[e]=n,n}(s.workerPath)):(c.log('injecting Web Worker for "'.concat(r,'"')),this.workerContext=function(){var e=Kn[Gn];if(e)return e.clientCount++,e;var t=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(".concat(__HLS_WORKER_BUNDLE__.toString(),")(true);")],{type:"text/javascript"}),r=_URL.createObjectURL(t),n={worker:new self.Worker(r),objectURL:r,clientCount:1};return Kn[Gn]=n,n}());var h=this.workerContext.worker;h.addEventListener("message",this.onWorkerMessage),h.addEventListener("error",this.onWorkerError),h.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:l,id:r,config:_JSON$stringify(s)})}catch(e){c.warn('Error setting up "'.concat(r,'" Web Worker, fallback to inline'),e),this.terminateWorker(),this.error=null,this.transmuxer=new si(this.observer,l,s,"",r,t.logger)}return}}this.transmuxer=new si(this.observer,l,s,"",r,t.logger)}return _createClass(e,[{key:"reset",value:function(){if(this.frag=null,this.part=null,this.workerContext){var e=this.instanceNo;this.instanceNo=hi++;var t=this.hls.config,r=ye(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:r,id:this.id,config:_JSON$stringify(t)})}}},{key:"terminateWorker",value:function(){if(this.workerContext){var e=this.workerContext.worker;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),function(e){var t=Kn[e||Gn];if(t&&1==t.clientCount--){var r=t.worker,n=t.objectURL;delete Kn[e||Gn],n&&_URL.revokeObjectURL(n),r.terminate()}}(this.hls.config.workerPath)}}},{key:"destroy",value:function(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}},{key:"push",value:function(e,t,r,n,a,i,s,o,l,c){var u,h,d=this;l.transmuxing.start=self.performance.now();var f=this.instanceNo,p=this.transmuxer,y=i?i.start:a.start,g=a.decryptdata,v=this.frag,m=!(v&&a.cc===v.cc),$=!(v&&l.level===v.level),S=v?l.sn-v.sn:-1,I=this.part?l.part-this.part.index:-1,_=0===S&&l.id>1&&l.id===(null==v?void 0:v.stats.chunkCount),E=!$&&(1===S||0===S&&(1===I||_&&I<=0)),T=self.performance.now();($||S||0===a.stats.parsing.start)&&(a.stats.parsing.start=T),!i||!I&&E||(i.stats.parsing.start=T);var P=!(v&&(null==(u=a.initSegment)?void 0:u.url)===(null==(h=v.initSegment)?void 0:h.url)),b=new ui(m,E,o,$,y,P);if(!E||m||P){var k,A,R,O,L,C,D,w,x,M,N;this.hls.logger.log(_concatInstanceProperty(k=_concatInstanceProperty(A=_concatInstanceProperty(R=_concatInstanceProperty(O=_concatInstanceProperty(L=_concatInstanceProperty(C=_concatInstanceProperty(D=_concatInstanceProperty(w=_concatInstanceProperty(x=_concatInstanceProperty(M=_concatInstanceProperty(N="[transmuxer-interface]: Starting new transmux session for ".concat(a.type," sn: ")).call(N,l.sn)).call(M,l.part>-1?" part: "+l.part:""," ")).call(x,this.id===B?"level":"track",": ")).call(w,l.level," id: ")).call(D,l.id,"\n discontinuity: ")).call(C,m,"\n trackSwitch: ")).call(L,$,"\n contiguous: ")).call(O,E,"\n accurateTimeOffset: ")).call(R,o,"\n timeOffset: ")).call(A,y,"\n initSegmentChange: ")).call(k,P));var F=new ci(r,n,t,s,c);this.configureTransmuxer(F)}if(this.frag=a,this.part=i,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:g,chunkMeta:l,state:b},e instanceof ArrayBuffer?[e]:[]);else if(p){var U=p.push(e,g,l,b);li(U)?U.then((function(e){d.handleTransmuxComplete(e)})).catch((function(e){d.transmuxerError(e,l,"transmuxer-interface push error")})):this.handleTransmuxComplete(U)}}},{key:"flush",value:function(e){var t=this;e.transmuxing.start=self.performance.now();var r=this.instanceNo,n=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:r,cmd:"flush",chunkMeta:e});else if(n){var a=n.flush(e);li(a)?a.then((function(r){t.handleFlushResult(r,e)})).catch((function(r){t.transmuxerError(r,e,"transmuxer-interface flush error")})):this.handleFlushResult(a,e)}}},{key:"transmuxerError",value:function(e,t,r){this.hls&&(this.error=e,this.hls.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:r}))}},{key:"handleFlushResult",value:function(e,t){var r=this;_forEachInstanceProperty(e).call(e,(function(e){r.handleTransmuxComplete(e)})),this.onFlush(t)}},{key:"configureTransmuxer",value:function(e){var t=this.instanceNo,r=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):r&&r.configure(e)}},{key:"handleTransmuxComplete",value:function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}]),e}();function fi(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!pi(e[r].attrs,t[r].attrs))return!1;return!0}function pi(e,t,r){var n,a=e["STABLE-RENDITION-ID"];return a&&!r?a===t["STABLE-RENDITION-ID"]:!_someInstanceProperty(n=r||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).call(n,(function(r){return e[r]!==t[r]}))}function yi(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}var gi=function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n){var a;return _classCallCheck(this,r),(a=t.call(this,n,e.logger)).hls=void 0,a.canLoad=!1,a.timer=-1,a.hls=e,a}return _createClass(r,[{key:"destroy",value:function(){this.clearTimer(),this.hls=this.log=this.warn=null}},{key:"clearTimer",value:function(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}},{key:"startLoad",value:function(){this.canLoad=!0,this.loadPlaylist()}},{key:"stopLoad",value:function(){this.canLoad=!1,this.clearTimer()}},{key:"switchParams",value:function(e,t,r){var n=null==t?void 0:t.renditionReports;if(n){for(var a=-1,i=0;i<n.length;i++){var s=n[i],o=void 0;try{o=new _URL(s.URI,t.url).href}catch(e){this.warn("Could not construct new URL for Rendition Report: ".concat(e)),o=s.URI||""}if(o===e){a=i;break}o===e.substring(0,o.length)&&(a=i)}if(-1!==a){var l=n[a],c=_parseInt$1(l["LAST-MSN"])||(null==t?void 0:t.lastPartSn),u=_parseInt$1(l["LAST-PART"])||(null==t?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){var h=Math.min(t.age-t.partTarget,t.targetduration);u>=0&&h>t.partTarget&&(u+=1)}var d=r&&Pe(r);return new be(c,u>=0?u:void 0,d)}}}},{key:"loadPlaylist",value:function(e){this.clearTimer()}},{key:"loadingPlaylist",value:function(e,t){this.clearTimer()}},{key:"shouldLoadPlaylist",value:function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}},{key:"getUrlWithDirectives",value:function(e,t){if(t)try{return t.addDirectives(e)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(e))}return e}},{key:"playlistLoaded",value:function(e,t,r){var n=t.details,a=t.stats,i=self.performance.now(),s=a.loading.first?Math.max(0,i-a.loading.first):0;n.advancedDateTime=_Date$now()-s;var o=this.hls.config.timelineOffset;if(o!==n.appliedTimelineOffset){var l,c=Math.max(o||0,0);n.appliedTimelineOffset=c,_forEachInstanceProperty(l=n.fragments).call(l,(function(e){e.start=e.playlistOffset+c}))}if(n.live||null!=r&&r.live){var u,h="levelInfo"in t?t.levelInfo:t.track;n.reloaded(r),r&&n.fragments.length>0&&fn(r,n),-1===n.requestScheduled&&(n.requestScheduled=a.loading.start);var d,f,p,y=this.hls.mainForwardBufferInfo,g=y?y.end-y.len:0,v=gn(n,1e3*(n.edge-g));if(n.requestScheduled+v<i?n.requestScheduled=i:n.requestScheduled+=v,this.log(_concatInstanceProperty(u="live playlist ".concat(e," ")).call(u,n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED")),!this.canLoad||!n.live)return;if(n.canBlockReload&&n.endSN&&n.advanced){var m=this.hls.config.lowLatencyMode,$=n.lastPartSn,S=n.endSN,I=n.lastPartIndex,_=$===S;-1!==I?_?(f=S+1,p=m?0:I):(f=$,p=m?I+1:n.maxPartIndex):f=S+1;var E=n.age,T=E+n.ageHeader,P=Math.min(T-n.partTarget,1.5*n.targetduration);if(P>0){var b,k;if(T>3*n.targetduration)this.log("Playlist last advanced ".concat(E.toFixed(2),"s ago. Omitting segment and part directives.")),f=void 0,p=void 0;else if(null!=r&&r.tuneInGoal&&T-n.partTarget>r.tuneInGoal)this.warn(_concatInstanceProperty(b=_concatInstanceProperty(k="CDN Tune-in goal increased from: ".concat(r.tuneInGoal," to: ")).call(k,P," with playlist age: ")).call(b,n.age)),P=0;else{var A,R,O,L,C=Math.floor(P/n.targetduration);f+=C,void 0!==p&&(p+=Math.round(P%n.targetduration/n.partTarget)),this.log(_concatInstanceProperty(A=_concatInstanceProperty(R=_concatInstanceProperty(O=_concatInstanceProperty(L="CDN Tune-in age: ".concat(n.ageHeader,"s last advanced ")).call(L,E.toFixed(2),"s goal: ")).call(O,P," skip sn ")).call(R,C," to part ")).call(A,p))}n.tuneInGoal=P}if(d=this.getDeliveryDirectives(n,t.deliveryDirectives,f,p),m||!_)return n.requestScheduled=i,void this.loadingPlaylist(h,d)}else(n.canBlockReload||n.canSkipUntil)&&(d=this.getDeliveryDirectives(n,t.deliveryDirectives,f,p));d&&void 0!==f&&n.canBlockReload&&(n.requestScheduled=a.loading.first+Math.max(v-2*s,v/2)),this.scheduleLoading(h,d,n)}else this.clearTimer()}},{key:"scheduleLoading",value:function(e,t,r){var n,a=this,i=r||e.details;if(i){var s=self.performance.now(),o=i.requestScheduled;if(s>=o)this.loadingPlaylist(e,t);else{var l=o-s;this.log(_concatInstanceProperty(n="reload live playlist ".concat(e.name||e.bitrate+"bps"," in ")).call(n,Math.round(l)," ms")),this.clearTimer(),this.timer=_setTimeout((function(){return a.loadingPlaylist(e,t)}),l)}}else this.loadingPlaylist(e,t)}},{key:"getDeliveryDirectives",value:function(e,t,r,n){var a=Pe(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(r=t.msn,n=t.part,a=_e),new be(r,n,a)}},{key:"checkRetry",value:function(e){var t=this,r=e.details,n=Ke(e),a=e.errorAction,i=a||{},s=i.action,o=i.retryCount,l=void 0===o?0:o,c=i.retryConfig,u=!!a&&!!c&&(s===Qe||!a.resolved&&s===ze);if(u){var h,d,f;if(l>=c.maxNumRetry)return!1;if(n&&null!=(f=e.context)&&f.deliveryDirectives)this.warn(_concatInstanceProperty(h=_concatInstanceProperty(d="Retrying playlist loading ".concat(l+1,"/")).call(d,c.maxNumRetry,' after "')).call(h,r,'" without delivery-directives')),this.loadPlaylist();else{var p,y,g,v=Ve(c,l);this.clearTimer(),this.timer=_setTimeout((function(){return t.loadPlaylist()}),v),this.warn(_concatInstanceProperty(p=_concatInstanceProperty(y=_concatInstanceProperty(g="Retrying playlist loading ".concat(l+1,"/")).call(g,c.maxNumRetry,' after "')).call(y,r,'" in ')).call(p,v,"ms"))}e.levelRetry=!0,a.resolved=!0}return u}}]),r}(z),vi=function(){function e(t){_classCallCheck(this,e),this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=t}return _createClass(e,[{key:"destroy",value:function(){this.tracks=this.queues=null}},{key:"append",value:function(e,t,r){if(null!==this.queues&&null!==this.tracks){var n=this.queues[t];n.push(e),1!==n.length||r||this.executeNext(t)}}},{key:"appendBlocker",value:function(e){var t=this;return new _Promise((function(r){var n={label:"async-blocker",execute:r,onStart:function(){},onComplete:function(){},onError:function(){}};t.append(n,e)}))}},{key:"prependBlocker",value:function(e){var t=this;return new _Promise((function(r){if(t.queues){var n={label:"async-blocker-prepend",execute:r,onStart:function(){},onComplete:function(){},onError:function(){}};t.queues[e].unshift(n)}}))}},{key:"removeBlockers",value:function(){var e;null!==this.queues&&_forEachInstanceProperty(e=[this.queues.video,this.queues.audio,this.queues.audiovideo]).call(e,(function(e){var t,r=null==(t=e[0])?void 0:t.label;"async-blocker"!==r&&"async-blocker-prepend"!==r||(e[0].execute(),_spliceInstanceProperty(e).call(e,0,1))}))}},{key:"unblockAudio",value:function(e){null!==this.queues&&this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}},{key:"executeNext",value:function(e){if(null!==this.queues&&null!==this.tracks){var t=this.queues[e];if(t.length){var r=t[0];try{r.execute()}catch(t){var n;if(r.onError(t),null===this.queues||null===this.tracks)return;var a=null==(n=this.tracks[e])?void 0:n.buffer;null!=a&&a.updating||this.shiftAndExecuteNext(e)}}}}},{key:"shiftAndExecuteNext",value:function(e){null!==this.queues&&(this.queues[e].shift(),this.executeNext(e))}},{key:"current",value:function(e){var t;return(null==(t=this.queues)?void 0:t[e][0])||null}},{key:"toString",value:function(){var e,t,r=this.queues,n=this.tracks;return null===r||null===n?"<destroyed>":_concatInstanceProperty(e=_concatInstanceProperty(t="\n".concat(this.list("video"),"\n")).call(t,this.list("audio"),"\n")).call(e,this.list("audiovideo"),"}")}},{key:"list",value:function(e){var t,r,n,a;return null!=(n=this.queues)&&n[e]||null!=(a=this.tracks)&&a[e]?_concatInstanceProperty(t=_concatInstanceProperty(r="".concat(e,": (")).call(r,this.listSbInfo(e),") ")).call(t,this.listOps(e)):""}},{key:"listSbInfo",value:function(e){var t,r,n,a=null==(n=this.tracks)?void 0:n[e],i=null==a?void 0:a.buffer;return i?_concatInstanceProperty(t=_concatInstanceProperty(r="SourceBuffer".concat(i.updating?" updating":"")).call(r,a.ended?" ended":"")).call(t,a.ending?" ending":""):"none"}},{key:"listOps",value:function(e){var t,r;return(null==(r=this.queues)?void 0:_mapInstanceProperty(t=r[e]).call(t,(function(e){return e.label})).join(", "))||""}}]),e}(),mi=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,$i="HlsJsTrackRemovedError",Si=function(e){_inherits(r,_wrapNativeSuper(Error));var t=_createSuper(r);function r(e){var n;return _classCallCheck(this,r),(n=t.call(this,e)).name=$i,n}return _createClass(r)}();function Ii(e){var t,r=e.querySelectorAll("source");_forEachInstanceProperty(t=_sliceInstanceProperty([]).call(r)).call(t,(function(t){e.removeChild(t)}))}function _i(e){return"audio"===e?1:0}var Ei=function(){function e(t){_classCallCheck(this,e),this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}return _createClass(e,[{key:"setStreamController",value:function(e){this.streamController=e}},{key:"destroy",value:function(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}},{key:"registerListeners",value:function(){var e=this.hls;e.on(x.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(x.BUFFER_CODECS,this.onBufferCodecs,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"unregisterListener",value:function(){var e=this.hls;e.off(x.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(x.BUFFER_CODECS,this.onBufferCodecs,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"onFpsDropLevelCapping",value:function(e,t){var r=this.hls.levels[t.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}},{key:"onMediaAttaching",value:function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}},{key:"onManifestParsed",value:function(e,t){var r=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,r.config.capLevelToPlayerSize&&t.video&&this.startCapping()}},{key:"onLevelsUpdated",value:function(e,t){this.timer&&O(this.autoLevelCapping)&&this.detectPlayerSize()}},{key:"onBufferCodecs",value:function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}},{key:"onMediaDetaching",value:function(){this.stopCapping(),this.media=null}},{key:"detectPlayerSize",value:function(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);var e=this.hls.levels;if(e.length){var t,r,n,a,i=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&i.logger.log(_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a="Setting autoLevelCapping to ".concat(s,": ")).call(a,e[s].height,"p@")).call(n,e[s].bitrate," for media ")).call(r,this.mediaWidth,"x")).call(t,this.mediaHeight)),i.autoLevelCapping=s,i.autoLevelEnabled&&i.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=i.autoLevelCapping}}}},{key:"getMaxLevel",value:function(t){var r=this,n=this.hls.levels;if(!n.length)return-1;var a=_filterInstanceProperty(n).call(n,(function(e,n){return r.isLevelAllowed(e)&&n<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)}},{key:"startCapping",value:function(){var e;this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=_setInterval(_bindInstanceProperty(e=this.detectPlayerSize).call(e,this),1e3),this.detectPlayerSize())}},{key:"stopCapping",value:function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}},{key:"getDimensions",value:function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.width||t.height||(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t}},{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}},{key:"isLevelAllowed",value:function(e){var t;return!_someInstanceProperty(t=this.restrictedLevels).call(t,(function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height}))}}],[{key:"getMaxLevelByMediaSize",value:function(e,t,r){if(null==e||!e.length)return-1;for(var n,a,i=e.length-1,s=Math.max(t,r),o=0;o<e.length;o+=1){var l=e[o];if((l.width>=s||l.height>=s)&&(n=l,!(a=e[o+1])||n.width!==a.width||n.height!==a.height)){i=o;break}}return i}}]),e}(),Ti={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Pi={DASH:"d",HLS:"h",SMOOTH:"s",OTHER:"o"},bi="CMCD-Request",ki=(_defineProperty(n={},"CMCD-Object",["br","d","ot","tb"]),_defineProperty(n,bi,["bl","dl","mtp","nor","nrr","su"]),_defineProperty(n,"CMCD-Session",["cid","pr","sf","sid","st","v"]),_defineProperty(n,"CMCD-Status",["bs","rtp"]),n),Ai=_createClass((function e(t,r){_classCallCheck(this,e),_Array$isArray(t)&&(t=_mapInstanceProperty(t).call(t,(function(t){return t instanceof e?t:new e(t)}))),this.value=t,this.params=r}));function Ri(e,t,r,n){var a,i,s;return new Error(_concatInstanceProperty(a=_concatInstanceProperty(i="failed to ".concat(e,' "')).call(i,(s=t,_Array$isArray(s)?_JSON$stringify(s):s instanceof _Map?"Map{}":s instanceof _Set?"Set{}":"object"==_typeof(s)?_JSON$stringify(s):String(s)),'" as ')).call(a,r),{cause:n})}function Oi(e,t,r){return Ri("serialize",e,t,r)}var Li=_createClass((function e(t){_classCallCheck(this,e),this.description=t})),Ci="Bare Item";function Di(e){if(!1===ArrayBuffer.isView(e))throw Oi(e,"Byte Sequence");return":".concat((t=e,btoa(String.fromCharCode.apply(String,_toConsumableArray(t)))),":");var t}function wi(e){if((t=e)<-999999999999999||999999999999999<t)throw Oi(e,"Integer");var t;return e.toString()}function xi(e){var t=aa(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw Oi(e,"Decimal");var r=t.toString();return _includesInstanceProperty(r).call(r,".")?r:"".concat(r,".0")}var Mi=/[\x00-\x1f\x7f]+/;function Ni(e){var t,r,n=(r=e).description||_sliceInstanceProperty(t=r.toString()).call(t,7,-1);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(n))throw Oi(n,"Token");return n}function Fi(e){switch(_typeof(e)){case"number":if(!O(e))throw Oi(e,Ci);return _Number$isInteger(e)?wi(e):xi(e);case"string":return function(e){if(Mi.test(e))throw Oi(e,"String");return'"'.concat(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),'"')}(e);case"symbol":return Ni(e);case"boolean":return function(e){if("boolean"!=typeof e)throw Oi(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return"@".concat(wi(e.getTime()/1e3));if(e instanceof Uint8Array)return Di(e);if(e instanceof Li)return Ni(e);default:throw Oi(e,Ci)}}function Ui(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw Oi(e,"Key");return e}function Bi(e){var t;return null==e?"":_mapInstanceProperty(t=_Object$entries(e)).call(t,(function(e){var t,r=_slicedToArray(e,2),n=r[0],a=r[1];return!0===a?";".concat(Ui(n)):_concatInstanceProperty(t=";".concat(Ui(n),"=")).call(t,Fi(a))})).join("")}function ji(e){var t;return e instanceof Ai?_concatInstanceProperty(t="".concat(Fi(e.value))).call(t,Bi(e.params)):Fi(e)}function Gi(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{whitespace:!0};if("object"!=_typeof(e))throw Oi(e,"Dict");var n=e instanceof _Map?_entriesInstanceProperty(e).call(e):_Object$entries(e),a=(null==r?void 0:r.whitespace)?" ":"";return _mapInstanceProperty(t=_Array$from(n)).call(t,(function(e){var t,r,n=_slicedToArray(e,2),a=n[0],i=n[1];i instanceof Ai==0&&(i=new Ai(i));var s,o=Ui(a);return!0===i.value?o+=Bi(i.params):(o+="=",_Array$isArray(i.value)?o+=_concatInstanceProperty(t="(".concat(_mapInstanceProperty(r=(s=i).value).call(r,ji).join(" "),")")).call(t,Bi(s.params)):o+=ji(i)),o})).join(",".concat(a))}var Ki=function(e){return Math.round(e)},Hi=function(e){return 100*Ki(e/100)},Vi={br:Ki,d:Ki,bl:Hi,dl:Hi,mtp:Hi,nor:function(e,t){return(null==t?void 0:t.baseUrl)&&(e=function(e,t,r,n){var a=new _URL(e),i=new _URL(t);if(a.origin!==i.origin)return e;for(var s=_sliceInstanceProperty(r=a.pathname.split("/")).call(r,1),o=_sliceInstanceProperty(n=i.pathname.split("/")).call(n,1,-1);s[0]===o[0];)s.shift(),o.shift();for(;o.length;)o.shift(),s.unshift("..");return s.join("/")}(e,t.baseUrl)),encodeURIComponent(e)},rtp:Hi,tb:Ki};function Wi(e,t){var r,n={};if(null==e||"object"!=_typeof(e))return n;var a=_sortInstanceProperty(r=_Object$keys(e)).call(r),i=W({},Vi,null==t?void 0:t.formatters),s=null==t?void 0:_filterInstanceProperty(t);return _forEachInstanceProperty(a).call(a,(function(r){if(!(null==s?void 0:s(r))){var a,o=e[r],l=i[r];l&&(o=l(o,t)),"v"===r&&1===o||"pr"==r&&1===o||("number"==typeof(a=o)?O(a):null!=a&&""!==a&&!1!==a)&&(function(e){return"ot"===e||"sf"===e||"st"===e}(r)&&"string"==typeof o&&(o=new Li(o)),n[r]=o)}})),n}function Yi(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?(t=Wi(e,n),r=W({whitespace:!1},n),Gi(t,r)):""}function qi(e,t,r){return W(e,function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a={};if(!e)return a;var i=_Object$entries(e),s=_concatInstanceProperty(t=_Object$entries(ki)).call(t,_Object$entries((null==n?void 0:n.customHeaderMap)||{})),o=_reduceInstanceProperty(i).call(i,(function(e,t){var r,n,a=_slicedToArray(t,2),i=a[0],o=a[1],l=(null===(r=_findInstanceProperty(s).call(s,(function(e){var t;return _includesInstanceProperty(t=e[1]).call(t,i)})))||void 0===r?void 0:r[0])||bi;return null!==(n=e[l])&&void 0!==n||(e[l]={}),e[l][i]=o,e}),{});return _reduceInstanceProperty(r=_Object$entries(o)).call(r,(function(e,t){var r=_slicedToArray(t,2),a=r[0],i=r[1];return e[a]=Yi(i,n),e}),a)}(t,r))}var zi=/CMCD=[^&#]+/;function Xi(e,t,r){var n,a,i=function(e){if(!e)return"";var t=Yi(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return"CMCD=".concat(encodeURIComponent(t))}(t,r);if(!i)return e;if(zi.test(e))return e.replace(zi,i);var s=_includesInstanceProperty(e).call(e,"?")?"&":"?";return _concatInstanceProperty(n=_concatInstanceProperty(a="".concat(e)).call(a,s)).call(n,i)}function Qi(e,t,r,n){var a;e&&_forEachInstanceProperty(a=_Object$keys(t)).call(a,(function(a){var i,s=_mapInstanceProperty(i=_filterInstanceProperty(e).call(e,(function(e){return e.groupId===a}))).call(i,(function(e){var i=W({},e);return i.details=void 0,i.attrs=new Ir(i.attrs),i.url=i.attrs.URI=Ji(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),i.groupId=i.attrs["GROUP-ID"]=t[a],i.attrs["PATHWAY-ID"]=n,i}));e.push.apply(e,_toConsumableArray(s))}))}function Ji(e,t,r,n){var a,i,s,o=n.HOST,l=n.PARAMS,c=n[r];t&&(s=null==c?void 0:c[t])&&(e=s);var u=new _URL(e);return o&&!s&&(u.host=o),l&&_forEachInstanceProperty(a=_sortInstanceProperty(i=_Object$keys(l)).call(i)).call(a,(function(e){e&&u.searchParams.set(e,l[e])})),u.href}var Zi=function(e){_inherits(r,e);var t=_createSuper(r);function r(e){var n;return _classCallCheck(this,r),(n=t.call(this,"eme",e.logger)).hls=void 0,n.config=void 0,n.media=null,n.keyFormatPromise=null,n.keySystemAccessPromises={},n._requestLicenseFailureCount=0,n.mediaKeySessions=[],n.keyIdToKeySessionPromise={},n.setMediaKeysQueue=r.CDMCleanupPromise?[r.CDMCleanupPromise]:[],n.onMediaEncrypted=function(e){var t,r=e.initDataType,a=e.initData,i=_concatInstanceProperty(t='"'.concat(e.type,'" event: init data type: "')).call(t,r,'"');if(n.debug(i),null!==a){var s,o;if("sinf"===r&&n.getLicenseServerUrl(Lr.FAIRPLAY)){var l=Mt(new Uint8Array(a));try{var c=zt(kr(JSON.parse(l).sinf));if(!c)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=c.subarray(8,24),o=Lr.FAIRPLAY}catch(e){var u;return void n.warn(_concatInstanceProperty(u="".concat(i," Failed to parse sinf: ")).call(u,e))}}else if(n.getLicenseServerUrl(Lr.WIDEVINE)){var h,d=function(e){var t=[];if(e instanceof ArrayBuffer)for(var r=e.byteLength,n=0;n+32<r;){var a=nr(new DataView(e,n));t.push(a),n+=a.size}return t}(a),f=_Object$keys(n.keySystemAccessPromises);f.length||(f=Kr(n.config));var p=_filterInstanceProperty(d).call(d,(function(e){var t=e.systemId?jr(e.systemId):null;return!!t&&_indexOfInstanceProperty(f).call(f,t)>-1}))[0];if(!p)return void(0===d.length||_someInstanceProperty(d).call(d,(function(e){return!e.systemId}))?n.warn("".concat(i," contains incomplete or invalid pssh data")):n.log(_concatInstanceProperty(h="ignoring ".concat(i," for ")).call(h,_mapInstanceProperty(d).call(d,(function(e){return jr(e.systemId)})).join(",")," pssh data in favor of playlist keys")));if(o=jr(p.systemId),0===p.version&&p.data)if(o===Lr.WIDEVINE){var y=p.data.length-22;s=p.data.subarray(y,y+16)}else o===Lr.PLAYREADY&&(s=Wr(p.data))}if(o&&s){for(var g=gt(s),v=_assertThisInitialized(n),m=v.keyIdToKeySessionPromise,$=v.mediaKeySessions,S=m[g],I=function(){var e,t=$[_],i=t.decryptdata;if(!i.keyId)return"continue";var o=gt(i.keyId);return g===o||-1!==_indexOfInstanceProperty(e=i.uri.replace(/-/g,"")).call(e,g)?(S=m[o],i.pssh||(delete m[o],i.pssh=new Uint8Array(a),i.keyId=s,(S=m[g]=S.then((function(){return n.generateRequestWithPreferredKeySession(t,r,a,"encrypted-event-key-match")}))).catch((function(e){return n.handleError(e)}))),"break"):void 0},_=0;_<$.length;_++){var E=I();if("continue"!==E&&"break"===E)break}S||(S=m[g]=n.getKeySystemSelectionPromise([o]).then((function(e){var t,i=e.keySystem,o=e.mediaKeys;n.throwIfDestroyed();var l=new qr("ISO-23001-7",g,null!=(t=Gr(i))?t:"");return l.pssh=new Uint8Array(a),l.keyId=s,n.attemptSetMediaKeys(i,o).then((function(){n.throwIfDestroyed();var e=n.createMediaKeySessionContext({decryptdata:l,keySystem:i,mediaKeys:o});return n.generateRequestWithPreferredKeySession(e,r,a,"encrypted-event-no-match")}))}))).catch((function(e){return n.handleError(e)}))}}},n.onWaitingForKey=function(e){n.log('"'.concat(e.type,'" event'))},n.hls=e,n.config=e.config,n.registerListeners(),n}return _createClass(r,[{key:"destroy",value:function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}},{key:"registerListeners",value:function(){this.hls.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(x.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(x.MANIFEST_LOADED,this.onManifestLoaded,this)}},{key:"unregisterListeners",value:function(){this.hls.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(x.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(x.MANIFEST_LOADED,this.onManifestLoaded,this)}},{key:"getLicenseServerUrl",value:function(e){var t=this.config,r=t.drmSystems,n=t.widevineLicenseUrl,a=r[e];return a?a.licenseUrl:e===Lr.WIDEVINE&&n?n:void 0}},{key:"getLicenseServerUrlOrThrow",value:function(e){var t=this.getLicenseServerUrl(e);if(void 0===t)throw new Error('no license server URL configured for key-system "'.concat(e,'"'));return t}},{key:"getServerCertificateUrl",value:function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'.concat(e,'"]'))}},{key:"attemptKeySystemAccess",value:function(e){var t,r,n=this,a=this.hls.levels,i=function(e,t,r){return!!e&&_indexOfInstanceProperty(r).call(r,e)===t},s=_filterInstanceProperty(t=_mapInstanceProperty(a).call(a,(function(e){return e.audioCodec}))).call(t,i),o=_filterInstanceProperty(r=_mapInstanceProperty(a).call(a,(function(e){return e.videoCodec}))).call(r,i);return s.length+o.length===0&&o.push("avc1.42e01e"),new _Promise((function(t,r){!function e(a){var i=a.shift();n.getMediaKeysPromise(i,s,o).then((function(e){return t({keySystem:i,mediaKeys:e})})).catch((function(t){a.length?e(a):r(t instanceof es?t:new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))}(e)}))}},{key:"requestMediaKeySystemAccess",value:function(e,t){var r=this.config.requestMediaKeySystemAccessFunc;if("function"!=typeof r){var n="Configured requestMediaKeySystemAccess is not a function ".concat(r);return null===Vr&&"http:"===self.location.protocol&&(n="navigator.requestMediaKeySystemAccess is not available over insecure protocol ".concat(location.protocol)),_Promise.reject(new Error(n))}return r(e,t)}},{key:"getMediaKeysPromise",value:function(e,t,r){var n=this,a=function(e,t,r,n){var a,i,s,o;switch(e){case Lr.FAIRPLAY:a=["cenc","sinf"];break;case Lr.WIDEVINE:case Lr.PLAYREADY:a=["cenc"];break;case Lr.CLEARKEY:a=["cenc","keyids"];break;default:throw new Error("Unknown key-system: ".concat(e))}return i=t,s=r,[{initDataTypes:a,persistentState:(o=n).persistentState||"optional",distinctiveIdentifier:o.distinctiveIdentifier||"optional",sessionTypes:o.sessionTypes||[o.sessionType||"temporary"],audioCapabilities:_mapInstanceProperty(i).call(i,(function(e){return{contentType:"audio/mp4; codecs=".concat(e),robustness:o.audioRobustness||"",encryptionScheme:o.audioEncryptionScheme||null}})),videoCapabilities:_mapInstanceProperty(s).call(s,(function(e){return{contentType:"video/mp4; codecs=".concat(e),robustness:o.videoRobustness||"",encryptionScheme:o.videoEncryptionScheme||null}}))}]}(e,t,r,this.config.drmSystemOptions),i=this.keySystemAccessPromises[e],s=null==i?void 0:i.keySystemAccess;if(!s){var o;this.log(_concatInstanceProperty(o='Requesting encrypted media "'.concat(e,'" key-system access with config: ')).call(o,_JSON$stringify(a))),s=this.requestMediaKeySystemAccess(e,a);var l=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch((function(t){var r;n.log(_concatInstanceProperty(r='Failed to obtain access to key-system "'.concat(e,'": ')).call(r,t))})),s.then((function(t){n.log('Access for key-system "'.concat(t.keySystem,'" obtained'));var r=n.fetchServerCertificate(e);return n.log('Create media-keys for "'.concat(e,'"')),l.mediaKeys=t.createMediaKeys().then((function(t){return n.log('Media-keys created for "'.concat(e,'"')),r.then((function(r){return r?n.setMediaKeysServerCertificate(t,e,r):t}))})),l.mediaKeys.catch((function(t){var r;n.error(_concatInstanceProperty(r='Failed to create media-keys for "'.concat(e,'"}: ')).call(r,t))})),l.mediaKeys}))}return s.then((function(){return i.mediaKeys}))}},{key:"createMediaKeySessionContext",value:function(e){var t,r=e.decryptdata,n=e.keySystem,a=e.mediaKeys;this.log(_concatInstanceProperty(t='Creating key-system session "'.concat(n,'" keyId: ')).call(t,gt(r.keyId||[])));var i=a.createSession(),s={decryptdata:r,keySystem:n,mediaKeys:a,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}},{key:"renewKeySession",value:function(e){var t=e.decryptdata;if(t.pssh){var r=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t),a="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(r,a,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}},{key:"getKeyIdString",value:function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return gt(e.keyId)}},{key:"updateKeySession",value:function(e,t){var r,n,a,i=e.mediaKeysSession;return this.log(_concatInstanceProperty(r=_concatInstanceProperty(n='Updating key-session "'.concat(i.sessionId,'" for keyID ')).call(n,gt((null==(a=e.decryptdata)?void 0:a.keyId)||[]),"\n } (data length: ")).call(r,t?t.byteLength:t,")")),i.update(t)}},{key:"selectKeySystemFormat",value:function(e){var t,r,n,a=_Object$keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(n="Selecting key-system from fragment (sn: ".concat(e.sn," ")).call(n,e.type,": ")).call(r,e.level,") key formats ")).call(t,a.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(a)),this.keyFormatPromise}},{key:"getKeyFormatPromise",value:function(e){var t=this;return new _Promise((function(r,n){var a,i=Kr(t.config),s=_filterInstanceProperty(a=_mapInstanceProperty(e).call(e,Mr)).call(a,(function(e){return!!e&&-1!==_indexOfInstanceProperty(i).call(i,e)}));return t.getKeySystemSelectionPromise(s).then((function(e){var t=e.keySystem,a=Gr(t);a?r(a):n(new Error('Unable to find format for key-system "'.concat(t,'"')))})).catch(n)}))}},{key:"loadKey",value:function(e){var t,r,n,a=this,i=e.keyInfo.decryptdata,s=this.getKeyIdString(i),o=_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(n="(keyId: ".concat(s,' format: "')).call(n,i.keyFormat,'" method: ')).call(r,i.method," uri: ")).call(t,i.uri,")");this.log("Starting session for key ".concat(o));var l=this.keyIdToKeySessionPromise[s];return l||(l=this.getKeySystemForKeyPromise(i).then((function(t){var r,n,s,l=t.keySystem,c=t.mediaKeys;return a.throwIfDestroyed(),a.log(_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(s="Handle encrypted media sn: ".concat(e.frag.sn," ")).call(s,e.frag.type,": ")).call(n,e.frag.level," using key ")).call(r,o)),a.attemptSetMediaKeys(l,c).then((function(){return a.throwIfDestroyed(),a.createMediaKeySessionContext({keySystem:l,mediaKeys:c,decryptdata:i})}))})),(this.keyIdToKeySessionPromise[s]=l.then((function(e){var t=i.pssh?i.pssh.buffer:null;return a.generateRequestWithPreferredKeySession(e,"cenc",t,"playlist-key")}))).catch((function(e){return a.handleError(e)}))),l}},{key:"throwIfDestroyed",value:function(){if(!this.hls)throw new Error("invalid state")}},{key:"handleError",value:function(e){this.hls&&(this.error(e.message),e instanceof es?this.hls.trigger(x.ERROR,e.data):this.hls.trigger(x.ERROR,{type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}},{key:"getKeySystemForKeyPromise",value:function(e){var t=this.getKeyIdString(e),r=this.keyIdToKeySessionPromise[t];if(!r){var n=Mr(e.keyFormat),a=n?[n]:Kr(this.config);return this.attemptKeySystemAccess(a)}return r}},{key:"getKeySystemSelectionPromise",value:function(e){if(e.length||(e=Kr(this.config)),0===e.length)throw new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options ".concat(_JSON$stringify({drmSystems:this.config.drmSystems})));return this.attemptKeySystemAccess(e)}},{key:"attemptSetMediaKeys",value:function(e,t){var r,n=this,a=_sliceInstanceProperty(r=this.setMediaKeysQueue).call(r);this.log('Setting media-keys for "'.concat(e,'"'));var i=_Promise.all(a).then((function(){if(!n.media)throw new Error("Attempted to set mediaKeys without media element attached");return n.media.setMediaKeys(t)}));return this.setMediaKeysQueue.push(i),i.then((function(){var t;n.log('Media-keys set for "'.concat(e,'"')),a.push(i),n.setMediaKeysQueue=_filterInstanceProperty(t=n.setMediaKeysQueue).call(t,(function(e){return-1===_indexOfInstanceProperty(a).call(a,e)}))}))}},{key:"generateRequestWithPreferredKeySession",value:function(e,t,r,n){var a,i,s,o,l,c=this,u=null==(o=this.config.drmSystems)||null==(l=o[e.keySystem])?void 0:l.generateRequest;if(u)try{var h=u.call(this.hls,t,r,e);if(!h)throw new Error("Invalid response from configured generateRequest filter");t=h.initDataType,r=h.initData?h.initData:null,e.decryptdata.pssh=r?new Uint8Array(r):null}catch(e){var d;if(this.warn(e.message),null!=(d=this.hls)&&d.config.debug)throw e}if(null===r)return this.log('Skipping key-session request for "'.concat(n,'" (no initData)')),_Promise.resolve(e);var f=this.getKeyIdString(e.decryptdata);this.log(_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s='Generating key-session request for "'.concat(n,'": ')).call(s,f," (init data type: ")).call(i,t," length: ")).call(a,r?r.byteLength:null,")"));var p=new jn,y=e._onmessage=function(t){var r,n,a=e.mediaKeysSession;if(a){var i=t.messageType,s=t.message;c.log(_concatInstanceProperty(r=_concatInstanceProperty(n='"'.concat(i,'" message event for session "')).call(n,a.sessionId,'" message size: ')).call(r,s.byteLength)),"license-request"===i||"license-renewal"===i?c.renewLicense(e,s).catch((function(e){p.eventNames().length?p.emit("error",e):c.handleError(e)})):"license-release"===i?e.keySystem===Lr.FAIRPLAY&&(c.updateKeySession(e,Ar("acknowledged")),c.removeSession(e)):c.warn('unhandled media key message type "'.concat(i,'"'))}else p.emit("error",new Error("invalid state"))},g=e._onkeystatuseschange=function(t){var r;if(e.mediaKeysSession){c.onKeyStatusChange(e);var n=e.keyStatus;p.emit("keyStatus",n),"expired"===n&&(c.warn(_concatInstanceProperty(r="".concat(e.keySystem," expired for key ")).call(r,f)),c.renewKeySession(e))}else p.emit("error",new Error("invalid state"))};e.mediaKeysSession.addEventListener("message",y),e.mediaKeysSession.addEventListener("keystatuseschange",g);var v=new _Promise((function(e,t){p.on("error",t),p.on("keyStatus",(function(r){_startsWithInstanceProperty(r).call(r,"usable")?e():"output-restricted"===r?t(new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===r?t(new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'.concat(r,'"'))):"expired"===r?t(new Error("key expired while generating request")):c.warn('unhandled key status change "'.concat(r,'"'))}))}));return e.mediaKeysSession.generateRequest(t,r).then((function(){var t,r;c.log(_concatInstanceProperty(t='Request generated for key-session "'.concat(null==(r=e.mediaKeysSession)?void 0:r.sessionId,'" keyId: ')).call(t,f))})).catch((function(e){throw new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},"Error generating key-session request: ".concat(e))})).then((function(){return v})).catch((function(t){throw p.removeAllListeners(),c.removeSession(e),t})).then((function(){return p.removeAllListeners(),e}))}},{key:"onKeyStatusChange",value:function(e){var t,r=this;_forEachInstanceProperty(t=e.mediaKeysSession.keyStatuses).call(t,(function(t,n){var a,i,s;r.log(_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s='key status change "'.concat(t,'" for keyStatuses keyId: ')).call(s,gt("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))," session keyId: ")).call(i,gt(new Uint8Array(e.decryptdata.keyId||[]))," uri: ")).call(a,e.decryptdata.uri)),e.keyStatus=t}))}},{key:"fetchServerCertificate",value:function(e){var t=this.config,r=new t.loader(t),n=this.getServerCertificateUrl(e);return n?(this.log('Fetching server certificate for "'.concat(e,'"')),new _Promise((function(a,i){var s={responseType:"arraybuffer",url:n},o=t.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:function(e,t,r,n){a(e.data)},onError:function(t,r,a,o){var l,c,u;i(new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:q({url:s.url,data:void 0},t)},_concatInstanceProperty(l=_concatInstanceProperty(c=_concatInstanceProperty(u='"'.concat(e,'" certificate request failed (')).call(u,n,"). Status: ")).call(c,t.code," (")).call(l,t.text,")")))},onTimeout:function(t,r,a){var o;i(new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:s.url,data:void 0}},_concatInstanceProperty(o='"'.concat(e,'" certificate request timed out (')).call(o,n,")")))},onAbort:function(e,t,r){i(new Error("aborted"))}};r.load(s,l,c)}))):_Promise.resolve()}},{key:"setMediaKeysServerCertificate",value:function(e,t,r){var n=this;return new _Promise((function(a,i){e.setServerCertificate(r).then((function(i){var s,o;n.log(_concatInstanceProperty(s=_concatInstanceProperty(o="setServerCertificate ".concat(i?"success":"not supported by CDM"," (")).call(o,null==r?void 0:r.byteLength,') on "')).call(s,t,'"')),a(e)})).catch((function(e){i(new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}},{key:"renewLicense",value:function(e,t){var r=this;return this.requestLicense(e,new Uint8Array(t)).then((function(t){return r.updateKeySession(e,new Uint8Array(t)).catch((function(e){throw new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))}))}},{key:"unpackPlayReadyKeyMessage",value:function(e,t){var r=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!_includesInstanceProperty(r).call(r,"PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;var n=(new DOMParser).parseFromString(r,"application/xml"),a=n.querySelectorAll("HttpHeader");if(a.length>0)for(var i,s=0,o=a.length;s<o;s++){var l,c,u=null==(l=(i=a[s]).querySelector("name"))?void 0:l.textContent,h=null==(c=i.querySelector("value"))?void 0:c.textContent;u&&h&&e.setRequestHeader(u,h)}var d=n.querySelector("Challenge"),f=null==d?void 0:d.textContent;if(!f)throw new Error("Cannot find <Challenge> in key message");return Ar(atob(f))}},{key:"setupLicenseXHR",value:function(e,t,r,n){var a=this,i=this.config.licenseXhrSetup;return i?_Promise.resolve().then((function(){if(!r.decryptdata)throw new Error("Key removed");return i.call(a.hls,e,t,r,n)})).catch((function(s){if(!r.decryptdata)throw s;return e.open("POST",t,!0),i.call(a.hls,e,t,r,n)})).then((function(r){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||n}})):(e.open("POST",t,!0),_Promise.resolve({xhr:e,licenseChallenge:n}))}},{key:"requestLicense",value:function(e,t){var r=this,n=this.config.keyLoadPolicy.default;return new _Promise((function(a,i){var s=r.getLicenseServerUrlOrThrow(e.keySystem);r.log("Sending license request to URL: ".concat(s));var o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=function(){if(!r.hls||!e.mediaKeysSession)return i(new Error("invalid state"));if(4===o.readyState)if(200===o.status){r._requestLicenseFailureCount=0;var l=o.response;r.log("License received ".concat(l instanceof ArrayBuffer?l.byteLength:l));var c=r.config.licenseResponseCallback;if(c)try{l=c.call(r.hls,o,s,e)}catch(e){r.error(e)}a(l)}else{var u,h,d=n.errorRetry,f=d?d.maxNumRetry:0;if(r._requestLicenseFailureCount++,r._requestLicenseFailureCount>f||o.status>=400&&o.status<500)i(new es({type:D.KEY_SYSTEM_ERROR,details:w.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:s,data:void 0,code:o.status,text:o.statusText}},_concatInstanceProperty(u=_concatInstanceProperty(h="License Request XHR failed (".concat(s,"). Status: ")).call(h,o.status," (")).call(u,o.statusText,")")));else{var p=f-r._requestLicenseFailureCount+1;r.warn("Retrying license request, ".concat(p," attempts left")),r.requestLicense(e,t).then(a,i)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,r.setupLicenseXHR(o,s,e,t).then((function(t){var n=t.xhr,a=t.licenseChallenge;e.keySystem==Lr.PLAYREADY&&(a=r.unpackPlayReadyKeyMessage(n,a)),n.send(a)}))}))}},{key:"onMediaAttached",value:function(e,t){if(this.config.emeEnabled){var r=t.media;this.media=r,r.removeEventListener("encrypted",this.onMediaEncrypted),r.removeEventListener("waitingforkey",this.onWaitingForKey),r.addEventListener("encrypted",this.onMediaEncrypted),r.addEventListener("waitingforkey",this.onWaitingForKey)}}},{key:"onMediaDetached",value:function(){var e,t,n=this,a=this.media,i=this.mediaKeySessions;a&&(a.removeEventListener("encrypted",this.onMediaEncrypted),a.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},qr.clearKeyUriToKeyIdMap();var s=i.length;r.CDMCleanupPromise=_Promise.all(_concatInstanceProperty(e=_mapInstanceProperty(i).call(i,(function(e){return n.removeSession(e)}))).call(e,null==a||null==(t=a.setMediaKeys(null))?void 0:t.catch((function(e){var t;n.log("Could not clear media keys: ".concat(e)),null==(t=n.hls)||t.trigger(x.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error("Could not clear media keys: ".concat(e))})})))).then((function(){s&&(n.log("finished closing key sessions and clearing media keys"),i.length=0)})).catch((function(e){var t;n.log("Could not close sessions and clear media keys: ".concat(e)),null==(t=n.hls)||t.trigger(x.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close sessions and clear media keys: ".concat(e))})}))}},{key:"onManifestLoading",value:function(){this.keyFormatPromise=null}},{key:"onManifestLoaded",value:function(e,t){var r=t.sessionKeys;if(r&&this.config.emeEnabled&&!this.keyFormatPromise){var n=_reduceInstanceProperty(r).call(r,(function(e,t){return-1===_indexOfInstanceProperty(e).call(e,t.keyFormat)&&e.push(t.keyFormat),e}),[]);this.log("Selecting key-system from session-keys ".concat(n.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(n)}}},{key:"removeSession",value:function(e){var t=this,r=e.mediaKeysSession,n=e.licenseXhr;if(r){var a,i;this.log("Remove licenses and keys and close session ".concat(r.sessionId)),e._onmessage&&(r.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(r.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var s=_indexOfInstanceProperty(a=this.mediaKeySessions).call(a,e);return s>-1&&_spliceInstanceProperty(i=this.mediaKeySessions).call(i,s,1),r.remove().catch((function(e){var r;t.log("Could not remove session: ".concat(e)),null==(r=t.hls)||r.trigger(x.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error("Could not remove session: ".concat(e))})})).then((function(){return r.close()})).catch((function(e){var r;t.log("Could not close session: ".concat(e)),null==(r=t.hls)||r.trigger(x.ERROR,{type:D.OTHER_ERROR,details:w.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close session: ".concat(e))})}))}}}]),r}(z);Zi.CDMCleanupPromise=void 0;var es=function(e){_inherits(r,_wrapNativeSuper(Error));var t=_createSuper(r);function r(e,n){var a;return _classCallCheck(this,r),(a=t.call(this,n)).data=void 0,e.error||(e.error=new Error(n)),a.data=e,e.err=e.error,a}return _createClass(r)}();function ts(e,t){var r;try{r=new Event("addtrack")}catch(e){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=e,t.dispatchEvent(r)}function rs(e,t){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: ".concat(t))}catch(r){te.debug("[texttrack-utils]: ".concat(r));try{var n=new self.TextTrackCue(t.startTime,t.endTime,t.text);n.id=t.id,e.addCue(n)}catch(e){te.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: ".concat(e))}}"disabled"===r&&(e.mode=r)}function ns(e,t){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues)for(var n=e.cues.length;n--;)t&&e.cues[n].removeEventListener("enter",t),e.removeCue(e.cues[n]);"disabled"===r&&(e.mode=r)}function as(e,t,r,n){var a=e.mode;if("disabled"===a&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var i=function(e,t,r){var n=[],a=function(e,t){if(t<e[0].startTime)return 0;var r=e.length-1;if(t>e[r].endTime)return-1;for(var n=0,a=r;n<=a;){var i=Math.floor((a+n)/2);if(t<e[i].startTime)a=i-1;else{if(!(t>e[i].startTime&&n<r))return i;n=i+1}}return e[n].startTime-t<t-e[a].startTime?n:a}(e,t);if(a>-1)for(var i=a,s=e.length;i<s;i++){var o=e[i];if(o.startTime>=t&&o.endTime<=r)n.push(o);else if(o.startTime>r)return n}return n}(e.cues,t,r),s=0;s<i.length;s++)n&&!n(i[s])||e.removeCue(i[s]);"disabled"===a&&(e.mode=a)}function is(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];"subtitles"!==n.kind&&"captions"!==n.kind||!n.label||t.push(e[r])}return t}function ss(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()}var os=.02,ls=function(e){return e[e.Point=0]="Point",e[e.Range=1]="Range",e}({});function cs(e,t,r){var n,a;return _concatInstanceProperty(n=_concatInstanceProperty(a="".concat(e.identifier,"-")).call(a,r+1,"-")).call(n,ss(t))}var us=function(){function e(t,r){_classCallCheck(this,e),this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.base=r,this.dateRange=t,this.setDateRange(t)}return _createClass(e,[{key:"setDateRange",value:function(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}},{key:"reset",value:function(){var e;null==(e=this.assetListLoader)||e.destroy(),this.assetListLoader=this.error=void 0}},{key:"isAssetPastPlayoutLimit",value:function(e){if(e>=this.assetList.length)return!0;var t=this.playoutLimit;return!(e<=0||isNaN(t))&&this.assetList[e].startOffset>t}},{key:"findAssetIndex",value:function(e){var t;return _indexOfInstanceProperty(t=this.assetList).call(t,e)}},{key:"identifier",get:function(){return this.dateRange.id}},{key:"startDate",get:function(){return this.dateRange.startDate}},{key:"startTime",get:function(){var e=this.dateRange.startTime;if(this.snapOptions.out){var t=this.dateRange.tagAnchor;if(t)return hs(e,t)}return e}},{key:"startOffset",get:function(){return this.cue.pre?0:this.startTime}},{key:"resumptionOffset",get:function(){var e=this.resumeOffset,t=O(e)?e:this.duration;return this.cumulativeDuration+t}},{key:"resumeTime",get:function(){var e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){var t=this.resumeAnchor;if(t)return hs(e,t)}return e}},{key:"appendInPlace",get:function(){return!this.appendInPlaceDisabled&&!(this.cue.once||this.cue.pre||0!==this.startTime&&!this.snapOptions.out||!(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<os))},set:function(e){this.appendInPlaceStarted||(this.appendInPlaceDisabled=!e)}},{key:"timelineStart",get:function(){return null!==this._timelineStart?this._timelineStart:this.startTime},set:function(e){this._timelineStart=e}},{key:"duration",get:function(){var e,t=this.playoutLimit;return e=this._duration?this._duration:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(t)&&t<e&&(e=t),e},set:function(e){this._duration=e}},{key:"cue",get:function(){return this.dateRange.cue}},{key:"timelineOccupancy",get:function(){return"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?ls.Range:ls.Point}},{key:"supplementsPrimary",get:function(){return"PRIMARY"===this.dateRange.attr["X-TIMELINE-STYLE"]}},{key:"contentMayVary",get:function(){return"NO"!==this.dateRange.attr["X-CONTENT-MAY-VARY"]}},{key:"assetUrl",get:function(){return this.dateRange.attr["X-ASSET-URI"]}},{key:"assetListUrl",get:function(){return this.dateRange.attr["X-ASSET-LIST"]}},{key:"baseUrl",get:function(){return this.base.url}},{key:"toString",value:function(){var e,t,r,n;return _concatInstanceProperty(e=_concatInstanceProperty(t=_concatInstanceProperty(r='["'.concat((n=this).identifier,'" ')).call(r,n.cue.pre?"<pre>":n.cue.post?"<post>":"")).call(t,n.timelineStart.toFixed(2),"-")).call(e,n.resumeTime.toFixed(2),"]")}}]),e}();function hs(e,t){return e-t.start<t.duration/2&&!(Math.abs(e-(t.start+t.duration))<os)?t.start:t.start+t.duration}function ds(e,t,r){var n=new _URL(e,r);return"data:"!==n.protocol&&n.searchParams.set("_HLS_primary_id",t),n}function fs(e){var t,r,n=e.timelineStart,a=e.duration||0;return _concatInstanceProperty(t=_concatInstanceProperty(r='["'.concat(e.identifier,'" ')).call(r,n.toFixed(2),"-")).call(t,(n+a).toFixed(2),"]")}var ps=function(){function e(t,r,n,a){var i=this;_classCallCheck(this,e),this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this.playoutOffset=0,this.checkPlayout=function(){var e=i.interstitial.playoutLimit;i.playoutOffset+i.currentTime>=e&&i.hls.trigger(x.PLAYOUT_LIMIT_REACHED,{})};var s=this.hls=new t(r);this.interstitial=n,this.assetItem=a;var o=a.uri;try{o=ds(o,s.sessionId).href}catch(e){}s.loadSource(o);var l=function(){i.hasDetails=!0};s.once(x.LEVEL_LOADED,l),s.once(x.AUDIO_TRACK_LOADED,l),s.once(x.SUBTITLE_TRACK_LOADED,l),s.on(x.MEDIA_ATTACHING,(function(e,t){var r,n=t.media;i.removeMediaListeners(),i.mediaAttached=n;var s,o=i.interstitial;o.playoutLimit&&(i.playoutOffset=(null==(s=o.assetList[_indexOfInstanceProperty(r=o.assetList).call(r,a)])?void 0:s.startOffset)||0,n.addEventListener("timeupdate",i.checkPlayout))}))}return _createClass(e,[{key:"destroyed",get:function(){var e;return!(null!=(e=this.hls)&&e.userConfig)}},{key:"assetId",get:function(){return this.assetItem.identifier}},{key:"interstitialId",get:function(){return this.assetItem.parentIdentifier}},{key:"media",get:function(){return this.hls.media}},{key:"bufferedEnd",get:function(){var e=this.media||this.mediaAttached;if(!e)return 0;var t=fr.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}},{key:"currentTime",get:function(){var e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):0}},{key:"duration",get:function(){var e;return(null==(e=this.assetItem)?void 0:e.duration)||0}},{key:"remaining",get:function(){var e=this.duration;return e?Math.max(0,e-this.currentTime):0}},{key:"timelineOffset",get:function(){return this.hls.config.timelineOffset||0},set:function(e){var t=this.timelineOffset;if(e!==t){var r=e-t;if(Math.abs(r)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}},{key:"getAssetTime",value:function(e){var t=this.timelineOffset,r=this.duration;return Math.min(Math.max(0,e-t),r)}},{key:"removeMediaListeners",value:function(){var e=this.mediaAttached;e&&e.removeEventListener("timeupdate",this.checkPlayout)}},{key:"destroy",value:function(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}},{key:"attachMedia",value:function(e){this.hls.attachMedia(e)}},{key:"detachMedia",value:function(){this.removeMediaListeners(),this.hls.detachMedia()}},{key:"resumeBuffering",value:function(){this.hls.resumeBuffering()}},{key:"pauseBuffering",value:function(){this.hls.pauseBuffering()}},{key:"transferMedia",value:function(){return this.hls.transferMedia()}},{key:"on",value:function(e,t,r){this.hls.on(e,t)}},{key:"once",value:function(e,t,r){this.hls.once(e,t)}},{key:"off",value:function(e,t,r){this.hls.off(e,t)}},{key:"toString",value:function(){var e,t;return _concatInstanceProperty(e=_concatInstanceProperty(t="HlsAssetPlayer: ".concat(fs(this.assetItem)," ")).call(t,this.hls.sessionId," ")).call(e,this.interstitial.appendInPlace?"append-in-place":"")}}]),e}(),ys=function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n){var a;return _classCallCheck(this,r),(a=t.call(this,"interstitials-sched",n)).onScheduleUpdate=void 0,a.eventMap={},a.events=null,a.items=null,a.durations={primary:0,playout:0,integrated:0},a.onScheduleUpdate=e,a}return _createClass(r,[{key:"destroy",value:function(){this.reset(),this.onScheduleUpdate=null}},{key:"reset",value:function(){var e;this.eventMap={},this.setDurations(0,0,0),this.events&&_forEachInstanceProperty(e=this.events).call(e,(function(e){return e.reset()})),this.events=this.items=null}},{key:"duration",get:function(){var e=this.items;return e?e[e.length-1].end:0}},{key:"length",get:function(){return this.items?this.items.length:0}},{key:"getEvent",value:function(e){return e&&this.eventMap[e]||null}},{key:"hasEvent",value:function(e){return e in this.eventMap}},{key:"findItemIndex",value:function(e,t){if(e.event)return this.findEventIndex(e.event.identifier);var r=-1;e.nextEvent?r=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(r=this.findEventIndex(e.previousEvent.identifier)+1);var n=this.items;if(n)for(n[r]||(void 0===t&&(t=e.start),r=this.findItemIndexAtTime(t));r>=0&&null!=(a=n[r])&&a.event;){var a;r--}return r}},{key:"findItemIndexAtTime",value:function(e,t){var r=this.items;if(r)for(var n=0;n<r.length;n++){var a=r[n];if(t&&"primary"!==t&&(a=a[t]),e===a.start||e>a.start&&e<a.end)return n}return-1}},{key:"findJumpRestrictedIndex",value:function(e,t){var r=this.items;if(r)for(var n=e;n<=t&&r[n];n++){var a=r[n].event;if(null!=a&&a.restrictions.jump&&!a.appendInPlace)return n}return-1}},{key:"findEventIndex",value:function(e){var t=this.items;if(t)for(var r=t.length;r--;){var n;if((null==(n=t[r].event)?void 0:n.identifier)===e)return r}return-1}},{key:"findAssetIndex",value:function(e,t){var r=e.assetList,n=r.length;if(n>1)for(var a=0;a<n;a++){var i=r[a];if(!i.error){var s=i.timelineStart;if(t===s||t>s&&t<s+(i.duration||0))return a}}return 0}},{key:"assetIdAtEnd",get:function(){var e,t,r=null==(e=this.items)||null==(t=e[this.length-1])?void 0:t.event;if(r){var n=r.assetList,a=n[n.length-1];if(a)return a.identifier}return null}},{key:"parseInterstitialDateRanges",value:function(e){var t=this,r=e.main.details,n=r.dateRanges,a=this.events,i=this.parseDateRanges(n,{url:r.url}),s=_Object$keys(n),o=a?_filterInstanceProperty(a).call(a,(function(e){return!_includesInstanceProperty(s).call(s,e.identifier)})):[];i.length&&_sortInstanceProperty(i).call(i,(function(e,t){var r=e.cue.pre,n=e.cue.post,a=t.cue.pre,i=t.cue.post;if(r&&!a)return-1;if(a&&!r)return 1;if(n&&!i)return 1;if(i&&!n)return-1;if(!(r||a||n||i)){var s=e.startTime,o=t.startTime;if(s!==o)return s-o}return e.dateRange.tagOrder-t.dateRange.tagOrder})),this.events=i,_forEachInstanceProperty(o).call(o,(function(e){t.removeEvent(e)})),this.updateSchedule(e,o)}},{key:"updateSchedule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=this.events||[];if(r.length||t.length||this.length<2){var n=this.items,a=this.parseSchedule(r,e);(t.length||(null==n?void 0:n.length)!==a.length||_someInstanceProperty(a).call(a,(function(e,t){return Math.abs(e.playout.start-n[t].playout.start)>.005||Math.abs(e.playout.end-n[t].playout.end)>.005})))&&(this.items=a,this.onScheduleUpdate(t,n))}}},{key:"parseDateRanges",value:function(e,t){for(var r=[],n=_Object$keys(e),a=0;a<n.length;a++){var i=n[a],s=e[i];if(s.isInterstitial){var o=this.eventMap[i];o?o.setDateRange(s):(o=new us(s,t),this.eventMap[i]=o),r.push(o)}}return r}},{key:"parseSchedule",value:function(e,t){var r=[],n=t.main.details,a=n.live?1/0:n.edge,i=0;if((e=_filterInstanceProperty(e).call(e,(function(e){return!(e.error||e.cue.once&&e.hasPlayed)}))).length){this.resolveOffsets(e,t);var s=0,o=0;if(_forEachInstanceProperty(e).call(e,(function(t,n){var l=t.cue.pre,c=t.cue.post,u=e[n-1]||null,h=t.appendInPlace,d=c?a:t.startOffset,f=t.duration,p=t.timelineOccupancy===ls.Range?f:0,y=t.resumptionOffset,g=(null==u?void 0:u.startTime)===d,v=d+t.cumulativeDuration,m=h?v+f:d+y;if(l||!c&&d<=0){var $=o;o+=p,t.timelineStart=v;var S=i;i+=f,r.push({event:t,start:v,end:m,playout:{start:S,end:i},integrated:{start:$,end:o}})}else{if(!(d<=a))return;if(!g){var I=d-s;if(I>.033){var _=s,E=o;o+=I;var T=i;i+=I;var P={previousEvent:e[n-1]||null,nextEvent:t,start:_,end:_+I,playout:{start:T,end:i},integrated:{start:E,end:o}};r.push(P)}else I>0&&u&&(u.cumulativeDuration+=I,r[r.length-1].end=d)}c&&(m=v),t.timelineStart=v;var b=o;o+=p;var k=i;i+=f,r.push({event:t,start:v,end:m,playout:{start:k,end:i},integrated:{start:b,end:o}})}var A=t.resumeTime;s=c||A>a?a:A})),s<a){var l,c=s,u=o,h=a-s;o+=h;var d=i;i+=h,r.push({previousEvent:(null==(l=r[r.length-1])?void 0:l.event)||null,nextEvent:null,start:s,end:c+h,playout:{start:d,end:i},integrated:{start:u,end:o}})}this.setDurations(a,i,o)}else{var f=0;r.push({previousEvent:null,nextEvent:null,start:f,end:a,playout:{start:f,end:a},integrated:{start:f,end:a}}),this.setDurations(a,a,a)}return r}},{key:"setDurations",value:function(e,t,r){this.durations={primary:e,playout:t,integrated:r}}},{key:"resolveOffsets",value:function(e,t){var r=this,n=t.main.details,a=n.live?1/0:n.edge,i=0,s=-1;_forEachInstanceProperty(e).call(e,(function(o,l){var c=o.cue.pre,u=o.cue.post,h=c?0:u?a:o.startTime;if(r.updateAssetDurations(o),s===h?o.cumulativeDuration=i:(i=0,s=h),!u&&o.snapOptions.in&&(o.resumeAnchor=Ue(null,n.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(r.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace)for(var d=l-1;l--;)e[d+1].startTime-e[d].resumeTime<.033&&(e[d].appendInPlace=!1);var f=O(o.resumeOffset)?o.resumeOffset:o.duration;i+=f}))}},{key:"primaryCanResumeInPlaceAt",value:function(e,t){var r,n,a,i,s=this,o=e.resumeTime,l=e.startTime+e.resumptionOffset;return Math.abs(o-l)>os?(this.log(_concatInstanceProperty(r=_concatInstanceProperty(n='"'.concat(e.identifier,'" resumption ')).call(n,o," not aligned with estimated timeline end ")).call(r,l)),!1):t?!_someInstanceProperty(a=_Object$keys(t)).call(a,(function(r){var n,a,i,l,c,u,h,d,f,p,y,g=t[r].details,v=g.edge;if(o>v)return s.log(_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i='"'.concat(e.identifier,'" resumption ')).call(i,o," past ")).call(a,r," playlist end ")).call(n,v)),!0;var m=Ue(null,g.fragments,o);if(!m)return s.log(_concatInstanceProperty(l=_concatInstanceProperty(c='"'.concat(e.identifier,'" resumption ')).call(c,o," does not align with any fragments in ")).call(l,r," playlist")),!0;var $="audio"===r?.175:0;return!(Math.abs(m.start-o)<os||Math.abs(m.end-o)<os+$||(s.log(_concatInstanceProperty(u=_concatInstanceProperty(h=_concatInstanceProperty(d=_concatInstanceProperty(f=_concatInstanceProperty(p=_concatInstanceProperty(y='"'.concat(e.identifier,'" resumption ')).call(y,o," not aligned with ")).call(p,r," fragment bounds (")).call(f,m.start,"-")).call(d,m.end," sn: ")).call(h,m.sn," cc: ")).call(u,m.cc,")")),0))})):(this.log(_concatInstanceProperty(i='"'.concat(e.identifier,'" resumption ')).call(i,o," can not be aligned with media (none selected)")),!1)}},{key:"updateAssetDurations",value:function(e){var t,r=e.timelineStart,n=0,a=!1,i=!1;_forEachInstanceProperty(t=e.assetList).call(t,(function(e,t){var s=r+n;e.startOffset=n,e.timelineStart=s,a||(a=null===e.duration),i||(i=!!e.error);var o=e.error?0:e.duration||0;n+=o})),e.duration=a&&!i?Math.max(n,e.duration):n}},{key:"removeEvent",value:function(e){e.reset(),delete this.eventMap[e.identifier]}}]),r}(z);function gs(e){var t,r;return _concatInstanceProperty(t=_concatInstanceProperty(r="[".concat(e.event?'"'+e.event.identifier+'"':"primary",": ")).call(r,e.start.toFixed(2),"-")).call(t,e.end.toFixed(2),"]")}var vs=function(){function e(t){_classCallCheck(this,e),this.hls=void 0,this.hls=t}return _createClass(e,[{key:"destroy",value:function(){this.hls=null}},{key:"loadAssetList",value:function(e,t){var r,n=this,a=e.assetListUrl;try{r=ds(a,this.hls.sessionId,e.baseUrl)}catch(t){var i=this.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,t,a);return void this.hls.trigger(x.ERROR,i)}if(t&&!e.cue.pre&&!e.cue.post&&"data:"!==r.protocol){var s=t-e.startTime;s>0&&r.searchParams.set("_HLS_start_offset",""+Math.round(1e3*s)/1e3)}var o=this.hls.config,l=new o.loader(o),c={responseType:"json",url:r.href},u=o.interstitialAssetListLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:function(t,r,a,i){var s=t.data,o=null==s?void 0:s.ASSETS;if(_Array$isArray(o))e.assetListResponse=s,n.hls.trigger(x.ASSET_LIST_LOADED,{event:e,assetListResponse:s,networkDetails:i});else{var l=n.assignAssetListError(e,w.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),a.url,r,i);n.hls.trigger(x.ERROR,l)}},onError:function(t,r,a,i){var s,o,l=n.assignAssetListError(e,w.ASSET_LIST_LOAD_ERROR,new Error(_concatInstanceProperty(s=_concatInstanceProperty(o="Error loading X-ASSET-LIST: HTTP status ".concat(t.code," ")).call(o,t.text," (")).call(s,r.url,")")),r.url,i,a);n.hls.trigger(x.ERROR,l)},onTimeout:function(t,r,a){var i=n.assignAssetListError(e,w.ASSET_LIST_LOAD_TIMEOUT,new Error("Timeout loading X-ASSET-LIST (".concat(r.url,")")),r.url,t,a);n.hls.trigger(x.ERROR,i)}};return l.load(c,h,d),this.hls.trigger(x.ASSET_LIST_LOADING,{event:e}),l}},{key:"assignAssetListError",value:function(e,t,r,n,a,i){return e.error=r,{type:D.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:r,networkDetails:i,stats:a}}}]),e}();function ms(e){null==e||e.play().catch()}var $s=_createClass((function e(t){_classCallCheck(this,e),this.buffered=void 0;var r=function(e,r,n){var a,i;if((r>>>=0)>n-1)throw new DOMException(_concatInstanceProperty(a=_concatInstanceProperty(i="Failed to execute '".concat(e,"' on 'TimeRanges': The index provided (")).call(i,r,") is greater than the maximum bound (")).call(a,n,")"));return t[r][e]};this.buffered={get length(){return t.length},end:function(e){return r("end",e,t.length)},start:function(e){return r("start",e,t.length)}}})),Ss={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Is=function(e){return String.fromCharCode(Ss[e]||e)},_s=15,Es=100,Ts={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Ps={17:2,18:4,21:6,22:8,23:10,19:13,20:15},bs={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ks={25:2,26:4,29:6,30:8,31:10,27:13,28:15},As=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],Rs=function(){function e(){_classCallCheck(this,e),this.time=null,this.verboseLevel=0}return _createClass(e,[{key:"log",value:function(e,t){if(this.verboseLevel>=e){var r,n,a="function"==typeof t?t():t;te.log(_concatInstanceProperty(r=_concatInstanceProperty(n="".concat(this.time," [")).call(n,e,"] ")).call(r,a))}}}]),e}(),Os=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},Ls=function(){function e(){_classCallCheck(this,e),this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}return _createClass(e,[{key:"reset",value:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}},{key:"setStyles",value:function(e){for(var t=["foreground","underline","italics","background","flash"],r=0;r<t.length;r++){var n=t[r];e.hasOwnProperty(n)&&(this[n]=e[n])}}},{key:"isDefault",value:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}},{key:"equals",value:function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}},{key:"copy",value:function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}},{key:"toString",value:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}]),e}(),Cs=function(){function e(){_classCallCheck(this,e),this.uchar=" ",this.penState=new Ls}return _createClass(e,[{key:"reset",value:function(){this.uchar=" ",this.penState.reset()}},{key:"setChar",value:function(e,t){this.uchar=e,this.penState.copy(t)}},{key:"setPenState",value:function(e){this.penState.copy(e)}},{key:"equals",value:function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}},{key:"copy",value:function(e){this.uchar=e.uchar,this.penState.copy(e.penState)}},{key:"isEmpty",value:function(){return" "===this.uchar&&this.penState.isDefault()}}]),e}(),Ds=function(){function e(t){_classCallCheck(this,e),this.chars=[],this.pos=0,this.currPenState=new Ls,this.cueStartTime=null,this.logger=void 0;for(var r=0;r<Es;r++)this.chars.push(new Cs);this.logger=t}return _createClass(e,[{key:"equals",value:function(e){for(var t=0;t<Es;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}},{key:"copy",value:function(e){for(var t=0;t<Es;t++)this.chars[t].copy(e.chars[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<Es;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}},{key:"setCursor",value:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Es&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Es)}},{key:"moveCursor",value:function(e){var t=this.pos+e;if(e>1)for(var r=this.pos+1;r<t+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)}},{key:"backSpace",value:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}},{key:"insertChar",value:function(e){var t=this;e>=144&&this.backSpace();var r=Is(e);this.pos>=Es?this.logger.log(0,(function(){return"Cannot insert "+e.toString(16)+" ("+r+") at position "+t.pos+". Skipping it!"})):(this.chars[this.pos].setChar(r,this.currPenState),this.moveCursor(1))}},{key:"clearFromPos",value:function(e){var t;for(t=e;t<Es;t++)this.chars[t].reset()}},{key:"clear",value:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}},{key:"clearToEndOfRow",value:function(){this.clearFromPos(this.pos)}},{key:"getTextString",value:function(){for(var e=[],t=!0,r=0;r<Es;r++){var n=this.chars[r].uchar;" "!==n&&(t=!1),e.push(n)}return t?"":e.join("")}},{key:"setPenStyles",value:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}]),e}(),ws=function(){function e(t){_classCallCheck(this,e),this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var r=0;r<_s;r++)this.rows.push(new Ds(t));this.logger=t}return _createClass(e,[{key:"reset",value:function(){for(var e=0;e<_s;e++)this.rows[e].clear();this.currRow=14}},{key:"equals",value:function(e){for(var t=!0,r=0;r<_s;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t}},{key:"copy",value:function(e){for(var t=0;t<_s;t++)this.rows[t].copy(e.rows[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<_s;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}},{key:"backSpace",value:function(){this.rows[this.currRow].backSpace()}},{key:"clearToEndOfRow",value:function(){this.rows[this.currRow].clearToEndOfRow()}},{key:"insertChar",value:function(e){this.rows[this.currRow].insertChar(e)}},{key:"setPen",value:function(e){this.rows[this.currRow].setPenStyles(e)}},{key:"moveCursor",value:function(e){this.rows[this.currRow].moveCursor(e)}},{key:"setCursor",value:function(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}},{key:"setPAC",value:function(e){this.logger.log(2,(function(){return"pacData = "+_JSON$stringify(e)}));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var r=0;r<_s;r++)this.rows[r].clear();var n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var i=a.rows[n].cueStartTime,s=this.logger.time;if(null!==i&&null!==s&&i<s)for(var o=0;o<this.nrRollUpRows;o++)this.rows[t-this.nrRollUpRows+o+1].copy(a.rows[n+o])}}this.currRow=t;var l=this.rows[this.currRow];if(null!==e.indent){var c=e.indent,u=Math.max(c-1,0);l.setCursor(e.indent),e.color=l.chars[u].penState.foreground}var h={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(h)}},{key:"setBkgData",value:function(e){this.logger.log(2,(function(){return"bkgData = "+_JSON$stringify(e)})),this.backSpace(),this.setPen(e),this.insertChar(32)}},{key:"setRollUpRows",value:function(e){this.nrRollUpRows=e}},{key:"rollUp",value:function(){var e,t,r=this;if(null!==this.nrRollUpRows){this.logger.log(1,(function(){return r.getDisplayText()}));var n=this.currRow+1-this.nrRollUpRows,a=_spliceInstanceProperty(e=this.rows).call(e,n,1)[0];a.clear(),_spliceInstanceProperty(t=this.rows).call(t,this.currRow,0,a),this.logger.log(2,"Rolling up")}else this.logger.log(3,"roll_up but nrRollUpRows not set yet")}},{key:"getDisplayText",value:function(e){e=e||!1;for(var t=[],r="",n=-1,a=0;a<_s;a++){var i=this.rows[a].getTextString();i&&(n=a+1,e?t.push("Row "+n+": '"+i+"'"):t.push(_trimInstanceProperty(i).call(i)))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r}},{key:"getTextAndFormat",value:function(){return this.rows}}]),e}(),xs=function(){function e(t,r,n){_classCallCheck(this,e),this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new ws(n),this.nonDisplayedMemory=new ws(n),this.lastOutputScreen=new ws(n),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}return _createClass(e,[{key:"reset",value:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}},{key:"getHandler",value:function(){return this.outputFilter}},{key:"setHandler",value:function(e){this.outputFilter=e}},{key:"setPAC",value:function(e){this.writeScreen.setPAC(e)}},{key:"setBkgData",value:function(e){this.writeScreen.setBkgData(e)}},{key:"setMode",value:function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(function(){return"MODE="+e})),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}},{key:"insertChars",value:function(e){for(var t=this,r=0;r<e.length;r++)this.writeScreen.insertChar(e[r]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(function(){return n+": "+t.writeScreen.getDisplayText(!0)})),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(function(){return"DISPLAYED: "+t.displayedMemory.getDisplayText(!0)})),this.outputDataUpdate())}},{key:"ccRCL",value:function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}},{key:"ccBS",value:function(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}},{key:"ccAOF",value:function(){}},{key:"ccAON",value:function(){}},{key:"ccDER",value:function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}},{key:"ccRU",value:function(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}},{key:"ccFON",value:function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}},{key:"ccRDC",value:function(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}},{key:"ccTR",value:function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}},{key:"ccRTD",value:function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}},{key:"ccEDM",value:function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}},{key:"ccCR",value:function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}},{key:"ccENM",value:function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}},{key:"ccEOC",value:function(){var e=this;if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(function(){return"DISP: "+e.displayedMemory.getDisplayText()}))}this.outputDataUpdate(!0)}},{key:"ccTO",value:function(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}},{key:"ccMIDROW",value:function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[r]}this.logger.log(2,"MIDROW: "+_JSON$stringify(t)),this.writeScreen.setPen(t)}},{key:"outputDataUpdate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}},{key:"cueSplitAtTime",value:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}]),e}(),Ms=function(){function e(t,r,n){_classCallCheck(this,e),this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;var a=this.logger=new Rs;this.channels=[null,new xs(t,r,a),new xs(t+1,n,a)]}return _createClass(e,[{key:"getHandler",value:function(e){return this.channels[e].getHandler()}},{key:"setHandler",value:function(e,t){this.channels[e].setHandler(t)}},{key:"addData",value:function(e,t){var r=this;this.logger.time=e;for(var n=function(e){var n=127&t[e],a=127&t[e+1],i=!1,s=null;if(0===n&&0===a)return"continue";r.logger.log(3,(function(){return"["+Os([t[e],t[e+1]])+"] -> ("+Os([n,a])+")"}));var o=r.cmdHistory;if(n>=16&&n<=31){if(Fs(n,a,o))return Ns(null,null,o),r.logger.log(3,(function(){return"Repeated command ("+Os([n,a])+") is dropped"})),"continue";Ns(n,a,r.cmdHistory),(i=r.parseCmd(n,a))||(i=r.parseMidrow(n,a)),i||(i=r.parsePAC(n,a)),i||(i=r.parseBackgroundAttributes(n,a))}else Ns(null,null,o);if(!i&&(s=r.parseChars(n,a))){var l=r.currentChannel;l&&l>0?r.channels[l].insertChars(s):r.logger.log(2,"No channel found yet. TEXT-MODE?")}i||s||r.logger.log(2,(function(){return"Couldn't parse cleaned data "+Os([n,a])+" orig: "+Os([t[e],t[e+1]])}))},a=0;a<t.length;a+=2)n(a)}},{key:"parseCmd",value:function(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;var r=20===e||21===e||23===e?1:2,n=this.channels[r];return 20===e||21===e||28===e||29===e?32===t?n.ccRCL():33===t?n.ccBS():34===t?n.ccAOF():35===t?n.ccAON():36===t?n.ccDER():37===t?n.ccRU(2):38===t?n.ccRU(3):39===t?n.ccRU(4):40===t?n.ccFON():41===t?n.ccRDC():42===t?n.ccTR():43===t?n.ccRTD():44===t?n.ccEDM():45===t?n.ccCR():46===t?n.ccENM():47===t&&n.ccEOC():n.ccTO(t-32),this.currentChannel=r,!0}},{key:"parseMidrow",value:function(e,t){var r=0;if((17===e||25===e)&&t>=32&&t<=47){if((r=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var n=this.channels[r];return!!n&&(n.ccMIDROW(t),this.logger.log(3,(function(){return"MIDROW ("+Os([e,t])+")"})),!0)}return!1}},{key:"parsePAC",value:function(e,t){var r;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;var n=e<=23?1:2;r=t>=64&&t<=95?1===n?Ts[e]:bs[e]:1===n?Ps[e]:ks[e];var a=this.channels[n];return!!a&&(a.setPAC(this.interpretPAC(r,t)),this.currentChannel=n,!0)}},{key:"interpretPAC",value:function(e,t){var r,n={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,n.underline=1==(1&r),r<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((r-16)/2),n}},{key:"parseChars",value:function(e,t){var r,n,a=null,i=null;return e>=25?(r=2,i=e-8):(r=1,i=e),i>=17&&i<=19?(n=17===i?t+80:18===i?t+112:t+144,this.logger.log(2,(function(){return"Special char '"+Is(n)+"' in channel "+r})),a=[n]):e>=32&&e<=127&&(a=0===t?[e]:[e,t]),a&&this.logger.log(3,(function(){return"Char codes = "+Os(a).join(",")})),a}},{key:"parseBackgroundAttributes",value:function(e,t){if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var r,n={};16===e||24===e?(r=Math.floor((t-32)/2),n.background=As[r],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0));var a=e<=23?1:2;return this.channels[a].setBkgData(n),!0}},{key:"reset",value:function(){for(var e=0;e<_Object$keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}Ns(null,null,this.cmdHistory)}},{key:"cueSplitAtTime",value:function(e){for(var t=0;t<this.channels.length;t++){var r=this.channels[t];r&&r.cueSplitAtTime(e)}}}]),e}();function Ns(e,t,r){r.a=e,r.b=t}function Fs(e,t,r){return r.a===e&&r.b===t}var Us=function(){if(null!=Or&&Or.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function r(e,t){if("string"!=typeof t)return!1;if(!_Array$isArray(e))return!1;var r=t.toLowerCase();return!!~_indexOfInstanceProperty(e).call(e,r)&&r}function n(e){return r(t,e)}function a(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var a=1;a<arguments.length;a++){var i=arguments[a];for(var s in i)e[s]=i[s]}return e}function i(t,i,s){var o=this,l={enumerable:!0};o.hasBeenReset=!1;var c="",u=!1,h=t,d=i,f=s,p=null,y="",g=!0,v="auto",m="start",$=50,S="middle",I=50,_="middle";_Object$defineProperty(o,"id",a({},l,{get:function(){return c},set:function(e){c=""+e}})),_Object$defineProperty(o,"pauseOnExit",a({},l,{get:function(){return u},set:function(e){u=!!e}})),_Object$defineProperty(o,"startTime",a({},l,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");h=e,this.hasBeenReset=!0}})),_Object$defineProperty(o,"endTime",a({},l,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");d=e,this.hasBeenReset=!0}})),_Object$defineProperty(o,"text",a({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),_Object$defineProperty(o,"region",a({},l,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),_Object$defineProperty(o,"vertical",a({},l,{get:function(){return y},set:function(t){var n=r(e,t);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");y=n,this.hasBeenReset=!0}})),_Object$defineProperty(o,"snapToLines",a({},l,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),_Object$defineProperty(o,"line",a({},l,{get:function(){return v},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");v=e,this.hasBeenReset=!0}})),_Object$defineProperty(o,"lineAlign",a({},l,{get:function(){return m},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");m=t,this.hasBeenReset=!0}})),_Object$defineProperty(o,"position",a({},l,{get:function(){return $},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");$=e,this.hasBeenReset=!0}})),_Object$defineProperty(o,"positionAlign",a({},l,{get:function(){return S},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),_Object$defineProperty(o,"size",a({},l,{get:function(){return I},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");I=e,this.hasBeenReset=!0}})),_Object$defineProperty(o,"align",a({},l,{get:function(){return _},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");_=t,this.hasBeenReset=!0}})),o.displayState=void 0}return i.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},i}(),Bs=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"decode",value:function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}]),e}();function js(e){function t(e,t,r,n){return 3600*(0|e)+60*(0|t)+(0|r)+_parseFloat$1(n||0)}var r=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?_parseFloat$1(r[2])>59?t(r[2],r[3],0,r[4]):t(r[1],r[2],r[3],r[4]):null}var Gs=function(){function e(){_classCallCheck(this,e),this.values=_Object$create(null)}return _createClass(e,[{key:"set",value:function(e,t){this.get(e)||""===t||(_valuesInstanceProperty(this)[e]=t)}},{key:"get",value:function(e,t,r){return r?this.has(e)?_valuesInstanceProperty(this)[e]:t[r]:this.has(e)?_valuesInstanceProperty(this)[e]:t}},{key:"has",value:function(e){return e in _valuesInstanceProperty(this)}},{key:"alt",value:function(e,t,r){for(var n=0;n<r.length;++n)if(t===r[n]){this.set(e,t);break}}},{key:"integer",value:function(e,t){/^-?\d+$/.test(t)&&this.set(e,_parseInt$1(t,10))}},{key:"percent",value:function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var r=_parseFloat$1(t);if(r>=0&&r<=100)return this.set(e,r),!0}return!1}}]),e}();function Ks(e,t,r,n){var a=n?e.split(n):[e];for(var i in a)if("string"==typeof a[i]){var s=a[i].split(r);2===s.length&&t(s[0],s[1])}}var Hs=new Us(0,0,""),Vs="middle"===Hs.align?"middle":"center";function Ws(e,t,r){var n=e;function a(){var t=js(e);if(null===t)throw new Error("Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function i(){e=e.replace(/^\s+/,"")}if(i(),t.startTime=a(),i(),"--\x3e"!==_sliceInstanceProperty(e).call(e,0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=_sliceInstanceProperty(e).call(e,3),i(),t.endTime=a(),i(),function(e,t){var n=new Gs;Ks(e,(function(e,t){var a;switch(e){case"region":for(var i=r.length-1;i>=0;i--)if(r[i].id===t){n.set(e,r[i].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":a=t.split(","),n.integer(e,a[0]),n.percent(e,a[0])&&n.set("snapToLines",!1),n.alt(e,a[0],["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start",Vs,"end"]);break;case"position":a=t.split(","),n.percent(e,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start",Vs,"end","line-left","line-right","auto"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start",Vs,"end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");var a=n.get("line","auto");"auto"===a&&-1===Hs.line&&(a=-1),t.line=a,t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align",Vs);var i=n.get("position","auto");"auto"===i&&50===Hs.position&&(i="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=i}(e,t)}function Ys(e){return e.replace(/<br(?: \/)?>/gi,"\n")}var qs=function(){function e(){_classCallCheck(this,e),this.state="INITIAL",this.buffer="",this.decoder=new Bs,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}return _createClass(e,[{key:"parse",value:function(e){var t=this;function r(){var e=t.buffer,r=0;for(e=Ys(e);r<e.length&&"\r"!==e[r]&&"\n"!==e[r];)++r;var n=_sliceInstanceProperty(e).call(e,0,r);return"\r"===e[r]&&++r,"\n"===e[r]&&++r,t.buffer=_sliceInstanceProperty(e).call(e,r),n}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var n="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(n=r()).match(/^()?WEBVTT([ \t].*)?$/);if(null==a||!a[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var i=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(i?i=!1:n=r(),t.state){case"HEADER":/:/.test(n)?Ks(n,(function(e,t){}),/:/):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new Us(0,0,""),t.state="CUE",-1===_indexOfInstanceProperty(n).call(n,"--\x3e")){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Ws(n,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var s=-1!==_indexOfInstanceProperty(n).call(n,"--\x3e");if(!n||s&&(i=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=n;continue;case"BADCUE":n||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this}},{key:"flush",value:function(){var e=this;try{if((e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state||"BADWEBVTT"===e.state)throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}]),e}(),zs=/\r\n|\n\r|\n|\r/g,Xs=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return _sliceInstanceProperty(e).call(e,r,r+t.length)===t};function Qs(e,t,r){return ss(e.toString())+ss(t.toString())+ss(r)}function Js(e,t,r,n,a,i,s){var o,l,c=new qs,u=_trimInstanceProperty(o=yt(new Uint8Array(e))).call(o).replace(zs,"\n").split("\n"),h=[],d=t?function(e){return Ya(e,9e4,1/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1))}(t.baseTime,t.timescale):0,f="00:00.000",p=0,y=0,g=!0;c.oncue=function(e){var i,s=r[n],o=r.ccOffset,c=(p-d)/9e4;if(null!=s&&s.new&&(void 0!==y?o=r.ccOffset=s.start:function(e,t,r){var n=e[t],a=e[n.prevCC];if(!a||!a.new&&n.new)return e.ccOffset=e.presentationOffset=n.start,void(n.new=!1);for(;null!=(i=a)&&i.new;){var i;e.ccOffset+=n.start-a.start,n.new=!1,a=e[(n=a).prevCC]}e.presentationOffset=r}(r,n,c)),c){if(!t)return void(l=new Error("Missing initPTS for VTT MPEGTS"));o=c-r.presentationOffset}var u=e.endTime-e.startTime,f=Za(9e4*(e.startTime+o-y),9e4*a)/9e4;e.startTime=Math.max(f,0),e.endTime=Math.max(f+u,0);var g=_trimInstanceProperty(i=e.text).call(i);e.text=decodeURIComponent(encodeURIComponent(g)),e.id||(e.id=Qs(e.startTime,e.endTime,g)),e.endTime>0&&h.push(e)},c.onparsingerror=function(e){l=e},c.onflush=function(){l?s(l):i(h)},_forEachInstanceProperty(u).call(u,(function(e){if(g){if(Xs(e,"X-TIMESTAMP-MAP=")){var t;g=!1,_forEachInstanceProperty(t=_sliceInstanceProperty(e).call(e,16).split(",")).call(t,(function(e){Xs(e,"LOCAL:")?f=_sliceInstanceProperty(e).call(e,6):Xs(e,"MPEGTS:")&&(p=_parseInt$1(_sliceInstanceProperty(e).call(e,7)))}));try{y=function(e){var t=_parseInt$1(_sliceInstanceProperty(e).call(e,-3)),r=_parseInt$1(_sliceInstanceProperty(e).call(e,-6,-4)),n=_parseInt$1(_sliceInstanceProperty(e).call(e,-9,-7)),a=e.length>9?_parseInt$1(e.substring(0,_indexOfInstanceProperty(e).call(e,":"))):0;if(!(O(t)&&O(r)&&O(n)&&O(a)))throw Error("Malformed X-TIMESTAMP-MAP: Local:".concat(e));return t+=1e3*r,t+=6e4*n,t+=36e5*a}(f)/1e3}catch(e){l=e}return}""===e&&(g=!1)}c.parse(e+"\n")})),c.flush()}var Zs="stpp.ttml.im1t",eo=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,to=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,ro={left:"start",center:"center",right:"end",start:"start",end:"end"};function no(e,t,r,n){var a=Gt(new Uint8Array(e),["mdat"]);if(0!==a.length){var i=_mapInstanceProperty(a).call(a,(function(e){return yt(e)})),s=function(e,t){return Ya(e,t,1/(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1),arguments.length>3&&void 0!==arguments[3]&&arguments[3])}(t.baseTime,1,t.timescale);try{_forEachInstanceProperty(i).call(i,(function(e){return r(function(e,t,r,n){var a=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!a)throw new Error("Invalid ttml");var i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=_reduceInstanceProperty(r=_Object$keys(i)).call(r,(function(e,t){return e[t]=a.getAttribute("ttp:".concat(t))||i[t],e}),{}),o="preserve"!==a.getAttribute("xml:space"),l=io(ao(a,"styling","style")),c=io(ao(a,"layout","region")),u=ao(a,"body","[begin]");return _filterInstanceProperty(n=_mapInstanceProperty([]).call(u,(function(e){var r=so(e,o);if(!r||!e.hasAttribute("begin"))return null;var n=co(e.getAttribute("begin"),s),a=co(e.getAttribute("dur"),s),i=co(e.getAttribute("end"),s);if(null===n)throw lo(e);if(null===i){if(null===a)throw lo(e);i=n+a}var u=new Us(n-t,i-t,r);u.id=Qs(u.startTime,u.endTime,u.text);var h,d,f,p,y,g,v,m=(h=c[e.getAttribute("region")],d=l[e.getAttribute("style")],f=l,p="http://www.w3.org/ns/ttml#styling",y=null,g=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],(v=null!=h&&h.hasAttribute("style")?h.getAttribute("style"):null)&&f.hasOwnProperty(v)&&(y=f[v]),_reduceInstanceProperty(g).call(g,(function(e,t){var r=oo(d,p,t)||oo(h,p,t)||oo(y,p,t);return r&&(e[t]=r),e}),{})),$=m.textAlign;if($){var S=ro[$];S&&(u.lineAlign=S),u.align=$}return W(u,m),u}))).call(n,(function(e){return null!==e}))}(e,s))}))}catch(e){n(e)}}else n(new Error("Could not parse IMSC1 mdat"))}function ao(e,t,r){var n=e.getElementsByTagName(t)[0];return n?_sliceInstanceProperty([]).call(n.querySelectorAll(r)):[]}function io(e){return _reduceInstanceProperty(e).call(e,(function(e,t){var r=t.getAttribute("xml:id");return r&&(e[r]=t),e}),{})}function so(e,t){var r;return _reduceInstanceProperty(r=_sliceInstanceProperty([]).call(e.childNodes)).call(r,(function(e,r,n){var a,i;return"br"===r.nodeName&&n?e+"\n":null!=(i=r.childNodes)&&i.length?so(r,t):t?e+_trimInstanceProperty(a=r.textContent).call(a).replace(/\s+/g," "):e+r.textContent}),"")}function oo(e,t,r){return e&&e.hasAttributeNS(t,r)?e.getAttributeNS(t,r):null}function lo(e){return new Error("Could not parse ttml timestamp ".concat(e))}function co(e,t){if(!e)return null;var r,n,a,i,s=js(e);return null===s&&(eo.test(e)?(r=e,n=t,a=eo.exec(r),i=(0|a[4])+(0|a[5])/n.subFrameRate,s=3600*(0|a[1])+60*(0|a[2])+(0|a[3])+i/n.frameRate):to.test(e)&&(s=function(e,t){var r=to.exec(e),n=Number(r[1]);switch(r[2]){case"h":return 3600*n;case"m":return 60*n;case"ms":return 1e3*n;case"f":return n/t.frameRate;case"t":return n/t.tickRate}return n}(e,t))),s}var uo=function(){function e(t,r){_classCallCheck(this,e),this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=r}return _createClass(e,[{key:"dispatchCue",value:function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}},{key:"newCue",value:function(e,t,r){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}},{key:"reset",value:function(){this.cueRanges=[],this.startTime=null}}]),e}();function ho(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function fo(e,t){return!!e&&e.kind===ho(t)&&yi(t,e)}var po=/\s/,yo={newCue:function(e,t,r,n){for(var a,i,s,o,l,c=[],u=self.VTTCue||self.TextTrackCue,h=0;h<n.rows.length;h++)if(s=!0,o=0,l="",!(a=n.rows[h]).isEmpty()){for(var d,f=0;f<a.chars.length;f++)po.test(a.chars[f].uchar)&&s?o++:(l+=a.chars[f].uchar,s=!1);a.cueStartTime=t,t===r&&(r+=1e-4),o>=16?o--:o++;var p=Ys(_trimInstanceProperty(l).call(l)),y=Qs(t,r,p);null!=e&&null!=(d=e.cues)&&d.getCueById(y)||((i=new u(t,r,p)).id=y,i.line=h+1,i.align="left",i.position=10+Math.min(80,10*Math.floor(8*o/32)),c.push(i))}return e&&c.length&&(_sortInstanceProperty(c).call(c,(function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line})),_forEachInstanceProperty(c).call(c,(function(t){return rs(e,t)}))),c}},go=/(\d+)-(\d+)\/(\d+)/,vo=function(){function e(t){_classCallCheck(this,e),this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=t.fetchSetup||mo,this.controller=new self.AbortController,this.stats=new Pt}return _createClass(e,[{key:"destroy",value:function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}},{key:"abortInternal",value:function(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}},{key:"abort",value:function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}},{key:"load",value:function(e,t,r){var n=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var i,s,o,l=(i=e,s=this.controller.signal,o={method:"GET",mode:"cors",credentials:"same-origin",signal:s,headers:new self.Headers(W({},i.headers))},i.rangeEnd&&o.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),o),c=r.onProgress,u="arraybuffer"===e.responseType,h=u?"byteLength":"length",d=t.loadPolicy,f=d.maxTimeToFirstByteMs,p=d.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,l),self.clearTimeout(this.requestTimeout),t.timeout=f&&O(f)?f:p,this.requestTimeout=_setTimeout((function(){n.abortInternal(),r.onTimeout(a,e,n.response)}),t.timeout),(li(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then((function(i){n.response=n.loader=i;var s=Math.max(self.performance.now(),a.loading.start);if(self.clearTimeout(n.requestTimeout),t.timeout=p,n.requestTimeout=_setTimeout((function(){n.abortInternal(),r.onTimeout(a,e,n.response)}),p-(s-a.loading.start)),!i.ok){var o=i.status,l=i.statusText;throw new $o(l||"fetch, bad network response",o,i)}return a.loading.first=s,a.total=function(e){var t=e.get("Content-Range");if(t){var r=function(e){var t=go.exec(e);if(t)return _parseInt$1(t[2])-_parseInt$1(t[1])+1}(t);if(O(r))return r}var n=e.get("Content-Length");if(n)return _parseInt$1(n)}(i.headers)||a.total,c&&O(t.highWaterMark)?n.loadProgressively(i,a,e,t.highWaterMark,c):u?i.arrayBuffer():"json"===e.responseType?i.json():i.text()})).then((function(i){var s=n.response;if(!s)throw new Error("loader destroyed");self.clearTimeout(n.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first);var o=i[h];o&&(a.loaded=a.total=o);var l={url:s.url,data:i,code:s.status};c&&!O(t.highWaterMark)&&c(a,e,i,s),r.onSuccess(l,a,e,s)})).catch((function(t){if(self.clearTimeout(n.requestTimeout),!a.aborted){var i=t&&t.code||0,s=t?t.message:null;r.onError({code:i,text:s},e,t?t.details:null,a)}}))}},{key:"getCacheAge",value:function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?_parseFloat$1(t):null}return e}},{key:"getResponseHeader",value:function(e){return this.response?this.response.headers.get(e):null}},{key:"loadProgressively",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4?arguments[4]:void 0,i=new Un,s=e.body.getReader();return function o(){return s.read().then((function(s){if(s.done)return i.dataLength&&a(t,r,i.flush().buffer,e),_Promise.resolve(new ArrayBuffer(0));var l=s.value,c=l.length;return t.loaded+=c,c<n||i.dataLength?(i.push(l),i.dataLength>=n&&a(t,r,i.flush().buffer,e)):a(t,r,l.buffer,e),o()})).catch((function(){return _Promise.reject()}))}()}}]),e}();function mo(e,t){return new self.Request(e.url,t)}var $o=function(e){_inherits(r,_wrapNativeSuper(Error));var t=_createSuper(r);function r(e,n,a){var i;return _classCallCheck(this,r),(i=t.call(this,e)).code=void 0,i.details=void 0,i.code=n,i.details=a,i}return _createClass(r)}(),So=/^age:\s*[\d.]+\s*$/im,Io=function(){function e(t){_classCallCheck(this,e),this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=t&&t.xhrSetup||null,this.stats=new Pt,this.retryDelay=0}return _createClass(e,[{key:"destroy",value:function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}},{key:"abortInternal",value:function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}},{key:"abort",value:function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}},{key:"load",value:function(e,t,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.loadInternal()}},{key:"loadInternal",value:function(){var e=this,t=this.config,r=this.context;if(t&&r){var n=this.loader=new self.XMLHttpRequest,a=this.stats;a.loading.first=0,a.loaded=0,a.aborted=!1;var i=this.xhrSetup;i?_Promise.resolve().then((function(){if(e.loader===n&&!e.stats.aborted)return i(n,r.url)})).catch((function(t){if(e.loader===n&&!e.stats.aborted)return n.open("GET",r.url,!0),i(n,r.url)})).then((function(){e.loader!==n||e.stats.aborted||e.openAndSendXhr(n,r,t)})).catch((function(t){e.callbacks.onError({code:n.status,text:t.message},r,n,a)})):this.openAndSendXhr(n,r,t)}}},{key:"openAndSendXhr",value:function(e,t,r){var n,a,i;e.readyState||e.open("GET",t.url,!0);var s=t.headers,o=r.loadPolicy,l=o.maxTimeToFirstByteMs,c=o.maxLoadTimeMs;if(s)for(var u in s)e.setRequestHeader(u,s[u]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=_bindInstanceProperty(n=this.readystatechange).call(n,this),e.onprogress=_bindInstanceProperty(a=this.loadprogress).call(a,this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),r.timeout=l&&O(l)?l:c,this.requestTimeout=_setTimeout(_bindInstanceProperty(i=this.loadtimeout).call(i,this),r.timeout),e.send()}},{key:"readystatechange",value:function(){var e,t=this.context,r=this.loader,n=this.stats;if(t&&r){var a=r.readyState,i=this.config;if(!n.aborted&&a>=2&&(0===n.loading.first&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=_setTimeout(_bindInstanceProperty(e=this.loadtimeout).call(e,this),i.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),4===a)){var s;self.clearTimeout(this.requestTimeout),r.onreadystatechange=null,r.onprogress=null;var o=r.status,l="text"===r.responseType?r.responseText:null;if(o>=200&&o<300){var c=null!=l?l:r.response;if(null!=c){n.loading.end=Math.max(self.performance.now(),n.loading.first);var u="arraybuffer"===r.responseType?c.byteLength:c.length;if(n.loaded=n.total=u,n.bwEstimate=8e3*n.total/(n.loading.end-n.loading.first),!this.callbacks)return;var h=this.callbacks.onProgress;if(h&&h(n,t,c,r),!this.callbacks)return;var d={url:r.responseURL,data:c,code:o};return void this.callbacks.onSuccess(d,n,t,r)}}var f=i.loadPolicy.errorRetry;Ye(f,n.retry,!1,{url:t.url,data:void 0,code:o})?this.retry(f):(te.error(_concatInstanceProperty(s="".concat(o," while loading ")).call(s,t.url)),this.callbacks.onError({code:o,text:r.statusText},t,r,n))}}}},{key:"loadtimeout",value:function(){if(this.config){var e=this.config.loadPolicy.timeoutRetry;if(Ye(e,this.stats.retry,!0))this.retry(e);else{var t;te.warn("timeout while loading ".concat(null==(t=this.context)?void 0:t.url));var r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}}},{key:"retry",value:function(e){var t,r,n,a,i,s=this.context,o=this.stats;this.retryDelay=Ve(e,o.retry),o.retry++,te.warn(_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a="".concat(status?"HTTP Status "+status:"Timeout"," while loading ")).call(a,null==s?void 0:s.url,", retrying ")).call(n,o.retry,"/")).call(r,e.maxNumRetry," in ")).call(t,this.retryDelay,"ms")),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=_setTimeout(_bindInstanceProperty(i=this.loadInternal).call(i,this),this.retryDelay)}},{key:"loadprogress",value:function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}},{key:"getCacheAge",value:function(){var e=null;if(this.loader&&So.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?_parseFloat$1(t):null}return e}},{key:"getResponseHeader",value:function(e){return this.loader&&new RegExp("^".concat(e,":\\s*[\\d.]+\\s*$"),"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}]),e}(),_o=q(q({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Io,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:function(e){_inherits(r,e);var t=_createSuper(r);function r(e){var n;return _classCallCheck(this,r),(n=t.call(this,"abr",e.logger)).hls=void 0,n.lastLevelLoadSec=0,n.lastLoadedFragLevel=-1,n.firstSelection=-1,n._nextAutoLevel=-1,n.nextAutoLevelKey="",n.audioTracksByGroup=null,n.codecTiers=null,n.timer=-1,n.fragCurrent=null,n.partCurrent=null,n.bitrateTestDelay=0,n.bwEstimator=void 0,n._abandonRulesCheck=function(){var e,t,r,a,i,s,o,l,c,u,h,d,f=_assertThisInitialized(n),p=f.fragCurrent,y=f.partCurrent,g=f.hls,v=g.autoLevelEnabled,m=g.media;if(p&&m){var $=performance.now(),S=y?y.stats:p.stats,I=y?y.duration:p.duration,_=$-S.loading.start,E=g.minAutoLevel;if(S.aborted||S.loaded&&S.loaded===S.total||p.level<=E)return n.clearTimer(),void(n._nextAutoLevel=-1);if(v&&!m.paused&&m.playbackRate&&m.readyState){var T=g.mainForwardBufferInfo;if(null!==T){var P=n.bwEstimator.getEstimateTTFB(),b=Math.abs(m.playbackRate);if(!(_<=Math.max(P,I/(2*b)*1e3))){var k=T.len/b,A=S.loading.first?S.loading.first-S.loading.start:-1,R=S.loaded&&A>-1,L=n.getBwEstimate(),C=g.levels,D=C[p.level],w=Math.max(S.loaded,Math.round(I*(p.bitrate||D.averageBitrate)/8)),M=R?_-A:_;M<1&&R&&(M=Math.min(_,8*S.loaded/L));var N=R?1e3*S.loaded/M:0,F=P/1e3,U=N?(w-S.loaded)/N:8*w/L+F;if(!(U<=k)){var B,j=N?8*N:L,G=!0===(null==(d=n.hls.latestLevelDetails)?void 0:d.live),K=n.hls.config.abrBandWidthUpFactor,H=Number.POSITIVE_INFINITY;for(B=p.level-1;B>E;B--){var V=C[B].maxBitrate,W=!C[B].details||G;if((H=n.getTimeToLoadFrag(F,j,I*V,W))<Math.min(k,I+F))break}if(!(H>=U||H>10*I)){R?n.bwEstimator.sample(_-Math.min(P,A),S.loaded):n.bwEstimator.sampleTTFB(_);var Y=C[B].maxBitrate;n.getBwEstimate()*K>Y&&n.resetEstimator(Y);var q=n.findBestLevel(Y,E,B,0,k,1,1);q>-1&&(B=q),n.warn(_concatInstanceProperty(e=_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o=_concatInstanceProperty(l=_concatInstanceProperty(c=_concatInstanceProperty(u=_concatInstanceProperty(h="Fragment ".concat(p.sn)).call(h,y?" part "+y.index:""," of level ")).call(u,p.level," is loading too slowly;\n Fragment duration: ")).call(c,p.duration.toFixed(3),"\n Time to underbuffer: ")).call(l,k.toFixed(3)," s\n Estimated load time for current fragment: ")).call(o,U.toFixed(3)," s\n Estimated load time for down switch fragment: ")).call(s,H.toFixed(3)," s\n TTFB estimate: ")).call(i,0|A," ms\n Current BW estimate: ")).call(a,O(L)?0|L:"Unknown"," bps\n New BW estimate: ")).call(r,0|n.getBwEstimate()," bps\n Switching to level ")).call(t,B," @ ")).call(e,0|Y," bps")),g.nextLoadLevel=g.nextAutoLevel=B,n.clearTimer(),n.timer=_setInterval((function(){if(n.clearTimer(),n.fragCurrent===p&&n.hls.loadLevel===B&&B>0){var e,t,r=n.getStarvationDelay();if(n.warn(_concatInstanceProperty(e=_concatInstanceProperty(t="Aborting inflight request ".concat(B>0?"and switching down":"","\n Fragment duration: ")).call(t,p.duration.toFixed(3)," s\n Time to underbuffer: ")).call(e,r.toFixed(3)," s")),p.abortRequests(),n.fragCurrent=n.partCurrent=null,B>E){var a=n.findBestLevel(n.hls.levels[E].bitrate,E,B,0,r,1,1);-1===a&&(a=E),n.hls.nextLoadLevel=n.hls.nextAutoLevel=a,n.resetEstimator(n.hls.levels[a].bitrate)}}}),1e3*H),g.trigger(x.FRAG_LOAD_EMERGENCY_ABORTED,{frag:p,part:y,stats:S})}}}}}}},n.hls=e,n.bwEstimator=n.initEstimator(),n.registerListeners(),n}return _createClass(r,[{key:"resetEstimator",value:function(e){e&&(this.log("setting initial bwe to ".concat(e)),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}},{key:"initEstimator",value:function(){var e=this.hls.config;return new H(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}},{key:"registerListeners",value:function(){var e=this.hls;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.FRAG_LOADING,this.onFragLoading,this),e.on(x.FRAG_LOADED,this.onFragLoaded,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this),e.on(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(x.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(x.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.FRAG_LOADING,this.onFragLoading,this),e.off(x.FRAG_LOADED,this.onFragLoaded,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this),e.off(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(x.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(x.ERROR,this.onError,this))}},{key:"destroy",value:function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}},{key:"onManifestLoading",value:function(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}},{key:"onLevelsUpdated",value:function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}},{key:"onMaxAutoLevelUpdated",value:function(){this.firstSelection=-1,this.nextAutoLevelKey=""}},{key:"onFragLoading",value:function(e,t){var r,n=t.frag;this.ignoreFragment(n)||(n.bitrateTest||(this.fragCurrent=n,this.partCurrent=null!=(r=t.part)?r:null),this.clearTimer(),this.timer=_setInterval(this._abandonRulesCheck,100))}},{key:"onLevelSwitching",value:function(e,t){this.clearTimer()}},{key:"onError",value:function(e,t){if(!t.fatal)switch(t.details){case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case w.FRAG_LOAD_TIMEOUT:var r=t.frag,n=this.fragCurrent,a=this.partCurrent;if(r&&n&&r.sn===n.sn&&r.level===n.level){var i=performance.now(),s=a?a.stats:r.stats,o=i-s.loading.start,l=s.loading.first?s.loading.first-s.loading.start:-1;if(s.loaded&&l>-1){var c=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(o-Math.min(c,l),s.loaded)}else this.bwEstimator.sampleTTFB(o)}}}},{key:"getTimeToLoadFrag",value:function(e,t,r,n){return e+r/t+(n?this.lastLevelLoadSec:0)}},{key:"onLevelLoaded",value:function(e,t){var r=this.hls.config,n=t.stats.loading,a=n.end-n.start;O(a)&&(this.lastLevelLoadSec=a/1e3),t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)}},{key:"onFragLoaded",value:function(e,t){var r=t.frag,n=t.part,a=n?n.stats:r.stats;if(r.type===B&&this.bwEstimator.sampleTTFB(a.loading.first-a.loading.start),!this.ignoreFragment(r)){if(this.clearTimer(),r.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var i=n?n.duration:r.duration,s=this.hls.levels[r.level],o=(s.loaded?s.loaded.bytes:0)+a.loaded,l=(s.loaded?s.loaded.duration:0)+i;s.loaded={bytes:o,duration:l},s.realBitrate=Math.round(8*o/l)}if(r.bitrateTest){var c={stats:a,frag:r,part:n,id:r.type};this.onFragBuffered(x.FRAG_BUFFERED,c),r.bitrateTest=!1}else this.lastLoadedFragLevel=r.level}}},{key:"onFragBuffered",value:function(e,t){var r=t.frag,n=t.part,a=null!=n&&n.stats.loaded?n.stats:r.stats;if(!a.aborted&&!this.ignoreFragment(r)){var i=a.parsing.end-a.loading.start-Math.min(a.loading.first-a.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(i,a.loaded),a.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0}}},{key:"ignoreFragment",value:function(e){return e.type!==B||"initSegment"===e.sn}},{key:"clearTimer",value:function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}},{key:"firstAutoLevel",get:function(){var e,t=this.hls,r=t.maxAutoLevel,n=t.minAutoLevel,a=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(a,n,r,0,i,1,1);if(s>-1)return s;var o=this.hls.firstLevel,l=Math.min(Math.max(o,n),r);return this.warn(_concatInstanceProperty(e="Could not find best starting auto level. Defaulting to first in playlist ".concat(o," clamped to ")).call(e,l)),l}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;var n=t&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){var a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n},set:function(e){var t=this.hls,r=t.maxAutoLevel,n=t.minAutoLevel,a=Math.min(Math.max(e,n),r);this._nextAutoLevel!==a&&(this.nextAutoLevelKey="",this._nextAutoLevel=a)}},{key:"getAutoLevelKey",value:function(){var e;return _concatInstanceProperty(e="".concat(this.getBwEstimate(),"_")).call(e,this.getStarvationDelay().toFixed(2))}},{key:"getNextABRAutoLevel",value:function(){var e,t=this.fragCurrent,r=this.partCurrent,n=this.hls;if(n.levels.length<=1)return n.loadLevel;var a=n.maxAutoLevel,i=n.config,s=n.minAutoLevel,o=r?r.duration:t?t.duration:0,l=this.getBwEstimate(),c=this.getStarvationDelay(),u=i.abrBandWidthFactor,h=i.abrBandWidthUpFactor;if(c){var d=this.findBestLevel(l,s,a,c,0,u,h);if(d>=0)return d}var f=o?Math.min(o,i.maxStarvationDelay):i.maxStarvationDelay;if(!c){var p,y=this.bitrateTestDelay;y&&(f=(o?Math.min(o,i.maxLoadingDelay):i.maxLoadingDelay)-y,this.info(_concatInstanceProperty(p="bitrate test took ".concat(Math.round(1e3*y),"ms, set first fragment max fetchDuration to ")).call(p,Math.round(1e3*f)," ms")),u=h=1)}var g=this.findBestLevel(l,s,a,c,f,u,h);if(this.info(_concatInstanceProperty(e="".concat(c?"rebuffering expected":"buffer is empty",", optimal quality level ")).call(e,g)),g>-1)return g;var v=n.levels[s],m=n.levels[n.loadLevel];return(null==v?void 0:v.bitrate)<(null==m?void 0:m.bitrate)?s:n.loadLevel}},{key:"getStarvationDelay",value:function(){var e=this.hls,t=e.media;if(!t)return 1/0;var r=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/r}},{key:"getBwEstimate",value:function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}},{key:"findBestLevel",value:function(e,t,r,n,a,i,s){var o,l=this,c=n+a,u=this.lastLoadedFragLevel,h=-1===u?this.hls.firstLevel:u,d=this.fragCurrent,f=this.partCurrent,p=this.hls,y=p.levels,g=p.allAudioTracks,v=p.loadLevel,m=p.config;if(1===y.length)return 0;var $,S,I,_,E,T,P=y[h],b=!(null==(o=this.hls.latestLevelDetails)||!o.live),k=-1===v||-1===u,A="SDR",R=(null==P?void 0:P.frameRate)||0,L=m.audioPreference,C=m.videoPreference,D=this.audioTracksByGroup||(this.audioTracksByGroup=Le(g)),w=-1;if(k){if(-1!==this.firstSelection)return this.firstSelection;var x=function(e,t,r,n,a){for(var i=_Object$keys(e),s=null==n?void 0:n.channels,o=null==n?void 0:n.audioCodec,l=null==a?void 0:a.videoCodec,c=s&&2===_parseInt$1(s),u=!1,h=!1,d=1/0,f=1/0,p=1/0,y=1/0,g=0,v=[],m=Re(t,a),$=m.preferHDR,S=m.allowedVideoRanges,I=function(){var t=e[i[_]];u||(u=t.channels[2]>0),d=Math.min(d,t.minHeight),f=Math.min(f,t.minFramerate),p=Math.min(p,t.minBitrate),_filterInstanceProperty(S).call(S,(function(e){return t.videoRanges[e]>0})).length>0&&(h=!0)},_=i.length;_--;)I();d=O(d)?d:0,f=O(f)?f:0;var E=Math.max(1080,d),T=Math.max(30,f);p=O(p)?p:r,r=Math.max(p,r),h||(t=void 0);var P=i.length>1;return{codecSet:_reduceInstanceProperty(i).call(i,(function(t,n){var a=e[n];if(n===t)return t;if(v=h?_filterInstanceProperty(S).call(S,(function(e){return a.videoRanges[e]>0})):[],P){var i,d,f,p,m;if(a.minBitrate>r)return Oe(n,_concatInstanceProperty(i="min bitrate of ".concat(a.minBitrate," > current estimate of ")).call(i,r)),t;if(!a.hasDefaultAudio)return Oe(n,"no renditions with default or auto-select sound found"),t;if(o&&_indexOfInstanceProperty(n).call(n,o.substring(0,4))%5!=0)return Oe(n,'audio codec preference "'.concat(o,'" not found')),t;if(s&&!c){if(!a.channels[s])return Oe(n,_concatInstanceProperty(m="no renditions with ".concat(s," channel sound found (channels options: ")).call(m,_Object$keys(a.channels),")")),t}else if((!o||c)&&u&&0===a.channels[2])return Oe(n,"no renditions with stereo sound found"),t;if(a.minHeight>E)return Oe(n,_concatInstanceProperty(d="min resolution of ".concat(a.minHeight," > maximum of ")).call(d,E)),t;if(a.minFramerate>T)return Oe(n,_concatInstanceProperty(f="min framerate of ".concat(a.minFramerate," > maximum of ")).call(f,T)),t;if(!_someInstanceProperty(v).call(v,(function(e){return a.videoRanges[e]>0})))return Oe(n,"no variants with VIDEO-RANGE of ".concat(_JSON$stringify(v)," found")),t;if(l&&_indexOfInstanceProperty(n).call(n,l.substring(0,4))%5!=0)return Oe(n,'video codec preference "'.concat(l,'" not found')),t;if(a.maxScore<g)return Oe(n,_concatInstanceProperty(p="max score of ".concat(a.maxScore," < selected max of ")).call(p,g)),t}return t&&(ce(n)>=ce(t)||a.fragmentError>e[t].fragmentError)?t:(y=a.minIndex,g=a.maxScore,n)}),void 0),videoRanges:v,preferHDR:$,minFramerate:f,minBitrate:p,minIndex:y}}(this.codecTiers||(this.codecTiers=(I=D,_=t,E=r,_reduceInstanceProperty(T=_sliceInstanceProperty(S=y).call(S,_,E+1)).call(T,(function(e,t,r){if(!t.codecSet)return e;var n=t.audioGroups,a=e[t.codecSet];a||(e[t.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!n,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,t.bitrate);var i=Math.min(t.height,t.width);return a.minHeight=Math.min(a.minHeight,i),a.minFramerate=Math.min(a.minFramerate,t.frameRate),a.minIndex=Math.min(a.minIndex,r),a.maxScore=Math.max(a.maxScore,t.score),a.fragmentError+=t.fragmentError,a.videoRanges[t.videoRange]=(a.videoRanges[t.videoRange]||0)+1,n&&_forEachInstanceProperty(n).call(n,(function(e){var t;if(e){var r=I.groups[e];r&&(a.hasDefaultAudio=a.hasDefaultAudio||I.hasDefaultAudio?r.hasDefault:r.hasAutoSelect||!I.hasDefaultAudio&&!I.hasAutoSelectAudio,_forEachInstanceProperty(t=_Object$keys(r.channels)).call(t,(function(e){a.channels[e]=(a.channels[e]||0)+r.channels[e]})))}})),e}),{}))),A,e,L,C),M=x.codecSet,N=x.videoRanges,F=x.minFramerate,U=x.minBitrate,B=x.minIndex,j=x.preferHDR;w=B,$=M,A=j?N[N.length-1]:N[0],R=F,e=Math.max(e,U),this.log("picked start tier ".concat(_JSON$stringify(x)))}else $=null==P?void 0:P.codecSet,A=null==P?void 0:P.videoRange;for(var G=f?f.duration:d?d.duration:0,K=this.bwEstimator.getEstimateTTFB()/1e3,H=[],V=function(){var t=y[W],o=W>h;if(!t)return"continue";if(m.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){var d=navigator.mediaCapabilities;"function"!=typeof(null==d?void 0:d.decodingInfo)||!me(t,D,A,R,e,L)&&"hvc1"!==(null==(q=t.videoCodec)?void 0:q.substring(0,4))?t.supportedResult=ge:(t.supportedPromise=$e(t,D,d),t.supportedPromise.then((function(e){var r,n,a;if(l.hls){t.supportedResult=e;var i=l.hls.levels,s=_indexOfInstanceProperty(i).call(i,t);e.error?l.warn(_concatInstanceProperty(r=_concatInstanceProperty(n='MediaCapabilities decodingInfo error: "'.concat(e.error,'" for level ')).call(n,s," ")).call(r,_JSON$stringify(e))):e.supported||(l.warn(_concatInstanceProperty(a="Unsupported MediaCapabilities decodingInfo result for level ".concat(s," ")).call(a,_JSON$stringify(e))),s>-1&&i.length>1&&(l.log("Removing unsupported level ".concat(s)),l.hls.removeLevel(s),-1===l.hls.loadLevel&&(l.hls.nextLoadLevel=0)))}})))}if(($&&t.codecSet!==$||A&&t.videoRange!==A||o&&R>t.frameRate||!o&&R>0&&R<t.frameRate||t.supportedResult&&(null==(Y=t.supportedResult.decodingInfoResults)||!Y[0].smooth))&&(!k||W!==w))return H.push(W),"continue";var p,g=t.details,S=(f?null==g?void 0:g.partTarget:null==g?void 0:g.averagetargetduration)||G;p=o?s*e:i*e;var I=G&&n>=2*G&&0===a?t.averageBitrate:t.maxBitrate,_=l.getTimeToLoadFrag(K,p,I*S,void 0===g);if(p>=I&&(W===u||0===t.loadError&&0===t.fragmentError)&&(_<=K||!O(_)||b&&!l.bitrateTestDelay||_<c)){var E,T,P,C,x,M,N,F,U,B,j,V,z,X,Q,J,Z=l.forcedAutoLevel;return{v:(W===v||-1!==Z&&Z===v||(H.length&&l.trace(_concatInstanceProperty(E=_concatInstanceProperty(T=_concatInstanceProperty(P=_concatInstanceProperty(C=_concatInstanceProperty(x="Skipped level(s) ".concat(H.join(",")," of ")).call(x,r,' max with CODECS and VIDEO-RANGE:"')).call(C,y[H[0]].codecs,'" ')).call(P,y[H[0]].videoRange,'; not compatible with "')).call(T,$,'" ')).call(E,A)),l.info(_concatInstanceProperty(M=_concatInstanceProperty(N=_concatInstanceProperty(F=_concatInstanceProperty(U=_concatInstanceProperty(B=_concatInstanceProperty(j=_concatInstanceProperty(V=_concatInstanceProperty(z=_concatInstanceProperty(X=_concatInstanceProperty(Q=_concatInstanceProperty(J="switch candidate:".concat(h,"->")).call(J,W," adjustedbw(")).call(Q,Math.round(p),")-bitrate=")).call(X,Math.round(p-I)," ttfb:")).call(z,K.toFixed(1)," avgDuration:")).call(V,S.toFixed(1)," maxFetchDuration:")).call(j,c.toFixed(1)," fetchDuration:")).call(B,_.toFixed(1)," firstSelection:")).call(U,k," codecSet:")).call(F,t.codecSet," videoRange:")).call(N,t.videoRange," hls.loadLevel:")).call(M,v))),k&&(l.firstSelection=W),W)}}},W=r;W>=t;W--){var Y,q,z=V();if("continue"!==z&&"object"===_typeof(z))return z.v}return-1}}]),r}(z),bufferController:function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n){var a,i;return _classCallCheck(this,r),(a=t.call(this,"buffer-controller",e.logger)).hls=void 0,a.fragmentTracker=void 0,a.details=null,a._objectUrl=null,a.operationQueue=null,a.bufferCodecEventsTotal=0,a.media=null,a.mediaSource=null,a.lastMpegAudioChunk=null,a.blockedAudioAppend=null,a.lastVideoAppendEnd=0,a.appendSource=void 0,a.transferData=void 0,a.overrides=void 0,a.appendErrors={audio:0,video:0,audiovideo:0},a.tracks={},a.sourceBuffers=[[null,null],[null,null]],a._onEndStreaming=function(e){var t;a.hls&&"open"===(null==(t=a.mediaSource)?void 0:t.readyState)&&a.hls.pauseBuffering()},a._onStartStreaming=function(e){a.hls&&a.hls.resumeBuffering()},a._onMediaSourceOpen=function(e){var t=_assertThisInitialized(a),r=t.media,n=t.mediaSource;e&&a.log("Media source opened"),r&&n&&(r.removeEventListener("emptied",a._onMediaEmptied),a.updateDuration(),a.hls.trigger(x.MEDIA_ATTACHED,{media:r,mediaSource:n}),n.removeEventListener("sourceopen",a._onMediaSourceOpen),null!==a.mediaSource&&a.checkPendingTracks())},a._onMediaSourceClose=function(){a.log("Media source closed")},a._onMediaSourceEnded=function(){a.log("Media source ended")},a._onMediaEmptied=function(){var e,t=_assertThisInitialized(a),r=t.mediaSrc,n=t._objectUrl;r!==n&&a.error(_concatInstanceProperty(e="Media element src was set while attaching MediaSource (".concat(n," > ")).call(e,r,")"))},a.hls=e,a.fragmentTracker=n,a.appendSource=(i=re(e.config.preferManagedMediaSource),"undefined"!=typeof self&&i===self.ManagedMediaSource),a.initTracks(),a.registerListeners(),a}return _createClass(r,[{key:"hasSourceTypes",value:function(){return _Object$keys(this.tracks).length>0}},{key:"destroy",value:function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}},{key:"registerListeners",value:function(){var e=this.hls;e.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.BUFFER_RESET,this.onBufferReset,this),e.on(x.BUFFER_APPENDING,this.onBufferAppending,this),e.on(x.BUFFER_CODECS,this.onBufferCodecs,this),e.on(x.BUFFER_EOS,this.onBufferEos,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(x.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(x.FRAG_PARSED,this.onFragParsed,this),e.on(x.FRAG_CHANGED,this.onFragChanged,this),e.on(x.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.BUFFER_RESET,this.onBufferReset,this),e.off(x.BUFFER_APPENDING,this.onBufferAppending,this),e.off(x.BUFFER_CODECS,this.onBufferCodecs,this),e.off(x.BUFFER_EOS,this.onBufferEos,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(x.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(x.FRAG_PARSED,this.onFragParsed,this),e.off(x.FRAG_CHANGED,this.onFragChanged,this),e.off(x.ERROR,this.onError,this)}},{key:"transferMedia",value:function(){var e,t=this,r=this.media,n=this.mediaSource;if(!r)return null;var a={};if(this.operationQueue){var i,s,o=this.isUpdating();o||this.operationQueue.removeBlockers();var l=this.isQueued();(o||l)&&this.warn(_concatInstanceProperty(i=_concatInstanceProperty(s="Transfering MediaSource with".concat(l?" operations in queue":"")).call(s,o?" updating SourceBuffer(s)":""," ")).call(i,this.operationQueue)),this.operationQueue.destroy()}var c=this.transferData;return!this.sourceBufferCount&&c&&c.mediaSource===n?W(a,c.tracks):_forEachInstanceProperty(e=this.sourceBuffers).call(e,(function(e){var r=_slicedToArray(e,1)[0];r&&(a[r]=W({},t.tracks[r]),t.removeBuffer(r)),e[0]=e[1]=null})),{media:r,mediaSource:n,tracks:a}}},{key:"initTracks",value:function(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}},{key:"onManifestLoading",value:function(){this.bufferCodecEventsTotal=0,this.details=null}},{key:"onManifestParsed",value:function(e,t){var r,n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log("".concat(n," bufferCodec event(s) expected.")),null!=(r=this.transferData)&&r.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}},{key:"onMediaAttaching",value:function(e,t){var r,n,a,i=this.media=t.media,s=re(this.appendSource);if(this.transferData=this.overrides=void 0,i&&s){var o=!!t.mediaSource;(o||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);var l=this.mediaSource=t.mediaSource||new s;if(this.assignMediaSource(l),o)this._objectUrl=i.src,this.attachTransferred();else{var c=this._objectUrl=_URL.createObjectURL(l);if(this.appendSource)try{i.removeAttribute("src");var u=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||u&&l instanceof u,Ii(i),r=i,n=c,(a=self.document.createElement("source")).type="video/mp4",a.src=n,r.appendChild(a),i.load()}catch(e){i.src=c}else i.src=c}i.addEventListener("emptied",this._onMediaEmptied)}}},{key:"assignMediaSource",value:function(e){var t,r,n;this.log(_concatInstanceProperty(t="".concat((null==(r=this.transferData)?void 0:r.mediaSource)===e?"transferred":"created"," media source: ")).call(t,null==(n=e.constructor)?void 0:n.name)),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}},{key:"attachTransferred",value:function(){var e=this,t=this.media,r=this.transferData;if(r&&t){var n=this.tracks,a=r.tracks,i=a?_Object$keys(a):null,s=i?i.length:0,o=function(){e.media&&e.mediaSourceOpenOrEnded&&e._onMediaSourceOpen()};if(a&&i&&s){var l,c;if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log(_concatInstanceProperty(l=_concatInstanceProperty(c="attachTransferred: (bufferCodecEventsTotal ".concat(this.bufferCodecEventsTotal,")\nrequired tracks: ")).call(c,_JSON$stringify(n,(function(e,t){return"initSegment"===e?void 0:t})),";\ntransfer tracks: ")).call(l,_JSON$stringify(a,(function(e,t){return"initSegment"===e?void 0:t})),"}")),!ne(a,n)){var u,h,d,f;r.mediaSource=null,r.tracks=void 0;var p=t.currentTime,y=this.details,g=Math.max(p,(null==y?void 0:y.fragments[0].start)||0);return g-p>1?void this.log(_concatInstanceProperty(u="attachTransferred: waiting for playback to reach new tracks start time ".concat(p," -> ")).call(u,g)):(this.warn(_concatInstanceProperty(h=_concatInstanceProperty(d=_concatInstanceProperty(f='attachTransferred: resetting MediaSource for incompatible tracks ("'.concat(_Object$keys(a),'"->"')).call(f,_Object$keys(n),'") start time: ')).call(d,g," currentTime: ")).call(h,p)),this.onMediaDetaching(x.MEDIA_DETACHING,{}),this.onMediaAttaching(x.MEDIA_ATTACHING,r),void(t.currentTime=g))}this.transferData=void 0,_forEachInstanceProperty(i).call(i,(function(t){var r=t,n=a[r];if(n){var i=n.buffer;if(i){var s=e.fragmentTracker,o=n.id;if(s.hasFragments(o)||s.hasParts(o)){var l=fr.getBuffered(i);s.detectEvictedFragments(r,l,o,null,!0)}var c=_i(r),u=[r,i];e.sourceBuffers[c]=u,i.updating&&e.operationQueue&&e.operationQueue.prependBlocker(r),e.trackSourceBuffer(r,n)}}})),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}}},{key:"mediaSourceOpenOrEnded",get:function(){var e,t=null==(e=this.mediaSource)?void 0:e.readyState;return"open"===t||"ended"===t}},{key:"onMediaDetaching",value:function(e,t){var r=this,n=!!t.transferMedia;this.transferData=this.overrides=void 0;var a=this.media,i=this.mediaSource,s=this._objectUrl;if(i){var o;if(this.log("media source "+(n?"transferring":"detaching")),n)_forEachInstanceProperty(o=this.sourceBuffers).call(o,(function(e){var t=_slicedToArray(e,1)[0];t&&r.removeBuffer(t)})),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){var l="open"===i.readyState;try{for(var c=i.sourceBuffers,u=c.length;u--;)l&&c[u].abort(),i.removeSourceBuffer(c[u]);l&&i.endOfStream()}catch(e){this.warn("onMediaDetaching: ".concat(e.message," while calling endOfStream"))}}this.sourceBufferCount&&this.onBufferReset()}i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(i.removeEventListener("startstreaming",this._onStartStreaming),i.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}a&&(a.removeEventListener("emptied",this._onMediaEmptied),n||(s&&_URL.revokeObjectURL(s),this.mediaSrc===s?(a.removeAttribute("src"),this.appendSource&&Ii(a),a.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(x.MEDIA_DETACHED,t)}},{key:"onBufferReset",value:function(){var e,t=this;_forEachInstanceProperty(e=this.sourceBuffers).call(e,(function(e){var r=_slicedToArray(e,1)[0];r&&t.resetBuffer(r)})),this.initTracks()}},{key:"resetBuffer",value:function(e){var t,r=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),r)try{var n;null!=(n=this.mediaSource)&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(t){this.warn("onBufferReset ".concat(e),t)}delete this.tracks[e]}},{key:"removeBuffer",value:function(e){this.removeBufferListeners(e),this.sourceBuffers[_i(e)]=[null,null];var t=this.tracks[e];t&&(t.buffer=void 0)}},{key:"resetQueue",value:function(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new vi(this.tracks)}},{key:"onBufferCodecs",value:function(e,t){var r,n,a=this,i=this.tracks,s=_Object$keys(t);this.log(_concatInstanceProperty(r='BUFFER_CODECS: "'.concat(s,'" (current SB count ')).call(r,this.sourceBufferCount,")"));var o="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),l=!o&&this.sourceBufferCount&&this.media&&_someInstanceProperty(s).call(s,(function(e){return!i[e]}));o||l?this.warn(_concatInstanceProperty(n='Unsupported transition between "'.concat(_Object$keys(i),'" and "')).call(n,s,'" SourceBuffers')):(_forEachInstanceProperty(s).call(s,(function(e){var r,n,s,o,l=t[e],c=l.id,u=l.codec,h=l.levelCodec,d=l.container,f=l.metadata,p=i[e],y=null==(n=a.transferData)||null==(s=n.tracks)?void 0:s[e],g=null!=y&&y.buffer?y:p,v=(null==g?void 0:g.pendingCodec)||(null==g?void 0:g.codec),m=null==g?void 0:g.levelCodec,$=!g||!!a.hls.config.assetPlayerId;p||(p=i[e]={buffer:void 0,listeners:[],codec:u,container:d,levelCodec:h,metadata:f,id:c});var S=fe(v,m),I=null==S?void 0:S.replace(mi,"$1"),_=fe(u,h),E=null==(o=_)?void 0:o.replace(mi,"$1");_&&(I!==E||$)&&("audio"===_sliceInstanceProperty(e).call(e,0,5)&&(_=de(_,a.appendSource)),a.log(_concatInstanceProperty(r="switching codec ".concat(v," to ")).call(r,_)),_!==(p.pendingCodec||p.codec)&&(p.pendingCodec=_),p.container=d,a.appendChangeType(e,d,_))})),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}},{key:"sourceBufferTracks",get:function(){var e,t=this;return _reduceInstanceProperty(e=_Object$keys(this.tracks)).call(e,(function(e,r){var n=t.tracks[r];return e[r]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e}),{})}},{key:"appendChangeType",value:function(e,t,r){var n,a=this,i=_concatInstanceProperty(n="".concat(t,";codecs=")).call(n,r),s={label:"change-type=".concat(i),execute:function(){var n=a.tracks[e];if(n){var s,o=n.buffer;null!=o&&o.changeType&&(a.log(_concatInstanceProperty(s="changing ".concat(e," sourceBuffer type to ")).call(s,i)),o.changeType(i),n.codec=r,n.container=t)}a.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){a.warn("Failed to change ".concat(e," SourceBuffer type"),t)}};this.append(s,e,this.isPending(this.tracks[e]))}},{key:"blockAudio",value:function(e){var t,r=this,n=e.start,a=n+.05*e.duration;if(!0!==(null==(t=this.fragmentTracker.getAppendedFrag(n,B))?void 0:t.gap)){var i={label:"block-audio",execute:function(){var e,t=r.tracks.video;(r.lastVideoAppendEnd>a||null!=t&&t.buffer&&fr.isBuffered(t.buffer,a)||!0===(null==(e=r.fragmentTracker.getAppendedFrag(a,B))?void 0:e.gap))&&(r.blockedAudioAppend=null,r.shiftAndExecuteNext("audio"))},onStart:function(){},onComplete:function(){},onError:function(e){r.warn("Error executing block-audio operation",e)}};this.blockedAudioAppend={op:i,frag:e},this.append(i,"audio",!0)}}},{key:"unblockAudio",value:function(){var e=this.blockedAudioAppend,t=this.operationQueue;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}},{key:"onBufferAppending",value:function(e,t){var r=this,n=this.tracks,a=t.data,i=t.type,s=t.parent,o=t.frag,l=t.part,c=t.chunkMeta,u=c.buffering[i],h=o.sn,d=self.performance.now();u.start=d;var f=o.stats.buffering,p=l?l.stats.buffering:null;0===f.start&&(f.start=d),p&&0===p.start&&(p.start=d);var y=n.audio,g=!1;"audio"===i&&"audio/mpeg"===(null==y?void 0:y.container)&&(g=!this.lastMpegAudioChunk||1===c.id||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);var v=this.tracks.video,m=null==v?void 0:v.buffer;if(m&&"initSegment"!==h){var $=l||o,S=this.blockedAudioAppend;if("audio"!==i||"main"===s||this.blockedAudioAppend){if("video"===i){var I=$.end;if(S){var _=S.frag.start;(I>_||I<this.lastVideoAppendEnd||fr.isBuffered(m,_))&&this.unblockAudio()}this.lastVideoAppendEnd=I}}else{var E=$.start+.05*$.duration,T=m.buffered,P=this.currentOp("video");T.length||P?!P&&!fr.isBuffered(m,E)&&this.lastVideoAppendEnd<E&&this.blockAudio($):this.blockAudio($)}}var b=(l||o).start,k={label:"append-".concat(i),execute:function(){if(u.executeStart=self.performance.now(),g){var e=r.tracks[i];if(e){var t=e.buffer;if(t){var n,s,o=b-t.timestampOffset;Math.abs(o)>=.1&&(r.log(_concatInstanceProperty(n=_concatInstanceProperty(s="Updating audio SourceBuffer timestampOffset to ".concat(b," (delta: ")).call(s,o,") sn: ")).call(n,h,")")),t.timestampOffset=b)}}}r.appendExecutor(a,i)},onStart:function(){},onComplete:function(){var e,t=self.performance.now();u.executeEnd=u.end=t,0===f.first&&(f.first=t),p&&0===p.first&&(p.first=t);var n={};_forEachInstanceProperty(e=r.sourceBuffers).call(e,(function(e){var t=_slicedToArray(e,2),r=t[0],a=t[1];r&&(n[r]=fr.getBuffered(a))})),r.appendErrors[i]=0,"audio"===i||"video"===i?r.appendErrors.audiovideo=0:(r.appendErrors.audio=0,r.appendErrors.video=0),r.hls.trigger(x.BUFFER_APPENDED,{type:i,frag:o,part:l,chunkMeta:c,parent:o.type,timeRanges:n})},onError:function(e){var t,n={type:D.MEDIA_ERROR,parent:o.type,details:w.BUFFER_APPEND_ERROR,sourceBufferName:i,frag:o,part:l,chunkMeta:c,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)n.details=w.BUFFER_FULL_ERROR;else if(e.code!==DOMException.INVALID_STATE_ERR||!r.mediaSourceOpenOrEnded||null!=(t=r.media)&&t.error)if(e.name===$i)0===r.sourceBufferCount?n.errorAction=tt(!0):++r.appendErrors[i];else{var a,s,u=++r.appendErrors[i];r.warn(_concatInstanceProperty(a=_concatInstanceProperty(s="Failed ".concat(u,"/")).call(s,r.hls.config.appendErrorMaxRetry,' times to append segment in "')).call(a,i,'" sourceBuffer')),u>=r.hls.config.appendErrorMaxRetry&&(n.fatal=!0)}else n.errorAction=tt(!0);r.hls.trigger(x.ERROR,n)}};this.append(k,i,this.isPending(this.tracks[i]))}},{key:"getFlushOp",value:function(e,t,r){var n,a,i=this;return this.log(_concatInstanceProperty(n=_concatInstanceProperty(a='queuing "'.concat(e,'" remove ')).call(a,t,"-")).call(n,r)),{label:"remove",execute:function(){i.removeExecutor(e,t,r)},onStart:function(){},onComplete:function(){i.hls.trigger(x.BUFFER_FLUSHED,{type:e})},onError:function(n){var a,s;i.warn(_concatInstanceProperty(a=_concatInstanceProperty(s="Failed to remove ".concat(t,"-")).call(s,r,' from "')).call(a,e,'" SourceBuffer'),n)}}}},{key:"onBufferFlushing",value:function(e,t){var r,n=this,a=t.type,i=t.startOffset,s=t.endOffset;a?this.append(this.getFlushOp(a,i,s),a):_forEachInstanceProperty(r=this.sourceBuffers).call(r,(function(e){var t=_slicedToArray(e,1)[0];t&&n.append(n.getFlushOp(t,i,s),t)}))}},{key:"onFragParsed",value:function(e,t){var r,n,a=this,i=t.frag,s=t.part,o=[],l=s?s.elementaryStreams:i.elementaryStreams;l[At]?o.push("audiovideo"):(l[bt]&&o.push("audio"),l[kt]&&o.push("video")),0===o.length&&this.warn(_concatInstanceProperty(r=_concatInstanceProperty(n="Fragments must have at least one ElementaryStreamType set. type: ".concat(i.type," level: ")).call(n,i.level," sn: ")).call(r,i.sn)),this.blockBuffers((function(){var e=self.performance.now();i.stats.buffering.end=e,s&&(s.stats.buffering.end=e);var t=s?s.stats:i.stats;a.hls.trigger(x.FRAG_BUFFERED,{frag:i,part:s,stats:t,id:i.type})}),o)}},{key:"onFragChanged",value:function(e,t){this.trimBuffers()}},{key:"bufferedToEnd",get:function(){var e,t=this;return this.sourceBufferCount>0&&!_someInstanceProperty(e=this.sourceBuffers).call(e,(function(e){var r,n,a=_slicedToArray(e,1)[0];return a&&(!(null!=(r=t.tracks[a])&&r.ended)||(null==(n=t.tracks[a])?void 0:n.ending))}))}},{key:"onBufferEos",value:function(e,t){var r,n,a,i=this;_forEachInstanceProperty(r=this.sourceBuffers).call(r,(function(e){var r=_slicedToArray(e,1)[0];if(r){var n=i.tracks[r];t.type&&t.type!==r||(n.ending=!0,n.ended||(n.ended=!0,i.log("".concat(r," buffer reached EOS"))))}}));var s=!1!==(null==(a=this.overrides)?void 0:a.endOfStream);this.sourceBufferCount>0&&!_someInstanceProperty(n=this.sourceBuffers).call(n,(function(e){var t,r=_slicedToArray(e,1)[0];return r&&!(null!=(t=i.tracks[r])&&t.ended)}))&&(this.log("Queueing EOS"),this.blockUntilOpen((function(){var e;if(_forEachInstanceProperty(e=i.sourceBuffers).call(e,(function(e){var t=_slicedToArray(e,1)[0];if(null!==t){var r=i.tracks[t];r&&(r.ending=!1)}})),s){var t=i.mediaSource;if(!t||"open"!==t.readyState)return void(t&&i.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: ".concat(t.readyState)));i.log("Calling mediaSource.endOfStream()"),t.endOfStream()}i.hls.trigger(x.BUFFERED_TO_END,void 0)})))}},{key:"onLevelUpdated",value:function(e,t){var r=t.details;r.fragments.length&&(this.details=r,this.updateDuration())}},{key:"updateDuration",value:function(){var e=this,t=this.getDurationAndRange();t&&this.blockUntilOpen((function(){return e.updateMediaSource(t)}))}},{key:"onError",value:function(e,t){if(t.details===w.BUFFER_APPEND_ERROR&&t.frag){var r,n=null==(r=t.errorAction)?void 0:r.nextAutoLevel;O(n)&&n!==t.frag.level&&this.resetAppendErrors()}}},{key:"resetAppendErrors",value:function(){this.appendErrors={audio:0,video:0,audiovideo:0}}},{key:"trimBuffers",value:function(){var e=this.hls,t=this.details,r=this.media;if(r&&null!==t&&this.sourceBufferCount){var n=e.config,a=r.currentTime,i=t.levelTargetDuration,s=t.live&&null!==n.liveBackBufferLength?n.liveBackBufferLength:n.backBufferLength;if(O(s)&&s>=0){var o=Math.max(s,i),l=Math.floor(a/i)*i-o;this.flushBackBuffer(a,i,l)}if(O(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){var c=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),u=Math.max(c,i),h=Math.floor(a/i)*i+u;this.flushFrontBuffer(a,i,h)}}}},{key:"flushBackBuffer",value:function(e,t,r){var n,a=this;_forEachInstanceProperty(n=this.sourceBuffers).call(n,(function(n){var i=_slicedToArray(n,2),s=i[0],o=i[1];if(o){var l=fr.getBuffered(o);if(l.length>0&&r>l.start(0)){var c;a.hls.trigger(x.BACK_BUFFER_REACHED,{bufferEnd:r});var u=a.tracks[s];if(null!=(c=a.details)&&c.live)a.hls.trigger(x.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(null!=u&&u.ended&&l.end(l.length-1)-e<2*t)return void a.log("Cannot flush ".concat(s," back buffer while SourceBuffer is in ended state"));a.hls.trigger(x.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:s})}}}))}},{key:"flushFrontBuffer",value:function(e,t,r){var n,a=this;_forEachInstanceProperty(n=this.sourceBuffers).call(n,(function(n){var i=_slicedToArray(n,2),s=i[0],o=i[1];if(o){var l=fr.getBuffered(o),c=l.length;if(c<2)return;var u=l.start(c-1),h=l.end(c-1),d=a.tracks[s];if(r>u||e>=u&&e<=h)return;if(null!=d&&d.ended&&e-h<2*t)return void a.log("Cannot flush ".concat(s," front buffer while SourceBuffer is in ended state"));a.hls.trigger(x.BUFFER_FLUSHING,{startOffset:u,endOffset:1/0,type:s})}}))}},{key:"getDurationAndRange",value:function(){var e,t=this.details,r=this.mediaSource;if(!t||!this.media||"open"!==(null==r?void 0:r.readyState))return null;var n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(r.duration=1/0,t.fragments.length&&t.live&&r.setLiveSeekableRange){var a=Math.max(0,t.fragmentStart);return{duration:1/0,start:a,end:Math.max(a,n)}}return{duration:1/0}}var i=null==(e=this.overrides)?void 0:e.duration;if(i)return{duration:i};var s=this.media.duration;return n>(O(r.duration)?r.duration:0)&&n>s||!O(s)?{duration:n}:null}},{key:"updateMediaSource",value:function(e){var t,r,n=e.duration,a=e.start,i=e.end,s=this.mediaSource;this.media&&s&&"open"===s.readyState&&(s.duration!==n&&(O(n)&&this.log("Updating MediaSource duration to ".concat(n.toFixed(3))),s.duration=n),void 0!==a&&void 0!==i&&(this.log(_concatInstanceProperty(t=_concatInstanceProperty(r="MediaSource duration is set to ".concat(s.duration,". Setting seekable range to ")).call(r,a,"-")).call(t,i,".")),s.setLiveSeekableRange(a,i)))}},{key:"tracksReady",get:function(){var e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}},{key:"checkPendingTracks",value:function(){var e,t,r=this.bufferCodecEventsTotal,n=this.pendingTrackCount,a=this.tracks;if(this.log(_concatInstanceProperty(e=_concatInstanceProperty(t="checkPendingTracks (pending: ".concat(n," codec events expected: ")).call(t,r,") ")).call(e,_JSON$stringify(a))),this.tracksReady){var i,s=null==(i=this.transferData)?void 0:i.tracks;s&&_Object$keys(s).length?this.attachTransferred():(this.createSourceBuffers(),this.bufferCreated())}}},{key:"bufferCreated",value:function(){var e=this;if(this.sourceBufferCount){var t,r,n={};_forEachInstanceProperty(t=this.sourceBuffers).call(t,(function(t){var r=_slicedToArray(t,2),a=r[0],i=r[1];if(a){var s=e.tracks[a];n[a]={buffer:i,container:s.container,codec:s.codec,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}})),this.hls.trigger(x.BUFFER_CREATED,{tracks:n}),this.log("SourceBuffers created. Running queue: ".concat(this.operationQueue)),_forEachInstanceProperty(r=this.sourceBuffers).call(r,(function(t){var r=_slicedToArray(t,1)[0];e.executeNext(r)}))}else{var a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}},{key:"createSourceBuffers",value:function(){var e=this.tracks,t=this.sourceBuffers,r=this.mediaSource;if(!r)throw new Error("createSourceBuffers called when mediaSource was null");for(var n in e){var a=n,i=e[a];if(this.isPending(i)){var s,o,l,c=this.getTrackCodec(i,a),u=_concatInstanceProperty(s="".concat(i.container,";codecs=")).call(s,c);i.codec=c,this.log(_concatInstanceProperty(o=_concatInstanceProperty(l="creating sourceBuffer(".concat(u,")")).call(l,this.currentOp(a)?" Queued":""," ")).call(o,_JSON$stringify(i)));try{var h=r.addSourceBuffer(u),d=_i(a),f=[a,h];t[d]=f,i.buffer=h}catch(e){this.error("error while trying to add sourceBuffer: ".concat(e.message)),this.hls.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:a,mimeType:u});break}this.trackSourceBuffer(a,i)}}}},{key:"getTrackCodec",value:function(e,t){var r=fe(e.codec,e.levelCodec);return r?"audio"===_sliceInstanceProperty(t).call(t,0,5)?de(r,this.appendSource):r:""}},{key:"trackSourceBuffer",value:function(e,t){var r=this,n=t.buffer;if(n){var a=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:a,container:t.container,levelCodec:t.levelCodec,metadata:t.metadata,id:t.id,listeners:[]},this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(function(e,t){var n=t.removedRanges;null!=n&&n.length&&r.hls.trigger(x.BUFFER_FLUSHED,{type:e})}))}}},{key:"mediaSrc",get:function(){var e,t,r=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==r?void 0:r.src}},{key:"onSBUpdateStart",value:function(e){var t=this.currentOp(e);t&&t.onStart()}},{key:"onSBUpdateEnd",value:function(e){var t;if("closed"!==(null==(t=this.mediaSource)?void 0:t.readyState)){var r=this.currentOp(e);r&&(r.onComplete(),this.shiftAndExecuteNext(e))}else this.resetBuffer(e)}},{key:"onSBUpdateError",value:function(e,t){var r,n,a=new Error(_concatInstanceProperty(r="".concat(e," SourceBuffer error. MediaSource readyState: ")).call(r,null==(n=this.mediaSource)?void 0:n.readyState));this.error("".concat(a),t),this.hls.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:a,fatal:!1});var i=this.currentOp(e);i&&i.onError(a)}},{key:"removeExecutor",value:function(e,t,r){var n,a,i=this.media,s=this.mediaSource,o=this.tracks[e],l=null==o?void 0:o.buffer;if(!i||!s||!l)return this.warn("Attempting to remove from the ".concat(e," SourceBuffer, but it does not exist")),void this.shiftAndExecuteNext(e);var c=O(i.duration)?i.duration:1/0,u=O(s.duration)?s.duration:1/0,h=Math.max(0,t),d=Math.min(r,c,u);d>h&&(!o.ending||o.ended)?(o.ended=!1,this.log(_concatInstanceProperty(n=_concatInstanceProperty(a="Removing [".concat(h,",")).call(a,d,"] from the ")).call(n,e," SourceBuffer")),l.remove(h,d)):this.shiftAndExecuteNext(e)}},{key:"appendExecutor",value:function(e,t){var r=this.tracks[t],n=null==r?void 0:r.buffer;if(!n)throw new Si("Attempting to append to the ".concat(t," SourceBuffer, but it does not exist"));r.ending=!1,r.ended=!1,n.appendBuffer(e)}},{key:"blockUntilOpen",value:function(e){this.isUpdating()||this.isQueued()?this.blockBuffers(e):e()}},{key:"isUpdating",value:function(){var e;return _someInstanceProperty(e=this.sourceBuffers).call(e,(function(e){var t=_slicedToArray(e,2),r=t[0],n=t[1];return r&&n.updating}))}},{key:"isQueued",value:function(){var e,t=this;return _someInstanceProperty(e=this.sourceBuffers).call(e,(function(e){var r=_slicedToArray(e,1)[0];return r&&!!t.currentOp(r)}))}},{key:"isPending",value:function(e){return!!e&&!e.buffer}},{key:"blockBuffers",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.sourceBufferTypes;if(!r.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void _Promise.resolve().then(e);var n=this.operationQueue,a=_mapInstanceProperty(r).call(r,(function(e){return t.appendBlocker(e)}));r.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),_Promise.all(a).then((function(a){n===t.operationQueue&&(e(),t.stepOperationQueue(r))}))}},{key:"stepOperationQueue",value:function(e){var t=this;_forEachInstanceProperty(e).call(e,(function(e){var r,n=null==(r=t.tracks[e])?void 0:r.buffer;n&&!n.updating&&t.shiftAndExecuteNext(e)}))}},{key:"append",value:function(e,t,r){this.operationQueue&&this.operationQueue.append(e,t,r)}},{key:"appendBlocker",value:function(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}},{key:"currentOp",value:function(e){return this.operationQueue?this.operationQueue.current(e):null}},{key:"executeNext",value:function(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}},{key:"shiftAndExecuteNext",value:function(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}},{key:"pendingTrackCount",get:function(){var e,t=this;return _reduceInstanceProperty(e=_Object$keys(this.tracks)).call(e,(function(e,r){return e+(t.isPending(t.tracks[r])?1:0)}),0)}},{key:"sourceBufferCount",get:function(){var e;return _reduceInstanceProperty(e=this.sourceBuffers).call(e,(function(e,t){return e+(_slicedToArray(t,1)[0]?1:0)}),0)}},{key:"sourceBufferTypes",get:function(){var e,t;return _filterInstanceProperty(e=_mapInstanceProperty(t=this.sourceBuffers).call(t,(function(e){return _slicedToArray(e,1)[0]}))).call(e,(function(e){return!!e}))}},{key:"addBufferListener",value:function(e,t,r){var n=this.tracks[e];if(n){var a=n.buffer;if(a){var i=_bindInstanceProperty(r).call(r,this,e);n.listeners.push({event:t,listener:i}),a.addEventListener(t,i)}}}},{key:"removeBufferListeners",value:function(e){var t,r=this.tracks[e];if(r){var n=r.buffer;n&&(_forEachInstanceProperty(t=r.listeners).call(t,(function(e){n.removeEventListener(e.event,e.listener)})),r.listeners.length=0)}}}]),r}(z),capLevelController:Ei,errorController:function(e){_inherits(r,e);var t=_createSuper(r);function r(e){var n;return _classCallCheck(this,r),(n=t.call(this,"error-controller",e.logger)).hls=void 0,n.playlistError=0,n.penalizedRenditions={},n.hls=e,n.registerListeners(),n}return _createClass(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(x.ERROR,this.onError,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.LEVEL_UPDATED,this.onLevelUpdated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(x.ERROR,this.onError,this),e.off(x.ERROR,this.onErrorOut,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.LEVEL_UPDATED,this.onLevelUpdated,this))}},{key:"destroy",value:function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}},{key:"startLoad",value:function(e){}},{key:"stopLoad",value:function(){this.playlistError=0}},{key:"getVariantLevelIndex",value:function(e){return(null==e?void 0:e.type)===B?e.level:this.hls.loadLevel}},{key:"onManifestLoading",value:function(){this.playlistError=0,this.penalizedRenditions={}}},{key:"onLevelUpdated",value:function(){this.playlistError=0}},{key:"onError",value:function(e,t){var r;if(!t.fatal){var n=this.hls,a=t.context;switch(t.details){case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case w.FRAG_PARSING_ERROR:if(null!=(r=t.frag)&&r.gap)return void(t.errorAction=tt());case w.FRAG_GAP:case w.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=ze);case w.LEVEL_EMPTY_ERROR:case w.LEVEL_PARSING_ERROR:var i,s,o=t.parent===B?t.level:n.loadLevel;return void(t.details===w.LEVEL_EMPTY_ERROR&&null!=(i=t.context)&&null!=(s=i.levelDetails)&&s.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,o)));case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==a?void 0:a.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level)));case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.SUBTITLE_LOAD_ERROR:case w.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){var l=n.levels[n.loadLevel];if(l&&(a.type===F&&l.hasAudioGroup(a.groupId)||a.type===U&&l.hasSubtitleGroup(a.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=ze,void(t.errorAction.flags=Ze)}return;case w.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var c=n.levels[n.loadLevel],u=null==c?void 0:c.attrs["HDCP-LEVEL"];return void(u?t.errorAction={action:ze,flags:et,hdcpLevel:u}:this.keySystemError(t));case w.BUFFER_ADD_CODEC_ERROR:case w.REMUX_ALLOC_ERROR:case w.BUFFER_APPEND_ERROR:var h;return void(t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,null!=(h=t.level)?h:n.loadLevel)));case w.INTERNAL_EXCEPTION:case w.BUFFER_APPENDING_ERROR:case w.BUFFER_FULL_ERROR:case w.LEVEL_SWITCH_ERROR:case w.BUFFER_STALLED_ERROR:case w.BUFFER_SEEK_OVER_HOLE:case w.BUFFER_NUDGE_ON_STALL:return void(t.errorAction=tt())}t.type===D.KEY_SYSTEM_ERROR&&this.keySystemError(t)}}},{key:"keySystemError",value:function(e){var t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}},{key:"getPlaylistRetryOrSwitchAction",value:function(e,t){var r=He(this.hls.config.playlistLoadPolicy,e),n=this.playlistError++;if(Ye(r,n,Ke(e),e.response))return{action:Qe,flags:Je,retryConfig:r,retryCount:n};var a=this.getLevelSwitchAction(e,t);return r&&(a.retryConfig=r,a.retryCount=n),a}},{key:"getFragRetryOrSwitchAction",value:function(e){var t,r,n=this.hls,a=this.getVariantLevelIndex(e.frag),i=n.levels[a],s=n.config,o=s.fragLoadPolicy,l=s.keyLoadPolicy,c=He(_startsWithInstanceProperty(t=e.details).call(t,"key")?l:o,e),u=_reduceInstanceProperty(r=n.levels).call(r,(function(e,t){return e+t.fragmentError}),0);if(i&&(e.details!==w.FRAG_GAP&&i.fragmentError++,Ye(c,u,Ke(e),e.response)))return{action:Qe,flags:Je,retryConfig:c,retryCount:u};var h=this.getLevelSwitchAction(e,a);return c&&(h.retryConfig=c,h.retryCount=u),h}},{key:"getLevelSwitchAction",value:function(e,t){var r=this.hls;null==t&&(t=r.loadLevel);var n=this.hls.levels[t];if(n){var a,i,s=e.details;n.loadError++,s===w.BUFFER_APPEND_ERROR&&n.fragmentError++;var o=-1,l=r.levels,c=r.loadLevel,u=r.minAutoLevel,h=r.maxAutoLevel;r.autoLevelEnabled||(r.loadLevel=-1);for(var d=null==(a=e.frag)?void 0:a.type,f=(d===j&&s===w.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(s===w.BUFFER_ADD_CODEC_ERROR||s===w.BUFFER_APPEND_ERROR))&&_someInstanceProperty(l).call(l,(function(e){var t=e.audioCodec;return n.audioCodec!==t})),p="video"===e.sourceBufferName&&(s===w.BUFFER_ADD_CODEC_ERROR||s===w.BUFFER_APPEND_ERROR)&&_someInstanceProperty(l).call(l,(function(e){var t=e.codecSet,r=e.audioCodec;return n.codecSet!==t&&n.audioCodec===r})),y=null!=(i=e.context)?i:{},g=y.type,v=y.groupId,m=function(){var t=($+c)%l.length;if(t!==c&&t>=u&&t<=h&&0===l[t].loadError){var r=l[t];if(s===w.FRAG_GAP&&d===B&&e.frag){var a=l[t].details;if(a){var i=Ue(e.frag,a.fragments,e.frag.start);if(null!=i&&i.gap)return"continue"}}else{if(g===F&&r.hasAudioGroup(v)||g===U&&r.hasSubtitleGroup(v))return"continue";if(d===j&&null!=(S=n.audioGroups)&&_someInstanceProperty(S).call(S,(function(e){return r.hasAudioGroup(e)}))||d===G&&null!=(I=n.subtitleGroups)&&_someInstanceProperty(I).call(I,(function(e){return r.hasSubtitleGroup(e)}))||f&&n.audioCodec===r.audioCodec||!f&&n.audioCodec!==r.audioCodec||p&&n.codecSet===r.codecSet)return"continue"}return o=t,"break"}},$=l.length;$--;){var S,I,_=m();if("continue"!==_&&"break"===_)break}if(o>-1&&r.loadLevel!==o)return e.levelRetry=!0,this.playlistError=0,{action:ze,flags:Je,nextAutoLevel:o}}return{action:ze,flags:Ze}}},{key:"onErrorOut",value:function(e,t){var r;switch(null==(r=t.errorAction)?void 0:r.action){case qe:break;case ze:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===w.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn('MediaSource ended after "'.concat(t.sourceBufferName,'" sourceBuffer append error. Attempting to recover from media error.')),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}},{key:"sendAlternateToPenaltyBox",value:function(e){var t=this.hls,r=e.errorAction;if(r){var n=_flagsInstanceProperty(r),a=r.hdcpLevel,i=r.nextAutoLevel;switch(n){case Je:this.switchLevel(e,i);break;case et:a&&(t.maxHdcpLevel=Se[_indexOfInstanceProperty(Se).call(Se,a)-1],r.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'.concat(t.maxHdcpLevel,'" or lower'))}r.resolved||this.switchLevel(e,i)}}},{key:"switchLevel",value:function(e,t){var r;void 0!==t&&e.errorAction&&(this.warn(_concatInstanceProperty(r="switching to level ".concat(t," after ")).call(r,e.details)),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}]),r}(z),fpsController:function(){function e(t){_classCallCheck(this,e),this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=t,this.registerListeners()}return _createClass(e,[{key:"setStreamController",value:function(e){this.streamController=e}},{key:"registerListeners",value:function(){this.hls.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(x.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"unregisterListeners",value:function(){this.hls.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(x.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"destroy",value:function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}},{key:"onMediaAttaching",value:function(e,t){var r=this.hls.config;if(r.capLevelOnFPSDrop){var n,a=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=a,a&&"function"==typeof a.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=_setInterval(_bindInstanceProperty(n=this.checkFPSInterval).call(n,this),r.fpsDroppedMonitoringPeriod)}}},{key:"onMediaDetaching",value:function(){this.media=null}},{key:"checkFPS",value:function(e,t,r){var n=performance.now();if(t){if(this.lastTime){var a=n-this.lastTime,i=r-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*i/a,l=this.hls;if(l.trigger(x.FPS_DROP,{currentDropped:i,currentDecoded:s,totalDroppedFrames:r}),o>0&&i>l.config.fpsDroppedMonitoringThreshold*s){var c=l.currentLevel;l.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=c)&&(c-=1,l.trigger(x.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:l.currentLevel}),l.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}},{key:"checkFPSInterval",value:function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}]),e}(),stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Vr,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:yo,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n,a){var i;return _classCallCheck(this,r),(i=t.call(this,e,n,a,"subtitle-stream-controller",G)).currentTrackId=-1,i.tracksBuffered=[],i.mainDetails=null,i.registerListeners(),i}return _createClass(r,[{key:"onHandlerDestroying",value:function(){this.unregisterListeners(),_get(_getPrototypeOf(r.prototype),"onHandlerDestroying",this).call(this),this.mainDetails=null}},{key:"registerListeners",value:function(){_get(_getPrototypeOf(r.prototype),"registerListeners",this).call(this);var e=this.hls;e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(x.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(x.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(x.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this)}},{key:"unregisterListeners",value:function(){_get(_getPrototypeOf(r.prototype),"unregisterListeners",this).call(this);var e=this.hls;e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(x.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(x.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(x.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this)}},{key:"startLoad",value:function(e){this.stopLoad(),this.state=kn,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}},{key:"onManifestLoading",value:function(){_get(_getPrototypeOf(r.prototype),"onManifestLoading",this).call(this),this.mainDetails=null}},{key:"onMediaDetaching",value:function(e,t){this.tracksBuffered=[],_get(_getPrototypeOf(r.prototype),"onMediaDetaching",this).call(this,e,t)}},{key:"onLevelLoaded",value:function(e,t){this.mainDetails=t.details}},{key:"onSubtitleFragProcessed",value:function(e,t){var r=t.frag,n=t.success;if(Ot(r)&&(this.fragPrevious=r),this.state=kn,n){var a=this.tracksBuffered[this.currentTrackId];if(a){for(var i,s=r.start,o=0;o<a.length;o++)if(s>=a[o].start&&s<=a[o].end){i=a[o];break}var l=r.start+r.duration;i?i.end=l:(i={start:s,end:l},a.push(i)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null),this.media&&this.tick()}}}},{key:"onBufferFlushing",value:function(e,t){var r=t.startOffset,n=t.endOffset;if(0===r&&n!==Number.POSITIVE_INFINITY){var a,i=n-1;if(i<=0)return;t.endOffsetSubtitles=Math.max(0,i),_forEachInstanceProperty(a=this.tracksBuffered).call(a,(function(e){for(var t=0;t<e.length;)if(e[t].end<=i)e.shift();else{if(!(e[t].start<i))break;e[t].start=i,t++}})),this.fragmentTracker.removeFragmentsInRange(r,i,G)}}},{key:"onError",value:function(e,t){var r=t.frag;(null==r?void 0:r.type)===G&&(t.details===w.FRAG_GAP&&this.fragmentTracker.fragBuffered(r,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==bn&&(this.state=kn))}},{key:"onSubtitleTracksUpdated",value:function(e,t){var r=this,n=t.subtitleTracks;this.levels&&fi(this.levels,n)?this.levels=_mapInstanceProperty(n).call(n,(function(e){return new ke(e)})):(this.tracksBuffered=[],this.levels=_mapInstanceProperty(n).call(n,(function(e){var t=new ke(e);return r.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,G),this.fragPrevious=null,this.mediaBuffer=null)}},{key:"onSubtitleTrackSwitch",value:function(e,t){var r;if(this.currentTrackId=t.id,null!=(r=this.levels)&&r.length&&-1!==this.currentTrackId){var n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==bn&&this.setInterval(500)}else this.clearInterval()}},{key:"onSubtitleTrackLoaded",value:function(e,t){var r,n,a,i,s,o,l=this.currentTrackId,c=this.levels,u=t.details,h=t.id;if(c){var d=c[h];if(!(h>=c.length)&&d){if(this.log(_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i="Subtitle track ".concat(h," loaded [")).call(i,u.startSN,",")).call(a,u.endSN,"]")).call(n,u.lastPartSn?_concatInstanceProperty(s="[part-".concat(u.lastPartSn,"-")).call(s,u.lastPartIndex,"]"):"",",duration:")).call(r,u.totalduration)),this.mediaBuffer=this.mediaBufferTimeRanges,u.live||null!=(o=d.details)&&o.live){var f=this.mainDetails;if(u.deltaUpdateFailed||!f)return;var p,y=f.fragments[0];d.details?0===this.alignPlaylists(u,d.details,null==(p=this.levelLastLoaded)?void 0:p.details)&&y&&yn(u,y.start):u.hasProgramDateTime&&f.hasProgramDateTime?(Tn(u,f),u.fragmentStart):y&&yn(u,y.start)}d.details=u,this.levelLastLoaded=d,h===l&&(this.hls.trigger(x.SUBTITLE_TRACK_UPDATED,{details:u,id:h,groupId:t.groupId}),this.tick(),u.live&&!this.fragCurrent&&this.media&&this.state===kn)&&(Ue(null,u.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),d.details=void 0))}}else this.warn("Subtitle tracks were reset while loading level ".concat(h))}},{key:"_handleFragmentLoadComplete",value:function(e){var t=this,r=e.frag,n=e.payload,a=r.decryptdata,i=this.hls;if(!this.fragContextChanged(r)&&n&&n.byteLength>0&&null!=a&&a.key&&a.iv&&Pr(a.method)){var s=performance.now();this.decrypter.decrypt(new Uint8Array(n),a.key.buffer,a.iv.buffer,br(a.method)).catch((function(e){throw i.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:r}),e})).then((function(e){var t=performance.now();i.trigger(x.FRAG_DECRYPTED,{frag:r,payload:e,stats:{tstart:s,tdecrypt:t}})})).catch((function(e){var r;t.warn(_concatInstanceProperty(r="".concat(e.name,": ")).call(r,e.message)),t.state=kn}))}}},{key:"doTick",value:function(){if(this.media){if(this.state===kn){var e=this.currentTrackId,t=this.levels,r=null==t?void 0:t[e];if(!r||!t.length||!r.details)return;if(this.waitForLive(r))return;var n=this.config,a=this.getLoadPosition(),i=fr.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],a,n.maxBufferHole),s=i.end,o=i.len,l=r.details;if(o>this.hls.maxBufferLength+l.levelTargetDuration)return;var c=l.fragments,u=c.length,h=l.edge,d=null,f=this.fragPrevious;if(s<h){var p=n.maxFragLookUpTolerance,y=s>h-p?0:p;!(d=Ue(f,c,Math.max(c[0].start,s),y))&&f&&f.start<c[0].start&&(d=c[0])}else d=c[u-1];if(!d)return;if(Ot(d=this.mapToInitFragWhenRequired(d))){var g=c[d.sn-l.startSN-1];g&&g.cc===d.cc&&this.fragmentTracker.getState(g)===rt&&(d=g)}this.fragmentTracker.getState(d)===rt&&this.loadFragment(d,r,s)}}else this.state=kn}},{key:"loadFragment",value:function(e,t,n){Ot(e)?_get(_getPrototypeOf(r.prototype),"loadFragment",this).call(this,e,t,n):this._loadInitSegment(e,t)}},{key:"mediaBufferTimeRanges",get:function(){return new $s(this.tracksBuffered[this.currentTrackId]||[])}}]),r}(Fn),subtitleTrackController:function(e){_inherits(r,e);var t=_createSuper(r);function r(e){var n;return _classCallCheck(this,r),(n=t.call(this,e,"subtitle-track-controller")).media=null,n.tracks=[],n.groupIds=null,n.tracksInGroup=[],n.trackId=-1,n.currentTrack=null,n.selectDefaultTrack=!0,n.queuedDefaultTrack=-1,n.useTextTrackPolling=!1,n.subtitlePollingInterval=-1,n._subtitleDisplay=!0,n.asyncPollTrackChange=function(){return n.pollTrackChange(0)},n.onTextTracksChanged=function(){if(n.useTextTrackPolling||self.clearInterval(n.subtitlePollingInterval),n.media&&n.hls.config.renderTextTracksNatively){for(var e=null,t=is(n.media.textTracks),r=0;r<t.length;r++)if("hidden"===t[r].mode)e=t[r];else if("showing"===t[r].mode){e=t[r];break}var a=n.findTrackForTextTrack(e);n.subtitleTrack!==a&&n.setSubtitleTrack(a)}},n.registerListeners(),n}return _createClass(r,[{key:"destroy",value:function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,_get(_getPrototypeOf(r.prototype),"destroy",this).call(this)}},{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}},{key:"registerListeners",value:function(){var e=this.hls;e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(x.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(x.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.LEVEL_LOADING,this.onLevelLoading,this),e.off(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(x.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(x.ERROR,this.onError,this)}},{key:"onMediaAttached",value:function(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}},{key:"pollTrackChange",value:function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=_setInterval(this.onTextTracksChanged,e)}},{key:"onMediaDetaching",value:function(e,t){var r,n=this.media;if(n){var a=!!t.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,a||_forEachInstanceProperty(r=is(n.textTracks)).call(r,(function(e){ns(e)}))}}},{key:"onManifestLoading",value:function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}},{key:"onManifestParsed",value:function(e,t){this.tracks=t.subtitleTracks}},{key:"onSubtitleTrackLoaded",value:function(e,t){var r,n,a,i,s,o,l,c=t.id,u=t.groupId,h=t.details,d=this.tracksInGroup[c];if(d&&d.groupId===u){var f=d.details;d.details=t.details,this.log(_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o=_concatInstanceProperty(l="Subtitle track ".concat(c,' "')).call(l,d.name,'" lang:')).call(o,d.lang," group:")).call(s,u," loaded [")).call(i,h.startSN,"-")).call(a,h.endSN,"]")),c===this.trackId&&this.playlistLoaded(c,t,f)}else this.warn(_concatInstanceProperty(r=_concatInstanceProperty(n="Subtitle track with id:".concat(c," and group:")).call(n,u," not found in active group ")).call(r,null==d?void 0:d.groupId))}},{key:"onLevelLoading",value:function(e,t){this.switchLevel(t.level)}},{key:"onLevelSwitching",value:function(e,t){this.switchLevel(t.level)}},{key:"switchLevel",value:function(e){var t=this.hls.levels[e];if(t){var r=t.subtitleGroups||null,n=this.groupIds,a=this.currentTrack;if(!r||(null==n?void 0:n.length)!==(null==r?void 0:r.length)||null!=r&&_someInstanceProperty(r).call(r,(function(e){return-1===(null==n?void 0:_indexOfInstanceProperty(n).call(n,e))}))){var i,s;this.groupIds=r,this.trackId=-1,this.currentTrack=null;var o=_filterInstanceProperty(i=this.tracks).call(i,(function(e){return!r||-1!==_indexOfInstanceProperty(r).call(r,e.groupId)}));if(o.length)this.selectDefaultTrack&&!_someInstanceProperty(o).call(o,(function(e){return e.default}))&&(this.selectDefaultTrack=!1),_forEachInstanceProperty(o).call(o,(function(e,t){e.id=t}));else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=o;var l=this.hls.config.subtitlePreference;if(!a&&l){this.selectDefaultTrack=!1;var c=De(l,o);if(c>-1)a=o[c];else{var u=De(l,this.tracks);a=this.tracks[u]}}var h=this.findTrackId(a);-1===h&&a&&(h=this.findTrackId(null));var d={subtitleTracks:o};this.log(_concatInstanceProperty(s="Updating subtitle tracks, ".concat(o.length,' track(s) found in "')).call(s,null==r?void 0:r.join(","),'" group-id')),this.hls.trigger(x.SUBTITLE_TRACKS_UPDATED,d),-1!==h&&-1===this.trackId&&this.setSubtitleTrack(h)}}}},{key:"findTrackId",value:function(e){for(var t=this.tracksInGroup,r=this.selectDefaultTrack,n=0;n<t.length;n++){var a=t[n];if((!r||a.default)&&(r||e)&&(!e||we(a,e)))return n}if(e){for(var i=0;i<t.length;i++){var s=t[i];if(pi(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(var o=0;o<t.length;o++){var l=t[o];if(pi(e.attrs,l.attrs,["LANGUAGE"]))return o}}return-1}},{key:"findTrackForTextTrack",value:function(e){if(e)for(var t=this.tracksInGroup,r=0;r<t.length;r++)if(yi(t[r],e))return r;return-1}},{key:"onError",value:function(e,t){var r;!t.fatal&&t.context&&(t.context.type!==U||t.context.id!==this.trackId||this.groupIds&&-1===_indexOfInstanceProperty(r=this.groupIds).call(r,t.context.groupId)||this.checkRetry(t))}},{key:"allSubtitleTracks",get:function(){return this.tracks}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}},{key:"setSubtitleOption",value:function(e){if(this.hls.config.subtitlePreference=e,e){if(-1===e.id)return this.setSubtitleTrack(-1),null;var t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){var r=this.currentTrack;if(r&&we(e,r))return r;var n=De(e,this.tracksInGroup);if(n>-1){var a=this.tracksInGroup[n];return this.setSubtitleTrack(n),a}if(r)return null;var i=De(e,t);if(i>-1)return t[i]}}return null}},{key:"loadPlaylist",value:function(e){_get(_getPrototypeOf(r.prototype),"loadPlaylist",this).call(this),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}},{key:"loadingPlaylist",value:function(e,t){var n,a,i,s,o,l;_get(_getPrototypeOf(r.prototype),"loadingPlaylist",this).call(this,e,t);var c=e.id,u=e.groupId,h=this.getUrlWithDirectives(e.url,t),d=e.details,f=null==d?void 0:d.age;this.log(_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o=_concatInstanceProperty(l="Loading subtitle ".concat(c,' "')).call(l,e.name,'" lang:')).call(o,e.lang," group:")).call(s,u)).call(i,void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")).call(a,f&&d.live?" age "+f.toFixed(1)+(d.type&&" "+d.type||""):""," ")).call(n,h)),this.hls.trigger(x.SUBTITLE_TRACK_LOADING,{url:h,id:c,groupId:u,deliveryDirectives:t||null,track:e})}},{key:"toggleTrackModes",value:function(){var e,t,r=this.media;if(r){var n,a=is(r.textTracks),i=this.currentTrack;if(i&&((n=_filterInstanceProperty(a).call(a,(function(e){return yi(i,e)}))[0])||this.warn(_concatInstanceProperty(e='Unable to find subtitle TextTrack with name "'.concat(i.name,'" and language "')).call(e,i.lang,'"'))),_forEachInstanceProperty(t=_sliceInstanceProperty([]).call(a)).call(t,(function(e){"disabled"!==e.mode&&e!==n&&(e.mode="disabled")})),n){var s=this.subtitleDisplay?"showing":"hidden";n.mode!==s&&(n.mode=s)}}}},{key:"setSubtitleTrack",value:function(e){var t,r,n=this.tracksInGroup;if(this.media)if(e<-1||e>=n.length||!O(e))this.warn("Invalid subtitle track id: ".concat(e));else{this.selectDefaultTrack=!1;var a=this.currentTrack,i=n[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),i){var s=!!i.details&&!i.details.live;if(e!==this.trackId||i!==a||!s){this.log("Switching to subtitle-track ".concat(e)+(i?_concatInstanceProperty(t=_concatInstanceProperty(r=' "'.concat(i.name,'" lang:')).call(r,i.lang," group:")).call(t,i.groupId):""));var o=i.id,l=i.groupId,c=void 0===l?"":l,u=i.name,h=i.type,d=i.url;this.hls.trigger(x.SUBTITLE_TRACK_SWITCH,{id:o,groupId:c,name:u,type:h,url:d});var f=this.switchParams(i.url,null==a?void 0:a.details,i.details);this.loadPlaylist(f)}}else this.hls.trigger(x.SUBTITLE_TRACK_SWITCH,{id:e})}else this.queuedDefaultTrack=e}}]),r}(gi),timelineController:function(){function e(t){_classCallCheck(this,e),this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},t.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(x.MANIFEST_LOADING,this.onManifestLoading,this),t.on(x.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(x.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(x.FRAG_LOADING,this.onFragLoading,this),t.on(x.FRAG_LOADED,this.onFragLoaded,this),t.on(x.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(x.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(x.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(x.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this)}return _createClass(e,[{key:"destroy",value:function(){var e=this.hls;e.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(x.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(x.FRAG_LOADING,this.onFragLoading,this),e.off(x.FRAG_LOADED,this.onFragLoaded,this),e.off(x.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(x.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(x.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(x.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}},{key:"initCea608Parsers",value:function(){var e=new uo(this,"textTrack1"),t=new uo(this,"textTrack2"),r=new uo(this,"textTrack3"),n=new uo(this,"textTrack4");this.cea608Parser1=new Ms(1,e,t),this.cea608Parser2=new Ms(3,r,n)}},{key:"addCues",value:function(e,t,r,n,a){for(var i,s,o,l,c=!1,u=a.length;u--;){var h=a[u],d=(i=h[0],s=h[1],o=t,l=r,Math.min(s,l)-Math.max(i,o));if(d>=0&&(h[0]=Math.min(h[0],t),h[1]=Math.max(h[1],r),c=!0,d/(r-t)>.5))return}if(c||a.push([t,r]),this.config.renderTextTracksNatively){var f=this.captionsTracks[e];this.Cues.newCue(f,t,r,n)}else{var p=this.Cues.newCue(null,t,r,n);this.hls.trigger(x.CUES_PARSED,{type:"captions",cues:p,track:e})}}},{key:"onInitPtsFound",value:function(e,t){var r=this,n=t.frag,a=t.id,i=t.initPTS,s=t.timescale,o=this.unparsedVttFrags;a===B&&(this.initPTS[n.cc]={baseTime:i,timescale:s}),o.length&&(this.unparsedVttFrags=[],_forEachInstanceProperty(o).call(o,(function(e){r.onFragLoaded(x.FRAG_LOADED,e)})))}},{key:"getExistingTrack",value:function(e,t){var r=this.media;if(r)for(var n=0;n<r.textTracks.length;n++){var a=r.textTracks[n];if(fo(a,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound",attrs:{}}))return a}return null}},{key:"createCaptionsTrack",value:function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}},{key:"createNativeTrack",value:function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,r=this.captionsTracks,n=this.media,a=t[e],i=a.label,s=a.languageCode,o=this.getExistingTrack(i,s);if(o)r[e]=o,ns(r[e]),ts(r[e],n);else{var l=this.createTextTrack("captions",i,s);l&&(l[e]=!0,r[e]=l)}}}},{key:"createNonNativeTrack",value:function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var r={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(x.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}}}},{key:"createTextTrack",value:function(e,t,r){var n=this.media;if(n)return n.addTextTrack(e,t,r)}},{key:"onMediaAttaching",value:function(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}},{key:"onMediaDetaching",value:function(e,t){var r,n=!!t.transferMedia;if(this.media=null,!n){var a=this.captionsTracks;_forEachInstanceProperty(r=_Object$keys(a)).call(r,(function(e){ns(a[e]),delete a[e]})),this.nonNativeCaptionsTracks={}}}},{key:"onManifestLoading",value:function(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}},{key:"_cleanTracks",value:function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var r=0;r<t.length;r++)ns(t[r])}}},{key:"onSubtitleTracksUpdated",value:function(e,t){var r=this,n=t.subtitleTracks||[],a=_someInstanceProperty(n).call(n,(function(e){return e.textCodec===Zs}));if(this.config.enableWebVTT||a&&this.config.enableIMSC1){if(fi(this.tracks,n))return void(this.tracks=n);if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){var i,s=this.media,o=s?is(s.textTracks):null;if(_forEachInstanceProperty(i=this.tracks).call(i,(function(e,t){var n;if(o){for(var a=null,i=0;i<o.length;i++)if(o[i]&&fo(o[i],e)){a=o[i],o[i]=null;break}a&&(n=a)}if(n)ns(n);else{var s=ho(e);(n=r.createTextTrack(s,e.name,e.lang))&&(n.mode="disabled")}n&&r.textTracks.push(n)})),null!=o&&o.length){var l,c=_mapInstanceProperty(l=_filterInstanceProperty(o).call(o,(function(e){return null!==e}))).call(l,(function(e){return e.label}));c.length&&this.hls.logger.warn("Media element contains unused subtitle tracks: ".concat(c.join(", "),". Replace media element for each source to clear TextTracks and captions menu."))}}else if(this.tracks.length){var u,h=_mapInstanceProperty(u=this.tracks).call(u,(function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}));this.hls.trigger(x.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}}},{key:"onManifestLoaded",value:function(e,t){var r,n=this;this.config.enableCEA708Captions&&t.captions&&_forEachInstanceProperty(r=t.captions).call(r,(function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(t){var r="textTrack".concat(t[1]),a=n.captionsProperties[r];a&&(a.label=e.name,e.lang&&(a.languageCode=e.lang),a.media=e)}}))}},{key:"closedCaptionsForLevel",value:function(e){var t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}},{key:"onFragLoading",value:function(e,t){if(this.enabled&&t.frag.type===B){var r,n,a=this.cea608Parser1,i=this.cea608Parser2,s=this.lastSn,o=t.frag,l=o.cc,c=o.sn,u=null!=(r=null==(n=t.part)?void 0:n.index)?r:-1;a&&i&&(c!==s+1||c===s&&u!==this.lastPartIndex+1||l!==this.lastCc)&&(a.reset(),i.reset()),this.lastCc=l,this.lastSn=c,this.lastPartIndex=u}}},{key:"onFragLoaded",value:function(e,t){var r=t.frag,n=t.payload;if(r.type===G)if(n.byteLength){var a=r.decryptdata,i="stats"in t;if(null==a||!a.encrypted||i){var s=this.tracks[r.level],o=this.vttCCs;o[r.cc]||(o[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),s&&s.textCodec===Zs?this._parseIMSC1(r,n):this._parseVTTs(t)}}else this.hls.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}},{key:"_parseIMSC1",value:function(e,t){var r=this,n=this.hls;no(t,this.initPTS[e.cc],(function(t){r._appendCues(t,e.level),n.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){n.logger.log("Failed to parse IMSC1: ".concat(t)),n.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}},{key:"_parseVTTs",value:function(e){var t,r=this,n=e.frag,a=e.payload,i=this.initPTS,s=this.unparsedVttFrags,o=i.length-1;if(i[n.cc]||-1!==o){var l=this.hls;Js(null!=(t=n.initSegment)&&t.data?Qt(n.initSegment.data,new Uint8Array(a)).buffer:a,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,(function(e){r._appendCues(e,n.level),l.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})}),(function(t){var i="Missing initPTS for VTT MPEGTS"===t.message;i?s.push(e):r._fallbackToIMSC1(n,a),l.logger.log("Failed to parse VTT cue: ".concat(t)),i&&o>n.cc||l.trigger(x.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:t})}))}else s.push(e)}},{key:"_fallbackToIMSC1",value:function(e,t){var r=this,n=this.tracks[e.level];n.textCodec||no(t,this.initPTS[e.cc],(function(){n.textCodec=Zs,r._parseIMSC1(e,t)}),(function(){n.textCodec="wvtt"}))}},{key:"_appendCues",value:function(e,t){var r=this.hls;if(this.config.renderTextTracksNatively){var n=this.textTracks[t];if(!n||"disabled"===n.mode)return;_forEachInstanceProperty(e).call(e,(function(e){return rs(n,e)}))}else{var a=this.tracks[t];if(!a)return;var i=a.default?"default":"subtitles"+t;r.trigger(x.CUES_PARSED,{type:"subtitles",cues:e,track:i})}}},{key:"onFragDecrypted",value:function(e,t){t.frag.type===G&&this.onFragLoaded(x.FRAG_LOADED,t)}},{key:"onSubtitleTracksCleared",value:function(){this.tracks=[],this.captionsTracks={}}},{key:"onFragParsingUserdata",value:function(e,t){if(this.enabled&&this.config.enableCEA708Captions){var r=t.frag,n=t.samples;if(r.type!==B||"NONE"!==this.closedCaptionsForLevel(r))for(var a=0;a<n.length;a++){var i=n[a].bytes;if(i){this.cea608Parser1||this.initCea608Parsers();var s=this.extractCea608Data(i);this.cea608Parser1.addData(n[a].pts,s[0]),this.cea608Parser2.addData(n[a].pts,s[1])}}}}},{key:"onBufferFlushing",value:function(e,t){var r=t.startOffset,n=t.endOffset,a=t.endOffsetSubtitles,i=t.type,s=this.media;if(s&&!(s.currentTime<n)){if(!i||"video"===i){var o,l=this.captionsTracks;_forEachInstanceProperty(o=_Object$keys(l)).call(o,(function(e){return as(l[e],r,n)}))}if(this.config.renderTextTracksNatively&&0===r&&void 0!==a){var c,u=this.textTracks;_forEachInstanceProperty(c=_Object$keys(u)).call(c,(function(e){return as(u[e],r,a)}))}}}},{key:"extractCea608Data",value:function(e){for(var t=[[],[]],r=31&e[0],n=2,a=0;a<r;a++){var i=e[n++],s=127&e[n++],o=127&e[n++];if((0!==s||0!==o)&&0!=(4&i)){var l=3&i;0!==l&&1!==l||(t[l].push(s),t[l].push(o))}}return t}}]),e}(),audioStreamController:function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n,a){var i;return _classCallCheck(this,r),(i=t.call(this,e,n,a,"audio-stream-controller",j)).mainAnchor=null,i.mainFragLoading=null,i.audioOnly=!1,i.bufferedTrack=null,i.switchingTrack=null,i.trackId=-1,i.waitingData=null,i.mainDetails=null,i.flushing=!1,i.bufferFlushed=!1,i.cachedTrackLoadedData=null,i.registerListeners(),i}return _createClass(r,[{key:"onHandlerDestroying",value:function(){this.unregisterListeners(),_get(_getPrototypeOf(r.prototype),"onHandlerDestroying",this).call(this),this.resetItem()}},{key:"resetItem",value:function(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}},{key:"registerListeners",value:function(){_get(_getPrototypeOf(r.prototype),"registerListeners",this).call(this);var e=this.hls;e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(x.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(x.BUFFER_RESET,this.onBufferReset,this),e.on(x.BUFFER_CREATED,this.onBufferCreated,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(x.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(x.FRAG_LOADING,this.onFragLoading,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(_get(_getPrototypeOf(r.prototype),"unregisterListeners",this).call(this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(x.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(x.BUFFER_RESET,this.onBufferReset,this),e.off(x.BUFFER_CREATED,this.onBufferCreated,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(x.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(x.FRAG_LOADING,this.onFragLoading,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this))}},{key:"onInitPtsFound",value:function(e,t){var r=t.frag,n=t.id,a=t.initPTS,i=t.timescale;if(n===B){var s,o,l=r.cc,c=this.fragCurrent;if(this.initPTS[l]={baseTime:a,timescale:i},this.log(_concatInstanceProperty(s=_concatInstanceProperty(o="InitPTS for cc: ".concat(l," found from main: ")).call(o,a,"/")).call(s,i)),this.mainAnchor=r,this.state===Mn){var u=this.waitingData;(!u&&!this.loadingParts||u&&u.frag.cc!==l)&&(this.nextLoadPosition=this.findSyncFrag(r).start),this.tick()}else!this.hls.hasEnoughToStart&&c&&c.cc!==l?(this.startFragRequested=!1,this.nextLoadPosition=this.findSyncFrag(r).start,c.abortRequests(),this.resetLoadingState()):this.state===kn&&this.tick()}}},{key:"findSyncFrag",value:function(e){var t=this.getLevelDetails(),r=e.cc;return function(e,t,r){if(e&&e.startCC<=t&&e.endCC>=t){var n=r.start,a=r.end,i=e.fragments;if(!r.relurl){var s=e.fragmentHint;s&&(i=_concatInstanceProperty(i).call(i,s))}return Fe(i,(function(e){return e.cc<t||e.end<=n?1:e.cc>t||e.start>=a?-1:0}))}return null}(t,r,e)||t&&Ge(t.fragments,r)||e}},{key:"startLoad",value:function(e){if(!this.levels)return this.startPosition=e,void(this.state=bn);var t=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),t>0&&-1===e?(this.log("Override startPosition with lastCurrentTime @".concat(t.toFixed(3))),e=t,this.state=kn):this.state=Ln,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}},{key:"doTick",value:function(){switch(this.state){case kn:this.doTickIdle();break;case Ln:var e=this.levels,t=this.trackId,n=null==e?void 0:e[t],a=null==n?void 0:n.details;if(a&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(a))break;this.state=Mn}break;case On:var i,s=performance.now(),o=this.retryDate;if(!o||s>=o||null!=(i=this.media)&&i.seeking){var l=this.levels,c=this.trackId;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==l?void 0:l[c])||null),this.state=kn}break;case Mn:var u=this.waitingData;if(u){var h,d=u.frag,f=u.part,p=u.cache,y=u.complete,g=this.mainAnchor;if(void 0!==this.initPTS[d.cc]){this.waitingData=null,this.state=Rn;var v={frag:d,part:f,payload:p.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(v),y&&_get(_getPrototypeOf(r.prototype),"_handleFragmentLoadComplete",this).call(this,v)}else g&&g.cc!==u.frag.cc&&(this.log(_concatInstanceProperty(h="Waiting fragment cc (".concat(d.cc,") cancelled because video is at cc ")).call(h,g.cc)),this.nextLoadPosition=this.findSyncFrag(g).start,this.clearWaitingFragment())}else this.state=kn}this.onTickEnd()}},{key:"clearWaitingFragment",value:function(){var e=this.waitingData;e&&(this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.state!==bn&&(this.state=kn))}},{key:"resetLoadingState",value:function(){this.clearWaitingFragment(),_get(_getPrototypeOf(r.prototype),"resetLoadingState",this).call(this)}},{key:"onTickEnd",value:function(){var e=this.media;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}},{key:"doTickIdle",value:function(){var e,t=this.hls,r=this.levels,n=this.media,a=this.trackId,i=t.config;if(this.buffering&&(n||!this.startFragRequested&&i.startFragPrefetch)&&null!=r&&r[a]){var s=r[a],o=s.details;if(!o||this.waitForLive(s)||this.waitForCdnTuneIn(o))return this.state=Ln,void(this.startFragRequested=!1);var l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,bt,j));var c=this.getFwdBufferInfo(l,j);if(null!==c){var u=this.bufferedTrack,h=this.switchingTrack;if(!h&&this._streamEnded(c,o))return t.trigger(x.BUFFER_EOS,{type:"audio"}),void(this.state=wn);var d=c.len,f=t.maxBufferLength,p=o.fragments,y=p[0].start,g=this.getLoadPosition(),v=this.flushing?g:c.end;if(h&&n){var m=g;u&&!pi(h.attrs,u.attrs)&&(v=m),o.PTSKnown&&m<y&&(c.end>y||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=y+.05)}if(!(d>=f&&!h&&v<p[p.length-1].start)){var $=this.getNextFragment(v,o);if($&&this.isLoopLoading($,v)&&($=this.getNextFragmentLoopLoading($,o,c,B,f)),$){var S=null==(e=this.mainFragLoading)?void 0:e.frag;if(!this.audioOnly&&this.startFragRequested&&S&&Ot(S)&&Ot($)&&!$.endList&&(!o.live||!this.loadingParts&&v<this.hls.liveSyncPosition)){var I=S;if($.start>I.end){var _=this.fragmentTracker.getFragAtPos(v,B);_&&_.end>S.end&&(I=_,this.mainFragLoading={frag:_,targetBufferTime:null})}if($.start>I.end)return}this.loadFragment($,s,v)}else this.bufferFlushed=!0}}}}},{key:"onMediaDetaching",value:function(e,t){this.bufferFlushed=this.flushing=!1,_get(_getPrototypeOf(r.prototype),"onMediaDetaching",this).call(this,e,t)}},{key:"onAudioTracksUpdated",value:function(e,t){var r=t.audioTracks;this.resetTransmuxer(),this.levels=_mapInstanceProperty(r).call(r,(function(e){return new ke(e)}))}},{key:"onAudioTrackSwitching",value:function(e,t){var r=!!t.url;this.trackId=t.id;var n=this.fragCurrent;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),r?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==bn&&(this.setInterval(100),this.state=kn,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}},{key:"onManifestLoading",value:function(){_get(_getPrototypeOf(r.prototype),"onManifestLoading",this).call(this),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}},{key:"onLevelLoaded",value:function(e,t){this.mainDetails=t.details;var r=this.cachedTrackLoadedData;r&&(this.cachedTrackLoadedData=null,this.hls.trigger(x.AUDIO_TRACK_LOADED,r))}},{key:"onAudioTrackLoaded",value:function(e,t){var r,n,a,i,s,o,l=this.levels,c=t.details,u=t.id,h=this.mainDetails;if(!h||h.expired||c.endCC>h.endCC)return this.cachedTrackLoadedData=t,void(this.state!==bn&&(this.state=Ln));if(l){this.log(_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i="Audio track ".concat(u," loaded [")).call(i,c.startSN,",")).call(a,c.endSN,"]")).call(n,c.lastPartSn?_concatInstanceProperty(s="[part-".concat(c.lastPartSn,"-")).call(s,c.lastPartIndex,"]"):"",",duration:")).call(r,c.totalduration));var d=l[u],f=0;if(c.live||null!=(o=d.details)&&o.live){if(this.checkLiveUpdate(c),c.deltaUpdateFailed)return;var p;d.details&&(f=this.alignPlaylists(c,d.details,null==(p=this.levelLastLoaded)?void 0:p.details)),c.alignedSliding||(En(c,h),c.alignedSliding||Tn(c,h),f=c.fragmentStart)}d.details=c,this.levelLastLoaded=d,this.startFragRequested||this.setStartPosition(h,f),this.hls.trigger(x.AUDIO_TRACK_UPDATED,{details:c,id:u,groupId:t.groupId}),this.state!==Ln||this.waitForCdnTuneIn(c)||(this.state=kn),this.tick()}else this.warn("Audio tracks were reset while loading level ".concat(u))}},{key:"_handleFragmentLoadProgress",value:function(e){var t,r,n,a,i=e.frag,s=e.part,o=e.payload,l=this.config,c=this.trackId,u=this.levels;if(u){var h=u[c];if(h){var d=h.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);var f=l.defaultAudioCodec||h.audioCodec||"mp4a.40.2",p=this.transmuxer;p||(p=this.transmuxer=new di(this.hls,j,_bindInstanceProperty(r=this._handleTransmuxComplete).call(r,this),_bindInstanceProperty(n=this._handleTransmuxerFlush).call(n,this)));var y=this.initPTS[i.cc],g=null==(a=i.initSegment)?void 0:a.data;if(void 0!==y){var v=!1,m=s?s.index:-1,$=-1!==m,S=new hr(i.level,i.sn,i.stats.chunkCount,o.byteLength,m,$);p.push(o,g,f,"",i,s,d.totalduration,v,S,y)}else{var I,_,E,T;this.log(_concatInstanceProperty(I=_concatInstanceProperty(_=_concatInstanceProperty(E=_concatInstanceProperty(T="Unknown video PTS for cc ".concat(i.cc,", waiting for video PTS before demuxing audio frag ")).call(T,i.sn," of [")).call(E,d.startSN," ,")).call(_,d.endSN,"],track ")).call(I,c)),(this.waitingData=this.waitingData||{frag:i,part:s,cache:new Un,complete:!1}).cache.push(new Uint8Array(o)),this.state!==bn&&(this.state=Mn)}}else this.warn("Audio track is undefined on fragment load progress")}else this.warn(_concatInstanceProperty(t="Audio tracks were reset while fragment load was in progress. Fragment ".concat(i.sn," of level ")).call(t,i.level," will not be buffered"))}},{key:"_handleFragmentLoadComplete",value:function(e){this.waitingData?this.waitingData.complete=!0:_get(_getPrototypeOf(r.prototype),"_handleFragmentLoadComplete",this).call(this,e)}},{key:"onBufferReset",value:function(){this.mediaBuffer=null}},{key:"onBufferCreated",value:function(e,t){this.bufferFlushed=this.flushing=!1;var r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer||null)}},{key:"onFragLoading",value:function(e,t){!this.audioOnly&&t.frag.type===B&&Ot(t.frag)&&(this.mainFragLoading=t,this.state===kn&&this.tick())}},{key:"onFragBuffered",value:function(e,t){var r,n,a,i,s=t.frag,o=t.part;if(s.type===j)if(this.fragContextChanged(s))this.warn(_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i="Fragment ".concat(s.sn)).call(i,o?" p: "+o.index:""," of level ")).call(a,s.level," finished buffering, but was aborted. state: ")).call(n,this.state,", audioSwitch: ")).call(r,this.switchingTrack?this.switchingTrack.name:"false"));else{if(Ot(s)){this.fragPrevious=s;var l=this.switchingTrack;l&&(this.bufferedTrack=l,this.switchingTrack=null,this.hls.trigger(x.AUDIO_TRACK_SWITCHED,q({},l)))}this.fragBufferedComplete(s,o),this.media&&this.tick()}else this.audioOnly||s.type!==B||s.elementaryStreams.video||s.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)}},{key:"onError",value:function(e,t){var n;if(t.fatal)this.state=xn;else switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(j,t);break;case w.AUDIO_TRACK_LOAD_ERROR:case w.AUDIO_TRACK_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Ln||(null==(n=t.context)?void 0:n.type)!==F||(this.state=kn);break;case w.BUFFER_APPEND_ERROR:case w.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===w.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,_get(_getPrototypeOf(r.prototype),"flushMainBuffer",this).call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}},{key:"onBufferFlushing",value:function(e,t){t.type!==kt&&(this.flushing=!0)}},{key:"onBufferFlushed",value:function(e,t){var r=t.type;if(r!==kt){this.flushing=!1,this.bufferFlushed=!0,this.state===wn&&(this.state=kn);var n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,r,j),this.tick())}}},{key:"_handleTransmuxComplete",value:function(e){var t,r="audio",n=this.hls,a=e.remuxResult,i=e.chunkMeta,s=this.getCurrentContext(i);if(s){var o=s.frag,l=s.part,c=s.level,u=c.details,h=a.audio,d=a.text,f=a.id3,p=a.initSegment;if(!this.fragContextChanged(o)&&u){if(this.state=Cn,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),null!=p&&p.tracks){var y=o.initSegment||o;this._bufferInitSegment(c,p.tracks,y,i),n.trigger(x.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:r,tracks:p.tracks})}if(h){var g=h.startPTS,v=h.endPTS,m=h.startDTS,$=h.endDTS;l&&(l.elementaryStreams[bt]={startPTS:g,endPTS:v,startDTS:m,endDTS:$}),o.setElementaryStreamInfo(bt,g,v,m,$),this.bufferFragmentData(h,o,l,i)}if(null!=f&&null!=(t=f.samples)&&t.length){var S=W({id:r,frag:o,details:u},f);n.trigger(x.FRAG_PARSING_METADATA,S)}if(d){var I=W({id:r,frag:o,details:u},d);n.trigger(x.FRAG_PARSING_USERDATA,I)}}else this.fragmentTracker.removeFragment(o)}else this.resetWhenMissingContext(i)}},{key:"_bufferInitSegment",value:function(e,t,r,n){var a,i;if(this.state===Cn&&(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,t.audio)){var s=t.audio;s.id="audio";var o=e.audioCodec;this.log(_concatInstanceProperty(a=_concatInstanceProperty(i="Init audio buffer, container:".concat(s.container,", codecs[level/parsed]=[")).call(i,o,"/")).call(a,s.codec,"]")),o&&1===o.split(",").length&&(s.levelCodec=o),this.hls.trigger(x.BUFFER_CODECS,t);var l=s.initSegment;if(null!=l&&l.byteLength){var c={type:"audio",frag:r,part:null,chunkMeta:n,parent:r.type,data:l};this.hls.trigger(x.BUFFER_APPENDING,c)}this.tickImmediate()}}},{key:"loadFragment",value:function(e,t,n){var a,i=this.fragmentTracker.getState(e);if(this.switchingTrack||i===rt||i===at)if(Ot(e))if(null!=(a=t.details)&&a.live&&!this.initPTS[e.cc]){var s,o;this.log(_concatInstanceProperty(s=_concatInstanceProperty(o="Waiting for video PTS in continuity counter ".concat(e.cc," of live stream before loading audio fragment ")).call(o,e.sn," of level ")).call(s,this.trackId)),this.state=Mn;var l=this.mainDetails;l&&l.fragmentStart!==t.details.fragmentStart&&Tn(t.details,l)}else _get(_getPrototypeOf(r.prototype),"loadFragment",this).call(this,e,t,n);else this._loadInitSegment(e,t);else this.clearTrackerIfNeeded(e)}},{key:"flushAudioIfNeeded",value:function(e){var t=this.media,n=this.bufferedTrack,a=null==n?void 0:n.attrs,i=e.attrs;t&&a&&(a.CHANNELS!==i.CHANNELS||n.name!==e.name||n.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),_get(_getPrototypeOf(r.prototype),"flushMainBuffer",this).call(this,0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}},{key:"completeAudioSwitch",value:function(e){var t=this.hls;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(x.AUDIO_TRACK_SWITCHED,q({},e))}}]),r}(Fn),audioTrackController:function(e){_inherits(r,e);var t=_createSuper(r);function r(e){var n;return _classCallCheck(this,r),(n=t.call(this,e,"audio-track-controller")).tracks=[],n.groupIds=null,n.tracksInGroup=[],n.trackId=-1,n.currentTrack=null,n.selectDefaultTrack=!0,n.registerListeners(),n}return _createClass(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(x.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(x.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.LEVEL_LOADING,this.onLevelLoading,this),e.off(x.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(x.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(x.ERROR,this.onError,this)}},{key:"destroy",value:function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,_get(_getPrototypeOf(r.prototype),"destroy",this).call(this)}},{key:"onManifestLoading",value:function(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}},{key:"onManifestParsed",value:function(e,t){this.tracks=t.audioTracks||[]}},{key:"onAudioTrackLoaded",value:function(e,t){var r,n,a,i,s,o,l,c=t.id,u=t.groupId,h=t.details,d=this.tracksInGroup[c];if(d&&d.groupId===u){var f=d.details;d.details=t.details,this.log(_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o=_concatInstanceProperty(l="Audio track ".concat(c,' "')).call(l,d.name,'" lang:')).call(o,d.lang," group:")).call(s,u," loaded [")).call(i,h.startSN,"-")).call(a,h.endSN,"]")),c===this.trackId&&this.playlistLoaded(c,t,f)}else this.warn(_concatInstanceProperty(r=_concatInstanceProperty(n="Audio track with id:".concat(c," and group:")).call(n,u," not found in active group ")).call(r,null==d?void 0:d.groupId))}},{key:"onLevelLoading",value:function(e,t){this.switchLevel(t.level)}},{key:"onLevelSwitching",value:function(e,t){this.switchLevel(t.level)}},{key:"switchLevel",value:function(e){var t=this.hls.levels[e];if(t){var r=t.audioGroups||null,n=this.groupIds,a=this.currentTrack;if(!r||(null==n?void 0:n.length)!==(null==r?void 0:r.length)||null!=r&&_someInstanceProperty(r).call(r,(function(e){return-1===(null==n?void 0:_indexOfInstanceProperty(n).call(n,e))}))){var i,s;this.groupIds=r,this.trackId=-1,this.currentTrack=null;var o=_filterInstanceProperty(i=this.tracks).call(i,(function(e){return!r||-1!==_indexOfInstanceProperty(r).call(r,e.groupId)}));if(o.length)this.selectDefaultTrack&&!_someInstanceProperty(o).call(o,(function(e){return e.default}))&&(this.selectDefaultTrack=!1),_forEachInstanceProperty(o).call(o,(function(e,t){e.id=t}));else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=o;var l=this.hls.config.audioPreference;if(!a&&l){var c=De(l,o,xe);if(c>-1)a=o[c];else{var u=De(l,this.tracks);a=this.tracks[u]}}var h=this.findTrackId(a);-1===h&&a&&(h=this.findTrackId(null));var d={audioTracks:o};this.log(_concatInstanceProperty(s="Updating audio tracks, ".concat(o.length," track(s) found in group(s): ")).call(s,null==r?void 0:r.join(","))),this.hls.trigger(x.AUDIO_TRACKS_UPDATED,d);var f=this.trackId;if(-1!==h&&-1===f)this.setAudioTrack(h);else if(o.length&&-1===f){var p,y,g=new Error(_concatInstanceProperty(p="No audio track selected for current audio group-ID(s): ".concat(null==(y=this.groupIds)?void 0:y.join(",")," track count: ")).call(p,o.length));this.warn(g.message),this.hls.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:g})}}}}},{key:"onError",value:function(e,t){var r;!t.fatal&&t.context&&(t.context.type!==F||t.context.id!==this.trackId||this.groupIds&&-1===_indexOfInstanceProperty(r=this.groupIds).call(r,t.context.groupId)||this.checkRetry(t))}},{key:"allAudioTracks",get:function(){return this.tracks}},{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}},{key:"setAudioOption",value:function(e){var t=this.hls;if(t.config.audioPreference=e,e){var r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){var n=this.currentTrack;if(n&&we(e,n,xe))return n;var a=De(e,this.tracksInGroup,xe);if(a>-1){var i=this.tracksInGroup[a];return this.setAudioTrack(a),i}if(n){var s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);var o=function(e,t,r,n,a){var i=t[n],s=_reduceInstanceProperty(t).call(t,(function(e,t,r){var n=t.uri;return(e[n]||(e[n]=[])).push(r),e}),{})[i.uri];s.length>1&&(n=Math.max.apply(Math,s));var o=i.videoRange,l=i.frameRate,c=i.codecSet.substring(0,4),u=Me(t,n,(function(t){if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==c)return!1;var n=t.audioGroups,i=_filterInstanceProperty(r).call(r,(function(e){return!n||-1!==_indexOfInstanceProperty(n).call(n,e.groupId)}));return De(e,i,a)>-1}));return u>-1?u:Me(t,n,(function(t){var n=t.audioGroups,i=_filterInstanceProperty(r).call(r,(function(e){return!n||-1!==_indexOfInstanceProperty(n).call(n,e.groupId)}));return De(e,i,a)>-1}))}(e,t.levels,r,s,xe);if(-1===o)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){var l=De(e,r);if(l>-1)return r[l]}}}return null}},{key:"setAudioTrack",value:function(e){var t,r,n,a,i=this.tracksInGroup;if(e<0||e>=i.length)this.warn("Invalid audio track id: ".concat(e));else{this.selectDefaultTrack=!1;var s=this.currentTrack,o=i[e],l=o.details&&!o.details.live;if(!(e===this.trackId&&o===s&&l||(this.log(_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a="Switching to audio-track ".concat(e,' "')).call(a,o.name,'" lang:')).call(n,o.lang," group:")).call(r,o.groupId," channels:")).call(t,o.channels)),this.trackId=e,this.currentTrack=o,this.hls.trigger(x.AUDIO_TRACK_SWITCHING,q({},o)),l))){var c=this.switchParams(o.url,null==s?void 0:s.details,o.details);this.loadPlaylist(c)}}}},{key:"findTrackId",value:function(e){for(var t=this.tracksInGroup,r=0;r<t.length;r++){var n=t[r];if((!this.selectDefaultTrack||n.default)&&(!e||we(e,n,xe)))return r}if(e){for(var a=e.name,i=e.lang,s=e.assocLang,o=e.characteristics,l=e.audioCodec,c=e.channels,u=0;u<t.length;u++)if(we({name:a,lang:i,assocLang:s,characteristics:o,audioCodec:l,channels:c},t[u],xe))return u;for(var h=0;h<t.length;h++){var d=t[h];if(pi(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return h}for(var f=0;f<t.length;f++){var p=t[f];if(pi(e.attrs,p.attrs,["LANGUAGE"]))return f}}return-1}},{key:"loadPlaylist",value:function(e){_get(_getPrototypeOf(r.prototype),"loadPlaylist",this).call(this);var t=this.currentTrack;this.shouldLoadPlaylist(t)&&Ne(t.url,this.hls)&&this.scheduleLoading(t,e)}},{key:"loadingPlaylist",value:function(e,t){var n,a,i,s,o,l;_get(_getPrototypeOf(r.prototype),"loadingPlaylist",this).call(this,e,t);var c=e.id,u=e.groupId,h=this.getUrlWithDirectives(e.url,t),d=e.details,f=null==d?void 0:d.age;this.log(_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o=_concatInstanceProperty(l="Loading audio-track ".concat(c,' "')).call(l,e.name,'" lang:')).call(o,e.lang," group:")).call(s,u)).call(i,void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")).call(a,f&&d.live?" age "+f.toFixed(1)+(d.type&&" "+d.type||""):""," ")).call(n,h)),this.hls.trigger(x.AUDIO_TRACK_LOADING,{url:h,id:c,groupId:u,deliveryDirectives:t||null,track:e})}}]),r}(gi),emeController:Zi,cmcdController:function(){function e(t){var r=this;_classCallCheck(this,e),this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(e){try{r.apply(e,{ot:Ti.MANIFEST,su:!r.initialized})}catch(e){r.hls.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var t=e.frag,n=e.part,a=r.hls.levels[t.level],i=r.getObjectType(t),s={d:1e3*(n||t).duration,ot:i};i!==Ti.VIDEO&&i!==Ti.AUDIO&&i!=Ti.MUXED||(s.br=a.bitrate/1e3,s.tb=r.getTopBandwidth(i)/1e3,s.bl=r.getBufferLength(i));var o=n?r.getNextPart(n):r.getNextFrag(t);null!=o&&o.url&&o.url!==t.url&&(s.nor=o.url),r.apply(e,s)}catch(e){r.hls.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=t;var n=this.config=t.config,a=n.cmcd;null!=a&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||t.sessionId,this.cid=a.contentId,this.useHeaders=!0===a.useHeaders,this.includeKeys=a.includeKeys,this.registerListeners())}return _createClass(e,[{key:"registerListeners",value:function(){var e=this.hls;e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHED,this.onMediaDetached,this),e.on(x.BUFFER_CREATED,this.onBufferCreated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHED,this.onMediaDetached,this),e.off(x.BUFFER_CREATED,this.onBufferCreated,this)}},{key:"destroy",value:function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}},{key:"onMediaAttached",value:function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}},{key:"onMediaDetached",value:function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}},{key:"onBufferCreated",value:function(e,t){var r,n;this.audioBuffer=null==(r=t.tracks.audio)?void 0:r.buffer,this.videoBuffer=null==(n=t.tracks.video)?void 0:n.buffer}},{key:"createData",value:function(){var e;return{v:1,sf:Pi.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}},{key:"apply",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};W(r,this.createData());var n=r.ot===Ti.INIT||r.ot===Ti.VIDEO||r.ot===Ti.MUXED;this.starved&&n&&(r.bs=!0,r.su=!0,this.starved=!1),null==r.su&&(r.su=this.buffering);var a=this.includeKeys;a&&(r=_reduceInstanceProperty(t=_Object$keys(r)).call(t,(function(e,t){return _includesInstanceProperty(a).call(a,t)&&(e[t]=r[t]),e}),{}));var i={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),qi(e.headers,r,i)):e.url=Xi(e.url,r,i)}},{key:"getNextFrag",value:function(e){var t,r=null==(t=this.hls.levels[e.level])?void 0:t.details;if(r){var n=e.sn-r.startSN;return r.fragments[n+1]}}},{key:"getNextPart",value:function(e){var t,r,n=e.index,a=e.fragment,i=null==(t=this.hls.levels[a.level])||null==(r=t.details)?void 0:r.partList;if(i)for(var s=a.sn,o=i.length-1;o>=0;o--){var l=i[o];if(l.index===n&&l.fragment.sn===s)return i[o+1]}}},{key:"getObjectType",value:function(e){var t=e.type;return"subtitle"===t?Ti.TIMED_TEXT:"initSegment"===e.sn?Ti.INIT:"audio"===t?Ti.AUDIO:"main"===t?this.hls.audioTracks.length?Ti.VIDEO:Ti.MUXED:void 0}},{key:"getTopBandwidth",value:function(e){var t,r=0,n=this.hls;if(e===Ti.AUDIO)t=n.audioTracks;else{var a,i=n.maxAutoLevel,s=i>-1?i+1:n.levels.length;t=_sliceInstanceProperty(a=n.levels).call(a,0,s)}var o,l=_createForOfIteratorHelper(t);try{for(l.s();!(o=l.n()).done;){var c=o.value;c.bitrate>r&&(r=c.bitrate)}}catch(e){l.e(e)}finally{l.f()}return r>0?r:NaN}},{key:"getBufferLength",value:function(e){var t=this.media,r=e===Ti.AUDIO?this.audioBuffer:this.videoBuffer;return r&&t?1e3*fr.bufferInfo(r,t.currentTime,this.config.maxBufferHole).len:NaN}},{key:"createPlaylistLoader",value:function(){var e=this.config.pLoader,t=this.applyPlaylistData,r=e||this.config.loader;return function(){function e(t){_classCallCheck(this,e),this.loader=void 0,this.loader=new r(t)}return _createClass(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}},{key:"destroy",value:function(){this.loader.destroy()}},{key:"abort",value:function(){this.loader.abort()}},{key:"load",value:function(e,r,n){t(e),this.loader.load(e,r,n)}}]),e}()}},{key:"createFragmentLoader",value:function(){var e=this.config.fLoader,t=this.applyFragmentData,r=e||this.config.loader;return function(){function e(t){_classCallCheck(this,e),this.loader=void 0,this.loader=new r(t)}return _createClass(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}},{key:"destroy",value:function(){this.loader.destroy()}},{key:"abort",value:function(){this.loader.abort()}},{key:"load",value:function(e,r,n){t(e),this.loader.load(e,r,n)}}]),e}()}}]),e}(),contentSteeringController:function(e){_inherits(r,e);var t=_createSuper(r);function r(e){var n;return _classCallCheck(this,r),(n=t.call(this,"content-steering",e.logger)).hls=void 0,n.loader=null,n.uri=null,n.pathwayId=".",n._pathwayPriority=null,n.timeToLoad=300,n.reloadTimer=-1,n.updated=0,n.started=!1,n.enabled=!0,n.levels=null,n.audioTracks=null,n.subtitleTracks=null,n.penalizedPathways={},n.hls=e,n.registerListeners(),n}return _createClass(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.ERROR,this.onError,this))}},{key:"pathways",value:function(){var e;return _reduceInstanceProperty(e=this.levels||[]).call(e,(function(e,t){return-1===_indexOfInstanceProperty(e).call(e,t.pathwayId)&&e.push(t.pathwayId),e}),[])}},{key:"pathwayPriority",get:function(){return this._pathwayPriority},set:function(e){this.updatePathwayPriority(e)}},{key:"startLoad",value:function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}},{key:"stopLoad",value:function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}},{key:"clearTimeout",value:function(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}},{key:"destroy",value:function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}},{key:"removeLevel",value:function(e){var t=this.levels;t&&(this.levels=_filterInstanceProperty(t).call(t,(function(t){return t!==e})))}},{key:"onManifestLoading",value:function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}},{key:"onManifestLoaded",value:function(e,t){var r=t.contentSteering;null!==r&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}},{key:"onManifestParsed",value:function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}},{key:"onError",value:function(e,t){var r=t.errorAction;if((null==r?void 0:r.action)===ze&&_flagsInstanceProperty(r)===Ze){var n,a,i,s,o,l=this.levels,c=this._pathwayPriority,u=this.pathwayId;if(t.context){var h=t.context,d=h.groupId,f=h.pathwayId,p=h.type;d&&l?u=this.getPathwayForGroupId(d,p,u):f&&(u=f)}u in this.penalizedPathways||(this.penalizedPathways[u]=performance.now()),!c&&l&&(c=this.pathways()),c&&c.length>1&&(this.updatePathwayPriority(c),r.resolved=this.pathwayId!==u),r.resolved||this.warn(_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o="Could not resolve ".concat(t.details,' ("')).call(o,t.error.message,'") with content-steering for Pathway: ')).call(s,u," levels: ")).call(i,l?l.length:l," priorities: ")).call(a,_JSON$stringify(c)," penalized: ")).call(n,_JSON$stringify(this.penalizedPathways)))}}},{key:"filterParsedLevels",value:function(e){var t,r;this.levels=e;var n=this.getLevelsForPathway(this.pathwayId);if(0===n.length){var a,i=e[0].pathwayId;this.log(_concatInstanceProperty(a="No levels found in Pathway ".concat(this.pathwayId,'. Setting initial Pathway to "')).call(a,i,'"')),n=this.getLevelsForPathway(i),this.pathwayId=i}return n.length!==e.length&&this.log(_concatInstanceProperty(t=_concatInstanceProperty(r="Found ".concat(n.length,"/")).call(r,e.length,' levels in Pathway "')).call(t,this.pathwayId,'"')),n}},{key:"getLevelsForPathway",value:function(e){var t;return null===this.levels?[]:_filterInstanceProperty(t=this.levels).call(t,(function(t){return e===t.pathwayId}))}},{key:"updatePathwayPriority",value:function(e){var t,r;this._pathwayPriority=e;var n=this.penalizedPathways,a=performance.now();_forEachInstanceProperty(t=_Object$keys(n)).call(t,(function(e){a-n[e]>3e5&&delete n[e]}));for(var i=0;i<e.length;i++){var s=e[i];if(!(s in n)){if(s===this.pathwayId)return;var o=this.hls.nextLoadLevel,l=this.hls.levels[o];if((r=this.getLevelsForPathway(s)).length>0){var c;this.log('Setting Pathway to "'.concat(s,'"')),this.pathwayId=s,$n(r),this.hls.trigger(x.LEVELS_UPDATED,{levels:r});var u=this.hls.levels[o];l&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==l.bitrate&&this.log(_concatInstanceProperty(c="Unstable Pathways change from bitrate ".concat(l.bitrate," to ")).call(c,u.bitrate)),this.hls.nextLoadLevel=o);break}}}}},{key:"getPathwayForGroupId",value:function(e,t,r){for(var n,a=_concatInstanceProperty(n=this.getLevelsForPathway(r)).call(n,this.levels||[]),i=0;i<a.length;i++)if(t===F&&a[i].hasAudioGroup(e)||t===U&&a[i].hasSubtitleGroup(e))return a[i].pathwayId;return r}},{key:"clonePathways",value:function(e){var t=this,r=this.levels;if(r){var n={},a={};_forEachInstanceProperty(e).call(e,(function(e){var i,s=e.ID,o=e["BASE-ID"],l=e["URI-REPLACEMENT"];if(!_someInstanceProperty(r).call(r,(function(e){return e.pathwayId===s}))){var c=_mapInstanceProperty(i=t.getLevelsForPathway(o)).call(i,(function(e){var t,r,i=new Ir(e.attrs);i["PATHWAY-ID"]=s;var o=i.AUDIO&&_concatInstanceProperty(t="".concat(i.AUDIO,"_clone_")).call(t,s),c=i.SUBTITLES&&_concatInstanceProperty(r="".concat(i.SUBTITLES,"_clone_")).call(r,s);o&&(n[i.AUDIO]=o,i.AUDIO=o),c&&(a[i.SUBTITLES]=c,i.SUBTITLES=c);var u=Ji(e.uri,i["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),h=new ke({attrs:i,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:u,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(var d=1;d<e.audioGroups.length;d++){var f;h.addGroupId("audio",_concatInstanceProperty(f="".concat(e.audioGroups[d],"_clone_")).call(f,s))}if(e.subtitleGroups)for(var p=1;p<e.subtitleGroups.length;p++){var y;h.addGroupId("text",_concatInstanceProperty(y="".concat(e.subtitleGroups[p],"_clone_")).call(y,s))}return h}));r.push.apply(r,_toConsumableArray(c)),Qi(t.audioTracks,n,l,s),Qi(t.subtitleTracks,a,l,s)}}))}}},{key:"loadSteeringManifest",value:function(e){var t,r=this,n=this.hls.config,a=n.loader;this.loader&&this.loader.destroy(),this.loader=new a(n);try{t=new _URL(e)}catch(t){return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: ".concat(e))}if("data:"!==t.protocol){var i=0|(this.hls.bandwidthEstimate||n.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+i)}var s={responseType:"json",url:t.href},o=n.steeringManifestLoadPolicy.default,l=o.errorRetry||o.timeoutRetry||{},c={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},u={onSuccess:function(e,n,a,i){r.log('Loaded steering manifest: "'.concat(t,'"'));var s=e.data;if(1===(null==s?void 0:s.VERSION)){r.updated=performance.now(),r.timeToLoad=s.TTL;var o=s["RELOAD-URI"],l=s["PATHWAY-CLONES"],c=s["PATHWAY-PRIORITY"];if(o)try{r.uri=new _URL(o,t).href}catch(e){return r.enabled=!1,void r.log("Failed to parse Steering Manifest RELOAD-URI: ".concat(o))}r.scheduleRefresh(r.uri||a.url),l&&r.clonePathways(l);var u={steeringManifest:s,url:t.toString()};r.hls.trigger(x.STEERING_MANIFEST_LOADED,u),c&&r.updatePathwayPriority(c)}else r.log("Steering VERSION ".concat(s.VERSION," not supported!"))},onError:function(e,t,n,a){var i,s;if(r.log(_concatInstanceProperty(i=_concatInstanceProperty(s="Error loading steering manifest: ".concat(e.code," ")).call(s,e.text," (")).call(i,t.url,")")),r.stopLoad(),410===e.code)return r.enabled=!1,void r.log("Steering manifest ".concat(t.url," no longer available"));var o=1e3*r.timeToLoad;if(429!==e.code)r.scheduleRefresh(r.uri||t.url,o);else{var l=r.loader;if("function"==typeof(null==l?void 0:l.getResponseHeader)){var c=l.getResponseHeader("Retry-After");c&&(o=1e3*_parseFloat$1(c))}r.log("Steering manifest ".concat(t.url," rate limited"))}},onTimeout:function(e,t,n){r.log("Timeout loading steering manifest (".concat(t.url,")")),r.scheduleRefresh(r.uri||t.url)}};this.log("Requesting steering manifest: ".concat(t)),this.loader.load(s,c,u)}},{key:"scheduleRefresh",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*this.timeToLoad;this.clearTimeout(),this.reloadTimer=_setTimeout((function(){var r,n=null==(r=t.hls)?void 0:r.media;!n||n.ended?t.scheduleRefresh(e,1e3*t.timeToLoad):t.loadSteeringManifest(e)}),r)}}]),r}(z),interstitialsController:function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n){var a;return _classCallCheck(this,r),(a=t.call(this,"interstitials",e.logger)).HlsPlayerClass=void 0,a.hls=void 0,a.assetListLoader=void 0,a.mediaSelection=null,a.altSelection=null,a.media=null,a.detachedData=null,a.requiredTracks=null,a.manager=null,a.playerQueue=[],a.bufferedPos=-1,a.timelinePos=-1,a.schedule=void 0,a.playingItem=null,a.bufferingItem=null,a.waitingItem=null,a.playingAsset=null,a.bufferingAsset=null,a.shouldPlay=!1,a.onPlay=function(){a.shouldPlay=!0},a.onPause=function(){a.shouldPlay=!1},a.onSeeking=function(){var e=a.currentTime;if(void 0!==e&&!a.playbackDisabled){var t=e-a.timelinePos;if(!(Math.abs(t)<1/7056e5)){var r=t<=-.01;a.timelinePos=e,a.bufferedPos=e,a.checkBuffer();var n=a.playingItem;if(n)if(r&&e<n.start||e>=n.end){var i,s=a.schedule.findItemIndexAtTime(a.timelinePos);if(!a.isInterstitial(n)&&null!=(i=a.media)&&i.paused&&(a.shouldPlay=!1),!r){var o=a.findItemIndex(n);if(s>o){var l=a.schedule.findJumpRestrictedIndex(o+1,s);if(l>o)return void a.setSchedulePosition(l)}}a.setSchedulePosition(s)}else{var c=a.playingAsset;if(c){var u=c.timelineStart,h=c.duration||0;(r&&e<u||e>=u+h)&&a.setScheduleToAssetAtTime(e,c)}else if(a.playingLastItem&&a.isInterstitial(n)){var d=n.event.assetList[0];d&&(a.playingItem=null,a.setScheduleToAssetAtTime(e,d))}}}}},a.onTimeupdate=function(){var e=a.currentTime;if(void 0!==e&&!a.playbackDisabled&&e>a.timelinePos){e>a.bufferedPos&&a.checkBuffer(),a.timelinePos=e;var t=a.playingItem;if(t&&!a.playingLastItem){if(e>=t.end){a.timelinePos=t.end;var r=a.findItemIndex(t);a.setSchedulePosition(r+1)}var n=a.playingAsset;n&&e>=n.timelineStart+(n.duration||0)&&a.setScheduleToAssetAtTime(e,n)}}},a.onScheduleUpdate=function(e,t){var r,n,i,s=a.schedule,o=a.playingItem,l=s.events||[],c=s.items||[],u=s.durations,h=_mapInstanceProperty(e).call(e,(function(e){return e.identifier})),d=!(!l.length&&!h.length);d&&(!1===a.hls.config.interstitialAppendInPlace&&_forEachInstanceProperty(l).call(l,(function(e){return e.appendInPlace=!1})),a.log(_concatInstanceProperty(r=_concatInstanceProperty(n="INTERSTITIALS_UPDATED (".concat(l.length,"): ")).call(n,l,"\nSchedule: ")).call(r,_mapInstanceProperty(c).call(c,(function(e){return gs(e)}))))),h.length&&a.log("Removed events ".concat(h)),_forEachInstanceProperty(i=a.playerQueue).call(i,(function(e){if(e.interstitial.appendInPlace){var t=e.assetItem.timelineStart,r=e.timelineOffset-t;if(r)try{e.timelineOffset=t}catch(o){var n,i,s;Math.abs(r)>os&&a.warn(_concatInstanceProperty(n=_concatInstanceProperty(i=_concatInstanceProperty(s="".concat(o,' ("')).call(s,e.assetId,'" ')).call(i,e.timelineOffset,"->")).call(n,t,")"))}}})),o&&!o.event&&(a.playingItem=a.updateItem(o,a.timelinePos));var f=a.bufferingItem;if(f&&(f.event?a.updateItem(f)||(a.bufferingItem=null,a.clearInterstitial(f.event,null)):a.bufferingItem=a.updateItem(f,a.bufferedPos)),a.waitingItem=a.updateItem(a.waitingItem),_forEachInstanceProperty(e).call(e,(function(e){var t;_forEachInstanceProperty(t=e.assetList).call(t,(function(e){a.clearAssetPlayer(e.identifier,null)}))})),d||t){if(a.hls.trigger(x.INTERSTITIALS_UPDATED,{events:_sliceInstanceProperty(l).call(l,0),schedule:_sliceInstanceProperty(c).call(c,0),durations:u,removedIds:h}),a.isInterstitial(o)&&_includesInstanceProperty(h).call(h,o.event.identifier))return a.warn('Interstitial "'.concat(o.event.identifier,'" removed while playing')),void a.primaryFallback(o.event);a.checkBuffer()}},a.hls=e,a.HlsPlayerClass=n,a.assetListLoader=new vs(e),a.schedule=new ys(a.onScheduleUpdate,e.logger),a.registerListeners(),a}return _createClass(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(x.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(x.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(x.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(x.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(x.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(x.BUFFER_APPENDED,this.onBufferAppended,this),e.on(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(x.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(x.MEDIA_ENDED,this.onMediaEnded,this),e.on(x.ERROR,this.onError,this),e.on(x.DESTROYING,this.onDestroying,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(x.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(x.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(x.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(x.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(x.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(x.BUFFER_CODECS,this.onBufferCodecs,this),e.off(x.BUFFER_APPENDED,this.onBufferAppended,this),e.off(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(x.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(x.MEDIA_ENDED,this.onMediaEnded,this),e.off(x.ERROR,this.onError,this),e.off(x.DESTROYING,this.onDestroying,this))}},{key:"startLoad",value:function(){this.resumeBuffering()}},{key:"stopLoad",value:function(){this.pauseBuffering()}},{key:"resumeBuffering",value:function(){var e;_forEachInstanceProperty(e=this.playerQueue).call(e,(function(e){return e.resumeBuffering()}))}},{key:"pauseBuffering",value:function(){var e;_forEachInstanceProperty(e=this.playerQueue).call(e,(function(e){return e.pauseBuffering()}))}},{key:"destroy",value:function(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.manager=null,this.hls=this.HlsPlayerClass=this.schedule=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}},{key:"onDestroying",value:function(){var e=this.primaryMedia;e&&this.removeMediaListeners(e)}},{key:"removeMediaListeners",value:function(e){e.removeEventListener("play",this.onPlay),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeking",this.onSeeking),e.removeEventListener("timeupdate",this.onTimeupdate)}},{key:"onMediaAttaching",value:function(e,t){var r=this.media=t.media;this.removeMediaListeners(r),r.addEventListener("seeking",this.onSeeking),r.addEventListener("timeupdate",this.onTimeupdate),r.addEventListener("play",this.onPlay),r.addEventListener("pause",this.onPause)}},{key:"onMediaAttached",value:function(e,t){var r=this.playingItem,n=this.detachedData;if(this.detachedData=null,null===r)this.checkStart();else if(!n){this.clearScheduleState();var a=this.findItemIndex(r);this.setSchedulePosition(a)}}},{key:"clearScheduleState",value:function(){this.playingItem=this.bufferingItem=this.waitingItem=this.playingAsset=this.bufferingAsset=null}},{key:"onMediaDetaching",value:function(e,t){var r=!!t.transferMedia,n=this.media;if(this.media=null,!r&&(n&&this.removeMediaListeners(n),this.detachedData)){var a=this.getBufferingPlayer();a&&(this.playingAsset=null,this.bufferingAsset=null,this.bufferingItem=null,this.waitingItem=null,this.detachedData=null,a.detachMedia()),this.shouldPlay=!1}}},{key:"interstitialsManager",get:function(){if(!this.manager){if(!this.hls||!this.schedule.events)return null;var e=this,t=function(){return e.bufferingItem||e.waitingItem},r=function(){return e.playingItem||e.waitingItem},n=function(t){return t?e.getAssetPlayer(t.identifier):t},a=function(t,r,a,i,o){if(t){var l=t[r].start,c=t.event;if(c){if("playout"===r||c.timelineOccupancy!==ls.Point){var u=n(a);(null==u?void 0:u.interstitial)===c&&(l+=u.assetItem.startOffset+u[o])}}else l+=("bufferedPos"===i?s():e[i])-t.start;return l}return 0},i=function(t,r){if(0!==t&&"primary"!==r&&e.schedule.length){var n,a=e.schedule.findItemIndexAtTime(t),i=null==(n=e.schedule.items)?void 0:n[a];if(i)return t+(i[r].start-i.start)}return t},s=function(){var t=e.bufferedPos;return t===Number.MAX_VALUE?o("primary"):t},o=function(t){var r;return null!=(r=e.primaryDetails)&&r.live?e.primaryDetails.edge:e.schedule.durations[t]},l=function(t,i){var s,o,l,c=r();if(null==c||null==(o=c.event)||!o.restrictions.skip){e.log(_concatInstanceProperty(s="seek to ".concat(t,' "')).call(s,i,'"'));var u=r(),h=e.schedule.findItemIndexAtTime(t,i),d=null==(l=e.schedule.items)?void 0:l[h],f=null==u?void 0:u.event,p=null==f?void 0:f.appendInPlace,y=u&&e.itemsMatch(u,d);if(u&&(p||y)){var g=n(e.playingAsset),v=(null==g?void 0:g.media)||e.hls.media;if(v){var m=t-("primary"===i?v.currentTime:a(u,i,e.playingAsset,"timelinePos","currentTime")),$=v.currentTime+m;if($>=0&&(!g||p||$<=g.duration))return void(v.currentTime=$)}}if(d){var S=t;if("primary"!==i){var I=t-d[i].start;S=d.start+I}var _=!e.isInterstitial(d);if(e.isInterstitial(u)||!_&&!d.event.appendInPlace){if(u){var E=e.findItemIndex(u);if(h>E){var T=e.schedule.findJumpRestrictedIndex(E+1,h);if(T>E)return void e.setSchedulePosition(T)}var P=0;if(_)e.timelinePos=S;else{var b,k=null==d||null==(b=d.event)?void 0:b.assetList;if(k)for(var A=t-(d[i]||d).start,R=k.length;R--;){var O=k[R];if(O.duration&&A>=O.startOffset&&A<O.startOffset+O.duration){P=R;break}}}e.setSchedulePosition(h,P)}}else{var L=e.hls.media;L&&(L.currentTime=S)}}}};this.manager={get events(){var t,r;return(null==(t=e.schedule)||null==(r=t.events)?void 0:_sliceInstanceProperty(r).call(r,0))||[]},get schedule(){var t,r;return(null==(t=e.schedule)||null==(r=t.items)?void 0:_sliceInstanceProperty(r).call(r,0))||[]},get playerQueue(){var t;return _sliceInstanceProperty(t=e.playerQueue).call(t,0)},get bufferingPlayer(){return e.getBufferingPlayer()},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return e.bufferingItem},get playingAsset(){return e.playingAsset},get playingItem(){return e.playingItem},get bufferingIndex(){var r=t();return e.findItemIndex(r)},get playingIndex(){var t=r();return e.findItemIndex(t)},get waitingIndex(){return e.findItemIndex(e.waitingItem)},primary:{get bufferedEnd(){return s()},get currentTime(){var t=e.timelinePos;return t>0?t:0},get duration(){return o("primary")},get seekableStart(){var t;return(null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0},seekTo:function(e){return l(e,"primary")}},playout:{get bufferedEnd(){return a(t(),"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return a(r(),"playout",e.playingAsset,"timelinePos","currentTime")},get duration(){return o("playout")},get seekableStart(){var t;return i((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"playout")},seekTo:function(e){return l(e,"playout")}},integrated:{get bufferedEnd(){return a(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return a(r(),"integrated",e.playingAsset,"timelinePos","currentTime")},get duration(){return o("integrated")},get seekableStart(){var t;return i((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"integrated")},seekTo:function(e){return l(e,"integrated")}},skip:function(){var t=r(),n=null==t?void 0:t.event;if(n&&!n.restrictions.skip){var a=e.findItemIndex(t);if(n.appendInPlace){var i=t.playout.start+t.event.duration;l(i+.001,"playout")}else e.advanceAfterAssetEnded(n,a,1/0)}}}}return this.manager}},{key:"playingLastItem",get:function(){var e,t=this.playingItem;if(!this.playbackStarted||!t)return!1;var r=null==(e=this.schedule)?void 0:e.items;return this.itemsMatch(t,r?r[r.length-1]:null)}},{key:"playbackStarted",get:function(){return null!==this.playingItem}},{key:"currentTime",get:function(){var e,t,r;if(null!==this.mediaSelection){var n=this.waitingItem||this.playingItem;if(!this.isInterstitial(n)||n.event.appendInPlace){var a=this.media;!a&&null!=(e=this.bufferingItem)&&null!=(t=e.event)&&t.appendInPlace&&(a=this.primaryMedia);var i=null==(r=a)?void 0:r.currentTime;return void 0!==i&&O(i)?i:void 0}}}},{key:"primaryMedia",get:function(){var e;return this.media||(null==(e=this.detachedData)?void 0:e.media)||null}},{key:"isInterstitial",value:function(e){return!(null==e||!e.event)}},{key:"retreiveMediaSource",value:function(e,t){var r=this.getAssetPlayer(e);r&&this.transferMediaFromPlayer(r,t)}},{key:"transferMediaFromPlayer",value:function(e,t){var r=e.interstitial.appendInPlace,n=e.media;if(r&&n===this.primaryMedia){var a;if(!t||this.isInterstitial(t)&&!t.event.appendInPlace)return void(t&&n&&(this.detachedData={media:n}));var i=e.transferMedia();this.log(_concatInstanceProperty(a="transfer MediaSource from ".concat(e," ")).call(a,_JSON$stringify(i))),this.bufferingAsset=null,this.detachedData=i}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}},{key:"transferMediaTo",value:function(e,t){var r,n,a,i,s,o,l=null,c=this.hls,u=e!==c,h=u&&e.interstitial.appendInPlace,d=null==(i=this.detachedData)?void 0:i.mediaSource;if(c.media&&h)l=c.transferMedia(),this.detachedData=l,o="Primary";else if(d){var f=this.getBufferingPlayer();f&&(l=f.transferMedia()),o="".concat(f)}else o="<unknown>";this.log(_concatInstanceProperty(r=_concatInstanceProperty(n="transferring to ".concat(u?e:"Primary","\nMediaSource ")).call(n,_JSON$stringify(l)," from ")).call(r,o)),l||(d?(l=this.detachedData,this.log("using detachedData: MediaSource ".concat(_JSON$stringify(l)))):this.detachedData&&this.hls.media!==t||(this.hls.detachMedia(),this.detachedData={media:t}));var p=l&&"mediaSource"in l&&"closed"!==(null==(s=l.mediaSource)?void 0:s.readyState),y=p&&l?l:t;if(this.log(_concatInstanceProperty(a="".concat(p?"transfering MediaSource":"attaching media"," to ")).call(a,u?e:"Primary")),y===l){var g=u&&e.assetId===this.schedule.assetIdAtEnd;y.overrides={duration:this.schedule.duration,endOfStream:!u||g,cueRemoval:!1}}e.attachMedia(y)}},{key:"onInterstitialCueEnter",value:function(){this.onTimeupdate()}},{key:"checkStart",value:function(){var e=this.schedule,t=e.events;if(t&&!this.playbackDisabled){-1===this.bufferedPos&&(this.bufferedPos=0);var r=this.timelinePos,n=this.waitingItem;if(-1===r){var a=this.hls.startPosition;if(this.timelinePos=a,t.length&&t[0].cue.pre){var i=e.findEventIndex(t[0].identifier);this.setSchedulePosition(i)}else if(a>=0||!this.primaryLive){var s=this.timelinePos=a>0?a:0,o=e.findItemIndexAtTime(s);this.setSchedulePosition(o)}}else if(n&&!this.playingItem){var l=e.findItemIndex(n);this.setSchedulePosition(l)}}}},{key:"advanceAfterAssetEnded",value:function(e,t,r){var n=r+1;if(e.isAssetPastPlayoutLimit(n)||e.assetList[n].error){var a=this.schedule.items;if(a){var i=t+1;if(i>=a.length)return void this.setSchedulePosition(-1);this.setSchedulePosition(i)}}else this.setSchedulePosition(t,n)}},{key:"setScheduleToAssetAtTime",value:function(e,t){var r=this.schedule,n=t.parentIdentifier,a=r.getEvent(n);if(a){var i=r.findEventIndex(n),s=r.findAssetIndex(a,e);this.setSchedulePosition(i,s)}}},{key:"setSchedulePosition",value:function(e,t){var r,n=this,a=this.schedule.items;if(a&&!this.playbackDisabled){this.log(_concatInstanceProperty(r="setSchedulePosition ".concat(e,", ")).call(r,t));var i=e>=0?a[e]:null,s=this.primaryMedia,o=this.playingItem,l=this.playingLastItem;if(this.isInterstitial(o)){var c,u,h=o.event,d=this.playingAsset,f=null==d?void 0:d.identifier,p=f?this.getAssetPlayer(f):null;if(p&&f&&(!this.eventItemsMatch(o,i)||void 0!==t&&f!==(null==(u=h.assetList)?void 0:u[t].identifier))){var y,g;this.playingAsset=null;var v=h.findAssetIndex(d);this.log(_concatInstanceProperty(y=_concatInstanceProperty(g="INTERSTITIAL_ASSET_ENDED ".concat(v+1,"/")).call(g,h.assetList.length," ")).call(y,fs(d))),this.hls.trigger(x.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:v,event:h,schedule:_sliceInstanceProperty(a).call(a,0),scheduleIndex:e,player:p}),this.retreiveMediaSource(f,i),p.media&&!this.detachedData&&p.detachMedia(),this.clearAssetPlayer(f,i)}if(!this.eventItemsMatch(o,i)&&(this.playingItem=null,this.log(_concatInstanceProperty(c="INTERSTITIAL_ENDED ".concat(h," ")).call(c,gs(o))),h.hasPlayed=!0,this.hls.trigger(x.INTERSTITIAL_ENDED,{event:h,schedule:_sliceInstanceProperty(a).call(a,0),scheduleIndex:e}),this.clearInterstitial(h,i),h.cue.once)){if(this.updateSchedule(),i){var m=this.schedule.findItemIndex(i);this.setSchedulePosition(m,t)}return}}var $=this.playerQueue;if($.length&&_forEachInstanceProperty($).call($,(function(t){var r=t.interstitial,a=n.schedule.findEventIndex(r.identifier);(a<e||a>e+1)&&n.clearInterstitial(r,i)})),this.isInterstitial(i)){var S,I,_;this.timelinePos=Math.min(Math.max(this.timelinePos,i.start),i.end);var E=i.event;void 0===t&&(t=this.schedule.findAssetIndex(E,this.timelinePos));var T=this.waitingItem,P=this.preloadAssets(E,t);P||this.setBufferingItem(i),this.eventItemsMatch(i,o||T)||(this.waitingItem=i,this.log(_concatInstanceProperty(S="INTERSTITIAL_STARTED ".concat(gs(i)," ")).call(S,E.appendInPlace?"append in place":"")),this.hls.trigger(x.INTERSTITIAL_STARTED,{event:E,schedule:_sliceInstanceProperty(a).call(a,0),scheduleIndex:e}));var b=E.assetList.length;if(0===b&&!E.assetListResponse)return void this.log("Waiting for ASSET-LIST to complete loading ".concat(E));if(E.assetListLoader&&(E.assetListLoader.destroy(),E.assetListLoader=void 0),!s)return void this.log("Waiting for attachMedia to start Interstitial ".concat(E));this.waitingItem=null,this.playingItem=i;var k=E.assetList[t];if(!k){var A=a[e+1],R=this.media;return A&&R&&!this.isInterstitial(A)&&R.currentTime<A.start&&(R.currentTime=this.timelinePos=A.start),void this.advanceAfterAssetEnded(E,e,t||0)}if(P||(P=this.getAssetPlayer(k.identifier)),(null===P||P.destroyed)&&(this.warn(_concatInstanceProperty(I=_concatInstanceProperty(_="asset ".concat(t+1,"/")).call(_,b," player destroyed ")).call(I,E)),P=this.createAssetPlayer(E,k,t)),!this.eventItemsMatch(i,this.bufferingItem)&&E.appendInPlace&&this.isAssetBuffered(k))return;this.startAssetPlayer(P,t,a,e,s),this.shouldPlay&&ms(P.media)}else null!==i?(this.resumePrimary(i,e,o),this.shouldPlay&&ms(this.hls.media)):l&&this.isInterstitial(o)&&(this.playingItem=o,o.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}}},{key:"playbackDisabled",get:function(){return!1===this.hls.config.enableInterstitialPlayback}},{key:"primaryDetails",get:function(){var e,t;return null==(e=this.mediaSelection)||null==(t=e.main)?void 0:t.details}},{key:"primaryLive",get:function(){var e;return!(null==(e=this.primaryDetails)||!e.live)}},{key:"resumePrimary",value:function(e,t,r){var n;if(this.playingItem=e,this.playingAsset=null,this.waitingItem=null,this.bufferedToItem(e),this.log("resuming ".concat(gs(e))),null==(n=this.detachedData)||!n.mediaSource){var a=this.timelinePos;(a<e.start||a>=e.end)&&(a=this.getPrimaryResumption(e,t),this.timelinePos=a),this.attachPrimary(a,e)}if(r){var i=this.schedule.items;i&&(this.log("resumed ".concat(gs(e))),this.hls.trigger(x.INTERSTITIALS_PRIMARY_RESUMED,{schedule:_sliceInstanceProperty(i).call(i,0),scheduleIndex:t}),this.checkBuffer())}}},{key:"getPrimaryResumption",value:function(e,t){var r=e.start;if(this.primaryLive){var n=this.primaryDetails;if(0===t)return this.hls.startPosition;if(n&&(r<n.fragmentStart||r>n.edge))return this.hls.liveSyncPosition||-1}return r}},{key:"isAssetBuffered",value:function(e){var t=this.getAssetPlayer(e.identifier);return null!=t&&t.hls?t.hls.bufferedToEnd:fr.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}},{key:"attachPrimary",value:function(e,t,r){t?this.setBufferingItem(t):this.bufferingItem=null,this.bufferingAsset=null;var n=this.primaryMedia;if(n){var a=this.hls;a.media?this.checkBuffer():(this.transferMediaTo(a,n),r&&this.startLoadingPrimaryAt(e,r)),r||(this.timelinePos=e,this.startLoadingPrimaryAt(e,r))}}},{key:"startLoadingPrimaryAt",value:function(e,t){this.hls.loadingEnabled&&this.hls.startLoad(e,t)}},{key:"onManifestLoading",value:function(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(x.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(x.BUFFER_CODECS,this.onBufferCodecs,this)}},{key:"onLevelUpdated",value:function(e,t){if(-1!==t.level){var r=this.hls.levels[t.level],n=q(q({},this.mediaSelection||this.altSelection),{},{main:r});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n),!this.playingItem&&this.schedule.items&&this.checkStart()}}},{key:"onAudioTrackUpdated",value:function(e,t){var r=this.hls.audioTracks[t.id],n=this.mediaSelection;if(n){var a=q(q({},n),{},{audio:r});this.mediaSelection=a}else this.altSelection=q(q({},this.altSelection),{},{audio:r})}},{key:"onSubtitleTrackUpdated",value:function(e,t){var r=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(n){var a=q(q({},n),{},{subtitles:r});this.mediaSelection=a}else this.altSelection=q(q({},this.altSelection),{},{subtitles:r})}},{key:"onAudioTrackSwitching",value:function(e,t){var r,n=Ce(t);_forEachInstanceProperty(r=this.playerQueue).call(r,(function(e){return e.hls.setAudioOption(t)||e.hls.setAudioOption(n)}))}},{key:"onSubtitleTrackSwitch",value:function(e,t){var r,n=Ce(t);_forEachInstanceProperty(r=this.playerQueue).call(r,(function(e){return e.hls.setSubtitleOption(t)||-1!==t.id&&e.hls.setSubtitleOption(n)}))}},{key:"onBufferCodecs",value:function(e,t){var r=t.tracks;r&&(this.requiredTracks=r)}},{key:"onBufferAppended",value:function(e,t){this.checkBuffer()}},{key:"onBufferFlushed",value:function(e,t){var r=this.playingItem;if(r&&r!==this.bufferingItem&&!this.isInterstitial(r)){var n=this.timelinePos;this.bufferedPos=n,this.setBufferingItem(r)}}},{key:"onBufferedToEnd",value:function(e){var t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(var r=0;r<t.length;r++){var n=t[r];if(n.cue.post){var a,i=this.schedule.findEventIndex(n.identifier),s=null==(a=this.schedule.items)?void 0:a[i];this.isInterstitial(s)&&this.eventItemsMatch(s,this.bufferingItem)&&this.bufferedToItem(s,0);break}}this.bufferedPos=Number.MAX_VALUE}}},{key:"onMediaEnded",value:function(e){var t=this.playingItem;if(!this.playingLastItem&&t){var r=this.findItemIndex(t);this.setSchedulePosition(r+1)}}},{key:"updateItem",value:function(e,t){var r=this.schedule.items;return e&&r&&r[this.findItemIndex(e,t)]||null}},{key:"itemsMatch",value:function(e,t){var r,n;return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&(null==(r=e.nextEvent)?void 0:r.identifier)===(null==(n=t.nextEvent)?void 0:n.identifier))}},{key:"eventItemsMatch",value:function(e,t){var r;return!!t&&(e===t||e.event.identifier===(null==(r=t.event)?void 0:r.identifier))}},{key:"findItemIndex",value:function(e,t){return e?this.schedule.findItemIndex(e,t):-1}},{key:"updateSchedule",value:function(){var e=this.mediaSelection;e&&this.schedule.updateSchedule(e,[])}},{key:"checkBuffer",value:function(){var e=this.schedule.items;if(e){var t=fr.bufferInfo(this.primaryMedia,this.timelinePos,0);this.updateBufferedPos(t.end,e,0===t.len)}}},{key:"updateBufferedPos",value:function(e,t,r){var n=this.schedule,a=this.bufferingItem;if(!(this.bufferedPos>e))if(1===t.length&&this.itemsMatch(t[0],a))this.bufferedPos=e;else{var i=this.playingItem,s=this.findItemIndex(i),o=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var l,c=this.findItemIndex(a),u=Math.min(c+1,t.length-1),h=t[u];if(-1===o&&a&&e>=a.end&&(o=u),u-s>1&&!1===(null==a||null==(l=a.event)?void 0:l.appendInPlace))return;if(this.bufferedPos=e,o>c&&o>s)this.bufferedToItem(h);else{var d=this.primaryDetails;this.primaryLive&&d&&e>d.edge-d.targetduration&&h.start<d.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(h)&&this.preloadAssets(h.event,0)}}else r&&i&&a!==i&&o===s&&this.bufferedToItem(i)}}},{key:"setBufferingItem",value:function(e){var t=this.bufferingItem,r=this.schedule,n=r.items,a=r.events;if(n&&a&&(!t||r.findItemIndex(t)!==r.findItemIndex(e))){var i,s,o=this.isInterstitial(e),l=this.getBufferingPlayer(),c=l?l.remaining:t?t.end-this.timelinePos:0;this.log("buffered to boundary ".concat(gs(e))+(t?" (".concat(c.toFixed(2)," remaining)"):"")),this.bufferingItem=e,this.bufferedPos=e.start,this.playbackDisabled||(o?_forEachInstanceProperty(i=this.playerQueue).call(i,(function(e){return e.resumeBuffering()})):(this.hls.resumeBuffering(),_forEachInstanceProperty(s=this.playerQueue).call(s,(function(e){return e.pauseBuffering()})))),this.hls.trigger(x.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:_sliceInstanceProperty(a).call(a,0),schedule:_sliceInstanceProperty(n).call(n,0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}return t}},{key:"bufferedToItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.setBufferingItem(e);if(!this.playbackDisabled)if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==r){this.bufferingAsset=null;var n=this.detachedData;if(n)if(n.mediaSource){var a=!0;this.attachPrimary(e.start,e,a)}else this.preloadPrimary(e);else this.preloadPrimary(e)}}},{key:"preloadPrimary",value:function(e){var t=this.findItemIndex(e),r=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(r)}},{key:"bufferedToEvent",value:function(e,t){var r=e.event,n=0===r.assetList.length&&!r.assetListLoader,a=r.cue.once;if(n||!a){var i=this.preloadAssets(r,t);if(null!=i&&i.interstitial.appendInPlace){var s=r.assetList[t],o=this.primaryMedia;s&&o&&this.bufferAssetPlayer(i,o)}}}},{key:"preloadAssets",value:function(e,t){var r=e.assetList.length,n=0===r&&!e.assetListLoader,a=e.cue.once;if(n){var i,s;this.log(_concatInstanceProperty(i=_concatInstanceProperty(s="Load interstitial asset ".concat(t+1,"/")).call(s,r," ")).call(i,e));var o=e.timelineStart;e.appendInPlace&&this.flushFrontBuffer(o);var l=e.assetUrl;if(l)return this.createAsset(e,0,0,o,e.duration,l);var c=0;!this.playingItem&&this.primaryLive&&-1===(c=this.hls.startPosition)&&(c=this.hls.liveSyncPosition||0);var u=this.assetListLoader.loadAssetList(e,c);u&&(e.assetListLoader=u)}else if(!a&&r){for(var h=t;h<r;h++){var d=e.assetList[h],f=this.getAssetPlayerQueueIndex(d.identifier);-1!==f&&!this.playerQueue[f].destroyed||d.error||this.createAssetPlayer(e,d,h)}return this.getAssetPlayer(e.assetList[t].identifier)}return null}},{key:"flushFrontBuffer",value:function(e){var t,r=this,n=this.requiredTracks;n&&_forEachInstanceProperty(t=_Object$keys(n)).call(t,(function(t){r.hls.trigger(x.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})}))}},{key:"getAssetPlayerQueueIndex",value:function(e){for(var t=this.playerQueue,r=0;r<t.length;r++)if(e===t[r].assetId)return r;return-1}},{key:"getAssetPlayer",value:function(e){var t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}},{key:"getBufferingPlayer",value:function(){var e=this.playerQueue,t=this.primaryMedia;if(t)for(var r=0;r<e.length;r++)if(e[r].media===t)return e[r];return null}},{key:"createAsset",value:function(e,t,r,n,a,i){var s={parentIdentifier:e.identifier,identifier:cs(e,i,t),duration:a,startOffset:r,timelineStart:n,uri:i};return this.createAssetPlayer(e,s,t)}},{key:"createAssetPlayer",value:function(e,t,r){var n=this;this.log("create HLSAssetPlayer for ".concat(fs(t)));var a=this.hls,i=a.userConfig,s=i.videoPreference,o=a.levels[a.loadLevel]||a.levels[a.currentLevel];(s||o)&&(s=W({},s),o.videoCodec&&(s.videoCodec=o.videoCodec),o.videoRange&&(s.allowedVideoRanges=[o.videoRange]));var l=a.audioTracks[a.audioTrack],c=a.subtitleTracks[a.subtitleTrack],u=0;if(this.primaryLive){var h=this.timelinePos-t.timelineStart;if(h>1){var d=t.duration;d&&h<d&&(u=h)}}var f=q(q({},i),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:a.sessionId,assetPlayerId:t.identifier,abrEwmaDefaultEstimate:a.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:l||i.audioPreference,subtitlePreference:c||i.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(f.timelineOffset=t.timelineStart));var p=f.cmcd;null!=p&&p.sessionId&&p.contentId&&(f.cmcd=W({},p,{contentId:ss(t.uri)}));var y=new ps(this.HlsPlayerClass,f,e,t);this.playerQueue.push(y),e.assetList[r]=t;var g=t.identifier,v=function(a){var i,s;if(a.live){var o=new Error("Interstitials MUST be VOD assets ".concat(e)),l={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:o};n.handleAssetItemError(l,e,n.schedule.findEventIndex(e.identifier),r,o.message)}else{var c=a.edge-a.fragmentStart,u=t.duration;(null===u||c>u)&&(n.log(_concatInstanceProperty(i=_concatInstanceProperty(s='Interstitial asset "'.concat(g,'" duration change ')).call(s,u," > ")).call(i,c)),t.duration=c,n.updateSchedule())}};y.on(x.LEVEL_UPDATED,(function(e,t){var r=t.details;return v(r)})),y.on(x.LEVEL_PTS_UPDATED,(function(e,t){var r=t.details;return v(r)}));var m=function e(t,r){var a=n.getAssetPlayer(g);if(a&&r.tracks){a.off(x.BUFFER_CODECS,e),a.tracks=r.tracks;var i=n.primaryMedia;n.bufferingAsset===a.assetItem&&i&&!a.media&&n.bufferAssetPlayer(a,i)}};y.on(x.BUFFER_CODECS,m);var $=function r(a){var i,s=n.getAssetPlayer(g);if(n.log("buffered to end of asset ".concat(s)),s){s.off(x.BUFFERED_TO_END,r);var o=n.schedule.findEventIndex(e.identifier),l=e.findAssetIndex(t),c=l+1,u=null==(i=n.schedule.items)?void 0:i[o];if(n.isInterstitial(u))if(-1===l||e.isAssetPastPlayoutLimit(c)||e.assetList[c].error){var h,d=null==(h=n.schedule.items)?void 0:h[o+1];d&&n.bufferedToItem(d)}else n.bufferedToItem(u,l+1)}};y.on(x.BUFFERED_TO_END,$);var S=function(t){return function(){if(n.getAssetPlayer(g)){n.shouldPlay=!0;var r=n.schedule.findEventIndex(e.identifier);n.advanceAfterAssetEnded(e,r,t)}}};return y.once(x.MEDIA_ENDED,S(r)),y.once(x.PLAYOUT_LIMIT_REACHED,S(1/0)),y.on(x.ERROR,(function(t,a){var i;n.handleAssetItemError(a,e,n.schedule.findEventIndex(e.identifier),r,_concatInstanceProperty(i="Asset player error ".concat(a.error," ")).call(i,e))})),y.on(x.DESTROYING,(function(){if(n.getAssetPlayer(g)){var t=new Error("Asset player destroyed unexpectedly ".concat(g)),a={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};n.handleAssetItemError(a,e,n.schedule.findEventIndex(e.identifier),r,t.message)}})),this.hls.trigger(x.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:r,event:e,player:y}),y}},{key:"clearInterstitial",value:function(e,t){var r,n=this;_forEachInstanceProperty(r=e.assetList).call(r,(function(e){n.clearAssetPlayer(e.identifier,t)})),e.appendInPlaceStarted=!1}},{key:"clearAssetPlayer",value:function(e,t){if(null!==t){var r=this.getAssetPlayerQueueIndex(e);if(-1!==r){var n,a;this.log(_concatInstanceProperty(n='clearAssetPlayer "'.concat(e,'" toSegment: ')).call(n,t?gs(t):t));var i=this.playerQueue[r];this.transferMediaFromPlayer(i,t),_spliceInstanceProperty(a=this.playerQueue).call(a,r,1),i.destroy()}}}},{key:"emptyPlayerQueue",value:function(){for(var e;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}},{key:"startAssetPlayer",value:function(e,t,r,n,a){var i,s,o=e.interstitial,l=e.assetItem,c=e.assetId,u=o.assetList.length,h=this.playingAsset;this.playingAsset=l,h&&h.identifier===c||(h&&(this.clearAssetPlayer(h.identifier,r[n]),delete h.error),this.log(_concatInstanceProperty(i=_concatInstanceProperty(s="INTERSTITIAL_ASSET_STARTED ".concat(t+1,"/")).call(s,u," ")).call(i,e)),this.hls.trigger(x.INTERSTITIAL_ASSET_STARTED,{asset:l,assetListIndex:t,event:o,schedule:_sliceInstanceProperty(r).call(r,0),scheduleIndex:n,player:e})),e.media||this.bufferAssetPlayer(e,a)}},{key:"bufferAssetPlayer",value:function(e,t){var r,n,a=e.interstitial,i=e.assetItem,s=e.assetId,o=this.schedule.findEventIndex(a.identifier),l=null==(r=this.schedule.items)?void 0:r[o];if(l){this.setBufferingItem(l),this.bufferingAsset=i;var c=this.getBufferingPlayer();if(c!==e){var u=(null==c?void 0:c.tracks)||(null==(n=this.detachedData)?void 0:n.tracks)||this.requiredTracks;if(a.appendInPlace&&i!==this.playingAsset){if(!e.tracks)return;if(u&&!ne(u,e.tracks)){var h,d,f=new Error(_concatInstanceProperty(h=_concatInstanceProperty(d='Asset "'.concat(s,"\" SourceBuffer tracks ('")).call(d,_Object$keys(e.tracks),"') are not compatible with primary content tracks ('")).call(h,_Object$keys(u),"')")),p={fatal:!0,type:D.OTHER_ERROR,details:w.INTERSTITIAL_ASSET_ITEM_ERROR,error:f},y=a.findAssetIndex(i);return void this.handleAssetItemError(p,a,o,y,f.message)}}this.transferMediaTo(e,t)}}}},{key:"handleAssetItemError",value:function(e,t,r,n,a){var i;if(e.details!==w.BUFFER_STALLED_ERROR){var s=t.assetList[n]||null,o=null;if(s){var l=this.getAssetPlayerQueueIndex(s.identifier);o=this.playerQueue[l]||null}var c=this.schedule.items,u=W({},e,{fatal:!1,errorAction:tt(!0),asset:s,assetListIndex:n,event:t,schedule:c,scheduleIndex:r,player:o});if(this.warn("Asset item error: ".concat(e.error)),this.hls.trigger(x.INTERSTITIAL_ASSET_ERROR,u),e.fatal){var h=new Error(a);s&&(this.playingAsset!==s&&this.clearAssetPlayer(s.identifier,null),s.error=h),_someInstanceProperty(i=t.assetList).call(i,(function(e){return!e.error}))?t.appendInPlace&&(t.error=h):t.error=h,this.primaryFallback(t)}}}},{key:"primaryFallback",value:function(e){var t=e.timelineStart,r=this.playingItem||this.waitingItem;if(this.updateSchedule(),r){var n,a,i,s;this.log(_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s='Fallback to primary from event "'.concat(e.identifier,'" start: ')).call(s,t," pos: ")).call(i,this.timelinePos," playing: ")).call(a,r?gs(r):"<none>"," error: ")).call(n,e.error)),e.appendInPlace&&(e.appendInPlace=!1,this.attachPrimary(t,null),this.flushFrontBuffer(t));var o=this.timelinePos;-1===o&&(o=this.hls.startPosition);var l=this.updateItem(r,o);if(!this.itemsMatch(r,l)){var c=this.schedule.findItemIndexAtTime(o);this.setSchedulePosition(c)}}else this.checkStart()}},{key:"onAssetListLoaded",value:function(e,t){var r,n=this,a=t.event,i=a.identifier,s=t.assetListResponse.ASSETS;if(this.schedule.hasEvent(i)){var o=a.timelineStart,l=0;_forEachInstanceProperty(s).call(s,(function(e,t){var r=_parseFloat$1(e.DURATION);n.createAsset(a,t,l,o+l,r,e.URI),l+=r})),a.duration=l;var c=this.waitingItem,u=(null==c?void 0:c.event.identifier)===i;this.updateSchedule();var h=null==(r=this.bufferingItem)?void 0:r.event;if(u){var d,f=this.schedule.findEventIndex(i),p=null==(d=this.schedule.items)?void 0:d[f];p&&this.setBufferingItem(p),this.setSchedulePosition(f)}else if((null==h?void 0:h.identifier)===i&&h.appendInPlace){var y=a.assetList[0],g=this.getAssetPlayer(y.identifier),v=this.primaryMedia;y&&g&&v&&this.bufferAssetPlayer(g,v)}}}},{key:"onError",value:function(e,t){switch(t.details){case w.ASSET_LIST_PARSING_ERROR:case w.ASSET_LIST_LOAD_ERROR:case w.ASSET_LIST_LOAD_TIMEOUT:var r=t.interstitial;r&&this.primaryFallback(r)}}}]),r}(z)});function Eo(e){var t;return e&&"object"==_typeof(e)?_Array$isArray(e)?_mapInstanceProperty(e).call(e,Eo):_reduceInstanceProperty(t=_Object$keys(e)).call(t,(function(t,r){return t[r]=Eo(e[r]),t}),{}):e}function To(e,t){var r=e.loader;r!==vo&&r!==Io?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}()&&(e.loader=vo,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}function Po(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function bo(e,t,r,n,a){var i=new e(t,r,"");try{i.value=n,a&&(i.type=a)}catch(s){i=new e(t,r,_JSON$stringify(a?q({type:a},n):n))}return i}var ko=function(){var e=Po();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}(),Ao=function(){function e(t){var r=this;_classCallCheck(this,e),this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=function(){r.hls&&r.hls.trigger(x.EVENT_CUE_ENTER,{})},this.hls=t,this._registerListeners()}return _createClass(e,[{key:"destroy",value:function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}},{key:"_registerListeners",value:function(){var e=this.hls;e.on(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(x.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(x.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(x.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(x.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(x.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(x.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}},{key:"onMediaAttaching",value:function(e,t){var r;this.media=t.media,!1===(null==(r=t.overrides)?void 0:r.cueRemoval)&&(this.removeCues=!1)}},{key:"onMediaAttached",value:function(){var e=this.hls.latestLevelDetails;e&&this.updateDateRangeCues(e)}},{key:"onMediaDetaching",value:function(e,t){this.media=null,t.transferMedia||(this.id3Track&&(this.removeCues&&ns(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}},{key:"onManifestLoading",value:function(){this.dateRangeCuesAppended={}}},{key:"createTrack",value:function(e){var t=this.getID3Track(e.textTracks);return t.mode="hidden",t}},{key:"getID3Track",value:function(e){if(this.media){for(var t=0;t<e.length;t++){var r=e[t];if("metadata"===r.kind&&"id3"===r.label)return ts(r,this.media),r}return this.media.addTextTrack("metadata","id3")}}},{key:"onFragParsingMetadata",value:function(e,t){if(this.media){var r=this.hls.config,n=r.enableEmsgMetadataCues,a=r.enableID3MetadataCues;if(n||a){var i=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));var s=Po();if(s)for(var o=0;o<i.length;o++){var l=i[o].type;if((l!==da.emsg||n)&&a){var c=la(i[o].data);if(c){var u=i[o].pts,h=u+i[o].duration;h>ko&&(h=ko),h-u<=0&&(h=u+.25);for(var d=0;d<c.length;d++){var f=c[d];if(!ca(f)){this.updateId3CueEnds(u,l);var p=bo(s,u,h,f,l);p&&this.id3Track.addCue(p)}}}}}}}}},{key:"updateId3CueEnds",value:function(e,t){var r,n=null==(r=this.id3Track)?void 0:r.cues;if(n)for(var a=n.length;a--;){var i=n[a];i.type===t&&i.startTime<e&&i.endTime===ko&&(i.endTime=e)}}},{key:"onBufferFlushing",value:function(e,t){var r=t.startOffset,n=t.endOffset,a=t.type,i=this.id3Track,s=this.hls;if(s){var o=s.config,l=o.enableEmsgMetadataCues,c=o.enableID3MetadataCues;i&&(l||c)&&as(i,r,n,"audio"===a?function(e){return e.type===da.audioId3&&c}:"video"===a?function(e){return e.type===da.emsg&&l}:function(e){return e.type===da.audioId3&&c||e.type===da.emsg&&l})}}},{key:"onLevelUpdated",value:function(e,t){var r=t.details;this.updateDateRangeCues(r,!0)}},{key:"onLevelPtsUpdated",value:function(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}},{key:"updateDateRangeCues",value:function(e,t){var r=this;if(this.media&&e.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var n,a=this.id3Track,i=e.dateRanges,s=_Object$keys(i),o=this.dateRangeCuesAppended;if(a&&t)if(null!=(n=a.cues)&&n.length)for(var l,c=_filterInstanceProperty(l=_Object$keys(o)).call(l,(function(e){return!_includesInstanceProperty(s).call(s,e)})),u=function(){var e,t=c[h],n=o[t].cues;delete o[t],_forEachInstanceProperty(e=_Object$keys(n)).call(e,(function(e){try{var t=n[e];t.removeEventListener("enter",r.onEventCueEnter),a.removeCue(t)}catch(e){}}))},h=c.length;h--;)u();else o=this.dateRangeCuesAppended={};var d=e.fragments[e.fragments.length-1];if(0!==s.length&&O(null==d?void 0:d.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var f,p,y=Po(),g=function(){var e=s[v],t=i[e],n=t.startTime,a=o[e],l=(null==a?void 0:a.cues)||{},c=(null==a?void 0:a.durationKnown)||!1,u=ko,h=t.duration;if(t.endDate&&null!==h)u=n+h,c=!0;else if(t.endOnNext&&!c){var d=_reduceInstanceProperty(s).call(s,(function(e,r){if(r!==t.id){var n=i[r];if(n.class===t.class&&n.startDate>t.startDate&&(!e||t.startDate<e.startDate))return n}return e}),null);d&&(u=d.startTime,c=!0)}for(var g=_Object$keys(t.attr),m=0;m<g.length;m++){var $=g[m];if("ID"!==(p=$)&&"CLASS"!==p&&"CUE"!==p&&"START-DATE"!==p&&"DURATION"!==p&&"END-DATE"!==p&&"END-ON-NEXT"!==p){var S=l[$];if(S)c&&!a.durationKnown?S.endTime=u:Math.abs(S.startTime-n)>.01&&(S.startTime=n,S.endTime=u);else if(y){var I=t.attr[$];_r($)&&(f=I,I=Uint8Array.from(f.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer);var _=bo(y,n,u,{key:$,data:I},da.dateRange);_&&(_.id=e,r.id3Track.addCue(_),l[$]=_,r.hls.config.interstitialsController&&("X-ASSET-LIST"!==$&&"X-ASSET-URL"!==$||_.addEventListener("enter",r.onEventCueEnter)))}}}o[e]={cues:l,dateRange:t,durationKnown:c}},v=0;v<s.length;v++)g()}}}}]),e}(),Ro=function(){function e(t){var r=this;_classCallCheck(this,e),this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=function(){var e=r.media,t=r.hls.latestLevelDetails;if(e&&t){r.currentTime=e.currentTime;var n=r.computeLatency();if(null!==n){r._latency=n;var a=r.config,i=a.lowLatencyMode,s=a.maxLiveSyncPlaybackRate;if(i&&1!==s&&t.live){var o=r.targetLatency;if(null!==o){var l=n-o;if(l<Math.min(r.maxLatency,o+t.targetduration)&&l>.05&&r.forwardBufferLength>1){var c=Math.min(2,Math.max(1,s)),u=Math.round(2/(1+Math.exp(-.75*l-r.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,u))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}}}}},this.hls=t,this.config=t.config,this.registerListeners()}return _createClass(e,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e,t=this.config;if(void 0!==t.liveMaxLatencyDuration)return t.liveMaxLatencyDuration;var r=null==(e=this.hls)?void 0:e.latestLevelDetails;return r?t.liveMaxLatencyDurationCount*r.targetduration:0}},{key:"targetLatency",get:function(){var e=this.hls.latestLevelDetails;if(null===e)return null;var t=e.holdBack,r=e.partHoldBack,n=e.targetduration,a=this.config,i=a.liveSyncDuration,s=a.liveSyncDurationCount,o=a.lowLatencyMode,l=this.hls.userConfig,c=o&&r||t;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||0===c)&&(c=void 0!==i?i:s*n);var u=n;return c+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)},set:function(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency;if(null===e||null===t)return null;var r=this.hls.latestLevelDetails;if(null===r)return null;var n=r.edge,a=e-t-this.edgeStalled,i=n-r.totalduration,s=n-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(i,a),s)}},{key:"drift",get:function(){var e=this.hls.latestLevelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.hls.latestLevelDetails;if(null===e)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.hls.latestLevelDetails;if(!e||!t)return 0;var r=e.buffered.length;return(r?e.buffered.end(r-1):t.edge)-this.currentTime}},{key:"destroy",value:function(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}},{key:"registerListeners",value:function(){this.hls.on(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(x.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(x.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(x.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){this.hls.off(x.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(x.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(x.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(x.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(x.ERROR,this.onError,this)}},{key:"onMediaAttached",value:function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}},{key:"onMediaDetaching",value:function(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}},{key:"onManifestLoading",value:function(){this._latency=null,this.stallCount=0}},{key:"onLevelUpdated",value:function(e,t){var r=t.details;r.advanced&&this.onTimeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}},{key:"onError",value:function(e,t){var r;t.details===w.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(r=this.hls.latestLevelDetails)&&r.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}},{key:"estimateLiveEdge",value:function(){var e=this.hls.latestLevelDetails;return null===e?null:e.edge+e.age}},{key:"computeLatency",value:function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}]),e}(),Oo=function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n){var a;return _classCallCheck(this,r),(a=t.call(this,e,"level-controller"))._levels=[],a._firstLevel=-1,a._maxAutoLevel=-1,a._startLevel=void 0,a.currentLevel=null,a.currentLevelIndex=-1,a.manualLevelIndex=-1,a.steering=void 0,a.onParsedComplete=void 0,a.steering=n,a._registerListeners(),a}return _createClass(r,[{key:"_registerListeners",value:function(){var e=this.hls;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this),e.on(x.ERROR,this.onError,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this),e.off(x.ERROR,this.onError,this)}},{key:"destroy",value:function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),_get(_getPrototypeOf(r.prototype),"destroy",this).call(this)}},{key:"stopLoad",value:function(){var e;_forEachInstanceProperty(e=this._levels).call(e,(function(e){e.loadError=0,e.fragmentError=0})),_get(_getPrototypeOf(r.prototype),"stopLoad",this).call(this)}},{key:"resetLevels",value:function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}},{key:"onManifestLoading",value:function(e,t){this.resetLevels()}},{key:"onManifestLoaded",value:function(e,t){var r,n=this,a=this.hls.config.preferManagedMediaSource,i=[],s={},o={},l=!1,c=!1,u=!1;_forEachInstanceProperty(r=t.levels).call(r,(function(e){var t,r,h,d,f,p,y=e.attrs,g=e.audioCodec,v=e.videoCodec;g&&(e.audioCodec=g=de(g,a)||void 0),0===(null==(p=v)?void 0:_indexOfInstanceProperty(p).call(p,"avc1"))&&(v=e.videoCodec=function(e){for(var t=e.split(","),r=0;r<t.length;r++){var n=t[r].split(".");if(n.length>2){var a,i=n.shift()+".";i+=_parseInt$1(n.shift()).toString(16),i+=_sliceInstanceProperty(a="000"+_parseInt$1(n.shift()).toString(16)).call(a,-4),t[r]=i}}return t.join(",")}(v));var m=e.width,$=e.height,S=e.unknownCodecs,I=S?S.length:0;if(S)for(var _=I;_--;){var E,T,P=S[_];n.isAudioSupported(P)?(e.audioCodec=g=g?_concatInstanceProperty(E="".concat(g,",")).call(E,P):P,I--,ae.audio[g.substring(0,4)]=2):n.isVideoSupported(P)&&(e.videoCodec=v=v?_concatInstanceProperty(T="".concat(v,",")).call(T,P):P,I--,ae.video[v.substring(0,4)]=2)}if(l||(l=!(!m||!$)),c||(c=!!v),u||(u=!!g),!(I||g&&!n.isAudioSupported(g)||v&&!n.isVideoSupported(v))){var b=y.CODECS,k=y["FRAME-RATE"],A=y["HDCP-LEVEL"],R=y["PATHWAY-ID"],O=y.RESOLUTION,L=y["VIDEO-RANGE"],C=_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(h=_concatInstanceProperty(d=_concatInstanceProperty(f="".concat("".concat(R||".","-"),e.bitrate,"-")).call(f,O,"-")).call(d,k,"-")).call(h,b,"-")).call(r,L,"-")).call(t,A);if(s[C])if(s[C].uri===e.url||e.attrs["PATHWAY-ID"])s[C].addGroupId("audio",y.AUDIO),s[C].addGroupId("text",y.SUBTITLES);else{var D=o[C]+=1;e.attrs["PATHWAY-ID"]=new Array(D+1).join(".");var w=new ke(e);s[C]=w,i.push(w)}else{var x=new ke(e);s[C]=x,o[C]=1,i.push(x)}}})),this.filterAndSortMediaOptions(i,t,l,c,u)}},{key:"isAudioSupported",value:function(e){return ie(e,"audio",this.hls.config.preferManagedMediaSource)}},{key:"isVideoSupported",value:function(e){return ie(e,"video",this.hls.config.preferManagedMediaSource)}},{key:"filterAndSortMediaOptions",value:function(e,t,r,n,a){var i,s=this,o=[],l=[],c=e;if((r||n)&&a&&(c=_filterInstanceProperty(c).call(c,(function(e){var t,r=e.videoCodec,n=e.videoRange,a=e.width,i=e.height;return(!!r||!(!a||!i))&&!!(t=n)&&_indexOfInstanceProperty(Ie).call(Ie,t)>-1}))),0!==c.length){t.audioTracks&&Lo(o=_filterInstanceProperty(i=t.audioTracks).call(i,(function(e){return!e.audioCodec||s.isAudioSupported(e.audioCodec)}))),t.subtitles&&Lo(l=t.subtitles);var u=_sliceInstanceProperty(c).call(c,0);_sortInstanceProperty(c).call(c,(function(e,t){if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return _indexOfInstanceProperty(Ie).call(Ie,e.videoRange)-_indexOfInstanceProperty(Ie).call(Ie,t.videoRange);if(e.videoCodec!==t.videoCodec){var n=le(e.videoCodec),a=le(t.videoCodec);if(n!==a)return a-n}if(e.uri===t.uri&&e.codecSet!==t.codecSet){var i=ce(e.codecSet),s=ce(t.codecSet);if(i!==s)return s-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));var h=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c)).length!==u.length)for(var d=0;d<u.length;d++)if(u[d].pathwayId===c[0].pathwayId){h=u[d];break}this._levels=c;for(var f=0;f<c.length;f++)if(c[f]===h){var p,y;this._firstLevel=f;var g=h.bitrate,v=this.hls.bandwidthEstimate;if(this.log(_concatInstanceProperty(p="manifest loaded, ".concat(c.length," level(s) found, first bitrate: ")).call(p,g)),void 0===(null==(y=this.hls.userConfig)?void 0:y.abrEwmaDefaultEstimate)){var m=Math.min(g,this.hls.config.abrEwmaDefaultEstimateMax);m>v&&v===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=m)}break}var $=a&&!n,S={levels:c,audioTracks:o,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:a,video:n,altAudio:!$&&_someInstanceProperty(o).call(o,(function(e){return!!e.url}))};this.hls.trigger(x.MANIFEST_PARSED,S)}else _Promise.resolve().then((function(){if(s.hls){t.levels.length&&s.warn("One or more CODECS in variant not supported: ".concat(_JSON$stringify(t.levels[0].attrs)));var e=new Error("no level with compatible codecs found in manifest");s.hls.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}}))}},{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t,r,n,a,i,s,o,l=this._levels;if(0!==l.length){if(e<0||e>=l.length){var c=new Error("invalid level idx"),u=e<0;if(this.hls.trigger(x.ERROR,{type:D.OTHER_ERROR,details:w.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:c,reason:c.message}),u)return;e=Math.min(e,l.length-1)}var h=this.currentLevelIndex,d=this.currentLevel,f=d?d.attrs["PATHWAY-ID"]:void 0,p=l[e],y=p.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=p,h!==e||!d||f!==y){this.log(_concatInstanceProperty(t=_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o="Switching to level ".concat(e," (")).call(o,p.height?p.height+"p ":"")).call(s,p.videoRange?p.videoRange+" ":"")).call(i,p.codecSet?p.codecSet+" ":"","@")).call(a,p.bitrate,")")).call(n,y?" with Pathway "+y:""," from level ")).call(r,h)).call(t,f?" with Pathway "+f:""));var g={level:e,attrs:p.attrs,details:p.details,bitrate:p.bitrate,averageBitrate:p.averageBitrate,maxBitrate:p.maxBitrate,realBitrate:p.realBitrate,width:p.width,height:p.height,codecSet:p.codecSet,audioCodec:p.audioCodec,videoCodec:p.videoCodec,audioGroups:p.audioGroups,subtitleGroups:p.subtitleGroups,loaded:p.loaded,loadError:p.loadError,fragmentError:p.fragmentError,name:p.name,id:p.id,uri:p.uri,url:p.url,urlId:0,audioGroupIds:p.audioGroupIds,textGroupIds:p.textGroupIds};this.hls.trigger(x.LEVEL_SWITCHING,g);var v=p.details;if(!v||v.live){var m=this.switchParams(p.uri,null==d?void 0:d.details,v);this.loadPlaylist(m)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"pathwayPriority",get:function(){return this.steering?this.steering.pathwayPriority:null},set:function(e){if(this.steering){var t,r=this.steering.pathways(),n=_filterInstanceProperty(e).call(e,(function(e){return-1!==_indexOfInstanceProperty(r).call(r,e)}));if(e.length<1)return void this.warn(_concatInstanceProperty(t="pathwayPriority ".concat(e," should contain at least one pathway from list: ")).call(t,r));this.steering.pathwayPriority=n}}},{key:"onError",value:function(e,t){!t.fatal&&t.context&&t.context.type===N&&t.context.level===this.level&&this.checkRetry(t)}},{key:"onFragBuffered",value:function(e,t){var r=t.frag;if(void 0!==r&&r.type===B){var n,a=r.elementaryStreams;if(!_someInstanceProperty(n=_Object$keys(a)).call(n,(function(e){return!!a[e]})))return;var i=this._levels[r.level];null!=i&&i.loadError&&(this.log("Resetting level error count of ".concat(i.loadError," on frag buffered")),i.loadError=0)}}},{key:"onLevelLoaded",value:function(e,t){var r,n,a=t.level,i=t.details,s=t.levelInfo;if(!s)return this.warn("Invalid level index ".concat(a)),void(null!=(n=t.deliveryDirectives)&&n.skip&&(i.deltaUpdateFailed=!0));if(s===this.currentLevel||t.withoutMultiVariant){0===s.fragmentError&&(s.loadError=0);var o=s.details;o===t.details&&o.advanced&&(o=void 0),this.playlistLoaded(a,t,o)}else null!=(r=t.deliveryDirectives)&&r.skip&&(i.deltaUpdateFailed=!0)}},{key:"loadPlaylist",value:function(e){_get(_getPrototypeOf(r.prototype),"loadPlaylist",this).call(this),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}},{key:"loadingPlaylist",value:function(e,t){var n,a,i,s;_get(_getPrototypeOf(r.prototype),"loadingPlaylist",this).call(this,e,t);var o=this.getUrlWithDirectives(e.uri,t),l=this.currentLevelIndex,c=e.attrs["PATHWAY-ID"],u=e.details,h=null==u?void 0:u.age;this.log(_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s="Loading level index ".concat(l)).call(s,void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")).call(i,c?" Pathway "+c:"")).call(a,h&&u.live?" age "+h.toFixed(1)+(u.type&&" "+u.type||""):""," ")).call(n,o)),this.hls.trigger(x.LEVEL_LOADING,{url:o,level:l,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}},{key:"removeLevel",value:function(e){var t,r,n=this;if(1!==this._levels.length){var a=_filterInstanceProperty(t=this._levels).call(t,(function(t,r){var a;return r!==e||(n.steering&&n.steering.removeLevel(t),t===n.currentLevel&&(n.currentLevel=null,n.currentLevelIndex=-1,t.details&&_forEachInstanceProperty(a=t.details.fragments).call(a,(function(e){return e.level=-1}))),!1)}));$n(a),this._levels=a,this.currentLevelIndex>-1&&null!=(r=this.currentLevel)&&r.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);var i=a.length-1;this._firstLevel=Math.min(this._firstLevel,i),this._startLevel&&(this._startLevel=Math.min(this._startLevel,i)),this.hls.trigger(x.LEVELS_UPDATED,{levels:a})}}},{key:"onLevelsUpdated",value:function(e,t){var r=t.levels;this._levels=r}},{key:"checkMaxAutoUpdated",value:function(){var e=this.hls,t=e.autoLevelCapping,r=e.maxAutoLevel,n=e.maxHdcpLevel;this._maxAutoLevel!==r&&(this._maxAutoLevel=r,this.hls.trigger(x.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:r,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}]),r}(gi);function Lo(e){var t={};_forEachInstanceProperty(e).call(e,(function(e){var r=e.groupId||"";e.id=t[r]=t[r]||0,t[r]++}))}var Co=function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n,a,i){var s;return _classCallCheck(this,r),(s=t.call(this,"gap-controller",i.logger)).config=void 0,s.media=null,s.fragmentTracker=void 0,s.hls=void 0,s.nudgeRetry=0,s.stallReported=!1,s.stalled=null,s.moved=!1,s.seeking=!1,s.ended=0,s.config=e,s.media=n,s.fragmentTracker=a,s.hls=i,s}return _createClass(r,[{key:"destroy",value:function(){this.media=null,this.hls=this.fragmentTracker=null}},{key:"poll",value:function(e,t,r,n){var a=this.config,i=this.media,s=this.stalled;if(null!==i){var o=i.currentTime,l=i.seeking,c=this.seeking&&!l,u=!this.seeking&&l;if(this.seeking=l,o===e)if(u||c)this.stalled=null;else{if(i.paused&&!l||i.ended||0===i.playbackRate||!fr.getBuffered(i).length)return!this.ended&&i.ended&&(this.ended=o||1,this.hls.trigger(x.MEDIA_ENDED,{stalled:!1})),void(this.nudgeRetry=0);var h=fr.bufferInfo(i,o,0),d=h.nextStart||0;if(l){var f=h.len>2,p=!d||t&&t.start<=o||d-o>2&&!this.fragmentTracker.getPartialFragment(o);if(f||p)return;this.moved=!1}if(!this.moved&&null!==this.stalled){if(!(h.len>0||d))return;var y=Math.max(d,h.start||0)-o,g=null!=r&&r.live?2*r.targetduration:2,v=this.fragmentTracker.getPartialFragment(o);if(y>0&&(y<=g||v))return void(i.paused||this._trySkipBufferHole(v))}var m=self.performance.now();if(null!==s){var $=m-s;if(!l&&$>=250){if(n===wn&&(null==r||!r.live)&&Math.abs(o-((null==r?void 0:r.edge)||0))<1){if($<1e3||this.ended)return;return this.ended=o||1,void this.hls.trigger(x.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(h),!this.media)return}var S=fr.bufferInfo(i,o,a.maxBufferHole);this._tryFixBufferStall(S,$)}else this.stalled=m}else if(e&&(this.ended=0),this.moved=!0,l||(this.nudgeRetry=0),null!==s){if(this.stallReported){var I,_=self.performance.now()-s;this.warn(_concatInstanceProperty(I="playback not stuck anymore @".concat(o,", after ")).call(I,Math.round(_),"ms")),this.stallReported=!1}this.stalled=null}}}},{key:"_tryFixBufferStall",value:function(e,t){var r=this.config,n=this.fragmentTracker,a=this.media;if(null!==a){var i=a.currentTime,s=n.getPartialFragment(i);(!s||!this._trySkipBufferHole(s)&&this.media)&&(e.len>r.maxBufferHole||e.nextStart&&e.nextStart-i<r.maxBufferHole)&&t>1e3*r.highBufferWatchdogPeriod&&(this.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}}},{key:"_reportStall",value:function(e){var t=this.hls,r=this.media;if(!this.stallReported&&r){var n;this.stallReported=!0;var a=new Error(_concatInstanceProperty(n="Playback stalling at @".concat(r.currentTime," due to low buffer (")).call(n,_JSON$stringify(e),")"));this.warn(a.message),t.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len})}}},{key:"_trySkipBufferHole",value:function(e){var t=this.config,r=this.hls,n=this.media;if(null===n)return 0;var a=n.currentTime,i=fr.bufferInfo(n,a,0),s=a<i.start?i.start:i.nextStart;if(s){var o=i.len<=t.maxBufferHole,l=i.len>0&&i.len<1&&n.readyState<3,c=s-a;if(c>0&&(o||l)){var u;if(c>t.maxBufferHole){var h=this.fragmentTracker,d=!1;if(0===a){var f=h.getAppendedFrag(0,B);f&&s<f.end&&(d=!0)}if(!d){var p=e||h.getAppendedFrag(a,B);if(p){for(var y=!1,g=p.end;g<s;){var v=h.getPartialFragment(g);if(!v){y=!0;break}g+=v.duration}if(y)return 0}}}var m=Math.max(s+.05,a+.1);if(this.warn(_concatInstanceProperty(u="skipping hole, adjusting currentTime from ".concat(a," to ")).call(u,m)),this.moved=!0,this.stalled=null,n.currentTime=m,e&&!e.gap){var $,S=new Error(_concatInstanceProperty($="fragment loaded with buffer holes, seeking from ".concat(a," to ")).call($,m));r.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:S,reason:S.message,frag:e})}return m}}return 0}},{key:"_tryNudgeBuffer",value:function(){var e=this.config,t=this.hls,r=this.media,n=this.nudgeRetry;if(null!==r){var a=r.currentTime;if(this.nudgeRetry++,n<e.nudgeMaxRetry){var i,s=a+(n+1)*e.nudgeOffset,o=new Error(_concatInstanceProperty(i="Nudging 'currentTime' from ".concat(a," to ")).call(i,s));this.warn(o.message),r.currentTime=s,t.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{var l,c=new Error(_concatInstanceProperty(l="Playhead still not moving while enough data buffered @".concat(a," after ")).call(l,e.nudgeMaxRetry," nudges"));this.error(c.message),t.trigger(x.ERROR,{type:D.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,error:c,fatal:!0})}}}}]),r}(z);function Do(){return self.SourceBuffer||self.WebKitSourceBuffer}function wo(){if(!re())return!1;var e=Do();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}var xo=function(e){_inherits(r,e);var t=_createSuper(r);function r(e,n,a){var i;return _classCallCheck(this,r),(i=t.call(this,e,n,a,"stream-controller",B)).audioCodecSwap=!1,i.gapController=null,i.level=-1,i._forceStartLoad=!1,i._hasEnoughToStart=!1,i.altAudio=0,i.audioOnly=!1,i.fragPlaying=null,i.fragLastKbps=0,i.couldBacktrack=!1,i.backtrackFragment=null,i.audioCodecSwitch=!1,i.videoBuffer=null,i.onMediaPlaying=function(){var e=i.gapController;e&&(e.ended=0),i.tick()},i.onMediaSeeked=function(){var e=i.media,t=e?e.currentTime:null;O(t)&&i.log("Media seeked to ".concat(t.toFixed(3)));var r=i.getMainFwdBufferInfo();null!==r&&0!==r.len?i.tick():i.warn('Main forward buffer length on "seeked" event '.concat(r?r.len:"empty",")"))},i.registerListeners(),i}return _createClass(r,[{key:"registerListeners",value:function(){_get(_getPrototypeOf(r.prototype),"registerListeners",this).call(this);var e=this.hls;e.on(x.MANIFEST_PARSED,this.onManifestParsed,this),e.on(x.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.LEVEL_LOADED,this.onLevelLoaded,this),e.on(x.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(x.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(x.BUFFER_CREATED,this.onBufferCreated,this),e.on(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(x.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"unregisterListeners",value:function(){_get(_getPrototypeOf(r.prototype),"unregisterListeners",this).call(this);var e=this.hls;e.off(x.MANIFEST_PARSED,this.onManifestParsed,this),e.off(x.LEVEL_LOADED,this.onLevelLoaded,this),e.off(x.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(x.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(x.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(x.BUFFER_CREATED,this.onBufferCreated,this),e.off(x.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(x.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"onHandlerDestroying",value:function(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),_get(_getPrototypeOf(r.prototype),"onHandlerDestroying",this).call(this)}},{key:"startLoad",value:function(e,t){if(this.levels){var r=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var a=n.startLevel;-1===a&&(n.config.testBandwidth&&this.levels.length>1?(a=0,this.bitrateTest=!0):a=n.firstAutoLevel),n.nextLoadLevel=a,this.level=n.loadLevel,this._hasEnoughToStart=!1}r>0&&-1===e&&!t&&(this.log("Override startPosition with lastCurrentTime @".concat(r.toFixed(3))),e=r),this.state=kn,this.nextLoadPosition=this.lastCurrentTime=e,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=bn}},{key:"stopLoad",value:function(){this._forceStartLoad=!1,_get(_getPrototypeOf(r.prototype),"stopLoad",this).call(this)}},{key:"doTick",value:function(){switch(this.state){case Nn:var e=this.levels,t=this.level,r=null==e?void 0:e[t],n=null==r?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(n))break;this.state=kn;break}if(this.hls.nextLoadLevel!==this.level){this.state=kn;break}break;case On:var a,i=self.performance.now(),s=this.retryDate;if(!s||i>=s||null!=(a=this.media)&&a.seeking){var o=this.levels,l=this.level,c=null==o?void 0:o[l];this.resetStartWhenNotLoaded(c||null),this.state=kn}}this.state===kn&&this.doTickIdle(),this.onTickEnd()}},{key:"onTickEnd",value:function(){_get(_getPrototypeOf(r.prototype),"onTickEnd",this).call(this),this.checkBuffer(),this.checkFragmentChanged()}},{key:"doTickIdle",value:function(){var e,t=this.hls,r=this.levelLastLoaded,n=this.levels,a=this.media;if(null!==r&&(a||!this.startFragRequested&&t.config.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)){var i=this.buffering?t.nextLoadLevel:t.loadLevel;if(null!=n&&n[i]){var s=n[i],o=this.getMainFwdBufferInfo();if(null!==o){var l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){var c={};return 2===this.altAudio&&(c.type="video"),this.hls.trigger(x.BUFFER_EOS,c),void(this.state=wn)}if(this.buffering){t.loadLevel!==i&&-1===t.manualLevel&&this.log(_concatInstanceProperty(e="Adapting to level ".concat(i," from level ")).call(e,this.level)),this.level=t.nextLoadLevel=i;var u=s.details;if(!u||this.state===Nn||this.waitForLive(s))return this.level=i,this.state=Nn,void(this.startFragRequested=!1);var h=o.len,d=this.getMaxBufferLength(s.maxBitrate);if(!(h>=d)){this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);var f=this.backtrackFragment?this.backtrackFragment.start:o.end,p=this.getNextFragment(f,u);if(this.couldBacktrack&&!this.fragPrevious&&p&&Ot(p)&&this.fragmentTracker.getState(p)!==it){var y,g=(null!=(y=this.backtrackFragment)?y:p).sn-u.startSN,v=u.fragments[g-1];v&&p.cc===v.cc&&(p=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,f)){if(!p.gap){var m=this.audioOnly&&!this.altAudio?bt:kt,$=(m===kt?this.videoBuffer:this.mediaBuffer)||this.media;$&&this.afterBufferFlushed($,m,B)}p=this.getNextFragmentLoopLoading(p,u,o,B,d)}p&&(!p.initSegment||p.initSegment.data||this.bitrateTest||(p=p.initSegment),this.loadFragment(p,s,f))}}}}}}},{key:"loadFragment",value:function(e,t,n){var a,i=this.fragmentTracker.getState(e);i===rt||i===at?Ot(e)?this.bitrateTest?(this.log(_concatInstanceProperty(a="Fragment ".concat(e.sn," of level ")).call(a,e.level," is being downloaded to test bitrate and will not be buffered")),this._loadBitrateTestFrag(e,t)):_get(_getPrototypeOf(r.prototype),"loadFragment",this).call(this,e,t,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}},{key:"getBufferedFrag",value:function(e){return this.fragmentTracker.getBufferedFrag(e,B)}},{key:"followingBufferedFrag",value:function(e){return e?this.getBufferedFrag(e.end+.5):null}},{key:"immediateLevelSwitch",value:function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}},{key:"nextLevelSwitch",value:function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var r,n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);var a=this.getLevelDetails();if(null!=a&&a.live){var i=this.getMainFwdBufferInfo();if(!i||i.len<2*a.targetduration)return}if(!t.paused&&e){var s=e[this.hls.nextLoadLevel],o=this.fragLastKbps;r=o&&this.fragCurrent?this.fragCurrent.duration*s.maxBitrate/(1e3*o)+1:0}else r=0;var l=this.getBufferedFrag(t.currentTime+r);if(l){var c=this.followingBufferedFrag(l);if(c){this.abortCurrentFrag();var u=c.maxStartPTS?c.maxStartPTS:c.start,h=c.duration,d=Math.max(l.end,u+Math.min(Math.max(h-this.config.maxFragLookUpTolerance,h*(this.couldBacktrack?.5:.125)),h*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(d,Number.POSITIVE_INFINITY)}}}}},{key:"abortCurrentFrag",value:function(){var e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case An:case Rn:case On:case Cn:case Dn:this.state=kn}this.nextLoadPosition=this.getLoadPosition()}},{key:"flushMainBuffer",value:function(e,t){_get(_getPrototypeOf(r.prototype),"flushMainBuffer",this).call(this,e,t,2===this.altAudio?"video":null)}},{key:"onMediaAttached",value:function(e,t){_get(_getPrototypeOf(r.prototype),"onMediaAttached",this).call(this,e,t);var n=t.media;n.removeEventListener("playing",this.onMediaPlaying),n.removeEventListener("seeked",this.onMediaSeeked),n.addEventListener("playing",this.onMediaPlaying),n.addEventListener("seeked",this.onMediaSeeked),this.gapController=new Co(this.config,n,this.fragmentTracker,this.hls)}},{key:"onMediaDetaching",value:function(e,t){var n=this.media;n&&(n.removeEventListener("playing",this.onMediaPlaying),n.removeEventListener("seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),_get(_getPrototypeOf(r.prototype),"onMediaDetaching",this).call(this,e,t),t.transferMedia||(this._hasEnoughToStart=!1)}},{key:"triggerEnded",value:function(){var e=this.gapController;if(e){var t;if(e.ended)return;e.ended=(null==(t=this.media)?void 0:t.currentTime)||1}this.hls.trigger(x.MEDIA_ENDED,{stalled:!1})}},{key:"onManifestLoading",value:function(){_get(_getPrototypeOf(r.prototype),"onManifestLoading",this).call(this),this.log("Trigger BUFFER_RESET"),this.hls.trigger(x.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}},{key:"onManifestParsed",value:function(e,t){var r,n,a,i=!1,s=!1;_forEachInstanceProperty(r=t.levels).call(r,(function(e){var t=e.audioCodec;t&&(i=i||-1!==_indexOfInstanceProperty(t).call(t,"mp4a.40.2"),s=s||-1!==_indexOfInstanceProperty(t).call(t,"mp4a.40.5"))})),this.audioCodecSwitch=i&&s&&!("function"==typeof(null==(a=Do())||null==(n=a.prototype)?void 0:n.changeType)),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}},{key:"onLevelLoading",value:function(e,t){if(this.levels&&this.state===kn){var r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=Nn)}}},{key:"onLevelLoaded",value:function(e,t){var r,n,a,i,s,o,l,c,u=this.levels,h=this.startFragRequested,d=t.level,f=t.details,p=f.totalduration;if(u){this.log(_concatInstanceProperty(r=_concatInstanceProperty(n=_concatInstanceProperty(a=_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o="Level ".concat(d," loaded [")).call(o,f.startSN,",")).call(s,f.endSN,"]")).call(i,f.lastPartSn?_concatInstanceProperty(l="[part-".concat(f.lastPartSn,"-")).call(l,f.lastPartIndex,"]"):"",", cc [")).call(a,f.startCC,", ")).call(n,f.endCC,"] duration:")).call(r,p));var y=t.levelInfo,g=this.fragCurrent;!g||this.state!==Rn&&this.state!==On||g.level!==t.level&&g.loader&&this.abortCurrentFrag();var v=0;if(f.live||null!=(c=y.details)&&c.live){var m;if(this.checkLiveUpdate(f),f.deltaUpdateFailed)return;v=this.alignPlaylists(f,y.details,null==(m=this.levelLastLoaded)?void 0:m.details)}if(y.details=f,this.levelLastLoaded=y,h||this.setStartPosition(f,v),this.hls.trigger(x.LEVEL_UPDATED,{details:f,level:d}),this.state===Nn){if(this.waitForCdnTuneIn(f))return;this.state=kn}h&&f.live&&this.synchronizeToLiveEdge(f),this.tick()}else this.warn("Levels were reset while loading level ".concat(d))}},{key:"synchronizeToLiveEdge",value:function(e){var t=this.config,r=this.media;if(r){var n=this.hls.liveSyncPosition,a=r.currentTime,i=e.fragmentStart,s=e.edge,o=a>=i-t.maxFragLookUpTolerance&&a<=s;if(null!==n&&r.duration>n&&(a<n||!o)){var l,c,u=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&r.readyState<4||a<s-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),r.readyState&&(this.warn(_concatInstanceProperty(l=_concatInstanceProperty(c="Playback: ".concat(a.toFixed(3)," is located too far from the end of live sliding playlist: ")).call(c,s,", reset currentTime to : ")).call(l,n.toFixed(3))),r.currentTime=n))}}}},{key:"_handleFragmentLoadProgress",value:function(e){var t,r,n,a,i,s=e.frag,o=e.part,l=e.payload,c=this.levels;if(c){var u=c[s.level];if(u){var h=u.details;if(!h)return this.warn(_concatInstanceProperty(r="Dropping fragment ".concat(s.sn," of level ")).call(r,s.level," after level details were reset")),void this.fragmentTracker.removeFragment(s);var d=u.videoCodec,f=h.PTSKnown||!h.live,p=null==(i=s.initSegment)?void 0:i.data,y=this._getAudioCodec(u),g=this.transmuxer=this.transmuxer||new di(this.hls,B,_bindInstanceProperty(n=this._handleTransmuxComplete).call(n,this),_bindInstanceProperty(a=this._handleTransmuxerFlush).call(a,this)),v=o?o.index:-1,m=-1!==v,$=new hr(s.level,s.sn,s.stats.chunkCount,l.byteLength,v,m),S=this.initPTS[s.cc];g.push(l,p,y,d,s,o,h.totalduration,f,$,S)}else this.warn("Level ".concat(s.level," not found on progress"))}else this.warn(_concatInstanceProperty(t="Levels were reset while fragment load was in progress. Fragment ".concat(s.sn," of level ")).call(t,s.level," will not be buffered"))}},{key:"onAudioTrackSwitching",value:function(e,t){var r=this.hls,n=2===this.altAudio;if(Ne(t.url,r))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();n&&(r.trigger(x.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),r.trigger(x.AUDIO_TRACK_SWITCHED,t)}}},{key:"onAudioTrackSwitched",value:function(e,t){var r=Ne(t.url,this.hls);if(r){var n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r?2:0,this.tick()}},{key:"onBufferCreated",value:function(e,t){var r,n,a=t.tracks,i=!1;for(var s in a){var o=a[s];if("main"===o.id){if(n=s,r=o,"video"===s){var l=a[s];l&&(this.videoBuffer=l.buffer)}}else i=!0}i&&r?(this.log("Alternate track found, use ".concat(n,".buffered to schedule main fragment loading")),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}},{key:"onFragBuffered",value:function(e,t){var r=t.frag,n=t.part,a=r.type===B;if(a){var i,s,o;if(this.fragContextChanged(r))return this.warn(_concatInstanceProperty(i=_concatInstanceProperty(s=_concatInstanceProperty(o="Fragment ".concat(r.sn)).call(o,n?" p: "+n.index:""," of level ")).call(s,r.level," finished buffering, but was aborted. state: ")).call(i,this.state)),void(this.state===Dn&&(this.state=kn));var l=n?n.stats:r.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),Ot(r)&&(this.fragPrevious=r),this.fragBufferedComplete(r,n)}var c=this.media;c&&(!this._hasEnoughToStart&&c.buffered.length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),a&&this.tick())}},{key:"hasEnoughToStart",get:function(){return this._hasEnoughToStart}},{key:"onError",value:function(e,t){var r;if(t.fatal)this.state=xn;else switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(B,t);break;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Nn||(null==(r=t.context)?void 0:r.type)!==N||(this.state=kn);break;case w.BUFFER_APPEND_ERROR:case w.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===w.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}},{key:"checkBuffer",value:function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){if(this._hasEnoughToStart||!fr.getBuffered(e).length){var r=this.state,n=r!==kn?this.fragCurrent:null,a=this.getLevelDetails();t.poll(this.lastCurrentTime,n,a,r)}this.lastCurrentTime=e.currentTime}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=kn,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}},{key:"onBufferFlushed",value:function(e,t){var r=t.type;if(r!==bt||this.audioOnly&&!this.altAudio){var n=(r===kt?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,r,B),this.tick()}}},{key:"onLevelsUpdated",value:function(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}},{key:"swapAudioCodec",value:function(){this.audioCodecSwap=!this.audioCodecSwap}},{key:"seekToStartPos",value:function(){var e=this.media;if(e){var t=e.currentTime,r=this.startPosition;if(r>=0){var n,a,i;if(e.seeking)return void this.log(_concatInstanceProperty(n="could not seek to ".concat(r,", already seeking at ")).call(n,t));var s=this.getLevelDetails(),o=this.config.timelineOffset;o&&r&&(r+=(null==s?void 0:s.appliedTimelineOffset)||o);var l=fr.getBuffered(e),c=l.length?l.start(0):0,u=c-r,h=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);u>0&&(u<h||this.loadingParts&&u<2*((null==s?void 0:s.partTarget)||0))&&(this.log("adjusting start position by ".concat(u," to match buffer start")),r+=u,this.startPosition=r),t<r&&(this.log(_concatInstanceProperty(a=_concatInstanceProperty(i="seek to target start position ".concat(r," from current time ")).call(i,t," buffer start ")).call(a,c)),e.currentTime=r)}}}},{key:"_getAudioCodec",value:function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==_indexOfInstanceProperty(t).call(t,"mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}},{key:"_loadBitrateTestFrag",value:function(e,t){var r=this;e.bitrateTest=!0,this._doFragLoad(e,t).then((function(e){var n=r.hls,a=null==e?void 0:e.frag;if(a&&!r.fragContextChanged(a)){t.fragmentError=0,r.state=kn,r.startFragRequested=!1,r.bitrateTest=!1;var i=a.stats;i.parsing.start=i.parsing.end=i.buffering.start=i.buffering.end=self.performance.now(),n.trigger(x.FRAG_LOADED,e),a.bitrateTest=!1}}))}},{key:"_handleTransmuxComplete",value:function(e){var t,r=this.playlistType,n=this.hls,a=e.remuxResult,i=e.chunkMeta,s=this.getCurrentContext(i);if(s){var o=s.frag,l=s.part,c=s.level,u=a.video,h=a.text,d=a.id3,f=a.initSegment,p=c.details,y=this.altAudio?void 0:a.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=Cn,f){if(null!=f&&f.tracks){var g=o.initSegment||o;this._bufferInitSegment(c,f.tracks,g,i),n.trigger(x.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:r,tracks:f.tracks})}var v=f.initPTS,m=f.timescale;O(v)&&(this.initPTS[o.cc]={baseTime:v,timescale:m},n.trigger(x.INIT_PTS_FOUND,{frag:o,id:r,initPTS:v,timescale:m}))}if(u&&p){var $=p.fragments[o.sn-1-p.startSN],S=o.sn===p.startSN,I=!$||o.cc>$.cc;if(!1!==a.independent){var _=u.startPTS,E=u.endPTS,T=u.startDTS,P=u.endDTS;if(l)l.elementaryStreams[u.type]={startPTS:_,endPTS:E,startDTS:T,endDTS:P};else if(u.firstKeyFrame&&u.independent&&1===i.id&&!I&&(this.couldBacktrack=!0),u.dropped&&u.independent){var b=this.getMainFwdBufferInfo(),k=(b?b.end:this.getLoadPosition())+this.config.maxBufferHole,A=u.firstKeyFramePTS?u.firstKeyFramePTS:_;if(!S&&k<A-this.config.maxBufferHole&&!I)return void this.backtrack(o);I&&(o.gap=!0),o.setElementaryStreamInfo(u.type,o.start,E,o.start,P,!0)}else S&&_-(p.appliedTimelineOffset||0)>2&&(o.gap=!0);o.setElementaryStreamInfo(u.type,_,E,T,P),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(u,o,l,i,S||I)}else{if(!S&&!I)return void this.backtrack(o);o.gap=!0}}if(y){var R=y.startPTS,L=y.endPTS,C=y.startDTS,D=y.endDTS;l&&(l.elementaryStreams[bt]={startPTS:R,endPTS:L,startDTS:C,endDTS:D}),o.setElementaryStreamInfo(bt,R,L,C,D),this.bufferFragmentData(y,o,l,i)}if(p&&null!=d&&null!=(t=d.samples)&&t.length){var w={id:r,frag:o,details:p,samples:d.samples};n.trigger(x.FRAG_PARSING_METADATA,w)}if(p&&h){var M={id:r,frag:o,details:p,samples:h.samples};n.trigger(x.FRAG_PARSING_USERDATA,M)}}}else this.resetWhenMissingContext(i)}},{key:"_bufferInitSegment",value:function(e,t,r,n){var a,i,s=this;if(this.state===Cn){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var o=t.audio,l=t.video,c=t.audiovideo;if(o){var u,h,d,f,p=fe(o.codec,e.audioCodec);"mp4a"===p&&(p="mp4a.40.5");var y=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){p&&(p=-1!==_indexOfInstanceProperty(p).call(p,"mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");var g=o.metadata;g&&"channelCount"in g&&1!==(g.channelCount||1)&&-1===_indexOfInstanceProperty(y).call(y,"firefox")&&(p="mp4a.40.5")}p&&-1!==_indexOfInstanceProperty(p).call(p,"mp4a.40.5")&&-1!==_indexOfInstanceProperty(y).call(y,"android")&&"audio/mpeg"!==o.container&&(p="mp4a.40.2",this.log("Android: force audio codec to ".concat(p))),e.audioCodec&&e.audioCodec!==p&&this.log(_concatInstanceProperty(u='Swapping manifest audio codec "'.concat(e.audioCodec,'" for "')).call(u,p,'"')),o.levelCodec=p,o.id="main",this.log(_concatInstanceProperty(h=_concatInstanceProperty(d=_concatInstanceProperty(f="Init audio buffer, container:".concat(o.container,", codecs[selected/level/parsed]=[")).call(f,p||"","/")).call(d,e.audioCodec||"","/")).call(h,o.codec,"]")),delete t.audiovideo}if(l){var v,m,$;l.levelCodec=e.videoCodec,l.id="main";var S=l.codec;if(4===(null==S?void 0:S.length))switch(S){case"hvc1":case"hev1":l.codec="hvc1.1.6.L120.90";break;case"av01":l.codec="av01.0.04M.08";break;case"avc1":l.codec="avc1.42e01e"}this.log(_concatInstanceProperty(v=_concatInstanceProperty(m=_concatInstanceProperty($="Init video buffer, container:".concat(l.container,", codecs[level/parsed]=[")).call($,e.videoCodec||"","/")).call(m,S)).call(v,l.codec!==S?" parsed-corrected="+l.codec:"","}]")),delete t.audiovideo}c&&(this.log(_concatInstanceProperty(a=_concatInstanceProperty(i="Init audiovideo buffer, container:".concat(c.container,", codecs[level/parsed]=[")).call(i,e.codecs,"/")).call(a,c.codec,"]")),delete t.video,delete t.audio);var I=_Object$keys(t);if(I.length){if(this.hls.trigger(x.BUFFER_CODECS,t),!this.hls)return;_forEachInstanceProperty(I).call(I,(function(e){var a=t[e].initSegment;null!=a&&a.byteLength&&s.hls.trigger(x.BUFFER_APPENDING,{type:e,data:a,frag:r,part:null,chunkMeta:n,parent:r.type})}))}this.tickImmediate()}}},{key:"getMainFwdBufferInfo",value:function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,B)}},{key:"maxBufferLength",get:function(){var e=this.levels,t=this.level,r=null==e?void 0:e[t];return r?this.getMaxBufferLength(r.maxBitrate):this.config.maxBufferLength}},{key:"backtrack",value:function(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=kn}},{key:"checkFragmentChanged",value:function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var r=e.currentTime;if(fr.isBuffered(e,r)?t=this.getAppendedFrag(r):fr.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){this.backtrackFragment=null;var n=this.fragPlaying,a=t.level;n&&t.sn===n.sn&&n.level===a||(this.fragPlaying=t,this.hls.trigger(x.FRAG_CHANGED,{frag:t}),n&&n.level===a||this.hls.trigger(x.LEVEL_SWITCHED,{level:a}))}}}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentFrag",get:function(){var e;if(this.fragPlaying)return this.fragPlaying;var t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;return O(t)?this.getAppendedFrag(t):null}},{key:"currentProgramDateTime",get:function(){var e,t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(O(t)){var r=this.getLevelDetails(),n=this.currentFrag||(r?Ue(null,r.fragments,t):null);if(n){var a=n.programDateTime;if(null!==a){var i=a+1e3*(t-n.start);return new Date(i)}}}return null}},{key:"currentLevel",get:function(){var e=this.currentFrag;return e?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.currentFrag;return e?this.followingBufferedFrag(e):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),r}(Fn),Mo=function(){function e(t){_classCallCheck(this,e),this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}return _createClass(e,[{key:"abort",value:function(e){for(var t in this.keyUriToKeyInfo){var r=this.keyUriToKeyInfo[t].loader;if(r){var n;if(e&&e!==(null==(n=r.context)?void 0:n.frag.type))return;r.abort()}}}},{key:"detach",value:function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}},{key:"destroy",value:function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}},{key:"createKeyLoadError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w.KEY_LOAD_ERROR,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return new cr({type:D.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:a,error:r,networkDetails:n})}},{key:"loadClear",value:function(e,t){var r=this;if(this.emeController&&this.config.emeEnabled)for(var n=e.sn,a=e.cc,i=function(){var e=t[s];if(a<=e.cc&&("initSegment"===n||"initSegment"===e.sn||n<e.sn))return r.emeController.selectKeySystemFormat(e).then((function(t){e.setKeyFormat(t)})),"break"},s=0;s<t.length&&"break"!==i();s++);}},{key:"load",value:function(e){var t=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then((function(r){return t.loadInternal(e,r)})):this.loadInternal(e)}},{key:"loadInternal",value:function(e,t){var r,n;t&&e.setKeyFormat(t);var a=e.decryptdata;if(!a){var i=new Error(t?"Expected frag.decryptdata to be defined after setting format ".concat(t):"Missing decryption data on fragment in onKeyLoading");return _Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,i))}var s=a.uri;if(!s)return _Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error('Invalid key URI: "'.concat(s,'"'))));var o,l=this.keyUriToKeyInfo[s];if(null!=(r=l)&&r.decryptdata.key)return a.key=l.decryptdata.key,_Promise.resolve({frag:e,keyInfo:l});if(null!=(n=l)&&n.keyLoadPromise)switch(null==(o=l.mediaKeySessionContext)?void 0:o.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return l.keyLoadPromise.then((function(t){return a.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:l}}))}switch(l=this.keyUriToKeyInfo[s]={decryptdata:a,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},a.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===a.keyFormat?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return _Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'.concat(a.method,'"'))))}}},{key:"loadKeyEME",value:function(e,t){var r={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var n=this.emeController.loadKey(r);if(n)return(e.keyLoadPromise=n.then((function(t){return e.mediaKeySessionContext=t,r}))).catch((function(t){throw e.keyLoadPromise=null,t}))}return _Promise.resolve(r)}},{key:"loadKeyHTTP",value:function(e,t){var r=this,n=this.config,a=new n.loader(n);return t.keyLoader=e.loader=a,e.keyLoadPromise=new _Promise((function(i,s){var o={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=n.keyLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:function(e,t,n,a){var o=n.frag,l=n.keyInfo,c=n.url;if(!o.decryptdata||l!==r.keyUriToKeyInfo[c])return s(r.createKeyLoadError(o,w.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),a));l.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,l.loader=null,i({frag:o,keyInfo:l})},onError:function(e,n,a,i){var l;r.resetLoader(n),s(r.createKeyLoadError(t,w.KEY_LOAD_ERROR,new Error(_concatInstanceProperty(l="HTTP Error ".concat(e.code," loading key ")).call(l,e.text)),a,q({url:o.url,data:void 0},e)))},onTimeout:function(e,n,a){r.resetLoader(n),s(r.createKeyLoadError(t,w.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),a))},onAbort:function(e,n,a){r.resetLoader(n),s(r.createKeyLoadError(t,w.INTERNAL_ABORTED,new Error("key loading aborted"),a))}};a.load(o,c,u)}))}},{key:"resetLoader",value:function(e){var t=e.frag,r=e.keyInfo,n=e.url,a=r.loader;t.keyLoader===a&&(t.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[n],a&&a.destroy()}}]),e}();function No(e){switch(e.type){case F:return j;case U:return G;default:return B}}function Fo(e,t){var r=e.url;return void 0!==r&&0!==_indexOfInstanceProperty(r).call(r,"data:")||(r=t.url),r}var Uo=function(){function e(t){_classCallCheck(this,e),this.hls=void 0,this.loaders=_Object$create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=t,this.registerListeners()}return _createClass(e,[{key:"startLoad",value:function(e){}},{key:"stopLoad",value:function(){this.destroyInternalLoaders()}},{key:"registerListeners",value:function(){var e=this.hls;e.on(x.MANIFEST_LOADING,this.onManifestLoading,this),e.on(x.LEVEL_LOADING,this.onLevelLoading,this),e.on(x.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(x.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(x.LEVELS_UPDATED,this.onLevelsUpdated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(x.MANIFEST_LOADING,this.onManifestLoading,this),e.off(x.LEVEL_LOADING,this.onLevelLoading,this),e.off(x.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(x.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(x.LEVELS_UPDATED,this.onLevelsUpdated,this)}},{key:"createInternalLoader",value:function(e){var t=this.hls.config,r=t.pLoader,n=t.loader,a=new(r||n)(t);return this.loaders[e.type]=a,a}},{key:"getInternalLoader",value:function(e){return this.loaders[e.type]}},{key:"resetInternalLoader",value:function(e){this.loaders[e]&&delete this.loaders[e]}},{key:"destroyInternalLoaders",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}},{key:"destroy",value:function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}},{key:"onManifestLoading",value:function(e,t){var r=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:M,url:r,deliveryDirectives:null,levelOrTrack:null})}},{key:"onLevelLoading",value:function(e,t){var r=t.id,n=t.level,a=t.pathwayId,i=t.url,s=t.deliveryDirectives,o=t.levelInfo;this.load({id:r,level:n,pathwayId:a,responseType:"text",type:N,url:i,deliveryDirectives:s,levelOrTrack:o})}},{key:"onAudioTrackLoading",value:function(e,t){var r=t.id,n=t.groupId,a=t.url,i=t.deliveryDirectives,s=t.track;this.load({id:r,groupId:n,level:null,responseType:"text",type:F,url:a,deliveryDirectives:i,levelOrTrack:s})}},{key:"onSubtitleTrackLoading",value:function(e,t){var r=t.id,n=t.groupId,a=t.url,i=t.deliveryDirectives,s=t.track;this.load({id:r,groupId:n,level:null,responseType:"text",type:U,url:a,deliveryDirectives:i,levelOrTrack:s})}},{key:"onLevelsUpdated",value:function(e,t){var r=this.loaders[N];if(r){var n,a=r.context;a&&!_someInstanceProperty(n=t.levels).call(n,(function(e){return e===a.levelOrTrack}))&&(r.abort(),delete this.loaders[N])}}},{key:"load",value:function(e){var t,r,n,a=this,i=this.hls.config,s=this.getInternalLoader(e);if(s){var o,l=this.hls.logger,c=s.context;if(c&&c.levelOrTrack===e.levelOrTrack&&(c.url===e.url||c.deliveryDirectives&&!e.deliveryDirectives))return void(c.url===e.url?l.log("[playlist-loader]: ignore ".concat(e.url," ongoing request")):l.log(_concatInstanceProperty(o="[playlist-loader]: ignore ".concat(e.url," in favor of ")).call(o,c.url)));l.log("[playlist-loader]: aborting previous loader for type: ".concat(e.type)),s.abort()}if(r=e.type===M?i.manifestLoadPolicy.default:W({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),O(null==(t=e.deliveryDirectives)?void 0:t.part)&&(e.type===N&&null!==e.level?n=this.hls.levels[e.level].details:e.type===F&&null!==e.id?n=this.hls.audioTracks[e.id].details:e.type===U&&null!==e.id&&(n=this.hls.subtitleTracks[e.id].details),n)){var u=n.partTarget,h=n.targetduration;if(u&&h){var d=1e3*Math.max(3*u,.8*h);r=W({},r,{maxTimeToFirstByteMs:Math.min(d,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(d,r.maxTimeToFirstByteMs)})}}var f=r.errorRetry||r.timeoutRetry||{},p={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:f.maxNumRetry||0,retryDelay:f.retryDelayMs||0,maxRetryDelay:f.maxRetryDelayMs||0},y={onSuccess:function(e,t,r,n){var i=a.getInternalLoader(r);a.resetInternalLoader(r.type);var s=e.data;0===_indexOfInstanceProperty(s).call(s,"#EXTM3U")?(t.parsing.start=performance.now(),en.isMediaPlaylist(s)||r.type!==M?a.handleTrackOrLevelPlaylist(e,t,r,n||null,i):a.handleMasterPlaylist(e,t,r,n)):a.handleManifestParsingError(e,r,new Error("no EXTM3U delimiter"),n||null,t)},onError:function(e,t,r,n){a.handleNetworkError(t,r,!1,e,n)},onTimeout:function(e,t,r){a.handleNetworkError(t,r,!0,void 0,e)}};s.load(e,p,y)}},{key:"checkAutostartLoad",value:function(){var e;if(this.hls){var t=this.hls,r=t.config,n=r.autoStartLoad,a=r.startPosition,i=t.forceStartLoad;(n||i)&&(this.hls.logger.log(_concatInstanceProperty(e="".concat(n?"auto":"force"," startLoad with configured startPosition ")).call(e,a)),this.hls.startLoad(a))}}},{key:"handleMasterPlaylist",value:function(e,t,r,n){var a=this.hls,i=e.data,s=Fo(e,r),o=en.parseMasterPlaylist(i,s);if(o.playlistParsingError)this.handleManifestParsingError(e,r,o.playlistParsingError,n,t);else{var l=o.contentSteering,c=o.levels,u=o.sessionData,h=o.sessionKeys,d=o.startTimeOffset,f=o.variableList;this.variableList=f;var p=en.parseMasterPlaylistMedia(i,s,o),y=p.AUDIO,g=void 0===y?[]:y,v=p.SUBTITLES,m=p["CLOSED-CAPTIONS"];g.length&&(_someInstanceProperty(g).call(g,(function(e){return!e.url}))||!c[0].audioCodec||c[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ir({}),bitrate:0,url:""}))),a.trigger(x.MANIFEST_LOADED,{levels:c,audioTracks:g,subtitles:v,captions:m,contentSteering:l,url:s,stats:t,networkDetails:n,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f})}}},{key:"handleTrackOrLevelPlaylist",value:function(e,t,r,n,a){var i=this.hls,s=r.id,o=r.level,l=r.type,c=Fo(e,r),u=O(o)?o:O(s)?s:0,h=No(r),d=en.parseLevelPlaylist(e.data,c,u,h,0,this.variableList);if(l===M){var f={attrs:new Ir({}),bitrate:0,details:d,name:"",url:c};d.requestScheduled=t.loading.start+gn(d,0),i.trigger(x.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:c,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),r.levelDetails=d,this.handlePlaylistLoaded(d,e,t,r,n,a)}},{key:"handleManifestParsingError",value:function(e,t,r,n,a){this.hls.trigger(x.ERROR,{type:D.NETWORK_ERROR,details:w.MANIFEST_PARSING_ERROR,fatal:t.type===M,url:e.url,err:r,error:r,reason:r.message,response:e,context:t,networkDetails:n,stats:a})}},{key:"handleNetworkError",value:function(e,t){var r,n,a,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,l=_concatInstanceProperty(r="A network ".concat(i?"timeout":"error"+(s?" (status "+s.code+")":"")," occurred while loading ")).call(r,e.type);e.type===N?l+=_concatInstanceProperty(n=": ".concat(e.level," id: ")).call(n,e.id):e.type!==F&&e.type!==U||(l+=_concatInstanceProperty(a=" id: ".concat(e.id,' group-id: "')).call(a,e.groupId,'"'));var c=new Error(l);this.hls.logger.warn("[playlist-loader]: ".concat(l));var u=w.UNKNOWN,h=!1,d=this.getInternalLoader(e);switch(e.type){case M:u=i?w.MANIFEST_LOAD_TIMEOUT:w.MANIFEST_LOAD_ERROR,h=!0;break;case N:u=i?w.LEVEL_LOAD_TIMEOUT:w.LEVEL_LOAD_ERROR,h=!1;break;case F:u=i?w.AUDIO_TRACK_LOAD_TIMEOUT:w.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case U:u=i?w.SUBTITLE_TRACK_LOAD_TIMEOUT:w.SUBTITLE_LOAD_ERROR,h=!1}d&&this.resetInternalLoader(e.type);var f={type:D.NETWORK_ERROR,details:u,fatal:h,url:e.url,loader:d,context:e,error:c,networkDetails:t,stats:o};if(s){var p=(null==t?void 0:t.url)||e.url;f.response=q({url:p,data:void 0},s)}this.hls.trigger(x.ERROR,f)}},{key:"handlePlaylistLoaded",value:function(e,t,r,n,a,i){var s=this.hls,o=n.type,l=n.level,c=n.id,u=n.groupId,h=n.deliveryDirectives,d=Fo(t,n),f=No(n),p="number"==typeof n.level&&f===B?l:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var y=e.playlistParsingError;if(y)s.trigger(x.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:y,reason:y.message,response:t,context:n,level:p,parent:f,networkDetails:a,stats:r});else switch(e.live&&i&&(i.getCacheAge&&(e.ageHeader=i.getCacheAge()||0),i.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),o){case M:case N:s.trigger(x.LEVEL_LOADED,{details:e,levelInfo:n.levelOrTrack||s.levels[0],level:p||0,id:c||0,stats:r,networkDetails:a,deliveryDirectives:h,withoutMultiVariant:o===M});break;case F:s.trigger(x.AUDIO_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:c||0,groupId:u||"",stats:r,networkDetails:a,deliveryDirectives:h});break;case U:s.trigger(x.SUBTITLE_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:c||0,groupId:u||"",stats:r,networkDetails:a,deliveryDirectives:h})}}else{var g=e.playlistParsingError=new Error("No Segments found in Playlist");s.trigger(x.ERROR,{type:D.NETWORK_ERROR,details:w.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:g,reason:g.message,response:t,context:n,level:p,parent:f,networkDetails:a,stats:r})}}}]),e}(),Bo=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,e),this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new jn,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;var r=this.logger=function(e,t,r){var n=J();if("object"==("undefined"==typeof console?"undefined":_typeof(console))&&!0===e||"object"==_typeof(e)){var a=["debug","log","info","warn","error"];_forEachInstanceProperty(a).call(a,(function(t){n[t]=Z(t,e,r)}));try{n.log('Debug logs enabled for "'.concat(t,'" in hls.js version 1.6.0-beta.2'))}catch(e){return J()}_forEachInstanceProperty(a).call(a,(function(t){ee[t]=Z(t,e)}))}else W(ee,n);return n}(t.debug||!1,"Hls instance",t.assetPlayerId),n=this.config=function(e,t,r,n){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var a=Eo(e),i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return _forEachInstanceProperty(n=["manifest","level","frag"]).call(n,(function(e){var n,s,o="".concat("level"===e?"playlist":e,"LoadPolicy"),l=void 0===t[o],c=[];_forEachInstanceProperty(i).call(i,(function(r){var n,i=_concatInstanceProperty(n="".concat(e,"Loading")).call(n,r),s=t[i];if(void 0!==s&&l){c.push(i);var u=a[o].default;switch(t[o]={default:u},r){case"TimeOut":u.maxLoadTimeMs=s,u.maxTimeToFirstByteMs=s;break;case"MaxRetry":u.errorRetry.maxNumRetry=s,u.timeoutRetry.maxNumRetry=s;break;case"RetryDelay":u.errorRetry.retryDelayMs=s,u.timeoutRetry.retryDelayMs=s;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=s,u.timeoutRetry.maxRetryDelayMs=s}}})),c.length&&r.warn(_concatInstanceProperty(n=_concatInstanceProperty(s='hls.js config: "'.concat(c.join('", "'),'" setting(s) are deprecated, use "')).call(s,o,'": ')).call(n,_JSON$stringify(t[o])))})),q(q({},a),t)}(e.DefaultConfig,t,r);this.userConfig=t,n.progressive&&To(n,r);var a=n.abrController,i=n.bufferController,s=n.capLevelController,o=n.errorController,l=n.fpsController,c=new o(this),u=this.abrController=new a(this),h=new st(this),d=n.interstitialsController,f=d?this.interstitialsController=new d(this,e):null,p=this.bufferController=new i(this,h),y=this.capLevelController=new s(this),g=new l(this),v=new Uo(this),m=n.contentSteeringController,$=m?new m(this):null,S=this.levelController=new Oo(this,$),I=new Ao(this),_=new Mo(this.config),E=this.streamController=new xo(this,h,_);y.setStreamController(E),g.setStreamController(E);var T=[v,S,E];f&&_spliceInstanceProperty(T).call(T,1,0,f),$&&_spliceInstanceProperty(T).call(T,1,0,$),this.networkControllers=T;var P=[u,p,y,g,I,h];this.audioTrackController=this.createController(n.audioTrackController,T);var b=n.audioStreamController;b&&T.push(new b(this,h,_)),this.subtitleTrackController=this.createController(n.subtitleTrackController,T);var k=n.subtitleStreamController;k&&T.push(new k(this,h,_)),this.createController(n.timelineController,P),_.emeController=this.emeController=this.createController(n.emeController,P),this.cmcdController=this.createController(n.cmcdController,P),this.latencyController=this.createController(Ro,P),this.coreComponents=P,T.push(c);var A=c.onErrorOut;"function"==typeof A&&this.on(x.ERROR,A,c),this.on(x.MANIFEST_LOADED,v.onManifestLoaded,v)}return _createClass(e,[{key:"createController",value:function(e,t){if(e){var r=new e(this);return t&&t.push(r),r}return null}},{key:"on",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.on(e,t,r)}},{key:"once",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.once(e,t,r)}},{key:"removeAllListeners",value:function(e){this._emitter.removeAllListeners(e)}},{key:"off",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this,n=arguments.length>3?arguments[3]:void 0;this._emitter.off(e,t,r,n)}},{key:"listeners",value:function(e){return this._emitter.listeners(e)}},{key:"emit",value:function(e,t,r){return this._emitter.emit(e,t,r)}},{key:"trigger",value:function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;var r=e===x.ERROR;this.trigger(x.ERROR,{type:D.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,fatal:r,event:e,error:t}),this.triggeringException=!1}}return!1}},{key:"listenerCount",value:function(e){return this._emitter.listenerCount(e)}},{key:"destroy",value:function(){var e,t;this.logger.log("destroy"),this.trigger(x.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,_forEachInstanceProperty(e=this.networkControllers).call(e,(function(e){return e.destroy()})),this.networkControllers.length=0,_forEachInstanceProperty(t=this.coreComponents).call(t,(function(e){return e.destroy()})),this.coreComponents.length=0;var r=this.config;r.xhrSetup=r.fetchSetup=void 0,this.userConfig=null}},{key:"attachMedia",value:function(e){if(!e||"media"in e&&!e.media){var t=new Error("attachMedia failed: invalid argument (".concat(e,")"));this.trigger(x.ERROR,{type:D.OTHER_ERROR,details:w.ATTACH_MEDIA_ERROR,fatal:!0,error:t})}else{this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());var r="media"in e,n=r?e.media:e,a=r?e:{media:n};this._media=n,this.trigger(x.MEDIA_ATTACHING,a)}}},{key:"detachMedia",value:function(){this.logger.log("detachMedia"),this.trigger(x.MEDIA_DETACHING,{}),this._media=null}},{key:"transferMedia",value:function(){this._media=null;var e=this.bufferController.transferMedia();return this.trigger(x.MEDIA_DETACHING,{transferMedia:e}),e}},{key:"loadSource",value:function(e){this.stopLoad();var t=this.media,r=this._url,n=this._url=Tt.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:".concat(n)),t&&r&&(r!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(x.MANIFEST_LOADING,{url:e})}},{key:"url",get:function(){return this._url}},{key:"hasEnoughToStart",get:function(){return this.streamController.hasEnoughToStart}},{key:"startPosition",get:function(){return this.streamController.startPositionValue}},{key:"startLoad",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=arguments.length>1?arguments[1]:void 0;this.logger.log("startLoad(".concat(e+(t?", <skip seek to start>":""),")")),this.started=!0,this.resumeBuffering();for(var r=0;r<this.networkControllers.length&&(this.networkControllers[r].startLoad(e,t),this.started&&this.networkControllers);r++);}},{key:"stopLoad",value:function(){this.logger.log("stopLoad"),this.started=!1;for(var e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!this.started&&this.networkControllers);e++);}},{key:"loadingEnabled",get:function(){return this.started}},{key:"bufferingEnabled",get:function(){return this.streamController.bufferingEnabled}},{key:"resumeBuffering",value:function(){var e;this.bufferingEnabled||(this.logger.log("resume buffering"),_forEachInstanceProperty(e=this.networkControllers).call(e,(function(e){e.resumeBuffering&&e.resumeBuffering()})))}},{key:"pauseBuffering",value:function(){var e;this.bufferingEnabled&&(this.logger.log("pause buffering"),_forEachInstanceProperty(e=this.networkControllers).call(e,(function(e){e.pauseBuffering&&e.pauseBuffering()})))}},{key:"swapAudioCodec",value:function(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){this.logger.log("recoverMediaError");var e=this._media,t=null==e?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}},{key:"removeLevel",value:function(e){this.levelController.removeLevel(e)}},{key:"sessionId",get:function(){var e=this._sessionId;return e||(e=this._sessionId=function(){try{return crypto.randomUUID()}catch(n){try{var e=_URL.createObjectURL(new Blob),t=e.toString();return _URL.revokeObjectURL(e),_sliceInstanceProperty(t).call(t,_lastIndexOfInstanceProperty(t).call(t,"/")+1)}catch(e){var r=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(r+16*Math.random())%16|0;return r=Math.floor(r/16),("x"==e?t:3&t|8).toString(16)}))}}}()),e}},{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"latestLevelDetails",get:function(){return this.streamController.getLevelDetails()||null}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){this.logger.log("set currentLevel:".concat(e)),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){this.logger.log("set nextLevel:".concat(e)),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){this.logger.log("set loadLevel:".concat(e)),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){this.logger.log("set firstLevel:".concat(e)),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){var e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e},set:function(e){this.logger.log("set startLevel:".concat(e)),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(this.logger.log("set autoLevelCapping:".concat(e)),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN},set:function(e){this.abrController.resetEstimator(e)}},{key:"abrEwmaDefaultEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.defaultEstimate:NaN}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){var t;t=e,_indexOfInstanceProperty(Se).call(Se,t)>-1&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var r=e.length,n=0;n<r;n++)if(e[n].maxBitrate>=t)return n;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,r=this.autoLevelCapping,n=this.maxHdcpLevel;if(e=-1===r&&null!=t&&t.length?t.length-1:r,n)for(var a=e;a--;){var i=t[a].attrs["HDCP-LEVEL"];if(i&&i<=n)return a}return e}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(e){this.abrController.nextAutoLevel=e}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"maxBufferLength",get:function(){return this.streamController.maxBufferLength}},{key:"setAudioOption",value:function(e){var t;return(null==(t=this.audioTrackController)?void 0:t.setAudioOption(e))||null}},{key:"setSubtitleOption",value:function(e){var t;return(null==(t=this.subtitleTrackController)?void 0:t.setSubtitleOption(e))||null}},{key:"allAudioTracks",get:function(){var e=this.audioTrackController;return e?e.allAudioTracks:[]}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"allSubtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency},set:function(e){this.latencyController.targetLatency=e}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}},{key:"pathwayPriority",get:function(){return this.levelController.pathwayPriority},set:function(e){this.levelController.pathwayPriority=e}},{key:"bufferedToEnd",get:function(){var e;return!(null==(e=this.bufferController)||!e.bufferedToEnd)}},{key:"interstitialsManager",get:function(){var e;return(null==(e=this.interstitialsController)?void 0:e.interstitialsManager)||null}},{key:"getMediaDecodingInfo",value:function(e){return $e(e,Le(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.allAudioTracks),navigator.mediaCapabilities)}}],[{key:"version",get:function(){return Gn}},{key:"isMSESupported",value:function(){return wo()}},{key:"isSupported",value:function(){return function(e,t){if(!wo())return!1;var r=re();return"function"==typeof(null==r?void 0:r.isTypeSupported)&&(_someInstanceProperty(e=["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"]).call(e,(function(e){return r.isTypeSupported(oe(e,"video"))}))||_someInstanceProperty(t=["mp4a.40.2","fLaC"]).call(t,(function(e){return r.isTypeSupported(oe(e,"audio"))})))}()}},{key:"getMediaSource",value:function(){return re()}},{key:"Events",get:function(){return x}},{key:"MetadataSchema",get:function(){return da}},{key:"ErrorTypes",get:function(){return D}},{key:"ErrorDetails",get:function(){return w}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:_o},set:function(t){e.defaultConfig=t}}]),e}();Bo.defaultConfig=void 0;var jo={liveSyncDuration:{key:"targetLatency",val:10},liveMaxLatencyDuration:{key:"maxLatency",val:20},backBufferLength:{key:"bufferBehind",val:10},initialLiveManifestSize:{key:"minSegmentsStartPlay",val:3},preferManagedMediaSource:{key:"preferMMS",val:!1},lowLatencyMode:{key:"useLowLatency",val:!0}};e.Hls=Bo,e.default=function(e){_inherits(r,e);var t=_createSuper(r);function r(e){var n;_classCallCheck(this,r),(n=t.call(this,e))._tickInterval=500,n._onPlay=function(){n.hls.startLoad()},n._getBufferend=function(e){var t=e.buffered;return t&&t.length?t.end(t.length-1):0},n._tick=function(){clearTimeout(n._tickTimer);var e=n.player.media;if(e){n._tickTimer=_setTimeout(n._tick,n._tickInterval);var t=n._getBufferend(e);t<.1||!e.readyState||n.player.config.isLive&&4===e.readyState&&e.paused&&t-e.currentTime>n.config.disconnectTime&&n.hls.stopLoad()}},n.on=function(e,t){var r;null==(r=n.hls)||r.on(e,t)};var a=e.config||{};return n.config=a,n.player.handleSource=!1,n}return _createClass(r,[{key:"beforePlayerInit",value:function(){this.register(this.player.config.url)}},{key:"initEvt",value:function(){var e=this;this.hls.on(Bo.Events.SUBTITLE_FRAG_PROCESSED,(function(t,r){var n=r.frag;e.player.emit("core_event",{eventName:"core.subtitlesegments",list:n})})),this.hls.on(Bo.Events.MANIFEST_PARSED,(function(t,r){var n=r.levels;e.player.emit("core_event",{eventName:"core.subtitleplaylist",list:n})})),this.hls.on(Bo.Events.MANIFEST_LOADING,(function(t,r){var n=r.url;e.player.emit("core_event",{eventName:"core.loadstart",url:n})})),this.hls.on(Bo.Events.LEVEL_LOADING,(function(t,r){var n=r.url;e.player.emit("core_event",{eventName:"core.loadstart",url:n})})),this.hls.on(Bo.Events.FRAG_LOADING,(function(t,r){var n=r.frag;e.player.emit("core_event",{eventName:"core.loadstart",url:n.url})})),this.hls.on(Bo.Events.MANIFEST_LOADED,(function(t,r){var n=r.url;e.player.emit("core_event",{eventName:"core.loadcomplete",url:n})})),this.hls.on(Bo.Events.LEVEL_LOADED,(function(t,r){var n=r.details,a=r.stats;e.player.emit("core_event",_objectSpread2(_objectSpread2({eventName:"core.loadcomplete"},a),{},{url:null==n?void 0:n.url}))})),this.hls.on(Bo.Events.FRAG_LOADED,(function(t,r){var n=r.frag;e.player.emit("core_event",{eventName:"core.loadcomplete",url:n.url})})),this.hls.on(Bo.Events.FRAG_PARSING_USERDATA,(function(t,r){var n=r.samples;e.player.emit("core_event",{eventName:"core.sei",list:n})})),this.hls.on(Bo.Events.MANIFEST_LOADED,(function(t,r){var n=r.levels,a=r.networkDetails;e.player.emit("core_event",{eventName:"core.hlsmanifestloaded",playlist:n}),e.player.emit("core_event",{eventName:"core.loadresponseheaders",headers:a.headers})})),this.hls.on(Bo.Events.LEVEL_LOADED,(function(t,r){var n,a=r.details,i={};_forEachInstanceProperty(n=_Object$keys(a.dateRanges)).call(n,(function(e){i[e]=a.dateRanges[e].attr["START-DATE"]})),e.player.emit("core_event",{eventName:"core.hlslevelloaded",playlist:_objectSpread2(_objectSpread2({},a),{},{segments:a.fragments,dateRanges:i})})})),this.hls.on(Bo.Events.ERROR,(function(t,r){var n=r.details,a=r.fatal,i=r.type,s=r.response,o=r.reason;if(a){if(i===Bo.ErrorTypes.NETWORK_ERROR){var l=2100;_includesInstanceProperty(n).call(n,"TimeOut")?l=2101:403===(null==s?void 0:s.code)?l=2103:404===(null==s?void 0:s.code)&&(l=2104),e.player.emit("error",{errorType:"network",errorCode:l,errorMessage:n,originError:r})}else e.player.emit("error",{errorType:i,errorMessage:o||n,originError:r});try{e.hls.stopLoad(),e.player.pause()}catch(e){}}})),this.hls.on(Bo.Events.MEDIA_ATTACHED,(function(){e.player.emit("sourceopen")})),this.hls.on(Bo.Events.BUFFER_APPENDED,(function(){e.player.emit("bufferappend")}))}},{key:"afterCreate",value:function(){var e=this,t=this.player.media;this.player.on("urlchange",(function(t){/^blob/.test(t)||(e.playerConfig.url=t,e.register(t))}));try{R.defineGetterOrSetter(this.player,{url:{get:function(){try{return t.src}catch(e){return null}},configurable:!0}})}catch(e){}}},{key:"register",value:function(e){var t=this.player;this.hls&&this.hls.destroy();var r=function(e,t,r){var n=_objectSpread2({progressive:!0},e);_forEachInstanceProperty(r=_Object$keys(jo)).call(r,(function(t){var r=jo[t];n[t]=e[r.key]||r.val}));var a=e.retryCount||3,i=e.retryDelay||1e3,s=e.loadTimeout||1e4,o=e.manifestLoadTimeout||1e4,l={maxNumRetry:a,retryDelayMs:i},c={maxNumRetry:a,retryDelayMs:i};return n.manifestLoadPolicy={default:{maxLoadTimeMs:o,timeoutRetry:l,errorRetry:c}},n.playlistLoadPolicy={default:{maxLoadTimeMs:s,timeoutRetry:l,errorRetry:c}},n.fragLoadPolicy={default:{maxLoadTimeMs:s,timeoutRetry:l,errorRetry:c}},n.fetchSetup=function(r,n){var a;if(_forEachInstanceProperty(a=_Object$keys(e.fetchOptions||{})).call(a,(function(t){n[t]=e.fetchOptions[t]})),t.preProcessUrl){var i=t.preProcessUrl(r.url).url;r.url=i}return new Request(r.url,n)},n}(this.config,t.config);this.hls=new Bo(r),this.initEvt(),this.hls.loadSource(e);var n=this.player.media;this.hls.attachMedia(n),clearTimeout(this._tickTimer),this._tickTimer=_setTimeout(this._tick,this._tickInterval),n.removeEventListener("play",this._onPlay),n.addEventListener("play",this._onPlay)}},{key:"destroy",value:function(){clearTimeout(this._tickTimer),this.hls.destroy()}}],[{key:"pluginName",get:function(){return"hls"}}]),r}(R),_Object$defineProperties(e,_defineProperty({__esModule:{value:!0}},_Symbol$toStringTag,{value:"Module"}))}(index_min$1.exports);var index_minExports=index_min$1.exports,index_min=getDefaultExportFromCjs(index_minExports),DynamicModule=window.VePlayer.DynamicModule,__PLUGIN_NAME__=DynamicModule.PluginHlsJs;export{index_min as HlsPlugin,__PLUGIN_NAME__};
2
+ //# sourceMappingURL=esm/veplayer.plugin.hlsjs.production.js.map