@volcengine/veplayer-plugin 2.8.0-rc.1 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).__VEPLAYER_PLUGIN_HLSJS__={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i=function(e){return e&&e.Math==Math&&e},n=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof t&&t)||function(){return this}()||t||Function("return this")(),a=function(e){try{return!!e()}catch(t){return!0}},s=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),o=s,l=Function.prototype,u=l.apply,c=l.call,h="object"==typeof Reflect&&Reflect.apply||(o?c.bind(u):function(){return c.apply(u,arguments)}),d=s,f=Function.prototype,v=f.call,g=d&&f.bind.bind(v,v),p=d?g:function(e){return function(){return v.apply(e,arguments)}},m=p,y=m({}.toString),E=m("".slice),k=function(e){return E(y(e),8,-1)},T=k,S=p,A=function(e){if("Function"===T(e))return S(e)},L="object"==typeof document&&document.all,b={all:L,IS_HTMLDDA:void 0===L&&void 0!==L},R=b.all,I=b.IS_HTMLDDA?function(e){return"function"==typeof e||e===R}:function(e){return"function"==typeof e},D={},w=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),_=s,P=Function.prototype.call,C=_?P.bind(P):function(){return P.apply(P,arguments)},x={},M={}.propertyIsEnumerable,O=Object.getOwnPropertyDescriptor,F=O&&!M.call({1:2},1);x.f=F?function(e){var t=O(this,e);return!!t&&t.enumerable}:M;var N,U,B=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},G=a,K=k,H=Object,V=p("".split),j=G((function(){return!H("z").propertyIsEnumerable(0)}))?function(e){return"String"==K(e)?V(e,""):H(e)}:H,Y=function(e){return null==e},W=Y,q=TypeError,z=function(e){if(W(e))throw q("Can't call method on "+e);return e},X=j,Q=z,$=function(e){return X(Q(e))},J=I,Z=b.all,ee=b.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:J(e)||e===Z}:function(e){return"object"==typeof e?null!==e:J(e)},te={},re=te,ie=n,ne=I,ae=function(e){return ne(e)?e:void 0},se=function(e,t){return arguments.length<2?ae(re[e])||ae(ie[e]):re[e]&&re[e][t]||ie[e]&&ie[e][t]},oe=p({}.isPrototypeOf),le="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ue=n,ce=le,he=ue.process,de=ue.Deno,fe=he&&he.versions||de&&de.version,ve=fe&&fe.v8;ve&&(U=(N=ve.split("."))[0]>0&&N[0]<4?1:+(N[0]+N[1])),!U&&ce&&(!(N=ce.match(/Edge\/(\d+)/))||N[1]>=74)&&(N=ce.match(/Chrome\/(\d+)/))&&(U=+N[1]);var ge=U,pe=ge,me=a,ye=n.String,Ee=!!Object.getOwnPropertySymbols&&!me((function(){var e=Symbol();return!ye(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&pe&&pe<41})),ke=Ee&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Te=se,Se=I,Ae=oe,Le=Object,be=ke?function(e){return"symbol"==typeof e}:function(e){var t=Te("Symbol");return Se(t)&&Ae(t.prototype,Le(e))},Re=String,Ie=function(e){try{return Re(e)}catch(t){return"Object"}},De=I,we=Ie,_e=TypeError,Pe=function(e){if(De(e))return e;throw _e(we(e)+" is not a function")},Ce=Pe,xe=Y,Me=function(e,t){var r=e[t];return xe(r)?void 0:Ce(r)},Oe=C,Fe=I,Ne=ee,Ue=TypeError,Be={exports:{}},Ge=n,Ke=Object.defineProperty,He=function(e,t){try{Ke(Ge,e,{value:t,configurable:!0,writable:!0})}catch(r){Ge[e]=t}return t},Ve="__core-js_shared__",je=n[Ve]||He(Ve,{}),Ye=je;(Be.exports=function(e,t){return Ye[e]||(Ye[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 We=Be.exports,qe=z,ze=Object,Xe=function(e){return ze(qe(e))},Qe=Xe,$e=p({}.hasOwnProperty),Je=Object.hasOwn||function(e,t){return $e(Qe(e),t)},Ze=p,et=0,tt=Math.random(),rt=Ze(1..toString),it=function(e){return"Symbol("+(void 0===e?"":e)+")_"+rt(++et+tt,36)},nt=We,at=Je,st=it,ot=Ee,lt=ke,ut=n.Symbol,ct=nt("wks"),ht=lt?ut.for||ut:ut&&ut.withoutSetter||st,dt=function(e){return at(ct,e)||(ct[e]=ot&&at(ut,e)?ut[e]:ht("Symbol."+e)),ct[e]},ft=C,vt=ee,gt=be,pt=Me,mt=function(e,t){var r,i;if("string"===t&&Fe(r=e.toString)&&!Ne(i=Oe(r,e)))return i;if(Fe(r=e.valueOf)&&!Ne(i=Oe(r,e)))return i;if("string"!==t&&Fe(r=e.toString)&&!Ne(i=Oe(r,e)))return i;throw Ue("Can't convert object to primitive value")},yt=TypeError,Et=dt("toPrimitive"),kt=function(e,t){if(!vt(e)||gt(e))return e;var r,i=pt(e,Et);if(i){if(void 0===t&&(t="default"),r=ft(i,e,t),!vt(r)||gt(r))return r;throw yt("Can't convert object to primitive value")}return void 0===t&&(t="number"),mt(e,t)},Tt=be,St=function(e){var t=kt(e,"string");return Tt(t)?t:t+""},At=ee,Lt=n.document,bt=At(Lt)&&At(Lt.createElement),Rt=function(e){return bt?Lt.createElement(e):{}},It=Rt,Dt=!w&&!a((function(){return 7!=Object.defineProperty(It("div"),"a",{get:function(){return 7}}).a})),wt=w,_t=C,Pt=x,Ct=B,xt=$,Mt=St,Ot=Je,Ft=Dt,Nt=Object.getOwnPropertyDescriptor;D.f=wt?Nt:function(e,t){if(e=xt(e),t=Mt(t),Ft)try{return Nt(e,t)}catch(r){}if(Ot(e,t))return Ct(!_t(Pt.f,e,t),e[t])};var Ut=a,Bt=I,Gt=/#|\.prototype\./,Kt=function(e,t){var r=Vt[Ht(e)];return r==Yt||r!=jt&&(Bt(t)?Ut(t):!!t)},Ht=Kt.normalize=function(e){return String(e).replace(Gt,".").toLowerCase()},Vt=Kt.data={},jt=Kt.NATIVE="N",Yt=Kt.POLYFILL="P",Wt=Kt,qt=Pe,zt=s,Xt=A(A.bind),Qt=function(e,t){return qt(e),void 0===t?e:zt?Xt(e,t):function(){return e.apply(t,arguments)}},$t={},Jt=w&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Zt=ee,er=String,tr=TypeError,rr=function(e){if(Zt(e))return e;throw tr(er(e)+" is not an object")},ir=w,nr=Dt,ar=Jt,sr=rr,or=St,lr=TypeError,ur=Object.defineProperty,cr=Object.getOwnPropertyDescriptor,hr="enumerable",dr="configurable",fr="writable";$t.f=ir?ar?function(e,t,r){if(sr(e),t=or(t),sr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&fr in r&&!r[fr]){var i=cr(e,t);i&&i[fr]&&(e[t]=r.value,r={configurable:dr in r?r[dr]:i[dr],enumerable:hr in r?r[hr]:i[hr],writable:!1})}return ur(e,t,r)}:ur:function(e,t,r){if(sr(e),t=or(t),sr(r),nr)try{return ur(e,t,r)}catch(i){}if("get"in r||"set"in r)throw lr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var vr=$t,gr=B,pr=w?function(e,t,r){return vr.f(e,t,gr(1,r))}:function(e,t,r){return e[t]=r,e},mr=n,yr=h,Er=A,kr=I,Tr=D.f,Sr=Wt,Ar=te,Lr=Qt,br=pr,Rr=Je,Ir=function(e){var t=function(r,i,n){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,i)}return new e(r,i,n)}return yr(e,this,arguments)};return t.prototype=e.prototype,t},Dr=function(e,t){var r,i,n,a,s,o,l,u,c,h=e.target,d=e.global,f=e.stat,v=e.proto,g=d?mr:f?mr[h]:(mr[h]||{}).prototype,p=d?Ar:Ar[h]||br(Ar,h,{})[h],m=p.prototype;for(a in t)i=!(r=Sr(d?a:h+(f?".":"#")+a,e.forced))&&g&&Rr(g,a),o=p[a],i&&(l=e.dontCallGetSet?(c=Tr(g,a))&&c.value:g[a]),s=i&&l?l:t[a],i&&typeof o==typeof s||(u=e.bind&&i?Lr(s,mr):e.wrap&&i?Ir(s):v&&kr(s)?Er(s):s,(e.sham||s&&s.sham||o&&o.sham)&&br(u,"sham",!0),br(p,a,u),v&&(Rr(Ar,n=h+"Prototype")||br(Ar,n,{}),br(Ar[n],a,s),e.real&&m&&(r||!m[a])&&br(m,a,s)))},wr=Math.ceil,_r=Math.floor,Pr=Math.trunc||function(e){var t=+e;return(t>0?_r:wr)(t)},Cr=function(e){var t=+e;return t!=t||0===t?0:Pr(t)},xr=Cr,Mr=Math.max,Or=Math.min,Fr=function(e,t){var r=xr(e);return r<0?Mr(r+t,0):Or(r,t)},Nr=Cr,Ur=Math.min,Br=function(e){return e>0?Ur(Nr(e),9007199254740991):0},Gr=Br,Kr=function(e){return Gr(e.length)},Hr=$,Vr=Fr,jr=Kr,Yr=function(e){return function(t,r,i){var n,a=Hr(t),s=jr(a),o=Vr(i,s);if(e&&r!=r){for(;s>o;)if((n=a[o++])!=n)return!0}else for(;s>o;o++)if((e||o in a)&&a[o]===r)return e||o||0;return!e&&-1}},Wr={includes:Yr(!0),indexOf:Yr(!1)},qr={},zr=Je,Xr=$,Qr=Wr.indexOf,$r=qr,Jr=p([].push),Zr=function(e,t){var r,i=Xr(e),n=0,a=[];for(r in i)!zr($r,r)&&zr(i,r)&&Jr(a,r);for(;t.length>n;)zr(i,r=t[n++])&&(~Qr(a,r)||Jr(a,r));return a},ei=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ti=Zr,ri=ei,ii=Object.keys||function(e){return ti(e,ri)},ni=Xe,ai=ii;Dr({target:"Object",stat:!0,forced:a((function(){ai(1)}))},{keys:function(e){return ai(ni(e))}});var si=te.Object.keys,oi=r(si),li={};li[dt("toStringTag")]="z";var ui="[object z]"===String(li),ci=ui,hi=I,di=k,fi=dt("toStringTag"),vi=Object,gi="Arguments"==di(function(){return arguments}()),pi=ci?di:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=vi(e),fi))?r:gi?di(t):"Object"==(i=di(t))&&hi(t.callee)?"Arguments":i},mi=pi,yi=String,Ei=function(e){if("Symbol"===mi(e))throw TypeError("Cannot convert a Symbol value to a string");return yi(e)},ki={},Ti=w,Si=Jt,Ai=$t,Li=rr,bi=$,Ri=ii;ki.f=Ti&&!Si?Object.defineProperties:function(e,t){Li(e);for(var r,i=bi(t),n=Ri(t),a=n.length,s=0;a>s;)Ai.f(e,r=n[s++],i[r]);return e};var Ii,Di=se("document","documentElement"),wi=it,_i=We("keys"),Pi=function(e){return _i[e]||(_i[e]=wi(e))},Ci=rr,xi=ki,Mi=ei,Oi=qr,Fi=Di,Ni=Rt,Ui="prototype",Bi="script",Gi=Pi("IE_PROTO"),Ki=function(){},Hi=function(e){return"<"+Bi+">"+e+"</"+Bi+">"},Vi=function(e){e.write(Hi("")),e.close();var t=e.parentWindow.Object;return e=null,t},ji=function(){try{Ii=new ActiveXObject("htmlfile")}catch(n){}var e,t,r;ji="undefined"!=typeof document?document.domain&&Ii?Vi(Ii):(t=Ni("iframe"),r="java"+Bi+":",t.style.display="none",Fi.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Hi("document.F=Object")),e.close(),e.F):Vi(Ii);for(var i=Mi.length;i--;)delete ji[Ui][Mi[i]];return ji()};Oi[Gi]=!0;var Yi=Object.create||function(e,t){var r;return null!==e?(Ki[Ui]=Ci(e),r=new Ki,Ki[Ui]=null,r[Gi]=e):r=ji(),void 0===t?r:xi.f(r,t)},Wi={},qi=Zr,zi=ei.concat("length","prototype");Wi.f=Object.getOwnPropertyNames||function(e){return qi(e,zi)};var Xi={},Qi=St,$i=$t,Ji=B,Zi=function(e,t,r){var i=Qi(t);i in e?$i.f(e,i,Ji(0,r)):e[i]=r},en=Fr,tn=Kr,rn=Zi,nn=Array,an=Math.max,sn=function(e,t,r){for(var i=tn(e),n=en(t,i),a=en(void 0===r?i:r,i),s=nn(an(a-n,0)),o=0;n<a;n++,o++)rn(s,o,e[n]);return s.length=o,s},on=k,ln=$,un=Wi.f,cn=sn,hn="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Xi.f=function(e){return hn&&"Window"==on(e)?function(e){try{return un(e)}catch(t){return cn(hn)}}(e):un(ln(e))};var dn={};dn.f=Object.getOwnPropertySymbols;var fn=pr,vn=function(e,t,r,i){return i&&i.enumerable?e[t]=r:fn(e,t,r),e},gn=$t,pn=function(e,t,r){return gn.f(e,t,r)},mn={},yn=dt;mn.f=yn;var En,kn,Tn,Sn=te,An=Je,Ln=mn,bn=$t.f,Rn=function(e){var t=Sn.Symbol||(Sn.Symbol={});An(t,e)||bn(t,e,{value:Ln.f(e)})},In=C,Dn=se,wn=dt,_n=vn,Pn=function(){var e=Dn("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,i=wn("toPrimitive");t&&!t[i]&&_n(t,i,(function(e){return In(r,this)}),{arity:1})},Cn=pi,xn=ui?{}.toString:function(){return"[object "+Cn(this)+"]"},Mn=ui,On=$t.f,Fn=pr,Nn=Je,Un=xn,Bn=dt("toStringTag"),Gn=function(e,t,r,i){if(e){var n=r?e:e.prototype;Nn(n,Bn)||On(n,Bn,{configurable:!0,value:t}),i&&!Mn&&Fn(n,"toString",Un)}},Kn=I,Hn=n.WeakMap,Vn=Kn(Hn)&&/native code/.test(String(Hn)),jn=n,Yn=ee,Wn=pr,qn=Je,zn=je,Xn=Pi,Qn=qr,$n="Object already initialized",Jn=jn.TypeError,Zn=jn.WeakMap;if(Vn||zn.state){var ea=zn.state||(zn.state=new Zn);ea.get=ea.get,ea.has=ea.has,ea.set=ea.set,En=function(e,t){if(ea.has(e))throw Jn($n);return t.facade=e,ea.set(e,t),t},kn=function(e){return ea.get(e)||{}},Tn=function(e){return ea.has(e)}}else{var ta=Xn("state");Qn[ta]=!0,En=function(e,t){if(qn(e,ta))throw Jn($n);return t.facade=e,Wn(e,ta,t),t},kn=function(e){return qn(e,ta)?e[ta]:{}},Tn=function(e){return qn(e,ta)}}var ra={set:En,get:kn,has:Tn,enforce:function(e){return Tn(e)?kn(e):En(e,{})},getterFor:function(e){return function(t){var r;if(!Yn(t)||(r=kn(t)).type!==e)throw Jn("Incompatible receiver, "+e+" required");return r}}},ia=k,na=Array.isArray||function(e){return"Array"==ia(e)},aa=I,sa=je,oa=p(Function.toString);aa(sa.inspectSource)||(sa.inspectSource=function(e){return oa(e)});var la=sa.inspectSource,ua=p,ca=a,ha=I,da=pi,fa=la,va=function(){},ga=[],pa=se("Reflect","construct"),ma=/^\s*(?:class|function)\b/,ya=ua(ma.exec),Ea=!ma.exec(va),ka=function(e){if(!ha(e))return!1;try{return pa(va,ga,e),!0}catch(t){return!1}},Ta=function(e){if(!ha(e))return!1;switch(da(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ea||!!ya(ma,fa(e))}catch(t){return!0}};Ta.sham=!0;var Sa=!pa||ca((function(){var e;return ka(ka.call)||!ka(Object)||!ka((function(){e=!0}))||e}))?Ta:ka,Aa=na,La=Sa,ba=ee,Ra=dt("species"),Ia=Array,Da=function(e){var t;return Aa(e)&&(t=e.constructor,(La(t)&&(t===Ia||Aa(t.prototype))||ba(t)&&null===(t=t[Ra]))&&(t=void 0)),void 0===t?Ia:t},wa=function(e,t){return new(Da(e))(0===t?0:t)},_a=Qt,Pa=j,Ca=Xe,xa=Kr,Ma=wa,Oa=p([].push),Fa=function(e){var t=1==e,r=2==e,i=3==e,n=4==e,a=6==e,s=7==e,o=5==e||a;return function(l,u,c,h){for(var d,f,v=Ca(l),g=Pa(v),p=_a(u,c),m=xa(g),y=0,E=h||Ma,k=t?E(l,m):r||s?E(l,0):void 0;m>y;y++)if((o||y in g)&&(f=p(d=g[y],y,v),e))if(t)k[y]=f;else if(f)switch(e){case 3:return!0;case 5:return d;case 6:return y;case 2:Oa(k,d)}else switch(e){case 4:return!1;case 7:Oa(k,d)}return a?-1:i||n?n:k}},Na={forEach:Fa(0),map:Fa(1),filter:Fa(2),some:Fa(3),every:Fa(4),find:Fa(5),findIndex:Fa(6),filterReject:Fa(7)},Ua=Dr,Ba=n,Ga=C,Ka=p,Ha=w,Va=Ee,ja=a,Ya=Je,Wa=oe,qa=rr,za=$,Xa=St,Qa=Ei,$a=B,Ja=Yi,Za=ii,es=Wi,ts=Xi,rs=dn,is=D,ns=$t,as=ki,ss=x,os=vn,ls=pn,us=We,cs=qr,hs=it,ds=dt,fs=mn,vs=Rn,gs=Pn,ps=Gn,ms=ra,ys=Na.forEach,Es=Pi("hidden"),ks="Symbol",Ts="prototype",Ss=ms.set,As=ms.getterFor(ks),Ls=Object[Ts],bs=Ba.Symbol,Rs=bs&&bs[Ts],Is=Ba.TypeError,Ds=Ba.QObject,ws=is.f,_s=ns.f,Ps=ts.f,Cs=ss.f,xs=Ka([].push),Ms=us("symbols"),Os=us("op-symbols"),Fs=us("wks"),Ns=!Ds||!Ds[Ts]||!Ds[Ts].findChild,Us=Ha&&ja((function(){return 7!=Ja(_s({},"a",{get:function(){return _s(this,"a",{value:7}).a}})).a}))?function(e,t,r){var i=ws(Ls,t);i&&delete Ls[t],_s(e,t,r),i&&e!==Ls&&_s(Ls,t,i)}:_s,Bs=function(e,t){var r=Ms[e]=Ja(Rs);return Ss(r,{type:ks,tag:e,description:t}),Ha||(r.description=t),r},Gs=function(e,t,r){e===Ls&&Gs(Os,t,r),qa(e);var i=Xa(t);return qa(r),Ya(Ms,i)?(r.enumerable?(Ya(e,Es)&&e[Es][i]&&(e[Es][i]=!1),r=Ja(r,{enumerable:$a(0,!1)})):(Ya(e,Es)||_s(e,Es,$a(1,{})),e[Es][i]=!0),Us(e,i,r)):_s(e,i,r)},Ks=function(e,t){qa(e);var r=za(t),i=Za(r).concat(Ys(r));return ys(i,(function(t){Ha&&!Ga(Hs,r,t)||Gs(e,t,r[t])})),e},Hs=function(e){var t=Xa(e),r=Ga(Cs,this,t);return!(this===Ls&&Ya(Ms,t)&&!Ya(Os,t))&&(!(r||!Ya(this,t)||!Ya(Ms,t)||Ya(this,Es)&&this[Es][t])||r)},Vs=function(e,t){var r=za(e),i=Xa(t);if(r!==Ls||!Ya(Ms,i)||Ya(Os,i)){var n=ws(r,i);return!n||!Ya(Ms,i)||Ya(r,Es)&&r[Es][i]||(n.enumerable=!0),n}},js=function(e){var t=Ps(za(e)),r=[];return ys(t,(function(e){Ya(Ms,e)||Ya(cs,e)||xs(r,e)})),r},Ys=function(e){var t=e===Ls,r=Ps(t?Os:za(e)),i=[];return ys(r,(function(e){!Ya(Ms,e)||t&&!Ya(Ls,e)||xs(i,Ms[e])})),i};Va||(bs=function(){if(Wa(Rs,this))throw Is("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Qa(arguments[0]):void 0,t=hs(e),r=function(e){this===Ls&&Ga(r,Os,e),Ya(this,Es)&&Ya(this[Es],t)&&(this[Es][t]=!1),Us(this,t,$a(1,e))};return Ha&&Ns&&Us(Ls,t,{configurable:!0,set:r}),Bs(t,e)},os(Rs=bs[Ts],"toString",(function(){return As(this).tag})),os(bs,"withoutSetter",(function(e){return Bs(hs(e),e)})),ss.f=Hs,ns.f=Gs,as.f=Ks,is.f=Vs,es.f=ts.f=js,rs.f=Ys,fs.f=function(e){return Bs(ds(e),e)},Ha&&ls(Rs,"description",{configurable:!0,get:function(){return As(this).description}})),Ua({global:!0,constructor:!0,wrap:!0,forced:!Va,sham:!Va},{Symbol:bs}),ys(Za(Fs),(function(e){vs(e)})),Ua({target:ks,stat:!0,forced:!Va},{useSetter:function(){Ns=!0},useSimple:function(){Ns=!1}}),Ua({target:"Object",stat:!0,forced:!Va,sham:!Ha},{create:function(e,t){return void 0===t?Ja(e):Ks(Ja(e),t)},defineProperty:Gs,defineProperties:Ks,getOwnPropertyDescriptor:Vs}),Ua({target:"Object",stat:!0,forced:!Va},{getOwnPropertyNames:js}),gs(),ps(bs,ks),cs[Es]=!0;var Ws=Ee&&!!Symbol.for&&!!Symbol.keyFor,qs=Dr,zs=se,Xs=Je,Qs=Ei,$s=We,Js=Ws,Zs=$s("string-to-symbol-registry"),eo=$s("symbol-to-string-registry");qs({target:"Symbol",stat:!0,forced:!Js},{for:function(e){var t=Qs(e);if(Xs(Zs,t))return Zs[t];var r=zs("Symbol")(t);return Zs[t]=r,eo[r]=t,r}});var to=Dr,ro=Je,io=be,no=Ie,ao=Ws,so=We("symbol-to-string-registry");to({target:"Symbol",stat:!0,forced:!ao},{keyFor:function(e){if(!io(e))throw TypeError(no(e)+" is not a symbol");if(ro(so,e))return so[e]}});var oo=p([].slice),lo=na,uo=I,co=k,ho=Ei,fo=p([].push),vo=Dr,go=se,po=h,mo=C,yo=p,Eo=a,ko=I,To=be,So=oo,Ao=function(e){if(uo(e))return e;if(lo(e)){for(var t=e.length,r=[],i=0;i<t;i++){var n=e[i];"string"==typeof n?fo(r,n):"number"!=typeof n&&"Number"!=co(n)&&"String"!=co(n)||fo(r,ho(n))}var a=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(lo(this))return t;for(var i=0;i<a;i++)if(r[i]===e)return t}}},Lo=Ee,bo=String,Ro=go("JSON","stringify"),Io=yo(/./.exec),Do=yo("".charAt),wo=yo("".charCodeAt),_o=yo("".replace),Po=yo(1..toString),Co=/[\uD800-\uDFFF]/g,xo=/^[\uD800-\uDBFF]$/,Mo=/^[\uDC00-\uDFFF]$/,Oo=!Lo||Eo((function(){var e=go("Symbol")();return"[null]"!=Ro([e])||"{}"!=Ro({a:e})||"{}"!=Ro(Object(e))})),Fo=Eo((function(){return'"\\udf06\\ud834"'!==Ro("\udf06\ud834")||'"\\udead"'!==Ro("\udead")})),No=function(e,t){var r=So(arguments),i=Ao(t);if(ko(i)||void 0!==e&&!To(e))return r[1]=function(e,t){if(ko(i)&&(t=mo(i,this,bo(e),t)),!To(t))return t},po(Ro,null,r)},Uo=function(e,t,r){var i=Do(r,t-1),n=Do(r,t+1);return Io(xo,e)&&!Io(Mo,n)||Io(Mo,e)&&!Io(xo,i)?"\\u"+Po(wo(e,0),16):e};Ro&&vo({target:"JSON",stat:!0,arity:3,forced:Oo||Fo},{stringify:function(e,t,r){var i=So(arguments),n=po(Oo?No:Ro,null,i);return Fo&&"string"==typeof n?_o(n,Co,Uo):n}});var Bo=dn,Go=Xe;Dr({target:"Object",stat:!0,forced:!Ee||a((function(){Bo.f(1)}))},{getOwnPropertySymbols:function(e){var t=Bo.f;return t?t(Go(e)):[]}});var Ko=te.Object.getOwnPropertySymbols,Ho=r(Ko),Vo=a,jo=ge,Yo=dt("species"),Wo=function(e){return jo>=51||!Vo((function(){var t=[];return(t.constructor={})[Yo]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},qo=Na.filter;Dr({target:"Array",proto:!0,forced:!Wo("filter")},{filter:function(e){return qo(this,e,arguments.length>1?arguments[1]:void 0)}});var zo=te,Xo=function(e){return zo[e+"Prototype"]},Qo=Xo("Array").filter,$o=oe,Jo=Qo,Zo=Array.prototype,el=function(e){var t=e.filter;return e===Zo||$o(Zo,e)&&t===Zo.filter?Jo:t},tl=r(el),rl={exports:{}},il=Dr,nl=a,al=$,sl=D.f,ol=w;il({target:"Object",stat:!0,forced:!ol||nl((function(){sl(1)})),sham:!ol},{getOwnPropertyDescriptor:function(e,t){return sl(al(e),t)}});var ll=te.Object,ul=rl.exports=function(e,t){return ll.getOwnPropertyDescriptor(e,t)};ll.getOwnPropertyDescriptor.sham&&(ul.sham=!0);var cl=rl.exports,hl=r(cl),dl=w,fl=na,vl=TypeError,gl=Object.getOwnPropertyDescriptor,pl=dl&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(fl(e)&&!gl(e,"length").writable)throw vl("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},ml=TypeError,yl=function(e){if(e>9007199254740991)throw ml("Maximum allowed index exceeded");return e},El=Xe,kl=Kr,Tl=pl,Sl=yl;Dr({target:"Array",proto:!0,arity:1,forced:a((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=El(this),r=kl(t),i=arguments.length;Sl(r+i);for(var n=0;n<i;n++)t[r]=arguments[n],r++;return Tl(t,r),r}});var Al,Ll,bl,Rl=Xo("Array").push,Il=oe,Dl=Rl,wl=Array.prototype,_l=r((function(e){var t=e.push;return e===wl||Il(wl,e)&&t===wl.push?Dl:t})),Pl={},Cl=w,xl=Je,Ml=Function.prototype,Ol=Cl&&Object.getOwnPropertyDescriptor,Fl=xl(Ml,"name"),Nl={EXISTS:Fl,PROPER:Fl&&"something"===function(){}.name,CONFIGURABLE:Fl&&(!Cl||Cl&&Ol(Ml,"name").configurable)},Ul=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Bl=Je,Gl=I,Kl=Xe,Hl=Ul,Vl=Pi("IE_PROTO"),jl=Object,Yl=jl.prototype,Wl=Hl?jl.getPrototypeOf:function(e){var t=Kl(e);if(Bl(t,Vl))return t[Vl];var r=t.constructor;return Gl(r)&&t instanceof r?r.prototype:t instanceof jl?Yl:null},ql=a,zl=I,Xl=ee,Ql=Yi,$l=Wl,Jl=vn,Zl=dt("iterator"),eu=!1;[].keys&&("next"in(bl=[].keys())?(Ll=$l($l(bl)))!==Object.prototype&&(Al=Ll):eu=!0);var tu=!Xl(Al)||ql((function(){var e={};return Al[Zl].call(e)!==e}));zl((Al=tu?{}:Ql(Al))[Zl])||Jl(Al,Zl,(function(){return this}));var ru={IteratorPrototype:Al,BUGGY_SAFARI_ITERATORS:eu},iu=ru.IteratorPrototype,nu=Yi,au=B,su=Gn,ou=Pl,lu=function(){return this},uu=function(e,t,r,i){var n=t+" Iterator";return e.prototype=nu(iu,{next:au(+!i,r)}),su(e,n,!1,!0),ou[n]=lu,e},cu=p,hu=Pe,du=I,fu=String,vu=TypeError,gu=function(e,t,r){try{return cu(hu(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(i){}},pu=rr,mu=function(e){if("object"==typeof e||du(e))return e;throw vu("Can't set "+fu(e)+" as a prototype")},yu=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=gu(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(i){}return function(r,i){return pu(r),mu(i),t?e(r,i):r.__proto__=i,r}}():void 0),Eu=Dr,ku=C,Tu=Nl,Su=uu,Au=Wl,Lu=Gn,bu=vn,Ru=Pl,Iu=ru,Du=Tu.PROPER,wu=Iu.BUGGY_SAFARI_ITERATORS,_u=dt("iterator"),Pu="keys",Cu="values",xu="entries",Mu=function(){return this},Ou=function(e,t,r,i,n,a,s){Su(r,t,i);var o,l,u,c=function(e){if(e===n&&g)return g;if(!wu&&e in f)return f[e];switch(e){case Pu:case Cu:case xu:return function(){return new r(this,e)}}return function(){return new r(this)}},h=t+" Iterator",d=!1,f=e.prototype,v=f[_u]||f["@@iterator"]||n&&f[n],g=!wu&&v||c(n),p="Array"==t&&f.entries||v;if(p&&(o=Au(p.call(new e)))!==Object.prototype&&o.next&&(Lu(o,h,!0,!0),Ru[h]=Mu),Du&&n==Cu&&v&&v.name!==Cu&&(d=!0,g=function(){return ku(v,this)}),n)if(l={values:c(Cu),keys:a?g:c(Pu),entries:c(xu)},s)for(u in l)(wu||d||!(u in f))&&bu(f,u,l[u]);else Eu({target:t,proto:!0,forced:wu||d},l);return s&&f[_u]!==g&&bu(f,_u,g,{name:n}),Ru[t]=g,l},Fu=function(e,t){return{value:e,done:t}},Nu=$,Uu=Pl,Bu=ra;$t.f;var Gu=Ou,Ku=Fu,Hu="Array Iterator",Vu=Bu.set,ju=Bu.getterFor(Hu);Gu(Array,"Array",(function(e,t){Vu(this,{type:Hu,target:Nu(e),index:0,kind:t})}),(function(){var e=ju(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,Ku(void 0,!0)):Ku("keys"==r?i:"values"==r?t[i]:[i,t[i]],!1)}),"values"),Uu.Arguments=Uu.Array;var Yu={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},Wu=n,qu=pi,zu=pr,Xu=Pl,Qu=dt("toStringTag");for(var $u in Yu){var Ju=Wu[$u],Zu=Ju&&Ju.prototype;Zu&&qu(Zu)!==Qu&&zu(Zu,Qu,$u),Xu[$u]=Xu.Array}var ec=a,tc=function(e,t){var r=[][e];return!!r&&ec((function(){r.call(null,t||function(){return 1},1)}))},rc=Na.forEach,ic=tc("forEach")?[].forEach:function(e){return rc(this,e,arguments.length>1?arguments[1]:void 0)};Dr({target:"Array",proto:!0,forced:[].forEach!=ic},{forEach:ic});var nc=Xo("Array").forEach,ac=pi,sc=Je,oc=oe,lc=nc,uc=Array.prototype,cc={DOMTokenList:!0,NodeList:!0},hc=function(e){var t=e.forEach;return e===uc||oc(uc,e)&&t===uc.forEach||sc(cc,ac(e))?lc:t},dc=r(hc),fc=se,vc=Wi,gc=dn,pc=rr,mc=p([].concat),yc=fc("Reflect","ownKeys")||function(e){var t=vc.f(pc(e)),r=gc.f;return r?mc(t,r(e)):t},Ec=yc,kc=$,Tc=D,Sc=Zi;Dr({target:"Object",stat:!0,sham:!w},{getOwnPropertyDescriptors:function(e){for(var t,r,i=kc(e),n=Tc.f,a=Ec(i),s={},o=0;a.length>o;)void 0!==(r=n(i,t=a[o++]))&&Sc(s,t,r);return s}});var Ac=te.Object.getOwnPropertyDescriptors,Lc=r(Ac),bc={exports:{}},Rc=Dr,Ic=w,Dc=ki.f;Rc({target:"Object",stat:!0,forced:Object.defineProperties!==Dc,sham:!Ic},{defineProperties:Dc});var wc=te.Object,_c=bc.exports=function(e,t){return wc.defineProperties(e,t)};wc.defineProperties.sham&&(_c.sham=!0);var Pc=bc.exports,Cc=r(Pc),xc={exports:{}},Mc=Dr,Oc=w,Fc=$t.f;Mc({target:"Object",stat:!0,forced:Object.defineProperty!==Fc,sham:!Oc},{defineProperty:Fc});var Nc=te.Object,Uc=xc.exports=function(e,t,r){return Nc.defineProperty(e,t,r)};Nc.defineProperty.sham&&(Uc.sham=!0);var Bc=xc.exports,Gc=r(Bc),Kc=Dr,Hc=a,Vc=na,jc=ee,Yc=Xe,Wc=Kr,qc=yl,zc=Zi,Xc=wa,Qc=Wo,$c=ge,Jc=dt("isConcatSpreadable"),Zc=$c>=51||!Hc((function(){var e=[];return e[Jc]=!1,e.concat()[0]!==e})),eh=function(e){if(!jc(e))return!1;var t=e[Jc];return void 0!==t?!!t:Vc(e)};Kc({target:"Array",proto:!0,arity:1,forced:!Zc||!Qc("concat")},{concat:function(e){var t,r,i,n,a,s=Yc(this),o=Xc(s,0),l=0;for(t=-1,i=arguments.length;t<i;t++)if(eh(a=-1===t?s:arguments[t]))for(n=Wc(a),qc(l+n),r=0;r<n;r++,l++)r in a&&zc(o,l,a[r]);else qc(l+1),zc(o,l++,a);return o.length=l,o}}),Rn("asyncIterator"),Rn("hasInstance"),Rn("isConcatSpreadable"),Rn("iterator"),Rn("match"),Rn("matchAll"),Rn("replace"),Rn("search"),Rn("species"),Rn("split");var th=Pn;Rn("toPrimitive"),th();var rh=se,ih=Gn;Rn("toStringTag"),ih(rh("Symbol"),"Symbol"),Rn("unscopables"),Gn(n.JSON,"JSON",!0);var nh=te.Symbol;Rn("dispose");var ah=nh;Rn("asyncDispose");var sh=Dr,oh=p,lh=se("Symbol"),uh=lh.keyFor,ch=oh(lh.prototype.valueOf);sh({target:"Symbol",stat:!0},{isRegistered:function(e){try{return void 0!==uh(ch(e))}catch(t){return!1}}});for(var hh=Dr,dh=We,fh=se,vh=p,gh=be,ph=dt,mh=fh("Symbol"),yh=mh.isWellKnown,Eh=fh("Object","getOwnPropertyNames"),kh=vh(mh.prototype.valueOf),Th=dh("wks"),Sh=0,Ah=Eh(mh),Lh=Ah.length;Sh<Lh;Sh++)try{var bh=Ah[Sh];gh(mh[bh])&&ph(bh)}catch(MM){}hh({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(e){if(yh&&yh(e))return!0;try{for(var t=kh(e),r=0,i=Eh(Th),n=i.length;r<n;r++)if(Th[i[r]]==t)return!0}catch(MM){}return!1}}),Rn("matcher"),Rn("metadataKey"),Rn("observable"),Rn("metadata"),Rn("patternMatch"),Rn("replaceAll");var Rh=ah,Ih=r(Rh),Dh=p,wh=Cr,_h=Ei,Ph=z,Ch=Dh("".charAt),xh=Dh("".charCodeAt),Mh=Dh("".slice),Oh=function(e){return function(t,r){var i,n,a=_h(Ph(t)),s=wh(r),o=a.length;return s<0||s>=o?e?"":void 0:(i=xh(a,s))<55296||i>56319||s+1===o||(n=xh(a,s+1))<56320||n>57343?e?Ch(a,s):i:e?Mh(a,s,s+2):n-56320+(i-55296<<10)+65536}},Fh={codeAt:Oh(!1),charAt:Oh(!0)},Nh=Fh.charAt,Uh=Ei,Bh=ra,Gh=Ou,Kh=Fu,Hh="String Iterator",Vh=Bh.set,jh=Bh.getterFor(Hh);Gh(String,"String",(function(e){Vh(this,{type:Hh,string:Uh(e),index:0})}),(function(){var e,t=jh(this),r=t.string,i=t.index;return i>=r.length?Kh(void 0,!0):(e=Nh(r,i),t.index+=e.length,Kh(e,!1))}));var Yh=mn.f("iterator"),Wh=r(Yh);function qh(e){return(qh="function"==typeof Ih&&"symbol"==typeof Wh?function(e){return typeof e}:function(e){return e&&"function"==typeof Ih&&e.constructor===Ih&&e!==Ih.prototype?"symbol":typeof e})(e)}var zh=mn.f("toPrimitive"),Xh=r(zh);function Qh(e){var t=function(e,t){if("object"!==qh(e)||null===e)return e;var r=e[Xh];if(void 0!==r){var i=r.call(e,t||"default");if("object"!==qh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===qh(t)?t:String(t)}function $h(e,t,r){return(t=Qh(t))in e?Gc(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jh(e,t){var r=oi(e);if(Ho){var i=Ho(e);t&&(i=tl(i).call(i,(function(t){return hl(e,t).enumerable}))),_l(r).apply(r,i)}return r}function Zh(e){for(var t=1;t<arguments.length;t++){var r,i,n=null!=arguments[t]?arguments[t]:{};t%2?dc(r=Jh(Object(n),!0)).call(r,(function(t){$h(e,t,n[t])})):Lc?Cc(e,Lc(n)):dc(i=Jh(Object(n))).call(i,(function(t){Gc(e,t,hl(n,t))}))}return e}var ed=pi,td=Me,rd=Y,id=Pl,nd=dt("iterator"),ad=function(e){if(!rd(e))return td(e,nd)||td(e,"@@iterator")||id[ed(e)]},sd=ad,od=r(sd);Dr({target:"Array",stat:!0},{isArray:na});var ld=te.Array.isArray,ud=r(ld),cd=Dr,hd=na,dd=Sa,fd=ee,vd=Fr,gd=Kr,pd=$,md=Zi,yd=dt,Ed=oo,kd=Wo("slice"),Td=yd("species"),Sd=Array,Ad=Math.max;cd({target:"Array",proto:!0,forced:!kd},{slice:function(e,t){var r,i,n,a=pd(this),s=gd(a),o=vd(e,s),l=vd(void 0===t?s:t,s);if(hd(a)&&(r=a.constructor,(dd(r)&&(r===Sd||hd(r.prototype))||fd(r)&&null===(r=r[Td]))&&(r=void 0),r===Sd||void 0===r))return Ed(a,o,l);for(i=new(void 0===r?Sd:r)(Ad(l-o,0)),n=0;o<l;o++,n++)o in a&&md(i,n,a[o]);return i.length=n,i}});var Ld=Xo("Array").slice,bd=oe,Rd=Ld,Id=Array.prototype,Dd=function(e){var t=e.slice;return e===Id||bd(Id,e)&&t===Id.slice?Rd:t},wd=r(Dd),_d=C,Pd=rr,Cd=Me,xd=function(e,t,r){var i,n;Pd(e);try{if(!(i=Cd(e,"return"))){if("throw"===t)throw r;return r}i=_d(i,e)}catch(MM){n=!0,i=MM}if("throw"===t)throw r;if(n)throw i;return Pd(i),r},Md=rr,Od=xd,Fd=Pl,Nd=dt("iterator"),Ud=Array.prototype,Bd=function(e){return void 0!==e&&(Fd.Array===e||Ud[Nd]===e)},Gd=C,Kd=Pe,Hd=rr,Vd=Ie,jd=ad,Yd=TypeError,Wd=function(e,t){var r=arguments.length<2?jd(e):t;if(Kd(r))return Hd(Gd(r,e));throw Yd(Vd(e)+" is not iterable")},qd=Qt,zd=C,Xd=Xe,Qd=function(e,t,r,i){try{return i?t(Md(r)[0],r[1]):t(r)}catch(MM){Od(e,"throw",MM)}},$d=Bd,Jd=Sa,Zd=Kr,ef=Zi,tf=Wd,rf=ad,nf=Array,af=function(e){var t=Xd(e),r=Jd(this),i=arguments.length,n=i>1?arguments[1]:void 0,a=void 0!==n;a&&(n=qd(n,i>2?arguments[2]:void 0));var s,o,l,u,c,h,d=rf(t),f=0;if(!d||this===nf&&$d(d))for(s=Zd(t),o=r?new this(s):nf(s);s>f;f++)h=a?n(t[f],f):t[f],ef(o,f,h);else for(c=(u=tf(t,d)).next,o=r?new this:[];!(l=zd(c,u)).done;f++)h=a?Qd(u,n,[l.value,f],!0):l.value,ef(o,f,h);return o.length=f,o},sf=dt("iterator"),of=!1;try{var lf=0,uf={next:function(){return{done:!!lf++}},return:function(){of=!0}};uf[sf]=function(){return this},Array.from(uf,(function(){throw 2}))}catch(MM){}var cf=function(e,t){if(!t&&!of)return!1;var r=!1;try{var i={};i[sf]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(MM){}return r},hf=af;Dr({target:"Array",stat:!0,forced:!cf((function(e){Array.from(e)}))},{from:hf});var df=te.Array.from,ff=r(df);function vf(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function gf(e,t){var r;if(e){if("string"==typeof e)return vf(e,t);var i=wd(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?ff(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?vf(e,t):void 0}}function pf(e){return function(e){if(ud(e))return vf(e)}(e)||function(e){if(void 0!==Ih&&null!=od(e)||null!=e["@@iterator"])return ff(e)}(e)||gf(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 mf(e,t){return function(e){if(ud(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==Ih&&od(e)||e["@@iterator"];if(null!=r){var i,n,a,s,o=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(_l(o).call(o,i.value),o.length!==t);l=!0);}catch(c){u=!0,n=c}finally{try{if(!l&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw n}}return o}}(e,t)||gf(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var yf=Je,Ef=C,kf=ee,Tf=rr,Sf=function(e){return void 0!==e&&(yf(e,"value")||yf(e,"writable"))},Af=D,Lf=Wl;Dr({target:"Reflect",stat:!0},{get:function e(t,r){var i,n,a=arguments.length<3?t:arguments[2];return Tf(t)===a?t[r]:(i=Af.f(t,r))?Sf(i)?i.value:void 0===i.get?void 0:Ef(i.get,a):kf(n=Lf(t))?e(n,r,a):void 0}});var bf=r(te.Reflect.get),Rf=p,If=Pe,Df=ee,wf=Je,_f=oo,Pf=s,Cf=Function,xf=Rf([].concat),Mf=Rf([].join),Of={},Ff=Pf?Cf.bind:function(e){var t=If(this),r=t.prototype,i=_f(arguments,1),n=function(){var r=xf(i,_f(arguments));return this instanceof n?function(e,t,r){if(!wf(Of,t)){for(var i=[],n=0;n<t;n++)i[n]="a["+n+"]";Of[t]=Cf("C,a","return new C("+Mf(i,",")+")")}return Of[t](e,r)}(t,r.length,r):t.apply(e,r)};return Df(r)&&(n.prototype=r),n},Nf=Ff;Dr({target:"Function",proto:!0,forced:Function.bind!==Nf},{bind:Nf});var Uf=Xo("Function").bind,Bf=oe,Gf=Uf,Kf=Function.prototype,Hf=function(e){var t=e.bind;return e===Kf||Bf(Kf,e)&&t===Kf.bind?Gf:t},Vf=r(Hf);Dr({target:"Object",stat:!0},{setPrototypeOf:yu});var jf=r(te.Object.setPrototypeOf),Yf=Xe,Wf=Wl,qf=Ul;Dr({target:"Object",stat:!0,forced:a((function(){Wf(1)})),sham:!qf},{getPrototypeOf:function(e){return Wf(Yf(e))}});var zf=r(te.Object.getPrototypeOf);function Xf(e){var t;return(Xf=jf?Vf(t=zf).call(t):function(e){return e.__proto__||zf(e)})(e)}function Qf(){var e;"undefined"!=typeof Reflect&&bf?Qf=Vf(e=bf).call(e):Qf=function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Xf(e)););return e}(e,t);if(i){var n=hl(i,t);return n.get?n.get.call(arguments.length<3?e:r):n.value}};return Qf.apply(this,arguments)}function $f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Jf={exports:{}},Zf=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),ev=a,tv=ee,rv=k,iv=Zf,nv=Object.isExtensible,av=ev((function(){nv(1)}))||iv?function(e){return!!tv(e)&&((!iv||"ArrayBuffer"!=rv(e))&&(!nv||nv(e)))}:nv,sv=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),ov=Dr,lv=p,uv=qr,cv=ee,hv=Je,dv=$t.f,fv=Wi,vv=Xi,gv=av,pv=sv,mv=!1,yv=it("meta"),Ev=0,kv=function(e){dv(e,yv,{value:{objectID:"O"+Ev++,weakData:{}}})},Tv=Jf.exports={enable:function(){Tv.enable=function(){},mv=!0;var e=fv.f,t=lv([].splice),r={};r[yv]=1,e(r).length&&(fv.f=function(r){for(var i=e(r),n=0,a=i.length;n<a;n++)if(i[n]===yv){t(i,n,1);break}return i},ov({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:vv.f}))},fastKey:function(e,t){if(!cv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!hv(e,yv)){if(!gv(e))return"F";if(!t)return"E";kv(e)}return e[yv].objectID},getWeakData:function(e,t){if(!hv(e,yv)){if(!gv(e))return!0;if(!t)return!1;kv(e)}return e[yv].weakData},onFreeze:function(e){return pv&&mv&&gv(e)&&!hv(e,yv)&&kv(e),e}};uv[yv]=!0;var Sv=Jf.exports,Av=Qt,Lv=C,bv=rr,Rv=Ie,Iv=Bd,Dv=Kr,wv=oe,_v=Wd,Pv=ad,Cv=xd,xv=TypeError,Mv=function(e,t){this.stopped=e,this.result=t},Ov=Mv.prototype,Fv=function(e,t,r){var i,n,a,s,o,l,u,c=r&&r.that,h=!(!r||!r.AS_ENTRIES),d=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),v=!(!r||!r.INTERRUPTED),g=Av(t,c),p=function(e){return i&&Cv(i,"normal",e),new Mv(!0,e)},m=function(e){return h?(bv(e),v?g(e[0],e[1],p):g(e[0],e[1])):v?g(e,p):g(e)};if(d)i=e.iterator;else if(f)i=e;else{if(!(n=Pv(e)))throw xv(Rv(e)+" is not iterable");if(Iv(n)){for(a=0,s=Dv(e);s>a;a++)if((o=m(e[a]))&&wv(Ov,o))return o;return new Mv(!1)}i=_v(e,n)}for(l=d?e.next:i.next;!(u=Lv(l,i)).done;){try{o=m(u.value)}catch(MM){Cv(i,"throw",MM)}if("object"==typeof o&&o&&wv(Ov,o))return o}return new Mv(!1)},Nv=oe,Uv=TypeError,Bv=function(e,t){if(Nv(t,e))return e;throw Uv("Incorrect invocation")},Gv=Dr,Kv=n,Hv=Sv,Vv=a,jv=pr,Yv=Fv,Wv=Bv,qv=I,zv=ee,Xv=Gn,Qv=$t.f,$v=Na.forEach,Jv=w,Zv=ra.set,eg=ra.getterFor,tg=function(e,t,r){var i,n=-1!==e.indexOf("Map"),a=-1!==e.indexOf("Weak"),s=n?"set":"add",o=Kv[e],l=o&&o.prototype,u={};if(Jv&&qv(o)&&(a||l.forEach&&!Vv((function(){(new o).entries().next()})))){var c=(i=t((function(t,r){Zv(Wv(t,c),{type:e,collection:new o}),null!=r&&Yv(r,t[s],{that:t,AS_ENTRIES:n})}))).prototype,h=eg(e);$v(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in l)||a&&"clear"==e||jv(c,e,(function(r,i){var n=h(this).collection;if(!t&&a&&!zv(r))return"get"==e&&void 0;var s=n[e](0===r?0:r,i);return t?this:s}))})),a||Qv(c,"size",{configurable:!0,get:function(){return h(this).collection.size}})}else i=r.getConstructor(t,e,n,s),Hv.enable();return Xv(i,e,!1,!0),u[e]=i,Gv({global:!0,forced:!0},u),a||r.setStrong(i,e,n),i},rg=vn,ig=function(e,t,r){for(var i in t)r&&r.unsafe&&e[i]?e[i]=t[i]:rg(e,i,t[i],r);return e},ng=se,ag=pn,sg=w,og=dt("species"),lg=function(e){var t=ng(e);sg&&t&&!t[og]&&ag(t,og,{configurable:!0,get:function(){return this}})},ug=Yi,cg=pn,hg=ig,dg=Qt,fg=Bv,vg=Y,gg=Fv,pg=Ou,mg=Fu,yg=lg,Eg=w,kg=Sv.fastKey,Tg=ra.set,Sg=ra.getterFor,Ag={getConstructor:function(e,t,r,i){var n=e((function(e,n){fg(e,a),Tg(e,{type:t,index:ug(null),first:void 0,last:void 0,size:0}),Eg||(e.size=0),vg(n)||gg(n,e[i],{that:e,AS_ENTRIES:r})})),a=n.prototype,s=Sg(t),o=function(e,t,r){var i,n,a=s(e),o=l(e,t);return o?o.value=r:(a.last=o={index:n=kg(t,!0),key:t,value:r,previous:i=a.last,next:void 0,removed:!1},a.first||(a.first=o),i&&(i.next=o),Eg?a.size++:e.size++,"F"!==n&&(a.index[n]=o)),e},l=function(e,t){var r,i=s(e),n=kg(t);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key==t)return r};return hg(a,{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,Eg?e.size=0:this.size=0},delete:function(e){var t=this,r=s(t),i=l(t,e);if(i){var n=i.next,a=i.previous;delete r.index[i.index],i.removed=!0,a&&(a.next=n),n&&(n.previous=a),r.first==i&&(r.first=n),r.last==i&&(r.last=a),Eg?r.size--:t.size--}return!!i},forEach:function(e){for(var t,r=s(this),i=dg(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(i(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!l(this,e)}}),hg(a,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)}}),Eg&&cg(a,"size",{configurable:!0,get:function(){return s(this).size}}),n},setStrong:function(e,t,r){var i=t+" Iterator",n=Sg(t),a=Sg(i);pg(e,t,(function(e,t){Tg(this,{type:i,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?mg("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,mg(void 0,!0))}),r?"entries":"values",!r,!0),yg(t)}};tg("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ag);var Lg=te.Map,bg=Sa,Rg=Ie,Ig=TypeError,Dg=function(e){if(bg(e))return e;throw Ig(Rg(e)+" is not a constructor")},wg=Qt,_g=C,Pg=Pe,Cg=Dg,xg=Y,Mg=Fv,Og=[].push,Fg=function(e){var t,r,i,n,a=arguments.length,s=a>1?arguments[1]:void 0;return Cg(this),(t=void 0!==s)&&Pg(s),xg(e)?new this:(r=[],t?(i=0,n=wg(s,a>2?arguments[2]:void 0),Mg(e,(function(e){_g(Og,r,n(e,i++))}))):Mg(e,Og,{that:r}),new this(r))};Dr({target:"Map",stat:!0,forced:!0},{from:Fg});var Ng=oo,Ug=function(){return new this(Ng(arguments))};Dr({target:"Map",stat:!0,forced:!0},{of:Ug});var Bg=Ie,Gg=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(Bg(e)+" is not a map")},Kg=function(e,t){return 1==t?function(t,r){return t[e](r)}:function(t,r,i){return t[e](r,i)}},Hg=Kg,Vg=se("Map"),jg={Map:Vg,set:Hg("set",2),get:Hg("get",1),has:Hg("has",1),remove:Hg("delete",1),proto:Vg.prototype},Yg=Gg,Wg=jg.remove;Dr({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=Yg(this),r=!0,i=0,n=arguments.length;i<n;i++)e=Wg(t,arguments[i]),r=r&&e;return!!r}});var qg=Gg,zg=jg.get,Xg=jg.has,Qg=jg.set;Dr({target:"Map",proto:!0,real:!0,forced:!0},{emplace:function(e,t){var r,i,n=qg(this);return Xg(n,e)?(r=zg(n,e),"update"in t&&(r=t.update(r,e,n),Qg(n,e,r)),r):(i=t.insert(e,n),Qg(n,e,i),i)}});var $g=C,Jg=function(e,t,r){for(var i,n,a=r||e.next;!(i=$g(a,e)).done;)if(void 0!==(n=t(i.value)))return n},Zg=Jg,ep=function(e,t,r){return r?Zg(e.entries(),(function(e){return t(e[1],e[0])})):e.forEach(t)},tp=Qt,rp=Gg,ip=ep;Dr({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=rp(this),r=tp(e,arguments.length>1?arguments[1]:void 0);return!1!==ip(t,(function(e,i){if(!r(e,i,t))return!1}),!0)}});var np=Qt,ap=Gg,sp=ep,op=jg.Map,lp=jg.set;Dr({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=ap(this),r=np(e,arguments.length>1?arguments[1]:void 0),i=new op;return sp(t,(function(e,n){r(e,n,t)&&lp(i,n,e)})),i}});var up=Qt,cp=Gg,hp=ep;Dr({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=cp(this),r=up(e,arguments.length>1?arguments[1]:void 0),i=hp(t,(function(e,i){if(r(e,i,t))return{value:e}}),!0);return i&&i.value}});var dp=Qt,fp=Gg,vp=ep;Dr({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=fp(this),r=dp(e,arguments.length>1?arguments[1]:void 0),i=vp(t,(function(e,i){if(r(e,i,t))return{key:i}}),!0);return i&&i.key}});var gp=Dr,pp=C,mp=I,yp=Pe,Ep=Fv,kp=jg.Map,Tp=p([].push);gp({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){var r=new(mp(this)?this:kp);yp(t);var i=yp(r.has),n=yp(r.get),a=yp(r.set);return Ep(e,(function(e){var s=t(e);pp(i,r,s)?Tp(pp(n,r,s),e):pp(a,r,s,[e])})),r}});var Sp=function(e,t){return e===t||e!=e&&t!=t},Ap=Gg,Lp=ep;Dr({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return!0===Lp(Ap(this),(function(t){if(Sp(t,e))return!0}),!0)}});var bp=C,Rp=Fv,Ip=I,Dp=Pe,wp=jg.Map;Dr({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new(Ip(this)?this:wp);Dp(t);var i=Dp(r.set);return Rp(e,(function(e){bp(i,r,t(e),e)})),r}});var _p=Gg,Pp=ep;Dr({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){var t=Pp(_p(this),(function(t,r){if(t===e)return{key:r}}),!0);return t&&t.key}});var Cp=Qt,xp=Gg,Mp=ep,Op=jg.Map,Fp=jg.set;Dr({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=xp(this),r=Cp(e,arguments.length>1?arguments[1]:void 0),i=new Op;return Mp(t,(function(e,n){Fp(i,r(e,n,t),e)})),i}});var Np=Qt,Up=Gg,Bp=ep,Gp=jg.Map,Kp=jg.set;Dr({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=Up(this),r=Np(e,arguments.length>1?arguments[1]:void 0),i=new Gp;return Bp(t,(function(e,n){Kp(i,n,r(e,n,t))})),i}});var Hp=Gg,Vp=Fv,jp=jg.set;Dr({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=Hp(this),r=arguments.length,i=0;i<r;)Vp(arguments[i++],(function(e,r){jp(t,e,r)}),{AS_ENTRIES:!0});return t}});var Yp=Pe,Wp=Gg,qp=ep,zp=TypeError;Dr({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=Wp(this),r=arguments.length<2,i=r?void 0:arguments[1];if(Yp(e),qp(t,(function(n,a){r?(r=!1,i=n):i=e(i,n,a,t)})),r)throw zp("Reduce of empty map with no initial value");return i}});var Xp=Qt,Qp=Gg,$p=ep;Dr({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=Qp(this),r=Xp(e,arguments.length>1?arguments[1]:void 0);return!0===$p(t,(function(e,i){if(r(e,i,t))return!0}),!0)}});var Jp=Pe,Zp=Gg,em=TypeError,tm=jg.get,rm=jg.has,im=jg.set;Dr({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=Zp(this),i=arguments.length;Jp(t);var n=rm(r,e);if(!n&&i<3)throw em("Updating absent value");var a=n?tm(r,e):Jp(i>2?arguments[2]:void 0)(e,r);return im(r,e,t(a,e,r)),r}});var nm=C,am=Pe,sm=I,om=rr,lm=TypeError,um=function(e,t){var r,i=om(this),n=am(i.get),a=am(i.has),s=am(i.set),o=arguments.length>2?arguments[2]:void 0;if(!sm(t)&&!sm(o))throw lm("At least one callback required");return nm(a,i,e)?(r=nm(n,i,e),sm(t)&&(r=t(r),nm(s,i,e,r))):sm(o)&&(r=o(),nm(s,i,e,r)),r};Dr({target:"Map",proto:!0,real:!0,forced:!0},{upsert:um}),Dr({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:um});var cm=Lg,hm=r(cm);Dr({target:"Object",stat:!0,sham:!w},{create:Yi});var dm=te.Object,fm=function(e,t){return dm.create(e,t)},vm=r(fm);function gm(e,t){var r;return(gm=jf?Vf(r=jf).call(r):function(e,t){return e.__proto__=t,e})(e,t)}var pm=Dr,mm=Wr.indexOf,ym=tc,Em=A([].indexOf),km=!!Em&&1/Em([1],1,-0)<0;pm({target:"Array",proto:!0,forced:km||!ym("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return km?Em(this,e,t)||0:mm(this,e,t)}});var Tm=Xo("Array").indexOf,Sm=oe,Am=Tm,Lm=Array.prototype,bm=function(e){var t=e.indexOf;return e===Lm||Sm(Lm,e)&&t===Lm.indexOf?Am:t},Rm=r(bm);var Im=Dr,Dm=h,wm=Ff,_m=Dg,Pm=rr,Cm=ee,xm=Yi,Mm=a,Om=se("Reflect","construct"),Fm=Object.prototype,Nm=[].push,Um=Mm((function(){function e(){}return!(Om((function(){}),[],e)instanceof e)})),Bm=!Mm((function(){Om((function(){}))})),Gm=Um||Bm;Im({target:"Reflect",stat:!0,forced:Gm,sham:Gm},{construct:function(e,t){_m(e),Pm(t);var r=arguments.length<3?e:_m(arguments[2]);if(Bm&&!Um)return Om(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 i=[null];return Dm(Nm,i,t),new(Dm(wm,e,i))}var n=r.prototype,a=xm(Cm(n)?n:Fm),s=Dm(e,a,t);return Cm(s)?s:a}});var Km=r(te.Reflect.construct);function Hm(){if("undefined"==typeof Reflect||!Km)return!1;if(Km.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Km(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Vm(e,t,r){var i;Hm()?Vm=Vf(i=Km).call(i):Vm=function(e,t,r){var i=[null];_l(i).apply(i,t);var n=new(Vf(Function).apply(e,i));return r&&gm(n,r.prototype),n};return Vm.apply(null,arguments)}function jm(e){var t="function"==typeof hm?new hm:void 0;return jm=function(e){if(null===e||(r=e,-1===Rm(i=Function.toString.call(r)).call(i,"[native code]")))return e;var r,i;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,n)}function n(){return Vm(e,arguments,Xf(this).constructor)}return n.prototype=vm(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),gm(n,e)},jm(e)}function Ym(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=vm(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Gc(e,"prototype",{writable:!1}),t&&gm(e,t)}function Wm(e){var t=Hm();return function(){var r,i=Xf(e);if(t){var n=Xf(this).constructor;r=Km(i,arguments,n)}else r=i.apply(this,arguments);return function(e,t){if(t&&("object"===qh(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return $f(e)}(this,r)}}function qm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zm(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Gc(e,Qh(i.key),i)}}function Xm(e,t,r){return t&&zm(e.prototype,t),r&&zm(e,r),Gc(e,"prototype",{writable:!1}),e}var Qm=r(si),$m=r(Ko),Jm=r(el),Zm=r(cl),ey=r(hc),ty=r(Ac),ry=r(Pc),iy=r(Bc),ny=r(Rh),ay=r(Yh),sy=r(ld),oy=r(sd),ly=r(df),uy=r(Dd),cy=r(zh),hy=r(bm),dy=Xo("Array").concat,fy=oe,vy=dy,gy=Array.prototype,py=r((function(e){var t=e.concat;return e===gy||fy(gy,e)&&t===gy.concat?vy:t})),my=Na.some;Dr({target:"Array",proto:!0,forced:!tc("some")},{some:function(e){return my(this,e,arguments.length>1?arguments[1]:void 0)}});var yy=Xo("Array").some,Ey=oe,ky=yy,Ty=Array.prototype,Sy=r((function(e){var t=e.some;return e===Ty||Ey(Ty,e)&&t===Ty.some?ky:t})),Ay=Na.map;Dr({target:"Array",proto:!0,forced:!Wo("map")},{map:function(e){return Ay(this,e,arguments.length>1?arguments[1]:void 0)}});var Ly=Xo("Array").map,by=oe,Ry=Ly,Iy=Array.prototype,Dy=r((function(e){var t=e.map;return e===Iy||by(Iy,e)&&t===Iy.map?Ry:t})),wy=Cr,_y=Ei,Py=z,Cy=RangeError,xy=p,My=Br,Oy=Ei,Fy=z,Ny=xy((function(e){var t=_y(Py(this)),r="",i=wy(e);if(i<0||i==1/0)throw Cy("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(r+=t);return r})),Uy=xy("".slice),By=Math.ceil,Gy=function(e){return function(t,r,i){var n,a,s=Oy(Fy(t)),o=My(r),l=s.length,u=void 0===i?" ":Oy(i);return o<=l||""==u?s:((a=Ny(u,By((n=o-l)/u.length))).length>n&&(a=Uy(a,0,n)),e?s+a:a+s)}},Ky={start:Gy(!1),end:Gy(!0)},Hy=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(le),Vy=Ky.start;Dr({target:"String",proto:!0,forced:Hy},{padStart:function(e){return Vy(this,e,arguments.length>1?arguments[1]:void 0)}});var jy,Yy=Xo("String").padStart,Wy=oe,qy=Yy,zy=String.prototype,Xy=r((function(e){var t=e.padStart;return"string"==typeof e||e===zy||Wy(zy,e)&&t===zy.padStart?qy:t})),Qy="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,$y=TypeError,Jy=function(e,t){if(e<t)throw $y("Not enough arguments");return e},Zy=n,eE=h,tE=I,rE=Qy,iE=le,nE=oo,aE=Jy,sE=Zy.Function,oE=/MSIE .\./.test(iE)||rE&&((jy=Zy.Bun.version.split(".")).length<3||0==jy[0]&&(jy[1]<3||3==jy[1]&&0==jy[2])),lE=function(e,t){var r=t?2:1;return oE?function(i,n){var a=aE(arguments.length,1)>r,s=tE(i)?i:sE(i),o=a?nE(arguments,r):[],l=a?function(){eE(s,this,o)}:s;return t?e(l,n):e(l)}:e},uE=Dr,cE=n,hE=lE(cE.setInterval,!0);uE({global:!0,bind:!0,forced:cE.setInterval!==hE},{setInterval:hE});var dE=Dr,fE=n,vE=lE(fE.setTimeout,!0);dE({global:!0,bind:!0,forced:fE.setTimeout!==vE},{setTimeout:vE});var gE=r(te.setInterval),pE=r(Hf),mE=r(te.setTimeout),yE=Ie,EE=TypeError,kE=function(e,t){if(!delete e[t])throw EE("Cannot delete property "+yE(t)+" of "+yE(e))},TE=Dr,SE=Xe,AE=Fr,LE=Cr,bE=Kr,RE=pl,IE=yl,DE=wa,wE=Zi,_E=kE,PE=Wo("splice"),CE=Math.max,xE=Math.min;TE({target:"Array",proto:!0,forced:!PE},{splice:function(e,t){var r,i,n,a,s,o,l=SE(this),u=bE(l),c=AE(e,u),h=arguments.length;for(0===h?r=i=0:1===h?(r=0,i=u-c):(r=h-2,i=xE(CE(LE(t),0),u-c)),IE(u+r-i),n=DE(l,i),a=0;a<i;a++)(s=c+a)in l&&wE(n,a,l[s]);if(n.length=i,r<i){for(a=c;a<u-i;a++)o=a+r,(s=a+i)in l?l[o]=l[s]:_E(l,o);for(a=u;a>u-i+r;a--)_E(l,a-1)}else if(r>i)for(a=u-i;a>c;a--)o=a+r-1,(s=a+i-1)in l?l[o]=l[s]:_E(l,o);for(a=0;a<r;a++)l[a+c]=arguments[a+2];return RE(l,u-i+r),n}});var ME=Xo("Array").splice,OE=oe,FE=ME,NE=Array.prototype,UE=r((function(e){var t=e.splice;return e===NE||OE(NE,e)&&t===NE.splice?FE:t})),BE=Na.every;Dr({target:"Array",proto:!0,forced:!tc("every")},{every:function(e){return BE(this,e,arguments.length>1?arguments[1]:void 0)}});var GE=Xo("Array").every,KE=oe,HE=GE,VE=Array.prototype,jE=r((function(e){var t=e.every;return e===VE||KE(VE,e)&&t===VE.every?HE:t})),YE="\t\n\v\f\r                 \u2028\u2029\ufeff",WE=z,qE=Ei,zE=YE,XE=p("".replace),QE=RegExp("^["+zE+"]+"),$E=RegExp("(^|[^"+zE+"])["+zE+"]+$"),JE=function(e){return function(t){var r=qE(WE(t));return 1&e&&(r=XE(r,QE,"")),2&e&&(r=XE(r,$E,"$1")),r}},ZE={start:JE(1),end:JE(2),trim:JE(3)},ek=n,tk=a,rk=Ei,ik=ZE.trim,nk=YE,ak=p("".charAt),sk=ek.parseFloat,ok=ek.Symbol,lk=ok&&ok.iterator,uk=1/sk(nk+"-0")!=-1/0||lk&&!tk((function(){sk(Object(lk))}))?function(e){var t=ik(rk(e)),r=sk(t);return 0===r&&"-"==ak(t,0)?-0:r}:sk;Dr({global:!0,forced:parseFloat!=uk},{parseFloat:uk});var ck=r(te.parseFloat),hk=Nl.PROPER,dk=a,fk=YE,vk=ZE.trim;Dr({target:"String",proto:!0,forced:function(e){return dk((function(){return!!fk[e]()||"​…᠎"!=="​…᠎"[e]()||hk&&fk[e].name!==e}))}("trim")},{trim:function(){return vk(this)}});var gk=Xo("String").trim,pk=oe,mk=gk,yk=String.prototype,Ek=r((function(e){var t=e.trim;return"string"==typeof e||e===yk||pk(yk,e)&&t===yk.trim?mk:t})),kk=n,Tk=a,Sk=p,Ak=Ei,Lk=ZE.trim,bk=YE,Rk=kk.parseInt,Ik=kk.Symbol,Dk=Ik&&Ik.iterator,wk=/^[+-]?0x/i,_k=Sk(wk.exec),Pk=8!==Rk(bk+"08")||22!==Rk(bk+"0x16")||Dk&&!Tk((function(){Rk(Object(Dk))}))?function(e,t){var r=Lk(Ak(e));return Rk(r,t>>>0||(_k(wk,r)?16:10))}:Rk;Dr({global:!0,forced:parseInt!=Pk},{parseInt:Pk});var Ck=r(te.parseInt),xk=sn,Mk=Math.floor,Ok=function(e,t){var r=e.length,i=Mk(r/2);return r<8?Fk(e,t):Nk(e,Ok(xk(e,0,i),t),Ok(xk(e,i),t),t)},Fk=function(e,t){for(var r,i,n=e.length,a=1;a<n;){for(i=a,r=e[a];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==a++&&(e[i]=r)}return e},Nk=function(e,t,r,i){for(var n=t.length,a=r.length,s=0,o=0;s<n||o<a;)e[s+o]=s<n&&o<a?i(t[s],r[o])<=0?t[s++]:r[o++]:s<n?t[s++]:r[o++];return e},Uk=Ok,Bk=le.match(/firefox\/(\d+)/i),Gk=!!Bk&&+Bk[1],Kk=/MSIE|Trident/.test(le),Hk=le.match(/AppleWebKit\/(\d+)\./),Vk=!!Hk&&+Hk[1],jk=Dr,Yk=p,Wk=Pe,qk=Xe,zk=Kr,Xk=kE,Qk=Ei,$k=a,Jk=Uk,Zk=tc,eT=Gk,tT=Kk,rT=ge,iT=Vk,nT=[],aT=Yk(nT.sort),sT=Yk(nT.push),oT=$k((function(){nT.sort(void 0)})),lT=$k((function(){nT.sort(null)})),uT=Zk("sort"),cT=!$k((function(){if(rT)return rT<70;if(!(eT&&eT>3)){if(tT)return!0;if(iT)return iT<603;var e,t,r,i,n="";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(i=0;i<47;i++)nT.push({k:t+i,v:r})}for(nT.sort((function(e,t){return t.v-e.v})),i=0;i<nT.length;i++)t=nT[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));jk({target:"Array",proto:!0,forced:oT||!lT||!uT||!cT},{sort:function(e){void 0!==e&&Wk(e);var t=qk(this);if(cT)return void 0===e?aT(t):aT(t,e);var r,i,n=[],a=zk(t);for(i=0;i<a;i++)i in t&&sT(n,t[i]);for(Jk(n,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:Qk(t)>Qk(r)?1:-1}}(e)),r=zk(n),i=0;i<r;)t[i]=n[i++];for(;i<a;)Xk(t,i++);return t}});var hT=Xo("Array").sort,dT=oe,fT=hT,vT=Array.prototype,gT=r((function(e){var t=e.sort;return e===vT||dT(vT,e)&&t===vT.sort?fT:t})),pT=n.isFinite;Dr({target:"Number",stat:!0},{isFinite:Number.isFinite||function(e){return"number"==typeof e&&pT(e)}});var mT=r(te.Number.isFinite),yT=ee,ET=Math.floor,kT=Number.isInteger||function(e){return!yT(e)&&isFinite(e)&&ET(e)===e},TT=Dr,ST=kT,AT=Math.abs;TT({target:"Number",stat:!0},{isSafeInteger:function(e){return ST(e)&&AT(e)<=9007199254740991}});var LT=r(te.Number.isSafeInteger);Dr({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991});var bT=r(9007199254740991),RT=w,IT=p,DT=C,wT=a,_T=ii,PT=dn,CT=x,xT=Xe,MT=j,OT=Object.assign,FT=Object.defineProperty,NT=IT([].concat),UT=!OT||wT((function(){if(RT&&1!==OT({b:1},OT(FT({},"a",{enumerable:!0,get:function(){FT(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!=OT({},e)[r]||_T(OT({},t)).join("")!=i}))?function(e,t){for(var r=xT(e),i=arguments.length,n=1,a=PT.f,s=CT.f;i>n;)for(var o,l=MT(arguments[n++]),u=a?NT(_T(l),a(l)):_T(l),c=u.length,h=0;c>h;)o=u[h++],RT&&!DT(s,l,o)||(r[o]=l[o]);return r}:OT,BT=UT;Dr({target:"Object",stat:!0,arity:2,forced:Object.assign!==BT},{assign:BT});var GT=r(te.Object.assign),KT=Pe,HT=Xe,VT=j,jT=Kr,YT=TypeError,WT=function(e){return function(t,r,i,n){KT(r);var a=HT(t),s=VT(a),o=jT(a),l=e?o-1:0,u=e?-1:1;if(i<2)for(;;){if(l in s){n=s[l],l+=u;break}if(l+=u,e?l<0:o<=l)throw YT("Reduce of empty array with no initial value")}for(;e?l>=0:o>l;l+=u)l in s&&(n=r(n,s[l],l,a));return n}},qT={left:WT(!1),right:WT(!0)},zT="undefined"!=typeof process&&"process"==k(process),XT=qT.left;Dr({target:"Array",proto:!0,forced:!zT&&ge>79&&ge<83||!tc("reduce")},{reduce:function(e){var t=arguments.length;return XT(this,e,t,t>1?arguments[1]:void 0)}});var QT=Xo("Array").reduce,$T=oe,JT=QT,ZT=Array.prototype,eS=r((function(e){var t=e.reduce;return e===ZT||$T(ZT,e)&&t===ZT.reduce?JT:t})),tS=ee,rS=k,iS=dt("match"),nS=function(e){var t;return tS(e)&&(void 0!==(t=e[iS])?!!t:"RegExp"==rS(e))},aS=TypeError,sS=function(e){if(nS(e))throw aS("The method doesn't accept regular expressions");return e},oS=dt("match"),lS=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[oS]=!1,"/./"[e](t)}catch(i){}}return!1},uS=Dr,cS=A;D.f;var hS=Br,dS=Ei,fS=sS,vS=z,gS=lS,pS=cS("".startsWith),mS=cS("".slice),yS=Math.min;uS({target:"String",proto:!0,forced:!gS("startsWith")},{startsWith:function(e){var t=dS(vS(this));fS(e);var r=hS(yS(arguments.length>1?arguments[1]:void 0,t.length)),i=dS(e);return pS?pS(t,i,r):mS(t,r,r+i.length)===i}});var ES=Xo("String").startsWith,kS=oe,TS=ES,SS=String.prototype,AS=r((function(e){var t=e.startsWith;return"string"==typeof e||e===SS||kS(SS,e)&&t===SS.startsWith?TS:t})),LS=Je,bS=yc,RS=D,IS=$t,DS=ee,wS=pr,_S=Error,PS=p("".replace),CS=String(_S("zxcasd").stack),xS=/\n\s*at [^:]*:[^\n]*/,MS=xS.test(CS),OS=B,FS=!a((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",OS(1,7)),7!==e.stack)})),NS=pr,US=function(e,t){if(MS&&"string"==typeof e&&!_S.prepareStackTrace)for(;t--;)e=PS(e,xS,"");return e},BS=FS,GS=Error.captureStackTrace,KS=Ei,HS=Dr,VS=oe,jS=Wl,YS=yu,WS=function(e,t,r){for(var i=bS(t),n=IS.f,a=RS.f,s=0;s<i.length;s++){var o=i[s];LS(e,o)||r&&LS(r,o)||n(e,o,a(t,o))}},qS=Yi,zS=pr,XS=B,QS=function(e,t){DS(t)&&"cause"in t&&wS(e,"cause",t.cause)},$S=function(e,t,r,i){BS&&(GS?GS(e,t):NS(e,"stack",US(r,i)))},JS=Fv,ZS=function(e,t){return void 0===e?arguments.length<2?"":t:KS(e)},eA=dt("toStringTag"),tA=Error,rA=[].push,iA=function(e,t){var r,i=VS(nA,this);YS?r=YS(tA(),i?jS(this):nA):(r=i?this:qS(nA),zS(r,eA,"Error")),void 0!==t&&zS(r,"message",ZS(t)),$S(r,iA,r.stack,1),arguments.length>2&&QS(r,arguments[2]);var n=[];return JS(e,rA,{that:n}),zS(r,"errors",n),r};YS?YS(iA,tA):WS(iA,tA,{name:!0});var nA=iA.prototype=qS(tA.prototype,{constructor:XS(1,iA),message:XS(1,""),name:XS(1,"AggregateError")});HS({global:!0,constructor:!0,arity:2},{AggregateError:iA});var aA,sA,oA,lA,uA=rr,cA=Dg,hA=Y,dA=dt("species"),fA=function(e,t){var r,i=uA(e).constructor;return void 0===i||hA(r=uA(i)[dA])?t:cA(r)},vA=/(?:ipad|iphone|ipod).*applewebkit/i.test(le),gA=n,pA=h,mA=Qt,yA=I,EA=Je,kA=a,TA=Di,SA=oo,AA=Rt,LA=Jy,bA=vA,RA=zT,IA=gA.setImmediate,DA=gA.clearImmediate,wA=gA.process,_A=gA.Dispatch,PA=gA.Function,CA=gA.MessageChannel,xA=gA.String,MA=0,OA={},FA="onreadystatechange";kA((function(){aA=gA.location}));var NA=function(e){if(EA(OA,e)){var t=OA[e];delete OA[e],t()}},UA=function(e){return function(){NA(e)}},BA=function(e){NA(e.data)},GA=function(e){gA.postMessage(xA(e),aA.protocol+"//"+aA.host)};IA&&DA||(IA=function(e){LA(arguments.length,1);var t=yA(e)?e:PA(e),r=SA(arguments,1);return OA[++MA]=function(){pA(t,void 0,r)},sA(MA),MA},DA=function(e){delete OA[e]},RA?sA=function(e){wA.nextTick(UA(e))}:_A&&_A.now?sA=function(e){_A.now(UA(e))}:CA&&!bA?(lA=(oA=new CA).port2,oA.port1.onmessage=BA,sA=mA(lA.postMessage,lA)):gA.addEventListener&&yA(gA.postMessage)&&!gA.importScripts&&aA&&"file:"!==aA.protocol&&!kA(GA)?(sA=GA,gA.addEventListener("message",BA,!1)):sA=FA in AA("script")?function(e){TA.appendChild(AA("script"))[FA]=function(){TA.removeChild(this),NA(e)}}:function(e){setTimeout(UA(e),0)});var KA={set:IA,clear:DA},HA=function(){this.head=null,this.tail=null};HA.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 VA,jA,YA,WA,qA,zA=HA,XA=/ipad|iphone|ipod/i.test(le)&&"undefined"!=typeof Pebble,QA=/web0s(?!.*chrome)/i.test(le),$A=n,JA=Qt,ZA=D.f,eL=KA.set,tL=zA,rL=vA,iL=XA,nL=QA,aL=zT,sL=$A.MutationObserver||$A.WebKitMutationObserver,oL=$A.document,lL=$A.process,uL=$A.Promise,cL=ZA($A,"queueMicrotask"),hL=cL&&cL.value;if(!hL){var dL=new tL,fL=function(){var e,t;for(aL&&(e=lL.domain)&&e.exit();t=dL.get();)try{t()}catch(MM){throw dL.head&&VA(),MM}e&&e.enter()};rL||aL||nL||!sL||!oL?!iL&&uL&&uL.resolve?((WA=uL.resolve(void 0)).constructor=uL,qA=JA(WA.then,WA),VA=function(){qA(fL)}):aL?VA=function(){lL.nextTick(fL)}:(eL=JA(eL,$A),VA=function(){eL(fL)}):(jA=!0,YA=oL.createTextNode(""),new sL(fL).observe(YA,{characterData:!0}),VA=function(){YA.data=jA=!jA}),hL=function(e){dL.head||VA(),dL.add(e)}}var vL=hL,gL=function(e){try{return{error:!1,value:e()}}catch(MM){return{error:!0,value:MM}}},pL=n.Promise,mL="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,yL=!mL&&!zT&&"object"==typeof window&&"object"==typeof document,EL=n,kL=pL,TL=I,SL=Wt,AL=la,LL=dt,bL=yL,RL=mL,IL=ge,DL=kL&&kL.prototype,wL=LL("species"),_L=!1,PL=TL(EL.PromiseRejectionEvent),CL={CONSTRUCTOR:SL("Promise",(function(){var e=AL(kL),t=e!==String(kL);if(!t&&66===IL)return!0;if(!DL.catch||!DL.finally)return!0;if(!IL||IL<51||!/native code/.test(e)){var r=new kL((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[wL]=i,!(_L=r.then((function(){}))instanceof i))return!0}return!t&&(bL||RL)&&!PL})),REJECTION_EVENT:PL,SUBCLASSING:_L},xL={},ML=Pe,OL=TypeError,FL=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw OL("Bad Promise constructor");t=e,r=i})),this.resolve=ML(t),this.reject=ML(r)};xL.f=function(e){return new FL(e)};var NL,UL,BL=Dr,GL=zT,KL=n,HL=C,VL=vn,jL=Gn,YL=lg,WL=Pe,qL=I,zL=ee,XL=Bv,QL=fA,$L=KA.set,JL=vL,ZL=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(MM){}},eb=gL,tb=zA,rb=ra,ib=pL,nb=CL,ab=xL,sb="Promise",ob=nb.CONSTRUCTOR,lb=nb.REJECTION_EVENT,ub=rb.getterFor(sb),cb=rb.set,hb=ib&&ib.prototype,db=ib,fb=hb,vb=KL.TypeError,gb=KL.document,pb=KL.process,mb=ab.f,yb=mb,Eb=!!(gb&&gb.createEvent&&KL.dispatchEvent),kb="unhandledrejection",Tb=function(e){var t;return!(!zL(e)||!qL(t=e.then))&&t},Sb=function(e,t){var r,i,n,a=t.value,s=1==t.state,o=s?e.ok:e.fail,l=e.resolve,u=e.reject,c=e.domain;try{o?(s||(2===t.rejection&&Ib(t),t.rejection=1),!0===o?r=a:(c&&c.enter(),r=o(a),c&&(c.exit(),n=!0)),r===e.promise?u(vb("Promise-chain cycle")):(i=Tb(r))?HL(i,r,l,u):l(r)):u(a)}catch(MM){c&&!n&&c.exit(),u(MM)}},Ab=function(e,t){e.notified||(e.notified=!0,JL((function(){for(var r,i=e.reactions;r=i.get();)Sb(r,e);e.notified=!1,t&&!e.rejection&&bb(e)})))},Lb=function(e,t,r){var i,n;Eb?((i=gb.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),KL.dispatchEvent(i)):i={promise:t,reason:r},!lb&&(n=KL["on"+e])?n(i):e===kb&&ZL("Unhandled promise rejection",r)},bb=function(e){HL($L,KL,(function(){var t,r=e.facade,i=e.value;if(Rb(e)&&(t=eb((function(){GL?pb.emit("unhandledRejection",i,r):Lb(kb,r,i)})),e.rejection=GL||Rb(e)?2:1,t.error))throw t.value}))},Rb=function(e){return 1!==e.rejection&&!e.parent},Ib=function(e){HL($L,KL,(function(){var t=e.facade;GL?pb.emit("rejectionHandled",t):Lb("rejectionhandled",t,e.value)}))},Db=function(e,t,r){return function(i){e(t,i,r)}},wb=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Ab(e,!0))},_b=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw vb("Promise can't be resolved itself");var i=Tb(t);i?JL((function(){var r={done:!1};try{HL(i,t,Db(_b,r,e),Db(wb,r,e))}catch(MM){wb(r,MM,e)}})):(e.value=t,e.state=1,Ab(e,!1))}catch(MM){wb({done:!1},MM,e)}}};ob&&(fb=(db=function(e){XL(this,fb),WL(e),HL(NL,this);var t=ub(this);try{e(Db(_b,t),Db(wb,t))}catch(MM){wb(t,MM)}}).prototype,(NL=function(e){cb(this,{type:sb,done:!1,notified:!1,parent:!1,reactions:new tb,rejection:!1,state:0,value:void 0})}).prototype=VL(fb,"then",(function(e,t){var r=ub(this),i=mb(QL(this,db));return r.parent=!0,i.ok=!qL(e)||e,i.fail=qL(t)&&t,i.domain=GL?pb.domain:void 0,0==r.state?r.reactions.add(i):JL((function(){Sb(i,r)})),i.promise})),UL=function(){var e=new NL,t=ub(e);this.promise=e,this.resolve=Db(_b,t),this.reject=Db(wb,t)},ab.f=mb=function(e){return e===db||undefined===e?new UL(e):yb(e)}),BL({global:!0,constructor:!0,wrap:!0,forced:ob},{Promise:db}),jL(db,sb,!1,!0),YL(sb);var Pb=pL,Cb=CL.CONSTRUCTOR||!cf((function(e){Pb.all(e).then(void 0,(function(){}))})),xb=C,Mb=Pe,Ob=xL,Fb=gL,Nb=Fv;Dr({target:"Promise",stat:!0,forced:Cb},{all:function(e){var t=this,r=Ob.f(t),i=r.resolve,n=r.reject,a=Fb((function(){var r=Mb(t.resolve),a=[],s=0,o=1;Nb(e,(function(e){var l=s++,u=!1;o++,xb(r,t,e).then((function(e){u||(u=!0,a[l]=e,--o||i(a))}),n)})),--o||i(a)}));return a.error&&n(a.value),r.promise}});var Ub=Dr,Bb=CL.CONSTRUCTOR;pL&&pL.prototype,Ub({target:"Promise",proto:!0,forced:Bb,real:!0},{catch:function(e){return this.then(void 0,e)}});var Gb=C,Kb=Pe,Hb=xL,Vb=gL,jb=Fv;Dr({target:"Promise",stat:!0,forced:Cb},{race:function(e){var t=this,r=Hb.f(t),i=r.reject,n=Vb((function(){var n=Kb(t.resolve);jb(e,(function(e){Gb(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var Yb=C,Wb=xL;Dr({target:"Promise",stat:!0,forced:CL.CONSTRUCTOR},{reject:function(e){var t=Wb.f(this);return Yb(t.reject,void 0,e),t.promise}});var qb=rr,zb=ee,Xb=xL,Qb=function(e,t){if(qb(e),zb(t)&&t.constructor===e)return t;var r=Xb.f(e);return(0,r.resolve)(t),r.promise},$b=Dr,Jb=pL,Zb=CL.CONSTRUCTOR,eR=Qb,tR=se("Promise"),rR=!Zb;$b({target:"Promise",stat:!0,forced:true},{resolve:function(e){return eR(rR&&this===tR?Jb:this,e)}});var iR=C,nR=Pe,aR=xL,sR=gL,oR=Fv;Dr({target:"Promise",stat:!0,forced:Cb},{allSettled:function(e){var t=this,r=aR.f(t),i=r.resolve,n=r.reject,a=sR((function(){var r=nR(t.resolve),n=[],a=0,s=1;oR(e,(function(e){var o=a++,l=!1;s++,iR(r,t,e).then((function(e){l||(l=!0,n[o]={status:"fulfilled",value:e},--s||i(n))}),(function(e){l||(l=!0,n[o]={status:"rejected",reason:e},--s||i(n))}))})),--s||i(n)}));return a.error&&n(a.value),r.promise}});var lR=C,uR=Pe,cR=se,hR=xL,dR=gL,fR=Fv,vR="No one promise resolved";Dr({target:"Promise",stat:!0,forced:Cb},{any:function(e){var t=this,r=cR("AggregateError"),i=hR.f(t),n=i.resolve,a=i.reject,s=dR((function(){var i=uR(t.resolve),s=[],o=0,l=1,u=!1;fR(e,(function(e){var c=o++,h=!1;l++,lR(i,t,e).then((function(e){h||u||(u=!0,n(e))}),(function(e){h||u||(h=!0,s[c]=e,--l||a(new r(s,vR)))}))})),--l||a(new r(s,vR))}));return s.error&&a(s.value),i.promise}});var gR=Dr,pR=pL,mR=a,yR=se,ER=I,kR=fA,TR=Qb,SR=pR&&pR.prototype;gR({target:"Promise",proto:!0,real:!0,forced:!!pR&&mR((function(){SR.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=kR(this,yR("Promise")),r=ER(e);return this.then(r?function(r){return TR(t,e()).then((function(){return r}))}:e,r?function(r){return TR(t,e()).then((function(){throw r}))}:e)}});var AR=te.Promise,LR=xL,bR=gL;Dr({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=LR.f(this),r=bR(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var RR=r(AR),IR=a,DR=dt("iterator"),wR=!IR((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,i){t.delete("b"),r+=i+e})),!e.toJSON||!t.size&&true||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[DR]||"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})),_R=p,PR=2147483647,CR=/[^\0-\u007E]/,xR=/[.\u3002\uFF0E\uFF61]/g,MR="Overflow: input needs wider integers to process",OR=RangeError,FR=_R(xR.exec),NR=Math.floor,UR=String.fromCharCode,BR=_R("".charCodeAt),GR=_R([].join),KR=_R([].push),HR=_R("".replace),VR=_R("".split),jR=_R("".toLowerCase),YR=function(e){return e+22+75*(e<26)},WR=function(e,t,r){var i=0;for(e=r?NR(e/700):e>>1,e+=NR(e/t);e>455;)e=NR(e/35),i+=36;return NR(i+36*e/(e+38))},qR=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=BR(e,r++);if(n>=55296&&n<=56319&&r<i){var a=BR(e,r++);56320==(64512&a)?KR(t,((1023&n)<<10)+(1023&a)+65536):(KR(t,n),r--)}else KR(t,n)}return t}(e);var r,i,n=e.length,a=128,s=0,o=72;for(r=0;r<e.length;r++)(i=e[r])<128&&KR(t,UR(i));var l=t.length,u=l;for(l&&KR(t,"-");u<n;){var c=PR;for(r=0;r<e.length;r++)(i=e[r])>=a&&i<c&&(c=i);var h=u+1;if(c-a>NR((PR-s)/h))throw OR(MR);for(s+=(c-a)*h,a=c,r=0;r<e.length;r++){if((i=e[r])<a&&++s>PR)throw OR(MR);if(i==a){for(var d=s,f=36;;){var v=f<=o?1:f>=o+26?26:f-o;if(d<v)break;var g=d-v,p=36-v;KR(t,UR(YR(v+g%p))),d=NR(g/p),f+=36}KR(t,UR(YR(d))),o=WR(s,h,u==l),s=0,u++}}s++,a++}return GR(t,"")},zR=Dr,XR=n,QR=C,$R=p,JR=w,ZR=wR,eI=vn,tI=pn,rI=ig,iI=Gn,nI=uu,aI=ra,sI=Bv,oI=I,lI=Je,uI=Qt,cI=pi,hI=rr,dI=ee,fI=Ei,vI=Yi,gI=B,pI=Wd,mI=ad,yI=Jy,EI=Uk,kI=dt("iterator"),TI="URLSearchParams",SI=TI+"Iterator",AI=aI.set,LI=aI.getterFor(TI),bI=aI.getterFor(SI),RI=Object.getOwnPropertyDescriptor,II=function(e){if(!JR)return XR[e];var t=RI(XR,e);return t&&t.value},DI=II("fetch"),wI=II("Request"),_I=II("Headers"),PI=wI&&wI.prototype,CI=_I&&_I.prototype,xI=XR.RegExp,MI=XR.TypeError,OI=XR.decodeURIComponent,FI=XR.encodeURIComponent,NI=$R("".charAt),UI=$R([].join),BI=$R([].push),GI=$R("".replace),KI=$R([].shift),HI=$R([].splice),VI=$R("".split),jI=$R("".slice),YI=/\+/g,WI=Array(4),qI=function(e){return WI[e-1]||(WI[e-1]=xI("((?:%[\\da-f]{2}){"+e+"})","gi"))},zI=function(e){try{return OI(e)}catch(MM){return e}},XI=function(e){var t=GI(e,YI," "),r=4;try{return OI(t)}catch(MM){for(;r;)t=GI(t,qI(r--),zI);return t}},QI=/[!'()~]|%20/g,$I={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},JI=function(e){return $I[e]},ZI=function(e){return GI(FI(e),QI,JI)},eD=nI((function(e,t){AI(this,{type:SI,iterator:pI(LI(e).entries),kind:t})}),"Iterator",(function(){var e=bI(this),t=e.kind,r=e.iterator.next(),i=r.value;return r.done||(r.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),r}),!0),tD=function(e){this.entries=[],this.url=null,void 0!==e&&(dI(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===NI(e,0)?jI(e,1):e:fI(e)))};tD.prototype={type:TI,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,a,s,o,l=mI(e);if(l)for(r=(t=pI(e,l)).next;!(i=QR(r,t)).done;){if(a=(n=pI(hI(i.value))).next,(s=QR(a,n)).done||(o=QR(a,n)).done||!QR(a,n).done)throw MI("Expected sequence with length 2");BI(this.entries,{key:fI(s.value),value:fI(o.value)})}else for(var u in e)lI(e,u)&&BI(this.entries,{key:u,value:fI(e[u])})},parseQuery:function(e){if(e)for(var t,r,i=VI(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=VI(t,"="),BI(this.entries,{key:XI(KI(r)),value:XI(UI(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],BI(r,ZI(e.key)+"="+ZI(e.value));return UI(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var rD=function(){sI(this,iD);var e=AI(this,new tD(arguments.length>0?arguments[0]:void 0));JR||(this.length=e.entries.length)},iD=rD.prototype;if(rI(iD,{append:function(e,t){yI(arguments.length,2);var r=LI(this);BI(r.entries,{key:fI(e),value:fI(t)}),JR||this.length++,r.updateURL()},delete:function(e){yI(arguments.length,1);for(var t=LI(this),r=t.entries,i=fI(e),n=0;n<r.length;)r[n].key===i?HI(r,n,1):n++;JR||(this.length=r.length),t.updateURL()},get:function(e){yI(arguments.length,1);for(var t=LI(this).entries,r=fI(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){yI(arguments.length,1);for(var t=LI(this).entries,r=fI(e),i=[],n=0;n<t.length;n++)t[n].key===r&&BI(i,t[n].value);return i},has:function(e){yI(arguments.length,1);for(var t=LI(this).entries,r=fI(e),i=0;i<t.length;)if(t[i++].key===r)return!0;return!1},set:function(e,t){yI(arguments.length,1);for(var r,i=LI(this),n=i.entries,a=!1,s=fI(e),o=fI(t),l=0;l<n.length;l++)(r=n[l]).key===s&&(a?HI(n,l--,1):(a=!0,r.value=o));a||BI(n,{key:s,value:o}),JR||(this.length=n.length),i.updateURL()},sort:function(){var e=LI(this);EI(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=LI(this).entries,i=uI(e,arguments.length>1?arguments[1]:void 0),n=0;n<r.length;)i((t=r[n++]).value,t.key,this)},keys:function(){return new eD(this,"keys")},values:function(){return new eD(this,"values")},entries:function(){return new eD(this,"entries")}},{enumerable:!0}),eI(iD,kI,iD.entries,{name:"entries"}),eI(iD,"toString",(function(){return LI(this).serialize()}),{enumerable:!0}),JR&&tI(iD,"size",{get:function(){return LI(this).entries.length},configurable:!0,enumerable:!0}),iI(rD,TI),zR({global:!0,constructor:!0,forced:!ZR},{URLSearchParams:rD}),!ZR&&oI(_I)){var nD=$R(CI.has),aD=$R(CI.set),sD=function(e){if(dI(e)){var t,r=e.body;if(cI(r)===TI)return t=e.headers?new _I(e.headers):new _I,nD(t,"content-type")||aD(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),vI(e,{body:gI(0,fI(r)),headers:gI(0,t)})}return e};if(oI(DI)&&zR({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return DI(e,arguments.length>1?sD(arguments[1]):{})}}),oI(wI)){var oD=function(e){return sI(this,PI),new wI(e,arguments.length>1?sD(arguments[1]):{})};PI.constructor=oD,oD.prototype=PI,zR({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:oD})}}var lD,uD=Dr,cD=w,hD=wR,dD=n,fD=Qt,vD=p,gD=vn,pD=pn,mD=Bv,yD=Je,ED=UT,kD=af,TD=sn,SD=Fh.codeAt,AD=function(e){var t,r,i=[],n=VR(HR(jR(e),xR,"."),".");for(t=0;t<n.length;t++)r=n[t],KR(i,FR(CR,r)?"xn--"+qR(r):r);return GR(i,".")},LD=Ei,bD=Gn,RD=Jy,ID={URLSearchParams:rD,getState:LI},DD=ra,wD=DD.set,_D=DD.getterFor("URL"),PD=ID.URLSearchParams,CD=ID.getState,xD=dD.URL,MD=dD.TypeError,OD=dD.parseInt,FD=Math.floor,ND=Math.pow,UD=vD("".charAt),BD=vD(/./.exec),GD=vD([].join),KD=vD(1..toString),HD=vD([].pop),VD=vD([].push),jD=vD("".replace),YD=vD([].shift),WD=vD("".split),qD=vD("".slice),zD=vD("".toLowerCase),XD=vD([].unshift),QD="Invalid scheme",$D="Invalid host",JD="Invalid port",ZD=/[a-z]/i,ew=/[\d+-.a-z]/i,tw=/\d/,rw=/^0x/i,iw=/^[0-7]+$/,nw=/^\d+$/,aw=/^[\da-f]+$/i,sw=/[\0\t\n\r #%/:<>?@[\\\]^|]/,ow=/[\0\t\n\r #/:<>?@[\\\]^|]/,lw=/^[\u0000-\u0020]+/,uw=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,cw=/[\t\n\r]/g,hw=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)XD(t,e%256),e=FD(e/256);return GD(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,n=0,a=0;a<8;a++)0!==e[a]?(n>r&&(t=i,r=n),i=null,n=0):(null===i&&(i=a),++n);return n>r&&(t=i,r=n),t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=KD(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},dw={},fw=ED({},dw,{" ":1,'"':1,"<":1,">":1,"`":1}),vw=ED({},fw,{"#":1,"?":1,"{":1,"}":1}),gw=ED({},vw,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),pw=function(e,t){var r=SD(e,0);return r>32&&r<127&&!yD(t,e)?e:encodeURIComponent(e)},mw={ftp:21,file:null,http:80,https:443,ws:80,wss:443},yw=function(e,t){var r;return 2==e.length&&BD(ZD,UD(e,0))&&(":"==(r=UD(e,1))||!t&&"|"==r)},Ew=function(e){var t;return e.length>1&&yw(qD(e,0,2))&&(2==e.length||"/"===(t=UD(e,2))||"\\"===t||"?"===t||"#"===t)},kw=function(e){return"."===e||"%2e"===zD(e)},Tw={},Sw={},Aw={},Lw={},bw={},Rw={},Iw={},Dw={},ww={},_w={},Pw={},Cw={},xw={},Mw={},Ow={},Fw={},Nw={},Uw={},Bw={},Gw={},Kw={},Hw=function(e,t,r){var i,n,a,s=LD(e);if(t){if(n=this.parse(s))throw MD(n);this.searchParams=null}else{if(void 0!==r&&(i=new Hw(r,!0)),n=this.parse(s,null,i))throw MD(n);(a=CD(new PD)).bindURL(this),this.searchParams=a}};Hw.prototype={type:"URL",parse:function(e,t,r){var i,n,a,s,o,l=this,u=t||Tw,c=0,h="",d=!1,f=!1,v=!1;for(e=LD(e),t||(l.scheme="",l.username="",l.password="",l.host=null,l.port=null,l.path=[],l.query=null,l.fragment=null,l.cannotBeABaseURL=!1,e=jD(e,lw,""),e=jD(e,uw,"$1")),e=jD(e,cw,""),i=kD(e);c<=i.length;){switch(n=i[c],u){case Tw:if(!n||!BD(ZD,n)){if(t)return QD;u=Aw;continue}h+=zD(n),u=Sw;break;case Sw:if(n&&(BD(ew,n)||"+"==n||"-"==n||"."==n))h+=zD(n);else{if(":"!=n){if(t)return QD;h="",u=Aw,c=0;continue}if(t&&(l.isSpecial()!=yD(mw,h)||"file"==h&&(l.includesCredentials()||null!==l.port)||"file"==l.scheme&&!l.host))return;if(l.scheme=h,t)return void(l.isSpecial()&&mw[l.scheme]==l.port&&(l.port=null));h="","file"==l.scheme?u=Mw:l.isSpecial()&&r&&r.scheme==l.scheme?u=Lw:l.isSpecial()?u=Dw:"/"==i[c+1]?(u=bw,c++):(l.cannotBeABaseURL=!0,VD(l.path,""),u=Bw)}break;case Aw:if(!r||r.cannotBeABaseURL&&"#"!=n)return QD;if(r.cannotBeABaseURL&&"#"==n){l.scheme=r.scheme,l.path=TD(r.path),l.query=r.query,l.fragment="",l.cannotBeABaseURL=!0,u=Kw;break}u="file"==r.scheme?Mw:Rw;continue;case Lw:if("/"!=n||"/"!=i[c+1]){u=Rw;continue}u=ww,c++;break;case bw:if("/"==n){u=_w;break}u=Uw;continue;case Rw:if(l.scheme=r.scheme,n==lD)l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=TD(r.path),l.query=r.query;else if("/"==n||"\\"==n&&l.isSpecial())u=Iw;else if("?"==n)l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=TD(r.path),l.query="",u=Gw;else{if("#"!=n){l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=TD(r.path),l.path.length--,u=Uw;continue}l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=TD(r.path),l.query=r.query,l.fragment="",u=Kw}break;case Iw:if(!l.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,u=Uw;continue}u=_w}else u=ww;break;case Dw:if(u=ww,"/"!=n||"/"!=UD(h,c+1))continue;c++;break;case ww:if("/"!=n&&"\\"!=n){u=_w;continue}break;case _w:if("@"==n){d&&(h="%40"+h),d=!0,a=kD(h);for(var g=0;g<a.length;g++){var p=a[g];if(":"!=p||v){var m=pw(p,gw);v?l.password+=m:l.username+=m}else v=!0}h=""}else if(n==lD||"/"==n||"?"==n||"#"==n||"\\"==n&&l.isSpecial()){if(d&&""==h)return"Invalid authority";c-=kD(h).length+1,h="",u=Pw}else h+=n;break;case Pw:case Cw:if(t&&"file"==l.scheme){u=Fw;continue}if(":"!=n||f){if(n==lD||"/"==n||"?"==n||"#"==n||"\\"==n&&l.isSpecial()){if(l.isSpecial()&&""==h)return $D;if(t&&""==h&&(l.includesCredentials()||null!==l.port))return;if(s=l.parseHost(h))return s;if(h="",u=Nw,t)return;continue}"["==n?f=!0:"]"==n&&(f=!1),h+=n}else{if(""==h)return $D;if(s=l.parseHost(h))return s;if(h="",u=xw,t==Cw)return}break;case xw:if(!BD(tw,n)){if(n==lD||"/"==n||"?"==n||"#"==n||"\\"==n&&l.isSpecial()||t){if(""!=h){var y=OD(h,10);if(y>65535)return JD;l.port=l.isSpecial()&&y===mw[l.scheme]?null:y,h=""}if(t)return;u=Nw;continue}return JD}h+=n;break;case Mw:if(l.scheme="file","/"==n||"\\"==n)u=Ow;else{if(!r||"file"!=r.scheme){u=Uw;continue}if(n==lD)l.host=r.host,l.path=TD(r.path),l.query=r.query;else if("?"==n)l.host=r.host,l.path=TD(r.path),l.query="",u=Gw;else{if("#"!=n){Ew(GD(TD(i,c),""))||(l.host=r.host,l.path=TD(r.path),l.shortenPath()),u=Uw;continue}l.host=r.host,l.path=TD(r.path),l.query=r.query,l.fragment="",u=Kw}}break;case Ow:if("/"==n||"\\"==n){u=Fw;break}r&&"file"==r.scheme&&!Ew(GD(TD(i,c),""))&&(yw(r.path[0],!0)?VD(l.path,r.path[0]):l.host=r.host),u=Uw;continue;case Fw:if(n==lD||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&yw(h))u=Uw;else if(""==h){if(l.host="",t)return;u=Nw}else{if(s=l.parseHost(h))return s;if("localhost"==l.host&&(l.host=""),t)return;h="",u=Nw}continue}h+=n;break;case Nw:if(l.isSpecial()){if(u=Uw,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=lD&&(u=Uw,"/"!=n))continue}else l.fragment="",u=Kw;else l.query="",u=Gw;break;case Uw:if(n==lD||"/"==n||"\\"==n&&l.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(o=zD(o=h))||"%2e."===o||".%2e"===o||"%2e%2e"===o?(l.shortenPath(),"/"==n||"\\"==n&&l.isSpecial()||VD(l.path,"")):kw(h)?"/"==n||"\\"==n&&l.isSpecial()||VD(l.path,""):("file"==l.scheme&&!l.path.length&&yw(h)&&(l.host&&(l.host=""),h=UD(h,0)+":"),VD(l.path,h)),h="","file"==l.scheme&&(n==lD||"?"==n||"#"==n))for(;l.path.length>1&&""===l.path[0];)YD(l.path);"?"==n?(l.query="",u=Gw):"#"==n&&(l.fragment="",u=Kw)}else h+=pw(n,vw);break;case Bw:"?"==n?(l.query="",u=Gw):"#"==n?(l.fragment="",u=Kw):n!=lD&&(l.path[0]+=pw(n,dw));break;case Gw:t||"#"!=n?n!=lD&&("'"==n&&l.isSpecial()?l.query+="%27":l.query+="#"==n?"%23":pw(n,dw)):(l.fragment="",u=Kw);break;case Kw:n!=lD&&(l.fragment+=pw(n,fw))}c++}},parseHost:function(e){var t,r,i;if("["==UD(e,0)){if("]"!=UD(e,e.length-1))return $D;if(t=function(e){var t,r,i,n,a,s,o,l=[0,0,0,0,0,0,0,0],u=0,c=null,h=0,d=function(){return UD(e,h)};if(":"==d()){if(":"!=UD(e,1))return;h+=2,c=++u}for(;d();){if(8==u)return;if(":"!=d()){for(t=r=0;r<4&&BD(aw,d());)t=16*t+OD(d(),16),h++,r++;if("."==d()){if(0==r)return;if(h-=r,u>6)return;for(i=0;d();){if(n=null,i>0){if(!("."==d()&&i<4))return;h++}if(!BD(tw,d()))return;for(;BD(tw,d());){if(a=OD(d(),10),null===n)n=a;else{if(0==n)return;n=10*n+a}if(n>255)return;h++}l[u]=256*l[u]+n,2!=++i&&4!=i||u++}if(4!=i)return;break}if(":"==d()){if(h++,!d())return}else if(d())return;l[u++]=t}else{if(null!==c)return;h++,c=++u}}if(null!==c)for(s=u-c,u=7;0!=u&&s>0;)o=l[u],l[u--]=l[c+s-1],l[c+--s]=o;else if(8!=u)return;return l}(qD(e,1,-1)),!t)return $D;this.host=t}else if(this.isSpecial()){if(e=AD(e),BD(sw,e))return $D;if(t=function(e){var t,r,i,n,a,s,o,l=WD(e,".");if(l.length&&""==l[l.length-1]&&l.length--,(t=l.length)>4)return e;for(r=[],i=0;i<t;i++){if(""==(n=l[i]))return e;if(a=10,n.length>1&&"0"==UD(n,0)&&(a=BD(rw,n)?16:8,n=qD(n,8==a?1:2)),""===n)s=0;else{if(!BD(10==a?nw:8==a?iw:aw,n))return e;s=OD(n,a)}VD(r,s)}for(i=0;i<t;i++)if(s=r[i],i==t-1){if(s>=ND(256,5-t))return null}else if(s>255)return null;for(o=HD(r),i=0;i<r.length;i++)o+=r[i]*ND(256,3-i);return o}(e),null===t)return $D;this.host=t}else{if(BD(ow,e))return $D;for(t="",r=kD(e),i=0;i<r.length;i++)t+=pw(r[i],dw);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return yD(mw,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&yw(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=e.password,n=e.host,a=e.port,s=e.path,o=e.query,l=e.fragment,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=r+(i?":"+i:"")+"@"),u+=hw(n),null!==a&&(u+=":"+a)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?s[0]:s.length?"/"+GD(s,"/"):"",null!==o&&(u+="?"+o),null!==l&&(u+="#"+l),u},setHref:function(e){var t=this.parse(e);if(t)throw MD(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new Vw(e.path[0]).origin}catch(MM){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+hw(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(LD(e)+":",Tw)},getUsername:function(){return this.username},setUsername:function(e){var t=kD(LD(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=pw(t[r],gw)}},getPassword:function(){return this.password},setPassword:function(e){var t=kD(LD(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=pw(t[r],gw)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?hw(e):hw(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,Pw)},getHostname:function(){var e=this.host;return null===e?"":hw(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Cw)},getPort:function(){var e=this.port;return null===e?"":LD(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=LD(e))?this.port=null:this.parse(e,xw))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+GD(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,Nw))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=LD(e))?this.query=null:("?"==UD(e,0)&&(e=qD(e,1)),this.query="",this.parse(e,Gw)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=LD(e))?("#"==UD(e,0)&&(e=qD(e,1)),this.fragment="",this.parse(e,Kw)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Vw=function(e){var t=mD(this,jw),r=RD(arguments.length,1)>1?arguments[1]:void 0,i=wD(t,new Hw(e,!1,r));cD||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},jw=Vw.prototype,Yw=function(e,t){return{get:function(){return _D(this)[e]()},set:t&&function(e){return _D(this)[t](e)},configurable:!0,enumerable:!0}};if(cD&&(pD(jw,"href",Yw("serialize","setHref")),pD(jw,"origin",Yw("getOrigin")),pD(jw,"protocol",Yw("getProtocol","setProtocol")),pD(jw,"username",Yw("getUsername","setUsername")),pD(jw,"password",Yw("getPassword","setPassword")),pD(jw,"host",Yw("getHost","setHost")),pD(jw,"hostname",Yw("getHostname","setHostname")),pD(jw,"port",Yw("getPort","setPort")),pD(jw,"pathname",Yw("getPathname","setPathname")),pD(jw,"search",Yw("getSearch","setSearch")),pD(jw,"searchParams",Yw("getSearchParams")),pD(jw,"hash",Yw("getHash","setHash"))),gD(jw,"toJSON",(function(){return _D(this).serialize()}),{enumerable:!0}),gD(jw,"toString",(function(){return _D(this).serialize()}),{enumerable:!0}),xD){var Ww=xD.createObjectURL,qw=xD.revokeObjectURL;Ww&&gD(Vw,"createObjectURL",fD(Ww,xD)),qw&&gD(Vw,"revokeObjectURL",fD(qw,xD))}bD(Vw,"URL"),uD({global:!0,constructor:!0,forced:!hD,sham:!cD},{URL:Vw});var zw=Dr,Xw=a,Qw=Jy,$w=Ei,Jw=wR,Zw=se("URL");zw({target:"URL",stat:!0,forced:!(Jw&&Xw((function(){Zw.canParse()})))},{canParse:function(e){var t=Qw(arguments.length,1),r=$w(e),i=t<2||void 0===arguments[1]?void 0:$w(arguments[1]);try{return!!new Zw(r,i)}catch(MM){return!1}}});var e_=r(te.URL),t_=r(fm),r_=h,i_=$,n_=Cr,a_=Kr,s_=tc,o_=Math.min,l_=[].lastIndexOf,u_=!!l_&&1/[1].lastIndexOf(1,-0)<0,c_=s_("lastIndexOf"),h_=u_||!c_?function(e){if(u_)return r_(l_,this,arguments)||0;var t=i_(this),r=a_(t),i=r-1;for(arguments.length>1&&(i=o_(i,n_(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:l_;Dr({target:"Array",proto:!0,forced:h_!==[].lastIndexOf},{lastIndexOf:h_});var d_=Xo("Array").lastIndexOf,f_=oe,v_=d_,g_=Array.prototype,p_=r((function(e){var t=e.lastIndexOf;return e===g_||f_(g_,e)&&t===g_.lastIndexOf?v_:t})),m_=Dr,y_=na,E_=p([].reverse),k_=[1,2];m_({target:"Array",proto:!0,forced:String(k_)===String(k_.reverse())},{reverse:function(){return y_(this)&&(this.length=this.length),E_(this)}});var T_=Xo("Array").reverse,S_=oe,A_=T_,L_=Array.prototype,b_=r((function(e){var t=e.reverse;return e===L_||S_(L_,e)&&t===L_.reverse?A_:t})),R_=Dr,I_=Date,D_=p(I_.prototype.getTime);R_({target:"Date",stat:!0},{now:function(){return D_(new I_)}});var w_=r(te.Date.now),__=te,P_=h;__.JSON||(__.JSON={stringify:JSON.stringify});var C_=function(e,t,r){return P_(__.JSON.stringify,null,arguments)},x_=r(C_),M_=rr,O_=C,F_=Je,N_=oe,U_=function(){var e=M_(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},B_=RegExp.prototype,G_=oe,K_=function(e){var t=e.flags;return void 0!==t||"flags"in B_||F_(e,"flags")||!N_(B_,e)?t:O_(U_,e)},H_=RegExp.prototype,V_=r((function(e){return e===H_||G_(H_,e)?K_(e):e.flags}));Dr({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{EPSILON:Math.pow(2,-52)});var j_=r(Math.pow(2,-52)),Y_=r(cm);tg("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Ag);var W_=te.Set,q_=Ie,z_=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(q_(e)+" is not a set")},X_=Kg,Q_=se("Set"),$_=Q_.prototype,J_={Set:Q_,add:X_("add",1),has:X_("has",1),remove:X_("delete",1),proto:$_},Z_=Jg,eP=function(e,t,r){return r?Z_(e.keys(),t):e.forEach(t)},tP=eP,rP=J_.Set,iP=J_.add,nP=function(e){var t=new rP;return tP(e,(function(e){iP(t,e)})),t},aP=function(e){return e.size},sP=Pe,oP=rr,lP=C,uP=Cr,cP=TypeError,hP=Math.max,dP=function(e,t,r,i){this.set=e,this.size=t,this.has=r,this.keys=i};dP.prototype={getIterator:function(){return oP(lP(this.keys,this.set))},includes:function(e){return lP(this.has,this.set,e)}};var fP=function(e){oP(e);var t=+e.size;if(t!=t)throw cP("Invalid size");return new dP(e,hP(uP(t),0),sP(e.has),sP(e.keys))},vP=z_,gP=nP,pP=aP,mP=fP,yP=eP,EP=Jg,kP=J_.has,TP=J_.remove,SP=function(e){var t=vP(this),r=mP(e),i=gP(t);return pP(t)<=r.size?yP(t,(function(e){r.includes(e)&&TP(i,e)})):EP(r.getIterator(),(function(e){kP(t,e)&&TP(i,e)})),i},AP=function(){return!1},LP=SP;Dr({target:"Set",proto:!0,real:!0,forced:!AP()},{difference:LP});var bP=z_,RP=aP,IP=fP,DP=eP,wP=Jg,_P=J_.Set,PP=J_.add,CP=J_.has,xP=function(e){var t=bP(this),r=IP(e),i=new _P;return RP(t)>r.size?wP(r.getIterator(),(function(e){CP(t,e)&&PP(i,e)})):DP(t,(function(e){r.includes(e)&&PP(i,e)})),i},MP=xP;Dr({target:"Set",proto:!0,real:!0,forced:!AP()},{intersection:MP});var OP=z_,FP=J_.has,NP=aP,UP=fP,BP=eP,GP=Jg,KP=xd,HP=function(e){var t=OP(this),r=UP(e);if(NP(t)<=r.size)return!1!==BP(t,(function(e){if(r.includes(e))return!1}),!0);var i=r.getIterator();return!1!==GP(i,(function(e){if(FP(t,e))return KP(i,"normal",!1)}))},VP=HP;Dr({target:"Set",proto:!0,real:!0,forced:!AP()},{isDisjointFrom:VP});var jP=z_,YP=aP,WP=eP,qP=fP,zP=function(e){var t=jP(this),r=qP(e);return!(YP(t)>r.size)&&!1!==WP(t,(function(e){if(!r.includes(e))return!1}),!0)},XP=zP;Dr({target:"Set",proto:!0,real:!0,forced:!AP()},{isSubsetOf:XP});var QP=z_,$P=J_.has,JP=aP,ZP=fP,eC=Jg,tC=xd,rC=function(e){var t=QP(this),r=ZP(e);if(JP(t)<r.size)return!1;var i=r.getIterator();return!1!==eC(i,(function(e){if(!$P(t,e))return tC(i,"normal",!1)}))},iC=rC;Dr({target:"Set",proto:!0,real:!0,forced:!AP()},{isSupersetOf:iC});var nC=z_,aC=nP,sC=fP,oC=Jg,lC=J_.add,uC=J_.has,cC=J_.remove,hC=function(e){var t=nC(this),r=sC(e).getIterator(),i=aC(t);return oC(r,(function(e){uC(t,e)?cC(i,e):lC(i,e)})),i},dC=hC;Dr({target:"Set",proto:!0,real:!0,forced:!AP()},{symmetricDifference:dC});var fC=z_,vC=J_.add,gC=nP,pC=fP,mC=Jg,yC=function(e){var t=fC(this),r=pC(e).getIterator(),i=gC(t);return mC(r,(function(e){vC(i,e)})),i},EC=yC;Dr({target:"Set",proto:!0,real:!0,forced:!AP()},{union:EC});var kC=W_;Dr({target:"Set",stat:!0,forced:!0},{from:Fg}),Dr({target:"Set",stat:!0,forced:!0},{of:Ug});var TC=z_,SC=J_.add;Dr({target:"Set",proto:!0,real:!0,forced:!0},{addAll:function(){for(var e=TC(this),t=0,r=arguments.length;t<r;t++)SC(e,arguments[t]);return e}});var AC=z_,LC=J_.remove;Dr({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=AC(this),r=!0,i=0,n=arguments.length;i<n;i++)e=LC(t,arguments[i]),r=r&&e;return!!r}});var bC=Qt,RC=z_,IC=eP;Dr({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=RC(this),r=bC(e,arguments.length>1?arguments[1]:void 0);return!1!==IC(t,(function(e){if(!r(e,e,t))return!1}),!0)}});var DC=pi,wC=Je,_C=Y,PC=Pl,CC=dt("iterator"),xC=Object,MC=I,OC=function(e){if(_C(e))return!1;var t=xC(e);return void 0!==t[CC]||"@@iterator"in t||wC(PC,DC(t))},FC=ee,NC=se("Set"),UC=function(e){return function(e){return FC(e)&&"number"==typeof e.size&&MC(e.has)&&MC(e.keys)}(e)?e:OC(e)?new NC(e):e},BC=C,GC=UC,KC=SP;Dr({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){return BC(KC,this,GC(e))}});var HC=Qt,VC=z_,jC=eP,YC=J_.Set,WC=J_.add;Dr({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=VC(this),r=HC(e,arguments.length>1?arguments[1]:void 0),i=new YC;return jC(t,(function(e){r(e,e,t)&&WC(i,e)})),i}});var qC=Qt,zC=z_,XC=eP;Dr({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=zC(this),r=qC(e,arguments.length>1?arguments[1]:void 0),i=XC(t,(function(e){if(r(e,e,t))return{value:e}}),!0);return i&&i.value}});var QC=C,$C=UC,JC=xP;Dr({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){return QC(JC,this,$C(e))}});var ZC=C,ex=UC,tx=HP;Dr({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){return ZC(tx,this,ex(e))}});var rx=C,ix=UC,nx=zP;Dr({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){return rx(nx,this,ix(e))}});var ax=C,sx=UC,ox=rC;Dr({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){return ax(ox,this,sx(e))}});var lx=Dr,ux=p,cx=z_,hx=eP,dx=Ei,fx=ux([].join),vx=ux([].push);lx({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=cx(this),r=void 0===e?",":dx(e),i=[];return hx(t,(function(e){vx(i,e)})),fx(i,r)}});var gx=Qt,px=z_,mx=eP,yx=J_.Set,Ex=J_.add;Dr({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=px(this),r=gx(e,arguments.length>1?arguments[1]:void 0),i=new yx;return mx(t,(function(e){Ex(i,r(e,e,t))})),i}});var kx=Pe,Tx=z_,Sx=eP,Ax=TypeError;Dr({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=Tx(this),r=arguments.length<2,i=r?void 0:arguments[1];if(kx(e),Sx(t,(function(n){r?(r=!1,i=n):i=e(i,n,n,t)})),r)throw Ax("Reduce of empty set with no initial value");return i}});var Lx=Qt,bx=z_,Rx=eP;Dr({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=bx(this),r=Lx(e,arguments.length>1?arguments[1]:void 0);return!0===Rx(t,(function(e){if(r(e,e,t))return!0}),!0)}});var Ix=C,Dx=UC,wx=hC;Dr({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){return Ix(wx,this,Dx(e))}});var _x=C,Px=UC,Cx=yC;Dr({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){return _x(Cx,this,Px(e))}});var xx=r(kC),Mx=Wr.includes;Dr({target:"Array",proto:!0,forced:a((function(){return!Array(1).includes()}))},{includes:function(e){return Mx(this,e,arguments.length>1?arguments[1]:void 0)}});var Ox=Xo("Array").includes,Fx=Dr,Nx=sS,Ux=z,Bx=Ei,Gx=lS,Kx=p("".indexOf);Fx({target:"String",proto:!0,forced:!Gx("includes")},{includes:function(e){return!!~Kx(Bx(Ux(this)),Bx(Nx(e)),arguments.length>1?arguments[1]:void 0)}});var Hx=Xo("String").includes,Vx=oe,jx=Ox,Yx=Hx,Wx=Array.prototype,qx=String.prototype,zx=r((function(e){var t=e.includes;return e===Wx||Vx(Wx,e)&&t===Wx.includes?jx:"string"==typeof e||e===qx||Vx(qx,e)&&t===qx.includes?Yx:t}));Dr({target:"Number",stat:!0},{isInteger:kT});var Xx=r(te.Number.isInteger),Qx=w,$x=p,Jx=ii,Zx=$,eM=$x(x.f),tM=$x([].push),rM=function(e){return function(t){for(var r,i=Zx(t),n=Jx(i),a=n.length,s=0,o=[];a>s;)r=n[s++],Qx&&!eM(i,r)||tM(o,e?[r,i[r]]:i[r]);return o}},iM={entries:rM(!0),values:rM(!1)}.entries;Dr({target:"Object",stat:!0},{entries:function(e){return iM(e)}});var nM=r(te.Object.entries),aM=Xo("Array").entries,sM=pi,oM=Je,lM=oe,uM=aM,cM=Array.prototype,hM={DOMTokenList:!0,NodeList:!0},dM=r((function(e){var t=e.entries;return e===cM||lM(cM,e)&&t===cM.entries||oM(hM,sM(e))?uM:t})),fM=Dr,vM=Na.find,gM="find",pM=!0;gM in[]&&Array(1)[gM]((function(){pM=!1})),fM({target:"Array",proto:!0,forced:pM},{find:function(e){return vM(this,e,arguments.length>1?arguments[1]:void 0)}});var mM=Xo("Array").find,yM=oe,EM=mM,kM=Array.prototype,TM=r((function(e){var t=e.find;return e===kM||yM(kM,e)&&t===kM.find?EM:t})),SM=Xo("Array").values,AM=pi,LM=Je,bM=oe,RM=SM,IM=Array.prototype,DM={DOMTokenList:!0,NodeList:!0},wM=r((function(e){var t=e.values;return e===IM||bM(IM,e)&&t===IM.values||LM(DM,AM(e))?RM:t})),_M=r(mn.f("toStringTag")),PM={exports:{}};(function(e){var t,r,i;function n(e,t){var r=Qm(e);if($m){var i=$m(e);t&&(i=Jm(i).call(i,(function(t){return Zm(e,t).enumerable}))),r.push.apply(r,i)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r,i,a=null!=arguments[t]?arguments[t]:{};t%2?ey(r=n(Object(a),!0)).call(r,(function(t){c(e,t,a[t])})):ty?ry(e,ty(a)):ey(i=n(Object(a))).call(i,(function(t){iy(e,t,Zm(a,t))}))}return e}function s(e){return(s="function"==typeof ny&&"symbol"==qh(ay)?function(e){return qh(e)}:function(e){return e&&"function"==typeof ny&&e.constructor===ny&&e!==ny.prototype?"symbol":qh(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 i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),iy(e,f(i.key),i)}}function u(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),iy(e,"prototype",{writable:!1}),e}function c(e,t,r){return(t=f(t))in e?iy(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){return function(e){if(sy(e))return d(e)}(e)||function(e){if(void 0!==ny&&null!=oy(e)||null!=e["@@iterator"])return ly(e)}(e)||function(e,t,r){if(e){if("string"==typeof e)return d(e,t);var i=uy(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?ly(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?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,i=new Array(t);r<t;r++)i[r]=e[r];return i}function f(e){var t=function(e,t){if("object"!=qh(e)||null===e)return e;var r=e[cy];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=qh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==qh(t)?t:String(t)}var v="undefined"!=typeof window&&window.location&&hy(t=window.location.href).call(t,"xgplayerdebugger=1")>-1,g={info:"color: #525252; background-color: #90ee90;",error:"color: #525252; background-color: red;",warn:"color: #525252; background-color: yellow; "},p="%c[xgplayer]",m={config:{debug:v?3:0},logInfo:function(e){for(var t,r,i=arguments.length,n=new Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];this.config.debug>=3&&(r=console).log.apply(r,py(t=[p,g.info,e]).call(t,n))},logWarn:function(e){for(var t,r,i=arguments.length,n=new Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];this.config.debug>=1&&(r=console).warn.apply(r,py(t=[p,g.warn,e]).call(t,n))},logError:function(e){var t;if(!(this.config.debug<1)){for(var r,i=this.config.debug>=2?"trace":"error",n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];(t=console)[i].apply(t,py(r=[p,g.error,e]).call(r,a))}}},y=function(){function e(t){o(this,e),this.bufferedList=t}return u(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}(),E={};function k(e,t){for(var r=0,i=t.length;r<i;r++)if(hy(e).call(e,t[r])>-1)return!0;return!1}function T(e,t,r){for(var i,n,a=arguments.length,s=new Array(a>3?a-3:0),o=3;o<a;o++)s[o-3]=arguments[o];var l=t.call.apply(t,py(i=[e]).call(i,s));r&&"function"==typeof r&&(l&&l.then?l.then((function(){for(var t,i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];r.call.apply(r,py(t=[e]).call(t,n))})):r.call.apply(r,py(n=[e]).call(n,s)))}function S(e,t){var r,i=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),pE(r=function(){var r,n=arguments,a=this;if(i.pre)try{var s,o;(o=i.pre).call.apply(o,py(s=[this]).call(s,uy(Array.prototype).call(arguments)))}catch(p){var l,u;throw p.message=py(l=py(u="[pluginName: ".concat(this.pluginName,":")).call(u,e,":pre error] >> ")).call(l,p.message),p}if(this.__hooks&&this.__hooks[e])try{var c,d,f=R(this,e,t);f?f.then?f.then((function(e){var r;!1!==e&&T.apply(void 0,py(r=[a,t,i.next]).call(r,h(n)))})).catch((function(e){throw e})):T.apply(void 0,py(c=[this,t,i.next]).call(c,uy(Array.prototype).call(arguments))):void 0===f&&T.apply(void 0,py(d=[this,t,i.next]).call(d,uy(Array.prototype).call(arguments)))}catch(p){var v,g;throw p.message=py(v=py(g="[pluginName: ".concat(this.pluginName,":")).call(g,e,"] >> ")).call(v,p.message),p}else T.apply(void 0,py(r=[this,t,i.next]).call(r,uy(Array.prototype).call(arguments)))}).call(r,this)}function A(e,t){var r=this.__hooks;if(!r||!sy(r[e]))return-1;for(var i=r[e],n=0;n<i.length;n++)if(i[n]===t)return n;return-1}function L(e,t){var r=this.__hooks;if(r)return r.hasOwnProperty(e)?(sy(r[e])||(r[e]=[]),-1===A.call(this,e,t)&&r[e].push(t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function b(e,t){var r=this.__hooks;if(r){if(sy(r[e])){var i=r[e],n=A.call(this,e,t);-1!==n&&UE(i).call(i,n,1)}delete r[e]}}function R(e,t,r){for(var i,n=arguments.length,a=new Array(n>3?n-3:0),s=3;s<n;s++)a[s-3]=arguments[s];if(e.__hooks&&sy(e.__hooks[t])){var o,l=e.__hooks[t],u=-1,c=function e(t,r,i){for(var n,a,s,o=arguments.length,c=new Array(o>3?o-3:0),h=3;h<o;h++)c[h-3]=arguments[h];if(u++,0===l.length||u===l.length)return i.call.apply(i,py(n=[t,t]).call(n,c));var d=l[u],f=d.call.apply(d,py(a=[t,t]).call(a,c));return f&&f.then?f.then((function(n){var a;return!1===n?null:e.apply(void 0,py(a=[t,r,i]).call(a,c))})).catch((function(e){console.warn("[runHooks]".concat(r," reject"),e.message)})):!1!==f?e.apply(void 0,py(s=[t,r,i]).call(s,c)):void 0};return c.apply(void 0,py(o=[e,t,r]).call(o,a))}return r.call.apply(r,py(i=[e,e]).call(i,a))}function I(e,t){var r;m.logError(py(r="[".concat(e,"] event or callback cant be undefined or null when call ")).call(r,t))}E.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]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=document.createElement(t);return a.className=n,a.innerHTML=r,ey(e=Qm(i)).call(e,(function(e){var r=e,n=i[e];"video"===t||"audio"===t||"live-video"===t?n&&a.setAttribute(r,n):a.setAttribute(r,n)})),a},E.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 i,n=document.createElement("div");n.innerHTML=e;var a=n.children;return n=null,a.length>0?(a=a[0],r&&E.addClass(a,r),t&&ey(i=Qm(t)).call(i,(function(e){a.setAttribute(e,t[e])})),a):null}catch(s){return m.logError("util.createDomFromHtml",s),null}},E.hasClass=function(e,t){if(!e||!t)return!1;try{return Sy(Array.prototype).call(e.classList,(function(e){return e===t}))}catch(i){var r=e.className&&"object"===s(e.className)?e.getAttribute("class"):e.className;return r&&!!r.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},E.addClass=function(e,t){if(e&&t)try{var r;ey(r=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(r,(function(t){t&&e.classList.add(t)}))}catch(i){E.hasClass(e,t)||(e.className&&"object"===s(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},E.removeClass=function(e,t){if(e&&t)try{var r;ey(r=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(r,(function(t){t&&e.classList.remove(t)}))}catch(n){var i;E.hasClass(e,t)&&ey(i=t.split(/\s+/g)).call(i,(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," ")}))}},E.toggleClass=function(e,t){var r;e&&ey(r=t.split(/\s+/g)).call(r,(function(t){E.hasClass(e,t)?E.removeClass(e,t):E.addClass(e,t)}))},E.classNames=function(){for(var e=arguments,t=[],r=function(r){var i;"String"===E.typeOf(e[r])?t.push(e[r]):"Object"===E.typeOf(e[r])&&Dy(i=Qm(e[r])).call(i,(function(i){e[r][i]&&t.push(i)}))},i=0;i<arguments.length;i++)r(i);return t.join(" ")},E.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(i){m.logError("util.findDom",i),0===hy(r).call(r,"#")&&(e=t.getElementById(uy(r).call(r,1)))}return e},E.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},E.padStart=function(e,t,r){for(var i=String(r),n=t>>0,a=Math.ceil(n/i.length),s=[],o=String(e);a--;)s.push(i);return s.join("").substring(0,n-o.length)+o},E.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=Xy(E).call(E,Math.floor(e/3600),2,0),r=Xy(E).call(E,Math.floor((e-3600*t)/60),2,0),i=Xy(E).call(E,Math.floor(e-3600*t-60*r),2,0);return("00"===t?[r,i]:[t,r,i]).join(":")},E.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},E.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},E.deepCopy=function(e,t){var r;if("Object"===E.typeOf(t)&&"Object"===E.typeOf(e))return ey(r=Qm(t)).call(r,(function(r){var i;"Object"!==E.typeOf(t[r])||t[r]instanceof Node?"Array"===E.typeOf(t[r])?e[r]="Array"===E.typeOf(e[r])?py(i=e[r]).call(i,t[r]):t[r]:e[r]=t[r]:void 0===e[r]||void 0===e[r]?e[r]=t[r]:E.deepCopy(e[r],t[r])})),e},E.deepMerge=function(e,t){var r;return Dy(r=Qm(t)).call(r,(function(r){var i;"Array"===E.typeOf(t[r])&&"Array"===E.typeOf(e[r])?"Array"===E.typeOf(e[r])&&(i=e[r]).push.apply(i,h(t[r])):E.typeOf(e[r])!==E.typeOf(t[r])||null===e[r]||"Object"!==E.typeOf(e[r])||t[r]instanceof window.Node?null!==t[r]&&(e[r]=t[r]):E.deepMerge(e[r],t[r])})),e},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},E.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return ey(Array.prototype).call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},E.setInterval=function(e,t,r,i){e._interval[t]||(e._interval[t]=gE(pE(r).call(r,e),i))},E.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},E.setTimeout=function(e,t,r){e._timers||(e._timers=[]);var i=mE((function(){t(),E.clearTimeout(e,i)}),r);return e._timers.push(i),i},E.clearTimeout=function(e,t){var r=e._timers;if("Array"===E.typeOf(r)){for(var i=0;i<r.length;i++)if(r[i]===t){UE(r).call(r,i,1),clearTimeout(t);break}}else clearTimeout(t)},E.clearAllTimers=function(e){var t=e._timers;"Array"===E.typeOf(t)&&(Dy(t).call(t,(function(e){clearTimeout(e)})),e._timerIds=[])},E.createImgBtn=function(e,t,r,i){var n,a,s,o,l,u,c,h,d,f,v,g,p=E.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));return p.style.backgroundImage='url("'.concat(t,'")'),r&&i&&(jE(n=["px","rem","em","pt","dp","vw","vh","vm","%"]).call(n,(function(e){var t,n;return!(hy(r).call(r,e)>-1&&hy(i).call(i,e)>-1&&(f=ck(Ek(t=uy(r).call(r,0,hy(r).call(r,e))).call(t)),v=ck(Ek(n=uy(i).call(i,0,hy(i).call(i,e))).call(n)),g=e,1))})),p.style.width=py(a="".concat(f)).call(a,g),p.style.height=py(s="".concat(v)).call(s,g),p.style.backgroundSize=py(o=py(l=py(u="".concat(f)).call(u,g," ")).call(l,v)).call(o,g),p.style.margin="start"===e?py(c=py(h=py(d="-".concat(v/2)).call(d,g," auto auto -")).call(h,f/2)).call(c,g):"auto 5px auto 5px"),p},E.Hex2RGBA=function(e,t){var r,i=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var n="#";e.replace(/[0-9A-F]/gi,(function(e){n+=e+e})),e=n}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){i.push(Ck(e,16))})),py(r="rgba(".concat(i.join(","),", ")).call(r,t,")")):"rgba(255, 255, 255, 0.1)"},E.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},E.checkIsFunction=function(e){return e&&"function"==typeof e},E.checkIsObject=function(e){return null!==e&&"object"===s(e)},E.hide=function(e){e.style.display="none"},E.show=function(e,t){e.style.display=t||"block"},E.isUndefined=function(e){if(null==e)return!0},E.isNotNull=function(e){return!(null==e)},E.setStyleFromCsstext=function(e,t){var r,i;t&&("String"===E.typeOf(t)?Dy(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])}})):Dy(i=Qm(t)).call(i,(function(r){e.style[r]=t[r]})))},E.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"],i=e.style.cssText;if(!i)return{};var n=i.replace(/\s+/g,"").split(";"),a={},s={};return Dy(n).call(n,(function(e){if(e){var t=e.split(":");t.length>1&&(k(t[0],r)?a[t[0]]=t[1]:s[t[0]]=t[1])}})),e.setAttribute("style",""),Dy(t=Qm(s)).call(t,(function(t){e.style[t]=s[t]})),a},E.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var r=t.replace(/\s+/g,"").split(";"),i={};return Dy(r).call(r,(function(e){if(e){var t=e.split(":");t.length>1&&(i[t[0]]=t[1])}})),i},E.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 i=new window.Image;i.onload=function(e){i=null,t&&t(e)},i.onerror=function(e){i=null,r&&r(e)},i.src=e}},E.stopPropagation=function(e){e&&e.stopPropagation()},E.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},E.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},E.checkTouchSupport=function(){return"ontouchstart"in window},E.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,r=[],i=0;i<e.length;i++)r.push({start:e.start(i)<.5?0:e.start(i),end:e.end(i)});gT(r).call(r,(function(e,t){return e.start-t.start||t.end-e.end}));var n=[];if(t)for(var a=0;a<r.length;a++){var s=n.length;if(s){var o=n[s-1].end;r[a].start-o<t?r[a].end>o&&(n[s-1].end=r[a].end):n.push(r[a])}else n.push(r[a])}else n=r;return new y(n)},E.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}},E.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},E.getHostFromUrl=function(e){if("String"!==E.typeOf(e))return"";var t=e.split("/"),r="";return t.length>3&&t[2]&&(r=t[2]),r},E.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},E.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},E.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},E.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=Ck(e)}catch(r){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=Ck(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)}))},E.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},E.adjustTimeByDuration=function(e,t,r){return t&&e&&(e>t||r&&e<t)?t:e},E.createPositionBar=function(e,t){var r=E.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(r),r},E.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]:"",i={scale:"".concat(t.scale||1),translate:py(e="".concat(t.x||0,"%, ")).call(e,t.y||0,"%"),rotate:"".concat(t.rotate||0,"deg")},n=Qm(i);return ey(n).call(n,(function(e){var t,n=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),a=py(t="".concat(e,"(")).call(t,i[e],")");n.test(r)?(n.lastIndex=-1,r=r.replace(n,a)):r+="".concat(a," ")})),r},E.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},E.getIndexByTime=function(e,t){var r=t.length,i=-1;if(r<1)return i;if(e<=t[0].end||r<2)i=0;else if(e>t[r-1].end)i=r-1;else for(var n=1;n<r;n++)if(e>t[n-1].end&&e<=t[n].end){i=n;break}return i},E.getOffsetCurrentTime=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=-1;if((i=r>=0&&r<t.length?r:E.getIndexByTime(e,t))<0)return-1;var n=t.length,a=t[i],s=a.start,o=a.end,l=a.cTime,u=a.offset;return e<s?l:e>=s&&e<=o?e-u:e>o&&i>=n-1?o:-1},E.getCurrentTimeByOffset=function(e,t){var r=-1;if(!t||t.length<0)return e;for(var i=0;i<t.length;i++)if(e<=t[i].duration){r=i;break}if(-1!==r){var n=t[r].start;return r-1<0?n+e:n+(e-t[r-1].duration)}return e};var D,w=function(){function e(t){o(this,e),E.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&Dy(t).call(t,(function(t){e.__hooks[t]=null})),iy(e,"hooks",{get:function(){var t;return e.__hooks&&Dy(t=Qm(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 u(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=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)):sy(e)&&ey(e).call(e,(function(e){r.__events[e]=t,r.player.on(e,t)})):I(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)):sy(e)&&ey(e).call(e,(function(i){r.__onceEvents[i]=t,r.player.once(e,t)})):I(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)):sy(e)&&ey(e).call(e,(function(i){delete r.__events[e],r.player.off(i,t)})):I(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e,t=this;ey(e=["__events","__onceEvents"]).call(e,(function(e){var r;ey(r=Qm(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,i=arguments.length,n=new Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];(t=this.player).emit.apply(t,py(r=[e]).call(r,n))}}},{key:"emitUserAction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var i=a(a({},r),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,i)}}},{key:"hook",value:function(e,t){var r;return S.call.apply(S,py(r=[this]).call(r,uy(Array.prototype).call(arguments)))}},{key:"useHooks",value:function(e,t){for(var r,i=arguments.length,n=new Array(i>2?i-2:0),a=2;a<i;a++)n[a-2]=arguments[a];return L.call.apply(L,py(r=[this]).call(r,uy(Array.prototype).call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var r,i=arguments.length,n=new Array(i>2?i-2:0),a=2;a<i;a++)n[a-2]=arguments[a];return b.call.apply(b,py(r=[this]).call(r,uy(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,i=this.pluginName;this.offAll(),E.clearAllTimers(this),E.checkIsFunction(this.destroy)&&this.destroy(),Dy(e=["player","playerConfig","pluginName","logger","__args","__hooks"]).call(e,(function(e){t[e]=null})),r.unRegisterPlugin(i),this.__hooks=null}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&iy(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]&&iy(e,r,{configurable:!0,value:t[r]})}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}(),_=mT||function(e){return"number"==typeof e&&isFinite(e)},P=LT||function(e){return"number"==typeof e&&Math.abs(e)<=C},C=bT||9007199254740991,x=((D={}).NETWORK_ERROR="networkError",D.MEDIA_ERROR="mediaError",D.KEY_SYSTEM_ERROR="keySystemError",D.MUX_ERROR="muxError",D.OTHER_ERROR="otherError",D),M=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}({}),O=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}({}),F="manifest",N="level",U="audioTrack",B="subtitleTrack",G="main",K="audio",H="subtitle",V=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;qm(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_=i}return Xm(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}(),j=function(){function e(t,r,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;qm(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_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new V(t),this.fast_=new V(r),this.defaultTTFB_=n,this.ttfb_=new V(t)}return Xm(e,[{key:"update",value:function(e,t){var r=this.slow_,i=this.fast_,n=this.ttfb_;r.halfLife!==e&&(this.slow_=new V(e,r.getEstimate(),r.getTotalWeight())),i.halfLife!==t&&(this.fast_=new V(t,i.getEstimate(),i.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new V(e,n.getEstimate(),n.getTotalWeight()))}},{key:"sample",value:function(e,t){var r=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}},{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 Y(e,t,r){return i=function(e,t){if("object"!=qh(e)||!e)return e;var r=e[cy];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=qh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==qh(i)?i:i+"")in e?iy(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e;var i}function W(){var e;return W=GT?pE(e=GT).call(e):function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},W.apply(null,arguments)}function q(e,t){var r=Qm(e);if($m){var i=$m(e);t&&(i=Jm(i).call(i,(function(t){return Zm(e,t).enumerable}))),r.push.apply(r,i)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r,i,n=null!=arguments[t]?arguments[t]:{};t%2?ey(r=q(Object(n),!0)).call(r,(function(t){Y(e,t,n[t])})):ty?ry(e,ty(n)):ey(i=q(Object(n))).call(i,(function(t){iy(e,t,Zm(n,t))}))}return e}var X=Xm((function e(t,r){var i,n,a,s,o;qm(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=Q,this.debug=pE(i=r.debug).call(i,null,l),this.log=pE(n=r.log).call(n,null,l),this.warn=pE(a=r.warn).call(a,null,l),this.info=pE(s=r.info).call(s,null,l),this.error=pE(o=r.error).call(o,null,l)})),Q=function(){},$={trace:Q,debug:Q,log:Q,warn:Q,info:Q,error:Q};function J(){return W({},$)}function Z(e,t,r){var i,n,a,s,o;return t[e]?pE(i=t[e]).call(i,t):(n=e,a=r,(o=self.console[n])?pE(o).call(o,self.console,py(s="".concat(a?"["+a+"] ":"","[")).call(s,n,"] >")):Q)}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 ie(e,t){var r=Qm(e),i=Qm(t),n=r.length,a=i.length;return!n||!a||n===a&&!Sy(r).call(r,(function(e){return-1===hy(i).call(i,e)}))}var ne={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 ae(e,t){var r,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return!Sy(r=e.split(",")).call(r,(function(e){return!se(e,t,i)}))}function se(e,t){var r,i=re(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);return null!=(r=null==i?void 0:i.isTypeSupported(oe(e,t)))&&r}function oe(e,t){var r;return py(r="".concat(t,"/mp4;codecs=")).call(r,e)}function le(e){if(e){var t=e.substring(0,4);return ne.video[t]}return 2}function ue(e){var t;return eS(t=e.split(",")).call(t,(function(e,t){var r=ne.video[t];return r?(2*r+e)/(e?3:2):(ne.audio[t]+e)/(e?2:1)}),0)}var ce={},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(ce[e])return ce[e];for(var r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e],i=0;i<r.length;i++){var n;if(se(r[i],"audio",t))return ce[e]=r[i],r[i];if("mp3"===r[i]&&null!=(n=re(t))&&n.isTypeSupported("audio/mpeg"))return""}return e}(e.toLowerCase(),t)}))}function fe(e,t){var r;if(e&&(e.length>4||-1!==hy(r=["ac-3","ec-3","alac","fLaC","Opus"]).call(r,e)))return e;if(t){var i=t.split(",");if(i.length>1){if(e)for(var n=i.length;n--;)if(i[n].substring(0,4)===e.substring(0,4))return i[n];return i[0]}}return t||e}function ve(e){if(AS(e).call(e,"av01.")){for(var t=e.split("."),r=["0","111","01","01","01","0"],i=t.length;i>4&&i<10;i++)t[i]=r[i-4];return t.join(".")}return e}function ge(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 pe={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},me={};function ye(e,t,r,i,n,a){var s,o=e.audioCodec?e.audioGroups:null,l=null==a?void 0:a.audioCodec,u=null==a?void 0:a.channels,c=u?Ck(u):l?1/0:2,h=null;if(null!=o&&o.length)try{h=1===o.length&&o[0]?t.groups[o[0]].channels:eS(o).call(o,(function(e,r){if(r){var i,n=t.groups[r];if(!n)throw new Error("Audio track group ".concat(r," not found"));ey(i=Qm(n.channels)).call(i,(function(t){e[t]=(e[t]||0)+n.channels[t]}))}return e}),{2:0})}catch(d){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(i,30)||"SDR"!==e.videoRange&&e.videoRange!==r||e.bitrate>Math.max(n,8e6))||!!h&&_(c)&&Sy(s=Qm(h)).call(s,(function(e){return Ck(e)>c}))}function Ee(e,t,r){var i,n=e.videoCodec,a=e.audioCodec;if(!n&&!a||!r)return RR.resolve(pe);var s=[];if(n){var o,l={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},u=e.videoRange;"SDR"!==u&&(l.transferFunction=u.toLowerCase()),s.push.apply(s,Dy(o=n.split(",")).call(o,(function(e){return{type:"media-source",video:z(z({},l),{},{contentType:oe(ve(e),"video")})}})))}return a&&e.audioGroups&&ey(i=e.audioGroups).call(i,(function(e){var r,i;e&&(null==(i=t.groups[e])||ey(r=i.tracks).call(r,(function(t){if(t.groupId===e){var r,i=t.channels||"",n=ck(i);_(n)&&n>2&&s.push.apply(s,Dy(r=a.split(",")).call(r,(function(e){return{type:"media-source",audio:{contentType:oe(e,"audio"),channels:""+n}}})))}})))})),RR.all(Dy(s).call(s,(function(e){var t=function(e){var t=e.audio,r=e.video,i=r||t;if(i){var n,a,s,o,l,u,c,h=i.contentType.split('"')[1];if(r)return py(n=py(a=py(s=py(o=py(l="r".concat(r.height,"x")).call(l,r.width,"f")).call(o,Math.ceil(r.framerate))).call(s,r.transferFunction||"sd","_")).call(a,h,"_")).call(n,Math.ceil(r.bitrate/1e5));if(t)return py(u=py(c="c".concat(t.channels)).call(c,t.spatialRendering?"s":"n","_")).call(u,h)}return""}(e);return me[t]||(me[t]=r.decodingInfo(e))}))).then((function(e){return{supported:!Sy(e).call(e,(function(e){return!e.supported})),configurations:s,decodingInfoResults:e}})).catch((function(e){return{supported:!1,configurations:s,decodingInfoResults:[],error:e}}))}var ke=["NONE","TYPE-0","TYPE-1",null],Te=["SDR","PQ","HLG"],Se="",Ae="YES",Le="v2";function be(e){var t=e.canSkipUntil,r=e.canSkipDateRanges,i=e.age;return t&&i<t/2?r?Le:Ae:Se}var Re=function(){function e(t,r,i){qm(this,e),this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=r,this.skip=i}return Xm(e,[{key:"addDirectives",value:function(e){var t=new e_(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}(),Ie=function(){function e(t){var r,i;qm(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=Dy(r=Jm(i=[t.videoCodec,t.audioCodec]).call(i,(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 Xm(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 De(this._audioGroups,e)}},{key:"hasSubtitleGroup",value:function(e){return De(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===hy(r).call(r,t)&&r.push(t)}else if("text"===e){var i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),-1===hy(i).call(i,t)&&i.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 De(e,t){return!(!t||!e)&&-1!==hy(e).call(e,t)}function we(e,t){var r=!1,i=[];if(e&&(r="SDR"!==e,i=[e]),t){var n="SDR"!==(i=t.allowedVideoRanges||uy(Te).call(Te,0)).join("")&&!t.videoCodec;(r=void 0!==t.preferHDR?t.preferHDR:n&&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}())||(i=["SDR"])}return{preferHDR:r,allowedVideoRanges:i}}function _e(e,t){var r;te.log(py(r='[abr] start candidates with "'.concat(e,'" ignored because ')).call(r,t))}function Pe(e){return eS(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 i=t.channels||"2";return r.channels[i]=(r.channels[i]||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 xe(e,t,r){if("attrs"in e){var i=hy(t).call(t,e);if(-1!==i)return i}for(var n=0;n<t.length;n++)if(Me(e,t[n],r))return n;return-1}function Me(e,t,r){var i=e.groupId,n=e.name,a=e.lang,s=e.assocLang,o=e.characteristics,l=e.default,u=e.forced;return(void 0===i||t.groupId===i)&&(void 0===n||t.name===n)&&(void 0===a||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--";return e.length===t.length?e===t:AS(e).call(e,t)||AS(t).call(t,e)}(a,t.lang))&&(void 0===a||t.assocLang===s)&&(void 0===l||t.default===l)&&(void 0===u||t.forced===u)&&(void 0===o||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split(","),i=t.split(",");return r.length===i.length&&!Sy(r).call(r,(function(e){return-1===hy(i).call(i,e)}))}(o,t.characteristics))&&(void 0===r||r(e,t))}function Oe(e,t){var r=e.audioCodec,i=e.channels;return!(void 0!==r&&(t.audioCodec||"").substring(0,4)!==r.substring(0,4)||void 0!==i&&i!==(t.channels||"2"))}function Fe(e,t,r){for(var i=t;i>-1;i--)if(r(e[i]))return i;for(var n=t+1;n<e.length;n++)if(r(e[n]))return n;return-1}function Ne(e,t){var r;return!!e&&e!==(null==(r=t.levels[t.loadLevel])?void 0:r.uri)}var Ue=function(e,t){for(var r=0,i=e.length-1,n=null,a=null;r<=i;){var s=t(a=e[n=(r+i)/2|0]);if(s>0)r=n+1;else{if(!(s<0))return a;i=n-1}}return null};function Be(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.005,a=null;if(e){a=t[1+e.sn-t[0].sn]||null;var s=e.endDTS-r;s>0&&s<15e-7&&(r+=15e-7),a&&e.level!==a.level&&a.end<=e.end&&(a=t[2+e.sn-t[0].sn]||null)}else 0===r&&0===t[0].start&&(a=t[0]);if(a&&((!e||e.level===a.level)&&0===Ge(r,i,a)||function(e,t,r){if(t&&0===t.start&&t.level<e.level&&(t.endPTS||0)>0){var i,n=eS(i=t.tagList).call(i,(function(e,t){return"INF"===t[0]&&(e+=ck(t[1])),e}),r);return e.start<=n}return!1}(a,e,Math.min(n,i))))return a;var o=Ue(t,pE(Ge).call(Ge,null,r,i));return!o||o===e&&a?a:o}function Ge(){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 i=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=e?1:r.start-i>e&&r.start?-1:0}function Ke(e,t,r){var i=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-i>e}function He(e,t){return Ue(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}function Ve(e){switch(e.details){case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_TIMEOUT:case M.LEVEL_LOAD_TIMEOUT:case M.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function je(e,t){var r=Ve(t);return e.default[(r?"timeout":"error")+"Retry"]}function Ye(e,t){var r="linear"===e.backoff?1:Math.pow(2,t);return Math.min(r*e.retryDelayMs,e.maxRetryDelayMs)}function We(e){return z(z({},e),{errorRetry:null,timeoutRetry:null})}function qe(e,t,r,i){if(!e)return!1;var n,a=null==i?void 0:i.code,s=t<e.maxNumRetry&&(0===(n=a)&&!1===navigator.onLine||!!n&&(n<400||n>499)||!!r);return e.shouldRetry?e.shouldRetry(e,t,r,i,s):s}var ze=0,Xe=2,Qe=3,$e=5,Je=0,Ze=1,et=2;function tt(e){var t={action:ze,flags:Je};return e&&(t.resolved=!0),t}var rt="NOT_LOADED",it="APPENDING",nt="PARTIAL",at="OK",st=function(){function e(t){qm(this,e),this.activePartLists=t_(null),this.endListFragments=t_(null),this.fragments=t_(null),this.timeRanges=t_(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=t,this._registerListeners()}return Xm(e,[{key:"_registerListeners",value:function(){var e=this.hls;e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.BUFFER_APPENDED,this.onBufferAppended,this),e.on(O.FRAG_BUFFERED,this.onFragBuffered,this),e.on(O.FRAG_LOADED,this.onFragLoaded,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.BUFFER_APPENDED,this.onBufferAppended,this),e.off(O.FRAG_BUFFERED,this.onFragBuffered,this),e.off(O.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 i=r.length;i--;){var n=r[i];if(!n)break;var a=n.end;if(n.start<=e&&null!==a&&e<=a)return n}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 i=this.fragments,n=Qm(i),a=n.length;a--;){var s=i[n[a]];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,i,n){var a,s=this;this.timeRanges&&(this.timeRanges[e]=t);var o=(null==i?void 0:i.fragment.sn)||-1;ey(a=Qm(this.fragments)).call(a,(function(i){var a,l=s.fragments[i];if(l&&!(o>=l.body.sn))if(l.buffered||l.loaded&&!n){var u=l.range[e];u&&(0!==u.time.length?Sy(a=u.time).call(a,(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,i=this.timeRanges;if(i&&"initSegment"!==e.frag.sn){var n=e.frag,a=lt(n),s=this.fragments[a];if(!(!s||s.buffered&&n.gap)){var o=!n.relurl;ey(t=Qm(i)).call(t,(function(t){var a=n.elementaryStreams[t];if(a){var l=i[t],u=o||!0===a.partial;s.range[t]=r.getBufferedTimes(n,e.part,u,l)}})),s.loaded=null,Qm(s.range).length?(s.buffered=!0,(s.body.endList=n.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),ot(s)||this.removeParts(n.sn-1,n.type)):this.removeFragment(s.body)}}}},{key:"removeParts",value:function(e,t){var r=this.activePartLists[t];r&&(this.activePartLists[t]=Jm(r).call(r,(function(t){return t.fragment.sn>=e})))}},{key:"fragBuffered",value:function(e,t){var r=lt(e),i=this.fragments[r];!i&&t&&(i=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:t_(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}},{key:"getBufferedTimes",value:function(e,t,r,i){for(var n={time:[],partial:r},a=e.start,s=e.end,o=e.minEndPTS||s,l=e.maxStartPTS||a,u=0;u<i.length;u++){var c=i.start(u)-this.bufferPadding,h=i.end(u)+this.bufferPadding;if(l>=c&&o<=h){n.time.push({startPTS:Math.max(a,i.start(u)),endPTS:Math.min(s,i.end(u))});break}if(a<h&&s>c){var d=Math.max(a,i.start(u)),f=Math.min(s,i.end(u));f>d&&(n.partial=!0,n.time.push({startPTS:d,endPTS:f}))}else if(s<=c)break}return n}},{key:"getPartialFragment",value:function(e){var t,r,i,n,a=null,s=0,o=this.bufferPadding,l=this.fragments;return ey(t=Qm(l)).call(t,(function(t){var u=l[t];u&&ot(u)&&(i=u.body.start-o,n=u.body.end+o,e>=i&&e<=n&&(r=Math.min(e-i,n-e),s<=r&&(a=u.body,s=r)))})),a}},{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)?nt:at:it:rt}},{key:"isTimeBuffered",value:function(e,t,r){for(var i,n,a=0;a<r.length;a++){if(i=r.start(a)-this.bufferPadding,n=r.end(a)+this.bufferPadding,e>=i&&t<=n)return!0;if(t<=i)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,i=t.part?null:t,n=lt(r);this.fragments[n]={body:r,appendedPTS:null,loaded:i,buffered:!1,range:t_(null)}}}},{key:"onBufferAppended",value:function(e,t){var r=t.frag,i=t.part,n=t.timeRanges,a=t.type;if("initSegment"!==r.sn){var s=r.type;if(i){var o=this.activePartLists[s];o||(this.activePartLists[s]=o=[]),o.push(i)}this.timeRanges=n;var l=n[a];this.detectEvictedFragments(a,l,s,i)}}},{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=Qm(t);if(!e)return r.length>0;for(var i=r.length;i--;){var n=t[r[i]];if((null==n?void 0:n.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,i,n){var a,s=this;i&&!this.hasGaps||ey(a=Qm(this.fragments)).call(a,(function(a){var o=s.fragments[a];if(o){var l=o.body;l.type!==r||i&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&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 i=e.sn;this.activePartLists[e.type]=Jm(r).call(r,(function(e){return e.fragment.sn!==i}))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}},{key:"removeAllFragments",value:function(){var e,t;this.fragments=t_(null),this.endListFragments=t_(null),this.activePartLists=t_(null),this.hasGaps=!1;var r=null==(e=this.hls)||null==(t=e.latestLevelDetails)?void 0:t.partList;r&&ey(r).call(r,(function(e){return e.clearElementaryStreamInfo()}))}}]),e}();function ot(e){var t,r,i;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==(i=e.range.audiovideo)?void 0:i.partial))}function lt(e){var t,r;return py(t=py(r="".concat(e.type,"_")).call(r,e.level,"_")).call(t,e.sn)}var ut=0,ct=1,ht=function(){function e(t,r,i){qm(this,e),this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=t,this.aesIV=r,this.aesMode=i}return Xm(e,[{key:"decrypt",value:function(e,t){switch(this.aesMode){case ut:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case ct: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 uy(Uint8Array.prototype)?uy(e).call(e,t,r):new Uint8Array(uy(Array.prototype).call(e,t,r))}var ft=function(){function e(){qm(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 Xm(e,[{key:"uint8ArrayToUint32Array_",value:function(e){for(var t=new DataView(e),r=new Uint32Array(4),i=0;i<4;i++)r[i]=t.getUint32(4*i);return r}},{key:"initTable",value:function(){var e=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],n=r[1],a=r[2],s=r[3],o=this.invSubMix,l=o[0],u=o[1],c=o[2],h=o[3],d=new Uint32Array(256),f=0,v=0,g=0;for(g=0;g<256;g++)d[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var p=v^v<<1^v<<2^v<<3^v<<4;p=p>>>8^255&p^99,e[f]=p,t[p]=f;var m=d[f],y=d[m],E=d[y],k=257*d[p]^16843008*p;i[f]=k<<24|k>>>8,n[f]=k<<16|k>>>16,a[f]=k<<8|k>>>24,s[f]=k,k=16843009*E^65537*y^257*m^16843008*f,l[p]=k<<24|k>>>8,u[p]=k<<16|k>>>16,c[p]=k<<8|k>>>24,h[p]=k,f?(f=m^d[d[d[E^m]]],v^=d[d[v]]):f=v=1}}},{key:"expandKey",value:function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i<t.length&&r;)r=t[i]===this.key[i],i++;if(!r){this.key=t;var n=this.keySize=t.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);var a,s,o,l,u=this.ksRows=4*(n+6+1),c=this.keySchedule=new Uint32Array(u),h=this.invKeySchedule=new Uint32Array(u),d=this.sBox,f=this.rcon,v=this.invSubMix,g=v[0],p=v[1],m=v[2],y=v[3];for(a=0;a<u;a++)a<n?o=c[a]=t[a]:(l=o,a%n==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[a/n|0]<<24):n>6&&a%n==4&&(l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l]),c[a]=o=(c[a-n]^l)>>>0);for(s=0;s<u;s++)a=u-s,l=3&s?c[a]:c[a-4],h[s]=s<4||a<=4?l:g[d[l>>>24]]^p[d[l>>>16&255]]^m[d[l>>>8&255]]^y[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 i,n,a,s,o,l,u,c,h,d,f,v,g,p,m=this.keySize+6,y=this.invKeySchedule,E=this.invSBox,k=this.invSubMix,T=k[0],S=k[1],A=k[2],L=k[3],b=this.uint8ArrayToUint32Array_(r),R=b[0],I=b[1],D=b[2],w=b[3],_=new Int32Array(e),P=new Int32Array(_.length),C=this.networkToHostOrderSwap;t<_.length;){for(h=C(_[t]),d=C(_[t+1]),f=C(_[t+2]),v=C(_[t+3]),o=h^y[0],l=v^y[1],u=f^y[2],c=d^y[3],g=4,p=1;p<m;p++)i=T[o>>>24]^S[l>>16&255]^A[u>>8&255]^L[255&c]^y[g],n=T[l>>>24]^S[u>>16&255]^A[c>>8&255]^L[255&o]^y[g+1],a=T[u>>>24]^S[c>>16&255]^A[o>>8&255]^L[255&l]^y[g+2],s=T[c>>>24]^S[o>>16&255]^A[l>>8&255]^L[255&u]^y[g+3],o=i,l=n,u=a,c=s,g+=4;i=E[o>>>24]<<24^E[l>>16&255]<<16^E[u>>8&255]<<8^E[255&c]^y[g],n=E[l>>>24]<<24^E[u>>16&255]<<16^E[c>>8&255]<<8^E[255&o]^y[g+1],a=E[u>>>24]<<24^E[c>>16&255]<<16^E[o>>8&255]<<8^E[255&l]^y[g+2],s=E[c>>>24]<<24^E[o>>16&255]<<16^E[l>>8&255]<<8^E[255&u]^y[g+3],P[t]=C(i^R),P[t+1]=C(s^I),P[t+2]=C(a^D),P[t+3]=C(n^w),R=h,I=d,D=f,w=v,t+=4}return P.buffer}}]),e}(),vt=function(){function e(t,r,i){qm(this,e),this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=t,this.key=r,this.aesMode=i}return Xm(e,[{key:"expandKey",value:function(){var e=function(e){switch(e){case ut:return"AES-CBC";case ct: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 gt(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 i=hy(r).call(r,"\0");return-1!==i?r.substring(0,i):r}return r.replace(/\0/g,"")}for(var n,a,s,o=e.length,l="",u=0;u<o;){if(0===(n=e[u++])&&t)return l;if(0!==n&&3!==n)switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(n);break;case 12:case 13:a=e[u++],l+=String.fromCharCode((31&n)<<6|63&a);break;case 14:a=e[u++],s=e[u++],l+=String.fromCharCode((15&n)<<12|(63&a)<<6|(63&s)<<0)}}return l}var pt=function(e){for(var t="",r=0;r<e.length;r++){var i=e[r].toString(16);i.length<2&&(i="0"+i),t+=i}return t};function mt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yt,Et,kt,Tt,St,At={exports:{}};yt=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,Et=/^(?=([^\/?#]*))\1([^]*)$/,kt=/(?:\/|^)\.(?=\/)/g,Tt=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,At.exports=St={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=Ek(e).call(e),!(t=Ek(t).call(t))){if(!r.alwaysNormalize)return e;var i=St.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=St.normalizePath(i.path),St.buildURLFromParts(i)}var n=St.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=St.normalizePath(n.path),St.buildURLFromParts(n)):t;var a=St.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var s=Et.exec(a.path);a.netLoc=s[1],a.path=s[2]}a.netLoc&&!a.path&&(a.path="/");var o={scheme:a.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(o.netLoc=a.netLoc,"/"!==n.path[0]))if(n.path){var l=a.path,u=l.substring(0,p_(l).call(l,"/")+1)+n.path;o.path=St.normalizePath(u)}else o.path=a.path,n.params||(o.params=a.params,n.query||(o.query=a.query));return null===o.path&&(o.path=r.alwaysNormalize?St.normalizePath(n.path):n.path),St.buildURLFromParts(o)},parseURL:function(e){var t=yt.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=b_(r=e.split("")).call(r).join("").replace(kt,"");e.length!==(e=e.replace(Tt,"")).length;)var r;return b_(t=e.split("")).call(t).join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};var Lt=At.exports,bt=Xm((function e(){qm(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}})),Rt="audio",It="video",Dt="audiovideo",wt=function(){function e(t){qm(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 Xm(e,[{key:"setByteRange",value:function(e,t){var r,i=e.split("@",2);r=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:Ck(i[1]),this._byteRange=[r,Ck(i[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=($h(e={},Rt,null),$h(e,It,null),$h(e,Dt,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 bt),this._stats},set:function(e){this._stats=e}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Lt.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}},{key:"clearElementaryStreamInfo",value:function(){var e=this.elementaryStreams;e[Rt]=null,e[It]=null,e[Dt]=null}}]),e}();function _t(e){return"initSegment"!==e.sn}var Pt=function(e){Ym(r,e);var t=Wm(r);function r(e,i){var n;return qm(this,r),(n=t.call(this,i))._decryptdata=null,n._programDateTime=null,n._ref=null,n._bitrate=void 0,n.rawProgramDateTime=null,n.tagList=[],n.duration=0,n.sn=0,n.levelkeys=void 0,n.type=void 0,n.loader=null,n.keyLoader=null,n.level=-1,n.cc=0,n.startPTS=void 0,n.endPTS=void 0,n.startDTS=void 0,n.endDTS=void 0,n.start=0,n.playlistOffset=0,n.deltaPTS=void 0,n.maxStartPTS=void 0,n.minEndPTS=void 0,n.data=void 0,n.bitrateTest=!1,n.title=null,n.initSegment=null,n.endList=void 0,n.gap=void 0,n.urlId=0,n.type=e,n}return Xm(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(_(t)&&_(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=Qm(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=_(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=Qm(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){_(e)?this._programDateTime=e:this._programDateTime=this.rawProgramDateTime=null}},{key:"ref",get:function(){return _t(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,i,n){var a=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,i),o.endDTS=Math.max(o.endDTS,n)):s[e]={startPTS:t,endPTS:r,startDTS:i,endDTS:n,partial:a}}}]),r}(wt),Ct=function(e){Ym(r,e);var t=Wm(r);function r(e,i,n,a,s){var o;qm(this,r),(o=t.call(this,n)).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=i,o.index=a;var l=e.enumeratedString("BYTERANGE");return l&&o.setByteRange(l,s),s&&(o.fragOffset=s.fragOffset+s.duration),o}return Xm(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}(wt),xt=Math.pow(2,32)-1,Mt=[].push,Ot={video:1,audio:2,id3:3,text:4};function Ft(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 Ut(e,t){var r=Gt(e,t);return r<0?4294967296+r:r}function Bt(e,t){var r=Ut(e,t);return r*=Math.pow(2,32),r+=Ut(e,t+4)}function Gt(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function Kt(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 Ht(e,t){var r=[];if(!t.length)return r;for(var i=e.byteLength,n=0;n<i;){var a=Ut(e,n),s=a>1?n+a:i;if(Ft(e.subarray(n+4,n+8))===t[0])if(1===t.length)r.push(e.subarray(n+8,s));else{var o=Ht(e.subarray(n+8,s),uy(t).call(t,1));o.length&&Mt.apply(r,o)}n=s}return r}function Vt(e){var t=[],r=e[0],i=8,n=Ut(e,i);i+=4;var a=0,s=0;0===r?(a=Ut(e,i),s=Ut(e,i+4),i+=8):(a=Bt(e,i),s=Bt(e,i+8),i+=16),i+=2;var o=e.length+s,l=Nt(e,i);i+=2;for(var u=0;u<l;u++){var c=i,h=Ut(e,c);c+=4;var d=2147483647&h;if(1==(2147483648&h)>>>31)return te.warn("SIDX has hierarchical references (not supported)"),null;var f=Ut(e,c);c+=4,t.push({referenceSize:d,subsegmentDuration:f,info:{duration:f/n,start:o,end:o+d-1}}),o+=d,i=c+=4}return{earliestPresentationTime:a,timescale:n,version:r,referencesCount:l,references:t}}function jt(e){for(var t,r=[],i=Ht(e,["moov","trak"]),n=0;n<i.length;n++){var a=i[n],s=Ht(a,["tkhd"])[0];if(s){var o=s[0],l=Ut(s,0===o?12:20),u=Ht(a,["mdia","mdhd"])[0];if(u){var c=Ut(u,0===(o=u[0])?12:20),h=Ht(a,["mdia","hdlr"])[0];if(h){var d=Ft(h.subarray(8,12)),f={soun:Rt,vide:It}[d];if(f){var v=Yt(Ht(a,["mdia","minf","stbl","stsd"])[0]);r[l]={timescale:c,type:f},r[f]=z({timescale:c,id:l},v)}}}}}return ey(t=Ht(e,["moov","mvex","trex"])).call(t,(function(e){var t=Ut(e,4),i=r[t];i&&(i.default={duration:Ut(e,12),flags:Ut(e,20)})})),r}function Yt(e){var t=e.subarray(8),r=t.subarray(86),i=Ft(t.subarray(4,8)),n=i,a="enca"===i||"encv"===i;if(a){var s,o=Ht(t,[i])[0];ey(s=Ht(o.subarray("enca"===i?28:78),["sinf"])).call(s,(function(e){var t=Ht(e,["schm"])[0];if(t){var r=Ft(t.subarray(4,8));if("cbcs"===r||"cenc"===r){var i=Ht(e,["frma"])[0];i&&(n=Ft(i))}}}))}switch(n){case"avc1":case"avc2":case"avc3":case"avc4":var l=Ht(r,["avcC"])[0];n+="."+qt(l[1])+qt(l[2])+qt(l[3]);break;case"mp4a":var u=Ht(t,[i])[0],c=Ht(u.subarray(28),["esds"])[0];if(c&&c.length>7){var h=4;if(3!==c[h++])break;h=Wt(c,h),h+=2;var d=c[h++];if(128&d&&(h+=2),64&d&&(h+=c[h++]),4!==c[h++])break;h=Wt(c,h);var f=c[h++];if(64!==f)break;if(n+="."+qt(f),h+=12,5!==c[h++])break;h=Wt(c,h);var v=c[h++],g=(248&v)>>3;31===g&&(g+=1+((7&v)<<3)+((224&c[h])>>5)),n+="."+g}break;case"hvc1":case"hev1":var p=Ht(r,["hvcC"])[0],m=p[1],y=["","A","B","C"][m>>6],E=31&m,k=Ut(p,2),T=(32&m)>>5?"H":"L",S=p[12],A=p.subarray(6,12);n+="."+y+E,n+="."+k.toString(16).toUpperCase(),n+="."+T+S;for(var L="",b=A.length;b--;){var R=A[b];(R||L)&&(L="."+R.toString(16).toUpperCase()+L)}n+=L;break;case"dvh1":case"dvhe":var I=Ht(r,["dvcC"])[0],D=I[2]>>1&127,w=I[2]<<5&32|I[3]>>3&31;n+="."+zt(D)+"."+zt(w);break;case"vp09":var _=Ht(r,["vpcC"])[0],P=_[4],C=_[5],x=_[6]>>4&15;n+="."+zt(P)+"."+zt(C)+"."+zt(x);break;case"av01":var M=Ht(r,["av1C"])[0],O=M[1]>>>5,F=31&M[1],N=M[2]>>>7?"H":"M",U=(64&M[2])>>6,B=(32&M[2])>>5,G=2===O&&U?B?12:10:U?10:8,K=(16&M[2])>>4,H=(8&M[2])>>3,V=(4&M[2])>>2,j=3&M[2],Y=1,W=1,q=1,z=0;n+="."+O+"."+zt(F)+N+"."+zt(G)+"."+K+"."+H+V+j+"."+zt(Y)+"."+zt(W)+"."+zt(q)+"."+z}return{codec:n,encrypted:a}}function Wt(e,t){for(var r=t+5;128&e[t++]&&t<r;);return t}function qt(e){var t;return uy(t="0"+e.toString(16).toUpperCase()).call(t,-2)}function zt(e){return(e<10?"0":"")+e}function Xt(e){var t=Ht(e,["schm"])[0];if(t){var r=Ft(t.subarray(4,8));if("cbcs"===r||"cenc"===r)return Ht(e,["schi","tenc"])[0]}return null}function Qt(e){var t=Ut(e,0),r=8;1&t&&(r+=4),4&t&&(r+=4);for(var i=0,n=Ut(e,4),a=0;a<n;a++)256&t&&(i+=Ut(e,r),r+=4),512&t&&(r+=4),1024&t&&(r+=4),2048&t&&(r+=4);return i}function $t(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,i=[],n=t.samples,a=t.timescale,s=t.id,o=!1;return Dy(r=Ht(n,["moof"])).call(r,(function(r){var l,u=r.byteOffset-8;Dy(l=Ht(r,["traf"])).call(l,(function(r){var l,c,h=Dy(l=Ht(r,["tfdt"])).call(l,(function(e){var t=e[0],r=Ut(e,4);return 1===t&&(r*=Math.pow(2,32),r+=Ut(e,8)),r/a}))[0];return void 0!==h&&(e=h),Dy(c=Ht(r,["tfhd"])).call(c,(function(l){var c,h=Ut(l,4),d=16777215&Ut(l,0),f=0,v=0!=(16&d),g=0,p=0!=(32&d),m=8;h===s&&(0!=(1&d)&&(m+=8),0!=(2&d)&&(m+=4),0!=(8&d)&&(f=Ut(l,m),m+=4),v&&(g=Ut(l,m),m+=4),p&&(m+=4),"video"===t.type&&(o=function(e){if(!e)return!1;var t=hy(e).call(e,"."),r=t<0?e:e.substring(0,t);return"hvc1"===r||"hev1"===r||"dvh1"===r||"dvhe"===r}(t.codec)),Dy(c=Ht(r,["trun"])).call(c,(function(r){var s=r[0],l=16777215&Ut(r,0),c=0!=(1&l),h=0,d=0!=(4&l),v=0!=(256&l),p=0,m=0!=(512&l),y=0,E=0!=(1024&l),k=0!=(2048&l),T=0,S=Ut(r,4),A=8;c&&(h=Ut(r,A),A+=4),d&&(A+=4);for(var L=h+u,b=0;b<S;b++){if(v?(p=Ut(r,A),A+=4):p=f,m?(y=Ut(r,A),A+=4):y=g,E&&(A+=4),k&&(T=0===s?Ut(r,A):Gt(r,A),A+=4),t.type===It)for(var R=0;R<y;){var I=Ut(n,L);Zt(o,n[L+=4])&&er(n.subarray(L,L+I),o?2:1,e+T/a,i),L+=I,R+=I+4}e+=p/a}})))}))}))})),i}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,i){var n=tr(e),a=0;a+=t;for(var s=0,o=0,l=0;a<n.length;){s=0;do{if(a>=n.length)break;s+=l=n[a++]}while(255===l);o=0;do{if(a>=n.length)break;o+=l=n[a++]}while(255===l);var u=n.length-a,c=a;if(o<u)a+=o;else if(o>u){var h;te.error(py(h="Malformed SEI payload. ".concat(o," is too small, only ")).call(h,u," bytes left to parse."));break}if(4===s){if(181===n[c++]){var d=Nt(n,c);if(c+=2,49===d){var f=Ut(n,c);if(c+=4,1195456820===f){var v=n[c++];if(3===v){var g=n[c++],p=64&g,m=p?2+3*(31&g):0,y=new Uint8Array(m);if(p){y[0]=g;for(var E=1;E<m;E++)y[E]=n[c++]}i.push({type:v,payloadType:s,pts:r,bytes:y})}}}}}else if(5===s&&o>16){for(var k=[],T=0;T<16;T++){var S=n[c++].toString(16);k.push(1==S.length?"0"+S:S),3!==T&&5!==T&&7!==T&&9!==T||k.push("-")}for(var A=o-16,L=new Uint8Array(A),b=0;b<A;b++)L[b]=n[c++];i.push({payloadType:s,pts:r,uuid:k.join(""),userData:gt(L),userDataBytes:L})}}}function tr(e){for(var t=e.byteLength,r=[],i=1;i<t-2;)0===e[i]&&0===e[i+1]&&3===e[i+2]?(r.push(i+2),i+=2):i++;if(0===r.length)return e;var n=t-r.length,a=new Uint8Array(n),s=0;for(i=0;i<n;s++,i++)s===r[0]&&(s++,r.shift()),a[i]=e[s];return a}function rr(e,t,r){if(16!==e.byteLength)throw new RangeError("Invalid system id");var i,n;i=new Uint8Array,n=new Uint8Array;var a=new Uint8Array(4);return r&&r.byteLength>0&&new DataView(a.buffer).setUint32(0,r.byteLength,!1),function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var n=r.length,a=8,s=n;s--;)a+=r[s].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),s=0,a=8;s<n;s++)o.set(r[s],a),a+=r[s].byteLength;return o}([112,115,115,104],new Uint8Array([0,0,0,0]),e,n,i,a,r||new Uint8Array)}function ir(e){var t=e.getUint32(0),r=e.byteOffset,i=e.byteLength;if(i<t)return{offset:r,size:i};if(1886614376!==e.getUint32(4))return{offset:r,size:t};var n=e.getUint32(8)>>>24;if(0!==n&&1!==n)return{offset:r,size:t};var a=e.buffer,s=pt(new Uint8Array(a,r+12,16)),o=e.getUint32(28),l=null,u=null;if(0===n){if(t-32<o||o<22)return{offset:r,size:t};u=new Uint8Array(a,r+32,o)}else if(1===n){if(!o||i<r+32+16*o+16)return{offset:r,size:t};l=[];for(var c=0;c<o;c++)l.push(new Uint8Array(a,r+32+16*c,16))}return{version:n,systemId:s,kids:l,data:u,offset:r,size:t}}var nr=function(){function e(t){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).removePKCS7Padding,i=void 0===r||r;if(qm(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=i,i)try{var n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(a){}this.useSoftware=!this.subtle}return Xm(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,i,n,a=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(i=(r=a).byteLength,(n=i&&new DataView(r.buffer).getUint8(i-1))?dt(r,0,i-n):r):a}},{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,i){var n=this;return this.useSoftware?new RR((function(a,s){var o=ArrayBuffer.isView(e)?e:new Uint8Array(e);n.softwareDecrypt(o,t,r,i);var l=n.flush();l?a(l.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(e),t,r,i)}},{key:"softwareDecrypt",value:function(e,t,r,i){var n=this.currentIV,a=this.currentResult,s=this.remainderData;if(i!==ut||16!==t.byteLength)return te.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),s&&(e=$t(s,e),this.remainderData=null);var o=this.getValidChunk(e);if(!o.length)return null;n&&(r=n);var l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new ft),l.expandKey(t);var u=a;return this.currentResult=l.decrypt(o.buffer,0,r),this.currentIV=dt(o,-16).buffer,u||null}},{key:"webCryptoDecrypt",value:function(e,t,r,i){var n=this;if(this.key!==t||!this.fastAesKey){if(!this.subtle)return RR.resolve(this.onWebCryptoError(e,t,r,i));this.key=t,this.fastAesKey=new vt(this.subtle,t,i)}return this.fastAesKey.expandKey().then((function(t){return n.subtle?(n.logOnce("WebCrypto AES decrypt"),new ht(n.subtle,new Uint8Array(r),i).decrypt(e.buffer,t)):RR.reject(new Error("web crypto not initialized"))})).catch((function(a){var s;return te.warn(py(s="[decrypter]: WebCrypto Error, disable WebCrypto API, ".concat(a.name,": ")).call(s,a.message)),n.onWebCryptoError(e,t,r,i)}))}},{key:"onWebCryptoError",value:function(e,t,r,i){var n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,r,i);var a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(n?" 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}(),ar=Math.pow(2,17),sr=function(){function e(t){qm(this,e),this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}return Xm(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,i=e.url;if(!i)return RR.reject(new ur({type:x.NETWORK_ERROR,details:M.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(i?"part list":"url")),networkDetails:null}));this.abort();var n=this.config,a=n.fLoader,s=n.loader;return new RR((function(o,l){if(r.loader&&r.loader.destroy(),e.gap){var u;if(Sy(u=e.tagList).call(u,(function(e){return"GAP"===e[0]})))return void l(lr(e));e.gap=!1}var c=r.loader=a?new a(n):new s(n),h=or(e);e.loader=c;var d=We(n.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:ar};e.stats=c.stats;var v={onSuccess:function(t,i,n,a){r.resetLoader(e,c);var s=t.data;n.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(uy(s).call(s,0,16)),s=uy(s).call(s,16)),o({frag:e,part:null,payload:s,networkDetails:a})},onError:function(t,n,a,s){var o;r.resetLoader(e,c),l(new ur({type:x.NETWORK_ERROR,details:M.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:z({url:i,data:void 0},t),error:new Error(py(o="HTTP Error ".concat(t.code," ")).call(o,t.text)),networkDetails:a,stats:s}))},onAbort:function(t,i,n){r.resetLoader(e,c),l(new ur({type:x.NETWORK_ERROR,details:M.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:n,stats:t}))},onTimeout:function(t,i,n){r.resetLoader(e,c),l(new ur({type:x.NETWORK_ERROR,details:M.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after ".concat(f.timeout,"ms")),networkDetails:n,stats:t}))}};t&&(v.onProgress=function(r,i,n,a){return t({frag:e,part:null,payload:n,networkDetails:a})}),c.load(h,f,v)}))}},{key:"loadPart",value:function(e,t,r){var i=this;this.abort();var n=this.config,a=n.fLoader,s=n.loader;return new RR((function(o,l){if(i.loader&&i.loader.destroy(),e.gap||t.gap)l(lr(e,t));else{var u=i.loader=a?new a(n):new s(n),c=or(e,t);e.loader=u;var h=We(n.fragLoadPolicy.default),d={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:ar};t.stats=u.stats,u.load(c,d,{onSuccess:function(n,a,s,l){i.resetLoader(e,u),i.updateStatsFromPart(e,t);var c={frag:e,part:t,payload:n.data,networkDetails:l};r(c),o(c)},onError:function(r,n,a,s){var o;i.resetLoader(e,u),l(new ur({type:x.NETWORK_ERROR,details:M.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:z({url:c.url,data:void 0},r),error:new Error(py(o="HTTP Error ".concat(r.code," ")).call(o,r.text)),networkDetails:a,stats:s}))},onAbort:function(r,n,a){e.stats.aborted=t.stats.aborted,i.resetLoader(e,u),l(new ur({type:x.NETWORK_ERROR,details:M.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:a,stats:r}))},onTimeout:function(r,n,a){i.resetLoader(e,u),l(new ur({type:x.NETWORK_ERROR,details:M.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after ".concat(d.timeout,"ms")),networkDetails:a,stats:r}))}})}}))}},{key:"updateStatsFromPart",value:function(e,t){var r=e.stats,i=t.stats,n=i.total;if(r.loaded+=i.loaded,n){var a=Math.round(e.duration/t.duration),s=Math.min(Math.round(r.loaded/n),a),o=(a-s)*Math.round(r.loaded/s);r.total=r.loaded+o}else r.total=Math.max(r.loaded,r.total);var l=r.loading,u=i.loading;l.start?l.first+=u.first-u.start:(l.start=u.start,l.first=u.first),l.end=u.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,i=r||e,n={frag:e,part:r,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},a=i.byteRangeStartOffset,s=i.byteRangeEndOffset;if(_(a)&&_(s)){var o,l=a,u=s;if("initSegment"===e.sn&&("AES-128"===(t=null==(o=e.decryptdata)?void 0:o.method)||"AES-256"===t)){var c=s-a;c%16&&(u=s+(16-c%16)),0!==a&&(n.resetIV=!0,l=a-16)}n.rangeStart=l,n.rangeEnd=u}return n}function lr(e,t){var r=new Error("GAP ".concat(e.gap?"tag":"attribute"," found")),i={type:x.MEDIA_ERROR,details:M.FRAG_GAP,fatal:!1,frag:e,error:r,networkDetails:null};return t&&(i.part=t),(t||e).stats.aborted=!0,new ur(i)}var ur=function(e){Ym(r,e);var t=Wm(r);function r(e){var i;return qm(this,r),(i=t.call(this,e.error.message)).data=void 0,i.data=e,i}return Xm(r)}(jm(Error)),cr=function(e){Ym(r,e);var t=Wm(r);function r(e,i){var n,a;return qm(this,r),(a=t.call(this,e,i))._boundTick=void 0,a._tickTimer=null,a._tickInterval=null,a._tickCallCount=0,a._boundTick=pE(n=a.tick).call(n,$f(a)),a}return Xm(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=gE(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=mE(this._boundTick,0)}},{key:"doTick",value:function(){}}]),r}(X),hr=Xm((function e(t,r,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];qm(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=i,this.size=n,this.part=a,this.partial=s})),dr={length:0,start:function(){return 0},end:function(){return 0}},fr=function(){function e(){qm(this,e)}return Xm(e,null,[{key:"isBuffered",value:function(t,r){if(t)for(var i=e.getBuffered(t),n=i.length;n--;)if(r>=i.start(n)&&r<=i.end(n))return!0;return!1}},{key:"bufferInfo",value:function(t,r,i){if(t){var n=e.getBuffered(t);if(n.length){for(var a=[],s=0;s<n.length;s++)a.push({start:n.start(s),end:n.end(s)});return e.bufferedInfo(a,r,i)}}return{len:0,start:r,end:r,nextStart:void 0}}},{key:"bufferedInfo",value:function(e,t,r){t=Math.max(0,t),gT(e).call(e,(function(e,t){return e.start-t.start||t.end-e.end}));var i=[];if(r)for(var n=0;n<e.length;n++){var a=i.length;if(a){var s=i[a-1].end;e[n].start-s<r?e[n].end>s&&(i[a-1].end=e[n].end):i.push(e[n])}else i.push(e[n])}else i=e;for(var o,l=0,u=t,c=t,h=0;h<i.length;h++){var d=i[h].start,f=i[h].end;if(t+r>=d&&t<f)u=d,l=(c=f)-t;else if(t+r<d){o=d;break}}return{len:l,start:u||0,end:c||0,nextStart:o}}},{key:"getBuffered",value:function(e){try{return e.buffered||dr}catch(t){return te.log("failed to get media.buffered",t),dr}}}]),e}(),vr=/\{\$([a-zA-Z0-9-_]+)\}/g;function gr(e){return vr.test(e)}function pr(e,t){if(null!==e.variableList||e.hasVariableRefs){var r=e.variableList;return t.replace(vr,(function(t){var i=t.substring(2,t.length-1),n=null==r?void 0:r[i];return void 0===n?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'.concat(i,'"'))),t):n}))}return t}function mr(e,t,r){var i,n,a=e.variableList;if(a||(e.variableList=a={}),"QUERYPARAM"in t){i=t.QUERYPARAM;try{var s,o=new e_(r).searchParams;if(!o.has(i))throw new Error(py(s='"'.concat(i,'" does not match any query parameter in URI: "')).call(s,r,'"'));n=o.get(i)}catch(l){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: ".concat(l.message)))}}else i=t.NAME,n=t.VALUE;i in a?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'.concat(i,'"'))):a[i]=n||""}function yr(e,t,r){var i=t.IMPORT;if(r&&i in r){var n=e.variableList;n||(e.variableList=n={}),n[i]=r[i]}else e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'.concat(i,'"')))}var Er=/^(\d+)x(\d+)$/,kr=/(.+?)=(".*?"|.*?)(?:,|$)/g,Tr=function(){function e(t,r){qm(this,e),"string"==typeof t&&(t=e.parseAttrList(t,r)),W(this,t)}return Xm(e,[{key:"clientAttrs",get:function(){var e;return Jm(e=Qm(this)).call(e,(function(e){return"X-"===e.substring(0,2)}))}},{key:"decimalInteger",value:function(e){var t=Ck(this[e],10);return t>bT?1/0:t}},{key:"hexadecimalInteger",value:function(e){if(this[e]){var t,r=uy(t=this[e]||"0x").call(t,2);r=(1&r.length?"0":"")+r;for(var i=new Uint8Array(r.length/2),n=0;n<r.length/2;n++)i[n]=Ck(uy(r).call(r,2*n,2*n+2),16);return i}return null}},{key:"hexadecimalIntegerAsNumber",value:function(e){var t=Ck(this[e],16);return t>bT?1/0:t}},{key:"decimalFloatingPoint",value:function(e){return ck(this[e])}},{key:"optionalFloat",value:function(e,t){var r=this[e];return r?ck(r):t}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"enumeratedStringList",value:function(e,t){var r,i=this[e];return eS(r=i?i.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=Er.exec(this[e]);if(null!==t)return{width:Ck(t[1],10),height:Ck(t[2],10)}}}],[{key:"parseAttrList",value:function(e,t){var r,i,n={};for(kr.lastIndex=0;null!==(i=kr.exec(e));){var a,s=Ek(a=i[1]).call(a),o=i[2],l=0===hy(o).call(o,'"')&&p_(o).call(o,'"')===o.length-1,u=!1;if(l)o=uy(o).call(o,1,-1);else switch(s){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(l||u))o=pr(t,o);else if(!u&&!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(py(r="".concat(e,": attribute ")).call(r,s," is missing quotes"))}n[s]=o}return n}}]),e}();function Sr(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e||"SCTE35-CMD"===e}var Ar=function(){function e(t,r){var i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(qm(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!=(i=null==r?void 0:r.tagOrder)?i:n,r){var a=r.attr;for(var s in a)if(Object.prototype.hasOwnProperty.call(t,s)&&t[s]!==a[s]){var o;te.warn(py(o='DATERANGE tag attribute: "'.concat(s,'" does not match for tags with ID: "')).call(o,t.ID,'"')),this._badValueForSameId=s;break}t=W(new Tr({}),a,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"]);_(l.getTime())&&(this._endDate=l)}}return Xm(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(py(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(_(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&&_(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}(),Lr=function(){function e(t){qm(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 Xm(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&&_(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(w_()-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 br(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function Rr(e){switch(e){case"AES-128":case"AES-256":return ut;case"AES-256-CTR":return ct;default:throw new Error("invalid full segment method ".concat(e))}}function Ir(e){return Uint8Array.from(atob(e),(function(e){return e.charCodeAt(0)}))}function Dr(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(function(e){return e.charCodeAt(0)}))}function wr(e){var t,r,i=e.split(":"),n=null;if("data"===i[0]&&2===i.length){var a=i[1].split(";"),s=a[a.length-1].split(",");if(2===s.length){var o="base64"===s[0],l=s[1];o?(UE(a).call(a,-1,1),n=Ir(l)):(t=Dr(l).subarray(0,16),(r=new Uint8Array(16)).set(t,16-t.length),n=r)}}return n}var _r="undefined"!=typeof self?self:void 0,Pr={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Cr="org.w3.clearkey",xr="com.apple.streamingkeydelivery",Mr="com.microsoft.playready",Or="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Fr(e){switch(e){case xr:return Pr.FAIRPLAY;case Mr:return Pr.PLAYREADY;case Or:return Pr.WIDEVINE;case Cr:return Pr.CLEARKEY}}var Nr="1077efecc0b24d02ace33c1e52e2fb4b",Ur="e2719d58a985b3c9781ab030af78d30e",Br="9a04f07998404286ab92e65be0885f95",Gr="edef8ba979d64acea3c827dcd51d21ed";function Kr(e){return e===Gr?Pr.WIDEVINE:e===Br?Pr.PLAYREADY:e===Nr||e===Ur?Pr.CLEARKEY:void 0}function Hr(e){switch(e){case Pr.FAIRPLAY:return xr;case Pr.PLAYREADY:return Mr;case Pr.WIDEVINE:return Or;case Pr.CLEARKEY:return Cr}}function Vr(e){var t,r=e.drmSystems,i=e.widevineLicenseUrl,n=r?Jm(t=[Pr.FAIRPLAY,Pr.WIDEVINE,Pr.PLAYREADY,Pr.CLEARKEY]).call(t,(function(e){return!!r[e]})):[];return!n[Pr.WIDEVINE]&&i&&n.push(Pr.WIDEVINE),n}var jr,Yr=null!=_r&&null!=(jr=_r.navigator)&&jr.requestMediaKeySystemAccess?pE(r=self.navigator.requestMediaKeySystemAccess).call(r,self.navigator):null;function Wr(e){var t,r,i=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=String.fromCharCode.apply(null,ly(i)),a=n.substring(hy(n).call(n,"<"),n.length),s=(new DOMParser).parseFromString(a,"text/xml").getElementsByTagName("KID")[0];if(s){var o=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(o){var l=Ir(o).subarray(0,16);return(r=function(e,t,r){var i=e[t];e[t]=e[r],e[r]=i})(t=l,0,3),r(t,1,2),r(t,4,5),r(t,6,7),l}}return null}var qr={},zr=function(){function e(t,r,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;qm(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=i,this.keyFormatVersions=n,this.iv=a,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&!br(t)}return Xm(e,[{key:"isSupported",value:function(){var e;if(this.method){if(br(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case xr:case Or:case Mr:case Cr:return-1!==hy(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(br(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 i=wr(this.uri);if(i)switch(this.keyFormat){case Or:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case Mr:var n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=rr(n,0,i),this.keyId=Wr(i);break;default:var a=i.subarray(0,16);if(16!==a.length){var s=new Uint8Array(16);s.set(a,16-a.length),a=s}this.keyId=a}if(!this.keyId||16!==this.keyId.byteLength){var o=qr[this.uri];if(!o){var l=Qm(qr).length%bT;o=new Uint8Array(16),new DataView(o.buffer,12,4).setUint32(0,l),qr[this.uri]=o}this.keyId=o}return this}}],[{key:"clearKeyUriToKeyIdMap",value:function(){qr={}}}]),e}(),Xr=/#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,Qr=/#EXT-X-MEDIA:(.*)/g,$r=/^#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("|")),ei=function(){function e(){qm(this,e)}return Xm(e,null,[{key:"findGroup",value:function(e,t){for(var r=0;r<e.length;r++){var i=e[r];if(i.id===t)return i}}},{key:"resolve",value:function(e,t){return Lt.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}},{key:"isMediaPlaylist",value:function(e){return $r.test(e)}},{key:"parseMasterPlaylist",value:function(t,r){var i,n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:gr(t)},a=[];for(Xr.lastIndex=0;null!=(i=Xr.exec(t));)if(i[1]){var s,o=new Tr(i[1],n),l=pr(n,i[2]),u={attrs:o,bitrate:o.decimalInteger("BANDWIDTH")||o.decimalInteger("AVERAGE-BANDWIDTH"),name:o.NAME,url:e.resolve(l,r)},c=o.decimalResolution("RESOLUTION");c&&(u.width=c.width,u.height=c.height),ai(o.CODECS,u),null!=(s=u.unknownCodecs)&&s.length||a.push(u),n.levels.push(u)}else if(i[3]){var h=i[3],d=i[4];switch(h){case"SESSION-DATA":var f=new Tr(d,n),v=f["DATA-ID"];v&&(null===n.sessionData&&(n.sessionData={}),n.sessionData[v]=f);break;case"SESSION-KEY":var g=ii(d,r,n);g.encrypted&&g.isSupported()?(null===n.sessionKeys&&(n.sessionKeys=[]),n.sessionKeys.push(g)):te.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'.concat(d,'"'));break;case"DEFINE":mr(n,new Tr(d,n),r);break;case"CONTENT-STEERING":var p=new Tr(d,n);n.contentSteering={uri:e.resolve(p["SERVER-URI"],r),pathwayId:p["PATHWAY-ID"]||"."};break;case"START":n.startTimeOffset=ni(d)}}var m=a.length>0&&a.length<n.levels.length;return n.levels=m?a:n.levels,0===n.levels.length&&(n.playlistParsingError=new Error("no levels found in manifest")),n}},{key:"parseMasterPlaylistMedia",value:function(t,r,i){var n,a={},s=i.levels,o={AUDIO:Dy(s).call(s,(function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),SUBTITLES:Dy(s).call(s,(function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),"CLOSED-CAPTIONS":[]},l=0;for(Qr.lastIndex=0;null!==(n=Qr.exec(t));){var u=new Tr(n[1],i),c=u.TYPE;if(c){var h=o[c],d=a[c]||[];a[c]=d;var f=u.LANGUAGE,v=u["ASSOC-LANGUAGE"],g=u.CHANNELS,p=u.CHARACTERISTICS,m=u["INSTREAM-ID"],y={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",name:u.NAME||f||"",type:c,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:f,url:u.URI?e.resolve(u.URI,r):""};if(v&&(y.assocLang=v),g&&(y.channels=g),p&&(y.characteristics=p),m&&(y.instreamId=m),null!=h&&h.length){var E=e.findGroup(h,y.groupId)||h[0];si(y,E,"audioCodec"),si(y,E,"textCodec")}d.push(y)}}return a}},{key:"parseLevelPlaylist",value:function(e,t,r,i,n,a){var s,o,l,u={url:t},c=new Lr(t),h=c.fragments,d=[],f=null,v=0,g=0,p=0,m=0,y=0,E=null,k=new Pt(i,u),T=-1,S=!1,A=null;for(Jr.lastIndex=0,c.m3u8=e,c.hasVariableRefs=gr(e);null!==(s=Jr.exec(e));){S&&(S=!1,(k=new Pt(i,u)).playlistOffset=p,k.start=p,k.sn=v,k.cc=m,y&&(k.bitrate=y),k.level=r,f&&(k.initSegment=f,f.rawProgramDateTime&&(k.rawProgramDateTime=f.rawProgramDateTime,f.rawProgramDateTime=null),A&&(k.setByteRange(A),A=null)));var L=s[1];if(L){var b;k.duration=ck(L);var R=uy(b=" "+s[2]).call(b,1);k.title=R||null,k.tagList.push(R?["INF",L,R]:["INF",L])}else if(s[3]){if(_(k.duration)){var I;k.playlistOffset=p,k.start=p,l&&ui(k,l,c),k.sn=v,k.level=r,k.cc=m,h.push(k);var D=uy(I=" "+s[3]).call(I,1);k.relurl=pr(c,D),oi(k,E,d),E=k,p+=k.duration,v++,g=0,S=!0}}else{var w,P,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 x=uy(w=" "+s[o]).call(w,1),M=uy(P=" "+s[o+1]).call(P,1),O=s[o+2]?uy(C=" "+s[o+2]).call(C,1):null;switch(x){case"BYTERANGE":E?k.setByteRange(M,E):k.setByteRange(M);break;case"PROGRAM-DATE-TIME":k.rawProgramDateTime=M,k.tagList.push(["PROGRAM-DATE-TIME",M]),-1===T&&(T=h.length);break;case"PLAYLIST-TYPE":c.type=M.toUpperCase();break;case"MEDIA-SEQUENCE":v=c.startSN=Ck(M);break;case"SKIP":var F;c.skippedSegments&&(c.playlistParsingError=new Error("#EXT-X-SKIP MUST NOT appear more than once in a Playlist"));var N=new Tr(M,c),U=N.decimalInteger("SKIPPED-SEGMENTS");if(_(U)){c.skippedSegments+=U;for(var B=U;B--;)h.push(null);v+=U}var G=N.enumeratedString("RECENTLY-REMOVED-DATERANGES");G&&(c.recentlyRemovedDateranges=py(F=c.recentlyRemovedDateranges||[]).call(F,G.split("\t")));break;case"TARGETDURATION":c.targetduration=Math.max(Ck(M),1);break;case"VERSION":c.version=Ck(M);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":c.live=!1;break;case"#":(M||O)&&k.tagList.push(O?[M,O]:[M]);break;case"DISCONTINUITY":m++,k.tagList.push(["DIS"]);break;case"GAP":k.gap=!0,k.tagList.push([x]);break;case"BITRATE":k.tagList.push([x,M]),y=1e3*Ck(M),_(y)?k.bitrate=y:y=0;break;case"DATERANGE":var K=new Tr(M,c),H=new Ar(K,c.dateRanges[K.ID],c.dateRangeTagCount);c.dateRangeTagCount++,H.isValid||c.skippedSegments?c.dateRanges[H.id]=H:te.warn('Ignoring invalid DATERANGE tag: "'.concat(M,'"')),k.tagList.push(["EXT-X-DATERANGE",M]);break;case"DEFINE":var V=new Tr(M,c);"IMPORT"in V?yr(c,V,a):mr(c,V,t);break;case"DISCONTINUITY-SEQUENCE":c.startCC=m=Ck(M);break;case"KEY":var j=ii(M,t,c);if(j.isSupported()){if("NONE"===j.method){l=void 0;break}l||(l={}),l[j.keyFormat]&&(l=W({},l)),l[j.keyFormat]=j}else te.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'.concat(M,'"'));break;case"START":c.startTimeOffset=ni(M);break;case"MAP":var Y=new Tr(M,c);if(k.duration){var q=new Pt(i,u);li(q,Y,r,l),f=q,k.initSegment=f,f.rawProgramDateTime&&!k.rawProgramDateTime&&(k.rawProgramDateTime=f.rawProgramDateTime)}else{var z=k.byteRangeEndOffset;if(z){var X,Q=k.byteRangeStartOffset;A=py(X="".concat(z-Q,"@")).call(X,Q)}else A=null;li(k,Y,r,l),f=k,S=!0}f.cc=m;break;case"SERVER-CONTROL":var $=new Tr(M);c.canBlockReload=$.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=$.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&$.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=$.optionalFloat("PART-HOLD-BACK",0),c.holdBack=$.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var J=new Tr(M);c.partTarget=J.decimalFloatingPoint("PART-TARGET");break;case"PART":var Z=c.partList;Z||(Z=c.partList=[]);var ee=g>0?Z[Z.length-1]:void 0,re=g++,ie=new Tr(M,c),ne=new Ct(ie,k,u,re,ee);Z.push(ne),k.duration+=ne.duration;break;case"PRELOAD-HINT":var ae=new Tr(M,c);c.preloadHint=ae;break;case"RENDITION-REPORT":var se=new Tr(M,c);c.renditionReports=c.renditionReports||[],c.renditionReports.push(se);break;default:te.warn("line parsed but not handled: ".concat(s))}}}E&&!E.relurl?(h.pop(),p-=E.duration,c.partList&&(c.fragmentHint=E)):c.partList&&(oi(k,E,d),k.cc=m,c.fragmentHint=k,l&&ui(k,l,c));var oe=h.length,le=h[0],ue=h[oe-1];if((p+=c.skippedSegments*c.targetduration)>0&&oe&&ue){c.averagetargetduration=p/oe;var ce=ue.sn;c.endSN="initSegment"!==ce?ce:0,c.live||(ue.endList=!0),le&&!c.startCC&&(c.startCC=le.cc),T>0&&(function(e,t){for(var r=e[t],i=t;i--;){var n=e[i];if(!n)return;n.programDateTime=r.programDateTime-1e3*n.duration,r=n}}(h,T),le&&d.unshift(le))}else c.endSN=0,c.startCC=0;return c.fragmentHint&&(p+=c.fragmentHint.duration),c.totalduration=p,d.length&&c.dateRangeTagCount&&le&&ti(d,c),c.endCC=m,c}}]),e}();function ti(e,t){for(var r=e.length,i=e[r-1],n=t.live?1/0:t.totalduration,a=Qm(t.dateRanges),s=a.length;s--;){var o=t.dateRanges[a[s]],l=o.startDate.getTime();o.tagAnchor=i.ref;for(var u=r;u--;){var c=ri(t,l,e,u,n);if(-1!==c){o.tagAnchor=t.fragments[c].ref;break}}}}function ri(e,t,r,i,n){var a=r[i];if(a){var s,o=a.programDateTime;if((t>=o||0===i)&&t<=o+1e3*(((null==(s=r[i+1])?void 0:s.start)||n)-a.start)){var l=r[i].sn-e.startSN,u=e.fragments;if(u.length>r.length)for(var c=(r[i+1]||u[u.length-1]).sn-e.startSN;c>l;c--){var h=u[c].programDateTime;if(t>=h&&t<h+1e3*u[c].duration)return c}return l}}return-1}function ii(e,t,r){var i,n,a,s,o=new Tr(e,r),l=null!=(a=o.METHOD)?a:"",u=o.URI,c=o.hexadecimalInteger("IV"),h=o.KEYFORMATVERSIONS,d=null!=(s=o.KEYFORMAT)?s:"identity";u&&o.IV&&!c&&te.error("Invalid IV: ".concat(o.IV));var f=u?ei.resolve(u,t):"",v=Jm(i=Dy(n=(h||"1").split("/")).call(n,Number)).call(i,mT);return new zr(l,f,d,v,c)}function ni(e){var t=new Tr(e).decimalFloatingPoint("TIME-OFFSET");return _(t)?t:null}function ai(e,t){var r,i,n=Jm(r=(e||"").split(/[ ,]+/)).call(r,(function(e){return e}));ey(i=["video","audio","text"]).call(i,(function(e){var r=Jm(n).call(n,(function(t){return r=t,!!(i=ne[e])&&!!i[uy(r).call(r,0,4)];var r,i}));r.length&&(t["".concat(e,"Codec")]=r.join(","),n=Jm(n).call(n,(function(e){return-1===hy(r).call(r,e)})))})),t.unknownCodecs=n}function si(e,t,r){var i=t[r];i&&(e[r]=i)}function oi(e,t,r){e.rawProgramDateTime?r.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function li(e,t,r,i){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=r,e.sn="initSegment",i&&(e.levelkeys=i),e.initSegment=null}function ui(e,t,r){var i;e.levelkeys=t;var n=r.encryptedFragments;n.length&&n[n.length-1].levelkeys===t||!Sy(i=Qm(t)).call(i,(function(e){return t[e].isCommonEncryption}))||n.push(e)}function ci(e,t){var r=t.startPTS;if(_(r)){var i,n=0;t.sn>e.sn?(n=r-e.start,i=e):(n=e.start-r,i=t),i.duration!==n&&i.setDuration(n)}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 hi(e,t,r,i,n,a){i-r<=0&&(te.warn("Fragment should have a positive duration",t),i=r+t.duration,a=n+t.duration);var s=r,o=i,l=t.startPTS,u=t.endPTS;if(_(l)){var c=Math.abs(l-r);_(t.deltaPTS)?t.deltaPTS=Math.max(c,t.deltaPTS):t.deltaPTS=c,s=Math.max(r,l),r=Math.min(r,l),n=Math.min(n,t.startDTS),o=Math.min(i,u),i=Math.max(i,u),a=Math.max(a,t.endDTS)}var h=r-t.start;0!==t.start&&t.setStart(r),t.setDuration(i-t.start),t.startPTS=r,t.maxStartPTS=s,t.startDTS=n,t.endPTS=i,t.minEndPTS=o,t.endDTS=a;var d,f=t.sn;if(!e||f<e.startSN||f>e.endSN)return 0;var v=f-e.startSN,g=e.fragments;for(g[v]=t,d=v;d>0;d--)ci(g[d],g[d-1]);for(d=v;d<g.length-1;d++)ci(g[d],g[d+1]);return e.fragmentHint&&ci(g[g.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,h}function di(e,t){for(var r,i,n=null,a=e.fragments,s=a.length-1;s>=0;s--){var o=a[s].initSegment;if(o){n=o;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var l,u=0;!function(e,t,r,i,n){for(var a=t.skippedSegments,s=Math.max(e.startSN,t.startSN)-t.startSN,o=(e.fragmentHint?1:0)+(a?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,l=t.startSN-e.startSN,u=t.fragmentHint?py(i=t.fragments).call(i,t.fragmentHint):t.fragments,c=e.fragmentHint?py(n=e.fragments).call(n,e.fragmentHint):e.fragments,h=s;h<=o;h++){var d=c[l+h],f=u[h];a&&!f&&d&&(f=t.fragments[h]=d),d&&f&&r(d,f)}}(e,t,(function(e,r){e.relurl&&(u=e.cc-r.cc),_(e.startPTS)&&_(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,n=e.initSegment)}));var c=t.fragmentHint?py(r=t.fragments).call(r,t.fragmentHint):t.fragments;if(n&&ey(c).call(c,(function(e){var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=n)?void 0:t.relurl)||(e.initSegment=n)})),t.skippedSegments)if(t.deltaUpdateFailed=Sy(i=t.fragments).call(i,(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 i=t.dateRanges,n=t.recentlyRemovedDateranges,a=W({},e);n&&ey(n).call(n,(function(e){delete a[e]}));var s=Qm(a).length;return s&&ey(r=Qm(i)).call(r,(function(e){var t=a[e],r=new Ar(i[e].attr,t);r.isValid?(a[e]=r,t||(r.tagOrder+=s)):te.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'.concat(x_(i[e].attr),'"'))})),a}(e.dateRanges,t));var f=Jm(d=e.fragments).call(d,(function(e){return e.rawProgramDateTime}));if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(var v=1;v<c.length;v++)null===c[v].programDateTime&&oi(c[v],c[v-1],f);ti(f,t)}var g=t.fragments;if(u){te.warn("discontinuity sliding from playlist, take drift into account");for(var p=0;p<g.length;p++)g[p].cc+=u}t.skippedSegments&&(t.startCC=t.fragments[0].cc),function(e,t,r){if(e&&t)for(var i=0,n=0,a=e.length;n<=a;n++){var s=e[n],o=t[n+i];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?r(s,o):i--}}(e.partList,t.partList,(function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),l?hi(t,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS):fi(e,t),g.length&&(t.totalduration=t.edge-g[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;var m=t.advancedDateTime;if(t.advanced&&m){var y=t.edge;t.driftStart||(t.driftStartTime=m,t.driftStart=y),t.driftEndTime=m,t.driftEnd=y}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}function fi(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.startSN+t.skippedSegments-e.startSN,n=e.fragments,a=i>=0,s=0;if(a&&i<n.length)s=n[i].start;else if(a&&t.startSN===e.endSN+1)s=e.fragmentEnd;else if(a&&r)s=e.fragmentStart+i*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return;s=e.fragmentStart}vi(t,s)}function vi(e,t){if(t){for(var r=e.fragments,i=e.skippedSegments;i<r.length;i++)r[i].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function gi(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0,r=1e3*e.targetduration;if(e.updated){var i=e.fragments,n=4;if(i.length&&r*n>t){var a=1e3*i[i.length-1].duration;a<r&&(r=a)}}else r/=2;return Math.round(r)}function pi(e,t,r){return e?mi(e.partList,t,r):null}function mi(e,t,r){if(e)for(var i=e.length;i--;){var n=e[i];if(n.index===r&&n.fragment.sn===t)return n}return null}function yi(e){ey(e).call(e,(function(e,t){var r,i=null==(r=e.details)?void 0:r.fragments;i&&ey(i).call(i,(function(e){e.level=t,e.initSegment&&(e.initSegment.level=t)}))}))}function Ei(e,t){for(var r=0,i=e.length;r<i;r++){var n;if((null==(n=e[r])?void 0:n.cc)===t)return e[r]}return null}function ki(e,t){if(e){var r=e.start+t;e.start=e.startPTS=r,e.endPTS=r+e.duration}}function Ti(e,t){for(var r=t.fragments,i=0,n=r.length;i<n;i++)ki(r[i],e);t.fragmentHint&&ki(t.fragmentHint,e),t.alignedSliding=!0}function Si(e,t){if(i=e,(r=t)&&i.startCC<r.endCC&&i.endCC>r.startCC){var r,i,n=Math.min(t.endCC,e.endCC),a=Ei(t.fragments,n),s=Ei(e.fragments,n);a&&s&&(te.log("Aligning playlist at start of dicontinuity sequence ".concat(n)),Ti(a.start-s.start,e))}}function Ai(e,t){if(e.hasProgramDateTime&&t.hasProgramDateTime){var r=e.fragments,i=t.fragments;if(r.length&&i.length){var n,a,s=Math.min(t.endCC,e.endCC);t.startCC<s&&e.startCC<s&&(n=Ei(i,s),a=Ei(r,s)),n&&a||(a=Ei(r,(n=i[Math.floor(i.length/2)]).cc)||r[Math.floor(r.length/2)]);var o=n.programDateTime,l=a.programDateTime;o&&l&&Ti((l-o)/1e3-(a.start-n.start),e)}}}var Li=function(e){for(var t="",r=e.length,i=0;i<r;i++){var n;t+=py(n="[".concat(e.start(i).toFixed(3),"-")).call(n,e.end(i).toFixed(3),"]")}return t},bi="STOPPED",Ri="IDLE",Ii="KEY_LOADING",Di="FRAG_LOADING",wi="FRAG_LOADING_WAITING_RETRY",_i="WAITING_TRACK",Pi="PARSING",Ci="PARSED",xi="ENDED",Mi="ERROR",Oi="WAITING_INIT_PTS",Fi="WAITING_LEVEL",Ni=function(e){Ym(r,e);var t=Wm(r);function r(e,i,n,a,s){var o;return qm(this,r),(o=t.call(this,a,e.logger)).hls=void 0,o.fragPrevious=null,o.fragCurrent=null,o.fragmentTracker=void 0,o.transmuxer=null,o._state=bi,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=$f(o),r=t.config,i=t.fragCurrent,n=t.media,a=t.mediaBuffer,s=t.state,l=n?n.currentTime:0,u=fr.bufferInfo(a||n,l,r.maxBufferHole);if(o.log(py(e="media seeking to ".concat(_(l)?l.toFixed(3):l,", state: ")).call(e,s)),o.state===xi)o.resetLoadingState();else if(i){var c=r.maxFragLookUpTolerance,h=i.start-c,d=i.start+i.duration+c;if(!u.len||d<u.start||h>u.end){var f=l>d;(l<h||f)&&(f&&i.loader&&(o.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),i.abortRequests(),o.resetLoadingState()),o.fragPrevious=null)}}if(n&&(o.fragmentTracker.removeFragmentsInRange(l,1/0,o.playlistType,!0),l>o.lastCurrentTime&&(o.lastCurrentTime=l),!o.loadingParts)){var v,g=Math.max(u.end,l),p=o.shouldLoadParts(o.getLevelDetails(),g);p&&(o.log(py(v="LL-Part loading ON after seeking to ".concat(l.toFixed(2)," with buffer @")).call(v,g.toFixed(2))),o.loadingParts=p)}o.hls.hasEnoughToStart||u.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=n,o.fragmentTracker=i,o.config=e.config,o.decrypter=new nr(e.config),o}return Xm(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(O.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(O.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!==bi){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=bi}}},{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,i=e.nextStart,n=i&&(!r||i<t.edge);if(t.live||n||!e.end||!this.media)return!1;var a=t.partList;if(null!=a&&a.length){var s=a[a.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 i=this.config;this.levels&&i.autoStartLoad&&this.state===bi&&this.startLoad(i.startPosition)}},{key:"onMediaDetaching",value:function(e,t){var r=!!t.transferMedia,i=this.media;null!==i&&(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),i.removeEventListener("seeking",this.onMediaSeeking),i.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),Qf(Xf(r.prototype),"onHandlerDestroying",this).call(this),this.hls=this.onMediaSeeking=this.onMediaEnded=null}},{key:"onHandlerDestroyed",value:function(){this.state=bi,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,Qf(Xf(r.prototype),"onHandlerDestroyed",this).call(this)}},{key:"loadFragment",value:function(e,t,r){var i=this.hls.config;if(i.interstitialsController&&!1!==i.enableInterstitialPlayback&&e.type!==H){var n=this.hls.interstitialsManager,a=null==n?void 0:n.bufferingItem;if(a){var s=a.event;if(s){if(s.appendInPlace||Math.abs(e.start-a.start)>1||0===a.start)return}else{var o;if(e.end<=a.start&&!1===(null==(o=t.details)?void 0:o.live))return;if(e.start>a.end&&a.nextEvent)return}}}this.startFragRequested=!0,this._loadFragForPlayback(e,t,r)}},{key:"_loadFragForPlayback",value:function(e,t,r){var i=this;this._doFragLoad(e,t,r,(function(e){var t,r,n,a=e.frag;if(i.fragContextChanged(a))return i.warn(py(t=py(r=py(n="".concat(a.type," sn: ")).call(n,a.sn)).call(r,e.part?" part: "+e.part.index:""," of ")).call(t,i.fragInfo(a,!1,e.part),") was dropped during download.")),void i.fragmentTracker.removeFragment(a);a.stats.chunkCount++,i._handleFragmentLoadProgress(e)})).then((function(e){var t,r,n;if(e){var a=i.state,s=e.frag;i.fragContextChanged(s)?(a===Di||!i.fragCurrent&&a===Pi)&&(i.fragmentTracker.removeFragment(s),i.state=Ri):("payload"in e&&(i.log(py(t=py(r=py(n="Loaded ".concat(s.type," sn: ")).call(n,s.sn," of ")).call(r,i.playlistLabel()," ")).call(t,s.level)),i.hls.trigger(O.FRAG_LOADED,e)),i._handleFragmentLoadComplete(e))}})).catch((function(t){i.state!==bi&&i.state!==Mi&&(i.warn("Frag error: ".concat((null==t?void 0:t.message)||t)),i.resetFragmentLoading(e))}))}},{key:"clearTrackerIfNeeded",value:function(e){var t,r=this.fragmentTracker;if(r.getState(e)===it){var i=e.type,n=this.getFwdBufferInfo(this.mediaBuffer,i),a=Math.max(e.duration,n?n.len:this.config.maxBufferLength),s=this.backtrackFragment;(1==(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(a,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)===nt&&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(O.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,i=e.frag,n=e.payload,a=i.decryptdata;if(n&&n.byteLength>0&&null!=a&&a.key&&a.iv&&br(a.method)){var s=self.performance.now();return r.decrypter.decrypt(new Uint8Array(n),a.key.buffer,a.iv.buffer,Rr(a.method)).catch((function(e){throw t.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:i}),e})).then((function(n){var a=self.performance.now();return t.trigger(O.FRAG_DECRYPTED,{frag:i,payload:n,stats:{tstart:s,tdecrypt:a}}),e.payload=n,r.completeInitSegmentLoad(e)}))}return r.completeInitSegmentLoad(e)})).catch((function(t){r.state!==bi&&r.state!==Mi&&(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!==bi&&(this.state=Ri),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,i,n,a,s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(py(r=py(i=py(n=py(a="Buffered ".concat(e.type," sn: ")).call(a,e.sn)).call(n,t?" part: "+t.index:""," of ")).call(i,this.fragInfo(e,!1,t)," > buffer:")).call(r,s?Li(fr.getBuffered(s)):"(detached)",")")),_t(e)){var o;if(e.type!==H){var l,u=e.elementaryStreams;if(!Sy(l=Qm(u)).call(l,(function(e){return!!u[e]})))return void(this.state=Ri)}var c=null==(o=this.levels)?void 0:o[e.level];null!=c&&c.fragmentError&&(this.log("Resetting level fragment error count of ".concat(c.fragmentError," on frag buffered")),c.fragmentError=0)}this.state=Ri}},{key:"_handleFragmentLoadComplete",value:function(e){var t=this.transmuxer;if(t){var r=e.frag,i=e.part,n=e.partsLoaded,a=!n||0===n.length||Sy(n).call(n,(function(e){return!e})),s=new hr(r.level,r.sn,r.stats.chunkCount+1,0,i?i.index:-1,!a);t.flush(s)}}},{key:"_handleFragmentLoadProgress",value:function(e){}},{key:"_doFragLoad",value:function(e,t){var r,i,n,a,s,o,l,u,c,h,d=this,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,v=arguments.length>3?arguments[3]:void 0;this.fragCurrent=e;var g=null==t?void 0:t.details;if(!this.levels||!g)throw new Error("frag load aborted, missing level".concat(g?"":" detail","s"));var p=null;!e.encrypted||null!=(h=e.decryptdata)&&h.key?!e.encrypted&&g.encryptedFragments.length&&this.keyLoader.loadClear(e,g.encryptedFragments):(this.log(py(r=py(i=py(n=py(a="Loading key for ".concat(e.sn," of [")).call(a,g.startSN,"-")).call(n,g.endSN,"], ")).call(i,this.playlistLabel()," ")).call(r,e.level)),this.state=Ii,this.fragCurrent=e,p=this.keyLoader.load(e).then((function(e){if(!d.fragContextChanged(e.frag))return d.hls.trigger(O.KEY_LOADED,e),d.state===Ii&&(d.state=Ri),e})),this.hls.trigger(O.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(p=RR.reject(new Error("frag load aborted, context changed in KEY_LOADING"))));var m=this.fragPrevious;if(_t(e)&&(!m||e.sn!==m.sn)){var y,E,k=this.shouldLoadParts(t.details,e.end);k!==this.loadingParts&&(this.log(py(y=py(E="LL-Part loading ".concat(k?"ON":"OFF"," loading sn ")).call(E,null==m?void 0:m.sn,"->")).call(y,e.sn)),this.loadingParts=k)}if(f=Math.max(e.start,f||0),this.loadingParts&&_t(e)){var T=g.partList;if(T&&v){f>e.end&&g.fragmentHint&&(e=g.fragmentHint);var S=this.getNextPart(T,e,f);if(S>-1){var A,L,b,R,I,D,w,P,C,x,M=T[S];return e=this.fragCurrent=M.fragment,this.log(py(A=py(L=py(b=py(R=py(I=py(D=py(w=py(P=py(C="Loading ".concat(e.type," sn: ")).call(C,e.sn," part: ")).call(P,M.index," (")).call(w,S,"/")).call(D,T.length-1,") of ")).call(I,this.fragInfo(e,!1,M),") cc: ")).call(R,e.cc," [")).call(b,g.startSN,"-")).call(L,g.endSN,"], target: ")).call(A,ck(f.toFixed(3)))),this.nextLoadPosition=M.start+M.duration,this.state=Di,x=p?p.then((function(r){return!r||d.fragContextChanged(r.frag)?null:d.doFragPartsLoad(e,M,t,v)})).catch((function(e){return d.handleFragLoadError(e)})):this.doFragPartsLoad(e,M,t,v).catch((function(e){return d.handleFragLoadError(e)})),this.hls.trigger(O.FRAG_LOADING,{frag:e,part:M,targetBufferTime:f}),null===this.fragCurrent?RR.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):x}if(!e.url||this.loadedEndOfParts(T,f))return RR.resolve(null)}}if(_t(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 RR.resolve(null);this.log(py(s=py(o=py(l=py(u=py(c="Loading ".concat(e.type," sn: ")).call(c,e.sn," of ")).call(u,this.fragInfo(e,!1),") cc: ")).call(l,e.cc," ")).call(o,g?"["+g.startSN+"-"+g.endSN+"]":"",", target: ")).call(s,ck(f.toFixed(3)))),_(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Di;var F,N=this.config.progressive;return F=N&&p?p.then((function(t){return!t||d.fragContextChanged(null==t?void 0:t.frag)?null:d.fragmentLoader.load(e,v)})).catch((function(e){return d.handleFragLoadError(e)})):RR.all([this.fragmentLoader.load(e,N?v:void 0),p]).then((function(e){var t=mf(e,1)[0];return!N&&t&&v&&v(t),t})).catch((function(e){return d.handleFragLoadError(e)})),this.hls.trigger(O.FRAG_LOADING,{frag:e,targetBufferTime:f}),null===this.fragCurrent?RR.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):F}},{key:"doFragPartsLoad",value:function(e,t,r,i){var n=this;return new RR((function(a,s){var o,l=[],u=null==(o=r.details)?void 0:o.partList;!function t(o){n.fragmentLoader.loadPart(e,o,i).then((function(i){l[o.index]=i;var s=i.part;n.hls.trigger(O.FRAG_LOADED,i);var c=pi(r.details,e.sn,o.index+1)||mi(u,e.sn,o.index+1);if(!c)return a({frag:e,part:s,partsLoaded:l});t(c)})).catch(s)}(t)}))}},{key:"handleFragLoadError",value:function(e){if("data"in e){var t=e.data;e.data&&t.details===M.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(O.ERROR,t)}else this.hls.trigger(O.ERROR,{type:x.OTHER_ERROR,details:M.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===Pi){var i=r.frag,n=r.part,a=r.level,s=self.performance.now();i.stats.parsing.end=s,n&&(n.stats.parsing.end=s);var o=this.getLevelDetails(),l=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);l!==this.loadingParts&&(this.log(py(t="LL-Part loading ".concat(l?"ON":"OFF"," after parsing segment ending @")).call(t,i.end.toFixed(2))),this.loadingParts=l),this.updateLevelTiming(i,n,a,e.partial)}else this.fragCurrent||this.state===bi||this.state===Mi||(this.state=Ri)}},{key:"shouldLoadParts",value:function(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(null!=e&&e.partList){var r,i,n=e.partList[0];if(t>=n.end+((null==(r=e.fragmentHint)?void 0:r.duration)||0)&&(this.hls.hasEnoughToStart?(null==(i=this.media)?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>n.start-n.fragment.duration)return!0}}return!1}},{key:"getCurrentContext",value:function(e){var t,r,i=this.levels,n=this.fragCurrent,a=e.level,s=e.sn,o=e.part;if(null==i||!i[a])return this.warn(py(t=py(r="Levels object was unset while buffering fragment ".concat(s," of ")).call(r,this.playlistLabel()," ")).call(t,a,". The current chunk will not be buffered.")),null;var l=i[a],u=l.details,c=o>-1?pi(u,s,o):null,h=c?c.fragment:function(e,t,r){if(!e)return null;var i=e.fragments[t-e.startSN];return i||((i=e.fragmentHint)&&i.sn===t?i:t<e.startSN&&r&&r.sn===t?r:null)}(u,s,n);return h?(n&&n!==h&&(h.stats=n.stats),{frag:h,part:c,level:l}):null}},{key:"bufferFragmentData",value:function(e,t,r,i,n){var a;if(e&&this.state===Pi){var s=e.data1,o=e.data2,l=s;if(s&&o&&(l=$t(s,o)),null!=(a=l)&&a.length){var u={type:e.type,frag:t,part:r,chunkMeta:i,parent:t.type,data:l};if(this.hls.trigger(O.BUFFER_APPENDING,u),e.dropped&&e.independent&&!r){if(n)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,i=fr.bufferInfo(t,r,0),n=e.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*n),s=Math.max(Math.min(e.start-a,i.end-a),r+a);e.start-s>a&&this.flushMainBuffer(s,e.start)}else this.flushMainBuffer(0,e.start)}},{key:"getFwdBufferInfo",value:function(e,t){var r,i=this.getLoadPosition();if(!_(i))return null;var n=this.lastCurrentTime>i||null!=(r=this.media)&&r.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,i,t,n)}},{key:"getFwdBufferInfoAtPos",value:function(e,t,r,i){var n=fr.bufferInfo(e,t,i);if(0===n.len&&void 0!==n.nextStart){var a=this.fragmentTracker.getBufferedFrag(t,r);if(a&&(n.nextStart<=a.end||a.gap))return fr.bufferInfo(e,t,Math.max(n.nextStart,i))}return n}},{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,i=Math.max(Math.min(e-t,r.maxBufferLength),t),n=Math.max(e-3*t,r.maxMaxBufferLength/2,i);return n>=i&&(r.maxMaxBufferLength=n,this.warn("Reduce max buffer length to ".concat(n,"s")),!0)}},{key:"getAppendedFrag",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:G,i=null==(t=this.fragmentTracker)?void 0:t.getAppendedFrag(e,r);return i&&"fragment"in i?i.fragment:i}},{key:"getNextFragment",value:function(e,t){var r=t.fragments,i=r.length;if(!i)return null;var n=this.config,a=r[0].start,s=n.lowLatencyMode&&!!t.partList,o=null;if(t.live){var l,u=n.initialLiveManifestSize;if(i<u)return this.warn(py(l="Not enough fragments to start playback (have: ".concat(i,", need: ")).call(l,u,")")),null;if(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<a){var c,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 v=this.hls.startPosition,g=this.hls.liveSyncPosition,p=o?(-1!==v?v:g)||o.start:e;this.log(py(c=py(h=py(d="Setting startPosition to ".concat(p," to match initial live edge. mainStart: ")).call(d,v," liveSyncPosition: ")).call(h,g," frag.start: ")).call(c,null==(f=o)?void 0:f.start)),this.startPosition=this.nextLoadPosition=p}}else e<=a&&(o=r[0]);if(!o){var m=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,m,t)}return this.mapToInitFragWhenRequired(o)}},{key:"isLoopLoading",value:function(e,t){var r=this.fragmentTracker.getState(e);return(r===at||r===nt&&!!e.gap)&&this.nextLoadPosition>t}},{key:"getNextFragmentLoopLoading",value:function(e,t,r,i,n){var a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t))&&!a.gap&&r.nextStart){var s=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,i,0);if(null!==s&&r.len+s.len>=n){var o,l=a.sn;return this.loopSn!==l&&(this.log(py(o='buffer full after gaps in "'.concat(i,'" playlist starting at sn: ')).call(o,l)),this.loopSn=l),null}}return this.loopSn=void 0,a}},{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 i=-1,n=!1,a=!0,s=0,o=e.length;s<o;s++){var l=e[s];if(a=a&&!l.independent,i>-1&&r<l.start)break;var u=l.loaded;u?i=-1:(n||l.independent||a)&&l.fragment===t&&(i=s),n=u}return i}},{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,i=null;if(r){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: ".concat(r.programDateTime)),i=function(e,t,r){if(null===t||!sy(e)||!e.length||!_(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 i=0;i<e.length;++i){var n=e[i];if(Ke(t,r,n))return n}return null}(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){var n=r.sn+1;if(n>=e.startSN&&n<=e.endSN){var a=t[n-e.startSN];r.cc===a.cc&&(i=a,this.log("Live playlist, switching playlist, load frag with next SN: ".concat(i.sn)))}i||(i=He(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: ".concat(i.sn))}}else{var s=this.hls.liveSyncPosition;null!==s&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}},{key:"getFragmentAtPosition",value:function(e,t,r){var i,n,a=this.config,s=this.fragPrevious,o=r.fragments,l=r.endSN,u=r.fragmentHint,c=a.maxFragLookUpTolerance,h=r.partList,d=!!(this.loadingParts&&null!=h&&h.length&&u);if(d&&u&&!this.bitrateTest&&h[h.length-1].fragment.sn===u.sn&&(o=py(o).call(o,u),l=u.sn),i=e<t?Be(s,o,e,e<this.lastCurrentTime||e>t-c||null!=(n=this.media)&&n.paused||!this.startFragRequested?0:c):o[o.length-1]){var f=i.sn-r.startSN,v=this.fragmentTracker.getState(i);if((v===at||v===nt&&i.gap)&&(s=i),s&&i.sn===s.sn&&(!d||h[0].fragment.sn>i.sn||!r.live&&!d)&&s&&i.level===s.level){var g=o[f+1];i=i.sn<l&&this.fragmentTracker.getState(g)!==at?g:null}}return i}},{key:"alignPlaylists",value:function(e,t,r){var i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;var n,a,s=e.fragmentStart,o=!t,l=e.alignedSliding&&_(s);if(o||!l&&!s){var u,c,h;a=e,(n=r)&&(Si(a,n),!a.alignedSliding&&n&&Ai(a,n),a.alignedSliding||!n||a.skippedSegments||fi(n,a,!1));var d=e.fragmentStart;return this.log(py(u=py(c=py(h="Live playlist sliding: ".concat(d.toFixed(2)," start-sn: ")).call(h,t?t.startSN:"na","->")).call(c,e.startSN," fragments: ")).call(u,i)),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 i,n,a=null!==this.startTimeOffset,s=a?this.startTimeOffset:e.startTimeOffset;null!==s&&_(s)?(r=t+s,s<0&&(r+=e.edge),r=Math.min(Math.max(t,r),t+e.totalduration),this.log(py(i=py(n="Setting startPosition to ".concat(r," for start time offset ")).call(n,s," found in ")).call(i,a?"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,i,n;this.transmuxer&&e.type===this.playlistType&&_t(e)&&e.stats.aborted&&(this.warn(py(r=py(i=py(n="Fragment ".concat(e.sn)).call(n,t?" part "+t.index:""," of ")).call(i,this.playlistLabel()," ")).call(r,e.level," was aborted")),this.resetFragmentLoading(e))}},{key:"resetFragmentLoading",value:function(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===wi)||(this.state=Ri)}},{key:"onFragmentOrKeyLoadError",value:function(e,t){var r;if(t.chunkMeta&&!t.frag){var i=this.getCurrentContext(t.chunkMeta);i&&(t.frag=i.frag)}var n,a=t.frag;if(a&&a.type===e&&this.levels)if(this.fragContextChanged(a))this.warn(py(r="Frag load error must match current frag to retry ".concat(a.url," > ")).call(r,null==(n=this.fragCurrent)?void 0:n.url));else{var s=t.details===M.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(a,!0);var o=t.errorAction,l=o||{},u=l.action,c=V_(l),h=l.retryCount,d=void 0===h?0:h,f=l.retryConfig,v=!!o&&!!f,g=v&&u===$e,p=v&&!o.resolved&&c===Ze;if(!g&&p&&_t(a)&&!a.endList)this.resetFragmentErrors(e),this.treatAsGap(a),o.resolved=!0;else if((g||p)&&d<f.maxNumRetry){var m,y,E,k,T,S;this.resetStartWhenNotLoaded(this.levelLastLoaded);var A=Ye(f,d);this.warn(py(m=py(y=py(E=py(k=py(T=py(S="Fragment ".concat(a.sn," of ")).call(S,e," ")).call(T,a.level," errored with ")).call(k,t.details,", retrying loading ")).call(E,d+1,"/")).call(y,f.maxNumRetry," in ")).call(m,A,"ms")),o.resolved=!0,this.retryDate=self.performance.now()+A,this.state=wi}else if(f&&o){var L;if(this.resetFragmentErrors(e),!(d<f.maxNumRetry))return void this.warn(py(L="".concat(t.details," reached or exceeded max retry (")).call(L,d,")"));s||u===Qe||(o.resolved=!0)}else this.state=u===Xe?Fi:Mi;this.tickImmediate()}}},{key:"reduceLengthAndFlushBuffer",value:function(e){if(this.state===Pi||this.state===Ci){var t=e.frag,r=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,r),n=i&&i.len>.5;n&&this.reduceMaxBufferLength(i.len,(null==t?void 0:t.duration)||10);var a=!n;return a&&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(),a}return!1}},{key:"resetFragmentErrors",value:function(e){e===K&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==bi&&(this.state=Ri)}},{key:"afterBufferFlushed",value:function(e,t,r){if(e){var i=fr.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,r),this.state===xi&&this.resetLoadingState()}}},{key:"resetLoadingState",value:function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==bi&&(this.state=Ri)}},{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(py(t=py(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,i){var n,a,s,o,l,u=this,c=r.details;if(c){if(!eS(n=Qm(e.elementaryStreams)).call(n,(function(t,n){var a=e.elementaryStreams[n];if(a){var s,o,l=a.endPTS-a.startPTS;if(l<=0)return u.warn(py(s=py(o="Could not parse fragment ".concat(e.sn," ")).call(o,n," duration reliably (")).call(s,l,")")),t||!1;var h=i?0:hi(c,e,a.startPTS,a.endPTS,a.startDTS,a.endDTS);return u.hls.trigger(O.LEVEL_PTS_UPDATED,{details:c,level:r,drift:h,type:n,frag:e,start:a.startPTS,end:a.endPTS}),!0}return t}),!1)&&null===(null==(l=this.transmuxer)?void 0:l.error)){var h,d,f,v,g=new Error(py(h=py(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(g.message),this.hls.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!1,error:g,frag:e,reason:py(f=py(v="Found no media in msn ".concat(e.sn," of ")).call(v,this.playlistLabel(),' "')).call(f,r.url,'"')}),!this.hls)return;this.resetTransmuxer()}this.state=Ci,this.log(py(a=py(s=py(o="Parsed ".concat(e.type," sn: ")).call(o,e.sn)).call(s,t?" part: "+t.index:""," of ")).call(a,this.fragInfo(e,!1,t),")")),this.hls.trigger(O.FRAG_PARSED,{frag:e,part:t})}else this.warn("level.details undefined")}},{key:"playlistLabel",value:function(){return this.playlistType===G?"level":"track"}},{key:"fragInfo",value:function(e){var t,r,i,n,a,s,o,l=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=arguments.length>2?arguments[2]:void 0;return py(t=py(r=py(i=py(n=py(a="".concat(this.playlistLabel()," ")).call(a,e.level," (")).call(n,u?"part":"frag",":[")).call(i,(null!=(s=l&&!u?e.startPTS:(u||e).start)?s:NaN).toFixed(3),"-")).call(r,(null!=(o=l&&!u?e.endPTS:(u||e).end)?o:NaN).toFixed(3),"]")).call(t,u&&"main"===e.type?"INDEPENDENT="+(u.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(py(t="".concat(r,"->")).call(t,e)))}}]),r}(cr),Ui=function(){function e(){qm(this,e),this.chunks=[],this.dataLength=0}return Xm(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),i=0,n=0;n<e.length;n++){var a=e[n];r.set(a,i),i+=a.length}return r}(t,r),this.reset(),e):new Uint8Array(0)}},{key:"reset",value:function(){this.chunks.length=0,this.dataLength=0}}]),e}(),Bi={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,i,a,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new n(i,a||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 i:delete e._events[t]}function o(){this._events=new i,this._eventsCount=0}t_&&(i.prototype=t_(null),(new i).__proto__||(r=!1)),o.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?uy(i).call(i,1):i);return $m?py(n).call(n,$m(e)):n},o.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,a=i.length,s=new Array(a);n<a;n++)s[n]=i[n].fn;return s},o.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},o.prototype.emit=function(e,t,i,n,a,s){var o=r?r+e:e;if(!this._events[o])return!1;var l,u,c=this._events[o],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,n),!0;case 5:return c.fn.call(c.context,t,i,n,a),!0;case 6:return c.fn.call(c.context,t,i,n,a,s),!0}for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var d,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),h){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,i);break;case 4:c[u].fn.call(c[u].context,t,i,n);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];c[u].fn.apply(c[u].context,l)}}return!0},o.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},o.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},o.prototype.removeListener=function(e,t,i,n){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||n&&!o.once||i&&o.context!==i||s(this,a);else{for(var l=0,u=[],c=o.length;l<c;l++)(o[l].fn!==t||n&&!o[l].once||i&&o[l].context!==i)&&u.push(o[l]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}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 i,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}(Bi);var Gi=mt(Bi.exports),Ki="1.6.0-beta.2",Hi={};function Vi(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 ji(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 Yi(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 Wi(e,t){for(var r=t,i=0;ji(e,t);)i+=10,i+=Yi(e,t+6),Vi(e,t+10)&&(i+=10),t+=i;if(i>0)return e.subarray(r,r+i)}function qi(e,t){return 255===e[t]&&240==(246&e[t+1])}function zi(e,t){return 1&e[t+1]?7:9}function Xi(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function Qi(e,t){return t+1<e.length&&qi(e,t)}function $i(e,t){if(Qi(e,t)){var r=zi(e,t);if(t+r>=e.length)return!1;var i=Xi(e,t);if(i<=r)return!1;var n=t+i;return n===e.length||Qi(e,n)}return!1}function Ji(e,t,r,i,n){if(!e.samplerate){var a=function(e,t,r,i,n,a,s,o,l){var u=t[r+2],c=u>>2&15;if(!(c>12)){var h=1+(u>>6&3),d=t[r+3]>>6&3|(1&u)<<2,f="mp4a.40."+h,v=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][c],g=c;5!==h&&29!==h||(g-=3);var p=[h<<3|(14&g)>>1,(1&g)<<7|d<<3];return te.log(py(n=py(a=py(s=py(o=py(l="manifest codec:".concat(i,", parsed codec:")).call(l,f,", channels:")).call(o,d,", rate:")).call(s,v," (ADTS object type:")).call(a,h," sampling index:")).call(n,c,")")),{config:p,samplerate:v,channelCount:d,codec:f,parsedCodec:f,manifestCodec:i}}var m=new Error("invalid ADTS sampling index:".concat(c));e.emit(O.ERROR,O.ERROR,{type:x.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!0,error:m,reason:m.message})}(t,r,i,n);if(!a)return;W(e,a)}}function Zi(e){return 9216e4/e}function en(e,t,r,i,n){var a,s=i+n*Zi(e.samplerate),o=function(e,t){var r=zi(e,t);if(t+r<=e.length){var i=Xi(e,t)-r;if(i>0)return{headerLength:r,frameLength:i}}}(t,r);if(o){var l=o.frameLength,u=o.headerLength,c=u+l,h=Math.max(0,r+c-t.length);h?(a=new Uint8Array(c-u)).set(t.subarray(r+u,t.length),0):a=t.subarray(r+u,r+c);var d={unit:a,pts:s};return h||e.samples.push(d),{sample:d,length:c,missing:h}}var f=t.length-r;return(a=new Uint8Array(f)).set(t.subarray(r,t.length),0),{sample:{unit:a,pts:s},length:f,missing:-1}}function tn(e,t){return ji(e,t)&&Yi(e,t+6)+10<=e.length-t}function rn(e){return function(e,t,r,i){var n,a=(n=e)instanceof ArrayBuffer?n:n.buffer,s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);var o,l=(o=e)&&o.buffer instanceof ArrayBuffer&&void 0!==o.byteLength&&void 0!==o.byteOffset?e.byteOffset:0,u=(l+e.byteLength)/s,c=(l+t)/s,h=Math.floor(Math.max(0,Math.min(c,u)));return new i(a,h,Math.floor(Math.min(h+Math.max(r,0),u))-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 nn(e,t){if(e<0)return-nn(-e,t);var r=Math.pow(10,t);if(Math.abs(e*r%1-.5)<j_){var i=Math.floor(e*r);return(i%2==0?i:i+1)/r}return Math.round(e*r)/r}function an(e){var t,r,i={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(!(e.size<2))if(3===e.data[0]){var n=hy(t=e.data.subarray(1)).call(t,0);if(-1!==n){var a=gt(rn(e.data,1,n)),s=e.data[2+n],o=hy(r=e.data.subarray(3+n)).call(r,0);if(-1!==o){var l,u,c=gt(rn(e.data,3+n,o));return l="--\x3e"===a?gt(rn(e.data,4+n+o)):(u=e.data.subarray(4+n+o))instanceof ArrayBuffer?u:0==u.byteOffset&&u.byteLength==u.buffer.byteLength?u.buffer:new Uint8Array(u).buffer,i.mimeType=a,i.pictureType=s,i.description=c,i.data=l,i}}}else console.log("Ignore frame with unrecognized character encoding")}function sn(e){return"PRIV"===e.type?function(e){if(!(e.size<2)){var t=gt(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=gt(e.data.subarray(t),!0);t+=r.length+1;var i=gt(e.data.subarray(t));return{key:e.type,info:r,data:i}}var n=gt(e.data);return{key:e.type,info:"",data:n}}(e):"APIC"===e.type?an(e):function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,r=gt(e.data.subarray(t),!0);t+=r.length+1;var i=gt(e.data.subarray(t));return{key:e.type,info:r,data:i}}var n=gt(e.data.subarray(1));return{key:e.type,info:"",data:n}}}(e)}function on(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=Yi(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}}function ln(e){for(var t=0,r=[];ji(e,t);){var i=Yi(e,t+6);e[t+5]>>6&1&&(t+=10);for(var n=(t+=10)+i;t+10<n;){var a=on(e.subarray(t)),s=sn(a);s&&r.push(s),t+=a.size+10}Vi(e,t)&&(t+=10)}return r}function un(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function cn(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}}function hn(e){for(var t=ln(e),r=0;r<t.length;r++){var i=t[r];if(un(i))return cn(i)}}var dn=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 fn(){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 vn=function(){function e(){qm(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 Xm(e,[{key:"resetInitSegment",value:function(e,t,r,i){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=$t(this.cachedData,e),this.cachedData=null);var r,i=Wi(e,0),n=i?i.length:0,a=this._audioTrack,s=this._id3Track,o=i?hn(i):void 0,l=e.length;for((null===this.basePTS||0===this.frameIndex&&_(o))&&(this.basePTS=gn(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),i&&i.length>0&&s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:dn.audioId3,duration:Number.POSITIVE_INFINITY});n<l;){if(this.canParse(e,n)){var u=this.appendFrame(a,e,n);u?(this.frameIndex++,this.lastPTS=u.sample.pts,r=n+=u.length):n=l}else tn(e,n)?(i=Wi(e,n),s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:dn.audioId3,duration:Number.POSITIVE_INFINITY}),r=n+=i.length):n++;if(n===l&&r!==l){var c=dt(e,r);this.cachedData?this.cachedData=$t(this.cachedData,c):this.cachedData=c}}return{audioTrack:a,videoTrack:fn(),id3Track:s,textTrack:fn()}}},{key:"demuxSampleAes",value:function(e,t,r){return RR.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:fn(),id3Track:this._id3Track,textTrack:fn()}}},{key:"destroy",value:function(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}]),e}(),gn=function(e,t,r){return _(e)?90*e:9e4*t+(r?9e4*r.baseTime/r.timescale:0)},pn=null,mn=[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],yn=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],En=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],kn=[0,1,1,4];function Tn(e,t,r,i,n){if(!(r+24>t.length)){var a=Sn(t,r);if(a&&r+a.frameLength<=t.length){var s=i+n*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:t.subarray(r,r+a.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(o),{sample:o,length:a.frameLength,missing:0}}}}function Sn(e,t){var r=e[t+1]>>3&3,i=e[t+1]>>1&3,n=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==r&&0!==n&&15!==n&&3!==a){var s=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*mn[14*(3===r?3-i:3===i?3:4)+n-1],u=yn[3*(3===r?0:2===r?1:2)+a],c=3===o?1:2,h=En[r][i],d=kn[i],f=8*h*d,v=Math.floor(h*l/u+s)*d;if(null===pn){var g=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);pn=g?Ck(g[1]):0}return!!pn&&pn<=87&&2===i&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:u,channelCount:c,frameLength:v,samplesPerFrame:f}}}function An(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function Ln(e,t){return t+1<e.length&&An(e,t)}function bn(e,t){if(t+1<e.length&&An(e,t)){var r=4,i=Sn(e,t),n=r;null!=i&&i.frameLength&&(n=i.frameLength);var a=t+n;return a===e.length||Ln(e,a)}return!1}var Rn=function(e,t){var r=0,i=5;t+=i;for(var n=new Uint32Array(1),a=new Uint32Array(1),s=new Uint8Array(1);i>0;){s[0]=e[t];var o=Math.min(i,8),l=8-o;a[0]=4278190080>>>24+l<<l,n[0]=(s[0]&a[0])>>l,r=r?r<<o|n[0]:n[0],t+=1,i-=o}return r},In=function(e){Ym(r,e);var t=Wm(r);function r(e){var i;return qm(this,r),(i=t.call(this)).observer=void 0,i.observer=e,i}return Xm(r,[{key:"resetInitSegment",value:function(e,t,i,n){Qf(Xf(r.prototype),"resetInitSegment",this).call(this,e,t,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return t+64<e.length}},{key:"appendFrame",value:function(e,t,r){var i=Dn(e,t,r,this.basePTS,this.frameIndex);if(-1!==i)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}}],[{key:"probe",value:function(e){if(!e)return!1;var t=Wi(e,0);if(!t)return!1;var r=t.length;return 11===e[r]&&119===e[r+1]&&void 0!==hn(t)&&Rn(e,r)<16}}]),r}(vn);function Dn(e,t,r,i,n){if(r+8>t.length)return-1;if(11!==t[r]||119!==t[r+1])return-1;var a=t[r+4]>>6;if(a>=3)return-1;var s=[48e3,44100,32e3][a],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+a];if(r+l>t.length)return-1;var u=t[r+6]>>5,c=0;2===u?c+=2:(1&u&&1!==u&&(c+=2),4&u&&(c+=2));var h=(t[r+6]<<8|t[r+7])>>12-c&1,d=[2,1,2,3,3,4,4,5][u]+h,f=t[r+5]>>3,v=7&t[r+5],g=new Uint8Array([a<<6|f<<1|v>>2,(3&v)<<6|u<<3|h<<2|o>>4,o<<4&224]),p=i+n*(1536/s*9e4),m=t.subarray(r,r+l);return e.config=g,e.channelCount=d,e.samplerate=s,e.samples.push({unit:m,pts:p}),l}var wn=/\/emsg[-/]ID3/i;function _n(e,t){return _(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}var Pn=function(){function e(t,r,i){qm(this,e),this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new nr(r,{removePKCS7Padding:!1})}return Xm(e,[{key:"decryptBuffer",value:function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,ut)}},{key:"decryptAacSample",value:function(e,t,r){var i,n=this,a=e[t].unit;if(!(a.length<=16)){var s=a.subarray(16,a.length-a.length%16),o=uy(i=s.buffer).call(i,s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(o).then((function(i){var s=new Uint8Array(i);a.set(s,16),n.decrypter.isSync()||n.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),i=0,n=32;n<e.length-16;n+=160,i+=16)r.set(e.subarray(n,n+16),i);return r}},{key:"getAvcDecryptedUnit",value:function(e,t){for(var r=new Uint8Array(t),i=0,n=32;n<e.length-16;n+=160,i+=16)e.set(r.subarray(i,i+16),n);return e}},{key:"decryptAvcSample",value:function(e,t,r,i,n){var a=this,s=tr(n.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then((function(o){n.data=a.getAvcDecryptedUnit(s,o),a.decrypter.isSync()||a.decryptAvcSamples(e,t,r+1,i)}))}},{key:"decryptAvcSamples",value:function(e,t,r,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length)return void i();for(var n=e[t].units;!(r>=n.length);r++){var a=n[r];if(!(a.data.length<=48||1!==a.type&&5!==a.type||(this.decryptAvcSample(e,t,r,i,a),this.decrypter.isSync())))return}}}}]),e}(),Cn=function(){function e(){qm(this,e),this.VideoSample=null}return Xm(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,i=this.VideoSample;if(i&&0!==i.units.length||(i=e[e.length-1]),null!=(t=i)&&t.units){var n=i.units;r=n[n.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,i=r.length;if(!i)return void t.dropped++;var n=r[i-1];e.pts=n.pts,e.dts=n.dts}t.samples.push(e)}}},{key:"parseNALu",value:function(e,t,r){var i,n,a=t.byteLength,s=e.naluState||0,o=s,l=[],u=0,c=-1,h=0;for(-1===s&&(c=0,h=this.getNALuType(t,0),s=0,u=1);u<a;)if(i=t[u++],s)if(1!==s)if(i)if(1===i){if(n=u-s-1,c>=0){var d={data:t.subarray(c,n),type:h};l.push(d)}else{var f=this.getLastNalUnit(e.samples);f&&(o&&u<=4-o&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-o)),n>0&&(f.data=$t(f.data,t.subarray(0,n)),f.state=0))}u<a?(c=u,h=this.getNALuType(t,u),s=0):s=-1}else s=0;else s=3;else s=i?0:2;else s=i?0:1;if(c>=0&&s>=0){var v={data:t.subarray(c,a),type:h,state:s};l.push(v)}if(0===l.length){var g=this.getLastNalUnit(e.samples);g&&(g.data=$t(g.data,t))}return e.naluState=s,l}}]),e}(),xn=function(){function e(t){qm(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 Xm(e,[{key:"loadWord",value:function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),n=Math.min(4,t);if(0===n)throw new Error("no bytes available");i.set(e.subarray(r,r+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n}},{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}(),Mn=function(e){Ym(r,e);var t=Wm(r);function r(){return qm(this,r),t.apply(this,arguments)}return Xm(r,[{key:"parsePES",value:function(e,t,r,i){var n,a=this,s=this.parseNALu(e,r.data,i),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)),ey(s).call(s,(function(i){var s,u;switch(i.type){case 1:var c=!1;n=!0;var h,d=i.data;if(l&&d.length>4){var f=a.readSliceType(d);2!==f&&4!==f&&7!==f&&9!==f||(c=!0)}c&&null!=(h=o)&&h.frame&&!o.key&&(a.pushAccessUnit(o,e),o=a.VideoSample=null),o||(o=a.VideoSample=a.createVideoSample(!0,r.pts,r.dts)),o.frame=!0,o.key=c;break;case 5:n=!0,null!=(s=o)&&s.frame&&!o.key&&(a.pushAccessUnit(o,e),o=a.VideoSample=null),o||(o=a.VideoSample=a.createVideoSample(!0,r.pts,r.dts)),o.key=!0,o.frame=!0;break;case 6:n=!0,er(i.data,1,r.pts,t.samples);break;case 7:var v,g;n=!0,l=!0;var p=i.data,m=a.readSPS(p);if(!e.sps||e.width!==m.width||e.height!==m.height||(null==(v=e.pixelRatio)?void 0:v[0])!==m.pixelRatio[0]||(null==(g=e.pixelRatio)?void 0:g[1])!==m.pixelRatio[1]){e.width=m.width,e.height=m.height,e.pixelRatio=m.pixelRatio,e.sps=[p];for(var y=p.subarray(1,4),E="avc1.",k=0;k<3;k++){var T=y[k].toString(16);T.length<2&&(T="0"+T),E+=T}e.codec=E}break;case 8:n=!0,e.pps=[i.data];break;case 9:n=!0,e.audFound=!0,null!=(u=o)&&u.frame&&(a.pushAccessUnit(o,e),o=null),o||(o=a.VideoSample=a.createVideoSample(!1,r.pts,r.dts));break;case 12:n=!0;break;default:n=!1}o&&n&&o.units.push(i)})),i&&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 xn(e);return t.readUByte(),t.readUEG(),t.readUEG()}},{key:"skipScalingList",value:function(e,t){for(var r=8,i=8,n=0;n<e;n++)0!==i&&(i=(r+t.readEG()+256)%256),r=0===i?r:i}},{key:"readSPS",value:function(e){var t,r,i,n,a,s,o,l,u,c,h,d=new xn(e),f=0,v=0,g=0,p=0,m=pE(t=d.readUByte).call(t,d),y=pE(r=d.readBits).call(r,d),E=pE(i=d.readUEG).call(i,d),k=pE(n=d.readBoolean).call(n,d),T=pE(a=d.skipBits).call(a,d),S=pE(s=d.skipEG).call(s,d),A=pE(o=d.skipUEG).call(o,d),L=pE(l=this.skipScalingList).call(l,this);m();var b=m();if(y(5),T(3),m(),A(),100===b||110===b||122===b||244===b||44===b||83===b||86===b||118===b||128===b){var R=E();if(3===R&&T(1),A(),A(),T(1),k())for(c=3!==R?8:12,h=0;h<c;h++)k()&&L(h<6?16:64,d)}A();var I=E();if(0===I)E();else if(1===I)for(T(1),S(),S(),u=E(),h=0;h<u;h++)S();A(),T(1);var D=E(),w=E(),_=y(1);0===_&&T(1),T(1),k()&&(f=E(),v=E(),g=E(),p=E());var P=[1,1];if(k()&&k())switch(m()){case 1:P=[1,1];break;case 2:P=[12,11];break;case 3:P=[10,11];break;case 4:P=[16,11];break;case 5:P=[40,33];break;case 6:P=[24,11];break;case 7:P=[20,11];break;case 8:P=[32,11];break;case 9:P=[80,33];break;case 10:P=[18,11];break;case 11:P=[15,11];break;case 12:P=[64,33];break;case 13:P=[160,99];break;case 14:P=[4,3];break;case 15:P=[3,2];break;case 16:P=[2,1];break;case 255:P=[m()<<8|m(),m()<<8|m()]}return{width:Math.ceil(16*(D+1)-2*f-2*v),height:(2-_)*(w+1)*16-(_?2:4)*(g+p),pixelRatio:P}}}]),r}(Cn),On=function(e){Ym(r,e);var t=Wm(r);function r(){var e,i;qm(this,r);for(var n=arguments.length,a=new Array(n),s=0;s<n;s++)a[s]=arguments[s];return(i=t.call.apply(t,py(e=[this]).call(e,a))).initVPS=null,i}return Xm(r,[{key:"parsePES",value:function(e,t,r,i){var n,a=this,s=this.parseNALu(e,r.data,i),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)),ey(s).call(s,(function(i){var s,u;switch(i.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||(o=a.VideoSample=a.createVideoSample(!1,r.pts,r.dts)),o.frame=!0,n=!0;break;case 16:case 17:case 18:case 21:var c;n=!0,l&&null!=(c=o)&&c.frame&&!o.key&&(a.pushAccessUnit(o,e),o=a.VideoSample=null),o||(o=a.VideoSample=a.createVideoSample(!0,r.pts,r.dts)),o.key=!0,o.frame=!0;break;case 19:case 20:n=!0,null!=(s=o)&&s.frame&&!o.key&&(a.pushAccessUnit(o,e),o=a.VideoSample=null),o||(o=a.VideoSample=a.createVideoSample(!0,r.pts,r.dts)),o.key=!0,o.frame=!0;break;case 39:n=!0,er(i.data,2,r.pts,t.samples);break;case 32:if(n=!0,!e.vps){var h=a.readVPS(i.data);e.params=z({},h),a.initVPS=i.data}e.vps=[i.data];break;case 33:if(n=!0,l=!0,"object"==qh(e.params)){if(void 0===e.vps||e.vps[0]===a.initVPS||void 0===e.sps||a.matchSPS(e.sps[0],i.data)||(a.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){var d=a.readSPS(i.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]===a.initVPS&&e.sps.push(i.data)}o||(o=a.VideoSample=a.createVideoSample(!0,r.pts,r.dts)),o.key=!0;break;case 34:if(n=!0,"object"==qh(e.params)){if(!e.pps){e.pps=[];var v=a.readPPS(i.data);for(var g in v)e.params[g]=v[g]}void 0!==e.vps&&e.vps[0]===a.initVPS&&e.pps.push(i.data)}break;case 35:n=!0,e.audFound=!0,null!=(u=o)&&u.frame&&(a.pushAccessUnit(o,e),o=null),o||(o=a.VideoSample=a.createVideoSample(!1,r.pts,r.dts));break;default:n=!1}o&&n&&o.units.push(i)})),i&&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,i=0;i<e.byteLength;i++)i>=2&&3===e[i]&&0===e[i-1]&&0===e[i-2]||(t[r]=e[i],r++);return new Uint8Array(t.buffer,0,r)}},{key:"pushAccessUnit",value:function(e,t){Qf(Xf(r.prototype),"pushAccessUnit",this).call(this,e,t),this.initVPS&&(this.initVPS=null)}},{key:"readVPS",value:function(e){var t=new xn(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,i,n,a=new xn(this.ebsp2rbsp(e));a.readUByte(),a.readUByte(),a.readBits(4);var s=a.readBits(3);a.readBoolean();for(var o=a.readBits(2),l=a.readBoolean(),u=a.readBits(5),c=a.readUByte(),h=a.readUByte(),d=a.readUByte(),f=a.readUByte(),v=a.readUByte(),g=a.readUByte(),p=a.readUByte(),m=a.readUByte(),y=a.readUByte(),E=a.readUByte(),k=a.readUByte(),T=[],S=[],A=0;A<s;A++)T.push(a.readBoolean()),S.push(a.readBoolean());if(s>0)for(var L=s;L<8;L++)a.readBits(2);for(var b=0;b<s;b++)T[b]&&(a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte()),S[b]&&a.readUByte();a.readUEG();var R=a.readUEG();3==R&&a.skipBits(1);var I=a.readUEG(),D=a.readUEG(),w=a.readBoolean(),_=0,P=0,C=0,x=0;w&&(_+=a.readUEG(),P+=a.readUEG(),C+=a.readUEG(),x+=a.readUEG());for(var M=a.readUEG(),O=a.readUEG(),F=a.readUEG(),N=a.readBoolean()?0:s;N<=s;N++)a.skipUEG(),a.skipUEG(),a.skipUEG();if(a.skipUEG(),a.skipUEG(),a.skipUEG(),a.skipUEG(),a.skipUEG(),a.skipUEG(),a.readBoolean()&&a.readBoolean())for(var U=0;U<4;U++)for(var B=0;B<(3===U?2:6);B++)if(a.readBoolean()){var G=Math.min(64,1<<4+(U<<1));U>1&&a.readEG();for(var K=0;K<G;K++)a.readEG()}else a.readUEG();a.readBoolean(),a.readBoolean(),a.readBoolean()&&(a.readUByte(),a.skipUEG(),a.skipUEG(),a.readBoolean());for(var H=a.readUEG(),V=0,j=0;j<H;j++){var Y=!1;if(0!==j&&(Y=a.readBoolean()),Y){j===H&&a.readUEG(),a.readBoolean(),a.readUEG();for(var W=0,q=0;q<=V;q++){var z=a.readBoolean(),X=!1;z||(X=a.readBoolean()),(z||X)&&W++}V=W}else{var Q=a.readUEG(),$=a.readUEG();V=Q+$;for(var J=0;J<Q;J++)a.readUEG(),a.readBoolean();for(var Z=0;Z<$;Z++)a.readUEG(),a.readBoolean()}}if(a.readBoolean())for(var ee=a.readUEG(),te=0;te<ee;te++){for(var re=0;re<F+4;re++)a.readBits(1);a.readBits(1)}var ie=0,ne=1,ae=1,se=!0,oe=1,le=0;a.readBoolean(),a.readBoolean();var ue=!1;if(a.readBoolean()){if(a.readBoolean()){var ce=a.readUByte();ce>0&&ce<16?(ne=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][ce-1],ae=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][ce-1]):255===ce&&(ne=a.readBits(16),ae=a.readBits(16))}if(a.readBoolean()&&a.readBoolean(),a.readBoolean()&&(a.readBits(3),a.readBoolean(),a.readBoolean()&&(a.readUByte(),a.readUByte(),a.readUByte())),a.readBoolean()&&(a.readUEG(),a.readUEG()),a.readBoolean(),a.readBoolean(),a.readBoolean(),(ue=a.readBoolean())&&(_+=a.readUEG(),P+=a.readUEG(),C+=a.readUEG(),x+=a.readUEG()),a.readBoolean()&&(oe=a.readBits(32),le=a.readBits(32),a.readBoolean()&&a.readUEG(),a.readBoolean())){var he=a.readBoolean(),de=a.readBoolean(),fe=!1;(he||de)&&((fe=a.readBoolean())&&(a.readUByte(),a.readBits(5),a.readBoolean(),a.readBits(5)),a.readBits(4),a.readBits(4),fe&&a.readBits(4),a.readBits(5),a.readBits(5),a.readBits(5));for(var ve=0;ve<=s;ve++){var ge=!1;(se=a.readBoolean())||a.readBoolean()?a.readEG():ge=a.readBoolean();var pe=ge?1:a.readUEG()+1;if(he)for(var me=0;me<pe;me++)a.readUEG(),a.readUEG(),fe&&(a.readUEG(),a.readUEG()),a.skipBits(1);if(de)for(var ye=0;ye<pe;ye++)a.readUEG(),a.readUEG(),fe&&(a.readUEG(),a.readUEG()),a.skipBits(1)}}a.readBoolean()&&(a.readBoolean(),a.readBoolean(),a.readBoolean(),ie=a.readUEG())}var Ee=I,ke=D;if(w||ue){var Te=1,Se=1;1===R?Te=Se=2:2==R&&(Te=2),Ee=I-Te*P-Te*_,ke=D-Se*x-Se*C}for(var Ae=o?["A","B","C"][o]:"",Le=c<<24|h<<16|d<<8|f,be=0,Re=0;Re<32;Re++)be=(be|(Le>>Re&1)<<31-Re)>>>0;var Ie=be.toString(16);return 1===u&&"2"===Ie&&(Ie="6"),{codecString:py(t=py(r=py(i=py(n="hvc1.".concat(Ae)).call(n,u,".")).call(i,Ie,".")).call(r,l?"H":"L")).call(t,k,".B0"),params:{general_tier_flag:l,general_profile_idc:u,general_profile_space:o,general_profile_compatibility_flags:[c,h,d,f],general_constraint_indicator_flags:[v,g,p,m,y,E],general_level_idc:k,bit_depth:M+8,bit_depth_luma_minus8:M,bit_depth_chroma_minus8:O,min_spatial_segmentation_idc:ie,chroma_format_idc:R,frame_rate:{fixed:se,fps:le/oe}},width:Ee,height:ke,pixelRatio:[ne,ae]}}},{key:"readPPS",value:function(e){var t=new xn(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(),i=t.readBoolean(),n=1;return i&&r?n=0:i?n=3:r&&(n=2),{parallelismType:n}}},{key:"matchSPS",value:function(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}]),r}(Cn),Fn=188,Nn=function(){function e(t,r,i,n){qm(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=i,this.logger=n,this.videoParser=null}return Xm(e,[{key:"resetInitSegment",value:function(t,r,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=e.createTrack("audio",n),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=i}},{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 i,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n||(this.sampleAes=null);var s=this._videoTrack,o=this._audioTrack,l=this._id3Track,u=this._txtTrack,c=s.pid,h=s.pesData,d=o.pid,f=l.pid,v=o.pesData,g=l.pesData,p=null,m=this.pmtParsed,y=this._pmtId,E=t.length;if(this.remainderData&&(E=(t=$t(this.remainderData,t)).length,this.remainderData=null),E<Fn&&!a)return this.remainderData=t,{audioTrack:o,videoTrack:s,id3Track:l,textTrack:u};var k=Math.max(0,e.syncOffset(t));(E-=(E-k)%Fn)<t.byteLength&&!a&&(this.remainderData=new Uint8Array(t.buffer,E,t.buffer.byteLength-E));for(var T=0,S=k;S<E;S+=Fn)if(71===t[S]){var A=!!(64&t[S+1]),L=Un(t,S),b=void 0;if((48&t[S+3])>>4>1){if((b=S+5+t[S+4])===S+Fn)continue}else b=S+4;switch(L){case c:if(A){if(h&&(i=Vn(h,this.logger))){if(null===this.videoParser)switch(s.segmentCodec){case"avc":this.videoParser=new Mn;break;case"hevc":this.videoParser=new On}null!==this.videoParser&&this.videoParser.parsePES(s,u,i,!1)}h={data:[],size:0}}h&&(h.data.push(t.subarray(b,S+Fn)),h.size+=S+Fn-b);break;case d:if(A){if(v&&(i=Vn(v,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,i);break;case"mp3":this.parseMPEGPES(o,i);break;case"ac3":this.parseAC3PES(o,i)}v={data:[],size:0}}v&&(v.data.push(t.subarray(b,S+Fn)),v.size+=S+Fn-b);break;case f:A&&(g&&(i=Vn(g,this.logger))&&this.parseID3PES(l,i),g={data:[],size:0}),g&&(g.data.push(t.subarray(b,S+Fn)),g.size+=S+Fn-b);break;case 0:A&&(b+=t[b]+1),y=this._pmtId=Bn(t,b);break;case y:var R,I;A&&(b+=t[b]+1);var D=Gn(t,b,this.typeSupported,n,this.observer,this.logger);(c=D.videoPid)>0&&(s.pid=c,s.segmentCodec=D.segmentVideoCodec),(d=D.audioPid)>0&&(o.pid=d,o.segmentCodec=D.segmentAudioCodec),(f=D.id3Pid)>0&&(l.pid=f),null===p||m||(this.logger.warn(py(R=py(I="MPEG-TS PMT found at ".concat(S," after unknown PID '")).call(I,p,"'. Backtracking to sync byte @")).call(R,k," to parse all TS packets.")),p=null,S=k-188),m=this.pmtParsed=!0;break;case 17:case 8191:break;default:p=L}}else T++;T>0&&Kn(this.observer,new Error("Found ".concat(T," TS packet/s that do not start with 0x47")),void 0,this.logger),s.pesData=h,o.pesData=v,l.pesData=g;var w={audioTrack:o,videoTrack:s,id3Track:l,textTrack:u};return a&&this.extractRemainingSamples(w),w}},{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,i=e.videoTrack,n=e.id3Track,a=e.textTrack,s=i.pesData,o=r.pesData,l=n.pesData;if(s&&(t=Vn(s,this.logger))){if(null===this.videoParser)switch(i.segmentCodec){case"avc":this.videoParser=new Mn;break;case"hevc":this.videoParser=new On}null!==this.videoParser&&(this.videoParser.parsePES(i,a,t,!0),i.pesData=null)}else i.pesData=s;if(o&&(t=Vn(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=Vn(l,this.logger))?(this.parseID3PES(n,t),n.pesData=null):n.pesData=l}},{key:"demuxSampleAes",value:function(e,t,r){var i=this.demux(e,r,!0,!this.config.progressive),n=this.sampleAes=new Pn(this.observer,this.config,t);return this.decrypt(i,n)}},{key:"decrypt",value:function(e,t){return new RR((function(r){var i=e.audioTrack,n=e.videoTrack;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,(function(){n.samples?t.decryptAvcSamples(n.samples,0,0,(function(){r(e)})):r(e)})):n.samples&&t.decryptAvcSamples(n.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,i,n,a=0,s=this.aacOverFlow,o=t.data;if(s){this.aacOverFlow=null;var l=s.missing,u=s.sample.unit.byteLength;if(-1===l)o=$t(s.sample.unit,o);else{var c=u-l;s.sample.unit.set(o.subarray(0,l),c),e.samples.push(s.sample),a=s.missing}}for(r=a,i=o.length;r<i-1&&!Qi(o,r);r++);if(r!==a){var h,d=r<i-1;if(h=d?"AAC PES did not start with ADTS header,offset:".concat(r):"No ADTS header found in AAC PES",Kn(this.observer,new Error(h),d,this.logger),!d)return}if(Ji(e,this.observer,o,r,this.audioCodec),void 0!==t.pts)n=t.pts;else{if(!s)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var f=Zi(e.samplerate);n=s.sample.pts+f}for(var v,g=0;r<i;){if(r+=(v=en(e,o,r,n,g)).length,v.missing){this.aacOverFlow=v;break}for(g++;r<i-1&&!Qi(o,r);r++);}}},{key:"parseMPEGPES",value:function(e,t){var r=t.data,i=r.length,n=0,a=0,s=t.pts;if(void 0!==s)for(;a<i;)if(Ln(r,a)){var o=Tn(e,r,a,s,n);if(!o)break;a+=o.length,n++}else a++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}},{key:"parseAC3PES",value:function(e,t){var r=t.data,i=t.pts;if(void 0!==i)for(var n,a=r.length,s=0,o=0;o<a&&(n=Dn(e,r,o,i,s++))>0;)o+=n;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?dn.emsg:dn.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 i=e.syncOffset(t);return i>0&&r.warn("MPEG2-TS detected but first sync word found @ offset ".concat(i)),-1!==i}},{key:"syncOffset",value:function(e){for(var t=e.length,r=Math.min(940,t-Fn)+1,i=0;i<r;){for(var n=!1,a=-1,s=0,o=i;o<t;o+=Fn){if(71!==e[o]||t-o!==Fn&&71!==e[o+Fn]){if(s)return-1;break}if(s++,-1===a&&0!==(a=o)&&(r=Math.min(a+18612,e.length-Fn)+1),n||(n=0===Un(e,o)),n&&s>1&&(0===a&&s>2||o+Fn>r))return a}i++}return-1}},{key:"createTrack",value:function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Ot[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}}]),e}();function Un(e,t){return((31&e[t+1])<<8)+e[t+2]}function Bn(e,t){return(31&e[t+10])<<8|e[t+11]}function Gn(e,t,r,i,n,a){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=Un(e,t),u=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!i){Hn("ADTS AAC",a);break}case 15:-1===s.audioPid&&(s.audioPid=l);break;case 21:-1===s.id3Pid&&(s.id3Pid=l);break;case 219:if(!i){Hn("H.264",a);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"):a.log("MPEG audio found, not supported in this browser");break;case 193:if(!i){Hn("AC-3",a);break}case 129:r.ac3?-1===s.audioPid&&(s.audioPid=l,s.segmentAudioCodec="ac3"):a.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===s.audioPid&&u>0)for(var c=t+5,h=u;h>2;){106===e[c]&&(!0!==r.ac3?a.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=l,s.segmentAudioCodec="ac3"));var d=e[c+1]+2;c+=d,h-=d}break;case 194:case 135:return Kn(n,new Error("Unsupported EC-3 in M2TS found"),void 0,a),s;case 36:-1===s.videoPid&&(s.videoPid=l,s.segmentVideoCodec="hevc",a.log("HEVC in M2TS found"))}t+=u+5}return s}function Kn(e,t,r,i){i.warn("parsing error: ".concat(t.message)),e.emit(O.ERROR,O.ERROR,{type:x.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,error:t,reason:t.message})}function Hn(e,t){t.log("".concat(e," with AES-128-CBC encryption found in unencrypted stream"))}function Vn(e,t){var r,i,n,a,s,o=0,l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=$t(l[0],l[1]),UE(l).call(l,1,1);if(1===((r=l[0])[0]<<16)+(r[1]<<8)+r[2]){if((i=(r[4]<<8)+r[5])&&i>e.size-6)return null;var u=r[7];192&u&&(a=536870912*(14&r[9])+4194304*(255&r[10])+16384*(254&r[11])+128*(255&r[12])+(254&r[13])/2,64&u?a-(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((a-s)/9e4),"s delta between PTS and DTS, align them")),a=s):s=a);var c=(n=r[8])+9;if(e.size<=c)return null;e.size-=c;for(var h=new Uint8Array(e.size),d=0,f=l.length;d<f;d++){var v=(r=l[d]).byteLength;if(c){if(c>v){c-=v;continue}r=r.subarray(c),v-=c,c=0}h.set(r,o),o+=v}return i&&(i-=n+3),{data:h,pts:a,dts:s,len:i}}return null}var jn=function(){function e(){qm(this,e)}return Xm(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}(),Yn=Math.pow(2,32)-1,Wn=function(){function e(){qm(this,e)}return Xm(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]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:i};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,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,n))}},{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var n=8,a=r.length,s=a;a--;)n+=r[a].byteLength;var o=new Uint8Array(n);for(o[0]=n>>24&255,o[1]=n>>16&255,o[2]=n>>8&255,o[3]=255&n,o.set(e,4),a=0,n=8;a<s;a++)o.set(r[a],n),n+=r[a].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 i=Math.floor(r/(Yn+1)),n=Math.floor(r%(Yn+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,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,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,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))}},{key:"moov",value:function(t){for(var r,i,n=t.length,a=[];n--;)a[n]=e.trak(t[n]);return e.box.apply(null,py(r=py(i=[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)]).call(i,a)).call(r,e.mvex(t)))}},{key:"mvex",value:function(t){for(var r,i=t.length,n=[];i--;)n[i]=e.trex(t[i]);return e.box.apply(null,py(r=[e.types.mvex]).call(r,n))}},{key:"mvhd",value:function(t,r){r*=t;var i=Math.floor(r/(Yn+1)),n=Math.floor(r%(Yn+1)),a=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,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,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,a)}},{key:"sdtp",value:function(t){var r,i,n=t.samples||[],a=new Uint8Array(4+n.length);for(r=0;r<n.length;r++)i=V_(n[r]),a[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return e.box(e.types.sdtp,a)}},{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,i,n,a,s,o,l=[],u=[];for(a=0;a<t.sps.length;a++)o=(s=t.sps[a]).byteLength,l.push(o>>>8&255),l.push(255&o),l=py(l).call(l,uy(Array.prototype).call(s));for(a=0;a<t.pps.length;a++)o=(s=t.pps[a]).byteLength,u.push(o>>>8&255),u.push(255&o),u=py(u).call(u,uy(Array.prototype).call(s));var c=e.box(e.types.avcC,new Uint8Array(py(r=py(i=py(n=[1,l[3],l[4],l[5],255,224|t.sps.length]).call(n,l)).call(i,[t.pps.length])).call(r,u))),h=t.width,d=t.height,f=t.pixelRatio[0],v=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]),c,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,v>>24,v>>16&255,v>>8&255,255&v])))}},{key:"esds",value:function(e){var t,r=e.config;return new Uint8Array(py(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,pf(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,i=t.duration*t.timescale,n=t.width,a=t.height,s=Math.floor(i/(Yn+1)),o=Math.floor(i%(Yn+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,n>>8&255,255&n,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(t,r){var i=e.sdtp(t),n=t.id,a=Math.floor(r/(Yn+1)),s=Math.floor(r%(Yn+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,s>>24,s>>16&255,s>>8&255,255&s])),e.trun(t,i.length+16+20+8+16+8+8),i)}},{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 i,n,a,s,o,l,u=t.samples||[],c=u.length,h=12+16*c,d=new Uint8Array(h);for(r+=8+h,d.set(["video"===t.type?1:0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<c;i++)a=(n=u[i]).duration,s=n.size,o=V_(n),l=n.cts,d.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,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*i);return e.box(e.types.trun,d)}},{key:"initSegment",value:function(t){e.types||e.init();var r=e.moov(t);return $t(e.FTYP,r)}},{key:"hvc1",value:function(t){for(var r=t.params,i=[t.vps,t.sps,t.pps],n=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,Ck(r.frame_rate.fps),3|r.temporal_id_nested<<2|r.num_temporal_layers<<3|(r.frame_rate.fixed?64:0),i.length]),a=n.length,s=0;s<i.length;s+=1){a+=3;for(var o=0;o<i[s].length;o+=1)a+=2+i[s][o].length}var l=new Uint8Array(a);l.set(n,0),a=n.length;for(var u=i.length-1,c=0;c<i.length;c+=1){l.set(new Uint8Array([32+c|(c===u?128:0),0,i[c].length]),a),a+=3;for(var h=0;h<i[c].length;h+=1)l.set(new Uint8Array([i[c][h].length>>8,255&i[c][h].length]),a),a+=2,l.set(i[c][h],a),a+=i[c][h].length}var d=e.box(e.types.hvcC,l),f=t.width,v=t.height,g=t.pixelRatio[0],p=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,v>>8&255,255&v,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([g>>24,g>>16&255,g>>8&255,255&g,p>>24,p>>16&255,p>>8&255,255&p])))}}]),e}();function qn(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 zn(e){return qn(e,1e3,1/9e4,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}Wn.types=void 0,Wn.HDLR_TYPES=void 0,Wn.STTS=void 0,Wn.STSC=void 0,Wn.STCO=void 0,Wn.STSZ=void 0,Wn.VMHD=void 0,Wn.SMHD=void 0,Wn.STSD=void 0,Wn.FTYP=void 0,Wn.DINF=void 0;var Xn,Qn=null,$n=null,Jn=function(){function e(t,r,i,n){if(qm(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=i,this.logger=n,this.ISGenerated=!1,null===Qn){var a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Qn=a?Ck(a[1]):0}if(null===$n){var s=navigator.userAgent.match(/Safari\/(\d+)/i);$n=s?Ck(s[1]):0}}return Xm(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,i=eS(e).call(e,(function(e,i){var n=i.pts,a=n-e;return a<-4294967296&&(t=!0,a=(n=Zn(n,r))-e),a>0?e:n}),r);return t&&this.logger.debug("PTS rollover detected"),i}},{key:"remux",value:function(e,t,r,i,n,a,s,o){var l,u,c,h,d,f,v=n,g=n,p=e.pid>-1,m=t.pid>-1,y=t.samples.length,E=e.samples.length>0,k=s&&y>0||y>1;if((!p||E)&&(!m||k)||this.ISGenerated||s){if(this.ISGenerated){var T,S,A,L,b=this.videoTrackConfig;(b&&(t.width!==b.width||t.height!==b.height||(null==(T=t.pixelRatio)?void 0:T[0])!==(null==(S=b.pixelRatio)?void 0:S[0])||(null==(A=t.pixelRatio)?void 0:A[1])!==(null==(L=b.pixelRatio)?void 0:L[1]))||!b&&k||null===this.nextAudioPts&&E)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,n,a));var R,I=this.isVideoContiguous,D=-1;if(k&&(D=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!I&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,D>0){var w,_;this.logger.warn(py(w="[mp4-remuxer]: Dropped ".concat(D," out of ")).call(w,y," video samples due to a missing keyframe"));var P=this.getVideoStartPts(t.samples);t.samples=uy(_=t.samples).call(_,D),t.dropped+=D,R=g+=(t.samples[0].pts-P)/t.inputTimeScale}else-1===D&&(this.logger.warn("[mp4-remuxer]: No keyframe found out of ".concat(y," video samples")),f=!1);if(this.ISGenerated){if(E&&k){var C=this.getVideoStartPts(t.samples),x=(Zn(e.samples[0].pts,C)-C)/t.inputTimeScale;v+=Math.max(0,x),g+=Math.max(0,-x)}if(E){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),c=this.generateIS(e,t,n,a)),u=this.remuxAudio(e,v,this.isAudioContiguous,a,m||k||o===K?g:void 0),k){var M=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(e,t,n,a)),l=this.remuxVideo(t,g,I,M)}}else k&&(l=this.remuxVideo(t,g,I,0));l&&(l.firstKeyFrame=D,l.independent=-1!==D,l.firstKeyFramePTS=R)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(d=ea(r,n,this._initPTS,this._initDTS)),i.samples.length&&(h=ta(i,n,this._initPTS))),{audio:u,video:l,initSegment:c,independent:f,text:h,id3:d}}},{key:"generateIS",value:function(e,t,r,i){var n,a,s,o=e.samples,l=t.samples,u=this.typeSupported,c={},h=this._initPTS,d=!h||i,f="audio/mp4";if(d&&(n=a=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":u.mpeg?(f="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}c.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&u.mpeg?new Uint8Array(0):Wn.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(s=e.inputTimeScale,h&&s===h.timescale?d=!1:n=a=o[0].pts-Math.round(s*r))}if(t.sps&&t.pps&&l.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Wn.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(s=t.inputTimeScale,h&&s===h.timescale)d=!1;else{var v=this.getVideoStartPts(l),g=Math.round(s*r);a=Math.min(a,Zn(l[0].dts,v)-g),n=Math.min(n,v-g)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Qm(c).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:n,timescale:s},this._initDTS={baseTime:a,timescale:s}):n=s=void 0,{tracks:c,initPTS:n,timescale:s}}},{key:"remuxVideo",value:function(e,t,r,i){var n,a,s=e.inputTimeScale,o=e.samples,l=[],u=o.length,c=this._initPTS,h=this.nextAvcDts,d=8,f=this.videoSampleDuration,v=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,p=!1;if(!r||null===h){var m=t*s,y=o[0].pts-Zn(o[0].dts,o[0].pts);Qn&&null!==h&&Math.abs(m-y-h)<15e3?r=!0:h=m-y}for(var E=c.baseTime*s/c.timescale,k=0;k<u;k++){var T=o[k];T.pts=Zn(T.pts-E,h),T.dts=Zn(T.dts-E,h),T.dts<o[k>0?k-1:k].dts&&(p=!0)}p&&gT(o).call(o,(function(e,t){var r=e.dts-t.dts,i=e.pts-t.pts;return r||i})),n=o[0].dts;var S=(a=o[o.length-1].dts)-n,A=S?Math.round(S/(u-1)):f||e.inputTimeScale/30;if(r){var L,b,R,I,D,w,_=n-h,P=_>A,C=_<-1;if((P||C)&&(P?this.logger.warn(py(L=py(b=py(R="".concat((e.segmentCodec||"").toUpperCase(),": ")).call(R,zn(_,!0)," ms (")).call(b,_,"dts) hole between fragments detected at ")).call(L,t.toFixed(3))):this.logger.warn(py(I=py(D=py(w="".concat((e.segmentCodec||"").toUpperCase(),": ")).call(w,zn(-_,!0)," ms (")).call(D,_,"dts) overlapping between fragments detected at ")).call(I,t.toFixed(3))),!C||h>=o[0].pts||Qn)){var F,N;n=h;var U=o[0].pts-_;if(P)o[0].dts=n,o[0].pts=U;else for(var B=!0,G=0;G<o.length&&!(o[G].dts>U&&B);G++){var K=o[G].pts;if(o[G].dts-=_,o[G].pts-=_,G<o.length-1){var H=o[G+1].pts;B=H<=o[G].pts==H<=K}}this.logger.log(py(F=py(N="Video: Initial PTS/DTS adjusted: ".concat(zn(U,!0),"/")).call(N,zn(n,!0),", delta: ")).call(F,zn(_,!0)," ms"))}}for(var V=0,j=0,Y=n=Math.max(0,n),q=0;q<u;q++){for(var z=o[q],X=z.units,Q=X.length,$=0,J=0;J<Q;J++)$+=X[J].data.length;j+=$,V+=Q,z.length=$,z.dts<Y?(z.dts=Y,Y+=A/4|0||1):Y=z.dts,v=Math.min(z.pts,v),g=Math.max(z.pts,g)}a=o[u-1].dts;var Z,ee=j+4*V+8;try{Z=new Uint8Array(ee)}catch(Pe){return void this.observer.emit(O.ERROR,O.ERROR,{type:x.MUX_ERROR,details:M.REMUX_ALLOC_ERROR,fatal:!1,error:Pe,bytes:ee,reason:"fail allocating video mdat ".concat(ee)})}var te=new DataView(Z.buffer);te.setUint32(0,ee),Z.set(Wn.types.mdat,4);for(var re=!1,ie=Number.POSITIVE_INFINITY,ne=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,se=Number.NEGATIVE_INFINITY,oe=0;oe<u;oe++){for(var le=o[oe],ue=le.units,ce=void 0,he=0,de=0,fe=ue.length;de<fe;de++){var ve=ue[de],ge=ve.data,pe=ve.data.byteLength;te.setUint32(d,pe),d+=4,Z.set(ge,d),d+=pe,he+=4+pe}if(oe<u-1)f=o[oe+1].dts-le.dts,ce=o[oe+1].pts-le.pts;else{var me=this.config,ye=oe>0?le.dts-o[oe-1].dts:A;if(ce=oe>0?le.pts-o[oe-1].pts:A,me.stretchShortVideoTrack&&null!==this.nextAudioPts){var Ee,ke=Math.floor(me.maxBufferHole*s),Te=(i?v+i*s:this.nextAudioPts)-le.pts;Te>ke?((f=Te-ye)<0?f=ye:re=!0,this.logger.log(py(Ee="[mp4-remuxer]: It is approximately ".concat(Te/90," ms to the next segment; using duration ")).call(Ee,f/90," ms for the last video frame."))):f=ye}else f=ye}var Se=Math.round(le.pts-le.dts);ie=Math.min(ie,f),ae=Math.max(ae,f),ne=Math.min(ne,ce),se=Math.max(se,ce),l.push(new ra(le.key,f,he,Se))}if(l.length)if(Qn){if(Qn<70){var Ae=V_(l[0]);Ae.dependsOn=2,Ae.isNonSync=0}}else if($n&&se-ne<ae-ie&&A/ae<.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 Le=n,be=0,Re=l.length;be<Re;be++){var Ie=Le+l[be].duration,De=Le+l[be].cts;if(be<Re-1){var we=Ie+l[be+1].cts;l[be].duration=we-De}else l[be].duration=be?l[be-1].duration:A;l[be].cts=0,Le=Ie}}f=re||!f?A:f,this.nextAvcDts=h=a+f,this.videoSampleDuration=f,this.isVideoContiguous=!0;var _e={data1:Wn.moof(e.sequenceNumber++,n,W({},e,{samples:l})),data2:Z,startPTS:v/s,endPTS:(g+f)/s,startDTS:n/s,endDTS:h/s,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,_e}},{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,i,n){var a=e.inputTimeScale,s=a/(e.samplerate?e.samplerate:a),o=this.getSamplesPerFrame(e),l=o*s,u=this._initPTS,c="mp3"===e.segmentCodec&&this.typeSupported.mpeg,h=[],d=void 0!==n,f=e.samples,v=c?0:8,g=this.nextAudioPts||-1,p=t*a,m=u.baseTime*a/u.timescale;if(this.isAudioContiguous=r=r||f.length&&g>0&&(i&&Math.abs(p-g)<9e3||Math.abs(Zn(f[0].pts-m,p)-g)<20*l),ey(f).call(f,(function(e){e.pts=Zn(e.pts-m,p)})),!r||g<0){if(!(f=Jm(f).call(f,(function(e){return e.pts>=0}))).length)return;g=0===n?0:i&&!d?Math.max(0,p):f[0].pts}if("aac"===e.segmentCodec)for(var y=this.config.maxAudioFramesDrift,E=0,k=g;E<f.length;E++){var T,S=f[E],A=S.pts,L=A-k,b=Math.abs(1e3*L/a);if(L<=-y*l&&d)0===E&&(this.logger.warn(py(T="Audio frame @ ".concat((A/a).toFixed(3),"s overlaps nextAudioPts by ")).call(T,Math.round(1e3*L/a)," ms.")),this.nextAudioPts=g=k=A);else if(L>=y*l&&b<1e4&&d){var R,I,D=Math.round(L/l);(k=A-D*l)<0&&(D--,k+=l),0===E&&(this.nextAudioPts=g=k),this.logger.warn(py(R=py(I="[mp4-remuxer]: Injecting ".concat(D," audio frame @ ")).call(I,(k/a).toFixed(3),"s due to ")).call(R,Math.round(1e3*L/a)," ms gap."));for(var w=0;w<D;w++){var _=Math.max(k,0),P=jn.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);P||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),P=S.unit.subarray()),UE(f).call(f,E,0,{unit:P,pts:_}),k+=l,E++}}S.pts=k,k+=l}for(var C,F=null,N=null,U=0,B=f.length;B--;)U+=f[B].unit.byteLength;for(var G=0,K=f.length;G<K;G++){var H=f[G],V=H.unit,j=H.pts;if(null!==N)h[G-1].duration=Math.round((j-N)/s);else{if(r&&"aac"===e.segmentCodec&&(j=g),F=j,!(U>0))return;U+=v;try{C=new Uint8Array(U)}catch(Z){return void this.observer.emit(O.ERROR,O.ERROR,{type:x.MUX_ERROR,details:M.REMUX_ALLOC_ERROR,fatal:!1,error:Z,bytes:U,reason:"fail allocating audio mdat ".concat(U)})}c||(new DataView(C.buffer).setUint32(0,U),C.set(Wn.types.mdat,4))}C.set(V,v);var Y=V.byteLength;v+=Y,h.push(new ra(!0,o,Y,0)),N=j}var q=h.length;if(q){var z=h[h.length-1];this.nextAudioPts=g=N+s*z.duration;var X=c?new Uint8Array(0):Wn.moof(e.sequenceNumber++,F/s,W({},e,{samples:h}));e.samples=[];var Q=F/a,$=g/a,J={data1:X,data2:C,startPTS:Q,endPTS:$,startDTS:Q,endDTS:$,type:"audio",hasAudio:!0,hasVideo:!1,nb:q};return this.isAudioContiguous=!0,J}}}]),e}();function Zn(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 ea(e,t,r,i){var n=e.samples.length;if(n){for(var a=e.inputTimeScale,s=0;s<n;s++){var o=e.samples[s];o.pts=Zn(o.pts-r.baseTime*a/r.timescale,t*a)/a,o.dts=Zn(o.dts-i.baseTime*a/i.timescale,t*a)/a}var l=e.samples;return e.samples=[],{samples:l}}}function ta(e,t,r){var i,n=e.samples.length;if(n){for(var a=e.inputTimeScale,s=0;s<n;s++){var o=e.samples[s];o.pts=Zn(o.pts-r.baseTime*a/r.timescale,t*a)/a}gT(i=e.samples).call(i,(function(e,t){return e.pts-t.pts}));var l=e.samples;return e.samples=[],{samples:l}}}var ra=Xm((function e(t,r,i,n){qm(this,e),this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=r,this.size=i,this.cts=n,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}));function ia(e,t){var r=null==e?void 0:e.codec;return r&&r.length>4?r:t===Rt?"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 na;Xn=pE(na=self.performance.now).call(na,self.performance)}catch(Ho){Xn=w_}var aa=[{demux:function(){function e(t,r){qm(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 Xm(e,[{key:"resetTimeStamp",value:function(){}},{key:"resetInitSegment",value:function(e,t,r,i){var n=this.videoTrack=fn("video",1),a=this.audioTrack=fn("audio",1),s=this.txtTrack=fn("text",1);if(this.id3Track=fn("id3",1),this.timeOffset=0,null!=e&&e.byteLength){var o=jt(e);if(o.video){var l=o.video,u=l.id,c=l.timescale,h=l.codec;n.id=u,n.timescale=s.timescale=c,n.codec=h}if(o.audio){var d=o.audio,f=d.id,v=d.timescale,g=d.codec;a.id=f,a.timescale=v,a.codec=g}s.id=Ot.text,n.sampleDuration=0,n.duration=a.duration=i}}},{key:"resetContiguity",value:function(){this.remainderData=null}},{key:"demux",value:function(e,t){this.timeOffset=t;var r=e,i=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=$t(this.remainderData,e));var a=function(e){var t={valid:null,remainder:null},r=Ht(e,["moof"]);if(r.length<2)return t.remainder=e,t;var i=r[r.length-1];return t.valid=dt(e,0,i.byteOffset-8),t.remainder=dt(e,i.byteOffset-8),t}(r);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=r;var s=this.extractID3Track(i,t);return n.samples=Jt(t,i),{videoTrack:i,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 i=this.extractID3Track(t,this.timeOffset);return r.samples=Jt(e,t),{videoTrack:t,audioTrack:fn(),id3Track:i,textTrack:fn()}}},{key:"extractID3Track",value:function(e,t){var r=this,i=this.id3Track;if(e.samples.length){var n=Ht(e.samples,["emsg"]);n&&ey(n).call(n,(function(e){var n,a=function(e){var t=e[0],r="",i="",n=0,a=0,s=0,o=0,l=0,u=0;if(0===t){for(;"\0"!==Ft(e.subarray(u,u+1));)r+=Ft(e.subarray(u,u+1)),u+=1;for(r+=Ft(e.subarray(u,u+1)),u+=1;"\0"!==Ft(e.subarray(u,u+1));)i+=Ft(e.subarray(u,u+1)),u+=1;i+=Ft(e.subarray(u,u+1)),u+=1,n=Ut(e,12),a=Ut(e,16),o=Ut(e,20),l=Ut(e,24),u=28}else if(1===t){n=Ut(e,u+=4);var c=Ut(e,u+=4),h=Ut(e,u+=4);for(u+=4,s=Math.pow(2,32)*c+h,P(s)||(s=bT,te.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ut(e,u),l=Ut(e,u+=4),u+=4;"\0"!==Ft(e.subarray(u,u+1));)r+=Ft(e.subarray(u,u+1)),u+=1;for(r+=Ft(e.subarray(u,u+1)),u+=1;"\0"!==Ft(e.subarray(u,u+1));)i+=Ft(e.subarray(u,u+1)),u+=1;i+=Ft(e.subarray(u,u+1)),u+=1}return{schemeIdUri:r,value:i,timeScale:n,presentationTime:s,presentationTimeDelta:a,eventDuration:o,id:l,payload:e.subarray(u,e.byteLength)}}(e);if(wn.test(a.schemeIdUri)){var s=_n(a,t),o=4294967295===a.eventDuration?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;o<=.001&&(o=Number.POSITIVE_INFINITY);var l=a.payload;i.samples.push({data:l,len:l.byteLength,dts:s,pts:s,type:dn.emsg,duration:o})}else if(r.config.enableEmsgKLVMetadata&&AS(n=a.schemeIdUri).call(n,"urn:misb:KLV:bin:1910.1")){var u=_n(a,t);i.samples.push({data:a.payload,len:a.payload.byteLength,dts:u,pts:u,type:dn.misbklv,duration:Number.POSITIVE_INFINITY})}}))}return i}},{key:"demuxSampleAes",value:function(e,t,r){return RR.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 i=Ut(e,r);if(i>8&&109===e[r+4]&&111===e[r+5]&&111===e[r+6]&&102===e[r+7])return!0;r=i>1?r+i:t}return!1}(e)}}]),e}(),remux:function(){function e(t,r,i,n){qm(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=n}return Xm(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,i){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(function(e,t,r){if(!e||!t)return e;var i=t.keyId;return i&&t.isCommonEncryption&&ey(r=Ht(e,["moov","trak"])).call(r,(function(e){var t=Ht(e,["mdia","minf","stbl","stsd"])[0].subarray(8),r=Ht(t,["enca"]),n=r.length>0;n||(r=Ht(t,["encv"])),ey(r).call(r,(function(e){var t;ey(t=Ht(n?e.subarray(28):e.subarray(78),["sinf"])).call(t,(function(e){var t=Xt(e);if(t){var r,a,s=t.subarray(8,24);Sy(s).call(s,(function(e){return 0!==e}))||(te.log(py(r=py(a="[eme] Patching keyId in 'enc".concat(n?"a":"v",">sinf>>tenc' box: ")).call(a,pt(s)," -> ")).call(r,pt(i))),t.set(i,8))}}))}))})),e}(e,i)),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 i=this.initData=jt(e);i.audio&&(t=ia(i.audio,Rt)),i.video&&(r=ia(i.video,It));var n={};i.audio&&i.video?n.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:e,id:"main"}:i.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?n.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=n}},{key:"remux",value:function(e,t,r,i,n,a){var s,o,l,u,c=this.initPTS,h=this.lastEndTime,d={audio:void 0,video:void 0,text:i,id3:r,initSegment:void 0};_(h)||(h=this.lastEndTime=n||0);var f=t.samples;if(null==f||!f.length)return d;var v={initPTS:void 0,timescale:1},g=this.initData;if(null!=(l=g)&&l.length||(this.generateInitSegment(f),g=this.initData),null==(u=g)||!u.length)return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),d;this.emitInitSegment&&(v.tracks=this.initTracks,this.emitInitSegment=!1);var p,m,y=function(e,t){for(var r=0,i=0,n=0,a=Ht(e,["moof","traf"]),s=0;s<a.length;s++){var o=a[s],l=Ht(o,["tfhd"])[0],u=t[Ut(l,4)];if(u){var c=u.default,h=Ut(l,0)|(null==c?void 0:V_(c)),d=null==c?void 0:c.duration;8&h&&(d=Ut(l,2&h?12:8));for(var f=u.timescale||9e4,v=Ht(o,["trun"]),g=0;g<v.length;g++)!(r=Qt(v[g]))&&d&&(r=d*Ut(v[g],4)),u.type===It?i+=r/f:u.type===Rt&&(n+=r/f)}}if(0===i&&0===n){for(var p=1/0,m=0,y=0,E=Ht(e,["sidx"]),k=0;k<E.length;k++){var T=Vt(E[k]);if(null!=T&&T.references){var S;p=Math.min(p,T.earliestPresentationTime/T.timescale);var A=eS(S=T.references).call(S,(function(e,t){return e+t.info.duration||0}),0);y=(m=Math.max(m,A+T.earliestPresentationTime/T.timescale))-p}}if(y&&_(y))return y}return i||n}(f,g),E=(p=g,eS(m=Ht(f,["moof","traf"])).call(m,(function(e,t){var r,i=Ht(t,["tfdt"])[0],n=i[0],a=eS(r=Ht(t,["tfhd"])).call(r,(function(e,t){var r=Ut(t,4),a=p[r];if(a){var s=Ut(i,4);if(1===n){if(s===xt)return te.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;s*=xt+1,s+=Ut(i,8)}var o=s/(a.timescale||9e4);if(_(o)&&(null===e||o<e))return o}return e}),null);return null!==a&&_(a)&&(null===e||a<e)?a:e}),null)),k=null===E?n:E;(function(e,t,r,i){if(null===e)return!0;var n=Math.max(i,1),a=t-e.baseTime/e.timescale;return Math.abs(a-r)>n}(c,k,n,y)||v.timescale!==c.timescale&&a)&&(v.initPTS=k-n,c&&1===c.timescale&&this.logger.warn(py(s=py(o="Adjusting initPTS @".concat(n," from ")).call(o,c.baseTime/c.timescale," to ")).call(s,v.initPTS)),this.initPTS=c={baseTime:v.initPTS,timescale:1});var T=e?k-c.baseTime/c.timescale:h,S=T+y;!function(e,t,r,i){ey(i=Ht(t,["moof","traf"])).call(i,(function(t){var i;ey(i=Ht(t,["tfhd"])).call(i,(function(i){var n,a=Ut(i,4),s=e[a];if(s){var o=s.timescale||9e4;ey(n=Ht(t,["tfdt"])).call(n,(function(e){var t=e[0],i=r*o;if(i){var n=Ut(e,4);if(0===t)n-=i,Kt(e,4,n=Math.max(n,0));else{n*=Math.pow(2,32),n+=Ut(e,8),n-=i,n=Math.max(n,0);var a=Math.floor(n/(xt+1)),s=Math.floor(n%(xt+1));Kt(e,4,a),Kt(e,8,s)}}}))}}))}))}(g,f,c.baseTime/c.timescale),y>0?this.lastEndTime=S:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var A=!!g.audio,L=!!g.video,b="";A&&(b+="audio"),L&&(b+="video");var R={data1:f,startPTS:T,startDTS:T,endPTS:S,endDTS:S,type:b,hasAudio:A,hasVideo:L,nb:1,dropped:0};return d.audio="audio"===R.type?R:void 0,d.video="audio"!==R.type?R:void 0,d.initSegment=v,d.id3=ea(r,n,c,c),i.samples.length&&(d.text=ta(i,n,c)),d}}]),e}()},{demux:Nn,remux:Jn},{demux:function(e){Ym(r,e);var t=Wm(r);function r(e,i){var n;return qm(this,r),(n=t.call(this)).observer=void 0,n.config=void 0,n.observer=e,n.config=i,n}return Xm(r,[{key:"resetInitSegment",value:function(e,t,i,n){Qf(Xf(r.prototype),"resetInitSegment",this).call(this,e,t,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return(i=t)+5<(r=e).length&&qi(r,i)&&Xi(r,i)<=r.length-i;var r,i}},{key:"appendFrame",value:function(e,t,r){Ji(e,this.observer,t,r,e.manifestCodec);var i=en(e,t,r,this.basePTS,this.frameIndex);if(i&&0===i.missing)return i}}],[{key:"probe",value:function(e,t){if(!e)return!1;var r=Wi(e,0),i=(null==r?void 0:r.length)||0;if(bn(e,i))return!1;for(var n=e.length;i<n;i++)if($i(e,i))return t.log("ADTS sync word found !"),!0;return!1}}]),r}(vn),remux:Jn},{demux:function(e){Ym(r,e);var t=Wm(r);function r(){return qm(this,r),t.apply(this,arguments)}return Xm(r,[{key:"resetInitSegment",value:function(e,t,i,n){Qf(Xf(r.prototype),"resetInitSegment",this).call(this,e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return An(r=e,i=t)&&4<=r.length-i;var r,i}},{key:"appendFrame",value:function(e,t,r){if(null!==this.basePTS)return Tn(e,t,r,this.basePTS,this.frameIndex)}}],[{key:"probe",value:function(e){if(!e)return!1;var t=Wi(e,0),r=(null==t?void 0:t.length)||0;if(t&&11===e[r]&&119===e[r+1]&&void 0!==hn(t)&&Rn(e,r)<=16)return!1;for(var i=e.length;r<i;r++)if(bn(e,r))return te.log("MPEG Audio sync word found !"),!0;return!1}}]),r}(vn),remux:Jn}];UE(aa).call(aa,2,0,{demux:In,remux:Jn});var sa=function(){function e(t,r,i,n,a,s){qm(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=i,this.id=a,this.logger=s}return Xm(e,[{key:"configure",value:function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}},{key:"push",value:function(e,t,r,i){var n=this,a=r.transmuxing;a.executeStart=Xn();var s=new Uint8Array(e),o=this.currentTransmuxState,l=this.transmuxConfig;i&&(this.currentTransmuxState=i);var u,c,h=i||o,d=h.contiguous,f=h.discontinuity,v=h.trackSwitch,g=h.accurateTimeOffset,p=h.timeOffset,m=h.initSegmentChange,y=l.audioCodec,E=l.videoCodec,k=l.defaultInitPts,T=l.duration,S=l.initSegmentData,A=(u=t,c=null,s.byteLength>0&&null!=(null==u?void 0:u.key)&&null!==u.iv&&null!=u.method&&(c=u),c);if(A&&br(A.method)){var L=this.getDecrypter(),b=Rr(A.method);if(!L.isSync())return this.asyncResult=!0,this.decryptionPromise=L.webCryptoDecrypt(s,A.key.buffer,A.iv.buffer,b).then((function(e){var t=n.push(e,null,r);return n.decryptionPromise=null,t})),this.decryptionPromise;var R=L.softwareDecrypt(s,A.key.buffer,A.iv.buffer,b);if(r.part>-1){var I=L.flush();R=I?I.buffer:I}if(!R)return a.executeEnd=Xn(),oa(r);s=new Uint8Array(R)}var D=this.needsProbing(f,v);if(D){var w=this.configureTransmuxer(s);if(w)return this.logger.warn("[transmuxer] ".concat(w.message)),this.observer.emit(O.ERROR,O.ERROR,{type:x.MEDIA_ERROR,details:M.FRAG_PARSING_ERROR,fatal:!1,error:w,reason:w.message}),a.executeEnd=Xn(),oa(r)}(f||v||m||D)&&this.resetInitSegment(S,y,E,T,t),(f||m||D)&&this.resetInitialTimestamp(k),d||this.resetContiguity();var _=this.transmux(s,A,p,g,r);this.asyncResult=la(_);var P=this.currentTransmuxState;return P.contiguous=!0,P.discontinuity=!1,P.trackSwitch=!1,a.executeEnd=Xn(),_}},{key:"flush",value:function(e){var t=this,r=e.transmuxing;r.executeStart=Xn();var i=this.decrypter,n=this.currentTransmuxState,a=this.decryptionPromise;if(a)return this.asyncResult=!0,a.then((function(){return t.flush(e)}));var s=[],o=n.timeOffset;if(i){var l=i.flush();l&&s.push(this.push(l.buffer,null,e))}var u=this.demuxer,c=this.remuxer;if(!u||!c){r.executeEnd=Xn();var h=[oa(e)];return this.asyncResult?RR.resolve(h):h}var d=u.flush(o);return la(d)?(this.asyncResult=!0,d.then((function(r){return t.flushRemux(s,r,e),s}))):(this.flushRemux(s,d,e),this.asyncResult?RR.resolve(s):s)}},{key:"flushRemux",value:function(e,t,r){var i,n,a,s,o=t.audioTrack,l=t.videoTrack,u=t.id3Track,c=t.textTrack,h=this.currentTransmuxState,d=h.accurateTimeOffset,f=h.timeOffset;this.logger.log(py(i=py(n=py(a=py(s="[transmuxer.ts]: Flushed ".concat(this.id," sn: ")).call(s,r.sn)).call(a,r.part>-1?" part: "+r.part:""," of ")).call(n,this.id===G?"level":"track"," ")).call(i,r.level));var v=this.remuxer.remux(o,l,u,c,f,d,!0,this.id);e.push({remuxResult:v,chunkMeta:r}),r.transmuxing.executeEnd=Xn()}},{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,i,n){var a=this.demuxer,s=this.remuxer;a&&s&&(a.resetInitSegment(e,t,r,i),s.resetInitSegment(e,t,r,n))}},{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,i,n){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,r,i,n):this.transmuxUnencrypted(e,r,i,n)}},{key:"transmuxUnencrypted",value:function(e,t,r,i){var n=this.demuxer.demux(e,t,!1,!this.config.progressive),a=n.audioTrack,s=n.videoTrack,o=n.id3Track,l=n.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,l,t,r,!1,this.id),chunkMeta:i}}},{key:"transmuxSampleAes",value:function(e,t,r,i,n){var a=this;return this.demuxer.demuxSampleAes(e,t,r).then((function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,r,i,!1,a.id),chunkMeta:n}}))}},{key:"configureTransmuxer",value:function(e){for(var t,r=this.config,i=this.observer,n=this.typeSupported,a=0,s=aa.length;a<s;a++){var o;if(null!=(o=aa[a].demux)&&o.probe(e,this.logger)){t=aa[a];break}}if(!t)return new Error("Failed to find demuxer by probing fragment data");var l=this.demuxer,u=this.remuxer,c=t.remux,h=t.demux;u&&u instanceof c||(this.remuxer=new c(i,r,n,this.logger)),l&&l instanceof h||(this.demuxer=new h(i,r,n,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 nr(this.config)),e}}]),e}(),oa=function(e){return{remuxResult:{},chunkMeta:e}};function la(e){return"then"in e&&e.then instanceof Function}var ua=Xm((function e(t,r,i,n,a){qm(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=i,this.duration=n,this.defaultInitPts=a||null})),ca=Xm((function e(t,r,i,n,a,s){qm(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=i,this.trackSwitch=n,this.timeOffset=a,this.initSegmentChange=s})),ha=0,da=function(){function e(t,r,i,n){var a=this;qm(this,e),this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=ha++,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=a.hls;if(r&&null!=t&&t.event&&t.instanceNo===a.instanceNo)switch(t.event){case"init":var i,n=null==(i=a.workerContext)?void 0:i.objectURL;n&&e_.revokeObjectURL(n);break;case"transmuxComplete":a.handleTransmuxComplete(t.data);break;case"flush":a.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=a.frag,t.data.part=a.part,t.data.id=a.id,r.trigger(t.event,t.data)}},this.onWorkerError=function(e){var t,r;if(a.hls){var i=new Error(py(t=py(r="".concat(e.message," (")).call(r,e.filename,":")).call(t,e.lineno,")"));a.hls.config.enableWorker=!1,a.hls.logger.warn('Error in "'.concat(a.id,'" Web Worker, fallback to inline')),a.hls.trigger(O.ERROR,{type:x.OTHER_ERROR,details:M.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:i})}};var s=t.config;this.hls=t,this.id=r,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;var o=function(e,t){(t=t||{}).frag=a.frag||void 0,e===O.ERROR&&(t.parent=a.id,t.part=a.part,a.error=t.error),a.hls.trigger(e,t)};this.observer=new Gi,this.observer.on(O.FRAG_DECRYPTED,o),this.observer.on(O.ERROR,o);var l=ge(s.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){var u=this.hls.logger;if(s.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{var c;s.workerPath?(u.log(py(c="loading Web Worker ".concat(s.workerPath,' for "')).call(c,r,'"')),this.workerContext=function(e){var t=Hi[e];if(t)return t.clientCount++,t;var r=new e_(e,self.location.href).href,i={worker:new self.Worker(r),scriptURL:r,clientCount:1};return Hi[e]=i,i}(s.workerPath)):(u.log('injecting Web Worker for "'.concat(r,'"')),this.workerContext=function(){var e=Hi[Ki];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=e_.createObjectURL(t),i={worker:new self.Worker(r),objectURL:r,clientCount:1};return Hi[Ki]=i,i}());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:x_(s)})}catch(Ho){u.warn('Error setting up "'.concat(r,'" Web Worker, fallback to inline'),Ho),this.terminateWorker(),this.error=null,this.transmuxer=new sa(this.observer,l,s,"",r,t.logger)}return}}this.transmuxer=new sa(this.observer,l,s,"",r,t.logger)}return Xm(e,[{key:"reset",value:function(){if(this.frag=null,this.part=null,this.workerContext){var e=this.instanceNo;this.instanceNo=ha++;var t=this.hls.config,r=ge(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:r,id:this.id,config:x_(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=Hi[e||Ki];if(t&&1==t.clientCount--){var r=t.worker,i=t.objectURL;delete Hi[e||Ki],i&&e_.revokeObjectURL(i),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,i,n,a,s,o,l,u){var c,h,d=this;l.transmuxing.start=self.performance.now();var f=this.instanceNo,v=this.transmuxer,g=a?a.start:n.start,p=n.decryptdata,m=this.frag,y=!(m&&n.cc===m.cc),E=!(m&&l.level===m.level),k=m?l.sn-m.sn:-1,T=this.part?l.part-this.part.index:-1,S=0===k&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),A=!E&&(1===k||0===k&&(1===T||S&&T<=0)),L=self.performance.now();(E||k||0===n.stats.parsing.start)&&(n.stats.parsing.start=L),!a||!T&&A||(a.stats.parsing.start=L);var b=!(m&&(null==(c=n.initSegment)?void 0:c.url)===(null==(h=m.initSegment)?void 0:h.url)),R=new ca(y,A,o,E,g,b);if(!A||y||b){var I,D,w,_,P,C,x,M,O,F,N;this.hls.logger.log(py(I=py(D=py(w=py(_=py(P=py(C=py(x=py(M=py(O=py(F=py(N="[transmuxer-interface]: Starting new transmux session for ".concat(n.type," sn: ")).call(N,l.sn)).call(F,l.part>-1?" part: "+l.part:""," ")).call(O,this.id===G?"level":"track",": ")).call(M,l.level," id: ")).call(x,l.id,"\n discontinuity: ")).call(C,y,"\n trackSwitch: ")).call(P,E,"\n contiguous: ")).call(_,A,"\n accurateTimeOffset: ")).call(w,o,"\n timeOffset: ")).call(D,g,"\n initSegmentChange: ")).call(I,b));var U=new ua(r,i,t,s,u);this.configureTransmuxer(U)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:p,chunkMeta:l,state:R},e instanceof ArrayBuffer?[e]:[]);else if(v){var B=v.push(e,p,l,R);la(B)?B.then((function(e){d.handleTransmuxComplete(e)})).catch((function(e){d.transmuxerError(e,l,"transmuxer-interface push error")})):this.handleTransmuxComplete(B)}}},{key:"flush",value:function(e){var t=this;e.transmuxing.start=self.performance.now();var r=this.instanceNo,i=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:r,cmd:"flush",chunkMeta:e});else if(i){var n=i.flush(e);la(n)?n.then((function(r){t.handleFlushResult(r,e)})).catch((function(r){t.transmuxerError(r,e,"transmuxer-interface flush error")})):this.handleFlushResult(n,e)}}},{key:"transmuxerError",value:function(e,t,r){this.hls&&(this.error=e,this.hls.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.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;ey(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 fa(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!va(e[r].attrs,t[r].attrs))return!1;return!0}function va(e,t,r){var i,n=e["STABLE-RENDITION-ID"];return n&&!r?n===t["STABLE-RENDITION-ID"]:!Sy(i=r||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).call(i,(function(r){return e[r]!==t[r]}))}function ga(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}var pa=function(e){Ym(r,e);var t=Wm(r);function r(e,i){var n;return qm(this,r),(n=t.call(this,i,e.logger)).hls=void 0,n.canLoad=!1,n.timer=-1,n.hls=e,n}return Xm(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 i=null==t?void 0:t.renditionReports;if(i){for(var n=-1,a=0;a<i.length;a++){var s=i[a],o=void 0;try{o=new e_(s.URI,t.url).href}catch(f){this.warn("Could not construct new URL for Rendition Report: ".concat(f)),o=s.URI||""}if(o===e){n=a;break}o===e.substring(0,o.length)&&(n=a)}if(-1!==n){var l=i[n],u=Ck(l["LAST-MSN"])||(null==t?void 0:t.lastPartSn),c=Ck(l["LAST-PART"])||(null==t?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){var h=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&h>t.partTarget&&(c+=1)}var d=r&&be(r);return new Re(u,c>=0?c: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(r){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(r))}return e}},{key:"playlistLoaded",value:function(e,t,r){var i=t.details,n=t.stats,a=self.performance.now(),s=n.loading.first?Math.max(0,a-n.loading.first):0;i.advancedDateTime=w_()-s;var o=this.hls.config.timelineOffset;if(o!==i.appliedTimelineOffset){var l,u=Math.max(o||0,0);i.appliedTimelineOffset=u,ey(l=i.fragments).call(l,(function(e){e.start=e.playlistOffset+u}))}if(i.live||null!=r&&r.live){var c,h="levelInfo"in t?t.levelInfo:t.track;i.reloaded(r),r&&i.fragments.length>0&&di(r,i),-1===i.requestScheduled&&(i.requestScheduled=n.loading.start);var d,f,v,g=this.hls.mainForwardBufferInfo,p=g?g.end-g.len:0,m=gi(i,1e3*(i.edge-p));if(i.requestScheduled+m<a?i.requestScheduled=a:i.requestScheduled+=m,this.log(py(c="live playlist ".concat(e," ")).call(c,i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED")),!this.canLoad||!i.live)return;if(i.canBlockReload&&i.endSN&&i.advanced){var y=this.hls.config.lowLatencyMode,E=i.lastPartSn,k=i.endSN,T=i.lastPartIndex,S=E===k;-1!==T?S?(f=k+1,v=y?0:T):(f=E,v=y?T+1:i.maxPartIndex):f=k+1;var A=i.age,L=A+i.ageHeader,b=Math.min(L-i.partTarget,1.5*i.targetduration);if(b>0){var R,I;if(L>3*i.targetduration)this.log("Playlist last advanced ".concat(A.toFixed(2),"s ago. Omitting segment and part directives.")),f=void 0,v=void 0;else if(null!=r&&r.tuneInGoal&&L-i.partTarget>r.tuneInGoal)this.warn(py(R=py(I="CDN Tune-in goal increased from: ".concat(r.tuneInGoal," to: ")).call(I,b," with playlist age: ")).call(R,i.age)),b=0;else{var D,w,_,P,C=Math.floor(b/i.targetduration);f+=C,void 0!==v&&(v+=Math.round(b%i.targetduration/i.partTarget)),this.log(py(D=py(w=py(_=py(P="CDN Tune-in age: ".concat(i.ageHeader,"s last advanced ")).call(P,A.toFixed(2),"s goal: ")).call(_,b," skip sn ")).call(w,C," to part ")).call(D,v))}i.tuneInGoal=b}if(d=this.getDeliveryDirectives(i,t.deliveryDirectives,f,v),y||!S)return i.requestScheduled=a,void this.loadingPlaylist(h,d)}else(i.canBlockReload||i.canSkipUntil)&&(d=this.getDeliveryDirectives(i,t.deliveryDirectives,f,v));d&&void 0!==f&&i.canBlockReload&&(i.requestScheduled=n.loading.first+Math.max(m-2*s,m/2)),this.scheduleLoading(h,d,i)}else this.clearTimer()}},{key:"scheduleLoading",value:function(e,t,r){var i,n=this,a=r||e.details;if(a){var s=self.performance.now(),o=a.requestScheduled;if(s>=o)this.loadingPlaylist(e,t);else{var l=o-s;this.log(py(i="reload live playlist ".concat(e.name||e.bitrate+"bps"," in ")).call(i,Math.round(l)," ms")),this.clearTimer(),this.timer=mE((function(){return n.loadingPlaylist(e,t)}),l)}}else this.loadingPlaylist(e,t)}},{key:"getDeliveryDirectives",value:function(e,t,r,i){var n=be(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(r=t.msn,i=t.part,n=Se),new Re(r,i,n)}},{key:"checkRetry",value:function(e){var t=this,r=e.details,i=Ve(e),n=e.errorAction,a=n||{},s=a.action,o=a.retryCount,l=void 0===o?0:o,u=a.retryConfig,c=!!n&&!!u&&(s===$e||!n.resolved&&s===Xe);if(c){var h,d,f;if(l>=u.maxNumRetry)return!1;if(i&&null!=(f=e.context)&&f.deliveryDirectives)this.warn(py(h=py(d="Retrying playlist loading ".concat(l+1,"/")).call(d,u.maxNumRetry,' after "')).call(h,r,'" without delivery-directives')),this.loadPlaylist();else{var v,g,p,m=Ye(u,l);this.clearTimer(),this.timer=mE((function(){return t.loadPlaylist()}),m),this.warn(py(v=py(g=py(p="Retrying playlist loading ".concat(l+1,"/")).call(p,u.maxNumRetry,' after "')).call(g,r,'" in ')).call(v,m,"ms"))}e.levelRetry=!0,n.resolved=!0}return c}}]),r}(X),ma=function(){function e(t){qm(this,e),this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=t}return Xm(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 i=this.queues[t];i.push(e),1!==i.length||r||this.executeNext(t)}}},{key:"appendBlocker",value:function(e){var t=this;return new RR((function(r){var i={label:"async-blocker",execute:r,onStart:function(){},onComplete:function(){},onError:function(){}};t.append(i,e)}))}},{key:"prependBlocker",value:function(e){var t=this;return new RR((function(r){if(t.queues){var i={label:"async-blocker-prepend",execute:r,onStart:function(){},onComplete:function(){},onError:function(){}};t.queues[e].unshift(i)}}))}},{key:"removeBlockers",value:function(){var e;null!==this.queues&&ey(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(),UE(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(a){var i;if(r.onError(a),null===this.queues||null===this.tracks)return;var n=null==(i=this.tracks[e])?void 0:i.buffer;null!=n&&n.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,i=this.tracks;return null===r||null===i?"<destroyed>":py(e=py(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,i,n;return null!=(i=this.queues)&&i[e]||null!=(n=this.tracks)&&n[e]?py(t=py(r="".concat(e,": (")).call(r,this.listSbInfo(e),") ")).call(t,this.listOps(e)):""}},{key:"listSbInfo",value:function(e){var t,r,i,n=null==(i=this.tracks)?void 0:i[e],a=null==n?void 0:n.buffer;return a?py(t=py(r="SourceBuffer".concat(a.updating?" updating":"")).call(r,n.ended?" ended":"")).call(t,n.ending?" ending":""):"none"}},{key:"listOps",value:function(e){var t,r;return(null==(r=this.queues)?void 0:Dy(t=r[e]).call(t,(function(e){return e.label})).join(", "))||""}}]),e}(),ya=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Ea="HlsJsTrackRemovedError",ka=function(e){Ym(r,e);var t=Wm(r);function r(e){var i;return qm(this,r),(i=t.call(this,e)).name=Ea,i}return Xm(r)}(jm(Error));function Ta(e){var t,r=e.querySelectorAll("source");ey(t=uy([]).call(r)).call(t,(function(t){e.removeChild(t)}))}function Sa(e){return"audio"===e?1:0}var Aa=function(){function e(t){qm(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 Xm(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(O.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(O.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(O.MANIFEST_PARSED,this.onManifestParsed,this),e.on(O.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(O.BUFFER_CODECS,this.onBufferCodecs,this),e.on(O.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"unregisterListener",value:function(){var e=this.hls;e.off(O.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(O.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(O.MANIFEST_PARSED,this.onManifestParsed,this),e.off(O.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(O.BUFFER_CODECS,this.onBufferCodecs,this),e.off(O.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&&_(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,i,n,a=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&a.logger.log(py(t=py(r=py(i=py(n="Setting autoLevelCapping to ".concat(s,": ")).call(n,e[s].height,"p@")).call(i,e[s].bitrate," for media ")).call(r,this.mediaWidth,"x")).call(t,this.mediaHeight)),a.autoLevelCapping=s,a.autoLevelEnabled&&a.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=a.autoLevelCapping}}}},{key:"getMaxLevel",value:function(t){var r=this,i=this.hls.levels;if(!i.length)return-1;var n=Jm(i).call(i,(function(e,i){return r.isLevelAllowed(e)&&i<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)}},{key:"startCapping",value:function(){var e;this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=gE(pE(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(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}},{key:"isLevelAllowed",value:function(e){var t;return!Sy(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 i,n,a=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)&&(i=l,!(n=e[o+1])||i.width!==n.width||i.height!==n.height)){a=o;break}}return a}}]),e}(),La={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},ba={DASH:"d",HLS:"h",SMOOTH:"s",OTHER:"o"},Ra="CMCD-Request",Ia=($h(i={},"CMCD-Object",["br","d","ot","tb"]),$h(i,Ra,["bl","dl","mtp","nor","nrr","su"]),$h(i,"CMCD-Session",["cid","pr","sf","sid","st","v"]),$h(i,"CMCD-Status",["bs","rtp"]),i),Da=Xm((function e(t,r){qm(this,e),sy(t)&&(t=Dy(t).call(t,(function(t){return t instanceof e?t:new e(t)}))),this.value=t,this.params=r}));function wa(e,t,r,i){var n,a,s;return new Error(py(n=py(a="failed to ".concat(e,' "')).call(a,(s=t,sy(s)?x_(s):s instanceof Y_?"Map{}":s instanceof xx?"Set{}":"object"==qh(s)?x_(s):String(s)),'" as ')).call(n,r),{cause:i})}function _a(e,t,r){return wa("serialize",e,t,r)}var Pa=Xm((function e(t){qm(this,e),this.description=t})),Ca="Bare Item";function xa(e){if(!1===ArrayBuffer.isView(e))throw _a(e,"Byte Sequence");return":".concat((t=e,btoa(String.fromCharCode.apply(String,pf(t)))),":");var t}function Ma(e){if((t=e)<-999999999999999||999999999999999<t)throw _a(e,"Integer");var t;return e.toString()}function Oa(e){var t=nn(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw _a(e,"Decimal");var r=t.toString();return zx(r).call(r,".")?r:"".concat(r,".0")}var Fa=/[\x00-\x1f\x7f]+/;function Na(e){var t,r,i=(r=e).description||uy(t=r.toString()).call(t,7,-1);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(i))throw _a(i,"Token");return i}function Ua(e){switch(qh(e)){case"number":if(!_(e))throw _a(e,Ca);return Xx(e)?Ma(e):Oa(e);case"string":return function(e){if(Fa.test(e))throw _a(e,"String");return'"'.concat(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),'"')}(e);case"symbol":return Na(e);case"boolean":return function(e){if("boolean"!=typeof e)throw _a(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return"@".concat(Ma(e.getTime()/1e3));if(e instanceof Uint8Array)return xa(e);if(e instanceof Pa)return Na(e);default:throw _a(e,Ca)}}function Ba(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw _a(e,"Key");return e}function Ga(e){var t;return null==e?"":Dy(t=nM(e)).call(t,(function(e){var t,r=mf(e,2),i=r[0],n=r[1];return!0===n?";".concat(Ba(i)):py(t=";".concat(Ba(i),"=")).call(t,Ua(n))})).join("")}function Ka(e){var t;return e instanceof Da?py(t="".concat(Ua(e.value))).call(t,Ga(e.params)):Ua(e)}function Ha(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{whitespace:!0};if("object"!=qh(e))throw _a(e,"Dict");var i=e instanceof Y_?dM(e).call(e):nM(e),n=(null==r?void 0:r.whitespace)?" ":"";return Dy(t=ly(i)).call(t,(function(e){var t,r,i=mf(e,2),n=i[0],a=i[1];a instanceof Da==0&&(a=new Da(a));var s,o=Ba(n);return!0===a.value?o+=Ga(a.params):(o+="=",sy(a.value)?o+=py(t="(".concat(Dy(r=(s=a).value).call(r,Ka).join(" "),")")).call(t,Ga(s.params)):o+=Ka(a)),o})).join(",".concat(n))}var Va=function(e){return Math.round(e)},ja=function(e){return 100*Va(e/100)},Ya={br:Va,d:Va,bl:ja,dl:ja,mtp:ja,nor:function(e,t){return(null==t?void 0:t.baseUrl)&&(e=function(e,t,r,i){var n=new e_(e),a=new e_(t);if(n.origin!==a.origin)return e;for(var s=uy(r=n.pathname.split("/")).call(r,1),o=uy(i=a.pathname.split("/")).call(i,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:ja,tb:Va};function Wa(e,t){var r,i={};if(null==e||"object"!=qh(e))return i;var n=gT(r=Qm(e)).call(r),a=W({},Ya,null==t?void 0:t.formatters),s=null==t?void 0:Jm(t);return ey(n).call(n,(function(r){if(!(null==s?void 0:s(r))){var n,o=e[r],l=a[r];l&&(o=l(o,t)),"v"===r&&1===o||"pr"==r&&1===o||("number"==typeof(n=o)?_(n):null!=n&&""!==n&&!1!==n)&&(function(e){return"ot"===e||"sf"===e||"st"===e}(r)&&"string"==typeof o&&(o=new Pa(o)),i[r]=o)}})),i}function qa(e){var t,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?(t=Wa(e,i),r=W({whitespace:!1},i),Ha(t,r)):""}function za(e,t,r){return W(e,function(e){var t,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={};if(!e)return n;var a=nM(e),s=py(t=nM(Ia)).call(t,nM((null==i?void 0:i.customHeaderMap)||{})),o=eS(a).call(a,(function(e,t){var r,i,n=mf(t,2),a=n[0],o=n[1],l=(null===(r=TM(s).call(s,(function(e){var t;return zx(t=e[1]).call(t,a)})))||void 0===r?void 0:r[0])||Ra;return null!==(i=e[l])&&void 0!==i||(e[l]={}),e[l][a]=o,e}),{});return eS(r=nM(o)).call(r,(function(e,t){var r=mf(t,2),n=r[0],a=r[1];return e[n]=qa(a,i),e}),n)}(t,r))}var Xa=/CMCD=[^&#]+/;function Qa(e,t,r){var i,n,a=function(e){if(!e)return"";var t=qa(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return"CMCD=".concat(encodeURIComponent(t))}(t,r);if(!a)return e;if(Xa.test(e))return e.replace(Xa,a);var s=zx(e).call(e,"?")?"&":"?";return py(i=py(n="".concat(e)).call(n,s)).call(i,a)}function $a(e,t,r,i){var n;e&&ey(n=Qm(t)).call(n,(function(n){var a,s=Dy(a=Jm(e).call(e,(function(e){return e.groupId===n}))).call(a,(function(e){var a=W({},e);return a.details=void 0,a.attrs=new Tr(a.attrs),a.url=a.attrs.URI=Ja(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),a.groupId=a.attrs["GROUP-ID"]=t[n],a.attrs["PATHWAY-ID"]=i,a}));e.push.apply(e,pf(s))}))}function Ja(e,t,r,i){var n,a,s,o=i.HOST,l=i.PARAMS,u=i[r];t&&(s=null==u?void 0:u[t])&&(e=s);var c=new e_(e);return o&&!s&&(c.host=o),l&&ey(n=gT(a=Qm(l)).call(a)).call(n,(function(e){e&&c.searchParams.set(e,l[e])})),c.href}var Za=function(e){Ym(r,e);var t=Wm(r);function r(e){var i;return qm(this,r),(i=t.call(this,"eme",e.logger)).hls=void 0,i.config=void 0,i.media=null,i.keyFormatPromise=null,i.keySystemAccessPromises={},i._requestLicenseFailureCount=0,i.mediaKeySessions=[],i.keyIdToKeySessionPromise={},i.setMediaKeysQueue=r.CDMCleanupPromise?[r.CDMCleanupPromise]:[],i.onMediaEncrypted=function(e){var t,r=e.initDataType,n=e.initData,a=py(t='"'.concat(e.type,'" event: init data type: "')).call(t,r,'"');if(i.debug(a),null!==n){var s,o;if("sinf"===r&&i.getLicenseServerUrl(Pr.FAIRPLAY)){var l=Ft(new Uint8Array(n));try{var u=Xt(Ir(JSON.parse(l).sinf));if(!u)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=u.subarray(8,24),o=Pr.FAIRPLAY}catch(L){var c;return void i.warn(py(c="".concat(a," Failed to parse sinf: ")).call(c,L))}}else if(i.getLicenseServerUrl(Pr.WIDEVINE)){var h,d=function(e){var t=[];if(e instanceof ArrayBuffer)for(var r=e.byteLength,i=0;i+32<r;){var n=ir(new DataView(e,i));t.push(n),i+=n.size}return t}(n),f=Qm(i.keySystemAccessPromises);f.length||(f=Vr(i.config));var v=Jm(d).call(d,(function(e){var t=e.systemId?Kr(e.systemId):null;return!!t&&hy(f).call(f,t)>-1}))[0];if(!v)return void(0===d.length||Sy(d).call(d,(function(e){return!e.systemId}))?i.warn("".concat(a," contains incomplete or invalid pssh data")):i.log(py(h="ignoring ".concat(a," for ")).call(h,Dy(d).call(d,(function(e){return Kr(e.systemId)})).join(",")," pssh data in favor of playlist keys")));if(o=Kr(v.systemId),0===v.version&&v.data)if(o===Pr.WIDEVINE){var g=v.data.length-22;s=v.data.subarray(g,g+16)}else o===Pr.PLAYREADY&&(s=Wr(v.data))}if(o&&s){for(var p=pt(s),m=$f(i),y=m.keyIdToKeySessionPromise,E=m.mediaKeySessions,k=y[p],T=function(){var e,t=E[S],a=t.decryptdata;if(!a.keyId)return"continue";var o=pt(a.keyId);return p===o||-1!==hy(e=a.uri.replace(/-/g,"")).call(e,p)?(k=y[o],a.pssh||(delete y[o],a.pssh=new Uint8Array(n),a.keyId=s,(k=y[p]=k.then((function(){return i.generateRequestWithPreferredKeySession(t,r,n,"encrypted-event-key-match")}))).catch((function(e){return i.handleError(e)}))),"break"):void 0},S=0;S<E.length;S++){var A=T();if("continue"!==A&&"break"===A)break}k||(k=y[p]=i.getKeySystemSelectionPromise([o]).then((function(e){var t,a=e.keySystem,o=e.mediaKeys;i.throwIfDestroyed();var l=new zr("ISO-23001-7",p,null!=(t=Hr(a))?t:"");return l.pssh=new Uint8Array(n),l.keyId=s,i.attemptSetMediaKeys(a,o).then((function(){i.throwIfDestroyed();var e=i.createMediaKeySessionContext({decryptdata:l,keySystem:a,mediaKeys:o});return i.generateRequestWithPreferredKeySession(e,r,n,"encrypted-event-no-match")}))}))).catch((function(e){return i.handleError(e)}))}}},i.onWaitingForKey=function(e){i.log('"'.concat(e.type,'" event'))},i.hls=e,i.config=e.config,i.registerListeners(),i}return Xm(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(O.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(O.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(O.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(O.MANIFEST_LOADED,this.onManifestLoaded,this)}},{key:"unregisterListeners",value:function(){this.hls.off(O.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(O.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(O.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(O.MANIFEST_LOADED,this.onManifestLoaded,this)}},{key:"getLicenseServerUrl",value:function(e){var t=this.config,r=t.drmSystems,i=t.widevineLicenseUrl,n=r[e];return n?n.licenseUrl:e===Pr.WIDEVINE&&i?i: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,i=this,n=this.hls.levels,a=function(e,t,r){return!!e&&hy(r).call(r,e)===t},s=Jm(t=Dy(n).call(n,(function(e){return e.audioCodec}))).call(t,a),o=Jm(r=Dy(n).call(n,(function(e){return e.videoCodec}))).call(r,a);return s.length+o.length===0&&o.push("avc1.42e01e"),new RR((function(t,r){!function e(n){var a=n.shift();i.getMediaKeysPromise(a,s,o).then((function(e){return t({keySystem:a,mediaKeys:e})})).catch((function(t){n.length?e(n):r(t instanceof es?t:new es({type:x.KEY_SYSTEM_ERROR,details:M.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 i="Configured requestMediaKeySystemAccess is not a function ".concat(r);return null===Yr&&"http:"===self.location.protocol&&(i="navigator.requestMediaKeySystemAccess is not available over insecure protocol ".concat(location.protocol)),RR.reject(new Error(i))}return r(e,t)}},{key:"getMediaKeysPromise",value:function(e,t,r){var i=this,n=function(e,t,r,i){var n,a,s,o;switch(e){case Pr.FAIRPLAY:n=["cenc","sinf"];break;case Pr.WIDEVINE:case Pr.PLAYREADY:n=["cenc"];break;case Pr.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error("Unknown key-system: ".concat(e))}return a=t,s=r,[{initDataTypes:n,persistentState:(o=i).persistentState||"optional",distinctiveIdentifier:o.distinctiveIdentifier||"optional",sessionTypes:o.sessionTypes||[o.sessionType||"temporary"],audioCapabilities:Dy(a).call(a,(function(e){return{contentType:"audio/mp4; codecs=".concat(e),robustness:o.audioRobustness||"",encryptionScheme:o.audioEncryptionScheme||null}})),videoCapabilities:Dy(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),a=this.keySystemAccessPromises[e],s=null==a?void 0:a.keySystemAccess;if(!s){var o;this.log(py(o='Requesting encrypted media "'.concat(e,'" key-system access with config: ')).call(o,x_(n))),s=this.requestMediaKeySystemAccess(e,n);var l=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch((function(t){var r;i.log(py(r='Failed to obtain access to key-system "'.concat(e,'": ')).call(r,t))})),s.then((function(t){i.log('Access for key-system "'.concat(t.keySystem,'" obtained'));var r=i.fetchServerCertificate(e);return i.log('Create media-keys for "'.concat(e,'"')),l.mediaKeys=t.createMediaKeys().then((function(t){return i.log('Media-keys created for "'.concat(e,'"')),r.then((function(r){return r?i.setMediaKeysServerCertificate(t,e,r):t}))})),l.mediaKeys.catch((function(t){var r;i.error(py(r='Failed to create media-keys for "'.concat(e,'"}: ')).call(r,t))})),l.mediaKeys}))}return s.then((function(){return a.mediaKeys}))}},{key:"createMediaKeySessionContext",value:function(e){var t,r=e.decryptdata,i=e.keySystem,n=e.mediaKeys;this.log(py(t='Creating key-system session "'.concat(i,'" keyId: ')).call(t,pt(r.keyId||[])));var a=n.createSession(),s={decryptdata:r,keySystem:i,mediaKeys:n,mediaKeysSession:a,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),i=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(r,n,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 pt(e.keyId)}},{key:"updateKeySession",value:function(e,t){var r,i,n,a=e.mediaKeysSession;return this.log(py(r=py(i='Updating key-session "'.concat(a.sessionId,'" for keyID ')).call(i,pt((null==(n=e.decryptdata)?void 0:n.keyId)||[]),"\n } (data length: ")).call(r,t?t.byteLength:t,")")),a.update(t)}},{key:"selectKeySystemFormat",value:function(e){var t,r,i,n=Qm(e.levelkeys||{});return this.keyFormatPromise||(this.log(py(t=py(r=py(i="Selecting key-system from fragment (sn: ".concat(e.sn," ")).call(i,e.type,": ")).call(r,e.level,") key formats ")).call(t,n.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(n)),this.keyFormatPromise}},{key:"getKeyFormatPromise",value:function(e){var t=this;return new RR((function(r,i){var n,a=Vr(t.config),s=Jm(n=Dy(e).call(e,Fr)).call(n,(function(e){return!!e&&-1!==hy(a).call(a,e)}));return t.getKeySystemSelectionPromise(s).then((function(e){var t=e.keySystem,n=Hr(t);n?r(n):i(new Error('Unable to find format for key-system "'.concat(t,'"')))})).catch(i)}))}},{key:"loadKey",value:function(e){var t,r,i,n=this,a=e.keyInfo.decryptdata,s=this.getKeyIdString(a),o=py(t=py(r=py(i="(keyId: ".concat(s,' format: "')).call(i,a.keyFormat,'" method: ')).call(r,a.method," uri: ")).call(t,a.uri,")");this.log("Starting session for key ".concat(o));var l=this.keyIdToKeySessionPromise[s];return l||(l=this.getKeySystemForKeyPromise(a).then((function(t){var r,i,s,l=t.keySystem,u=t.mediaKeys;return n.throwIfDestroyed(),n.log(py(r=py(i=py(s="Handle encrypted media sn: ".concat(e.frag.sn," ")).call(s,e.frag.type,": ")).call(i,e.frag.level," using key ")).call(r,o)),n.attemptSetMediaKeys(l,u).then((function(){return n.throwIfDestroyed(),n.createMediaKeySessionContext({keySystem:l,mediaKeys:u,decryptdata:a})}))})),(this.keyIdToKeySessionPromise[s]=l.then((function(e){var t=a.pssh?a.pssh.buffer:null;return n.generateRequestWithPreferredKeySession(e,"cenc",t,"playlist-key")}))).catch((function(e){return n.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(O.ERROR,e.data):this.hls.trigger(O.ERROR,{type:x.KEY_SYSTEM_ERROR,details:M.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 i=Fr(e.keyFormat),n=i?[i]:Vr(this.config);return this.attemptKeySystemAccess(n)}return r}},{key:"getKeySystemSelectionPromise",value:function(e){if(e.length||(e=Vr(this.config)),0===e.length)throw new es({type:x.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options ".concat(x_({drmSystems:this.config.drmSystems})));return this.attemptKeySystemAccess(e)}},{key:"attemptSetMediaKeys",value:function(e,t){var r,i=this,n=uy(r=this.setMediaKeysQueue).call(r);this.log('Setting media-keys for "'.concat(e,'"'));var a=RR.all(n).then((function(){if(!i.media)throw new Error("Attempted to set mediaKeys without media element attached");return i.media.setMediaKeys(t)}));return this.setMediaKeysQueue.push(a),a.then((function(){var t;i.log('Media-keys set for "'.concat(e,'"')),n.push(a),i.setMediaKeysQueue=Jm(t=i.setMediaKeysQueue).call(t,(function(e){return-1===hy(n).call(n,e)}))}))}},{key:"generateRequestWithPreferredKeySession",value:function(e,t,r,i){var n,a,s,o,l,u=this,c=null==(o=this.config.drmSystems)||null==(l=o[e.keySystem])?void 0:l.generateRequest;if(c)try{var h=c.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(y){var d;if(this.warn(y.message),null!=(d=this.hls)&&d.config.debug)throw y}if(null===r)return this.log('Skipping key-session request for "'.concat(i,'" (no initData)')),RR.resolve(e);var f=this.getKeyIdString(e.decryptdata);this.log(py(n=py(a=py(s='Generating key-session request for "'.concat(i,'": ')).call(s,f," (init data type: ")).call(a,t," length: ")).call(n,r?r.byteLength:null,")"));var v=new Gi,g=e._onmessage=function(t){var r,i,n=e.mediaKeysSession;if(n){var a=t.messageType,s=t.message;u.log(py(r=py(i='"'.concat(a,'" message event for session "')).call(i,n.sessionId,'" message size: ')).call(r,s.byteLength)),"license-request"===a||"license-renewal"===a?u.renewLicense(e,s).catch((function(e){v.eventNames().length?v.emit("error",e):u.handleError(e)})):"license-release"===a?e.keySystem===Pr.FAIRPLAY&&(u.updateKeySession(e,Dr("acknowledged")),u.removeSession(e)):u.warn('unhandled media key message type "'.concat(a,'"'))}else v.emit("error",new Error("invalid state"))},p=e._onkeystatuseschange=function(t){var r;if(e.mediaKeysSession){u.onKeyStatusChange(e);var i=e.keyStatus;v.emit("keyStatus",i),"expired"===i&&(u.warn(py(r="".concat(e.keySystem," expired for key ")).call(r,f)),u.renewKeySession(e))}else v.emit("error",new Error("invalid state"))};e.mediaKeysSession.addEventListener("message",g),e.mediaKeysSession.addEventListener("keystatuseschange",p);var m=new RR((function(e,t){v.on("error",t),v.on("keyStatus",(function(r){AS(r).call(r,"usable")?e():"output-restricted"===r?t(new es({type:x.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===r?t(new es({type:x.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'.concat(r,'"'))):"expired"===r?t(new Error("key expired while generating request")):u.warn('unhandled key status change "'.concat(r,'"'))}))}));return e.mediaKeysSession.generateRequest(t,r).then((function(){var t,r;u.log(py(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:x.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},"Error generating key-session request: ".concat(e))})).then((function(){return m})).catch((function(t){throw v.removeAllListeners(),u.removeSession(e),t})).then((function(){return v.removeAllListeners(),e}))}},{key:"onKeyStatusChange",value:function(e){var t,r=this;ey(t=e.mediaKeysSession.keyStatuses).call(t,(function(t,i){var n,a,s;r.log(py(n=py(a=py(s='key status change "'.concat(t,'" for keyStatuses keyId: ')).call(s,pt("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))," session keyId: ")).call(a,pt(new Uint8Array(e.decryptdata.keyId||[]))," uri: ")).call(n,e.decryptdata.uri)),e.keyStatus=t}))}},{key:"fetchServerCertificate",value:function(e){var t=this.config,r=new t.loader(t),i=this.getServerCertificateUrl(e);return i?(this.log('Fetching server certificate for "'.concat(e,'"')),new RR((function(n,a){var s={responseType:"arraybuffer",url:i},o=t.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:function(e,t,r,i){n(e.data)},onError:function(t,r,n,o){var l,u,c;a(new es({type:x.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:z({url:s.url,data:void 0},t)},py(l=py(u=py(c='"'.concat(e,'" certificate request failed (')).call(c,i,"). Status: ")).call(u,t.code," (")).call(l,t.text,")")))},onTimeout:function(t,r,n){var o;a(new es({type:x.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:{url:s.url,data:void 0}},py(o='"'.concat(e,'" certificate request timed out (')).call(o,i,")")))},onAbort:function(e,t,r){a(new Error("aborted"))}};r.load(s,l,u)}))):RR.resolve()}},{key:"setMediaKeysServerCertificate",value:function(e,t,r){var i=this;return new RR((function(n,a){e.setServerCertificate(r).then((function(a){var s,o;i.log(py(s=py(o="setServerCertificate ".concat(a?"success":"not supported by CDM"," (")).call(o,null==r?void 0:r.byteLength,') on "')).call(s,t,'"')),n(e)})).catch((function(e){a(new es({type:x.KEY_SYSTEM_ERROR,details:M.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:x.KEY_SYSTEM_ERROR,details:M.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(!zx(r).call(r,"PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;var i=(new DOMParser).parseFromString(r,"application/xml"),n=i.querySelectorAll("HttpHeader");if(n.length>0)for(var a,s=0,o=n.length;s<o;s++){var l,u,c=null==(l=(a=n[s]).querySelector("name"))?void 0:l.textContent,h=null==(u=a.querySelector("value"))?void 0:u.textContent;c&&h&&e.setRequestHeader(c,h)}var d=i.querySelector("Challenge"),f=null==d?void 0:d.textContent;if(!f)throw new Error("Cannot find <Challenge> in key message");return Dr(atob(f))}},{key:"setupLicenseXHR",value:function(e,t,r,i){var n=this,a=this.config.licenseXhrSetup;return a?RR.resolve().then((function(){if(!r.decryptdata)throw new Error("Key removed");return a.call(n.hls,e,t,r,i)})).catch((function(s){if(!r.decryptdata)throw s;return e.open("POST",t,!0),a.call(n.hls,e,t,r,i)})).then((function(r){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||i}})):(e.open("POST",t,!0),RR.resolve({xhr:e,licenseChallenge:i}))}},{key:"requestLicense",value:function(e,t){var r=this,i=this.config.keyLoadPolicy.default;return new RR((function(n,a){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 a(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 u=r.config.licenseResponseCallback;if(u)try{l=u.call(r.hls,o,s,e)}catch(g){r.error(g)}n(l)}else{var c,h,d=i.errorRetry,f=d?d.maxNumRetry:0;if(r._requestLicenseFailureCount++,r._requestLicenseFailureCount>f||o.status>=400&&o.status<500)a(new es({type:x.KEY_SYSTEM_ERROR,details:M.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:s,data:void 0,code:o.status,text:o.statusText}},py(c=py(h="License Request XHR failed (".concat(s,"). Status: ")).call(h,o.status," (")).call(c,o.statusText,")")));else{var v=f-r._requestLicenseFailureCount+1;r.warn("Retrying license request, ".concat(v," attempts left")),r.requestLicense(e,t).then(n,a)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,r.setupLicenseXHR(o,s,e,t).then((function(t){var i=t.xhr,n=t.licenseChallenge;e.keySystem==Pr.PLAYREADY&&(n=r.unpackPlayReadyKeyMessage(i,n)),i.send(n)}))}))}},{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,i=this,n=this.media,a=this.mediaKeySessions;n&&(n.removeEventListener("encrypted",this.onMediaEncrypted),n.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},zr.clearKeyUriToKeyIdMap();var s=a.length;r.CDMCleanupPromise=RR.all(py(e=Dy(a).call(a,(function(e){return i.removeSession(e)}))).call(e,null==n||null==(t=n.setMediaKeys(null))?void 0:t.catch((function(e){var t;i.log("Could not clear media keys: ".concat(e)),null==(t=i.hls)||t.trigger(O.ERROR,{type:x.OTHER_ERROR,details:M.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error("Could not clear media keys: ".concat(e))})})))).then((function(){s&&(i.log("finished closing key sessions and clearing media keys"),a.length=0)})).catch((function(e){var t;i.log("Could not close sessions and clear media keys: ".concat(e)),null==(t=i.hls)||t.trigger(O.ERROR,{type:x.OTHER_ERROR,details:M.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 i=eS(r).call(r,(function(e,t){return-1===hy(e).call(e,t.keyFormat)&&e.push(t.keyFormat),e}),[]);this.log("Selecting key-system from session-keys ".concat(i.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(i)}}},{key:"removeSession",value:function(e){var t=this,r=e.mediaKeysSession,i=e.licenseXhr;if(r){var n,a;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),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var s=hy(n=this.mediaKeySessions).call(n,e);return s>-1&&UE(a=this.mediaKeySessions).call(a,s,1),r.remove().catch((function(e){var r;t.log("Could not remove session: ".concat(e)),null==(r=t.hls)||r.trigger(O.ERROR,{type:x.OTHER_ERROR,details:M.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(O.ERROR,{type:x.OTHER_ERROR,details:M.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close session: ".concat(e))})}))}}}]),r}(X);Za.CDMCleanupPromise=void 0;var es=function(e){Ym(r,e);var t=Wm(r);function r(e,i){var n;return qm(this,r),(n=t.call(this,i)).data=void 0,e.error||(e.error=new Error(i)),n.data=e,e.err=e.error,n}return Xm(r)}(jm(Error));function ts(e,t){var r;try{r=new Event("addtrack")}catch(Ho){(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(Ho){te.debug("[texttrack-utils]: ".concat(Ho));try{var i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(n){te.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: ".concat(n))}}"disabled"===r&&(e.mode=r)}function is(e,t){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues)for(var i=e.cues.length;i--;)t&&e.cues[i].removeEventListener("enter",t),e.removeCue(e.cues[i]);"disabled"===r&&(e.mode=r)}function ns(e,t,r,i){var n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var a=function(e,t,r){var i=[],n=function(e,t){if(t<e[0].startTime)return 0;var r=e.length-1;if(t>e[r].endTime)return-1;for(var i=0,n=r;i<=n;){var a=Math.floor((n+i)/2);if(t<e[a].startTime)n=a-1;else{if(!(t>e[a].startTime&&i<r))return a;i=a+1}}return e[i].startTime-t<t-e[n].startTime?i:n}(e,t);if(n>-1)for(var a=n,s=e.length;a<s;a++){var o=e[a];if(o.startTime>=t&&o.endTime<=r)i.push(o);else if(o.startTime>r)return i}return i}(e.cues,t,r),s=0;s<a.length;s++)i&&!i(a[s])||e.removeCue(a[s]);"disabled"===n&&(e.mode=n)}function as(e){for(var t=[],r=0;r<e.length;r++){var i=e[r];"subtitles"!==i.kind&&"captions"!==i.kind||!i.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 us(e,t,r){var i,n;return py(i=py(n="".concat(e.identifier,"-")).call(n,r+1,"-")).call(i,ss(t))}var cs=function(){function e(t,r){qm(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 Xm(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 hy(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=_(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,i;return py(e=py(t=py(r='["'.concat((i=this).identifier,'" ')).call(r,i.cue.pre?"<pre>":i.cue.post?"<post>":"")).call(t,i.timelineStart.toFixed(2),"-")).call(e,i.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 i=new e_(e,r);return"data:"!==i.protocol&&i.searchParams.set("_HLS_primary_id",t),i}function fs(e){var t,r,i=e.timelineStart,n=e.duration||0;return py(t=py(r='["'.concat(e.identifier,'" ')).call(r,i.toFixed(2),"-")).call(t,(i+n).toFixed(2),"]")}var vs=function(){function e(t,r,i,n){var a=this;qm(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=a.interstitial.playoutLimit;a.playoutOffset+a.currentTime>=e&&a.hls.trigger(O.PLAYOUT_LIMIT_REACHED,{})};var s=this.hls=new t(r);this.interstitial=i,this.assetItem=n;var o=n.uri;try{o=ds(o,s.sessionId).href}catch(u){}s.loadSource(o);var l=function(){a.hasDetails=!0};s.once(O.LEVEL_LOADED,l),s.once(O.AUDIO_TRACK_LOADED,l),s.once(O.SUBTITLE_TRACK_LOADED,l),s.on(O.MEDIA_ATTACHING,(function(e,t){var r,i=t.media;a.removeMediaListeners(),a.mediaAttached=i;var s,o=a.interstitial;o.playoutLimit&&(a.playoutOffset=(null==(s=o.assetList[hy(r=o.assetList).call(r,n)])?void 0:s.startOffset)||0,i.addEventListener("timeupdate",a.checkPlayout))}))}return Xm(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 py(e=py(t="HlsAssetPlayer: ".concat(fs(this.assetItem)," ")).call(t,this.hls.sessionId," ")).call(e,this.interstitial.appendInPlace?"append-in-place":"")}}]),e}(),gs=function(e){Ym(r,e);var t=Wm(r);function r(e,i){var n;return qm(this,r),(n=t.call(this,"interstitials-sched",i)).onScheduleUpdate=void 0,n.eventMap={},n.events=null,n.items=null,n.durations={primary:0,playout:0,integrated:0},n.onScheduleUpdate=e,n}return Xm(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&&ey(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 i=this.items;if(i)for(i[r]||(void 0===t&&(t=e.start),r=this.findItemIndexAtTime(t));r>=0&&null!=(n=i[r])&&n.event;){var n;r--}return r}},{key:"findItemIndexAtTime",value:function(e,t){var r=this.items;if(r)for(var i=0;i<r.length;i++){var n=r[i];if(t&&"primary"!==t&&(n=n[t]),e===n.start||e>n.start&&e<n.end)return i}return-1}},{key:"findJumpRestrictedIndex",value:function(e,t){var r=this.items;if(r)for(var i=e;i<=t&&r[i];i++){var n=r[i].event;if(null!=n&&n.restrictions.jump&&!n.appendInPlace)return i}return-1}},{key:"findEventIndex",value:function(e){var t=this.items;if(t)for(var r=t.length;r--;){var i;if((null==(i=t[r].event)?void 0:i.identifier)===e)return r}return-1}},{key:"findAssetIndex",value:function(e,t){var r=e.assetList,i=r.length;if(i>1)for(var n=0;n<i;n++){var a=r[n];if(!a.error){var s=a.timelineStart;if(t===s||t>s&&t<s+(a.duration||0))return n}}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 i=r.assetList,n=i[i.length-1];if(n)return n.identifier}return null}},{key:"parseInterstitialDateRanges",value:function(e){var t=this,r=e.main.details,i=r.dateRanges,n=this.events,a=this.parseDateRanges(i,{url:r.url}),s=Qm(i),o=n?Jm(n).call(n,(function(e){return!zx(s).call(s,e.identifier)})):[];a.length&&gT(a).call(a,(function(e,t){var r=e.cue.pre,i=e.cue.post,n=t.cue.pre,a=t.cue.post;if(r&&!n)return-1;if(n&&!r)return 1;if(i&&!a)return 1;if(a&&!i)return-1;if(!(r||n||i||a)){var s=e.startTime,o=t.startTime;if(s!==o)return s-o}return e.dateRange.tagOrder-t.dateRange.tagOrder})),this.events=a,ey(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 i=this.items,n=this.parseSchedule(r,e);(t.length||(null==i?void 0:i.length)!==n.length||Sy(n).call(n,(function(e,t){return Math.abs(e.playout.start-i[t].playout.start)>.005||Math.abs(e.playout.end-i[t].playout.end)>.005})))&&(this.items=n,this.onScheduleUpdate(t,i))}}},{key:"parseDateRanges",value:function(e,t){for(var r=[],i=Qm(e),n=0;n<i.length;n++){var a=i[n],s=e[a];if(s.isInterstitial){var o=this.eventMap[a];o?o.setDateRange(s):(o=new cs(s,t),this.eventMap[a]=o),r.push(o)}}return r}},{key:"parseSchedule",value:function(e,t){var r=[],i=t.main.details,n=i.live?1/0:i.edge,a=0;if((e=Jm(e).call(e,(function(e){return!(e.error||e.cue.once&&e.hasPlayed)}))).length){this.resolveOffsets(e,t);var s=0,o=0;if(ey(e).call(e,(function(t,i){var l=t.cue.pre,u=t.cue.post,c=e[i-1]||null,h=t.appendInPlace,d=u?n:t.startOffset,f=t.duration,v=t.timelineOccupancy===ls.Range?f:0,g=t.resumptionOffset,p=(null==c?void 0:c.startTime)===d,m=d+t.cumulativeDuration,y=h?m+f:d+g;if(l||!u&&d<=0){var E=o;o+=v,t.timelineStart=m;var k=a;a+=f,r.push({event:t,start:m,end:y,playout:{start:k,end:a},integrated:{start:E,end:o}})}else{if(!(d<=n))return;if(!p){var T=d-s;if(T>.033){var S=s,A=o;o+=T;var L=a;a+=T;var b={previousEvent:e[i-1]||null,nextEvent:t,start:S,end:S+T,playout:{start:L,end:a},integrated:{start:A,end:o}};r.push(b)}else T>0&&c&&(c.cumulativeDuration+=T,r[r.length-1].end=d)}u&&(y=m),t.timelineStart=m;var R=o;o+=v;var I=a;a+=f,r.push({event:t,start:m,end:y,playout:{start:I,end:a},integrated:{start:R,end:o}})}var D=t.resumeTime;s=u||D>n?n:D})),s<n){var l,u=s,c=o,h=n-s;o+=h;var d=a;a+=h,r.push({previousEvent:(null==(l=r[r.length-1])?void 0:l.event)||null,nextEvent:null,start:s,end:u+h,playout:{start:d,end:a},integrated:{start:c,end:o}})}this.setDurations(n,a,o)}else{var f=0;r.push({previousEvent:null,nextEvent:null,start:f,end:n,playout:{start:f,end:n},integrated:{start:f,end:n}}),this.setDurations(n,n,n)}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,i=t.main.details,n=i.live?1/0:i.edge,a=0,s=-1;ey(e).call(e,(function(o,l){var u=o.cue.pre,c=o.cue.post,h=u?0:c?n:o.startTime;if(r.updateAssetDurations(o),s===h?o.cumulativeDuration=a:(a=0,s=h),!c&&o.snapOptions.in&&(o.resumeAnchor=Be(null,i.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.resumeOffset)?o.resumeOffset:o.duration;a+=f}))}},{key:"primaryCanResumeInPlaceAt",value:function(e,t){var r,i,n,a,s=this,o=e.resumeTime,l=e.startTime+e.resumptionOffset;return Math.abs(o-l)>os?(this.log(py(r=py(i='"'.concat(e.identifier,'" resumption ')).call(i,o," not aligned with estimated timeline end ")).call(r,l)),!1):t?!Sy(n=Qm(t)).call(n,(function(r){var i,n,a,l,u,c,h,d,f,v,g,p=t[r].details,m=p.edge;if(o>m)return s.log(py(i=py(n=py(a='"'.concat(e.identifier,'" resumption ')).call(a,o," past ")).call(n,r," playlist end ")).call(i,m)),!0;var y=Be(null,p.fragments,o);if(!y)return s.log(py(l=py(u='"'.concat(e.identifier,'" resumption ')).call(u,o," does not align with any fragments in ")).call(l,r," playlist")),!0;var E="audio"===r?.175:0;return!(Math.abs(y.start-o)<os||Math.abs(y.end-o)<os+E||(s.log(py(c=py(h=py(d=py(f=py(v=py(g='"'.concat(e.identifier,'" resumption ')).call(g,o," not aligned with ")).call(v,r," fragment bounds (")).call(f,y.start,"-")).call(d,y.end," sn: ")).call(h,y.sn," cc: ")).call(c,y.cc,")")),0))})):(this.log(py(a='"'.concat(e.identifier,'" resumption ')).call(a,o," can not be aligned with media (none selected)")),!1)}},{key:"updateAssetDurations",value:function(e){var t,r=e.timelineStart,i=0,n=!1,a=!1;ey(t=e.assetList).call(t,(function(e,t){var s=r+i;e.startOffset=i,e.timelineStart=s,n||(n=null===e.duration),a||(a=!!e.error);var o=e.error?0:e.duration||0;i+=o})),e.duration=n&&!a?Math.max(i,e.duration):i}},{key:"removeEvent",value:function(e){e.reset(),delete this.eventMap[e.identifier]}}]),r}(X);function ps(e){var t,r;return py(t=py(r="[".concat(e.event?'"'+e.event.identifier+'"':"primary",": ")).call(r,e.start.toFixed(2),"-")).call(t,e.end.toFixed(2),"]")}var ms=function(){function e(t){qm(this,e),this.hls=void 0,this.hls=t}return Xm(e,[{key:"destroy",value:function(){this.hls=null}},{key:"loadAssetList",value:function(e,t){var r,i=this,n=e.assetListUrl;try{r=ds(n,this.hls.sessionId,e.baseUrl)}catch(f){var a=this.assignAssetListError(e,M.ASSET_LIST_LOAD_ERROR,f,n);return void this.hls.trigger(O.ERROR,a)}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),u={responseType:"json",url:r.href},c=o.interstitialAssetListLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:function(t,r,n,a){var s=t.data,o=null==s?void 0:s.ASSETS;if(sy(o))e.assetListResponse=s,i.hls.trigger(O.ASSET_LIST_LOADED,{event:e,assetListResponse:s,networkDetails:a});else{var l=i.assignAssetListError(e,M.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),n.url,r,a);i.hls.trigger(O.ERROR,l)}},onError:function(t,r,n,a){var s,o,l=i.assignAssetListError(e,M.ASSET_LIST_LOAD_ERROR,new Error(py(s=py(o="Error loading X-ASSET-LIST: HTTP status ".concat(t.code," ")).call(o,t.text," (")).call(s,r.url,")")),r.url,a,n);i.hls.trigger(O.ERROR,l)},onTimeout:function(t,r,n){var a=i.assignAssetListError(e,M.ASSET_LIST_LOAD_TIMEOUT,new Error("Timeout loading X-ASSET-LIST (".concat(r.url,")")),r.url,t,n);i.hls.trigger(O.ERROR,a)}};return l.load(u,h,d),this.hls.trigger(O.ASSET_LIST_LOADING,{event:e}),l}},{key:"assignAssetListError",value:function(e,t,r,i,n,a){return e.error=r,{type:x.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:i,error:r,networkDetails:a,stats:n}}}]),e}();function ys(e){null==e||e.play().catch()}var Es=Xm((function e(t){qm(this,e),this.buffered=void 0;var r=function(e,r,i){var n,a;if((r>>>=0)>i-1)throw new DOMException(py(n=py(a="Failed to execute '".concat(e,"' on 'TimeRanges': The index provided (")).call(a,r,") is greater than the maximum bound (")).call(n,i,")"));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)}}})),ks={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},Ts=function(e){return String.fromCharCode(ks[e]||e)},Ss=15,As=100,Ls={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},bs={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Rs={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Is={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Ds=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],ws=function(){function e(){qm(this,e),this.time=null,this.verboseLevel=0}return Xm(e,[{key:"log",value:function(e,t){if(this.verboseLevel>=e){var r,i,n="function"==typeof t?t():t;te.log(py(r=py(i="".concat(this.time," [")).call(i,e,"] ")).call(r,n))}}}]),e}(),_s=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},Ps=function(){function e(){qm(this,e),this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}return Xm(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 i=t[r];e.hasOwnProperty(i)&&(this[i]=e[i])}}},{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(){qm(this,e),this.uchar=" ",this.penState=new Ps}return Xm(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}(),xs=function(){function e(t){qm(this,e),this.chars=[],this.pos=0,this.currPenState=new Ps,this.cueStartTime=null,this.logger=void 0;for(var r=0;r<As;r++)this.chars.push(new Cs);this.logger=t}return Xm(e,[{key:"equals",value:function(e){for(var t=0;t<As;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}},{key:"copy",value:function(e){for(var t=0;t<As;t++)this.chars[t].copy(e.chars[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<As;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>As&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=As)}},{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=Ts(e);this.pos>=As?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<As;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<As;r++){var i=this.chars[r].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")}},{key:"setPenStyles",value:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}]),e}(),Ms=function(){function e(t){qm(this,e),this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var r=0;r<Ss;r++)this.rows.push(new xs(t));this.logger=t}return Xm(e,[{key:"reset",value:function(){for(var e=0;e<Ss;e++)this.rows[e].clear();this.currRow=14}},{key:"equals",value:function(e){for(var t=!0,r=0;r<Ss;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t}},{key:"copy",value:function(e){for(var t=0;t<Ss;t++)this.rows[t].copy(e.rows[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<Ss;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 = "+x_(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<Ss;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){var a=n.rows[i].cueStartTime,s=this.logger.time;if(null!==a&&null!==s&&a<s)for(var o=0;o<this.nrRollUpRows;o++)this.rows[t-this.nrRollUpRows+o+1].copy(n.rows[i+o])}}this.currRow=t;var l=this.rows[this.currRow];if(null!==e.indent){var u=e.indent,c=Math.max(u-1,0);l.setCursor(e.indent),e.color=l.chars[c].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 = "+x_(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 i=this.currRow+1-this.nrRollUpRows,n=UE(e=this.rows).call(e,i,1)[0];n.clear(),UE(t=this.rows).call(t,this.currRow,0,n),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="",i=-1,n=0;n<Ss;n++){var a=this.rows[n].getTextString();a&&(i=n+1,e?t.push("Row "+i+": '"+a+"'"):t.push(Ek(a).call(a)))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r}},{key:"getTextAndFormat",value:function(){return this.rows}}]),e}(),Os=function(){function e(t,r,i){qm(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 Ms(i),this.nonDisplayedMemory=new Ms(i),this.lastOutputScreen=new Ms(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}return Xm(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 i=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(function(){return i+": "+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,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[r]}this.logger.log(2,"MIDROW: "+x_(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}(),Fs=function(){function e(t,r,i){qm(this,e),this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;var n=this.logger=new ws;this.channels=[null,new Os(t,r,n),new Os(t+1,i,n)]}return Xm(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 i=function(e){var i=127&t[e],n=127&t[e+1],a=!1,s=null;if(0===i&&0===n)return"continue";r.logger.log(3,(function(){return"["+_s([t[e],t[e+1]])+"] -> ("+_s([i,n])+")"}));var o=r.cmdHistory;if(i>=16&&i<=31){if(Us(i,n,o))return Ns(null,null,o),r.logger.log(3,(function(){return"Repeated command ("+_s([i,n])+") is dropped"})),"continue";Ns(i,n,r.cmdHistory),(a=r.parseCmd(i,n))||(a=r.parseMidrow(i,n)),a||(a=r.parsePAC(i,n)),a||(a=r.parseBackgroundAttributes(i,n))}else Ns(null,null,o);if(!a&&(s=r.parseChars(i,n))){var l=r.currentChannel;l&&l>0?r.channels[l].insertChars(s):r.logger.log(2,"No channel found yet. TEXT-MODE?")}a||s||r.logger.log(2,(function(){return"Couldn't parse cleaned data "+_s([i,n])+" orig: "+_s([t[e],t[e+1]])}))},n=0;n<t.length;n+=2)i(n)}},{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,i=this.channels[r];return 20===e||21===e||28===e||29===e?32===t?i.ccRCL():33===t?i.ccBS():34===t?i.ccAOF():35===t?i.ccAON():36===t?i.ccDER():37===t?i.ccRU(2):38===t?i.ccRU(3):39===t?i.ccRU(4):40===t?i.ccFON():41===t?i.ccRDC():42===t?i.ccTR():43===t?i.ccRTD():44===t?i.ccEDM():45===t?i.ccCR():46===t?i.ccENM():47===t&&i.ccEOC():i.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 i=this.channels[r];return!!i&&(i.ccMIDROW(t),this.logger.log(3,(function(){return"MIDROW ("+_s([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 i=e<=23?1:2;r=t>=64&&t<=95?1===i?Ls[e]:Rs[e]:1===i?bs[e]:Is[e];var n=this.channels[i];return!!n&&(n.setPAC(this.interpretPAC(r,t)),this.currentChannel=i,!0)}},{key:"interpretPAC",value:function(e,t){var r,i={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,i.underline=1==(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i}},{key:"parseChars",value:function(e,t){var r,i,n=null,a=null;return e>=25?(r=2,a=e-8):(r=1,a=e),a>=17&&a<=19?(i=17===a?t+80:18===a?t+112:t+144,this.logger.log(2,(function(){return"Special char '"+Ts(i)+"' in channel "+r})),n=[i]):e>=32&&e<=127&&(n=0===t?[e]:[e,t]),n&&this.logger.log(3,(function(){return"Char codes = "+_s(n).join(",")})),n}},{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,i={};16===e||24===e?(r=Math.floor((t-32)/2),i.background=Ds[r],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));var n=e<=23?1:2;return this.channels[n].setBkgData(i),!0}},{key:"reset",value:function(){for(var e=0;e<Qm(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 Us(e,t,r){return r.a===e&&r.b===t}var Bs=function(){if(null!=_r&&_r.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(!sy(e))return!1;var r=t.toLowerCase();return!!~hy(e).call(e,r)&&r}function i(e){return r(t,e)}function n(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var s in a)e[s]=a[s]}return e}function a(t,a,s){var o=this,l={enumerable:!0};o.hasBeenReset=!1;var u="",c=!1,h=t,d=a,f=s,v=null,g="",p=!0,m="auto",y="start",E=50,k="middle",T=50,S="middle";iy(o,"id",n({},l,{get:function(){return u},set:function(e){u=""+e}})),iy(o,"pauseOnExit",n({},l,{get:function(){return c},set:function(e){c=!!e}})),iy(o,"startTime",n({},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}})),iy(o,"endTime",n({},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}})),iy(o,"text",n({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),iy(o,"region",n({},l,{get:function(){return v},set:function(e){v=e,this.hasBeenReset=!0}})),iy(o,"vertical",n({},l,{get:function(){return g},set:function(t){var i=r(e,t);if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");g=i,this.hasBeenReset=!0}})),iy(o,"snapToLines",n({},l,{get:function(){return p},set:function(e){p=!!e,this.hasBeenReset=!0}})),iy(o,"line",n({},l,{get:function(){return m},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");m=e,this.hasBeenReset=!0}})),iy(o,"lineAlign",n({},l,{get:function(){return y},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),iy(o,"position",n({},l,{get:function(){return E},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),iy(o,"positionAlign",n({},l,{get:function(){return k},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");k=t,this.hasBeenReset=!0}})),iy(o,"size",n({},l,{get:function(){return T},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");T=e,this.hasBeenReset=!0}})),iy(o,"align",n({},l,{get:function(){return S},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),o.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}(),Gs=function(){function e(){qm(this,e)}return Xm(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 Ks(e){function t(e,t,r,i){return 3600*(0|e)+60*(0|t)+(0|r)+ck(i||0)}var r=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?ck(r[2])>59?t(r[2],r[3],0,r[4]):t(r[1],r[2],r[3],r[4]):null}var Hs=function(){function e(){qm(this,e),this.values=t_(null)}return Xm(e,[{key:"set",value:function(e,t){this.get(e)||""===t||(wM(this)[e]=t)}},{key:"get",value:function(e,t,r){return r?this.has(e)?wM(this)[e]:t[r]:this.has(e)?wM(this)[e]:t}},{key:"has",value:function(e){return e in wM(this)}},{key:"alt",value:function(e,t,r){for(var i=0;i<r.length;++i)if(t===r[i]){this.set(e,t);break}}},{key:"integer",value:function(e,t){/^-?\d+$/.test(t)&&this.set(e,Ck(t,10))}},{key:"percent",value:function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var r=ck(t);if(r>=0&&r<=100)return this.set(e,r),!0}return!1}}]),e}();function Vs(e,t,r,i){var n=i?e.split(i):[e];for(var a in n)if("string"==typeof n[a]){var s=n[a].split(r);2===s.length&&t(s[0],s[1])}}var js=new Bs(0,0,""),Ys="middle"===js.align?"middle":"center";function Ws(e,t,r){var i=e;function n(){var t=Ks(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=n(),a(),"--\x3e"!==uy(e).call(e,0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=uy(e).call(e,3),a(),t.endTime=n(),a(),function(e,t){var i=new Hs;Vs(e,(function(e,t){var n;switch(e){case"region":for(var a=r.length-1;a>=0;a--)if(r[a].id===t){i.set(e,r[a].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":n=t.split(","),i.integer(e,n[0]),i.percent(e,n[0])&&i.set("snapToLines",!1),i.alt(e,n[0],["auto"]),2===n.length&&i.alt("lineAlign",n[1],["start",Ys,"end"]);break;case"position":n=t.split(","),i.percent(e,n[0]),2===n.length&&i.alt("positionAlign",n[1],["start",Ys,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",Ys,"end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var n=i.get("line","auto");"auto"===n&&-1===js.line&&(n=-1),t.line=n,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",Ys);var a=i.get("position","auto");"auto"===a&&50===js.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function qs(e){return e.replace(/<br(?: \/)?>/gi,"\n")}var zs=function(){function e(){qm(this,e),this.state="INITIAL",this.buffer="",this.decoder=new Gs,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}return Xm(e,[{key:"parse",value:function(e){var t=this;function r(){var e=t.buffer,r=0;for(e=qs(e);r<e.length&&"\r"!==e[r]&&"\n"!==e[r];)++r;var i=uy(e).call(e,0,r);return"\r"===e[r]&&++r,"\n"===e[r]&&++r,t.buffer=uy(e).call(e,r),i}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var i="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var n=(i=r()).match(/^()?WEBVTT([ \t].*)?$/);if(null==n||!n[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var a=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:i=r(),t.state){case"HEADER":/:/.test(i)?Vs(i,(function(e,t){}),/:/):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new Bs(0,0,""),t.state="CUE",-1===hy(i).call(i,"--\x3e")){t.cue.id=i;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Ws(i,t.cue,t.regionList)}catch(o){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var s=-1!==hy(i).call(i,"--\x3e");if(!i||s&&(a=!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+=i;continue;case"BADCUE":i||(t.state="ID")}}}catch(o){"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}(),Xs=/\r\n|\n\r|\n|\r/g,Qs=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return uy(e).call(e,r,r+t.length)===t};function $s(e,t,r){return ss(e.toString())+ss(t.toString())+ss(r)}function Js(e,t,r,i,n,a,s){var o,l,u=new zs,c=Ek(o=gt(new Uint8Array(e))).call(o).replace(Xs,"\n").split("\n"),h=[],d=t?function(e){return qn(e,9e4,1/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1))}(t.baseTime,t.timescale):0,f="00:00.000",v=0,g=0,p=!0;u.oncue=function(e){var a,s=r[i],o=r.ccOffset,u=(v-d)/9e4;if(null!=s&&s.new&&(void 0!==g?o=r.ccOffset=s.start:function(e,t,r){var i=e[t],n=e[i.prevCC];if(!n||!n.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;null!=(a=n)&&a.new;){var a;e.ccOffset+=i.start-n.start,i.new=!1,n=e[(i=n).prevCC]}e.presentationOffset=r}(r,i,u)),u){if(!t)return void(l=new Error("Missing initPTS for VTT MPEGTS"));o=u-r.presentationOffset}var c=e.endTime-e.startTime,f=Zn(9e4*(e.startTime+o-g),9e4*n)/9e4;e.startTime=Math.max(f,0),e.endTime=Math.max(f+c,0);var p=Ek(a=e.text).call(a);e.text=decodeURIComponent(encodeURIComponent(p)),e.id||(e.id=$s(e.startTime,e.endTime,p)),e.endTime>0&&h.push(e)},u.onparsingerror=function(e){l=e},u.onflush=function(){l?s(l):a(h)},ey(c).call(c,(function(e){if(p){if(Qs(e,"X-TIMESTAMP-MAP=")){var t;p=!1,ey(t=uy(e).call(e,16).split(",")).call(t,(function(e){Qs(e,"LOCAL:")?f=uy(e).call(e,6):Qs(e,"MPEGTS:")&&(v=Ck(uy(e).call(e,7)))}));try{g=function(e){var t=Ck(uy(e).call(e,-3)),r=Ck(uy(e).call(e,-6,-4)),i=Ck(uy(e).call(e,-9,-7)),n=e.length>9?Ck(e.substring(0,hy(e).call(e,":"))):0;if(!(_(t)&&_(r)&&_(i)&&_(n)))throw Error("Malformed X-TIMESTAMP-MAP: Local:".concat(e));return t+=1e3*r,t+=6e4*i,t+=36e5*n}(f)/1e3}catch(r){l=r}return}""===e&&(p=!1)}u.parse(e+"\n")})),u.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 io(e,t,r,i){var n=Ht(new Uint8Array(e),["mdat"]);if(0!==n.length){var a=Dy(n).call(n,(function(e){return gt(e)})),s=function(e,t){return qn(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{ey(a).call(a,(function(e){return r(function(e,t,r,i){var n=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");var a={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=eS(r=Qm(a)).call(r,(function(e,t){return e[t]=n.getAttribute("ttp:".concat(t))||a[t],e}),{}),o="preserve"!==n.getAttribute("xml:space"),l=ao(no(n,"styling","style")),u=ao(no(n,"layout","region")),c=no(n,"body","[begin]");return Jm(i=Dy([]).call(c,(function(e){var r=so(e,o);if(!r||!e.hasAttribute("begin"))return null;var i=uo(e.getAttribute("begin"),s),n=uo(e.getAttribute("dur"),s),a=uo(e.getAttribute("end"),s);if(null===i)throw lo(e);if(null===a){if(null===n)throw lo(e);a=i+n}var c=new Bs(i-t,a-t,r);c.id=$s(c.startTime,c.endTime,c.text);var h,d,f,v,g,p,m,y=(h=u[e.getAttribute("region")],d=l[e.getAttribute("style")],f=l,v="http://www.w3.org/ns/ttml#styling",g=null,p=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],(m=null!=h&&h.hasAttribute("style")?h.getAttribute("style"):null)&&f.hasOwnProperty(m)&&(g=f[m]),eS(p).call(p,(function(e,t){var r=oo(d,v,t)||oo(h,v,t)||oo(g,v,t);return r&&(e[t]=r),e}),{})),E=y.textAlign;if(E){var k=ro[E];k&&(c.lineAlign=k),c.align=E}return W(c,y),c}))).call(i,(function(e){return null!==e}))}(e,s))}))}catch(o){i(o)}}else i(new Error("Could not parse IMSC1 mdat"))}function no(e,t,r){var i=e.getElementsByTagName(t)[0];return i?uy([]).call(i.querySelectorAll(r)):[]}function ao(e){return eS(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 eS(r=uy([]).call(e.childNodes)).call(r,(function(e,r,i){var n,a;return"br"===r.nodeName&&i?e+"\n":null!=(a=r.childNodes)&&a.length?so(r,t):t?e+Ek(n=r.textContent).call(n).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 uo(e,t){if(!e)return null;var r,i,n,a,s=Ks(e);return null===s&&(eo.test(e)?(r=e,i=t,n=eo.exec(r),a=(0|n[4])+(0|n[5])/i.subFrameRate,s=3600*(0|n[1])+60*(0|n[2])+(0|n[3])+a/i.frameRate):to.test(e)&&(s=function(e,t){var r=to.exec(e),i=Number(r[1]);switch(r[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/t.frameRate;case"t":return i/t.tickRate}return i}(e,t))),s}var co=function(){function e(t,r){qm(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 Xm(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)&&ga(t,e)}var vo=/\s/,go={newCue:function(e,t,r,i){for(var n,a,s,o,l,u=[],c=self.VTTCue||self.TextTrackCue,h=0;h<i.rows.length;h++)if(s=!0,o=0,l="",!(n=i.rows[h]).isEmpty()){for(var d,f=0;f<n.chars.length;f++)vo.test(n.chars[f].uchar)&&s?o++:(l+=n.chars[f].uchar,s=!1);n.cueStartTime=t,t===r&&(r+=1e-4),o>=16?o--:o++;var v=qs(Ek(l).call(l)),g=$s(t,r,v);null!=e&&null!=(d=e.cues)&&d.getCueById(g)||((a=new c(t,r,v)).id=g,a.line=h+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*o/32)),u.push(a))}return e&&u.length&&(gT(u).call(u,(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})),ey(u).call(u,(function(t){return rs(e,t)}))),u}},po=/(\d+)-(\d+)\/(\d+)/,mo=function(){function e(t){qm(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||yo,this.controller=new self.AbortController,this.stats=new bt}return Xm(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 i=this,n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();var a,s,o,l=(a=e,s=this.controller.signal,o={method:"GET",mode:"cors",credentials:"same-origin",signal:s,headers:new self.Headers(W({},a.headers))},a.rangeEnd&&o.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),o),u=r.onProgress,c="arraybuffer"===e.responseType,h=c?"byteLength":"length",d=t.loadPolicy,f=d.maxTimeToFirstByteMs,v=d.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,l),self.clearTimeout(this.requestTimeout),t.timeout=f&&_(f)?f:v,this.requestTimeout=mE((function(){i.abortInternal(),r.onTimeout(n,e,i.response)}),t.timeout),(la(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then((function(a){i.response=i.loader=a;var s=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(i.requestTimeout),t.timeout=v,i.requestTimeout=mE((function(){i.abortInternal(),r.onTimeout(n,e,i.response)}),v-(s-n.loading.start)),!a.ok){var o=a.status,l=a.statusText;throw new Eo(l||"fetch, bad network response",o,a)}return n.loading.first=s,n.total=function(e){var t=e.get("Content-Range");if(t){var r=function(e){var t=po.exec(e);if(t)return Ck(t[2])-Ck(t[1])+1}(t);if(_(r))return r}var i=e.get("Content-Length");if(i)return Ck(i)}(a.headers)||n.total,u&&_(t.highWaterMark)?i.loadProgressively(a,n,e,t.highWaterMark,u):c?a.arrayBuffer():"json"===e.responseType?a.json():a.text()})).then((function(a){var s=i.response;if(!s)throw new Error("loader destroyed");self.clearTimeout(i.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);var o=a[h];o&&(n.loaded=n.total=o);var l={url:s.url,data:a,code:s.status};u&&!_(t.highWaterMark)&&u(n,e,a,s),r.onSuccess(l,n,e,s)})).catch((function(t){if(self.clearTimeout(i.requestTimeout),!n.aborted){var a=t&&t.code||0,s=t?t.message:null;r.onError({code:a,text:s},e,t?t.details:null,n)}}))}},{key:"getCacheAge",value:function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?ck(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 i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4?arguments[4]:void 0,a=new Ui,s=e.body.getReader();return function o(){return s.read().then((function(s){if(s.done)return a.dataLength&&n(t,r,a.flush().buffer,e),RR.resolve(new ArrayBuffer(0));var l=s.value,u=l.length;return t.loaded+=u,u<i||a.dataLength?(a.push(l),a.dataLength>=i&&n(t,r,a.flush().buffer,e)):n(t,r,l.buffer,e),o()})).catch((function(){return RR.reject()}))}()}}]),e}();function yo(e,t){return new self.Request(e.url,t)}var Eo=function(e){Ym(r,e);var t=Wm(r);function r(e,i,n){var a;return qm(this,r),(a=t.call(this,e)).code=void 0,a.details=void 0,a.code=i,a.details=n,a}return Xm(r)}(jm(Error)),ko=/^age:\s*[\d.]+\s*$/im,To=function(){function e(t){qm(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 bt,this.retryDelay=0}return Xm(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 i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;var a=this.xhrSetup;a?RR.resolve().then((function(){if(e.loader===i&&!e.stats.aborted)return a(i,r.url)})).catch((function(t){if(e.loader===i&&!e.stats.aborted)return i.open("GET",r.url,!0),a(i,r.url)})).then((function(){e.loader!==i||e.stats.aborted||e.openAndSendXhr(i,r,t)})).catch((function(t){e.callbacks.onError({code:i.status,text:t.message},r,i,n)})):this.openAndSendXhr(i,r,t)}}},{key:"openAndSendXhr",value:function(e,t,r){var i,n,a;e.readyState||e.open("GET",t.url,!0);var s=t.headers,o=r.loadPolicy,l=o.maxTimeToFirstByteMs,u=o.maxLoadTimeMs;if(s)for(var c in s)e.setRequestHeader(c,s[c]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=pE(i=this.readystatechange).call(i,this),e.onprogress=pE(n=this.loadprogress).call(n,this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),r.timeout=l&&_(l)?l:u,this.requestTimeout=mE(pE(a=this.loadtimeout).call(a,this),r.timeout),e.send()}},{key:"readystatechange",value:function(){var e,t=this.context,r=this.loader,i=this.stats;if(t&&r){var n=r.readyState,a=this.config;if(!i.aborted&&n>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),a.timeout!==a.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),a.timeout=a.loadPolicy.maxLoadTimeMs,this.requestTimeout=mE(pE(e=this.loadtimeout).call(e,this),a.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===n)){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 u=null!=l?l:r.response;if(null!=u){i.loading.end=Math.max(self.performance.now(),i.loading.first);var c="arraybuffer"===r.responseType?u.byteLength:u.length;if(i.loaded=i.total=c,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;var h=this.callbacks.onProgress;if(h&&h(i,t,u,r),!this.callbacks)return;var d={url:r.responseURL,data:u,code:o};return void this.callbacks.onSuccess(d,i,t,r)}}var f=a.loadPolicy.errorRetry;qe(f,i.retry,!1,{url:t.url,data:void 0,code:o})?this.retry(f):(te.error(py(s="".concat(o," while loading ")).call(s,t.url)),this.callbacks.onError({code:o,text:r.statusText},t,r,i))}}}},{key:"loadtimeout",value:function(){if(this.config){var e=this.config.loadPolicy.timeoutRetry;if(qe(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,i,n,a,s=this.context,o=this.stats;this.retryDelay=Ye(e,o.retry),o.retry++,te.warn(py(t=py(r=py(i=py(n="".concat(status?"HTTP Status "+status:"Timeout"," while loading ")).call(n,null==s?void 0:s.url,", retrying ")).call(i,o.retry,"/")).call(r,e.maxNumRetry," in ")).call(t,this.retryDelay,"ms")),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=mE(pE(a=this.loadInternal).call(a,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&&ko.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?ck(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}(),So=z(z({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:To,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:function(e){Ym(r,e);var t=Wm(r);function r(e){var i;return qm(this,r),(i=t.call(this,"abr",e.logger)).hls=void 0,i.lastLevelLoadSec=0,i.lastLoadedFragLevel=-1,i.firstSelection=-1,i._nextAutoLevel=-1,i.nextAutoLevelKey="",i.audioTracksByGroup=null,i.codecTiers=null,i.timer=-1,i.fragCurrent=null,i.partCurrent=null,i.bitrateTestDelay=0,i.bwEstimator=void 0,i._abandonRulesCheck=function(){var e,t,r,n,a,s,o,l,u,c,h,d,f=$f(i),v=f.fragCurrent,g=f.partCurrent,p=f.hls,m=p.autoLevelEnabled,y=p.media;if(v&&y){var E=performance.now(),k=g?g.stats:v.stats,T=g?g.duration:v.duration,S=E-k.loading.start,A=p.minAutoLevel;if(k.aborted||k.loaded&&k.loaded===k.total||v.level<=A)return i.clearTimer(),void(i._nextAutoLevel=-1);if(m&&!y.paused&&y.playbackRate&&y.readyState){var L=p.mainForwardBufferInfo;if(null!==L){var b=i.bwEstimator.getEstimateTTFB(),R=Math.abs(y.playbackRate);if(!(S<=Math.max(b,T/(2*R)*1e3))){var I=L.len/R,D=k.loading.first?k.loading.first-k.loading.start:-1,w=k.loaded&&D>-1,P=i.getBwEstimate(),C=p.levels,x=C[v.level],M=Math.max(k.loaded,Math.round(T*(v.bitrate||x.averageBitrate)/8)),F=w?S-D:S;F<1&&w&&(F=Math.min(S,8*k.loaded/P));var N=w?1e3*k.loaded/F:0,U=b/1e3,B=N?(M-k.loaded)/N:8*M/P+U;if(!(B<=I)){var G,K=N?8*N:P,H=!0===(null==(d=i.hls.latestLevelDetails)?void 0:d.live),V=i.hls.config.abrBandWidthUpFactor,j=Number.POSITIVE_INFINITY;for(G=v.level-1;G>A;G--){var Y=C[G].maxBitrate,W=!C[G].details||H;if((j=i.getTimeToLoadFrag(U,K,T*Y,W))<Math.min(I,T+U))break}if(!(j>=B||j>10*T)){w?i.bwEstimator.sample(S-Math.min(b,D),k.loaded):i.bwEstimator.sampleTTFB(S);var q=C[G].maxBitrate;i.getBwEstimate()*V>q&&i.resetEstimator(q);var z=i.findBestLevel(q,A,G,0,I,1,1);z>-1&&(G=z),i.warn(py(e=py(t=py(r=py(n=py(a=py(s=py(o=py(l=py(u=py(c=py(h="Fragment ".concat(v.sn)).call(h,g?" part "+g.index:""," of level ")).call(c,v.level," is loading too slowly;\n Fragment duration: ")).call(u,v.duration.toFixed(3),"\n Time to underbuffer: ")).call(l,I.toFixed(3)," s\n Estimated load time for current fragment: ")).call(o,B.toFixed(3)," s\n Estimated load time for down switch fragment: ")).call(s,j.toFixed(3)," s\n TTFB estimate: ")).call(a,0|D," ms\n Current BW estimate: ")).call(n,_(P)?0|P:"Unknown"," bps\n New BW estimate: ")).call(r,0|i.getBwEstimate()," bps\n Switching to level ")).call(t,G," @ ")).call(e,0|q," bps")),p.nextLoadLevel=p.nextAutoLevel=G,i.clearTimer(),i.timer=gE((function(){if(i.clearTimer(),i.fragCurrent===v&&i.hls.loadLevel===G&&G>0){var e,t,r=i.getStarvationDelay();if(i.warn(py(e=py(t="Aborting inflight request ".concat(G>0?"and switching down":"","\n Fragment duration: ")).call(t,v.duration.toFixed(3)," s\n Time to underbuffer: ")).call(e,r.toFixed(3)," s")),v.abortRequests(),i.fragCurrent=i.partCurrent=null,G>A){var n=i.findBestLevel(i.hls.levels[A].bitrate,A,G,0,r,1,1);-1===n&&(n=A),i.hls.nextLoadLevel=i.hls.nextAutoLevel=n,i.resetEstimator(i.hls.levels[n].bitrate)}}}),1e3*j),p.trigger(O.FRAG_LOAD_EMERGENCY_ABORTED,{frag:v,part:g,stats:k})}}}}}}},i.hls=e,i.bwEstimator=i.initEstimator(),i.registerListeners(),i}return Xm(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 j(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}},{key:"registerListeners",value:function(){var e=this.hls;e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.FRAG_LOADING,this.onFragLoading,this),e.on(O.FRAG_LOADED,this.onFragLoaded,this),e.on(O.FRAG_BUFFERED,this.onFragBuffered,this),e.on(O.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(O.LEVEL_LOADED,this.onLevelLoaded,this),e.on(O.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(O.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(O.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.FRAG_LOADING,this.onFragLoading,this),e.off(O.FRAG_LOADED,this.onFragLoaded,this),e.off(O.FRAG_BUFFERED,this.onFragBuffered,this),e.off(O.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(O.LEVEL_LOADED,this.onLevelLoaded,this),e.off(O.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(O.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(O.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,i=t.frag;this.ignoreFragment(i)||(i.bitrateTest||(this.fragCurrent=i,this.partCurrent=null!=(r=t.part)?r:null),this.clearTimer(),this.timer=gE(this._abandonRulesCheck,100))}},{key:"onLevelSwitching",value:function(e,t){this.clearTimer()}},{key:"onError",value:function(e,t){if(!t.fatal)switch(t.details){case M.BUFFER_ADD_CODEC_ERROR:case M.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case M.FRAG_LOAD_TIMEOUT:var r=t.frag,i=this.fragCurrent,n=this.partCurrent;if(r&&i&&r.sn===i.sn&&r.level===i.level){var a=performance.now(),s=n?n.stats:r.stats,o=a-s.loading.start,l=s.loading.first?s.loading.first-s.loading.start:-1;if(s.loaded&&l>-1){var u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(o-Math.min(u,l),s.loaded)}else this.bwEstimator.sampleTTFB(o)}}}},{key:"getTimeToLoadFrag",value:function(e,t,r,i){return e+r/t+(i?this.lastLevelLoadSec:0)}},{key:"onLevelLoaded",value:function(e,t){var r=this.hls.config,i=t.stats.loading,n=i.end-i.start;_(n)&&(this.lastLevelLoadSec=n/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,i=t.part,n=i?i.stats:r.stats;if(r.type===G&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(r)){if(this.clearTimer(),r.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var a=i?i.duration:r.duration,s=this.hls.levels[r.level],o=(s.loaded?s.loaded.bytes:0)+n.loaded,l=(s.loaded?s.loaded.duration:0)+a;s.loaded={bytes:o,duration:l},s.realBitrate=Math.round(8*o/l)}if(r.bitrateTest){var u={stats:n,frag:r,part:i,id:r.type};this.onFragBuffered(O.FRAG_BUFFERED,u),r.bitrateTest=!1}else this.lastLoadedFragLevel=r.level}}},{key:"onFragBuffered",value:function(e,t){var r=t.frag,i=t.part,n=null!=i&&i.stats.loaded?i.stats:r.stats;if(!n.aborted&&!this.ignoreFragment(r)){var a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}}},{key:"ignoreFragment",value:function(e){return e.type!==G||"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,i=t.minAutoLevel,n=this.getBwEstimate(),a=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,i,r,0,a,1,1);if(s>-1)return s;var o=this.hls.firstLevel,l=Math.min(Math.max(o,i),r);return this.warn(py(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 i=t&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){var n=this.hls.levels;if(n.length>Math.max(e,i)&&n[e].loadError<=n[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i},set:function(e){var t=this.hls,r=t.maxAutoLevel,i=t.minAutoLevel,n=Math.min(Math.max(e,i),r);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}},{key:"getAutoLevelKey",value:function(){var e;return py(e="".concat(this.getBwEstimate(),"_")).call(e,this.getStarvationDelay().toFixed(2))}},{key:"getNextABRAutoLevel",value:function(){var e,t=this.fragCurrent,r=this.partCurrent,i=this.hls;if(i.levels.length<=1)return i.loadLevel;var n=i.maxAutoLevel,a=i.config,s=i.minAutoLevel,o=r?r.duration:t?t.duration:0,l=this.getBwEstimate(),u=this.getStarvationDelay(),c=a.abrBandWidthFactor,h=a.abrBandWidthUpFactor;if(u){var d=this.findBestLevel(l,s,n,u,0,c,h);if(d>=0)return d}var f=o?Math.min(o,a.maxStarvationDelay):a.maxStarvationDelay;if(!u){var v,g=this.bitrateTestDelay;g&&(f=(o?Math.min(o,a.maxLoadingDelay):a.maxLoadingDelay)-g,this.info(py(v="bitrate test took ".concat(Math.round(1e3*g),"ms, set first fragment max fetchDuration to ")).call(v,Math.round(1e3*f)," ms")),c=h=1)}var p=this.findBestLevel(l,s,n,u,f,c,h);if(this.info(py(e="".concat(u?"rebuffering expected":"buffer is empty",", optimal quality level ")).call(e,p)),p>-1)return p;var m=i.levels[s],y=i.levels[i.loadLevel];return(null==m?void 0:m.bitrate)<(null==y?void 0:y.bitrate)?s:i.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,i=e.mainForwardBufferInfo;return(i?i.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,i,n,a,s){var o,l=this,u=i+n,c=this.lastLoadedFragLevel,h=-1===c?this.hls.firstLevel:c,d=this.fragCurrent,f=this.partCurrent,v=this.hls,g=v.levels,p=v.allAudioTracks,m=v.loadLevel,y=v.config;if(1===g.length)return 0;var E,k,T,S,A,L,b=g[h],R=!(null==(o=this.hls.latestLevelDetails)||!o.live),I=-1===m||-1===c,D="SDR",w=(null==b?void 0:b.frameRate)||0,P=y.audioPreference,C=y.videoPreference,x=this.audioTracksByGroup||(this.audioTracksByGroup=Pe(p)),M=-1;if(I){if(-1!==this.firstSelection)return this.firstSelection;var O=function(e,t,r,i,n){for(var a=Qm(e),s=null==i?void 0:i.channels,o=null==i?void 0:i.audioCodec,l=null==n?void 0:n.videoCodec,u=s&&2===Ck(s),c=!1,h=!1,d=1/0,f=1/0,v=1/0,g=1/0,p=0,m=[],y=we(t,n),E=y.preferHDR,k=y.allowedVideoRanges,T=function(){var t=e[a[S]];c||(c=t.channels[2]>0),d=Math.min(d,t.minHeight),f=Math.min(f,t.minFramerate),v=Math.min(v,t.minBitrate),Jm(k).call(k,(function(e){return t.videoRanges[e]>0})).length>0&&(h=!0)},S=a.length;S--;)T();d=_(d)?d:0,f=_(f)?f:0;var A=Math.max(1080,d),L=Math.max(30,f);v=_(v)?v:r,r=Math.max(v,r),h||(t=void 0);var b=a.length>1;return{codecSet:eS(a).call(a,(function(t,i){var n=e[i];if(i===t)return t;if(m=h?Jm(k).call(k,(function(e){return n.videoRanges[e]>0})):[],b){var a,d,f,v,y;if(n.minBitrate>r)return _e(i,py(a="min bitrate of ".concat(n.minBitrate," > current estimate of ")).call(a,r)),t;if(!n.hasDefaultAudio)return _e(i,"no renditions with default or auto-select sound found"),t;if(o&&hy(i).call(i,o.substring(0,4))%5!=0)return _e(i,'audio codec preference "'.concat(o,'" not found')),t;if(s&&!u){if(!n.channels[s])return _e(i,py(y="no renditions with ".concat(s," channel sound found (channels options: ")).call(y,Qm(n.channels),")")),t}else if((!o||u)&&c&&0===n.channels[2])return _e(i,"no renditions with stereo sound found"),t;if(n.minHeight>A)return _e(i,py(d="min resolution of ".concat(n.minHeight," > maximum of ")).call(d,A)),t;if(n.minFramerate>L)return _e(i,py(f="min framerate of ".concat(n.minFramerate," > maximum of ")).call(f,L)),t;if(!Sy(m).call(m,(function(e){return n.videoRanges[e]>0})))return _e(i,"no variants with VIDEO-RANGE of ".concat(x_(m)," found")),t;if(l&&hy(i).call(i,l.substring(0,4))%5!=0)return _e(i,'video codec preference "'.concat(l,'" not found')),t;if(n.maxScore<p)return _e(i,py(v="max score of ".concat(n.maxScore," < selected max of ")).call(v,p)),t}return t&&(ue(i)>=ue(t)||n.fragmentError>e[t].fragmentError)?t:(g=n.minIndex,p=n.maxScore,i)}),void 0),videoRanges:m,preferHDR:E,minFramerate:f,minBitrate:v,minIndex:g}}(this.codecTiers||(this.codecTiers=(T=x,S=t,A=r,eS(L=uy(k=g).call(k,S,A+1)).call(L,(function(e,t,r){if(!t.codecSet)return e;var i=t.audioGroups,n=e[t.codecSet];n||(e[t.codecSet]=n={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),n.minBitrate=Math.min(n.minBitrate,t.bitrate);var a=Math.min(t.height,t.width);return n.minHeight=Math.min(n.minHeight,a),n.minFramerate=Math.min(n.minFramerate,t.frameRate),n.minIndex=Math.min(n.minIndex,r),n.maxScore=Math.max(n.maxScore,t.score),n.fragmentError+=t.fragmentError,n.videoRanges[t.videoRange]=(n.videoRanges[t.videoRange]||0)+1,i&&ey(i).call(i,(function(e){var t;if(e){var r=T.groups[e];r&&(n.hasDefaultAudio=n.hasDefaultAudio||T.hasDefaultAudio?r.hasDefault:r.hasAutoSelect||!T.hasDefaultAudio&&!T.hasAutoSelectAudio,ey(t=Qm(r.channels)).call(t,(function(e){n.channels[e]=(n.channels[e]||0)+r.channels[e]})))}})),e}),{}))),D,e,P,C),F=O.codecSet,N=O.videoRanges,U=O.minFramerate,B=O.minBitrate,G=O.minIndex,K=O.preferHDR;M=G,E=F,D=K?N[N.length-1]:N[0],w=U,e=Math.max(e,B),this.log("picked start tier ".concat(x_(O)))}else E=null==b?void 0:b.codecSet,D=null==b?void 0:b.videoRange;for(var H=f?f.duration:d?d.duration:0,V=this.bwEstimator.getEstimateTTFB()/1e3,j=[],Y=function(){var t=g[W],o=W>h;if(!t)return"continue";if(y.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){var d=navigator.mediaCapabilities;"function"!=typeof(null==d?void 0:d.decodingInfo)||!ye(t,x,D,w,e,P)&&"hvc1"!==(null==(z=t.videoCodec)?void 0:z.substring(0,4))?t.supportedResult=pe:(t.supportedPromise=Ee(t,x,d),t.supportedPromise.then((function(e){var r,i,n;if(l.hls){t.supportedResult=e;var a=l.hls.levels,s=hy(a).call(a,t);e.error?l.warn(py(r=py(i='MediaCapabilities decodingInfo error: "'.concat(e.error,'" for level ')).call(i,s," ")).call(r,x_(e))):e.supported||(l.warn(py(n="Unsupported MediaCapabilities decodingInfo result for level ".concat(s," ")).call(n,x_(e))),s>-1&&a.length>1&&(l.log("Removing unsupported level ".concat(s)),l.hls.removeLevel(s),-1===l.hls.loadLevel&&(l.hls.nextLoadLevel=0)))}})))}if((E&&t.codecSet!==E||D&&t.videoRange!==D||o&&w>t.frameRate||!o&&w>0&&w<t.frameRate||t.supportedResult&&(null==(q=t.supportedResult.decodingInfoResults)||!q[0].smooth))&&(!I||W!==M))return j.push(W),"continue";var v,p=t.details,k=(f?null==p?void 0:p.partTarget:null==p?void 0:p.averagetargetduration)||H;v=o?s*e:a*e;var T=H&&i>=2*H&&0===n?t.averageBitrate:t.maxBitrate,S=l.getTimeToLoadFrag(V,v,T*k,void 0===p);if(v>=T&&(W===c||0===t.loadError&&0===t.fragmentError)&&(S<=V||!_(S)||R&&!l.bitrateTestDelay||S<u)){var A,L,b,C,O,F,N,U,B,G,K,Y,X,Q,$,J,Z=l.forcedAutoLevel;return{v:(W===m||-1!==Z&&Z===m||(j.length&&l.trace(py(A=py(L=py(b=py(C=py(O="Skipped level(s) ".concat(j.join(",")," of ")).call(O,r,' max with CODECS and VIDEO-RANGE:"')).call(C,g[j[0]].codecs,'" ')).call(b,g[j[0]].videoRange,'; not compatible with "')).call(L,E,'" ')).call(A,D)),l.info(py(F=py(N=py(U=py(B=py(G=py(K=py(Y=py(X=py(Q=py($=py(J="switch candidate:".concat(h,"->")).call(J,W," adjustedbw(")).call($,Math.round(v),")-bitrate=")).call(Q,Math.round(v-T)," ttfb:")).call(X,V.toFixed(1)," avgDuration:")).call(Y,k.toFixed(1)," maxFetchDuration:")).call(K,u.toFixed(1)," fetchDuration:")).call(G,S.toFixed(1)," firstSelection:")).call(B,I," codecSet:")).call(U,t.codecSet," videoRange:")).call(N,t.videoRange," hls.loadLevel:")).call(F,m))),I&&(l.firstSelection=W),W)}}},W=r;W>=t;W--){var q,z,X=Y();if("continue"!==X&&"object"===qh(X))return X.v}return-1}}]),r}(X),bufferController:function(e){Ym(r,e);var t=Wm(r);function r(e,i){var n,a;return qm(this,r),(n=t.call(this,"buffer-controller",e.logger)).hls=void 0,n.fragmentTracker=void 0,n.details=null,n._objectUrl=null,n.operationQueue=null,n.bufferCodecEventsTotal=0,n.media=null,n.mediaSource=null,n.lastMpegAudioChunk=null,n.blockedAudioAppend=null,n.lastVideoAppendEnd=0,n.appendSource=void 0,n.transferData=void 0,n.overrides=void 0,n.appendErrors={audio:0,video:0,audiovideo:0},n.tracks={},n.sourceBuffers=[[null,null],[null,null]],n._onEndStreaming=function(e){var t;n.hls&&"open"===(null==(t=n.mediaSource)?void 0:t.readyState)&&n.hls.pauseBuffering()},n._onStartStreaming=function(e){n.hls&&n.hls.resumeBuffering()},n._onMediaSourceOpen=function(e){var t=$f(n),r=t.media,i=t.mediaSource;e&&n.log("Media source opened"),r&&i&&(r.removeEventListener("emptied",n._onMediaEmptied),n.updateDuration(),n.hls.trigger(O.MEDIA_ATTACHED,{media:r,mediaSource:i}),i.removeEventListener("sourceopen",n._onMediaSourceOpen),null!==n.mediaSource&&n.checkPendingTracks())},n._onMediaSourceClose=function(){n.log("Media source closed")},n._onMediaSourceEnded=function(){n.log("Media source ended")},n._onMediaEmptied=function(){var e,t=$f(n),r=t.mediaSrc,i=t._objectUrl;r!==i&&n.error(py(e="Media element src was set while attaching MediaSource (".concat(i," > ")).call(e,r,")"))},n.hls=e,n.fragmentTracker=i,n.appendSource=(a=re(e.config.preferManagedMediaSource),"undefined"!=typeof self&&a===self.ManagedMediaSource),n.initTracks(),n.registerListeners(),n}return Xm(r,[{key:"hasSourceTypes",value:function(){return Qm(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(O.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.MANIFEST_PARSED,this.onManifestParsed,this),e.on(O.BUFFER_RESET,this.onBufferReset,this),e.on(O.BUFFER_APPENDING,this.onBufferAppending,this),e.on(O.BUFFER_CODECS,this.onBufferCodecs,this),e.on(O.BUFFER_EOS,this.onBufferEos,this),e.on(O.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(O.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(O.FRAG_PARSED,this.onFragParsed,this),e.on(O.FRAG_CHANGED,this.onFragChanged,this),e.on(O.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(O.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.MANIFEST_PARSED,this.onManifestParsed,this),e.off(O.BUFFER_RESET,this.onBufferReset,this),e.off(O.BUFFER_APPENDING,this.onBufferAppending,this),e.off(O.BUFFER_CODECS,this.onBufferCodecs,this),e.off(O.BUFFER_EOS,this.onBufferEos,this),e.off(O.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(O.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(O.FRAG_PARSED,this.onFragParsed,this),e.off(O.FRAG_CHANGED,this.onFragChanged,this),e.off(O.ERROR,this.onError,this)}},{key:"transferMedia",value:function(){var e,t=this,r=this.media,i=this.mediaSource;if(!r)return null;var n={};if(this.operationQueue){var a,s,o=this.isUpdating();o||this.operationQueue.removeBlockers();var l=this.isQueued();(o||l)&&this.warn(py(a=py(s="Transfering MediaSource with".concat(l?" operations in queue":"")).call(s,o?" updating SourceBuffer(s)":""," ")).call(a,this.operationQueue)),this.operationQueue.destroy()}var u=this.transferData;return!this.sourceBufferCount&&u&&u.mediaSource===i?W(n,u.tracks):ey(e=this.sourceBuffers).call(e,(function(e){var r=mf(e,1)[0];r&&(n[r]=W({},t.tracks[r]),t.removeBuffer(r)),e[0]=e[1]=null})),{media:r,mediaSource:i,tracks:n}}},{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,i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsTotal=i,this.log("".concat(i," bufferCodec event(s) expected.")),null!=(r=this.transferData)&&r.mediaSource&&this.sourceBufferCount&&i&&this.bufferCreated()}},{key:"onMediaAttaching",value:function(e,t){var r,i,n,a=this.media=t.media,s=re(this.appendSource);if(this.transferData=this.overrides=void 0,a&&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=a.src,this.attachTransferred();else{var u=this._objectUrl=e_.createObjectURL(l);if(this.appendSource)try{a.removeAttribute("src");var c=self.ManagedMediaSource;a.disableRemotePlayback=a.disableRemotePlayback||c&&l instanceof c,Ta(a),r=a,i=u,(n=self.document.createElement("source")).type="video/mp4",n.src=i,r.appendChild(n),a.load()}catch(h){a.src=u}else a.src=u}a.addEventListener("emptied",this._onMediaEmptied)}}},{key:"assignMediaSource",value:function(e){var t,r,i;this.log(py(t="".concat((null==(r=this.transferData)?void 0:r.mediaSource)===e?"transferred":"created"," media source: ")).call(t,null==(i=e.constructor)?void 0:i.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 i=this.tracks,n=r.tracks,a=n?Qm(n):null,s=a?a.length:0,o=function(){e.media&&e.mediaSourceOpenOrEnded&&e._onMediaSourceOpen()};if(n&&a&&s){var l,u;if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log(py(l=py(u="attachTransferred: (bufferCodecEventsTotal ".concat(this.bufferCodecEventsTotal,")\nrequired tracks: ")).call(u,x_(i,(function(e,t){return"initSegment"===e?void 0:t})),";\ntransfer tracks: ")).call(l,x_(n,(function(e,t){return"initSegment"===e?void 0:t})),"}")),!ie(n,i)){var c,h,d,f;r.mediaSource=null,r.tracks=void 0;var v=t.currentTime,g=this.details,p=Math.max(v,(null==g?void 0:g.fragments[0].start)||0);return p-v>1?void this.log(py(c="attachTransferred: waiting for playback to reach new tracks start time ".concat(v," -> ")).call(c,p)):(this.warn(py(h=py(d=py(f='attachTransferred: resetting MediaSource for incompatible tracks ("'.concat(Qm(n),'"->"')).call(f,Qm(i),'") start time: ')).call(d,p," currentTime: ")).call(h,v)),this.onMediaDetaching(O.MEDIA_DETACHING,{}),this.onMediaAttaching(O.MEDIA_ATTACHING,r),void(t.currentTime=p))}this.transferData=void 0,ey(a).call(a,(function(t){var r=t,i=n[r];if(i){var a=i.buffer;if(a){var s=e.fragmentTracker,o=i.id;if(s.hasFragments(o)||s.hasParts(o)){var l=fr.getBuffered(a);s.detectEvictedFragments(r,l,o,null,!0)}var u=Sa(r),c=[r,a];e.sourceBuffers[u]=c,a.updating&&e.operationQueue&&e.operationQueue.prependBlocker(r),e.trackSourceBuffer(r,i)}}})),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,i=!!t.transferMedia;this.transferData=this.overrides=void 0;var n=this.media,a=this.mediaSource,s=this._objectUrl;if(a){var o;if(this.log("media source "+(i?"transferring":"detaching")),i)ey(o=this.sourceBuffers).call(o,(function(e){var t=mf(e,1)[0];t&&r.removeBuffer(t)})),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){var l="open"===a.readyState;try{for(var u=a.sourceBuffers,c=u.length;c--;)l&&u[c].abort(),a.removeSourceBuffer(u[c]);l&&a.endOfStream()}catch(Ho){this.warn("onMediaDetaching: ".concat(Ho.message," while calling endOfStream"))}}this.sourceBufferCount&&this.onBufferReset()}a.removeEventListener("sourceopen",this._onMediaSourceOpen),a.removeEventListener("sourceended",this._onMediaSourceEnded),a.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(a.removeEventListener("startstreaming",this._onStartStreaming),a.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(s&&e_.revokeObjectURL(s),this.mediaSrc===s?(n.removeAttribute("src"),this.appendSource&&Ta(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(O.MEDIA_DETACHED,t)}},{key:"onBufferReset",value:function(){var e,t=this;ey(e=this.sourceBuffers).call(e,(function(e){var r=mf(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 i;null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(Ho){this.warn("onBufferReset ".concat(e),Ho)}delete this.tracks[e]}},{key:"removeBuffer",value:function(e){this.removeBufferListeners(e),this.sourceBuffers[Sa(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 ma(this.tracks)}},{key:"onBufferCodecs",value:function(e,t){var r,i,n=this,a=this.tracks,s=Qm(t);this.log(py(r='BUFFER_CODECS: "'.concat(s,'" (current SB count ')).call(r,this.sourceBufferCount,")"));var o="audiovideo"in t&&(a.audio||a.video)||a.audiovideo&&("audio"in t||"video"in t),l=!o&&this.sourceBufferCount&&this.media&&Sy(s).call(s,(function(e){return!a[e]}));o||l?this.warn(py(i='Unsupported transition between "'.concat(Qm(a),'" and "')).call(i,s,'" SourceBuffers')):(ey(s).call(s,(function(e){var r,i,s,o,l=t[e],u=l.id,c=l.codec,h=l.levelCodec,d=l.container,f=l.metadata,v=a[e],g=null==(i=n.transferData)||null==(s=i.tracks)?void 0:s[e],p=null!=g&&g.buffer?g:v,m=(null==p?void 0:p.pendingCodec)||(null==p?void 0:p.codec),y=null==p?void 0:p.levelCodec,E=!p||!!n.hls.config.assetPlayerId;v||(v=a[e]={buffer:void 0,listeners:[],codec:c,container:d,levelCodec:h,metadata:f,id:u});var k=fe(m,y),T=null==k?void 0:k.replace(ya,"$1"),S=fe(c,h),A=null==(o=S)?void 0:o.replace(ya,"$1");S&&(T!==A||E)&&("audio"===uy(e).call(e,0,5)&&(S=de(S,n.appendSource)),n.log(py(r="switching codec ".concat(m," to ")).call(r,S)),S!==(v.pendingCodec||v.codec)&&(v.pendingCodec=S),v.container=d,n.appendChangeType(e,d,S))})),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}},{key:"sourceBufferTracks",get:function(){var e,t=this;return eS(e=Qm(this.tracks)).call(e,(function(e,r){var i=t.tracks[r];return e[r]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e}),{})}},{key:"appendChangeType",value:function(e,t,r){var i,n=this,a=py(i="".concat(t,";codecs=")).call(i,r),s={label:"change-type=".concat(a),execute:function(){var i=n.tracks[e];if(i){var s,o=i.buffer;null!=o&&o.changeType&&(n.log(py(s="changing ".concat(e," sourceBuffer type to ")).call(s,a)),o.changeType(a),i.codec=r,i.container=t)}n.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){n.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,i=e.start,n=i+.05*e.duration;if(!0!==(null==(t=this.fragmentTracker.getAppendedFrag(i,G))?void 0:t.gap)){var a={label:"block-audio",execute:function(){var e,t=r.tracks.video;(r.lastVideoAppendEnd>n||null!=t&&t.buffer&&fr.isBuffered(t.buffer,n)||!0===(null==(e=r.fragmentTracker.getAppendedFrag(n,G))?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:a,frag:e},this.append(a,"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,i=this.tracks,n=t.data,a=t.type,s=t.parent,o=t.frag,l=t.part,u=t.chunkMeta,c=u.buffering[a],h=o.sn,d=self.performance.now();c.start=d;var f=o.stats.buffering,v=l?l.stats.buffering:null;0===f.start&&(f.start=d),v&&0===v.start&&(v.start=d);var g=i.audio,p=!1;"audio"===a&&"audio/mpeg"===(null==g?void 0:g.container)&&(p=!this.lastMpegAudioChunk||1===u.id||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);var m=this.tracks.video,y=null==m?void 0:m.buffer;if(y&&"initSegment"!==h){var E=l||o,k=this.blockedAudioAppend;if("audio"!==a||"main"===s||this.blockedAudioAppend){if("video"===a){var T=E.end;if(k){var S=k.frag.start;(T>S||T<this.lastVideoAppendEnd||fr.isBuffered(y,S))&&this.unblockAudio()}this.lastVideoAppendEnd=T}}else{var A=E.start+.05*E.duration,L=y.buffered,b=this.currentOp("video");L.length||b?!b&&!fr.isBuffered(y,A)&&this.lastVideoAppendEnd<A&&this.blockAudio(E):this.blockAudio(E)}}var R=(l||o).start,I={label:"append-".concat(a),execute:function(){if(c.executeStart=self.performance.now(),p){var e=r.tracks[a];if(e){var t=e.buffer;if(t){var i,s,o=R-t.timestampOffset;Math.abs(o)>=.1&&(r.log(py(i=py(s="Updating audio SourceBuffer timestampOffset to ".concat(R," (delta: ")).call(s,o,") sn: ")).call(i,h,")")),t.timestampOffset=R)}}}r.appendExecutor(n,a)},onStart:function(){},onComplete:function(){var e,t=self.performance.now();c.executeEnd=c.end=t,0===f.first&&(f.first=t),v&&0===v.first&&(v.first=t);var i={};ey(e=r.sourceBuffers).call(e,(function(e){var t=mf(e,2),r=t[0],n=t[1];r&&(i[r]=fr.getBuffered(n))})),r.appendErrors[a]=0,"audio"===a||"video"===a?r.appendErrors.audiovideo=0:(r.appendErrors.audio=0,r.appendErrors.video=0),r.hls.trigger(O.BUFFER_APPENDED,{type:a,frag:o,part:l,chunkMeta:u,parent:o.type,timeRanges:i})},onError:function(e){var t,i={type:x.MEDIA_ERROR,parent:o.type,details:M.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:o,part:l,chunkMeta:u,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)i.details=M.BUFFER_FULL_ERROR;else if(e.code!==DOMException.INVALID_STATE_ERR||!r.mediaSourceOpenOrEnded||null!=(t=r.media)&&t.error)if(e.name===Ea)0===r.sourceBufferCount?i.errorAction=tt(!0):++r.appendErrors[a];else{var n,s,c=++r.appendErrors[a];r.warn(py(n=py(s="Failed ".concat(c,"/")).call(s,r.hls.config.appendErrorMaxRetry,' times to append segment in "')).call(n,a,'" sourceBuffer')),c>=r.hls.config.appendErrorMaxRetry&&(i.fatal=!0)}else i.errorAction=tt(!0);r.hls.trigger(O.ERROR,i)}};this.append(I,a,this.isPending(this.tracks[a]))}},{key:"getFlushOp",value:function(e,t,r){var i,n,a=this;return this.log(py(i=py(n='queuing "'.concat(e,'" remove ')).call(n,t,"-")).call(i,r)),{label:"remove",execute:function(){a.removeExecutor(e,t,r)},onStart:function(){},onComplete:function(){a.hls.trigger(O.BUFFER_FLUSHED,{type:e})},onError:function(i){var n,s;a.warn(py(n=py(s="Failed to remove ".concat(t,"-")).call(s,r,' from "')).call(n,e,'" SourceBuffer'),i)}}}},{key:"onBufferFlushing",value:function(e,t){var r,i=this,n=t.type,a=t.startOffset,s=t.endOffset;n?this.append(this.getFlushOp(n,a,s),n):ey(r=this.sourceBuffers).call(r,(function(e){var t=mf(e,1)[0];t&&i.append(i.getFlushOp(t,a,s),t)}))}},{key:"onFragParsed",value:function(e,t){var r,i,n=this,a=t.frag,s=t.part,o=[],l=s?s.elementaryStreams:a.elementaryStreams;l[Dt]?o.push("audiovideo"):(l[Rt]&&o.push("audio"),l[It]&&o.push("video")),0===o.length&&this.warn(py(r=py(i="Fragments must have at least one ElementaryStreamType set. type: ".concat(a.type," level: ")).call(i,a.level," sn: ")).call(r,a.sn)),this.blockBuffers((function(){var e=self.performance.now();a.stats.buffering.end=e,s&&(s.stats.buffering.end=e);var t=s?s.stats:a.stats;n.hls.trigger(O.FRAG_BUFFERED,{frag:a,part:s,stats:t,id:a.type})}),o)}},{key:"onFragChanged",value:function(e,t){this.trimBuffers()}},{key:"bufferedToEnd",get:function(){var e,t=this;return this.sourceBufferCount>0&&!Sy(e=this.sourceBuffers).call(e,(function(e){var r,i,n=mf(e,1)[0];return n&&(!(null!=(r=t.tracks[n])&&r.ended)||(null==(i=t.tracks[n])?void 0:i.ending))}))}},{key:"onBufferEos",value:function(e,t){var r,i,n,a=this;ey(r=this.sourceBuffers).call(r,(function(e){var r=mf(e,1)[0];if(r){var i=a.tracks[r];t.type&&t.type!==r||(i.ending=!0,i.ended||(i.ended=!0,a.log("".concat(r," buffer reached EOS"))))}}));var s=!1!==(null==(n=this.overrides)?void 0:n.endOfStream);this.sourceBufferCount>0&&!Sy(i=this.sourceBuffers).call(i,(function(e){var t,r=mf(e,1)[0];return r&&!(null!=(t=a.tracks[r])&&t.ended)}))&&(this.log("Queueing EOS"),this.blockUntilOpen((function(){var e;if(ey(e=a.sourceBuffers).call(e,(function(e){var t=mf(e,1)[0];if(null!==t){var r=a.tracks[t];r&&(r.ending=!1)}})),s){var t=a.mediaSource;if(!t||"open"!==t.readyState)return void(t&&a.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: ".concat(t.readyState)));a.log("Calling mediaSource.endOfStream()"),t.endOfStream()}a.hls.trigger(O.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===M.BUFFER_APPEND_ERROR&&t.frag){var r,i=null==(r=t.errorAction)?void 0:r.nextAutoLevel;_(i)&&i!==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 i=e.config,n=r.currentTime,a=t.levelTargetDuration,s=t.live&&null!==i.liveBackBufferLength?i.liveBackBufferLength:i.backBufferLength;if(_(s)&&s>=0){var o=Math.max(s,a),l=Math.floor(n/a)*a-o;this.flushBackBuffer(n,a,l)}if(_(i.frontBufferFlushThreshold)&&i.frontBufferFlushThreshold>0){var u=Math.max(i.maxBufferLength,i.frontBufferFlushThreshold),c=Math.max(u,a),h=Math.floor(n/a)*a+c;this.flushFrontBuffer(n,a,h)}}}},{key:"flushBackBuffer",value:function(e,t,r){var i,n=this;ey(i=this.sourceBuffers).call(i,(function(i){var a=mf(i,2),s=a[0],o=a[1];if(o){var l=fr.getBuffered(o);if(l.length>0&&r>l.start(0)){var u;n.hls.trigger(O.BACK_BUFFER_REACHED,{bufferEnd:r});var c=n.tracks[s];if(null!=(u=n.details)&&u.live)n.hls.trigger(O.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(null!=c&&c.ended&&l.end(l.length-1)-e<2*t)return void n.log("Cannot flush ".concat(s," back buffer while SourceBuffer is in ended state"));n.hls.trigger(O.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:s})}}}))}},{key:"flushFrontBuffer",value:function(e,t,r){var i,n=this;ey(i=this.sourceBuffers).call(i,(function(i){var a=mf(i,2),s=a[0],o=a[1];if(o){var l=fr.getBuffered(o),u=l.length;if(u<2)return;var c=l.start(u-1),h=l.end(u-1),d=n.tracks[s];if(r>c||e>=c&&e<=h)return;if(null!=d&&d.ended&&e-h<2*t)return void n.log("Cannot flush ".concat(s," front buffer while SourceBuffer is in ended state"));n.hls.trigger(O.BUFFER_FLUSHING,{startOffset:c,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 i=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(r.duration=1/0,t.fragments.length&&t.live&&r.setLiveSeekableRange){var n=Math.max(0,t.fragmentStart);return{duration:1/0,start:n,end:Math.max(n,i)}}return{duration:1/0}}var a=null==(e=this.overrides)?void 0:e.duration;if(a)return{duration:a};var s=this.media.duration;return i>(_(r.duration)?r.duration:0)&&i>s||!_(s)?{duration:i}:null}},{key:"updateMediaSource",value:function(e){var t,r,i=e.duration,n=e.start,a=e.end,s=this.mediaSource;this.media&&s&&"open"===s.readyState&&(s.duration!==i&&(_(i)&&this.log("Updating MediaSource duration to ".concat(i.toFixed(3))),s.duration=i),void 0!==n&&void 0!==a&&(this.log(py(t=py(r="MediaSource duration is set to ".concat(s.duration,". Setting seekable range to ")).call(r,n,"-")).call(t,a,".")),s.setLiveSeekableRange(n,a)))}},{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,i=this.pendingTrackCount,n=this.tracks;if(this.log(py(e=py(t="checkPendingTracks (pending: ".concat(i," codec events expected: ")).call(t,r,") ")).call(e,x_(n))),this.tracksReady){var a,s=null==(a=this.transferData)?void 0:a.tracks;s&&Qm(s).length?this.attachTransferred():(this.createSourceBuffers(),this.bufferCreated())}}},{key:"bufferCreated",value:function(){var e=this;if(this.sourceBufferCount){var t,r,i={};ey(t=this.sourceBuffers).call(t,(function(t){var r=mf(t,2),n=r[0],a=r[1];if(n){var s=e.tracks[n];i[n]={buffer:a,container:s.container,codec:s.codec,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}})),this.hls.trigger(O.BUFFER_CREATED,{tracks:i}),this.log("SourceBuffers created. Running queue: ".concat(this.operationQueue)),ey(r=this.sourceBuffers).call(r,(function(t){var r=mf(t,1)[0];e.executeNext(r)}))}else{var n=new Error("could not create source buffer for media codec(s)");this.hls.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:n,reason:n.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 i in e){var n=i,a=e[n];if(this.isPending(a)){var s,o,l,u=this.getTrackCodec(a,n),c=py(s="".concat(a.container,";codecs=")).call(s,u);a.codec=u,this.log(py(o=py(l="creating sourceBuffer(".concat(c,")")).call(l,this.currentOp(n)?" Queued":""," ")).call(o,x_(a)));try{var h=r.addSourceBuffer(c),d=Sa(n),f=[n,h];t[d]=f,a.buffer=h}catch(v){this.error("error while trying to add sourceBuffer: ".concat(v.message)),this.hls.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:v,sourceBufferName:n,mimeType:c});break}this.trackSourceBuffer(n,a)}}}},{key:"getTrackCodec",value:function(e,t){var r=fe(e.codec,e.levelCodec);return r?"audio"===uy(t).call(t,0,5)?de(r,this.appendSource):r:""}},{key:"trackSourceBuffer",value:function(e,t){var r=this,i=t.buffer;if(i){var n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,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 i=t.removedRanges;null!=i&&i.length&&r.hls.trigger(O.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,i,n=new Error(py(r="".concat(e," SourceBuffer error. MediaSource readyState: ")).call(r,null==(i=this.mediaSource)?void 0:i.readyState));this.error("".concat(n),t),this.hls.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});var a=this.currentOp(e);a&&a.onError(n)}},{key:"removeExecutor",value:function(e,t,r){var i,n,a=this.media,s=this.mediaSource,o=this.tracks[e],l=null==o?void 0:o.buffer;if(!a||!s||!l)return this.warn("Attempting to remove from the ".concat(e," SourceBuffer, but it does not exist")),void this.shiftAndExecuteNext(e);var u=_(a.duration)?a.duration:1/0,c=_(s.duration)?s.duration:1/0,h=Math.max(0,t),d=Math.min(r,u,c);d>h&&(!o.ending||o.ended)?(o.ended=!1,this.log(py(i=py(n="Removing [".concat(h,",")).call(n,d,"] from the ")).call(i,e," SourceBuffer")),l.remove(h,d)):this.shiftAndExecuteNext(e)}},{key:"appendExecutor",value:function(e,t){var r=this.tracks[t],i=null==r?void 0:r.buffer;if(!i)throw new ka("Attempting to append to the ".concat(t," SourceBuffer, but it does not exist"));r.ending=!1,r.ended=!1,i.appendBuffer(e)}},{key:"blockUntilOpen",value:function(e){this.isUpdating()||this.isQueued()?this.blockBuffers(e):e()}},{key:"isUpdating",value:function(){var e;return Sy(e=this.sourceBuffers).call(e,(function(e){var t=mf(e,2),r=t[0],i=t[1];return r&&i.updating}))}},{key:"isQueued",value:function(){var e,t=this;return Sy(e=this.sourceBuffers).call(e,(function(e){var r=mf(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 RR.resolve().then(e);var i=this.operationQueue,n=Dy(r).call(r,(function(e){return t.appendBlocker(e)}));r.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),RR.all(n).then((function(n){i===t.operationQueue&&(e(),t.stepOperationQueue(r))}))}},{key:"stepOperationQueue",value:function(e){var t=this;ey(e).call(e,(function(e){var r,i=null==(r=t.tracks[e])?void 0:r.buffer;i&&!i.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 eS(e=Qm(this.tracks)).call(e,(function(e,r){return e+(t.isPending(t.tracks[r])?1:0)}),0)}},{key:"sourceBufferCount",get:function(){var e;return eS(e=this.sourceBuffers).call(e,(function(e,t){return e+(mf(t,1)[0]?1:0)}),0)}},{key:"sourceBufferTypes",get:function(){var e,t;return Jm(e=Dy(t=this.sourceBuffers).call(t,(function(e){return mf(e,1)[0]}))).call(e,(function(e){return!!e}))}},{key:"addBufferListener",value:function(e,t,r){var i=this.tracks[e];if(i){var n=i.buffer;if(n){var a=pE(r).call(r,this,e);i.listeners.push({event:t,listener:a}),n.addEventListener(t,a)}}}},{key:"removeBufferListeners",value:function(e){var t,r=this.tracks[e];if(r){var i=r.buffer;i&&(ey(t=r.listeners).call(t,(function(e){i.removeEventListener(e.event,e.listener)})),r.listeners.length=0)}}}]),r}(X),capLevelController:Aa,errorController:function(e){Ym(r,e);var t=Wm(r);function r(e){var i;return qm(this,r),(i=t.call(this,"error-controller",e.logger)).hls=void 0,i.playlistError=0,i.penalizedRenditions={},i.hls=e,i.registerListeners(),i}return Xm(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(O.ERROR,this.onError,this),e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.LEVEL_UPDATED,this.onLevelUpdated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(O.ERROR,this.onError,this),e.off(O.ERROR,this.onErrorOut,this),e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.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)===G?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 i=this.hls,n=t.context;switch(t.details){case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case M.FRAG_PARSING_ERROR:if(null!=(r=t.frag)&&r.gap)return void(t.errorAction=tt());case M.FRAG_GAP:case M.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=Xe);case M.LEVEL_EMPTY_ERROR:case M.LEVEL_PARSING_ERROR:var a,s,o=t.parent===G?t.level:i.loadLevel;return void(t.details===M.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(s=a.levelDetails)&&s.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,o)));case M.LEVEL_LOAD_ERROR:case M.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==n?void 0:n.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level)));case M.AUDIO_TRACK_LOAD_ERROR:case M.AUDIO_TRACK_LOAD_TIMEOUT:case M.SUBTITLE_LOAD_ERROR:case M.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){var l=i.levels[i.loadLevel];if(l&&(n.type===U&&l.hasAudioGroup(n.groupId)||n.type===B&&l.hasSubtitleGroup(n.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=Xe,void(t.errorAction.flags=Ze)}return;case M.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var u=i.levels[i.loadLevel],c=null==u?void 0:u.attrs["HDCP-LEVEL"];return void(c?t.errorAction={action:Xe,flags:et,hdcpLevel:c}:this.keySystemError(t));case M.BUFFER_ADD_CODEC_ERROR:case M.REMUX_ALLOC_ERROR:case M.BUFFER_APPEND_ERROR:var h;return void(t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,null!=(h=t.level)?h:i.loadLevel)));case M.INTERNAL_EXCEPTION:case M.BUFFER_APPENDING_ERROR:case M.BUFFER_FULL_ERROR:case M.LEVEL_SWITCH_ERROR:case M.BUFFER_STALLED_ERROR:case M.BUFFER_SEEK_OVER_HOLE:case M.BUFFER_NUDGE_ON_STALL:return void(t.errorAction=tt())}t.type===x.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=je(this.hls.config.playlistLoadPolicy,e),i=this.playlistError++;if(qe(r,i,Ve(e),e.response))return{action:$e,flags:Je,retryConfig:r,retryCount:i};var n=this.getLevelSwitchAction(e,t);return r&&(n.retryConfig=r,n.retryCount=i),n}},{key:"getFragRetryOrSwitchAction",value:function(e){var t,r,i=this.hls,n=this.getVariantLevelIndex(e.frag),a=i.levels[n],s=i.config,o=s.fragLoadPolicy,l=s.keyLoadPolicy,u=je(AS(t=e.details).call(t,"key")?l:o,e),c=eS(r=i.levels).call(r,(function(e,t){return e+t.fragmentError}),0);if(a&&(e.details!==M.FRAG_GAP&&a.fragmentError++,qe(u,c,Ve(e),e.response)))return{action:$e,flags:Je,retryConfig:u,retryCount:c};var h=this.getLevelSwitchAction(e,n);return u&&(h.retryConfig=u,h.retryCount=c),h}},{key:"getLevelSwitchAction",value:function(e,t){var r=this.hls;null==t&&(t=r.loadLevel);var i=this.hls.levels[t];if(i){var n,a,s=e.details;i.loadError++,s===M.BUFFER_APPEND_ERROR&&i.fragmentError++;var o=-1,l=r.levels,u=r.loadLevel,c=r.minAutoLevel,h=r.maxAutoLevel;r.autoLevelEnabled||(r.loadLevel=-1);for(var d=null==(n=e.frag)?void 0:n.type,f=(d===K&&s===M.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(s===M.BUFFER_ADD_CODEC_ERROR||s===M.BUFFER_APPEND_ERROR))&&Sy(l).call(l,(function(e){var t=e.audioCodec;return i.audioCodec!==t})),v="video"===e.sourceBufferName&&(s===M.BUFFER_ADD_CODEC_ERROR||s===M.BUFFER_APPEND_ERROR)&&Sy(l).call(l,(function(e){var t=e.codecSet,r=e.audioCodec;return i.codecSet!==t&&i.audioCodec===r})),g=null!=(a=e.context)?a:{},p=g.type,m=g.groupId,y=function(){var t=(E+u)%l.length;if(t!==u&&t>=c&&t<=h&&0===l[t].loadError){var r=l[t];if(s===M.FRAG_GAP&&d===G&&e.frag){var n=l[t].details;if(n){var a=Be(e.frag,n.fragments,e.frag.start);if(null!=a&&a.gap)return"continue"}}else{if(p===U&&r.hasAudioGroup(m)||p===B&&r.hasSubtitleGroup(m))return"continue";if(d===K&&null!=(k=i.audioGroups)&&Sy(k).call(k,(function(e){return r.hasAudioGroup(e)}))||d===H&&null!=(T=i.subtitleGroups)&&Sy(T).call(T,(function(e){return r.hasSubtitleGroup(e)}))||f&&i.audioCodec===r.audioCodec||!f&&i.audioCodec!==r.audioCodec||v&&i.codecSet===r.codecSet)return"continue"}return o=t,"break"}},E=l.length;E--;){var k,T,S=y();if("continue"!==S&&"break"===S)break}if(o>-1&&r.loadLevel!==o)return e.levelRetry=!0,this.playlistError=0,{action:Xe,flags:Je,nextAutoLevel:o}}return{action:Xe,flags:Ze}}},{key:"onErrorOut",value:function(e,t){var r;switch(null==(r=t.errorAction)?void 0:r.action){case ze:break;case Xe:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===M.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 i=V_(r),n=r.hdcpLevel,a=r.nextAutoLevel;switch(i){case Je:this.switchLevel(e,a);break;case et:n&&(t.maxHdcpLevel=ke[hy(ke).call(ke,n)-1],r.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'.concat(t.maxHdcpLevel,'" or lower'))}r.resolved||this.switchLevel(e,a)}}},{key:"switchLevel",value:function(e,t){var r;void 0!==t&&e.errorAction&&(this.warn(py(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}(X),fpsController:function(){function e(t){qm(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 Xm(e,[{key:"setStreamController",value:function(e){this.streamController=e}},{key:"registerListeners",value:function(){this.hls.on(O.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(O.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"unregisterListeners",value:function(){this.hls.off(O.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(O.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 i,n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&"function"==typeof n.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=gE(pE(i=this.checkFPSInterval).call(i,this),r.fpsDroppedMonitoringPeriod)}}},{key:"onMediaDetaching",value:function(){this.media=null}},{key:"checkFPS",value:function(e,t,r){var i=performance.now();if(t){if(this.lastTime){var n=i-this.lastTime,a=r-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*a/n,l=this.hls;if(l.trigger(O.FPS_DROP,{currentDropped:a,currentDecoded:s,totalDroppedFrames:r}),o>0&&a>l.config.fpsDroppedMonitoringThreshold*s){var u=l.currentLevel;l.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=u)&&(u-=1,l.trigger(O.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=i,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:Yr,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:go,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){Ym(r,e);var t=Wm(r);function r(e,i,n){var a;return qm(this,r),(a=t.call(this,e,i,n,"subtitle-stream-controller",H)).currentTrackId=-1,a.tracksBuffered=[],a.mainDetails=null,a.registerListeners(),a}return Xm(r,[{key:"onHandlerDestroying",value:function(){this.unregisterListeners(),Qf(Xf(r.prototype),"onHandlerDestroying",this).call(this),this.mainDetails=null}},{key:"registerListeners",value:function(){Qf(Xf(r.prototype),"registerListeners",this).call(this);var e=this.hls;e.on(O.LEVEL_LOADED,this.onLevelLoaded,this),e.on(O.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(O.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(O.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(O.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(O.BUFFER_FLUSHING,this.onBufferFlushing,this)}},{key:"unregisterListeners",value:function(){Qf(Xf(r.prototype),"unregisterListeners",this).call(this);var e=this.hls;e.off(O.LEVEL_LOADED,this.onLevelLoaded,this),e.off(O.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(O.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(O.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(O.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(O.BUFFER_FLUSHING,this.onBufferFlushing,this)}},{key:"startLoad",value:function(e){this.stopLoad(),this.state=Ri,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}},{key:"onManifestLoading",value:function(){Qf(Xf(r.prototype),"onManifestLoading",this).call(this),this.mainDetails=null}},{key:"onMediaDetaching",value:function(e,t){this.tracksBuffered=[],Qf(Xf(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,i=t.success;if(_t(r)&&(this.fragPrevious=r),this.state=Ri,i){var n=this.tracksBuffered[this.currentTrackId];if(n){for(var a,s=r.start,o=0;o<n.length;o++)if(s>=n[o].start&&s<=n[o].end){a=n[o];break}var l=r.start+r.duration;a?a.end=l:(a={start:s,end:l},n.push(a)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null),this.media&&this.tick()}}}},{key:"onBufferFlushing",value:function(e,t){var r=t.startOffset,i=t.endOffset;if(0===r&&i!==Number.POSITIVE_INFINITY){var n,a=i-1;if(a<=0)return;t.endOffsetSubtitles=Math.max(0,a),ey(n=this.tracksBuffered).call(n,(function(e){for(var t=0;t<e.length;)if(e[t].end<=a)e.shift();else{if(!(e[t].start<a))break;e[t].start=a,t++}})),this.fragmentTracker.removeFragmentsInRange(r,a,H)}}},{key:"onError",value:function(e,t){var r=t.frag;(null==r?void 0:r.type)===H&&(t.details===M.FRAG_GAP&&this.fragmentTracker.fragBuffered(r,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==bi&&(this.state=Ri))}},{key:"onSubtitleTracksUpdated",value:function(e,t){var r=this,i=t.subtitleTracks;this.levels&&fa(this.levels,i)?this.levels=Dy(i).call(i,(function(e){return new Ie(e)})):(this.tracksBuffered=[],this.levels=Dy(i).call(i,(function(e){var t=new Ie(e);return r.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,H),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 i=this.levels[this.currentTrackId];null!=i&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.state!==bi&&this.setInterval(500)}else this.clearInterval()}},{key:"onSubtitleTrackLoaded",value:function(e,t){var r,i,n,a,s,o,l=this.currentTrackId,u=this.levels,c=t.details,h=t.id;if(u){var d=u[h];if(!(h>=u.length)&&d){if(this.log(py(r=py(i=py(n=py(a="Subtitle track ".concat(h," loaded [")).call(a,c.startSN,",")).call(n,c.endSN,"]")).call(i,c.lastPartSn?py(s="[part-".concat(c.lastPartSn,"-")).call(s,c.lastPartIndex,"]"):"",",duration:")).call(r,c.totalduration)),this.mediaBuffer=this.mediaBufferTimeRanges,c.live||null!=(o=d.details)&&o.live){var f=this.mainDetails;if(c.deltaUpdateFailed||!f)return;var v,g=f.fragments[0];d.details?0===this.alignPlaylists(c,d.details,null==(v=this.levelLastLoaded)?void 0:v.details)&&g&&vi(c,g.start):c.hasProgramDateTime&&f.hasProgramDateTime?(Ai(c,f),c.fragmentStart):g&&vi(c,g.start)}d.details=c,this.levelLastLoaded=d,h===l&&(this.hls.trigger(O.SUBTITLE_TRACK_UPDATED,{details:c,id:h,groupId:t.groupId}),this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===Ri)&&(Be(null,c.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,i=e.payload,n=r.decryptdata,a=this.hls;if(!this.fragContextChanged(r)&&i&&i.byteLength>0&&null!=n&&n.key&&n.iv&&br(n.method)){var s=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,Rr(n.method)).catch((function(e){throw a.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:r}),e})).then((function(e){var t=performance.now();a.trigger(O.FRAG_DECRYPTED,{frag:r,payload:e,stats:{tstart:s,tdecrypt:t}})})).catch((function(e){var r;t.warn(py(r="".concat(e.name,": ")).call(r,e.message)),t.state=Ri}))}}},{key:"doTick",value:function(){if(this.media){if(this.state===Ri){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 i=this.config,n=this.getLoadPosition(),a=fr.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,i.maxBufferHole),s=a.end,o=a.len,l=r.details;if(o>this.hls.maxBufferLength+l.levelTargetDuration)return;var u=l.fragments,c=u.length,h=l.edge,d=null,f=this.fragPrevious;if(s<h){var v=i.maxFragLookUpTolerance,g=s>h-v?0:v;!(d=Be(f,u,Math.max(u[0].start,s),g))&&f&&f.start<u[0].start&&(d=u[0])}else d=u[c-1];if(!d)return;if(_t(d=this.mapToInitFragWhenRequired(d))){var p=u[d.sn-l.startSN-1];p&&p.cc===d.cc&&this.fragmentTracker.getState(p)===rt&&(d=p)}this.fragmentTracker.getState(d)===rt&&this.loadFragment(d,r,s)}}else this.state=Ri}},{key:"loadFragment",value:function(e,t,i){_t(e)?Qf(Xf(r.prototype),"loadFragment",this).call(this,e,t,i):this._loadInitSegment(e,t)}},{key:"mediaBufferTimeRanges",get:function(){return new Es(this.tracksBuffered[this.currentTrackId]||[])}}]),r}(Ni),subtitleTrackController:function(e){Ym(r,e);var t=Wm(r);function r(e){var i;return qm(this,r),(i=t.call(this,e,"subtitle-track-controller")).media=null,i.tracks=[],i.groupIds=null,i.tracksInGroup=[],i.trackId=-1,i.currentTrack=null,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i._subtitleDisplay=!0,i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.onTextTracksChanged=function(){if(i.useTextTrackPolling||self.clearInterval(i.subtitlePollingInterval),i.media&&i.hls.config.renderTextTracksNatively){for(var e=null,t=as(i.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 n=i.findTrackForTextTrack(e);i.subtitleTrack!==n&&i.setSubtitleTrack(n)}},i.registerListeners(),i}return Xm(r,[{key:"destroy",value:function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,Qf(Xf(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(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.MANIFEST_PARSED,this.onManifestParsed,this),e.on(O.LEVEL_LOADING,this.onLevelLoading,this),e.on(O.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(O.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(O.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.MANIFEST_PARSED,this.onManifestParsed,this),e.off(O.LEVEL_LOADING,this.onLevelLoading,this),e.off(O.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(O.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(O.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=gE(this.onTextTracksChanged,e)}},{key:"onMediaDetaching",value:function(e,t){var r,i=this.media;if(i){var n=!!t.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n||ey(r=as(i.textTracks)).call(r,(function(e){is(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,i,n,a,s,o,l,u=t.id,c=t.groupId,h=t.details,d=this.tracksInGroup[u];if(d&&d.groupId===c){var f=d.details;d.details=t.details,this.log(py(n=py(a=py(s=py(o=py(l="Subtitle track ".concat(u,' "')).call(l,d.name,'" lang:')).call(o,d.lang," group:")).call(s,c," loaded [")).call(a,h.startSN,"-")).call(n,h.endSN,"]")),u===this.trackId&&this.playlistLoaded(u,t,f)}else this.warn(py(r=py(i="Subtitle track with id:".concat(u," and group:")).call(i,c," 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,i=this.groupIds,n=this.currentTrack;if(!r||(null==i?void 0:i.length)!==(null==r?void 0:r.length)||null!=r&&Sy(r).call(r,(function(e){return-1===(null==i?void 0:hy(i).call(i,e))}))){var a,s;this.groupIds=r,this.trackId=-1,this.currentTrack=null;var o=Jm(a=this.tracks).call(a,(function(e){return!r||-1!==hy(r).call(r,e.groupId)}));if(o.length)this.selectDefaultTrack&&!Sy(o).call(o,(function(e){return e.default}))&&(this.selectDefaultTrack=!1),ey(o).call(o,(function(e,t){e.id=t}));else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;var l=this.hls.config.subtitlePreference;if(!n&&l){this.selectDefaultTrack=!1;var u=xe(l,o);if(u>-1)n=o[u];else{var c=xe(l,this.tracks);n=this.tracks[c]}}var h=this.findTrackId(n);-1===h&&n&&(h=this.findTrackId(null));var d={subtitleTracks:o};this.log(py(s="Updating subtitle tracks, ".concat(o.length,' track(s) found in "')).call(s,null==r?void 0:r.join(","),'" group-id')),this.hls.trigger(O.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,i=0;i<t.length;i++){var n=t[i];if((!r||n.default)&&(r||e)&&(!e||Me(n,e)))return i}if(e){for(var a=0;a<t.length;a++){var s=t[a];if(va(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return a}for(var o=0;o<t.length;o++){var l=t[o];if(va(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(ga(t[r],e))return r;return-1}},{key:"onError",value:function(e,t){var r;!t.fatal&&t.context&&(t.context.type!==B||t.context.id!==this.trackId||this.groupIds&&-1===hy(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&&Me(e,r))return r;var i=xe(e,this.tracksInGroup);if(i>-1){var n=this.tracksInGroup[i];return this.setSubtitleTrack(i),n}if(r)return null;var a=xe(e,t);if(a>-1)return t[a]}}return null}},{key:"loadPlaylist",value:function(e){Qf(Xf(r.prototype),"loadPlaylist",this).call(this),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}},{key:"loadingPlaylist",value:function(e,t){var i,n,a,s,o,l;Qf(Xf(r.prototype),"loadingPlaylist",this).call(this,e,t);var u=e.id,c=e.groupId,h=this.getUrlWithDirectives(e.url,t),d=e.details,f=null==d?void 0:d.age;this.log(py(i=py(n=py(a=py(s=py(o=py(l="Loading subtitle ".concat(u,' "')).call(l,e.name,'" lang:')).call(o,e.lang," group:")).call(s,c)).call(a,void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")).call(n,f&&d.live?" age "+f.toFixed(1)+(d.type&&" "+d.type||""):""," ")).call(i,h)),this.hls.trigger(O.SUBTITLE_TRACK_LOADING,{url:h,id:u,groupId:c,deliveryDirectives:t||null,track:e})}},{key:"toggleTrackModes",value:function(){var e,t,r=this.media;if(r){var i,n=as(r.textTracks),a=this.currentTrack;if(a&&((i=Jm(n).call(n,(function(e){return ga(a,e)}))[0])||this.warn(py(e='Unable to find subtitle TextTrack with name "'.concat(a.name,'" and language "')).call(e,a.lang,'"'))),ey(t=uy([]).call(n)).call(t,(function(e){"disabled"!==e.mode&&e!==i&&(e.mode="disabled")})),i){var s=this.subtitleDisplay?"showing":"hidden";i.mode!==s&&(i.mode=s)}}}},{key:"setSubtitleTrack",value:function(e){var t,r,i=this.tracksInGroup;if(this.media)if(e<-1||e>=i.length||!_(e))this.warn("Invalid subtitle track id: ".concat(e));else{this.selectDefaultTrack=!1;var n=this.currentTrack,a=i[e]||null;if(this.trackId=e,this.currentTrack=a,this.toggleTrackModes(),a){var s=!!a.details&&!a.details.live;if(e!==this.trackId||a!==n||!s){this.log("Switching to subtitle-track ".concat(e)+(a?py(t=py(r=' "'.concat(a.name,'" lang:')).call(r,a.lang," group:")).call(t,a.groupId):""));var o=a.id,l=a.groupId,u=void 0===l?"":l,c=a.name,h=a.type,d=a.url;this.hls.trigger(O.SUBTITLE_TRACK_SWITCH,{id:o,groupId:u,name:c,type:h,url:d});var f=this.switchParams(a.url,null==n?void 0:n.details,a.details);this.loadPlaylist(f)}}else this.hls.trigger(O.SUBTITLE_TRACK_SWITCH,{id:e})}else this.queuedDefaultTrack=e}}]),r}(pa),timelineController:function(){function e(t){qm(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(O.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(O.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(O.MANIFEST_LOADING,this.onManifestLoading,this),t.on(O.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(O.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(O.FRAG_LOADING,this.onFragLoading,this),t.on(O.FRAG_LOADED,this.onFragLoaded,this),t.on(O.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(O.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(O.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(O.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(O.BUFFER_FLUSHING,this.onBufferFlushing,this)}return Xm(e,[{key:"destroy",value:function(){var e=this.hls;e.off(O.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(O.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(O.FRAG_LOADING,this.onFragLoading,this),e.off(O.FRAG_LOADED,this.onFragLoaded,this),e.off(O.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(O.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(O.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(O.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(O.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 co(this,"textTrack1"),t=new co(this,"textTrack2"),r=new co(this,"textTrack3"),i=new co(this,"textTrack4");this.cea608Parser1=new Fs(1,e,t),this.cea608Parser2=new Fs(3,r,i)}},{key:"addCues",value:function(e,t,r,i,n){for(var a,s,o,l,u=!1,c=n.length;c--;){var h=n[c],d=(a=h[0],s=h[1],o=t,l=r,Math.min(s,l)-Math.max(a,o));if(d>=0&&(h[0]=Math.min(h[0],t),h[1]=Math.max(h[1],r),u=!0,d/(r-t)>.5))return}if(u||n.push([t,r]),this.config.renderTextTracksNatively){var f=this.captionsTracks[e];this.Cues.newCue(f,t,r,i)}else{var v=this.Cues.newCue(null,t,r,i);this.hls.trigger(O.CUES_PARSED,{type:"captions",cues:v,track:e})}}},{key:"onInitPtsFound",value:function(e,t){var r=this,i=t.frag,n=t.id,a=t.initPTS,s=t.timescale,o=this.unparsedVttFrags;n===G&&(this.initPTS[i.cc]={baseTime:a,timescale:s}),o.length&&(this.unparsedVttFrags=[],ey(o).call(o,(function(e){r.onFragLoaded(O.FRAG_LOADED,e)})))}},{key:"getExistingTrack",value:function(e,t){var r=this.media;if(r)for(var i=0;i<r.textTracks.length;i++){var n=r.textTracks[i];if(fo(n,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound",attrs:{}}))return n}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,i=this.media,n=t[e],a=n.label,s=n.languageCode,o=this.getExistingTrack(a,s);if(o)r[e]=o,is(r[e]),ts(r[e],i);else{var l=this.createTextTrack("captions",a,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(O.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}}}},{key:"createTextTrack",value:function(e,t,r){var i=this.media;if(i)return i.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,i=!!t.transferMedia;if(this.media=null,!i){var n=this.captionsTracks;ey(r=Qm(n)).call(r,(function(e){is(n[e]),delete n[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++)is(t[r])}}},{key:"onSubtitleTracksUpdated",value:function(e,t){var r=this,i=t.subtitleTracks||[],n=Sy(i).call(i,(function(e){return e.textCodec===Zs}));if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(fa(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){var a,s=this.media,o=s?as(s.textTracks):null;if(ey(a=this.tracks).call(a,(function(e,t){var i;if(o){for(var n=null,a=0;a<o.length;a++)if(o[a]&&fo(o[a],e)){n=o[a],o[a]=null;break}n&&(i=n)}if(i)is(i);else{var s=ho(e);(i=r.createTextTrack(s,e.name,e.lang))&&(i.mode="disabled")}i&&r.textTracks.push(i)})),null!=o&&o.length){var l,u=Dy(l=Jm(o).call(o,(function(e){return null!==e}))).call(l,(function(e){return e.label}));u.length&&this.hls.logger.warn("Media element contains unused subtitle tracks: ".concat(u.join(", "),". Replace media element for each source to clear TextTracks and captions menu."))}}else if(this.tracks.length){var c,h=Dy(c=this.tracks).call(c,(function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}));this.hls.trigger(O.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}}},{key:"onManifestLoaded",value:function(e,t){var r,i=this;this.config.enableCEA708Captions&&t.captions&&ey(r=t.captions).call(r,(function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(t){var r="textTrack".concat(t[1]),n=i.captionsProperties[r];n&&(n.label=e.name,e.lang&&(n.languageCode=e.lang),n.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===G){var r,i,n=this.cea608Parser1,a=this.cea608Parser2,s=this.lastSn,o=t.frag,l=o.cc,u=o.sn,c=null!=(r=null==(i=t.part)?void 0:i.index)?r:-1;n&&a&&(u!==s+1||u===s&&c!==this.lastPartIndex+1||l!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=l,this.lastSn=u,this.lastPartIndex=c}}},{key:"onFragLoaded",value:function(e,t){var r=t.frag,i=t.payload;if(r.type===H)if(i.byteLength){var n=r.decryptdata,a="stats"in t;if(null==n||!n.encrypted||a){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,i):this._parseVTTs(t)}}else this.hls.trigger(O.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}},{key:"_parseIMSC1",value:function(e,t){var r=this,i=this.hls;io(t,this.initPTS[e.cc],(function(t){r._appendCues(t,e.level),i.trigger(O.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){i.logger.log("Failed to parse IMSC1: ".concat(t)),i.trigger(O.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}},{key:"_parseVTTs",value:function(e){var t,r=this,i=e.frag,n=e.payload,a=this.initPTS,s=this.unparsedVttFrags,o=a.length-1;if(a[i.cc]||-1!==o){var l=this.hls;Js(null!=(t=i.initSegment)&&t.data?$t(i.initSegment.data,new Uint8Array(n)).buffer:n,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,(function(e){r._appendCues(e,i.level),l.trigger(O.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})}),(function(t){var a="Missing initPTS for VTT MPEGTS"===t.message;a?s.push(e):r._fallbackToIMSC1(i,n),l.logger.log("Failed to parse VTT cue: ".concat(t)),a&&o>i.cc||l.trigger(O.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}else s.push(e)}},{key:"_fallbackToIMSC1",value:function(e,t){var r=this,i=this.tracks[e.level];i.textCodec||io(t,this.initPTS[e.cc],(function(){i.textCodec=Zs,r._parseIMSC1(e,t)}),(function(){i.textCodec="wvtt"}))}},{key:"_appendCues",value:function(e,t){var r=this.hls;if(this.config.renderTextTracksNatively){var i=this.textTracks[t];if(!i||"disabled"===i.mode)return;ey(e).call(e,(function(e){return rs(i,e)}))}else{var n=this.tracks[t];if(!n)return;var a=n.default?"default":"subtitles"+t;r.trigger(O.CUES_PARSED,{type:"subtitles",cues:e,track:a})}}},{key:"onFragDecrypted",value:function(e,t){t.frag.type===H&&this.onFragLoaded(O.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,i=t.samples;if(r.type!==G||"NONE"!==this.closedCaptionsForLevel(r))for(var n=0;n<i.length;n++){var a=i[n].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();var s=this.extractCea608Data(a);this.cea608Parser1.addData(i[n].pts,s[0]),this.cea608Parser2.addData(i[n].pts,s[1])}}}}},{key:"onBufferFlushing",value:function(e,t){var r=t.startOffset,i=t.endOffset,n=t.endOffsetSubtitles,a=t.type,s=this.media;if(s&&!(s.currentTime<i)){if(!a||"video"===a){var o,l=this.captionsTracks;ey(o=Qm(l)).call(o,(function(e){return ns(l[e],r,i)}))}if(this.config.renderTextTracksNatively&&0===r&&void 0!==n){var u,c=this.textTracks;ey(u=Qm(c)).call(u,(function(e){return ns(c[e],r,n)}))}}}},{key:"extractCea608Data",value:function(e){for(var t=[[],[]],r=31&e[0],i=2,n=0;n<r;n++){var a=e[i++],s=127&e[i++],o=127&e[i++];if((0!==s||0!==o)&&0!=(4&a)){var l=3&a;0!==l&&1!==l||(t[l].push(s),t[l].push(o))}}return t}}]),e}(),audioStreamController:function(e){Ym(r,e);var t=Wm(r);function r(e,i,n){var a;return qm(this,r),(a=t.call(this,e,i,n,"audio-stream-controller",K)).mainAnchor=null,a.mainFragLoading=null,a.audioOnly=!1,a.bufferedTrack=null,a.switchingTrack=null,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.flushing=!1,a.bufferFlushed=!1,a.cachedTrackLoadedData=null,a.registerListeners(),a}return Xm(r,[{key:"onHandlerDestroying",value:function(){this.unregisterListeners(),Qf(Xf(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(){Qf(Xf(r.prototype),"registerListeners",this).call(this);var e=this.hls;e.on(O.LEVEL_LOADED,this.onLevelLoaded,this),e.on(O.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(O.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(O.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(O.BUFFER_RESET,this.onBufferReset,this),e.on(O.BUFFER_CREATED,this.onBufferCreated,this),e.on(O.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(O.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(O.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(O.FRAG_LOADING,this.onFragLoading,this),e.on(O.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(Qf(Xf(r.prototype),"unregisterListeners",this).call(this),e.off(O.LEVEL_LOADED,this.onLevelLoaded,this),e.off(O.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(O.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(O.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(O.BUFFER_RESET,this.onBufferReset,this),e.off(O.BUFFER_CREATED,this.onBufferCreated,this),e.off(O.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(O.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(O.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(O.FRAG_LOADING,this.onFragLoading,this),e.off(O.FRAG_BUFFERED,this.onFragBuffered,this))}},{key:"onInitPtsFound",value:function(e,t){var r=t.frag,i=t.id,n=t.initPTS,a=t.timescale;if(i===G){var s,o,l=r.cc,u=this.fragCurrent;if(this.initPTS[l]={baseTime:n,timescale:a},this.log(py(s=py(o="InitPTS for cc: ".concat(l," found from main: ")).call(o,n,"/")).call(s,a)),this.mainAnchor=r,this.state===Oi){var c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==l)&&(this.nextLoadPosition=this.findSyncFrag(r).start),this.tick()}else!this.hls.hasEnoughToStart&&u&&u.cc!==l?(this.startFragRequested=!1,this.nextLoadPosition=this.findSyncFrag(r).start,u.abortRequests(),this.resetLoadingState()):this.state===Ri&&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 i=r.start,n=r.end,a=e.fragments;if(!r.relurl){var s=e.fragmentHint;s&&(a=py(a).call(a,s))}return Ue(a,(function(e){return e.cc<t||e.end<=i?1:e.cc>t||e.start>=n?-1:0}))}return null}(t,r,e)||t&&He(t.fragments,r)||e}},{key:"startLoad",value:function(e){if(!this.levels)return this.startPosition=e,void(this.state=bi);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=Ri):this.state=_i,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}},{key:"doTick",value:function(){switch(this.state){case Ri:this.doTickIdle();break;case _i:var e=this.levels,t=this.trackId,i=null==e?void 0:e[t],n=null==i?void 0:i.details;if(n&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(n))break;this.state=Oi}break;case wi:var a,s=performance.now(),o=this.retryDate;if(!o||s>=o||null!=(a=this.media)&&a.seeking){var l=this.levels,u=this.trackId;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==l?void 0:l[u])||null),this.state=Ri}break;case Oi:var c=this.waitingData;if(c){var h,d=c.frag,f=c.part,v=c.cache,g=c.complete,p=this.mainAnchor;if(void 0!==this.initPTS[d.cc]){this.waitingData=null,this.state=Di;var m={frag:d,part:f,payload:v.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(m),g&&Qf(Xf(r.prototype),"_handleFragmentLoadComplete",this).call(this,m)}else p&&p.cc!==c.frag.cc&&(this.log(py(h="Waiting fragment cc (".concat(d.cc,") cancelled because video is at cc ")).call(h,p.cc)),this.nextLoadPosition=this.findSyncFrag(p).start,this.clearWaitingFragment())}else this.state=Ri}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!==bi&&(this.state=Ri))}},{key:"resetLoadingState",value:function(){this.clearWaitingFragment(),Qf(Xf(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,i=this.media,n=this.trackId,a=t.config;if(this.buffering&&(i||!this.startFragRequested&&a.startFragPrefetch)&&null!=r&&r[n]){var s=r[n],o=s.details;if(!o||this.waitForLive(s)||this.waitForCdnTuneIn(o))return this.state=_i,void(this.startFragRequested=!1);var l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,Rt,K));var u=this.getFwdBufferInfo(l,K);if(null!==u){var c=this.bufferedTrack,h=this.switchingTrack;if(!h&&this._streamEnded(u,o))return t.trigger(O.BUFFER_EOS,{type:"audio"}),void(this.state=xi);var d=u.len,f=t.maxBufferLength,v=o.fragments,g=v[0].start,p=this.getLoadPosition(),m=this.flushing?p:u.end;if(h&&i){var y=p;c&&!va(h.attrs,c.attrs)&&(m=y),o.PTSKnown&&y<g&&(u.end>g||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=g+.05)}if(!(d>=f&&!h&&m<v[v.length-1].start)){var E=this.getNextFragment(m,o);if(E&&this.isLoopLoading(E,m)&&(E=this.getNextFragmentLoopLoading(E,o,u,G,f)),E){var k=null==(e=this.mainFragLoading)?void 0:e.frag;if(!this.audioOnly&&this.startFragRequested&&k&&_t(k)&&_t(E)&&!E.endList&&(!o.live||!this.loadingParts&&m<this.hls.liveSyncPosition)){var T=k;if(E.start>T.end){var S=this.fragmentTracker.getFragAtPos(m,G);S&&S.end>k.end&&(T=S,this.mainFragLoading={frag:S,targetBufferTime:null})}if(E.start>T.end)return}this.loadFragment(E,s,m)}else this.bufferFlushed=!0}}}}},{key:"onMediaDetaching",value:function(e,t){this.bufferFlushed=this.flushing=!1,Qf(Xf(r.prototype),"onMediaDetaching",this).call(this,e,t)}},{key:"onAudioTracksUpdated",value:function(e,t){var r=t.audioTracks;this.resetTransmuxer(),this.levels=Dy(r).call(r,(function(e){return new Ie(e)}))}},{key:"onAudioTrackSwitching",value:function(e,t){var r=!!t.url;this.trackId=t.id;var i=this.fragCurrent;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),r?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==bi&&(this.setInterval(100),this.state=Ri,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}},{key:"onManifestLoading",value:function(){Qf(Xf(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(O.AUDIO_TRACK_LOADED,r))}},{key:"onAudioTrackLoaded",value:function(e,t){var r,i,n,a,s,o,l=this.levels,u=t.details,c=t.id,h=this.mainDetails;if(!h||h.expired||u.endCC>h.endCC)return this.cachedTrackLoadedData=t,void(this.state!==bi&&(this.state=_i));if(l){this.log(py(r=py(i=py(n=py(a="Audio track ".concat(c," loaded [")).call(a,u.startSN,",")).call(n,u.endSN,"]")).call(i,u.lastPartSn?py(s="[part-".concat(u.lastPartSn,"-")).call(s,u.lastPartIndex,"]"):"",",duration:")).call(r,u.totalduration));var d=l[c],f=0;if(u.live||null!=(o=d.details)&&o.live){if(this.checkLiveUpdate(u),u.deltaUpdateFailed)return;var v;d.details&&(f=this.alignPlaylists(u,d.details,null==(v=this.levelLastLoaded)?void 0:v.details)),u.alignedSliding||(Si(u,h),u.alignedSliding||Ai(u,h),f=u.fragmentStart)}d.details=u,this.levelLastLoaded=d,this.startFragRequested||this.setStartPosition(h,f),this.hls.trigger(O.AUDIO_TRACK_UPDATED,{details:u,id:c,groupId:t.groupId}),this.state!==_i||this.waitForCdnTuneIn(u)||(this.state=Ri),this.tick()}else this.warn("Audio tracks were reset while loading level ".concat(c))}},{key:"_handleFragmentLoadProgress",value:function(e){var t,r,i,n,a=e.frag,s=e.part,o=e.payload,l=this.config,u=this.trackId,c=this.levels;if(c){var h=c[u];if(h){var d=h.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(a.start);var f=l.defaultAudioCodec||h.audioCodec||"mp4a.40.2",v=this.transmuxer;v||(v=this.transmuxer=new da(this.hls,K,pE(r=this._handleTransmuxComplete).call(r,this),pE(i=this._handleTransmuxerFlush).call(i,this)));var g=this.initPTS[a.cc],p=null==(n=a.initSegment)?void 0:n.data;if(void 0!==g){var m=!1,y=s?s.index:-1,E=-1!==y,k=new hr(a.level,a.sn,a.stats.chunkCount,o.byteLength,y,E);v.push(o,p,f,"",a,s,d.totalduration,m,k,g)}else{var T,S,A,L;this.log(py(T=py(S=py(A=py(L="Unknown video PTS for cc ".concat(a.cc,", waiting for video PTS before demuxing audio frag ")).call(L,a.sn," of [")).call(A,d.startSN," ,")).call(S,d.endSN,"],track ")).call(T,u)),(this.waitingData=this.waitingData||{frag:a,part:s,cache:new Ui,complete:!1}).cache.push(new Uint8Array(o)),this.state!==bi&&(this.state=Oi)}}else this.warn("Audio track is undefined on fragment load progress")}else this.warn(py(t="Audio tracks were reset while fragment load was in progress. Fragment ".concat(a.sn," of level ")).call(t,a.level," will not be buffered"))}},{key:"_handleFragmentLoadComplete",value:function(e){this.waitingData?this.waitingData.complete=!0:Qf(Xf(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===G&&_t(t.frag)&&(this.mainFragLoading=t,this.state===Ri&&this.tick())}},{key:"onFragBuffered",value:function(e,t){var r,i,n,a,s=t.frag,o=t.part;if(s.type===K)if(this.fragContextChanged(s))this.warn(py(r=py(i=py(n=py(a="Fragment ".concat(s.sn)).call(a,o?" p: "+o.index:""," of level ")).call(n,s.level," finished buffering, but was aborted. state: ")).call(i,this.state,", audioSwitch: ")).call(r,this.switchingTrack?this.switchingTrack.name:"false"));else{if(_t(s)){this.fragPrevious=s;var l=this.switchingTrack;l&&(this.bufferedTrack=l,this.switchingTrack=null,this.hls.trigger(O.AUDIO_TRACK_SWITCHED,z({},l)))}this.fragBufferedComplete(s,o),this.media&&this.tick()}else this.audioOnly||s.type!==G||s.elementaryStreams.video||s.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)}},{key:"onError",value:function(e,t){var i;if(t.fatal)this.state=Mi;else switch(t.details){case M.FRAG_GAP:case M.FRAG_PARSING_ERROR:case M.FRAG_DECRYPT_ERROR:case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(K,t);break;case M.AUDIO_TRACK_LOAD_ERROR:case M.AUDIO_TRACK_LOAD_TIMEOUT:case M.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==_i||(null==(i=t.context)?void 0:i.type)!==U||(this.state=Ri);break;case M.BUFFER_APPEND_ERROR:case M.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===M.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,Qf(Xf(r.prototype),"flushMainBuffer",this).call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case M.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}},{key:"onBufferFlushing",value:function(e,t){t.type!==It&&(this.flushing=!0)}},{key:"onBufferFlushed",value:function(e,t){var r=t.type;if(r!==It){this.flushing=!1,this.bufferFlushed=!0,this.state===xi&&(this.state=Ri);var i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,r,K),this.tick())}}},{key:"_handleTransmuxComplete",value:function(e){var t,r="audio",i=this.hls,n=e.remuxResult,a=e.chunkMeta,s=this.getCurrentContext(a);if(s){var o=s.frag,l=s.part,u=s.level,c=u.details,h=n.audio,d=n.text,f=n.id3,v=n.initSegment;if(!this.fragContextChanged(o)&&c){if(this.state=Pi,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),null!=v&&v.tracks){var g=o.initSegment||o;this._bufferInitSegment(u,v.tracks,g,a),i.trigger(O.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:r,tracks:v.tracks})}if(h){var p=h.startPTS,m=h.endPTS,y=h.startDTS,E=h.endDTS;l&&(l.elementaryStreams[Rt]={startPTS:p,endPTS:m,startDTS:y,endDTS:E}),o.setElementaryStreamInfo(Rt,p,m,y,E),this.bufferFragmentData(h,o,l,a)}if(null!=f&&null!=(t=f.samples)&&t.length){var k=W({id:r,frag:o,details:c},f);i.trigger(O.FRAG_PARSING_METADATA,k)}if(d){var T=W({id:r,frag:o,details:c},d);i.trigger(O.FRAG_PARSING_USERDATA,T)}}else this.fragmentTracker.removeFragment(o)}else this.resetWhenMissingContext(a)}},{key:"_bufferInitSegment",value:function(e,t,r,i){var n,a;if(this.state===Pi&&(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(py(n=py(a="Init audio buffer, container:".concat(s.container,", codecs[level/parsed]=[")).call(a,o,"/")).call(n,s.codec,"]")),o&&1===o.split(",").length&&(s.levelCodec=o),this.hls.trigger(O.BUFFER_CODECS,t);var l=s.initSegment;if(null!=l&&l.byteLength){var u={type:"audio",frag:r,part:null,chunkMeta:i,parent:r.type,data:l};this.hls.trigger(O.BUFFER_APPENDING,u)}this.tickImmediate()}}},{key:"loadFragment",value:function(e,t,i){var n,a=this.fragmentTracker.getState(e);if(this.switchingTrack||a===rt||a===nt)if(_t(e))if(null!=(n=t.details)&&n.live&&!this.initPTS[e.cc]){var s,o;this.log(py(s=py(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=Oi;var l=this.mainDetails;l&&l.fragmentStart!==t.details.fragmentStart&&Ai(t.details,l)}else Qf(Xf(r.prototype),"loadFragment",this).call(this,e,t,i);else this._loadInitSegment(e,t);else this.clearTrackerIfNeeded(e)}},{key:"flushAudioIfNeeded",value:function(e){var t=this.media,i=this.bufferedTrack,n=null==i?void 0:i.attrs,a=e.attrs;t&&n&&(n.CHANNELS!==a.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),Qf(Xf(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(O.AUDIO_TRACK_SWITCHED,z({},e))}}]),r}(Ni),audioTrackController:function(e){Ym(r,e);var t=Wm(r);function r(e){var i;return qm(this,r),(i=t.call(this,e,"audio-track-controller")).tracks=[],i.groupIds=null,i.tracksInGroup=[],i.trackId=-1,i.currentTrack=null,i.selectDefaultTrack=!0,i.registerListeners(),i}return Xm(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.MANIFEST_PARSED,this.onManifestParsed,this),e.on(O.LEVEL_LOADING,this.onLevelLoading,this),e.on(O.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(O.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(O.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.MANIFEST_PARSED,this.onManifestParsed,this),e.off(O.LEVEL_LOADING,this.onLevelLoading,this),e.off(O.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(O.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(O.ERROR,this.onError,this)}},{key:"destroy",value:function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,Qf(Xf(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,i,n,a,s,o,l,u=t.id,c=t.groupId,h=t.details,d=this.tracksInGroup[u];if(d&&d.groupId===c){var f=d.details;d.details=t.details,this.log(py(n=py(a=py(s=py(o=py(l="Audio track ".concat(u,' "')).call(l,d.name,'" lang:')).call(o,d.lang," group:")).call(s,c," loaded [")).call(a,h.startSN,"-")).call(n,h.endSN,"]")),u===this.trackId&&this.playlistLoaded(u,t,f)}else this.warn(py(r=py(i="Audio track with id:".concat(u," and group:")).call(i,c," 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,i=this.groupIds,n=this.currentTrack;if(!r||(null==i?void 0:i.length)!==(null==r?void 0:r.length)||null!=r&&Sy(r).call(r,(function(e){return-1===(null==i?void 0:hy(i).call(i,e))}))){var a,s;this.groupIds=r,this.trackId=-1,this.currentTrack=null;var o=Jm(a=this.tracks).call(a,(function(e){return!r||-1!==hy(r).call(r,e.groupId)}));if(o.length)this.selectDefaultTrack&&!Sy(o).call(o,(function(e){return e.default}))&&(this.selectDefaultTrack=!1),ey(o).call(o,(function(e,t){e.id=t}));else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;var l=this.hls.config.audioPreference;if(!n&&l){var u=xe(l,o,Oe);if(u>-1)n=o[u];else{var c=xe(l,this.tracks);n=this.tracks[c]}}var h=this.findTrackId(n);-1===h&&n&&(h=this.findTrackId(null));var d={audioTracks:o};this.log(py(s="Updating audio tracks, ".concat(o.length," track(s) found in group(s): ")).call(s,null==r?void 0:r.join(","))),this.hls.trigger(O.AUDIO_TRACKS_UPDATED,d);var f=this.trackId;if(-1!==h&&-1===f)this.setAudioTrack(h);else if(o.length&&-1===f){var v,g,p=new Error(py(v="No audio track selected for current audio group-ID(s): ".concat(null==(g=this.groupIds)?void 0:g.join(",")," track count: ")).call(v,o.length));this.warn(p.message),this.hls.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:p})}}}}},{key:"onError",value:function(e,t){var r;!t.fatal&&t.context&&(t.context.type!==U||t.context.id!==this.trackId||this.groupIds&&-1===hy(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 i=this.currentTrack;if(i&&Me(e,i,Oe))return i;var n=xe(e,this.tracksInGroup,Oe);if(n>-1){var a=this.tracksInGroup[n];return this.setAudioTrack(n),a}if(i){var s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);var o=function(e,t,r,i,n){var a=t[i],s=eS(t).call(t,(function(e,t,r){var i=t.uri;return(e[i]||(e[i]=[])).push(r),e}),{})[a.uri];s.length>1&&(i=Math.max.apply(Math,s));var o=a.videoRange,l=a.frameRate,u=a.codecSet.substring(0,4),c=Fe(t,i,(function(t){if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==u)return!1;var i=t.audioGroups,a=Jm(r).call(r,(function(e){return!i||-1!==hy(i).call(i,e.groupId)}));return xe(e,a,n)>-1}));return c>-1?c:Fe(t,i,(function(t){var i=t.audioGroups,a=Jm(r).call(r,(function(e){return!i||-1!==hy(i).call(i,e.groupId)}));return xe(e,a,n)>-1}))}(e,t.levels,r,s,Oe);if(-1===o)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){var l=xe(e,r);if(l>-1)return r[l]}}}return null}},{key:"setAudioTrack",value:function(e){var t,r,i,n,a=this.tracksInGroup;if(e<0||e>=a.length)this.warn("Invalid audio track id: ".concat(e));else{this.selectDefaultTrack=!1;var s=this.currentTrack,o=a[e],l=o.details&&!o.details.live;if(!(e===this.trackId&&o===s&&l||(this.log(py(t=py(r=py(i=py(n="Switching to audio-track ".concat(e,' "')).call(n,o.name,'" lang:')).call(i,o.lang," group:")).call(r,o.groupId," channels:")).call(t,o.channels)),this.trackId=e,this.currentTrack=o,this.hls.trigger(O.AUDIO_TRACK_SWITCHING,z({},o)),l))){var u=this.switchParams(o.url,null==s?void 0:s.details,o.details);this.loadPlaylist(u)}}}},{key:"findTrackId",value:function(e){for(var t=this.tracksInGroup,r=0;r<t.length;r++){var i=t[r];if((!this.selectDefaultTrack||i.default)&&(!e||Me(e,i,Oe)))return r}if(e){for(var n=e.name,a=e.lang,s=e.assocLang,o=e.characteristics,l=e.audioCodec,u=e.channels,c=0;c<t.length;c++)if(Me({name:n,lang:a,assocLang:s,characteristics:o,audioCodec:l,channels:u},t[c],Oe))return c;for(var h=0;h<t.length;h++){var d=t[h];if(va(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return h}for(var f=0;f<t.length;f++){var v=t[f];if(va(e.attrs,v.attrs,["LANGUAGE"]))return f}}return-1}},{key:"loadPlaylist",value:function(e){Qf(Xf(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 i,n,a,s,o,l;Qf(Xf(r.prototype),"loadingPlaylist",this).call(this,e,t);var u=e.id,c=e.groupId,h=this.getUrlWithDirectives(e.url,t),d=e.details,f=null==d?void 0:d.age;this.log(py(i=py(n=py(a=py(s=py(o=py(l="Loading audio-track ".concat(u,' "')).call(l,e.name,'" lang:')).call(o,e.lang," group:")).call(s,c)).call(a,void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")).call(n,f&&d.live?" age "+f.toFixed(1)+(d.type&&" "+d.type||""):""," ")).call(i,h)),this.hls.trigger(O.AUDIO_TRACK_LOADING,{url:h,id:u,groupId:c,deliveryDirectives:t||null,track:e})}}]),r}(pa),emeController:Za,cmcdController:function(){function e(t){var r=this;qm(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:La.MANIFEST,su:!r.initialized})}catch(t){r.hls.logger.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=function(e){try{var t=e.frag,i=e.part,n=r.hls.levels[t.level],a=r.getObjectType(t),s={d:1e3*(i||t).duration,ot:a};a!==La.VIDEO&&a!==La.AUDIO&&a!=La.MUXED||(s.br=n.bitrate/1e3,s.tb=r.getTopBandwidth(a)/1e3,s.bl=r.getBufferLength(a));var o=i?r.getNextPart(i):r.getNextFrag(t);null!=o&&o.url&&o.url!==t.url&&(s.nor=o.url),r.apply(e,s)}catch(l){r.hls.logger.warn("Could not generate segment CMCD data.",l)}},this.hls=t;var i=this.config=t.config,n=i.cmcd;null!=n&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||t.sessionId,this.cid=n.contentId,this.useHeaders=!0===n.useHeaders,this.includeKeys=n.includeKeys,this.registerListeners())}return Xm(e,[{key:"registerListeners",value:function(){var e=this.hls;e.on(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(O.MEDIA_DETACHED,this.onMediaDetached,this),e.on(O.BUFFER_CREATED,this.onBufferCreated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(O.MEDIA_DETACHED,this.onMediaDetached,this),e.off(O.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,i;this.audioBuffer=null==(r=t.tracks.audio)?void 0:r.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer}},{key:"createData",value:function(){var e;return{v:1,sf:ba.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 i=r.ot===La.INIT||r.ot===La.VIDEO||r.ot===La.MUXED;this.starved&&i&&(r.bs=!0,r.su=!0,this.starved=!1),null==r.su&&(r.su=this.buffering);var n=this.includeKeys;n&&(r=eS(t=Qm(r)).call(t,(function(e,t){return zx(n).call(n,t)&&(e[t]=r[t]),e}),{}));var a={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),za(e.headers,r,a)):e.url=Qa(e.url,r,a)}},{key:"getNextFrag",value:function(e){var t,r=null==(t=this.hls.levels[e.level])?void 0:t.details;if(r){var i=e.sn-r.startSN;return r.fragments[i+1]}}},{key:"getNextPart",value:function(e){var t,r,i=e.index,n=e.fragment,a=null==(t=this.hls.levels[n.level])||null==(r=t.details)?void 0:r.partList;if(a)for(var s=n.sn,o=a.length-1;o>=0;o--){var l=a[o];if(l.index===i&&l.fragment.sn===s)return a[o+1]}}},{key:"getObjectType",value:function(e){var t=e.type;return"subtitle"===t?La.TIMED_TEXT:"initSegment"===e.sn?La.INIT:"audio"===t?La.AUDIO:"main"===t?this.hls.audioTracks.length?La.VIDEO:La.MUXED:void 0}},{key:"getTopBandwidth",value:function(e){var t,r=0,i=this.hls;if(e===La.AUDIO)t=i.audioTracks;else{var n,a=i.maxAutoLevel,s=a>-1?a+1:i.levels.length;t=uy(n=i.levels).call(n,0,s)}var o,l=function(e,t){var r=void 0!==Ih&&od(e)||e["@@iterator"];if(!r){if(ud(e)||(r=gf(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,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,a=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}(t);try{for(l.s();!(o=l.n()).done;){var u=o.value;u.bitrate>r&&(r=u.bitrate)}}catch(c){l.e(c)}finally{l.f()}return r>0?r:NaN}},{key:"getBufferLength",value:function(e){var t=this.media,r=e===La.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){qm(this,e),this.loader=void 0,this.loader=new r(t)}return Xm(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,i){t(e),this.loader.load(e,r,i)}}]),e}()}},{key:"createFragmentLoader",value:function(){var e=this.config.fLoader,t=this.applyFragmentData,r=e||this.config.loader;return function(){function e(t){qm(this,e),this.loader=void 0,this.loader=new r(t)}return Xm(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,i){t(e),this.loader.load(e,r,i)}}]),e}()}}]),e}(),contentSteeringController:function(e){Ym(r,e);var t=Wm(r);function r(e){var i;return qm(this,r),(i=t.call(this,"content-steering",e.logger)).hls=void 0,i.loader=null,i.uri=null,i.pathwayId=".",i._pathwayPriority=null,i.timeToLoad=300,i.reloadTimer=-1,i.updated=0,i.started=!1,i.enabled=!0,i.levels=null,i.audioTracks=null,i.subtitleTracks=null,i.penalizedPathways={},i.hls=e,i.registerListeners(),i}return Xm(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(O.MANIFEST_PARSED,this.onManifestParsed,this),e.on(O.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(O.MANIFEST_PARSED,this.onManifestParsed,this),e.off(O.ERROR,this.onError,this))}},{key:"pathways",value:function(){var e;return eS(e=this.levels||[]).call(e,(function(e,t){return-1===hy(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=Jm(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)===Xe&&V_(r)===Ze){var i,n,a,s,o,l=this.levels,u=this._pathwayPriority,c=this.pathwayId;if(t.context){var h=t.context,d=h.groupId,f=h.pathwayId,v=h.type;d&&l?c=this.getPathwayForGroupId(d,v,c):f&&(c=f)}c in this.penalizedPathways||(this.penalizedPathways[c]=performance.now()),!u&&l&&(u=this.pathways()),u&&u.length>1&&(this.updatePathwayPriority(u),r.resolved=this.pathwayId!==c),r.resolved||this.warn(py(i=py(n=py(a=py(s=py(o="Could not resolve ".concat(t.details,' ("')).call(o,t.error.message,'") with content-steering for Pathway: ')).call(s,c," levels: ")).call(a,l?l.length:l," priorities: ")).call(n,x_(u)," penalized: ")).call(i,x_(this.penalizedPathways)))}}},{key:"filterParsedLevels",value:function(e){var t,r;this.levels=e;var i=this.getLevelsForPathway(this.pathwayId);if(0===i.length){var n,a=e[0].pathwayId;this.log(py(n="No levels found in Pathway ".concat(this.pathwayId,'. Setting initial Pathway to "')).call(n,a,'"')),i=this.getLevelsForPathway(a),this.pathwayId=a}return i.length!==e.length&&this.log(py(t=py(r="Found ".concat(i.length,"/")).call(r,e.length,' levels in Pathway "')).call(t,this.pathwayId,'"')),i}},{key:"getLevelsForPathway",value:function(e){var t;return null===this.levels?[]:Jm(t=this.levels).call(t,(function(t){return e===t.pathwayId}))}},{key:"updatePathwayPriority",value:function(e){var t,r;this._pathwayPriority=e;var i=this.penalizedPathways,n=performance.now();ey(t=Qm(i)).call(t,(function(e){n-i[e]>3e5&&delete i[e]}));for(var a=0;a<e.length;a++){var s=e[a];if(!(s in i)){if(s===this.pathwayId)return;var o=this.hls.nextLoadLevel,l=this.hls.levels[o];if((r=this.getLevelsForPathway(s)).length>0){var u;this.log('Setting Pathway to "'.concat(s,'"')),this.pathwayId=s,yi(r),this.hls.trigger(O.LEVELS_UPDATED,{levels:r});var c=this.hls.levels[o];l&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==l.bitrate&&this.log(py(u="Unstable Pathways change from bitrate ".concat(l.bitrate," to ")).call(u,c.bitrate)),this.hls.nextLoadLevel=o);break}}}}},{key:"getPathwayForGroupId",value:function(e,t,r){for(var i,n=py(i=this.getLevelsForPathway(r)).call(i,this.levels||[]),a=0;a<n.length;a++)if(t===U&&n[a].hasAudioGroup(e)||t===B&&n[a].hasSubtitleGroup(e))return n[a].pathwayId;return r}},{key:"clonePathways",value:function(e){var t=this,r=this.levels;if(r){var i={},n={};ey(e).call(e,(function(e){var a,s=e.ID,o=e["BASE-ID"],l=e["URI-REPLACEMENT"];if(!Sy(r).call(r,(function(e){return e.pathwayId===s}))){var u=Dy(a=t.getLevelsForPathway(o)).call(a,(function(e){var t,r,a=new Tr(e.attrs);a["PATHWAY-ID"]=s;var o=a.AUDIO&&py(t="".concat(a.AUDIO,"_clone_")).call(t,s),u=a.SUBTITLES&&py(r="".concat(a.SUBTITLES,"_clone_")).call(r,s);o&&(i[a.AUDIO]=o,a.AUDIO=o),u&&(n[a.SUBTITLES]=u,a.SUBTITLES=u);var c=Ja(e.uri,a["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),h=new Ie({attrs:a,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:c,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(var d=1;d<e.audioGroups.length;d++){var f;h.addGroupId("audio",py(f="".concat(e.audioGroups[d],"_clone_")).call(f,s))}if(e.subtitleGroups)for(var v=1;v<e.subtitleGroups.length;v++){var g;h.addGroupId("text",py(g="".concat(e.subtitleGroups[v],"_clone_")).call(g,s))}return h}));r.push.apply(r,pf(u)),$a(t.audioTracks,i,l,s),$a(t.subtitleTracks,n,l,s)}}))}}},{key:"loadSteeringManifest",value:function(e){var t,r=this,i=this.hls.config,n=i.loader;this.loader&&this.loader.destroy(),this.loader=new n(i);try{t=new e_(e)}catch(h){return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: ".concat(e))}if("data:"!==t.protocol){var a=0|(this.hls.bandwidthEstimate||i.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+a)}var s={responseType:"json",url:t.href},o=i.steeringManifestLoadPolicy.default,l=o.errorRetry||o.timeoutRetry||{},u={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},c={onSuccess:function(e,i,n,a){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"],u=s["PATHWAY-PRIORITY"];if(o)try{r.uri=new e_(o,t).href}catch(h){return r.enabled=!1,void r.log("Failed to parse Steering Manifest RELOAD-URI: ".concat(o))}r.scheduleRefresh(r.uri||n.url),l&&r.clonePathways(l);var c={steeringManifest:s,url:t.toString()};r.hls.trigger(O.STEERING_MANIFEST_LOADED,c),u&&r.updatePathwayPriority(u)}else r.log("Steering VERSION ".concat(s.VERSION," not supported!"))},onError:function(e,t,i,n){var a,s;if(r.log(py(a=py(s="Error loading steering manifest: ".concat(e.code," ")).call(s,e.text," (")).call(a,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 u=l.getResponseHeader("Retry-After");u&&(o=1e3*ck(u))}r.log("Steering manifest ".concat(t.url," rate limited"))}},onTimeout:function(e,t,i){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,u,c)}},{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=mE((function(){var r,i=null==(r=t.hls)?void 0:r.media;!i||i.ended?t.scheduleRefresh(e,1e3*t.timeToLoad):t.loadSteeringManifest(e)}),r)}}]),r}(X),interstitialsController:function(e){Ym(r,e);var t=Wm(r);function r(e,i){var n;return qm(this,r),(n=t.call(this,"interstitials",e.logger)).HlsPlayerClass=void 0,n.hls=void 0,n.assetListLoader=void 0,n.mediaSelection=null,n.altSelection=null,n.media=null,n.detachedData=null,n.requiredTracks=null,n.manager=null,n.playerQueue=[],n.bufferedPos=-1,n.timelinePos=-1,n.schedule=void 0,n.playingItem=null,n.bufferingItem=null,n.waitingItem=null,n.playingAsset=null,n.bufferingAsset=null,n.shouldPlay=!1,n.onPlay=function(){n.shouldPlay=!0},n.onPause=function(){n.shouldPlay=!1},n.onSeeking=function(){var e=n.currentTime;if(void 0!==e&&!n.playbackDisabled){var t=e-n.timelinePos;if(!(Math.abs(t)<1/7056e5)){var r=t<=-.01;n.timelinePos=e,n.bufferedPos=e,n.checkBuffer();var i=n.playingItem;if(i)if(r&&e<i.start||e>=i.end){var a,s=n.schedule.findItemIndexAtTime(n.timelinePos);if(!n.isInterstitial(i)&&null!=(a=n.media)&&a.paused&&(n.shouldPlay=!1),!r){var o=n.findItemIndex(i);if(s>o){var l=n.schedule.findJumpRestrictedIndex(o+1,s);if(l>o)return void n.setSchedulePosition(l)}}n.setSchedulePosition(s)}else{var u=n.playingAsset;if(u){var c=u.timelineStart,h=u.duration||0;(r&&e<c||e>=c+h)&&n.setScheduleToAssetAtTime(e,u)}else if(n.playingLastItem&&n.isInterstitial(i)){var d=i.event.assetList[0];d&&(n.playingItem=null,n.setScheduleToAssetAtTime(e,d))}}}}},n.onTimeupdate=function(){var e=n.currentTime;if(void 0!==e&&!n.playbackDisabled&&e>n.timelinePos){e>n.bufferedPos&&n.checkBuffer(),n.timelinePos=e;var t=n.playingItem;if(t&&!n.playingLastItem){if(e>=t.end){n.timelinePos=t.end;var r=n.findItemIndex(t);n.setSchedulePosition(r+1)}var i=n.playingAsset;i&&e>=i.timelineStart+(i.duration||0)&&n.setScheduleToAssetAtTime(e,i)}}},n.onScheduleUpdate=function(e,t){var r,i,a,s=n.schedule,o=n.playingItem,l=s.events||[],u=s.items||[],c=s.durations,h=Dy(e).call(e,(function(e){return e.identifier})),d=!(!l.length&&!h.length);d&&(!1===n.hls.config.interstitialAppendInPlace&&ey(l).call(l,(function(e){return e.appendInPlace=!1})),n.log(py(r=py(i="INTERSTITIALS_UPDATED (".concat(l.length,"): ")).call(i,l,"\nSchedule: ")).call(r,Dy(u).call(u,(function(e){return ps(e)}))))),h.length&&n.log("Removed events ".concat(h)),ey(a=n.playerQueue).call(a,(function(e){if(e.interstitial.appendInPlace){var t=e.assetItem.timelineStart,r=e.timelineOffset-t;if(r)try{e.timelineOffset=t}catch(o){var i,a,s;Math.abs(r)>os&&n.warn(py(i=py(a=py(s="".concat(o,' ("')).call(s,e.assetId,'" ')).call(a,e.timelineOffset,"->")).call(i,t,")"))}}})),o&&!o.event&&(n.playingItem=n.updateItem(o,n.timelinePos));var f=n.bufferingItem;if(f&&(f.event?n.updateItem(f)||(n.bufferingItem=null,n.clearInterstitial(f.event,null)):n.bufferingItem=n.updateItem(f,n.bufferedPos)),n.waitingItem=n.updateItem(n.waitingItem),ey(e).call(e,(function(e){var t;ey(t=e.assetList).call(t,(function(e){n.clearAssetPlayer(e.identifier,null)}))})),d||t){if(n.hls.trigger(O.INTERSTITIALS_UPDATED,{events:uy(l).call(l,0),schedule:uy(u).call(u,0),durations:c,removedIds:h}),n.isInterstitial(o)&&zx(h).call(h,o.event.identifier))return n.warn('Interstitial "'.concat(o.event.identifier,'" removed while playing')),void n.primaryFallback(o.event);n.checkBuffer()}},n.hls=e,n.HlsPlayerClass=i,n.assetListLoader=new ms(e),n.schedule=new gs(n.onScheduleUpdate,e.logger),n.registerListeners(),n}return Xm(r,[{key:"registerListeners",value:function(){var e=this.hls;e.on(O.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(O.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(O.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(O.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(O.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(O.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(O.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(O.BUFFER_APPENDED,this.onBufferAppended,this),e.on(O.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(O.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(O.MEDIA_ENDED,this.onMediaEnded,this),e.on(O.ERROR,this.onError,this),e.on(O.DESTROYING,this.onDestroying,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(O.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(O.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(O.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(O.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(O.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(O.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(O.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(O.BUFFER_CODECS,this.onBufferCodecs,this),e.off(O.BUFFER_APPENDED,this.onBufferAppended,this),e.off(O.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(O.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(O.MEDIA_ENDED,this.onMediaEnded,this),e.off(O.ERROR,this.onError,this),e.off(O.DESTROYING,this.onDestroying,this))}},{key:"startLoad",value:function(){this.resumeBuffering()}},{key:"stopLoad",value:function(){this.pauseBuffering()}},{key:"resumeBuffering",value:function(){var e;ey(e=this.playerQueue).call(e,(function(e){return e.resumeBuffering()}))}},{key:"pauseBuffering",value:function(){var e;ey(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,i=this.detachedData;if(this.detachedData=null,null===r)this.checkStart();else if(!i){this.clearScheduleState();var n=this.findItemIndex(r);this.setSchedulePosition(n)}}},{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,i=this.media;if(this.media=null,!r&&(i&&this.removeMediaListeners(i),this.detachedData)){var n=this.getBufferingPlayer();n&&(this.playingAsset=null,this.bufferingAsset=null,this.bufferingItem=null,this.waitingItem=null,this.detachedData=null,n.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},i=function(t){return t?e.getAssetPlayer(t.identifier):t},n=function(t,r,n,a,o){if(t){var l=t[r].start,u=t.event;if(u){if("playout"===r||u.timelineOccupancy!==ls.Point){var c=i(n);(null==c?void 0:c.interstitial)===u&&(l+=c.assetItem.startOffset+c[o])}}else l+=("bufferedPos"===a?s():e[a])-t.start;return l}return 0},a=function(t,r){if(0!==t&&"primary"!==r&&e.schedule.length){var i,n=e.schedule.findItemIndexAtTime(t),a=null==(i=e.schedule.items)?void 0:i[n];if(a)return t+(a[r].start-a.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,a){var s,o,l,u=r();if(null==u||null==(o=u.event)||!o.restrictions.skip){e.log(py(s="seek to ".concat(t,' "')).call(s,a,'"'));var c=r(),h=e.schedule.findItemIndexAtTime(t,a),d=null==(l=e.schedule.items)?void 0:l[h],f=null==c?void 0:c.event,v=null==f?void 0:f.appendInPlace,g=c&&e.itemsMatch(c,d);if(c&&(v||g)){var p=i(e.playingAsset),m=(null==p?void 0:p.media)||e.hls.media;if(m){var y=t-("primary"===a?m.currentTime:n(c,a,e.playingAsset,"timelinePos","currentTime")),E=m.currentTime+y;if(E>=0&&(!p||v||E<=p.duration))return void(m.currentTime=E)}}if(d){var k=t;if("primary"!==a){var T=t-d[a].start;k=d.start+T}var S=!e.isInterstitial(d);if(e.isInterstitial(c)||!S&&!d.event.appendInPlace){if(c){var A=e.findItemIndex(c);if(h>A){var L=e.schedule.findJumpRestrictedIndex(A+1,h);if(L>A)return void e.setSchedulePosition(L)}var b=0;if(S)e.timelinePos=k;else{var R,I=null==d||null==(R=d.event)?void 0:R.assetList;if(I)for(var D=t-(d[a]||d).start,w=I.length;w--;){var _=I[w];if(_.duration&&D>=_.startOffset&&D<_.startOffset+_.duration){b=w;break}}}e.setSchedulePosition(h,b)}}else{var P=e.hls.media;P&&(P.currentTime=k)}}}};this.manager={get events(){var t,r;return(null==(t=e.schedule)||null==(r=t.events)?void 0:uy(r).call(r,0))||[]},get schedule(){var t,r;return(null==(t=e.schedule)||null==(r=t.items)?void 0:uy(r).call(r,0))||[]},get playerQueue(){var t;return uy(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 n(t(),"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(r(),"playout",e.playingAsset,"timelinePos","currentTime")},get duration(){return o("playout")},get seekableStart(){var t;return a((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"playout")},seekTo:function(e){return l(e,"playout")}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(r(),"integrated",e.playingAsset,"timelinePos","currentTime")},get duration(){return o("integrated")},get seekableStart(){var t;return a((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"integrated")},seekTo:function(e){return l(e,"integrated")}},skip:function(){var t=r(),i=null==t?void 0:t.event;if(i&&!i.restrictions.skip){var n=e.findItemIndex(t);if(i.appendInPlace){var a=t.playout.start+t.event.duration;l(a+.001,"playout")}else e.advanceAfterAssetEnded(i,n,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 i=this.waitingItem||this.playingItem;if(!this.isInterstitial(i)||i.event.appendInPlace){var n=this.media;!n&&null!=(e=this.bufferingItem)&&null!=(t=e.event)&&t.appendInPlace&&(n=this.primaryMedia);var a=null==(r=n)?void 0:r.currentTime;return void 0!==a&&_(a)?a: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,i=e.media;if(r&&i===this.primaryMedia){var n;if(!t||this.isInterstitial(t)&&!t.event.appendInPlace)return void(t&&i&&(this.detachedData={media:i}));var a=e.transferMedia();this.log(py(n="transfer MediaSource from ".concat(e," ")).call(n,x_(a))),this.bufferingAsset=null,this.detachedData=a}else t&&i&&(this.shouldPlay||(this.shouldPlay=!i.paused))}},{key:"transferMediaTo",value:function(e,t){var r,i,n,a,s,o,l=null,u=this.hls,c=e!==u,h=c&&e.interstitial.appendInPlace,d=null==(a=this.detachedData)?void 0:a.mediaSource;if(u.media&&h)l=u.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(py(r=py(i="transferring to ".concat(c?e:"Primary","\nMediaSource ")).call(i,x_(l)," from ")).call(r,o)),l||(d?(l=this.detachedData,this.log("using detachedData: MediaSource ".concat(x_(l)))):this.detachedData&&this.hls.media!==t||(this.hls.detachMedia(),this.detachedData={media:t}));var v=l&&"mediaSource"in l&&"closed"!==(null==(s=l.mediaSource)?void 0:s.readyState),g=v&&l?l:t;if(this.log(py(n="".concat(v?"transfering MediaSource":"attaching media"," to ")).call(n,c?e:"Primary")),g===l){var p=c&&e.assetId===this.schedule.assetIdAtEnd;g.overrides={duration:this.schedule.duration,endOfStream:!c||p,cueRemoval:!1}}e.attachMedia(g)}},{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,i=this.waitingItem;if(-1===r){var n=this.hls.startPosition;if(this.timelinePos=n,t.length&&t[0].cue.pre){var a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(n>=0||!this.primaryLive){var s=this.timelinePos=n>0?n:0,o=e.findItemIndexAtTime(s);this.setSchedulePosition(o)}}else if(i&&!this.playingItem){var l=e.findItemIndex(i);this.setSchedulePosition(l)}}}},{key:"advanceAfterAssetEnded",value:function(e,t,r){var i=r+1;if(e.isAssetPastPlayoutLimit(i)||e.assetList[i].error){var n=this.schedule.items;if(n){var a=t+1;if(a>=n.length)return void this.setSchedulePosition(-1);this.setSchedulePosition(a)}}else this.setSchedulePosition(t,i)}},{key:"setScheduleToAssetAtTime",value:function(e,t){var r=this.schedule,i=t.parentIdentifier,n=r.getEvent(i);if(n){var a=r.findEventIndex(i),s=r.findAssetIndex(n,e);this.setSchedulePosition(a,s)}}},{key:"setSchedulePosition",value:function(e,t){var r,i=this,n=this.schedule.items;if(n&&!this.playbackDisabled){this.log(py(r="setSchedulePosition ".concat(e,", ")).call(r,t));var a=e>=0?n[e]:null,s=this.primaryMedia,o=this.playingItem,l=this.playingLastItem;if(this.isInterstitial(o)){var u,c,h=o.event,d=this.playingAsset,f=null==d?void 0:d.identifier,v=f?this.getAssetPlayer(f):null;if(v&&f&&(!this.eventItemsMatch(o,a)||void 0!==t&&f!==(null==(c=h.assetList)?void 0:c[t].identifier))){var g,p;this.playingAsset=null;var m=h.findAssetIndex(d);this.log(py(g=py(p="INTERSTITIAL_ASSET_ENDED ".concat(m+1,"/")).call(p,h.assetList.length," ")).call(g,fs(d))),this.hls.trigger(O.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:m,event:h,schedule:uy(n).call(n,0),scheduleIndex:e,player:v}),this.retreiveMediaSource(f,a),v.media&&!this.detachedData&&v.detachMedia(),this.clearAssetPlayer(f,a)}if(!this.eventItemsMatch(o,a)&&(this.playingItem=null,this.log(py(u="INTERSTITIAL_ENDED ".concat(h," ")).call(u,ps(o))),h.hasPlayed=!0,this.hls.trigger(O.INTERSTITIAL_ENDED,{event:h,schedule:uy(n).call(n,0),scheduleIndex:e}),this.clearInterstitial(h,a),h.cue.once)){if(this.updateSchedule(),a){var y=this.schedule.findItemIndex(a);this.setSchedulePosition(y,t)}return}}var E=this.playerQueue;if(E.length&&ey(E).call(E,(function(t){var r=t.interstitial,n=i.schedule.findEventIndex(r.identifier);(n<e||n>e+1)&&i.clearInterstitial(r,a)})),this.isInterstitial(a)){var k,T,S;this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);var A=a.event;void 0===t&&(t=this.schedule.findAssetIndex(A,this.timelinePos));var L=this.waitingItem,b=this.preloadAssets(A,t);b||this.setBufferingItem(a),this.eventItemsMatch(a,o||L)||(this.waitingItem=a,this.log(py(k="INTERSTITIAL_STARTED ".concat(ps(a)," ")).call(k,A.appendInPlace?"append in place":"")),this.hls.trigger(O.INTERSTITIAL_STARTED,{event:A,schedule:uy(n).call(n,0),scheduleIndex:e}));var R=A.assetList.length;if(0===R&&!A.assetListResponse)return void this.log("Waiting for ASSET-LIST to complete loading ".concat(A));if(A.assetListLoader&&(A.assetListLoader.destroy(),A.assetListLoader=void 0),!s)return void this.log("Waiting for attachMedia to start Interstitial ".concat(A));this.waitingItem=null,this.playingItem=a;var I=A.assetList[t];if(!I){var D=n[e+1],w=this.media;return D&&w&&!this.isInterstitial(D)&&w.currentTime<D.start&&(w.currentTime=this.timelinePos=D.start),void this.advanceAfterAssetEnded(A,e,t||0)}if(b||(b=this.getAssetPlayer(I.identifier)),(null===b||b.destroyed)&&(this.warn(py(T=py(S="asset ".concat(t+1,"/")).call(S,R," player destroyed ")).call(T,A)),b=this.createAssetPlayer(A,I,t)),!this.eventItemsMatch(a,this.bufferingItem)&&A.appendInPlace&&this.isAssetBuffered(I))return;this.startAssetPlayer(b,t,n,e,s),this.shouldPlay&&ys(b.media)}else null!==a?(this.resumePrimary(a,e,o),this.shouldPlay&&ys(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 i;if(this.playingItem=e,this.playingAsset=null,this.waitingItem=null,this.bufferedToItem(e),this.log("resuming ".concat(ps(e))),null==(i=this.detachedData)||!i.mediaSource){var n=this.timelinePos;(n<e.start||n>=e.end)&&(n=this.getPrimaryResumption(e,t),this.timelinePos=n),this.attachPrimary(n,e)}if(r){var a=this.schedule.items;a&&(this.log("resumed ".concat(ps(e))),this.hls.trigger(O.INTERSTITIALS_PRIMARY_RESUMED,{schedule:uy(a).call(a,0),scheduleIndex:t}),this.checkBuffer())}}},{key:"getPrimaryResumption",value:function(e,t){var r=e.start;if(this.primaryLive){var i=this.primaryDetails;if(0===t)return this.hls.startPosition;if(i&&(r<i.fragmentStart||r>i.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 i=this.primaryMedia;if(i){var n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,i),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(O.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(O.BUFFER_CODECS,this.onBufferCodecs,this)}},{key:"onLevelUpdated",value:function(e,t){if(-1!==t.level){var r=this.hls.levels[t.level],i=z(z({},this.mediaSelection||this.altSelection),{},{main:r});this.mediaSelection=i,this.schedule.parseInterstitialDateRanges(i),!this.playingItem&&this.schedule.items&&this.checkStart()}}},{key:"onAudioTrackUpdated",value:function(e,t){var r=this.hls.audioTracks[t.id],i=this.mediaSelection;if(i){var n=z(z({},i),{},{audio:r});this.mediaSelection=n}else this.altSelection=z(z({},this.altSelection),{},{audio:r})}},{key:"onSubtitleTrackUpdated",value:function(e,t){var r=this.hls.subtitleTracks[t.id],i=this.mediaSelection;if(i){var n=z(z({},i),{},{subtitles:r});this.mediaSelection=n}else this.altSelection=z(z({},this.altSelection),{},{subtitles:r})}},{key:"onAudioTrackSwitching",value:function(e,t){var r,i=Ce(t);ey(r=this.playerQueue).call(r,(function(e){return e.hls.setAudioOption(t)||e.hls.setAudioOption(i)}))}},{key:"onSubtitleTrackSwitch",value:function(e,t){var r,i=Ce(t);ey(r=this.playerQueue).call(r,(function(e){return e.hls.setSubtitleOption(t)||-1!==t.id&&e.hls.setSubtitleOption(i)}))}},{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 i=this.timelinePos;this.bufferedPos=i,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 i=t[r];if(i.cue.post){var n,a=this.schedule.findEventIndex(i.identifier),s=null==(n=this.schedule.items)?void 0:n[a];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,i;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==(i=t.nextEvent)?void 0:i.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 i=this.schedule,n=this.bufferingItem;if(!(this.bufferedPos>e))if(1===t.length&&this.itemsMatch(t[0],n))this.bufferedPos=e;else{var a=this.playingItem,s=this.findItemIndex(a),o=i.findItemIndexAtTime(e);if(this.bufferedPos<e){var l,u=this.findItemIndex(n),c=Math.min(u+1,t.length-1),h=t[c];if(-1===o&&n&&e>=n.end&&(o=c),c-s>1&&!1===(null==n||null==(l=n.event)?void 0:l.appendInPlace))return;if(this.bufferedPos=e,o>u&&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&&a&&n!==a&&o===s&&this.bufferedToItem(a)}}},{key:"setBufferingItem",value:function(e){var t=this.bufferingItem,r=this.schedule,i=r.items,n=r.events;if(i&&n&&(!t||r.findItemIndex(t)!==r.findItemIndex(e))){var a,s,o=this.isInterstitial(e),l=this.getBufferingPlayer(),u=l?l.remaining:t?t.end-this.timelinePos:0;this.log("buffered to boundary ".concat(ps(e))+(t?" (".concat(u.toFixed(2)," remaining)"):"")),this.bufferingItem=e,this.bufferedPos=e.start,this.playbackDisabled||(o?ey(a=this.playerQueue).call(a,(function(e){return e.resumeBuffering()})):(this.hls.resumeBuffering(),ey(s=this.playerQueue).call(s,(function(e){return e.pauseBuffering()})))),this.hls.trigger(O.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:uy(n).call(n,0),schedule:uy(i).call(i,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 i=this.detachedData;if(i)if(i.mediaSource){var n=!0;this.attachPrimary(e.start,e,n)}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,i=0===r.assetList.length&&!r.assetListLoader,n=r.cue.once;if(i||!n){var a=this.preloadAssets(r,t);if(null!=a&&a.interstitial.appendInPlace){var s=r.assetList[t],o=this.primaryMedia;s&&o&&this.bufferAssetPlayer(a,o)}}}},{key:"preloadAssets",value:function(e,t){var r=e.assetList.length,i=0===r&&!e.assetListLoader,n=e.cue.once;if(i){var a,s;this.log(py(a=py(s="Load interstitial asset ".concat(t+1,"/")).call(s,r," ")).call(a,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 u=0;!this.playingItem&&this.primaryLive&&-1===(u=this.hls.startPosition)&&(u=this.hls.liveSyncPosition||0);var c=this.assetListLoader.loadAssetList(e,u);c&&(e.assetListLoader=c)}else if(!n&&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,i=this.requiredTracks;i&&ey(t=Qm(i)).call(t,(function(t){r.hls.trigger(O.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,i,n,a){var s={parentIdentifier:e.identifier,identifier:us(e,a,t),duration:n,startOffset:r,timelineStart:i,uri:a};return this.createAssetPlayer(e,s,t)}},{key:"createAssetPlayer",value:function(e,t,r){var i=this;this.log("create HLSAssetPlayer for ".concat(fs(t)));var n=this.hls,a=n.userConfig,s=a.videoPreference,o=n.levels[n.loadLevel]||n.levels[n.currentLevel];(s||o)&&(s=W({},s),o.videoCodec&&(s.videoCodec=o.videoCodec),o.videoRange&&(s.allowedVideoRanges=[o.videoRange]));var l=n.audioTracks[n.audioTrack],u=n.subtitleTracks[n.subtitleTrack],c=0;if(this.primaryLive){var h=this.timelinePos-t.timelineStart;if(h>1){var d=t.duration;d&&h<d&&(c=h)}}var f=z(z({},a),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:t.identifier,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:c,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:l||a.audioPreference,subtitlePreference:u||a.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(f.timelineOffset=t.timelineStart));var v=f.cmcd;null!=v&&v.sessionId&&v.contentId&&(f.cmcd=W({},v,{contentId:ss(t.uri)}));var g=new vs(this.HlsPlayerClass,f,e,t);this.playerQueue.push(g),e.assetList[r]=t;var p=t.identifier,m=function(n){var a,s;if(n.live){var o=new Error("Interstitials MUST be VOD assets ".concat(e)),l={fatal:!0,type:x.OTHER_ERROR,details:M.INTERSTITIAL_ASSET_ITEM_ERROR,error:o};i.handleAssetItemError(l,e,i.schedule.findEventIndex(e.identifier),r,o.message)}else{var u=n.edge-n.fragmentStart,c=t.duration;(null===c||u>c)&&(i.log(py(a=py(s='Interstitial asset "'.concat(p,'" duration change ')).call(s,c," > ")).call(a,u)),t.duration=u,i.updateSchedule())}};g.on(O.LEVEL_UPDATED,(function(e,t){var r=t.details;return m(r)})),g.on(O.LEVEL_PTS_UPDATED,(function(e,t){var r=t.details;return m(r)}));var y=function e(t,r){var n=i.getAssetPlayer(p);if(n&&r.tracks){n.off(O.BUFFER_CODECS,e),n.tracks=r.tracks;var a=i.primaryMedia;i.bufferingAsset===n.assetItem&&a&&!n.media&&i.bufferAssetPlayer(n,a)}};g.on(O.BUFFER_CODECS,y);var E=function r(n){var a,s=i.getAssetPlayer(p);if(i.log("buffered to end of asset ".concat(s)),s){s.off(O.BUFFERED_TO_END,r);var o=i.schedule.findEventIndex(e.identifier),l=e.findAssetIndex(t),u=l+1,c=null==(a=i.schedule.items)?void 0:a[o];if(i.isInterstitial(c))if(-1===l||e.isAssetPastPlayoutLimit(u)||e.assetList[u].error){var h,d=null==(h=i.schedule.items)?void 0:h[o+1];d&&i.bufferedToItem(d)}else i.bufferedToItem(c,l+1)}};g.on(O.BUFFERED_TO_END,E);var k=function(t){return function(){if(i.getAssetPlayer(p)){i.shouldPlay=!0;var r=i.schedule.findEventIndex(e.identifier);i.advanceAfterAssetEnded(e,r,t)}}};return g.once(O.MEDIA_ENDED,k(r)),g.once(O.PLAYOUT_LIMIT_REACHED,k(1/0)),g.on(O.ERROR,(function(t,n){var a;i.handleAssetItemError(n,e,i.schedule.findEventIndex(e.identifier),r,py(a="Asset player error ".concat(n.error," ")).call(a,e))})),g.on(O.DESTROYING,(function(){if(i.getAssetPlayer(p)){var t=new Error("Asset player destroyed unexpectedly ".concat(p)),n={fatal:!0,type:x.OTHER_ERROR,details:M.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};i.handleAssetItemError(n,e,i.schedule.findEventIndex(e.identifier),r,t.message)}})),this.hls.trigger(O.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:r,event:e,player:g}),g}},{key:"clearInterstitial",value:function(e,t){var r,i=this;ey(r=e.assetList).call(r,(function(e){i.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 i,n;this.log(py(i='clearAssetPlayer "'.concat(e,'" toSegment: ')).call(i,t?ps(t):t));var a=this.playerQueue[r];this.transferMediaFromPlayer(a,t),UE(n=this.playerQueue).call(n,r,1),a.destroy()}}}},{key:"emptyPlayerQueue",value:function(){for(var e;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}},{key:"startAssetPlayer",value:function(e,t,r,i,n){var a,s,o=e.interstitial,l=e.assetItem,u=e.assetId,c=o.assetList.length,h=this.playingAsset;this.playingAsset=l,h&&h.identifier===u||(h&&(this.clearAssetPlayer(h.identifier,r[i]),delete h.error),this.log(py(a=py(s="INTERSTITIAL_ASSET_STARTED ".concat(t+1,"/")).call(s,c," ")).call(a,e)),this.hls.trigger(O.INTERSTITIAL_ASSET_STARTED,{asset:l,assetListIndex:t,event:o,schedule:uy(r).call(r,0),scheduleIndex:i,player:e})),e.media||this.bufferAssetPlayer(e,n)}},{key:"bufferAssetPlayer",value:function(e,t){var r,i,n=e.interstitial,a=e.assetItem,s=e.assetId,o=this.schedule.findEventIndex(n.identifier),l=null==(r=this.schedule.items)?void 0:r[o];if(l){this.setBufferingItem(l),this.bufferingAsset=a;var u=this.getBufferingPlayer();if(u!==e){var c=(null==u?void 0:u.tracks)||(null==(i=this.detachedData)?void 0:i.tracks)||this.requiredTracks;if(n.appendInPlace&&a!==this.playingAsset){if(!e.tracks)return;if(c&&!ie(c,e.tracks)){var h,d,f=new Error(py(h=py(d='Asset "'.concat(s,"\" SourceBuffer tracks ('")).call(d,Qm(e.tracks),"') are not compatible with primary content tracks ('")).call(h,Qm(c),"')")),v={fatal:!0,type:x.OTHER_ERROR,details:M.INTERSTITIAL_ASSET_ITEM_ERROR,error:f},g=n.findAssetIndex(a);return void this.handleAssetItemError(v,n,o,g,f.message)}}this.transferMediaTo(e,t)}}}},{key:"handleAssetItemError",value:function(e,t,r,i,n){var a;if(e.details!==M.BUFFER_STALLED_ERROR){var s=t.assetList[i]||null,o=null;if(s){var l=this.getAssetPlayerQueueIndex(s.identifier);o=this.playerQueue[l]||null}var u=this.schedule.items,c=W({},e,{fatal:!1,errorAction:tt(!0),asset:s,assetListIndex:i,event:t,schedule:u,scheduleIndex:r,player:o});if(this.warn("Asset item error: ".concat(e.error)),this.hls.trigger(O.INTERSTITIAL_ASSET_ERROR,c),e.fatal){var h=new Error(n);s&&(this.playingAsset!==s&&this.clearAssetPlayer(s.identifier,null),s.error=h),Sy(a=t.assetList).call(a,(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 i,n,a,s;this.log(py(i=py(n=py(a=py(s='Fallback to primary from event "'.concat(e.identifier,'" start: ')).call(s,t," pos: ")).call(a,this.timelinePos," playing: ")).call(n,r?ps(r):"<none>"," error: ")).call(i,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 u=this.schedule.findItemIndexAtTime(o);this.setSchedulePosition(u)}}else this.checkStart()}},{key:"onAssetListLoaded",value:function(e,t){var r,i=this,n=t.event,a=n.identifier,s=t.assetListResponse.ASSETS;if(this.schedule.hasEvent(a)){var o=n.timelineStart,l=0;ey(s).call(s,(function(e,t){var r=ck(e.DURATION);i.createAsset(n,t,l,o+l,r,e.URI),l+=r})),n.duration=l;var u=this.waitingItem,c=(null==u?void 0:u.event.identifier)===a;this.updateSchedule();var h=null==(r=this.bufferingItem)?void 0:r.event;if(c){var d,f=this.schedule.findEventIndex(a),v=null==(d=this.schedule.items)?void 0:d[f];v&&this.setBufferingItem(v),this.setSchedulePosition(f)}else if((null==h?void 0:h.identifier)===a&&h.appendInPlace){var g=n.assetList[0],p=this.getAssetPlayer(g.identifier),m=this.primaryMedia;g&&p&&m&&this.bufferAssetPlayer(p,m)}}}},{key:"onError",value:function(e,t){switch(t.details){case M.ASSET_LIST_PARSING_ERROR:case M.ASSET_LIST_LOAD_ERROR:case M.ASSET_LIST_LOAD_TIMEOUT:var r=t.interstitial;r&&this.primaryFallback(r)}}}]),r}(X)});function Ao(e){var t;return e&&"object"==qh(e)?sy(e)?Dy(e).call(e,Ao):eS(t=Qm(e)).call(t,(function(t,r){return t[r]=Ao(e[r]),t}),{}):e}function Lo(e,t){var r=e.loader;r!==mo&&r!==To?(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=mo,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}function bo(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function Ro(e,t,r,i,n){var a=new e(t,r,"");try{a.value=i,n&&(a.type=n)}catch(s){a=new e(t,r,x_(n?z({type:n},i):i))}return a}var Io=function(){var e=bo();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}(),Do=function(){function e(t){var r=this;qm(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(O.EVENT_CUE_ENTER,{})},this.hls=t,this._registerListeners()}return Xm(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(O.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(O.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(O.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(O.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(O.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(O.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(O.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(O.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(O.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(O.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&&is(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,i=r.enableEmsgMetadataCues,n=r.enableID3MetadataCues;if(i||n){var a=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));var s=bo();if(s)for(var o=0;o<a.length;o++){var l=a[o].type;if((l!==dn.emsg||i)&&n){var u=ln(a[o].data);if(u){var c=a[o].pts,h=c+a[o].duration;h>Io&&(h=Io),h-c<=0&&(h=c+.25);for(var d=0;d<u.length;d++){var f=u[d];if(!un(f)){this.updateId3CueEnds(c,l);var v=Ro(s,c,h,f,l);v&&this.id3Track.addCue(v)}}}}}}}}},{key:"updateId3CueEnds",value:function(e,t){var r,i=null==(r=this.id3Track)?void 0:r.cues;if(i)for(var n=i.length;n--;){var a=i[n];a.type===t&&a.startTime<e&&a.endTime===Io&&(a.endTime=e)}}},{key:"onBufferFlushing",value:function(e,t){var r=t.startOffset,i=t.endOffset,n=t.type,a=this.id3Track,s=this.hls;if(s){var o=s.config,l=o.enableEmsgMetadataCues,u=o.enableID3MetadataCues;a&&(l||u)&&ns(a,r,i,"audio"===n?function(e){return e.type===dn.audioId3&&u}:"video"===n?function(e){return e.type===dn.emsg&&l}:function(e){return e.type===dn.audioId3&&u||e.type===dn.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 i,n=this.id3Track,a=e.dateRanges,s=Qm(a),o=this.dateRangeCuesAppended;if(n&&t)if(null!=(i=n.cues)&&i.length)for(var l,u=Jm(l=Qm(o)).call(l,(function(e){return!zx(s).call(s,e)})),c=function(){var e,t=u[h],i=o[t].cues;delete o[t],ey(e=Qm(i)).call(e,(function(e){try{var t=i[e];t.removeEventListener("enter",r.onEventCueEnter),n.removeCue(t)}catch(a){}}))},h=u.length;h--;)c();else o=this.dateRangeCuesAppended={};var d=e.fragments[e.fragments.length-1];if(0!==s.length&&_(null==d?void 0:d.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var f,v,g=bo(),p=function(){var e=s[m],t=a[e],i=t.startTime,n=o[e],l=(null==n?void 0:n.cues)||{},u=(null==n?void 0:n.durationKnown)||!1,c=Io,h=t.duration;if(t.endDate&&null!==h)c=i+h,u=!0;else if(t.endOnNext&&!u){var d=eS(s).call(s,(function(e,r){if(r!==t.id){var i=a[r];if(i.class===t.class&&i.startDate>t.startDate&&(!e||t.startDate<e.startDate))return i}return e}),null);d&&(c=d.startTime,u=!0)}for(var p=Qm(t.attr),y=0;y<p.length;y++){var E=p[y];if("ID"!==(v=E)&&"CLASS"!==v&&"CUE"!==v&&"START-DATE"!==v&&"DURATION"!==v&&"END-DATE"!==v&&"END-ON-NEXT"!==v){var k=l[E];if(k)u&&!n.durationKnown?k.endTime=c:Math.abs(k.startTime-i)>.01&&(k.startTime=i,k.endTime=c);else if(g){var T=t.attr[E];Sr(E)&&(f=T,T=Uint8Array.from(f.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer);var S=Ro(g,i,c,{key:E,data:T},dn.dateRange);S&&(S.id=e,r.id3Track.addCue(S),l[E]=S,r.hls.config.interstitialsController&&("X-ASSET-LIST"!==E&&"X-ASSET-URL"!==E||S.addEventListener("enter",r.onEventCueEnter)))}}}o[e]={cues:l,dateRange:t,durationKnown:u}},m=0;m<s.length;m++)p()}}}}]),e}(),wo=function(){function e(t){var r=this;qm(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 i=r.computeLatency();if(null!==i){r._latency=i;var n=r.config,a=n.lowLatencyMode,s=n.maxLiveSyncPlaybackRate;if(a&&1!==s&&t.live){var o=r.targetLatency;if(null!==o){var l=i-o;if(l<Math.min(r.maxLatency,o+t.targetduration)&&l>.05&&r.forwardBufferLength>1){var u=Math.min(2,Math.max(1,s)),c=Math.round(2/(1+Math.exp(-.75*l-r.edgeStalled))*20)/20;e.playbackRate=Math.min(u,Math.max(1,c))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}}}}},this.hls=t,this.config=t.config,this.registerListeners()}return Xm(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,i=e.targetduration,n=this.config,a=n.liveSyncDuration,s=n.liveSyncDurationCount,o=n.lowLatencyMode,l=this.hls.userConfig,u=o&&r||t;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||0===u)&&(u=void 0!==a?a:s*i);var c=i;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,c)},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 i=r.edge,n=e-t-this.edgeStalled,a=i-r.totalduration,s=i-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(a,n),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(O.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(O.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(O.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(O.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(O.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){this.hls.off(O.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(O.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(O.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(O.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(O.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===M.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}(),_o=function(e){Ym(r,e);var t=Wm(r);function r(e,i){var n;return qm(this,r),(n=t.call(this,e,"level-controller"))._levels=[],n._firstLevel=-1,n._maxAutoLevel=-1,n._startLevel=void 0,n.currentLevel=null,n.currentLevelIndex=-1,n.manualLevelIndex=-1,n.steering=void 0,n.onParsedComplete=void 0,n.steering=i,n._registerListeners(),n}return Xm(r,[{key:"_registerListeners",value:function(){var e=this.hls;e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(O.LEVEL_LOADED,this.onLevelLoaded,this),e.on(O.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(O.FRAG_BUFFERED,this.onFragBuffered,this),e.on(O.ERROR,this.onError,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(O.LEVEL_LOADED,this.onLevelLoaded,this),e.off(O.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(O.FRAG_BUFFERED,this.onFragBuffered,this),e.off(O.ERROR,this.onError,this)}},{key:"destroy",value:function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),Qf(Xf(r.prototype),"destroy",this).call(this)}},{key:"stopLoad",value:function(){var e;ey(e=this._levels).call(e,(function(e){e.loadError=0,e.fragmentError=0})),Qf(Xf(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,i=this,n=this.hls.config.preferManagedMediaSource,a=[],s={},o={},l=!1,u=!1,c=!1;ey(r=t.levels).call(r,(function(e){var t,r,h,d,f,v,g=e.attrs,p=e.audioCodec,m=e.videoCodec;p&&(e.audioCodec=p=de(p,n)||void 0),0===(null==(v=m)?void 0:hy(v).call(v,"avc1"))&&(m=e.videoCodec=function(e){for(var t=e.split(","),r=0;r<t.length;r++){var i=t[r].split(".");if(i.length>2){var n,a=i.shift()+".";a+=Ck(i.shift()).toString(16),a+=uy(n="000"+Ck(i.shift()).toString(16)).call(n,-4),t[r]=a}}return t.join(",")}(m));var y=e.width,E=e.height,k=e.unknownCodecs,T=k?k.length:0;if(k)for(var S=T;S--;){var A,L,b=k[S];i.isAudioSupported(b)?(e.audioCodec=p=p?py(A="".concat(p,",")).call(A,b):b,T--,ne.audio[p.substring(0,4)]=2):i.isVideoSupported(b)&&(e.videoCodec=m=m?py(L="".concat(m,",")).call(L,b):b,T--,ne.video[m.substring(0,4)]=2)}if(l||(l=!(!y||!E)),u||(u=!!m),c||(c=!!p),!(T||p&&!i.isAudioSupported(p)||m&&!i.isVideoSupported(m))){var R=g.CODECS,I=g["FRAME-RATE"],D=g["HDCP-LEVEL"],w=g["PATHWAY-ID"],_=g.RESOLUTION,P=g["VIDEO-RANGE"],C=py(t=py(r=py(h=py(d=py(f="".concat("".concat(w||".","-"),e.bitrate,"-")).call(f,_,"-")).call(d,I,"-")).call(h,R,"-")).call(r,P,"-")).call(t,D);if(s[C])if(s[C].uri===e.url||e.attrs["PATHWAY-ID"])s[C].addGroupId("audio",g.AUDIO),s[C].addGroupId("text",g.SUBTITLES);else{var x=o[C]+=1;e.attrs["PATHWAY-ID"]=new Array(x+1).join(".");var M=new Ie(e);s[C]=M,a.push(M)}else{var O=new Ie(e);s[C]=O,o[C]=1,a.push(O)}}})),this.filterAndSortMediaOptions(a,t,l,u,c)}},{key:"isAudioSupported",value:function(e){return ae(e,"audio",this.hls.config.preferManagedMediaSource)}},{key:"isVideoSupported",value:function(e){return ae(e,"video",this.hls.config.preferManagedMediaSource)}},{key:"filterAndSortMediaOptions",value:function(e,t,r,i,n){var a,s=this,o=[],l=[],u=e;if((r||i)&&n&&(u=Jm(u).call(u,(function(e){var t,r=e.videoCodec,i=e.videoRange,n=e.width,a=e.height;return(!!r||!(!n||!a))&&!!(t=i)&&hy(Te).call(Te,t)>-1}))),0!==u.length){t.audioTracks&&Po(o=Jm(a=t.audioTracks).call(a,(function(e){return!e.audioCodec||s.isAudioSupported(e.audioCodec)}))),t.subtitles&&Po(l=t.subtitles);var c=uy(u).call(u,0);gT(u).call(u,(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 hy(Te).call(Te,e.videoRange)-hy(Te).call(Te,t.videoRange);if(e.videoCodec!==t.videoCodec){var i=le(e.videoCodec),n=le(t.videoCodec);if(i!==n)return n-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){var a=ue(e.codecSet),s=ue(t.codecSet);if(a!==s)return s-a}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));var h=c[0];if(this.steering&&(u=this.steering.filterParsedLevels(u)).length!==c.length)for(var d=0;d<c.length;d++)if(c[d].pathwayId===u[0].pathwayId){h=c[d];break}this._levels=u;for(var f=0;f<u.length;f++)if(u[f]===h){var v,g;this._firstLevel=f;var p=h.bitrate,m=this.hls.bandwidthEstimate;if(this.log(py(v="manifest loaded, ".concat(u.length," level(s) found, first bitrate: ")).call(v,p)),void 0===(null==(g=this.hls.userConfig)?void 0:g.abrEwmaDefaultEstimate)){var y=Math.min(p,this.hls.config.abrEwmaDefaultEstimateMax);y>m&&m===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}var E=n&&!i,k={levels:u,audioTracks:o,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:i,altAudio:!E&&Sy(o).call(o,(function(e){return!!e.url}))};this.hls.trigger(O.MANIFEST_PARSED,k)}else RR.resolve().then((function(){if(s.hls){t.levels.length&&s.warn("One or more CODECS in variant not supported: ".concat(x_(t.levels[0].attrs)));var e=new Error("no level with compatible codecs found in manifest");s.hls.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.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,i,n,a,s,o,l=this._levels;if(0!==l.length){if(e<0||e>=l.length){var u=new Error("invalid level idx"),c=e<0;if(this.hls.trigger(O.ERROR,{type:x.OTHER_ERROR,details:M.LEVEL_SWITCH_ERROR,level:e,fatal:c,error:u,reason:u.message}),c)return;e=Math.min(e,l.length-1)}var h=this.currentLevelIndex,d=this.currentLevel,f=d?d.attrs["PATHWAY-ID"]:void 0,v=l[e],g=v.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=v,h!==e||!d||f!==g){this.log(py(t=py(r=py(i=py(n=py(a=py(s=py(o="Switching to level ".concat(e," (")).call(o,v.height?v.height+"p ":"")).call(s,v.videoRange?v.videoRange+" ":"")).call(a,v.codecSet?v.codecSet+" ":"","@")).call(n,v.bitrate,")")).call(i,g?" with Pathway "+g:""," from level ")).call(r,h)).call(t,f?" with Pathway "+f:""));var p={level:e,attrs:v.attrs,details:v.details,bitrate:v.bitrate,averageBitrate:v.averageBitrate,maxBitrate:v.maxBitrate,realBitrate:v.realBitrate,width:v.width,height:v.height,codecSet:v.codecSet,audioCodec:v.audioCodec,videoCodec:v.videoCodec,audioGroups:v.audioGroups,subtitleGroups:v.subtitleGroups,loaded:v.loaded,loadError:v.loadError,fragmentError:v.fragmentError,name:v.name,id:v.id,uri:v.uri,url:v.url,urlId:0,audioGroupIds:v.audioGroupIds,textGroupIds:v.textGroupIds};this.hls.trigger(O.LEVEL_SWITCHING,p);var m=v.details;if(!m||m.live){var y=this.switchParams(v.uri,null==d?void 0:d.details,m);this.loadPlaylist(y)}}}}},{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(),i=Jm(e).call(e,(function(e){return-1!==hy(r).call(r,e)}));if(e.length<1)return void this.warn(py(t="pathwayPriority ".concat(e," should contain at least one pathway from list: ")).call(t,r));this.steering.pathwayPriority=i}}},{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===G){var i,n=r.elementaryStreams;if(!Sy(i=Qm(n)).call(i,(function(e){return!!n[e]})))return;var a=this._levels[r.level];null!=a&&a.loadError&&(this.log("Resetting level error count of ".concat(a.loadError," on frag buffered")),a.loadError=0)}}},{key:"onLevelLoaded",value:function(e,t){var r,i,n=t.level,a=t.details,s=t.levelInfo;if(!s)return this.warn("Invalid level index ".concat(n)),void(null!=(i=t.deliveryDirectives)&&i.skip&&(a.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(n,t,o)}else null!=(r=t.deliveryDirectives)&&r.skip&&(a.deltaUpdateFailed=!0)}},{key:"loadPlaylist",value:function(e){Qf(Xf(r.prototype),"loadPlaylist",this).call(this),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}},{key:"loadingPlaylist",value:function(e,t){var i,n,a,s;Qf(Xf(r.prototype),"loadingPlaylist",this).call(this,e,t);var o=this.getUrlWithDirectives(e.uri,t),l=this.currentLevelIndex,u=e.attrs["PATHWAY-ID"],c=e.details,h=null==c?void 0:c.age;this.log(py(i=py(n=py(a=py(s="Loading level index ".concat(l)).call(s,void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")).call(a,u?" Pathway "+u:"")).call(n,h&&c.live?" age "+h.toFixed(1)+(c.type&&" "+c.type||""):""," ")).call(i,o)),this.hls.trigger(O.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,i=this;if(1!==this._levels.length){var n=Jm(t=this._levels).call(t,(function(t,r){var n;return r!==e||(i.steering&&i.steering.removeLevel(t),t===i.currentLevel&&(i.currentLevel=null,i.currentLevelIndex=-1,t.details&&ey(n=t.details.fragments).call(n,(function(e){return e.level=-1}))),!1)}));yi(n),this._levels=n,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 a=n.length-1;this._firstLevel=Math.min(this._firstLevel,a),this._startLevel&&(this._startLevel=Math.min(this._startLevel,a)),this.hls.trigger(O.LEVELS_UPDATED,{levels:n})}}},{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,i=e.maxHdcpLevel;this._maxAutoLevel!==r&&(this._maxAutoLevel=r,this.hls.trigger(O.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:r,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}]),r}(pa);function Po(e){var t={};ey(e).call(e,(function(e){var r=e.groupId||"";e.id=t[r]=t[r]||0,t[r]++}))}var Co=function(e){Ym(r,e);var t=Wm(r);function r(e,i,n,a){var s;return qm(this,r),(s=t.call(this,"gap-controller",a.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=i,s.fragmentTracker=n,s.hls=a,s}return Xm(r,[{key:"destroy",value:function(){this.media=null,this.hls=this.fragmentTracker=null}},{key:"poll",value:function(e,t,r,i){var n=this.config,a=this.media,s=this.stalled;if(null!==a){var o=a.currentTime,l=a.seeking,u=this.seeking&&!l,c=!this.seeking&&l;if(this.seeking=l,o===e)if(c||u)this.stalled=null;else{if(a.paused&&!l||a.ended||0===a.playbackRate||!fr.getBuffered(a).length)return!this.ended&&a.ended&&(this.ended=o||1,this.hls.trigger(O.MEDIA_ENDED,{stalled:!1})),void(this.nudgeRetry=0);var h=fr.bufferInfo(a,o,0),d=h.nextStart||0;if(l){var f=h.len>2,v=!d||t&&t.start<=o||d-o>2&&!this.fragmentTracker.getPartialFragment(o);if(f||v)return;this.moved=!1}if(!this.moved&&null!==this.stalled){if(!(h.len>0||d))return;var g=Math.max(d,h.start||0)-o,p=null!=r&&r.live?2*r.targetduration:2,m=this.fragmentTracker.getPartialFragment(o);if(g>0&&(g<=p||m))return void(a.paused||this._trySkipBufferHole(m))}var y=self.performance.now();if(null!==s){var E=y-s;if(!l&&E>=250){if(i===xi&&(null==r||!r.live)&&Math.abs(o-((null==r?void 0:r.edge)||0))<1){if(E<1e3||this.ended)return;return this.ended=o||1,void this.hls.trigger(O.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(h),!this.media)return}var k=fr.bufferInfo(a,o,n.maxBufferHole);this._tryFixBufferStall(k,E)}else this.stalled=y}else if(e&&(this.ended=0),this.moved=!0,l||(this.nudgeRetry=0),null!==s){if(this.stallReported){var T,S=self.performance.now()-s;this.warn(py(T="playback not stuck anymore @".concat(o,", after ")).call(T,Math.round(S),"ms")),this.stallReported=!1}this.stalled=null}}}},{key:"_tryFixBufferStall",value:function(e,t){var r=this.config,i=this.fragmentTracker,n=this.media;if(null!==n){var a=n.currentTime,s=i.getPartialFragment(a);(!s||!this._trySkipBufferHole(s)&&this.media)&&(e.len>r.maxBufferHole||e.nextStart&&e.nextStart-a<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 i;this.stallReported=!0;var n=new Error(py(i="Playback stalling at @".concat(r.currentTime," due to low buffer (")).call(i,x_(e),")"));this.warn(n.message),t.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}},{key:"_trySkipBufferHole",value:function(e){var t=this.config,r=this.hls,i=this.media;if(null===i)return 0;var n=i.currentTime,a=fr.bufferInfo(i,n,0),s=n<a.start?a.start:a.nextStart;if(s){var o=a.len<=t.maxBufferHole,l=a.len>0&&a.len<1&&i.readyState<3,u=s-n;if(u>0&&(o||l)){var c;if(u>t.maxBufferHole){var h=this.fragmentTracker,d=!1;if(0===n){var f=h.getAppendedFrag(0,G);f&&s<f.end&&(d=!0)}if(!d){var v=e||h.getAppendedFrag(n,G);if(v){for(var g=!1,p=v.end;p<s;){var m=h.getPartialFragment(p);if(!m){g=!0;break}p+=m.duration}if(g)return 0}}}var y=Math.max(s+.05,n+.1);if(this.warn(py(c="skipping hole, adjusting currentTime from ".concat(n," to ")).call(c,y)),this.moved=!0,this.stalled=null,i.currentTime=y,e&&!e.gap){var E,k=new Error(py(E="fragment loaded with buffer holes, seeking from ".concat(n," to ")).call(E,y));r.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:k,reason:k.message,frag:e})}return y}}return 0}},{key:"_tryNudgeBuffer",value:function(){var e=this.config,t=this.hls,r=this.media,i=this.nudgeRetry;if(null!==r){var n=r.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){var a,s=n+(i+1)*e.nudgeOffset,o=new Error(py(a="Nudging 'currentTime' from ".concat(n," to ")).call(a,s));this.warn(o.message),r.currentTime=s,t.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{var l,u=new Error(py(l="Playhead still not moving while enough data buffered @".concat(n," after ")).call(l,e.nudgeMaxRetry," nudges"));this.error(u.message),t.trigger(O.ERROR,{type:x.MEDIA_ERROR,details:M.BUFFER_STALLED_ERROR,error:u,fatal:!0})}}}}]),r}(X);function xo(){return self.SourceBuffer||self.WebKitSourceBuffer}function Mo(){if(!re())return!1;var e=xo();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}var Oo=function(e){Ym(r,e);var t=Wm(r);function r(e,i,n){var a;return qm(this,r),(a=t.call(this,e,i,n,"stream-controller",G)).audioCodecSwap=!1,a.gapController=null,a.level=-1,a._forceStartLoad=!1,a._hasEnoughToStart=!1,a.altAudio=0,a.audioOnly=!1,a.fragPlaying=null,a.fragLastKbps=0,a.couldBacktrack=!1,a.backtrackFragment=null,a.audioCodecSwitch=!1,a.videoBuffer=null,a.onMediaPlaying=function(){var e=a.gapController;e&&(e.ended=0),a.tick()},a.onMediaSeeked=function(){var e=a.media,t=e?e.currentTime:null;_(t)&&a.log("Media seeked to ".concat(t.toFixed(3)));var r=a.getMainFwdBufferInfo();null!==r&&0!==r.len?a.tick():a.warn('Main forward buffer length on "seeked" event '.concat(r?r.len:"empty",")"))},a.registerListeners(),a}return Xm(r,[{key:"registerListeners",value:function(){Qf(Xf(r.prototype),"registerListeners",this).call(this);var e=this.hls;e.on(O.MANIFEST_PARSED,this.onManifestParsed,this),e.on(O.LEVEL_LOADING,this.onLevelLoading,this),e.on(O.LEVEL_LOADED,this.onLevelLoaded,this),e.on(O.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(O.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(O.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(O.BUFFER_CREATED,this.onBufferCreated,this),e.on(O.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(O.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(O.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"unregisterListeners",value:function(){Qf(Xf(r.prototype),"unregisterListeners",this).call(this);var e=this.hls;e.off(O.MANIFEST_PARSED,this.onManifestParsed,this),e.off(O.LEVEL_LOADED,this.onLevelLoaded,this),e.off(O.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(O.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(O.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(O.BUFFER_CREATED,this.onBufferCreated,this),e.off(O.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(O.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(O.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"onHandlerDestroying",value:function(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),Qf(Xf(r.prototype),"onHandlerDestroying",this).call(this)}},{key:"startLoad",value:function(e,t){if(this.levels){var r=this.lastCurrentTime,i=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var n=i.startLevel;-1===n&&(i.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=i.firstAutoLevel),i.nextLoadLevel=n,this.level=i.loadLevel,this._hasEnoughToStart=!1}r>0&&-1===e&&!t&&(this.log("Override startPosition with lastCurrentTime @".concat(r.toFixed(3))),e=r),this.state=Ri,this.nextLoadPosition=this.lastCurrentTime=e,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=bi}},{key:"stopLoad",value:function(){this._forceStartLoad=!1,Qf(Xf(r.prototype),"stopLoad",this).call(this)}},{key:"doTick",value:function(){switch(this.state){case Fi:var e=this.levels,t=this.level,r=null==e?void 0:e[t],i=null==r?void 0:r.details;if(i&&(!i.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(i))break;this.state=Ri;break}if(this.hls.nextLoadLevel!==this.level){this.state=Ri;break}break;case wi:var n,a=self.performance.now(),s=this.retryDate;if(!s||a>=s||null!=(n=this.media)&&n.seeking){var o=this.levels,l=this.level,u=null==o?void 0:o[l];this.resetStartWhenNotLoaded(u||null),this.state=Ri}}this.state===Ri&&this.doTickIdle(),this.onTickEnd()}},{key:"onTickEnd",value:function(){Qf(Xf(r.prototype),"onTickEnd",this).call(this),this.checkBuffer(),this.checkFragmentChanged()}},{key:"doTickIdle",value:function(){var e,t=this.hls,r=this.levelLastLoaded,i=this.levels,n=this.media;if(null!==r&&(n||!this.startFragRequested&&t.config.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)){var a=this.buffering?t.nextLoadLevel:t.loadLevel;if(null!=i&&i[a]){var s=i[a],o=this.getMainFwdBufferInfo();if(null!==o){var l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){var u={};return 2===this.altAudio&&(u.type="video"),this.hls.trigger(O.BUFFER_EOS,u),void(this.state=xi)}if(this.buffering){t.loadLevel!==a&&-1===t.manualLevel&&this.log(py(e="Adapting to level ".concat(a," from level ")).call(e,this.level)),this.level=t.nextLoadLevel=a;var c=s.details;if(!c||this.state===Fi||this.waitForLive(s))return this.level=a,this.state=Fi,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,v=this.getNextFragment(f,c);if(this.couldBacktrack&&!this.fragPrevious&&v&&_t(v)&&this.fragmentTracker.getState(v)!==at){var g,p=(null!=(g=this.backtrackFragment)?g:v).sn-c.startSN,m=c.fragments[p-1];m&&v.cc===m.cc&&(v=m,this.fragmentTracker.removeFragment(m))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(v&&this.isLoopLoading(v,f)){if(!v.gap){var y=this.audioOnly&&!this.altAudio?Rt:It,E=(y===It?this.videoBuffer:this.mediaBuffer)||this.media;E&&this.afterBufferFlushed(E,y,G)}v=this.getNextFragmentLoopLoading(v,c,o,G,d)}v&&(!v.initSegment||v.initSegment.data||this.bitrateTest||(v=v.initSegment),this.loadFragment(v,s,f))}}}}}}},{key:"loadFragment",value:function(e,t,i){var n,a=this.fragmentTracker.getState(e);a===rt||a===nt?_t(e)?this.bitrateTest?(this.log(py(n="Fragment ".concat(e.sn," of level ")).call(n,e.level," is being downloaded to test bitrate and will not be buffered")),this._loadBitrateTestFrag(e,t)):Qf(Xf(r.prototype),"loadFragment",this).call(this,e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}},{key:"getBufferedFrag",value:function(e){return this.fragmentTracker.getBufferedFrag(e,G)}},{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,i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);var n=this.getLevelDetails();if(null!=n&&n.live){var a=this.getMainFwdBufferInfo();if(!a||a.len<2*n.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 u=this.followingBufferedFrag(l);if(u){this.abortCurrentFrag();var c=u.maxStartPTS?u.maxStartPTS:u.start,h=u.duration,d=Math.max(l.end,c+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 Ii:case Di:case wi:case Pi:case Ci:this.state=Ri}this.nextLoadPosition=this.getLoadPosition()}},{key:"flushMainBuffer",value:function(e,t){Qf(Xf(r.prototype),"flushMainBuffer",this).call(this,e,t,2===this.altAudio?"video":null)}},{key:"onMediaAttached",value:function(e,t){Qf(Xf(r.prototype),"onMediaAttached",this).call(this,e,t);var i=t.media;i.removeEventListener("playing",this.onMediaPlaying),i.removeEventListener("seeked",this.onMediaSeeked),i.addEventListener("playing",this.onMediaPlaying),i.addEventListener("seeked",this.onMediaSeeked),this.gapController=new Co(this.config,i,this.fragmentTracker,this.hls)}},{key:"onMediaDetaching",value:function(e,t){var i=this.media;i&&(i.removeEventListener("playing",this.onMediaPlaying),i.removeEventListener("seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),Qf(Xf(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(O.MEDIA_ENDED,{stalled:!1})}},{key:"onManifestLoading",value:function(){Qf(Xf(r.prototype),"onManifestLoading",this).call(this),this.log("Trigger BUFFER_RESET"),this.hls.trigger(O.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,i,n,a=!1,s=!1;ey(r=t.levels).call(r,(function(e){var t=e.audioCodec;t&&(a=a||-1!==hy(t).call(t,"mp4a.40.2"),s=s||-1!==hy(t).call(t,"mp4a.40.5"))})),this.audioCodecSwitch=a&&s&&!("function"==typeof(null==(n=xo())||null==(i=n.prototype)?void 0:i.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===Ri){var r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=Fi)}}},{key:"onLevelLoaded",value:function(e,t){var r,i,n,a,s,o,l,u,c=this.levels,h=this.startFragRequested,d=t.level,f=t.details,v=f.totalduration;if(c){this.log(py(r=py(i=py(n=py(a=py(s=py(o="Level ".concat(d," loaded [")).call(o,f.startSN,",")).call(s,f.endSN,"]")).call(a,f.lastPartSn?py(l="[part-".concat(f.lastPartSn,"-")).call(l,f.lastPartIndex,"]"):"",", cc [")).call(n,f.startCC,", ")).call(i,f.endCC,"] duration:")).call(r,v));var g=t.levelInfo,p=this.fragCurrent;!p||this.state!==Di&&this.state!==wi||p.level!==t.level&&p.loader&&this.abortCurrentFrag();var m=0;if(f.live||null!=(u=g.details)&&u.live){var y;if(this.checkLiveUpdate(f),f.deltaUpdateFailed)return;m=this.alignPlaylists(f,g.details,null==(y=this.levelLastLoaded)?void 0:y.details)}if(g.details=f,this.levelLastLoaded=g,h||this.setStartPosition(f,m),this.hls.trigger(O.LEVEL_UPDATED,{details:f,level:d}),this.state===Fi){if(this.waitForCdnTuneIn(f))return;this.state=Ri}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 i=this.hls.liveSyncPosition,n=r.currentTime,a=e.fragmentStart,s=e.edge,o=n>=a-t.maxFragLookUpTolerance&&n<=s;if(null!==i&&r.duration>i&&(n<i||!o)){var l,u,c=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&r.readyState<4||n<s-c)&&(this._hasEnoughToStart||(this.nextLoadPosition=i),r.readyState&&(this.warn(py(l=py(u="Playback: ".concat(n.toFixed(3)," is located too far from the end of live sliding playlist: ")).call(u,s,", reset currentTime to : ")).call(l,i.toFixed(3))),r.currentTime=i))}}}},{key:"_handleFragmentLoadProgress",value:function(e){var t,r,i,n,a,s=e.frag,o=e.part,l=e.payload,u=this.levels;if(u){var c=u[s.level];if(c){var h=c.details;if(!h)return this.warn(py(r="Dropping fragment ".concat(s.sn," of level ")).call(r,s.level," after level details were reset")),void this.fragmentTracker.removeFragment(s);var d=c.videoCodec,f=h.PTSKnown||!h.live,v=null==(a=s.initSegment)?void 0:a.data,g=this._getAudioCodec(c),p=this.transmuxer=this.transmuxer||new da(this.hls,G,pE(i=this._handleTransmuxComplete).call(i,this),pE(n=this._handleTransmuxerFlush).call(n,this)),m=o?o.index:-1,y=-1!==m,E=new hr(s.level,s.sn,s.stats.chunkCount,l.byteLength,m,y),k=this.initPTS[s.cc];p.push(l,v,g,d,s,o,h.totalduration,f,E,k)}else this.warn("Level ".concat(s.level," not found on progress"))}else this.warn(py(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,i=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 n=this.fragCurrent;n&&(this.log("Switching to main audio track, cancel main fragment load"),n.abortRequests(),this.fragmentTracker.removeFragment(n)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();i&&(r.trigger(O.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),r.trigger(O.AUDIO_TRACK_SWITCHED,t)}}},{key:"onAudioTrackSwitched",value:function(e,t){var r=Ne(t.url,this.hls);if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r?2:0,this.tick()}},{key:"onBufferCreated",value:function(e,t){var r,i,n=t.tracks,a=!1;for(var s in n){var o=n[s];if("main"===o.id){if(i=s,r=o,"video"===s){var l=n[s];l&&(this.videoBuffer=l.buffer)}}else a=!0}a&&r?(this.log("Alternate track found, use ".concat(i,".buffered to schedule main fragment loading")),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}},{key:"onFragBuffered",value:function(e,t){var r=t.frag,i=t.part,n=r.type===G;if(n){var a,s,o;if(this.fragContextChanged(r))return this.warn(py(a=py(s=py(o="Fragment ".concat(r.sn)).call(o,i?" p: "+i.index:""," of level ")).call(s,r.level," finished buffering, but was aborted. state: ")).call(a,this.state)),void(this.state===Ci&&(this.state=Ri));var l=i?i.stats:r.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),_t(r)&&(this.fragPrevious=r),this.fragBufferedComplete(r,i)}var u=this.media;u&&(!this._hasEnoughToStart&&u.buffered.length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}},{key:"hasEnoughToStart",get:function(){return this._hasEnoughToStart}},{key:"onError",value:function(e,t){var r;if(t.fatal)this.state=Mi;else switch(t.details){case M.FRAG_GAP:case M.FRAG_PARSING_ERROR:case M.FRAG_DECRYPT_ERROR:case M.FRAG_LOAD_ERROR:case M.FRAG_LOAD_TIMEOUT:case M.KEY_LOAD_ERROR:case M.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(G,t);break;case M.LEVEL_LOAD_ERROR:case M.LEVEL_LOAD_TIMEOUT:case M.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Fi||(null==(r=t.context)?void 0:r.type)!==N||(this.state=Ri);break;case M.BUFFER_APPEND_ERROR:case M.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===M.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case M.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,i=r!==Ri?this.fragCurrent:null,n=this.getLevelDetails();t.poll(this.lastCurrentTime,i,n,r)}this.lastCurrentTime=e.currentTime}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=Ri,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}},{key:"onBufferFlushed",value:function(e,t){var r=t.type;if(r!==Rt||this.audioOnly&&!this.altAudio){var i=(r===It?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,r,G),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 i,n,a;if(e.seeking)return void this.log(py(i="could not seek to ".concat(r,", already seeking at ")).call(i,t));var s=this.getLevelDetails(),o=this.config.timelineOffset;o&&r&&(r+=(null==s?void 0:s.appliedTimelineOffset)||o);var l=fr.getBuffered(e),u=l.length?l.start(0):0,c=u-r,h=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);c>0&&(c<h||this.loadingParts&&c<2*((null==s?void 0:s.partTarget)||0))&&(this.log("adjusting start position by ".concat(c," to match buffer start")),r+=c,this.startPosition=r),t<r&&(this.log(py(n=py(a="seek to target start position ".concat(r," from current time ")).call(a,t," buffer start ")).call(n,u)),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!==hy(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 i=r.hls,n=null==e?void 0:e.frag;if(n&&!r.fragContextChanged(n)){t.fragmentError=0,r.state=Ri,r.startFragRequested=!1,r.bitrateTest=!1;var a=n.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),i.trigger(O.FRAG_LOADED,e),n.bitrateTest=!1}}))}},{key:"_handleTransmuxComplete",value:function(e){var t,r=this.playlistType,i=this.hls,n=e.remuxResult,a=e.chunkMeta,s=this.getCurrentContext(a);if(s){var o=s.frag,l=s.part,u=s.level,c=n.video,h=n.text,d=n.id3,f=n.initSegment,v=u.details,g=this.altAudio?void 0:n.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=Pi,f){if(null!=f&&f.tracks){var p=o.initSegment||o;this._bufferInitSegment(u,f.tracks,p,a),i.trigger(O.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:r,tracks:f.tracks})}var m=f.initPTS,y=f.timescale;_(m)&&(this.initPTS[o.cc]={baseTime:m,timescale:y},i.trigger(O.INIT_PTS_FOUND,{frag:o,id:r,initPTS:m,timescale:y}))}if(c&&v){var E=v.fragments[o.sn-1-v.startSN],k=o.sn===v.startSN,T=!E||o.cc>E.cc;if(!1!==n.independent){var S=c.startPTS,A=c.endPTS,L=c.startDTS,b=c.endDTS;if(l)l.elementaryStreams[c.type]={startPTS:S,endPTS:A,startDTS:L,endDTS:b};else if(c.firstKeyFrame&&c.independent&&1===a.id&&!T&&(this.couldBacktrack=!0),c.dropped&&c.independent){var R=this.getMainFwdBufferInfo(),I=(R?R.end:this.getLoadPosition())+this.config.maxBufferHole,D=c.firstKeyFramePTS?c.firstKeyFramePTS:S;if(!k&&I<D-this.config.maxBufferHole&&!T)return void this.backtrack(o);T&&(o.gap=!0),o.setElementaryStreamInfo(c.type,o.start,A,o.start,b,!0)}else k&&S-(v.appliedTimelineOffset||0)>2&&(o.gap=!0);o.setElementaryStreamInfo(c.type,S,A,L,b),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(c,o,l,a,k||T)}else{if(!k&&!T)return void this.backtrack(o);o.gap=!0}}if(g){var w=g.startPTS,P=g.endPTS,C=g.startDTS,x=g.endDTS;l&&(l.elementaryStreams[Rt]={startPTS:w,endPTS:P,startDTS:C,endDTS:x}),o.setElementaryStreamInfo(Rt,w,P,C,x),this.bufferFragmentData(g,o,l,a)}if(v&&null!=d&&null!=(t=d.samples)&&t.length){var M={id:r,frag:o,details:v,samples:d.samples};i.trigger(O.FRAG_PARSING_METADATA,M)}if(v&&h){var F={id:r,frag:o,details:v,samples:h.samples};i.trigger(O.FRAG_PARSING_USERDATA,F)}}}else this.resetWhenMissingContext(a)}},{key:"_bufferInitSegment",value:function(e,t,r,i){var n,a,s=this;if(this.state===Pi){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var o=t.audio,l=t.video,u=t.audiovideo;if(o){var c,h,d,f,v=fe(o.codec,e.audioCodec);"mp4a"===v&&(v="mp4a.40.5");var g=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){v&&(v=-1!==hy(v).call(v,"mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");var p=o.metadata;p&&"channelCount"in p&&1!==(p.channelCount||1)&&-1===hy(g).call(g,"firefox")&&(v="mp4a.40.5")}v&&-1!==hy(v).call(v,"mp4a.40.5")&&-1!==hy(g).call(g,"android")&&"audio/mpeg"!==o.container&&(v="mp4a.40.2",this.log("Android: force audio codec to ".concat(v))),e.audioCodec&&e.audioCodec!==v&&this.log(py(c='Swapping manifest audio codec "'.concat(e.audioCodec,'" for "')).call(c,v,'"')),o.levelCodec=v,o.id="main",this.log(py(h=py(d=py(f="Init audio buffer, container:".concat(o.container,", codecs[selected/level/parsed]=[")).call(f,v||"","/")).call(d,e.audioCodec||"","/")).call(h,o.codec,"]")),delete t.audiovideo}if(l){var m,y,E;l.levelCodec=e.videoCodec,l.id="main";var k=l.codec;if(4===(null==k?void 0:k.length))switch(k){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(py(m=py(y=py(E="Init video buffer, container:".concat(l.container,", codecs[level/parsed]=[")).call(E,e.videoCodec||"","/")).call(y,k)).call(m,l.codec!==k?" parsed-corrected="+l.codec:"","}]")),delete t.audiovideo}u&&(this.log(py(n=py(a="Init audiovideo buffer, container:".concat(u.container,", codecs[level/parsed]=[")).call(a,e.codecs,"/")).call(n,u.codec,"]")),delete t.video,delete t.audio);var T=Qm(t);if(T.length){if(this.hls.trigger(O.BUFFER_CODECS,t),!this.hls)return;ey(T).call(T,(function(e){var n=t[e].initSegment;null!=n&&n.byteLength&&s.hls.trigger(O.BUFFER_APPENDING,{type:e,data:n,frag:r,part:null,chunkMeta:i,parent:r.type})}))}this.tickImmediate()}}},{key:"getMainFwdBufferInfo",value:function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,G)}},{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=Ri}},{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 i=this.fragPlaying,n=t.level;i&&t.sn===i.sn&&i.level===n||(this.fragPlaying=t,this.hls.trigger(O.FRAG_CHANGED,{frag:t}),i&&i.level===n||this.hls.trigger(O.LEVEL_SWITCHED,{level:n}))}}}},{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 _(t)?this.getAppendedFrag(t):null}},{key:"currentProgramDateTime",get:function(){var e,t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(_(t)){var r=this.getLevelDetails(),i=this.currentFrag||(r?Be(null,r.fragments,t):null);if(i){var n=i.programDateTime;if(null!==n){var a=n+1e3*(t-i.start);return new Date(a)}}}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}(Ni),Fo=function(){function e(t){qm(this,e),this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}return Xm(e,[{key:"abort",value:function(e){for(var t in this.keyUriToKeyInfo){var r=this.keyUriToKeyInfo[t].loader;if(r){var i;if(e&&e!==(null==(i=r.context)?void 0:i.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]:M.KEY_LOAD_ERROR,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;return new ur({type:x.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:r,networkDetails:i})}},{key:"loadClear",value:function(e,t){var r=this;if(this.emeController&&this.config.emeEnabled)for(var i=e.sn,n=e.cc,a=function(){var e=t[s];if(n<=e.cc&&("initSegment"===i||"initSegment"===e.sn||i<e.sn))return r.emeController.selectKeySystemFormat(e).then((function(t){e.setKeyFormat(t)})),"break"},s=0;s<t.length&&"break"!==a();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,i;t&&e.setKeyFormat(t);var n=e.decryptdata;if(!n){var a=new Error(t?"Expected frag.decryptdata to be defined after setting format ".concat(t):"Missing decryption data on fragment in onKeyLoading");return RR.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,a))}var s=n.uri;if(!s)return RR.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,new Error('Invalid key URI: "'.concat(s,'"'))));var o,l=this.keyUriToKeyInfo[s];if(null!=(r=l)&&r.decryptdata.key)return n.key=l.decryptdata.key,RR.resolve({frag:e,keyInfo:l});if(null!=(i=l)&&i.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 n.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:l}}))}switch(l=this.keyUriToKeyInfo[s]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===n.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 RR.reject(this.createKeyLoadError(e,M.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'.concat(n.method,'"'))))}}},{key:"loadKeyEME",value:function(e,t){var r={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var i=this.emeController.loadKey(r);if(i)return(e.keyLoadPromise=i.then((function(t){return e.mediaKeySessionContext=t,r}))).catch((function(t){throw e.keyLoadPromise=null,t}))}return RR.resolve(r)}},{key:"loadKeyHTTP",value:function(e,t){var r=this,i=this.config,n=new i.loader(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new RR((function(a,s){var o={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:function(e,t,i,n){var o=i.frag,l=i.keyInfo,u=i.url;if(!o.decryptdata||l!==r.keyUriToKeyInfo[u])return s(r.createKeyLoadError(o,M.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),n));l.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,l.loader=null,a({frag:o,keyInfo:l})},onError:function(e,i,n,a){var l;r.resetLoader(i),s(r.createKeyLoadError(t,M.KEY_LOAD_ERROR,new Error(py(l="HTTP Error ".concat(e.code," loading key ")).call(l,e.text)),n,z({url:o.url,data:void 0},e)))},onTimeout:function(e,i,n){r.resetLoader(i),s(r.createKeyLoadError(t,M.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),n))},onAbort:function(e,i,n){r.resetLoader(i),s(r.createKeyLoadError(t,M.INTERNAL_ABORTED,new Error("key loading aborted"),n))}};n.load(o,u,c)}))}},{key:"resetLoader",value:function(e){var t=e.frag,r=e.keyInfo,i=e.url,n=r.loader;t.keyLoader===n&&(t.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[i],n&&n.destroy()}}]),e}();function No(e){switch(e.type){case U:return K;case B:return H;default:return G}}function Uo(e,t){var r=e.url;return void 0!==r&&0!==hy(r).call(r,"data:")||(r=t.url),r}var Bo=function(){function e(t){qm(this,e),this.hls=void 0,this.loaders=t_(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=t,this.registerListeners()}return Xm(e,[{key:"startLoad",value:function(e){}},{key:"stopLoad",value:function(){this.destroyInternalLoaders()}},{key:"registerListeners",value:function(){var e=this.hls;e.on(O.MANIFEST_LOADING,this.onManifestLoading,this),e.on(O.LEVEL_LOADING,this.onLevelLoading,this),e.on(O.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(O.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(O.LEVELS_UPDATED,this.onLevelsUpdated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(O.MANIFEST_LOADING,this.onManifestLoading,this),e.off(O.LEVEL_LOADING,this.onLevelLoading,this),e.off(O.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(O.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(O.LEVELS_UPDATED,this.onLevelsUpdated,this)}},{key:"createInternalLoader",value:function(e){var t=this.hls.config,r=t.pLoader,i=t.loader,n=new(r||i)(t);return this.loaders[e.type]=n,n}},{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:F,url:r,deliveryDirectives:null,levelOrTrack:null})}},{key:"onLevelLoading",value:function(e,t){var r=t.id,i=t.level,n=t.pathwayId,a=t.url,s=t.deliveryDirectives,o=t.levelInfo;this.load({id:r,level:i,pathwayId:n,responseType:"text",type:N,url:a,deliveryDirectives:s,levelOrTrack:o})}},{key:"onAudioTrackLoading",value:function(e,t){var r=t.id,i=t.groupId,n=t.url,a=t.deliveryDirectives,s=t.track;this.load({id:r,groupId:i,level:null,responseType:"text",type:U,url:n,deliveryDirectives:a,levelOrTrack:s})}},{key:"onSubtitleTrackLoading",value:function(e,t){var r=t.id,i=t.groupId,n=t.url,a=t.deliveryDirectives,s=t.track;this.load({id:r,groupId:i,level:null,responseType:"text",type:B,url:n,deliveryDirectives:a,levelOrTrack:s})}},{key:"onLevelsUpdated",value:function(e,t){var r=this.loaders[N];if(r){var i,n=r.context;n&&!Sy(i=t.levels).call(i,(function(e){return e===n.levelOrTrack}))&&(r.abort(),delete this.loaders[N])}}},{key:"load",value:function(e){var t,r,i,n=this,a=this.hls.config,s=this.getInternalLoader(e);if(s){var o,l=this.hls.logger,u=s.context;if(u&&u.levelOrTrack===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives))return void(u.url===e.url?l.log("[playlist-loader]: ignore ".concat(e.url," ongoing request")):l.log(py(o="[playlist-loader]: ignore ".concat(e.url," in favor of ")).call(o,u.url)));l.log("[playlist-loader]: aborting previous loader for type: ".concat(e.type)),s.abort()}if(r=e.type===F?a.manifestLoadPolicy.default:W({},a.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),_(null==(t=e.deliveryDirectives)?void 0:t.part)&&(e.type===N&&null!==e.level?i=this.hls.levels[e.level].details:e.type===U&&null!==e.id?i=this.hls.audioTracks[e.id].details:e.type===B&&null!==e.id&&(i=this.hls.subtitleTracks[e.id].details),i)){var c=i.partTarget,h=i.targetduration;if(c&&h){var d=1e3*Math.max(3*c,.8*h);r=W({},r,{maxTimeToFirstByteMs:Math.min(d,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(d,r.maxTimeToFirstByteMs)})}}var f=r.errorRetry||r.timeoutRetry||{},v={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:f.maxNumRetry||0,retryDelay:f.retryDelayMs||0,maxRetryDelay:f.maxRetryDelayMs||0},g={onSuccess:function(e,t,r,i){var a=n.getInternalLoader(r);n.resetInternalLoader(r.type);var s=e.data;0===hy(s).call(s,"#EXTM3U")?(t.parsing.start=performance.now(),ei.isMediaPlaylist(s)||r.type!==F?n.handleTrackOrLevelPlaylist(e,t,r,i||null,a):n.handleMasterPlaylist(e,t,r,i)):n.handleManifestParsingError(e,r,new Error("no EXTM3U delimiter"),i||null,t)},onError:function(e,t,r,i){n.handleNetworkError(t,r,!1,e,i)},onTimeout:function(e,t,r){n.handleNetworkError(t,r,!0,void 0,e)}};s.load(e,v,g)}},{key:"checkAutostartLoad",value:function(){var e;if(this.hls){var t=this.hls,r=t.config,i=r.autoStartLoad,n=r.startPosition,a=t.forceStartLoad;(i||a)&&(this.hls.logger.log(py(e="".concat(i?"auto":"force"," startLoad with configured startPosition ")).call(e,n)),this.hls.startLoad(n))}}},{key:"handleMasterPlaylist",value:function(e,t,r,i){var n=this.hls,a=e.data,s=Uo(e,r),o=ei.parseMasterPlaylist(a,s);if(o.playlistParsingError)this.handleManifestParsingError(e,r,o.playlistParsingError,i,t);else{var l=o.contentSteering,u=o.levels,c=o.sessionData,h=o.sessionKeys,d=o.startTimeOffset,f=o.variableList;this.variableList=f;var v=ei.parseMasterPlaylistMedia(a,s,o),g=v.AUDIO,p=void 0===g?[]:g,m=v.SUBTITLES,y=v["CLOSED-CAPTIONS"];p.length&&(Sy(p).call(p,(function(e){return!e.url}))||!u[0].audioCodec||u[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Tr({}),bitrate:0,url:""}))),n.trigger(O.MANIFEST_LOADED,{levels:u,audioTracks:p,subtitles:m,captions:y,contentSteering:l,url:s,stats:t,networkDetails:i,sessionData:c,sessionKeys:h,startTimeOffset:d,variableList:f})}}},{key:"handleTrackOrLevelPlaylist",value:function(e,t,r,i,n){var a=this.hls,s=r.id,o=r.level,l=r.type,u=Uo(e,r),c=_(o)?o:_(s)?s:0,h=No(r),d=ei.parseLevelPlaylist(e.data,u,c,h,0,this.variableList);if(l===F){var f={attrs:new Tr({}),bitrate:0,details:d,name:"",url:u};d.requestScheduled=t.loading.start+gi(d,0),a.trigger(O.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:u,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),r.levelDetails=d,this.handlePlaylistLoaded(d,e,t,r,i,n)}},{key:"handleManifestParsingError",value:function(e,t,r,i,n){this.hls.trigger(O.ERROR,{type:x.NETWORK_ERROR,details:M.MANIFEST_PARSING_ERROR,fatal:t.type===F,url:e.url,err:r,error:r,reason:r.message,response:e,context:t,networkDetails:i,stats:n})}},{key:"handleNetworkError",value:function(e,t){var r,i,n,a=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=py(r="A network ".concat(a?"timeout":"error"+(s?" (status "+s.code+")":"")," occurred while loading ")).call(r,e.type);e.type===N?l+=py(i=": ".concat(e.level," id: ")).call(i,e.id):e.type!==U&&e.type!==B||(l+=py(n=" id: ".concat(e.id,' group-id: "')).call(n,e.groupId,'"'));var u=new Error(l);this.hls.logger.warn("[playlist-loader]: ".concat(l));var c=M.UNKNOWN,h=!1,d=this.getInternalLoader(e);switch(e.type){case F:c=a?M.MANIFEST_LOAD_TIMEOUT:M.MANIFEST_LOAD_ERROR,h=!0;break;case N:c=a?M.LEVEL_LOAD_TIMEOUT:M.LEVEL_LOAD_ERROR,h=!1;break;case U:c=a?M.AUDIO_TRACK_LOAD_TIMEOUT:M.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case B:c=a?M.SUBTITLE_TRACK_LOAD_TIMEOUT:M.SUBTITLE_LOAD_ERROR,h=!1}d&&this.resetInternalLoader(e.type);var f={type:x.NETWORK_ERROR,details:c,fatal:h,url:e.url,loader:d,context:e,error:u,networkDetails:t,stats:o};if(s){var v=(null==t?void 0:t.url)||e.url;f.response=z({url:v,data:void 0},s)}this.hls.trigger(O.ERROR,f)}},{key:"handlePlaylistLoaded",value:function(e,t,r,i,n,a){var s=this.hls,o=i.type,l=i.level,u=i.id,c=i.groupId,h=i.deliveryDirectives,d=Uo(t,i),f=No(i),v="number"==typeof i.level&&f===G?l:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var g=e.playlistParsingError;if(g)s.trigger(O.ERROR,{type:x.NETWORK_ERROR,details:M.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:g,reason:g.message,response:t,context:i,level:v,parent:f,networkDetails:n,stats:r});else switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),a.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),o){case F:case N:s.trigger(O.LEVEL_LOADED,{details:e,levelInfo:i.levelOrTrack||s.levels[0],level:v||0,id:u||0,stats:r,networkDetails:n,deliveryDirectives:h,withoutMultiVariant:o===F});break;case U:s.trigger(O.AUDIO_TRACK_LOADED,{details:e,track:i.levelOrTrack,id:u||0,groupId:c||"",stats:r,networkDetails:n,deliveryDirectives:h});break;case B:s.trigger(O.SUBTITLE_TRACK_LOADED,{details:e,track:i.levelOrTrack,id:u||0,groupId:c||"",stats:r,networkDetails:n,deliveryDirectives:h})}}else{var p=e.playlistParsingError=new Error("No Segments found in Playlist");s.trigger(O.ERROR,{type:x.NETWORK_ERROR,details:M.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:i,level:v,parent:f,networkDetails:n,stats:r})}}}]),e}(),Go=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};qm(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 Gi,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 i=J();if("object"==("undefined"==typeof console?"undefined":qh(console))&&!0===e||"object"==qh(e)){var n=["debug","log","info","warn","error"];ey(n).call(n,(function(t){i[t]=Z(t,e,r)}));try{i.log('Debug logs enabled for "'.concat(t,'" in hls.js version 1.6.0-beta.2'))}catch(a){return J()}ey(n).call(n,(function(t){ee[t]=Z(t,e)}))}else W(ee,i);return i}(t.debug||!1,"Hls instance",t.assetPlayerId),i=this.config=function(e,t,r,i){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 n=Ao(e),a=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return ey(i=["manifest","level","frag"]).call(i,(function(e){var i,s,o="".concat("level"===e?"playlist":e,"LoadPolicy"),l=void 0===t[o],u=[];ey(a).call(a,(function(r){var i,a=py(i="".concat(e,"Loading")).call(i,r),s=t[a];if(void 0!==s&&l){u.push(a);var c=n[o].default;switch(t[o]={default:c},r){case"TimeOut":c.maxLoadTimeMs=s,c.maxTimeToFirstByteMs=s;break;case"MaxRetry":c.errorRetry.maxNumRetry=s,c.timeoutRetry.maxNumRetry=s;break;case"RetryDelay":c.errorRetry.retryDelayMs=s,c.timeoutRetry.retryDelayMs=s;break;case"MaxRetryTimeout":c.errorRetry.maxRetryDelayMs=s,c.timeoutRetry.maxRetryDelayMs=s}}})),u.length&&r.warn(py(i=py(s='hls.js config: "'.concat(u.join('", "'),'" setting(s) are deprecated, use "')).call(s,o,'": ')).call(i,x_(t[o])))})),z(z({},n),t)}(e.DefaultConfig,t,r);this.userConfig=t,i.progressive&&Lo(i,r);var n=i.abrController,a=i.bufferController,s=i.capLevelController,o=i.errorController,l=i.fpsController,u=new o(this),c=this.abrController=new n(this),h=new st(this),d=i.interstitialsController,f=d?this.interstitialsController=new d(this,e):null,v=this.bufferController=new a(this,h),g=this.capLevelController=new s(this),p=new l(this),m=new Bo(this),y=i.contentSteeringController,E=y?new y(this):null,k=this.levelController=new _o(this,E),T=new Do(this),S=new Fo(this.config),A=this.streamController=new Oo(this,h,S);g.setStreamController(A),p.setStreamController(A);var L=[m,k,A];f&&UE(L).call(L,1,0,f),E&&UE(L).call(L,1,0,E),this.networkControllers=L;var b=[c,v,g,p,T,h];this.audioTrackController=this.createController(i.audioTrackController,L);var R=i.audioStreamController;R&&L.push(new R(this,h,S)),this.subtitleTrackController=this.createController(i.subtitleTrackController,L);var I=i.subtitleStreamController;I&&L.push(new I(this,h,S)),this.createController(i.timelineController,b),S.emeController=this.emeController=this.createController(i.emeController,b),this.cmcdController=this.createController(i.cmcdController,b),this.latencyController=this.createController(wo,b),this.coreComponents=b,L.push(u);var D=u.onErrorOut;"function"==typeof D&&this.on(O.ERROR,D,u),this.on(O.MANIFEST_LOADED,m.onManifestLoaded,m)}return Xm(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,i=arguments.length>3?arguments[3]:void 0;this._emitter.off(e,t,r,i)}},{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(i){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;var r=e===O.ERROR;this.trigger(O.ERROR,{type:x.OTHER_ERROR,details:M.INTERNAL_EXCEPTION,fatal:r,event:e,error:i}),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(O.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,ey(e=this.networkControllers).call(e,(function(e){return e.destroy()})),this.networkControllers.length=0,ey(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(O.ERROR,{type:x.OTHER_ERROR,details:M.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,i=r?e.media:e,n=r?e:{media:i};this._media=i,this.trigger(O.MEDIA_ATTACHING,n)}}},{key:"detachMedia",value:function(){this.logger.log("detachMedia"),this.trigger(O.MEDIA_DETACHING,{}),this._media=null}},{key:"transferMedia",value:function(){this._media=null;var e=this.bufferController.transferMedia();return this.trigger(O.MEDIA_DETACHING,{transferMedia:e}),e}},{key:"loadSource",value:function(e){this.stopLoad();var t=this.media,r=this._url,i=this._url=Lt.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:".concat(i)),t&&r&&(r!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(O.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"),ey(e=this.networkControllers).call(e,(function(e){e.resumeBuffering&&e.resumeBuffering()})))}},{key:"pauseBuffering",value:function(){var e;this.bufferingEnabled&&(this.logger.log("pause buffering"),ey(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(i){try{var e=e_.createObjectURL(new Blob),t=e.toString();return e_.revokeObjectURL(e),uy(t).call(t,p_(t).call(t,"/")+1)}catch(n){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,hy(ke).call(ke,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,i=0;i<r;i++)if(e[i].maxBitrate>=t)return i;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,r=this.autoLevelCapping,i=this.maxHdcpLevel;if(e=-1===r&&null!=t&&t.length?t.length-1:r,i)for(var n=e;n--;){var a=t[n].attrs["HDCP-LEVEL"];if(a&&a<=i)return n}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 Ee(e,Pe(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.allAudioTracks),navigator.mediaCapabilities)}}],[{key:"version",get:function(){return Ki}},{key:"isMSESupported",value:function(){return Mo()}},{key:"isSupported",value:function(){return function(e,t){if(!Mo())return!1;var r=re();return"function"==typeof(null==r?void 0:r.isTypeSupported)&&(Sy(e=["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"]).call(e,(function(e){return r.isTypeSupported(oe(e,"video"))}))||Sy(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 O}},{key:"MetadataSchema",get:function(){return dn}},{key:"ErrorTypes",get:function(){return x}},{key:"ErrorDetails",get:function(){return M}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:So},set:function(t){e.defaultConfig=t}}]),e}();Go.defaultConfig=void 0;var Ko={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=Go,e.default=function(e){Ym(r,e);var t=Wm(r);function r(e){var i;qm(this,r),(i=t.call(this,e))._tickInterval=500,i._onPlay=function(){i.hls.startLoad()},i._getBufferend=function(e){var t=e.buffered;return t&&t.length?t.end(t.length-1):0},i._tick=function(){clearTimeout(i._tickTimer);var e=i.player.media;if(e){i._tickTimer=mE(i._tick,i._tickInterval);var t=i._getBufferend(e);t<.1||!e.readyState||i.player.config.isLive&&4===e.readyState&&e.paused&&t-e.currentTime>i.config.disconnectTime&&i.hls.stopLoad()}},i.on=function(e,t){var r;null==(r=i.hls)||r.on(e,t)};var n=e.config||{};return i.config=n,i.player.handleSource=!1,i}return Xm(r,[{key:"beforePlayerInit",value:function(){this.register(this.player.config.url)}},{key:"initEvt",value:function(){var e=this;this.hls.on(Go.Events.SUBTITLE_FRAG_PROCESSED,(function(t,r){var i=r.frag;e.player.emit("core_event",{eventName:"core.subtitlesegments",list:i})})),this.hls.on(Go.Events.MANIFEST_PARSED,(function(t,r){var i=r.levels;e.player.emit("core_event",{eventName:"core.subtitleplaylist",list:i})})),this.hls.on(Go.Events.MANIFEST_LOADING,(function(t,r){var i=r.url;e.player.emit("core_event",{eventName:"core.loadstart",url:i})})),this.hls.on(Go.Events.LEVEL_LOADING,(function(t,r){var i=r.url;e.player.emit("core_event",{eventName:"core.loadstart",url:i})})),this.hls.on(Go.Events.FRAG_LOADING,(function(t,r){var i=r.frag;e.player.emit("core_event",{eventName:"core.loadstart",url:i.url})})),this.hls.on(Go.Events.MANIFEST_LOADED,(function(t,r){var i=r.url;e.player.emit("core_event",{eventName:"core.loadcomplete",url:i})})),this.hls.on(Go.Events.LEVEL_LOADED,(function(t,r){var i=r.details,n=r.stats;e.player.emit("core_event",Zh(Zh({eventName:"core.loadcomplete"},n),{},{url:null==i?void 0:i.url}))})),this.hls.on(Go.Events.FRAG_LOADED,(function(t,r){var i=r.frag;e.player.emit("core_event",{eventName:"core.loadcomplete",url:i.url})})),this.hls.on(Go.Events.FRAG_PARSING_USERDATA,(function(t,r){var i=r.samples;e.player.emit("core_event",{eventName:"core.sei",list:i})})),this.hls.on(Go.Events.MANIFEST_LOADED,(function(t,r){var i=r.levels,n=r.networkDetails;e.player.emit("core_event",{eventName:"core.hlsmanifestloaded",playlist:i}),e.player.emit("core_event",{eventName:"core.loadresponseheaders",headers:n.headers})})),this.hls.on(Go.Events.LEVEL_LOADED,(function(t,r){var i,n=r.details,a={};ey(i=Qm(n.dateRanges)).call(i,(function(e){a[e]=n.dateRanges[e].attr["START-DATE"]})),e.player.emit("core_event",{eventName:"core.hlslevelloaded",playlist:Zh(Zh({},n),{},{segments:n.fragments,dateRanges:a})})})),this.hls.on(Go.Events.ERROR,(function(t,r){var i=r.details,n=r.fatal,a=r.type,s=r.response,o=r.reason;if(n){if(a===Go.ErrorTypes.NETWORK_ERROR){var l=2100;zx(i).call(i,"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:i,originError:r})}else e.player.emit("error",{errorType:a,errorMessage:o||i,originError:r});try{e.hls.stopLoad(),e.player.pause()}catch(u){}}})),this.hls.on(Go.Events.MEDIA_ATTACHED,(function(){e.player.emit("sourceopen")})),this.hls.on(Go.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{w.defineGetterOrSetter(this.player,{url:{get:function(){try{return t.src}catch(e){return null}},configurable:!0}})}catch(r){}}},{key:"register",value:function(e){var t=this.player;this.hls&&this.hls.destroy();var r=function(e,t,r){var i=Zh({progressive:!0},e);ey(r=Qm(Ko)).call(r,(function(t){var r=Ko[t];i[t]=e[r.key]||r.val}));var n=e.retryCount||3,a=e.retryDelay||1e3,s=e.loadTimeout||1e4,o=e.manifestLoadTimeout||1e4,l={maxNumRetry:n,retryDelayMs:a},u={maxNumRetry:n,retryDelayMs:a};return i.manifestLoadPolicy={default:{maxLoadTimeMs:o,timeoutRetry:l,errorRetry:u}},i.playlistLoadPolicy={default:{maxLoadTimeMs:s,timeoutRetry:l,errorRetry:u}},i.fragLoadPolicy={default:{maxLoadTimeMs:s,timeoutRetry:l,errorRetry:u}},i.fetchSetup=function(r,i){var n;if(ey(n=Qm(e.fetchOptions||{})).call(n,(function(t){i[t]=e.fetchOptions[t]})),t.preProcessUrl){var a=t.preProcessUrl(r.url).url;r.url=a}return new Request(r.url,i)},i}(this.config,t.config);this.hls=new Go(r),this.initEvt(),this.hls.loadSource(e);var i=this.player.media;this.hls.attachMedia(i),clearTimeout(this._tickTimer),this._tickTimer=mE(this._tick,this._tickInterval),i.removeEventListener("play",this._onPlay),i.addEventListener("play",this._onPlay)}},{key:"destroy",value:function(){clearTimeout(this._tickTimer),this.hls.destroy()}}],[{key:"pluginName",get:function(){return"hls"}}]),r}(w),ry(e,$h({__esModule:{value:!0}},_M,{value:"Module"}))})(PM.exports);var CM=r(PM.exports),xM=window.VePlayer.DynamicModule;VePlayer.registerPlugin(xM.PluginHlsJs,{HlsPlugin:CM}),e.HlsPlugin=CM}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).__VEPLAYER_PLUGIN_HLSJS__={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var i=function e(){if(this instanceof e){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(t,i))}return t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),i}var r=function(e){return e&&e.Math==Math&&e},a=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||t||Function("return this")(),s=function(e){try{return!!e()}catch(t){return!0}},o=!s((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),l=o,u=Function.prototype,c=u.apply,h=u.call,d="object"==typeof Reflect&&Reflect.apply||(l?h.bind(c):function(){return h.apply(c,arguments)}),f=o,v=Function.prototype,g=v.call,p=f&&v.bind.bind(g,g),m=f?p:function(e){return function(){return g.apply(e,arguments)}},y=m,k=y({}.toString),T=y("".slice),E=function(e){return T(k(e),8,-1)},S=E,_=m,b=function(e){if("Function"===S(e))return _(e)},A="object"==typeof document&&document.all,R={all:A,IS_HTMLDDA:void 0===A&&void 0!==A},L=R.all,I=R.IS_HTMLDDA?function(e){return"function"==typeof e||e===L}:function(e){return"function"==typeof e},C={},w=!s((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),D=o,x=Function.prototype.call,P=D?x.bind(x):function(){return x.apply(x,arguments)},O={},M={}.propertyIsEnumerable,N=Object.getOwnPropertyDescriptor,F=N&&!M.call({1:2},1);O.f=F?function(e){var t=N(this,e);return!!t&&t.enumerable}:M;var U,B,H=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},G=s,V=E,K=Object,W=m("".split),j=G((function(){return!K("z").propertyIsEnumerable(0)}))?function(e){return"String"==V(e)?W(e,""):K(e)}:K,Y=function(e){return null==e},z=Y,q=TypeError,X=function(e){if(z(e))throw q("Can't call method on "+e);return e},Q=j,$=X,Z=function(e){return Q($(e))},J=I,ee=R.all,te=R.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:J(e)||e===ee}:function(e){return"object"==typeof e?null!==e:J(e)},ie={},ne=ie,re=a,ae=I,se=function(e){return ae(e)?e:void 0},oe=function(e,t){return arguments.length<2?se(ne[e])||se(re[e]):ne[e]&&ne[e][t]||re[e]&&re[e][t]},le=m({}.isPrototypeOf),ue="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ce=a,he=ue,de=ce.process,fe=ce.Deno,ve=de&&de.versions||fe&&fe.version,ge=ve&&ve.v8;ge&&(B=(U=ge.split("."))[0]>0&&U[0]<4?1:+(U[0]+U[1])),!B&&he&&(!(U=he.match(/Edge\/(\d+)/))||U[1]>=74)&&(U=he.match(/Chrome\/(\d+)/))&&(B=+U[1]);var pe=B,me=pe,ye=s,ke=a.String,Te=!!Object.getOwnPropertySymbols&&!ye((function(){var e=Symbol();return!ke(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&me&&me<41})),Ee=Te&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Se=oe,_e=I,be=le,Ae=Object,Re=Ee?function(e){return"symbol"==typeof e}:function(e){var t=Se("Symbol");return _e(t)&&be(t.prototype,Ae(e))},Le=String,Ie=function(e){try{return Le(e)}catch(t){return"Object"}},Ce=I,we=Ie,De=TypeError,xe=function(e){if(Ce(e))return e;throw De(we(e)+" is not a function")},Pe=xe,Oe=Y,Me=function(e,t){var i=e[t];return Oe(i)?void 0:Pe(i)},Ne=P,Fe=I,Ue=te,Be=TypeError,He={exports:{}},Ge=a,Ve=Object.defineProperty,Ke=function(e,t){try{Ve(Ge,e,{value:t,configurable:!0,writable:!0})}catch(i){Ge[e]=t}return t},We="__core-js_shared__",je=a[We]||Ke(We,{}),Ye=je;(He.exports=function(e,t){return Ye[e]||(Ye[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 ze=He.exports,qe=X,Xe=Object,Qe=function(e){return Xe(qe(e))},$e=Qe,Ze=m({}.hasOwnProperty),Je=Object.hasOwn||function(e,t){return Ze($e(e),t)},et=m,tt=0,it=Math.random(),nt=et(1..toString),rt=function(e){return"Symbol("+(void 0===e?"":e)+")_"+nt(++tt+it,36)},at=ze,st=Je,ot=rt,lt=Te,ut=Ee,ct=a.Symbol,ht=at("wks"),dt=ut?ct.for||ct:ct&&ct.withoutSetter||ot,ft=function(e){return st(ht,e)||(ht[e]=lt&&st(ct,e)?ct[e]:dt("Symbol."+e)),ht[e]},vt=P,gt=te,pt=Re,mt=Me,yt=function(e,t){var i,n;if("string"===t&&Fe(i=e.toString)&&!Ue(n=Ne(i,e)))return n;if(Fe(i=e.valueOf)&&!Ue(n=Ne(i,e)))return n;if("string"!==t&&Fe(i=e.toString)&&!Ue(n=Ne(i,e)))return n;throw Be("Can't convert object to primitive value")},kt=TypeError,Tt=ft("toPrimitive"),Et=function(e,t){if(!gt(e)||pt(e))return e;var i,n=mt(e,Tt);if(n){if(void 0===t&&(t="default"),i=vt(n,e,t),!gt(i)||pt(i))return i;throw kt("Can't convert object to primitive value")}return void 0===t&&(t="number"),yt(e,t)},St=Re,_t=function(e){var t=Et(e,"string");return St(t)?t:t+""},bt=te,At=a.document,Rt=bt(At)&&bt(At.createElement),Lt=function(e){return Rt?At.createElement(e):{}},It=Lt,Ct=!w&&!s((function(){return 7!=Object.defineProperty(It("div"),"a",{get:function(){return 7}}).a})),wt=w,Dt=P,xt=O,Pt=H,Ot=Z,Mt=_t,Nt=Je,Ft=Ct,Ut=Object.getOwnPropertyDescriptor;C.f=wt?Ut:function(e,t){if(e=Ot(e),t=Mt(t),Ft)try{return Ut(e,t)}catch(i){}if(Nt(e,t))return Pt(!Dt(xt.f,e,t),e[t])};var Bt=s,Ht=I,Gt=/#|\.prototype\./,Vt=function(e,t){var i=Wt[Kt(e)];return i==Yt||i!=jt&&(Ht(t)?Bt(t):!!t)},Kt=Vt.normalize=function(e){return String(e).replace(Gt,".").toLowerCase()},Wt=Vt.data={},jt=Vt.NATIVE="N",Yt=Vt.POLYFILL="P",zt=Vt,qt=xe,Xt=o,Qt=b(b.bind),$t=function(e,t){return qt(e),void 0===t?e:Xt?Qt(e,t):function(){return e.apply(t,arguments)}},Zt={},Jt=w&&s((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ei=te,ti=String,ii=TypeError,ni=function(e){if(ei(e))return e;throw ii(ti(e)+" is not an object")},ri=w,ai=Ct,si=Jt,oi=ni,li=_t,ui=TypeError,ci=Object.defineProperty,hi=Object.getOwnPropertyDescriptor,di="enumerable",fi="configurable",vi="writable";Zt.f=ri?si?function(e,t,i){if(oi(e),t=li(t),oi(i),"function"==typeof e&&"prototype"===t&&"value"in i&&vi in i&&!i[vi]){var n=hi(e,t);n&&n[vi]&&(e[t]=i.value,i={configurable:fi in i?i[fi]:n[fi],enumerable:di in i?i[di]:n[di],writable:!1})}return ci(e,t,i)}:ci:function(e,t,i){if(oi(e),t=li(t),oi(i),ai)try{return ci(e,t,i)}catch(n){}if("get"in i||"set"in i)throw ui("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var gi=Zt,pi=H,mi=w?function(e,t,i){return gi.f(e,t,pi(1,i))}:function(e,t,i){return e[t]=i,e},yi=a,ki=d,Ti=b,Ei=I,Si=C.f,_i=zt,bi=ie,Ai=$t,Ri=mi,Li=Je,Ii=function(e){var t=function(i,n,r){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(i);case 2:return new e(i,n)}return new e(i,n,r)}return ki(e,this,arguments)};return t.prototype=e.prototype,t},Ci=function(e,t){var i,n,r,a,s,o,l,u,c,h=e.target,d=e.global,f=e.stat,v=e.proto,g=d?yi:f?yi[h]:(yi[h]||{}).prototype,p=d?bi:bi[h]||Ri(bi,h,{})[h],m=p.prototype;for(a in t)n=!(i=_i(d?a:h+(f?".":"#")+a,e.forced))&&g&&Li(g,a),o=p[a],n&&(l=e.dontCallGetSet?(c=Si(g,a))&&c.value:g[a]),s=n&&l?l:t[a],n&&typeof o==typeof s||(u=e.bind&&n?Ai(s,yi):e.wrap&&n?Ii(s):v&&Ei(s)?Ti(s):s,(e.sham||s&&s.sham||o&&o.sham)&&Ri(u,"sham",!0),Ri(p,a,u),v&&(Li(bi,r=h+"Prototype")||Ri(bi,r,{}),Ri(bi[r],a,s),e.real&&m&&(i||!m[a])&&Ri(m,a,s)))},wi=Math.ceil,Di=Math.floor,xi=Math.trunc||function(e){var t=+e;return(t>0?Di:wi)(t)},Pi=function(e){var t=+e;return t!=t||0===t?0:xi(t)},Oi=Pi,Mi=Math.max,Ni=Math.min,Fi=function(e,t){var i=Oi(e);return i<0?Mi(i+t,0):Ni(i,t)},Ui=Pi,Bi=Math.min,Hi=function(e){return e>0?Bi(Ui(e),9007199254740991):0},Gi=Hi,Vi=function(e){return Gi(e.length)},Ki=Z,Wi=Fi,ji=Vi,Yi=function(e){return function(t,i,n){var r,a=Ki(t),s=ji(a),o=Wi(n,s);if(e&&i!=i){for(;s>o;)if((r=a[o++])!=r)return!0}else for(;s>o;o++)if((e||o in a)&&a[o]===i)return e||o||0;return!e&&-1}},zi={includes:Yi(!0),indexOf:Yi(!1)},qi={},Xi=Je,Qi=Z,$i=zi.indexOf,Zi=qi,Ji=m([].push),en=function(e,t){var i,n=Qi(e),r=0,a=[];for(i in n)!Xi(Zi,i)&&Xi(n,i)&&Ji(a,i);for(;t.length>r;)Xi(n,i=t[r++])&&(~$i(a,i)||Ji(a,i));return a},tn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],nn=en,rn=tn,an=Object.keys||function(e){return nn(e,rn)},sn=Qe,on=an;Ci({target:"Object",stat:!0,forced:s((function(){on(1)}))},{keys:function(e){return on(sn(e))}});var ln=ie.Object.keys,un=i(ln),cn={};cn[ft("toStringTag")]="z";var hn="[object z]"===String(cn),dn=hn,fn=I,vn=E,gn=ft("toStringTag"),pn=Object,mn="Arguments"==vn(function(){return arguments}()),yn=dn?vn:function(e){var t,i,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(i){}}(t=pn(e),gn))?i:mn?vn(t):"Object"==(n=vn(t))&&fn(t.callee)?"Arguments":n},kn=yn,Tn=String,En=function(e){if("Symbol"===kn(e))throw TypeError("Cannot convert a Symbol value to a string");return Tn(e)},Sn={},_n=w,bn=Jt,An=Zt,Rn=ni,Ln=Z,In=an;Sn.f=_n&&!bn?Object.defineProperties:function(e,t){Rn(e);for(var i,n=Ln(t),r=In(t),a=r.length,s=0;a>s;)An.f(e,i=r[s++],n[i]);return e};var Cn,wn=oe("document","documentElement"),Dn=rt,xn=ze("keys"),Pn=function(e){return xn[e]||(xn[e]=Dn(e))},On=ni,Mn=Sn,Nn=tn,Fn=qi,Un=wn,Bn=Lt,Hn="prototype",Gn="script",Vn=Pn("IE_PROTO"),Kn=function(){},Wn=function(e){return"<"+Gn+">"+e+"</"+Gn+">"},jn=function(e){e.write(Wn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Yn=function(){try{Cn=new ActiveXObject("htmlfile")}catch(r){}var e,t,i;Yn="undefined"!=typeof document?document.domain&&Cn?jn(Cn):(t=Bn("iframe"),i="java"+Gn+":",t.style.display="none",Un.appendChild(t),t.src=String(i),(e=t.contentWindow.document).open(),e.write(Wn("document.F=Object")),e.close(),e.F):jn(Cn);for(var n=Nn.length;n--;)delete Yn[Hn][Nn[n]];return Yn()};Fn[Vn]=!0;var zn=Object.create||function(e,t){var i;return null!==e?(Kn[Hn]=On(e),i=new Kn,Kn[Hn]=null,i[Vn]=e):i=Yn(),void 0===t?i:Mn.f(i,t)},qn={},Xn=en,Qn=tn.concat("length","prototype");qn.f=Object.getOwnPropertyNames||function(e){return Xn(e,Qn)};var $n={},Zn=_t,Jn=Zt,er=H,tr=function(e,t,i){var n=Zn(t);n in e?Jn.f(e,n,er(0,i)):e[n]=i},ir=Fi,nr=Vi,rr=tr,ar=Array,sr=Math.max,or=function(e,t,i){for(var n=nr(e),r=ir(t,n),a=ir(void 0===i?n:i,n),s=ar(sr(a-r,0)),o=0;r<a;r++,o++)rr(s,o,e[r]);return s.length=o,s},lr=E,ur=Z,cr=qn.f,hr=or,dr="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];$n.f=function(e){return dr&&"Window"==lr(e)?function(e){try{return cr(e)}catch(t){return hr(dr)}}(e):cr(ur(e))};var fr={};fr.f=Object.getOwnPropertySymbols;var vr=mi,gr=function(e,t,i,n){return n&&n.enumerable?e[t]=i:vr(e,t,i),e},pr=Zt,mr=function(e,t,i){return pr.f(e,t,i)},yr={},kr=ft;yr.f=kr;var Tr,Er,Sr,_r=ie,br=Je,Ar=yr,Rr=Zt.f,Lr=function(e){var t=_r.Symbol||(_r.Symbol={});br(t,e)||Rr(t,e,{value:Ar.f(e)})},Ir=P,Cr=oe,wr=ft,Dr=gr,xr=function(){var e=Cr("Symbol"),t=e&&e.prototype,i=t&&t.valueOf,n=wr("toPrimitive");t&&!t[n]&&Dr(t,n,(function(e){return Ir(i,this)}),{arity:1})},Pr=yn,Or=hn?{}.toString:function(){return"[object "+Pr(this)+"]"},Mr=hn,Nr=Zt.f,Fr=mi,Ur=Je,Br=Or,Hr=ft("toStringTag"),Gr=function(e,t,i,n){if(e){var r=i?e:e.prototype;Ur(r,Hr)||Nr(r,Hr,{configurable:!0,value:t}),n&&!Mr&&Fr(r,"toString",Br)}},Vr=I,Kr=a.WeakMap,Wr=Vr(Kr)&&/native code/.test(String(Kr)),jr=a,Yr=te,zr=mi,qr=Je,Xr=je,Qr=Pn,$r=qi,Zr="Object already initialized",Jr=jr.TypeError,ea=jr.WeakMap;if(Wr||Xr.state){var ta=Xr.state||(Xr.state=new ea);ta.get=ta.get,ta.has=ta.has,ta.set=ta.set,Tr=function(e,t){if(ta.has(e))throw Jr(Zr);return t.facade=e,ta.set(e,t),t},Er=function(e){return ta.get(e)||{}},Sr=function(e){return ta.has(e)}}else{var ia=Qr("state");$r[ia]=!0,Tr=function(e,t){if(qr(e,ia))throw Jr(Zr);return t.facade=e,zr(e,ia,t),t},Er=function(e){return qr(e,ia)?e[ia]:{}},Sr=function(e){return qr(e,ia)}}var na={set:Tr,get:Er,has:Sr,enforce:function(e){return Sr(e)?Er(e):Tr(e,{})},getterFor:function(e){return function(t){var i;if(!Yr(t)||(i=Er(t)).type!==e)throw Jr("Incompatible receiver, "+e+" required");return i}}},ra=E,aa=Array.isArray||function(e){return"Array"==ra(e)},sa=I,oa=je,la=m(Function.toString);sa(oa.inspectSource)||(oa.inspectSource=function(e){return la(e)});var ua=oa.inspectSource,ca=m,ha=s,da=I,fa=yn,va=ua,ga=function(){},pa=[],ma=oe("Reflect","construct"),ya=/^\s*(?:class|function)\b/,ka=ca(ya.exec),Ta=!ya.exec(ga),Ea=function(e){if(!da(e))return!1;try{return ma(ga,pa,e),!0}catch(t){return!1}},Sa=function(e){if(!da(e))return!1;switch(fa(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ta||!!ka(ya,va(e))}catch(t){return!0}};Sa.sham=!0;var _a=!ma||ha((function(){var e;return Ea(Ea.call)||!Ea(Object)||!Ea((function(){e=!0}))||e}))?Sa:Ea,ba=aa,Aa=_a,Ra=te,La=ft("species"),Ia=Array,Ca=function(e){var t;return ba(e)&&(t=e.constructor,(Aa(t)&&(t===Ia||ba(t.prototype))||Ra(t)&&null===(t=t[La]))&&(t=void 0)),void 0===t?Ia:t},wa=function(e,t){return new(Ca(e))(0===t?0:t)},Da=$t,xa=j,Pa=Qe,Oa=Vi,Ma=wa,Na=m([].push),Fa=function(e){var t=1==e,i=2==e,n=3==e,r=4==e,a=6==e,s=7==e,o=5==e||a;return function(l,u,c,h){for(var d,f,v=Pa(l),g=xa(v),p=Da(u,c),m=Oa(g),y=0,k=h||Ma,T=t?k(l,m):i||s?k(l,0):void 0;m>y;y++)if((o||y in g)&&(f=p(d=g[y],y,v),e))if(t)T[y]=f;else if(f)switch(e){case 3:return!0;case 5:return d;case 6:return y;case 2:Na(T,d)}else switch(e){case 4:return!1;case 7:Na(T,d)}return a?-1:n||r?r:T}},Ua={forEach:Fa(0),map:Fa(1),filter:Fa(2),some:Fa(3),every:Fa(4),find:Fa(5),findIndex:Fa(6),filterReject:Fa(7)},Ba=Ci,Ha=a,Ga=P,Va=m,Ka=w,Wa=Te,ja=s,Ya=Je,za=le,qa=ni,Xa=Z,Qa=_t,$a=En,Za=H,Ja=zn,es=an,ts=qn,is=$n,ns=fr,rs=C,as=Zt,ss=Sn,os=O,ls=gr,us=mr,cs=ze,hs=qi,ds=rt,fs=ft,vs=yr,gs=Lr,ps=xr,ms=Gr,ys=na,ks=Ua.forEach,Ts=Pn("hidden"),Es="Symbol",Ss="prototype",_s=ys.set,bs=ys.getterFor(Es),As=Object[Ss],Rs=Ha.Symbol,Ls=Rs&&Rs[Ss],Is=Ha.TypeError,Cs=Ha.QObject,ws=rs.f,Ds=as.f,xs=is.f,Ps=os.f,Os=Va([].push),Ms=cs("symbols"),Ns=cs("op-symbols"),Fs=cs("wks"),Us=!Cs||!Cs[Ss]||!Cs[Ss].findChild,Bs=Ka&&ja((function(){return 7!=Ja(Ds({},"a",{get:function(){return Ds(this,"a",{value:7}).a}})).a}))?function(e,t,i){var n=ws(As,t);n&&delete As[t],Ds(e,t,i),n&&e!==As&&Ds(As,t,n)}:Ds,Hs=function(e,t){var i=Ms[e]=Ja(Ls);return _s(i,{type:Es,tag:e,description:t}),Ka||(i.description=t),i},Gs=function(e,t,i){e===As&&Gs(Ns,t,i),qa(e);var n=Qa(t);return qa(i),Ya(Ms,n)?(i.enumerable?(Ya(e,Ts)&&e[Ts][n]&&(e[Ts][n]=!1),i=Ja(i,{enumerable:Za(0,!1)})):(Ya(e,Ts)||Ds(e,Ts,Za(1,{})),e[Ts][n]=!0),Bs(e,n,i)):Ds(e,n,i)},Vs=function(e,t){qa(e);var i=Xa(t),n=es(i).concat(Ys(i));return ks(n,(function(t){Ka&&!Ga(Ks,i,t)||Gs(e,t,i[t])})),e},Ks=function(e){var t=Qa(e),i=Ga(Ps,this,t);return!(this===As&&Ya(Ms,t)&&!Ya(Ns,t))&&(!(i||!Ya(this,t)||!Ya(Ms,t)||Ya(this,Ts)&&this[Ts][t])||i)},Ws=function(e,t){var i=Xa(e),n=Qa(t);if(i!==As||!Ya(Ms,n)||Ya(Ns,n)){var r=ws(i,n);return!r||!Ya(Ms,n)||Ya(i,Ts)&&i[Ts][n]||(r.enumerable=!0),r}},js=function(e){var t=xs(Xa(e)),i=[];return ks(t,(function(e){Ya(Ms,e)||Ya(hs,e)||Os(i,e)})),i},Ys=function(e){var t=e===As,i=xs(t?Ns:Xa(e)),n=[];return ks(i,(function(e){!Ya(Ms,e)||t&&!Ya(As,e)||Os(n,Ms[e])})),n};Wa||(Rs=function(){if(za(Ls,this))throw Is("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?$a(arguments[0]):void 0,t=ds(e),i=function(e){this===As&&Ga(i,Ns,e),Ya(this,Ts)&&Ya(this[Ts],t)&&(this[Ts][t]=!1),Bs(this,t,Za(1,e))};return Ka&&Us&&Bs(As,t,{configurable:!0,set:i}),Hs(t,e)},ls(Ls=Rs[Ss],"toString",(function(){return bs(this).tag})),ls(Rs,"withoutSetter",(function(e){return Hs(ds(e),e)})),os.f=Ks,as.f=Gs,ss.f=Vs,rs.f=Ws,ts.f=is.f=js,ns.f=Ys,vs.f=function(e){return Hs(fs(e),e)},Ka&&us(Ls,"description",{configurable:!0,get:function(){return bs(this).description}})),Ba({global:!0,constructor:!0,wrap:!0,forced:!Wa,sham:!Wa},{Symbol:Rs}),ks(es(Fs),(function(e){gs(e)})),Ba({target:Es,stat:!0,forced:!Wa},{useSetter:function(){Us=!0},useSimple:function(){Us=!1}}),Ba({target:"Object",stat:!0,forced:!Wa,sham:!Ka},{create:function(e,t){return void 0===t?Ja(e):Vs(Ja(e),t)},defineProperty:Gs,defineProperties:Vs,getOwnPropertyDescriptor:Ws}),Ba({target:"Object",stat:!0,forced:!Wa},{getOwnPropertyNames:js}),ps(),ms(Rs,Es),hs[Ts]=!0;var zs=Te&&!!Symbol.for&&!!Symbol.keyFor,qs=Ci,Xs=oe,Qs=Je,$s=En,Zs=ze,Js=zs,eo=Zs("string-to-symbol-registry"),to=Zs("symbol-to-string-registry");qs({target:"Symbol",stat:!0,forced:!Js},{for:function(e){var t=$s(e);if(Qs(eo,t))return eo[t];var i=Xs("Symbol")(t);return eo[t]=i,to[i]=t,i}});var io=Ci,no=Je,ro=Re,ao=Ie,so=zs,oo=ze("symbol-to-string-registry");io({target:"Symbol",stat:!0,forced:!so},{keyFor:function(e){if(!ro(e))throw TypeError(ao(e)+" is not a symbol");if(no(oo,e))return oo[e]}});var lo=m([].slice),uo=aa,co=I,ho=E,fo=En,vo=m([].push),go=Ci,po=oe,mo=d,yo=P,ko=m,To=s,Eo=I,So=Re,_o=lo,bo=function(e){if(co(e))return e;if(uo(e)){for(var t=e.length,i=[],n=0;n<t;n++){var r=e[n];"string"==typeof r?vo(i,r):"number"!=typeof r&&"Number"!=ho(r)&&"String"!=ho(r)||vo(i,fo(r))}var a=i.length,s=!0;return function(e,t){if(s)return s=!1,t;if(uo(this))return t;for(var n=0;n<a;n++)if(i[n]===e)return t}}},Ao=Te,Ro=String,Lo=po("JSON","stringify"),Io=ko(/./.exec),Co=ko("".charAt),wo=ko("".charCodeAt),Do=ko("".replace),xo=ko(1..toString),Po=/[\uD800-\uDFFF]/g,Oo=/^[\uD800-\uDBFF]$/,Mo=/^[\uDC00-\uDFFF]$/,No=!Ao||To((function(){var e=po("Symbol")();return"[null]"!=Lo([e])||"{}"!=Lo({a:e})||"{}"!=Lo(Object(e))})),Fo=To((function(){return'"\\udf06\\ud834"'!==Lo("\udf06\ud834")||'"\\udead"'!==Lo("\udead")})),Uo=function(e,t){var i=_o(arguments),n=bo(t);if(Eo(n)||void 0!==e&&!So(e))return i[1]=function(e,t){if(Eo(n)&&(t=yo(n,this,Ro(e),t)),!So(t))return t},mo(Lo,null,i)},Bo=function(e,t,i){var n=Co(i,t-1),r=Co(i,t+1);return Io(Oo,e)&&!Io(Mo,r)||Io(Mo,e)&&!Io(Oo,n)?"\\u"+xo(wo(e,0),16):e};Lo&&go({target:"JSON",stat:!0,arity:3,forced:No||Fo},{stringify:function(e,t,i){var n=_o(arguments),r=mo(No?Uo:Lo,null,n);return Fo&&"string"==typeof r?Do(r,Po,Bo):r}});var Ho=fr,Go=Qe;Ci({target:"Object",stat:!0,forced:!Te||s((function(){Ho.f(1)}))},{getOwnPropertySymbols:function(e){var t=Ho.f;return t?t(Go(e)):[]}});var Vo=ie.Object.getOwnPropertySymbols,Ko=i(Vo),Wo=s,jo=pe,Yo=ft("species"),zo=function(e){return jo>=51||!Wo((function(){var t=[];return(t.constructor={})[Yo]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},qo=Ua.filter;Ci({target:"Array",proto:!0,forced:!zo("filter")},{filter:function(e){return qo(this,e,arguments.length>1?arguments[1]:void 0)}});var Xo=ie,Qo=function(e){return Xo[e+"Prototype"]},$o=Qo("Array").filter,Zo=le,Jo=$o,el=Array.prototype,tl=function(e){var t=e.filter;return e===el||Zo(el,e)&&t===el.filter?Jo:t},il=i(tl),nl={exports:{}},rl=Ci,al=s,sl=Z,ol=C.f,ll=w;rl({target:"Object",stat:!0,forced:!ll||al((function(){ol(1)})),sham:!ll},{getOwnPropertyDescriptor:function(e,t){return ol(sl(e),t)}});var ul=ie.Object,cl=nl.exports=function(e,t){return ul.getOwnPropertyDescriptor(e,t)};ul.getOwnPropertyDescriptor.sham&&(cl.sham=!0);var hl=nl.exports,dl=i(hl),fl=w,vl=aa,gl=TypeError,pl=Object.getOwnPropertyDescriptor,ml=fl&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(vl(e)&&!pl(e,"length").writable)throw gl("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},yl=TypeError,kl=function(e){if(e>9007199254740991)throw yl("Maximum allowed index exceeded");return e},Tl=Qe,El=Vi,Sl=ml,_l=kl;Ci({target:"Array",proto:!0,arity:1,forced:s((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=Tl(this),i=El(t),n=arguments.length;_l(i+n);for(var r=0;r<n;r++)t[i]=arguments[r],i++;return Sl(t,i),i}});var bl,Al,Rl,Ll=Qo("Array").push,Il=le,Cl=Ll,wl=Array.prototype,Dl=i((function(e){var t=e.push;return e===wl||Il(wl,e)&&t===wl.push?Cl:t})),xl={},Pl=w,Ol=Je,Ml=Function.prototype,Nl=Pl&&Object.getOwnPropertyDescriptor,Fl=Ol(Ml,"name"),Ul={EXISTS:Fl,PROPER:Fl&&"something"===function(){}.name,CONFIGURABLE:Fl&&(!Pl||Pl&&Nl(Ml,"name").configurable)},Bl=!s((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Hl=Je,Gl=I,Vl=Qe,Kl=Bl,Wl=Pn("IE_PROTO"),jl=Object,Yl=jl.prototype,zl=Kl?jl.getPrototypeOf:function(e){var t=Vl(e);if(Hl(t,Wl))return t[Wl];var i=t.constructor;return Gl(i)&&t instanceof i?i.prototype:t instanceof jl?Yl:null},ql=s,Xl=I,Ql=te,$l=zn,Zl=zl,Jl=gr,eu=ft("iterator"),tu=!1;[].keys&&("next"in(Rl=[].keys())?(Al=Zl(Zl(Rl)))!==Object.prototype&&(bl=Al):tu=!0);var iu=!Ql(bl)||ql((function(){var e={};return bl[eu].call(e)!==e}));Xl((bl=iu?{}:$l(bl))[eu])||Jl(bl,eu,(function(){return this}));var nu={IteratorPrototype:bl,BUGGY_SAFARI_ITERATORS:tu},ru=nu.IteratorPrototype,au=zn,su=H,ou=Gr,lu=xl,uu=function(){return this},cu=function(e,t,i,n){var r=t+" Iterator";return e.prototype=au(ru,{next:su(+!n,i)}),ou(e,r,!1,!0),lu[r]=uu,e},hu=m,du=xe,fu=I,vu=String,gu=TypeError,pu=function(e,t,i){try{return hu(du(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(n){}},mu=ni,yu=function(e){if("object"==typeof e||fu(e))return e;throw gu("Can't set "+vu(e)+" as a prototype")},ku=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=pu(Object.prototype,"__proto__","set"))(i,[]),t=i instanceof Array}catch(n){}return function(i,n){return mu(i),yu(n),t?e(i,n):i.__proto__=n,i}}():void 0),Tu=Ci,Eu=P,Su=Ul,_u=cu,bu=zl,Au=Gr,Ru=gr,Lu=xl,Iu=nu,Cu=Su.PROPER,wu=Iu.BUGGY_SAFARI_ITERATORS,Du=ft("iterator"),xu="keys",Pu="values",Ou="entries",Mu=function(){return this},Nu=function(e,t,i,n,r,a,s){_u(i,t,n);var o,l,u,c=function(e){if(e===r&&g)return g;if(!wu&&e in f)return f[e];switch(e){case xu:case Pu:case Ou:return function(){return new i(this,e)}}return function(){return new i(this)}},h=t+" Iterator",d=!1,f=e.prototype,v=f[Du]||f["@@iterator"]||r&&f[r],g=!wu&&v||c(r),p="Array"==t&&f.entries||v;if(p&&(o=bu(p.call(new e)))!==Object.prototype&&o.next&&(Au(o,h,!0,!0),Lu[h]=Mu),Cu&&r==Pu&&v&&v.name!==Pu&&(d=!0,g=function(){return Eu(v,this)}),r)if(l={values:c(Pu),keys:a?g:c(xu),entries:c(Ou)},s)for(u in l)(wu||d||!(u in f))&&Ru(f,u,l[u]);else Tu({target:t,proto:!0,forced:wu||d},l);return s&&f[Du]!==g&&Ru(f,Du,g,{name:r}),Lu[t]=g,l},Fu=function(e,t){return{value:e,done:t}},Uu=Z,Bu=xl,Hu=na;Zt.f;var Gu=Nu,Vu=Fu,Ku="Array Iterator",Wu=Hu.set,ju=Hu.getterFor(Ku);Gu(Array,"Array",(function(e,t){Wu(this,{type:Ku,target:Uu(e),index:0,kind:t})}),(function(){var e=ju(this),t=e.target,i=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,Vu(void 0,!0)):Vu("keys"==i?n:"values"==i?t[n]:[n,t[n]],!1)}),"values"),Bu.Arguments=Bu.Array;var Yu={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},zu=a,qu=yn,Xu=mi,Qu=xl,$u=ft("toStringTag");for(var Zu in Yu){var Ju=zu[Zu],ec=Ju&&Ju.prototype;ec&&qu(ec)!==$u&&Xu(ec,$u,Zu),Qu[Zu]=Qu.Array}var tc=s,ic=function(e,t){var i=[][e];return!!i&&tc((function(){i.call(null,t||function(){return 1},1)}))},nc=Ua.forEach,rc=ic("forEach")?[].forEach:function(e){return nc(this,e,arguments.length>1?arguments[1]:void 0)};Ci({target:"Array",proto:!0,forced:[].forEach!=rc},{forEach:rc});var ac=Qo("Array").forEach,sc=yn,oc=Je,lc=le,uc=ac,cc=Array.prototype,hc={DOMTokenList:!0,NodeList:!0},dc=function(e){var t=e.forEach;return e===cc||lc(cc,e)&&t===cc.forEach||oc(hc,sc(e))?uc:t},fc=i(dc),vc=oe,gc=qn,pc=fr,mc=ni,yc=m([].concat),kc=vc("Reflect","ownKeys")||function(e){var t=gc.f(mc(e)),i=pc.f;return i?yc(t,i(e)):t},Tc=kc,Ec=Z,Sc=C,_c=tr;Ci({target:"Object",stat:!0,sham:!w},{getOwnPropertyDescriptors:function(e){for(var t,i,n=Ec(e),r=Sc.f,a=Tc(n),s={},o=0;a.length>o;)void 0!==(i=r(n,t=a[o++]))&&_c(s,t,i);return s}});var bc=ie.Object.getOwnPropertyDescriptors,Ac=i(bc),Rc={exports:{}},Lc=Ci,Ic=w,Cc=Sn.f;Lc({target:"Object",stat:!0,forced:Object.defineProperties!==Cc,sham:!Ic},{defineProperties:Cc});var wc=ie.Object,Dc=Rc.exports=function(e,t){return wc.defineProperties(e,t)};wc.defineProperties.sham&&(Dc.sham=!0);var xc=Rc.exports,Pc=i(xc),Oc={exports:{}},Mc=Ci,Nc=w,Fc=Zt.f;Mc({target:"Object",stat:!0,forced:Object.defineProperty!==Fc,sham:!Nc},{defineProperty:Fc});var Uc=ie.Object,Bc=Oc.exports=function(e,t,i){return Uc.defineProperty(e,t,i)};Uc.defineProperty.sham&&(Bc.sham=!0);var Hc=Oc.exports,Gc=i(Hc),Vc=Ci,Kc=s,Wc=aa,jc=te,Yc=Qe,zc=Vi,qc=kl,Xc=tr,Qc=wa,$c=zo,Zc=pe,Jc=ft("isConcatSpreadable"),eh=Zc>=51||!Kc((function(){var e=[];return e[Jc]=!1,e.concat()[0]!==e})),th=function(e){if(!jc(e))return!1;var t=e[Jc];return void 0!==t?!!t:Wc(e)};Vc({target:"Array",proto:!0,arity:1,forced:!eh||!$c("concat")},{concat:function(e){var t,i,n,r,a,s=Yc(this),o=Qc(s,0),l=0;for(t=-1,n=arguments.length;t<n;t++)if(th(a=-1===t?s:arguments[t]))for(r=zc(a),qc(l+r),i=0;i<r;i++,l++)i in a&&Xc(o,l,a[i]);else qc(l+1),Xc(o,l++,a);return o.length=l,o}}),Lr("asyncIterator"),Lr("hasInstance"),Lr("isConcatSpreadable"),Lr("iterator"),Lr("match"),Lr("matchAll"),Lr("replace"),Lr("search"),Lr("species"),Lr("split");var ih=xr;Lr("toPrimitive"),ih();var nh=oe,rh=Gr;Lr("toStringTag"),rh(nh("Symbol"),"Symbol"),Lr("unscopables"),Gr(a.JSON,"JSON",!0);var ah=ie.Symbol;Lr("dispose");var sh=ah;Lr("asyncDispose");var oh=Ci,lh=m,uh=oe("Symbol"),ch=uh.keyFor,hh=lh(uh.prototype.valueOf);oh({target:"Symbol",stat:!0},{isRegistered:function(e){try{return void 0!==ch(hh(e))}catch(t){return!1}}});for(var dh=Ci,fh=ze,vh=oe,gh=m,ph=Re,mh=ft,yh=vh("Symbol"),kh=yh.isWellKnown,Th=vh("Object","getOwnPropertyNames"),Eh=gh(yh.prototype.valueOf),Sh=fh("wks"),_h=0,bh=Th(yh),Ah=bh.length;_h<Ah;_h++)try{var Rh=bh[_h];ph(yh[Rh])&&mh(Rh)}catch(GG){}dh({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(e){if(kh&&kh(e))return!0;try{for(var t=Eh(e),i=0,n=Th(Sh),r=n.length;i<r;i++)if(Sh[n[i]]==t)return!0}catch(GG){}return!1}}),Lr("matcher"),Lr("metadataKey"),Lr("observable"),Lr("metadata"),Lr("patternMatch"),Lr("replaceAll");var Lh=sh,Ih=i(Lh),Ch=m,wh=Pi,Dh=En,xh=X,Ph=Ch("".charAt),Oh=Ch("".charCodeAt),Mh=Ch("".slice),Nh=function(e){return function(t,i){var n,r,a=Dh(xh(t)),s=wh(i),o=a.length;return s<0||s>=o?e?"":void 0:(n=Oh(a,s))<55296||n>56319||s+1===o||(r=Oh(a,s+1))<56320||r>57343?e?Ph(a,s):n:e?Mh(a,s,s+2):r-56320+(n-55296<<10)+65536}},Fh={codeAt:Nh(!1),charAt:Nh(!0)},Uh=Fh.charAt,Bh=En,Hh=na,Gh=Nu,Vh=Fu,Kh="String Iterator",Wh=Hh.set,jh=Hh.getterFor(Kh);Gh(String,"String",(function(e){Wh(this,{type:Kh,string:Bh(e),index:0})}),(function(){var e,t=jh(this),i=t.string,n=t.index;return n>=i.length?Vh(void 0,!0):(e=Uh(i,n),t.index+=e.length,Vh(e,!1))}));var Yh=yr.f("iterator"),zh=i(Yh);function qh(e){return(qh="function"==typeof Ih&&"symbol"==typeof zh?function(e){return typeof e}:function(e){return e&&"function"==typeof Ih&&e.constructor===Ih&&e!==Ih.prototype?"symbol":typeof e})(e)}var Xh=yr.f("toPrimitive"),Qh=i(Xh);function $h(e){var t=function(e,t){if("object"!==qh(e)||null===e)return e;var i=e[Qh];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==qh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===qh(t)?t:String(t)}function Zh(e,t,i){return(t=$h(t))in e?Gc(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Jh(e,t){var i=un(e);if(Ko){var n=Ko(e);t&&(n=il(n).call(n,(function(t){return dl(e,t).enumerable}))),Dl(i).apply(i,n)}return i}function ed(e){for(var t=1;t<arguments.length;t++){var i,n,r=null!=arguments[t]?arguments[t]:{};t%2?fc(i=Jh(Object(r),!0)).call(i,(function(t){Zh(e,t,r[t])})):Ac?Pc(e,Ac(r)):fc(n=Jh(Object(r))).call(n,(function(t){Gc(e,t,dl(r,t))}))}return e}var td=yn,id=Me,nd=Y,rd=xl,ad=ft("iterator"),sd=function(e){if(!nd(e))return id(e,ad)||id(e,"@@iterator")||rd[td(e)]},od=sd,ld=i(od);Ci({target:"Array",stat:!0},{isArray:aa});var ud=ie.Array.isArray,cd=i(ud),hd=Ci,dd=aa,fd=_a,vd=te,gd=Fi,pd=Vi,md=Z,yd=tr,kd=ft,Td=lo,Ed=zo("slice"),Sd=kd("species"),_d=Array,bd=Math.max;hd({target:"Array",proto:!0,forced:!Ed},{slice:function(e,t){var i,n,r,a=md(this),s=pd(a),o=gd(e,s),l=gd(void 0===t?s:t,s);if(dd(a)&&(i=a.constructor,(fd(i)&&(i===_d||dd(i.prototype))||vd(i)&&null===(i=i[Sd]))&&(i=void 0),i===_d||void 0===i))return Td(a,o,l);for(n=new(void 0===i?_d:i)(bd(l-o,0)),r=0;o<l;o++,r++)o in a&&yd(n,r,a[o]);return n.length=r,n}});var Ad=Qo("Array").slice,Rd=le,Ld=Ad,Id=Array.prototype,Cd=function(e){var t=e.slice;return e===Id||Rd(Id,e)&&t===Id.slice?Ld:t},wd=i(Cd),Dd=P,xd=ni,Pd=Me,Od=function(e,t,i){var n,r;xd(e);try{if(!(n=Pd(e,"return"))){if("throw"===t)throw i;return i}n=Dd(n,e)}catch(GG){r=!0,n=GG}if("throw"===t)throw i;if(r)throw n;return xd(n),i},Md=ni,Nd=Od,Fd=xl,Ud=ft("iterator"),Bd=Array.prototype,Hd=function(e){return void 0!==e&&(Fd.Array===e||Bd[Ud]===e)},Gd=P,Vd=xe,Kd=ni,Wd=Ie,jd=sd,Yd=TypeError,zd=function(e,t){var i=arguments.length<2?jd(e):t;if(Vd(i))return Kd(Gd(i,e));throw Yd(Wd(e)+" is not iterable")},qd=$t,Xd=P,Qd=Qe,$d=function(e,t,i,n){try{return n?t(Md(i)[0],i[1]):t(i)}catch(GG){Nd(e,"throw",GG)}},Zd=Hd,Jd=_a,ef=Vi,tf=tr,nf=zd,rf=sd,af=Array,sf=function(e){var t=Qd(e),i=Jd(this),n=arguments.length,r=n>1?arguments[1]:void 0,a=void 0!==r;a&&(r=qd(r,n>2?arguments[2]:void 0));var s,o,l,u,c,h,d=rf(t),f=0;if(!d||this===af&&Zd(d))for(s=ef(t),o=i?new this(s):af(s);s>f;f++)h=a?r(t[f],f):t[f],tf(o,f,h);else for(c=(u=nf(t,d)).next,o=i?new this:[];!(l=Xd(c,u)).done;f++)h=a?$d(u,r,[l.value,f],!0):l.value,tf(o,f,h);return o.length=f,o},of=ft("iterator"),lf=!1;try{var uf=0,cf={next:function(){return{done:!!uf++}},return:function(){lf=!0}};cf[of]=function(){return this},Array.from(cf,(function(){throw 2}))}catch(GG){}var hf=function(e,t){if(!t&&!lf)return!1;var i=!1;try{var n={};n[of]=function(){return{next:function(){return{done:i=!0}}}},e(n)}catch(GG){}return i},df=sf;Ci({target:"Array",stat:!0,forced:!hf((function(e){Array.from(e)}))},{from:df});var ff=ie.Array.from,vf=i(ff);function gf(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function pf(e,t){var i;if(e){if("string"==typeof e)return gf(e,t);var n=wd(i=Object.prototype.toString.call(e)).call(i,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?vf(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gf(e,t):void 0}}function mf(e){return function(e){if(cd(e))return gf(e)}(e)||function(e){if(void 0!==Ih&&null!=ld(e)||null!=e["@@iterator"])return vf(e)}(e)||pf(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 yf(e,t){return function(e){if(cd(e))return e}(e)||function(e,t){var i=null==e?null:void 0!==Ih&&ld(e)||e["@@iterator"];if(null!=i){var n,r,a,s,o=[],l=!0,u=!1;try{if(a=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=a.call(i)).done)&&(Dl(o).call(o,n.value),o.length!==t);l=!0);}catch(c){u=!0,r=c}finally{try{if(!l&&null!=i.return&&(s=i.return(),Object(s)!==s))return}finally{if(u)throw r}}return o}}(e,t)||pf(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var kf=Je,Tf=P,Ef=te,Sf=ni,_f=function(e){return void 0!==e&&(kf(e,"value")||kf(e,"writable"))},bf=C,Af=zl;Ci({target:"Reflect",stat:!0},{get:function e(t,i){var n,r,a=arguments.length<3?t:arguments[2];return Sf(t)===a?t[i]:(n=bf.f(t,i))?_f(n)?n.value:void 0===n.get?void 0:Tf(n.get,a):Ef(r=Af(t))?e(r,i,a):void 0}});var Rf=ie.Reflect.get,Lf=i(Rf),If=m,Cf=xe,wf=te,Df=Je,xf=lo,Pf=o,Of=Function,Mf=If([].concat),Nf=If([].join),Ff={},Uf=Pf?Of.bind:function(e){var t=Cf(this),i=t.prototype,n=xf(arguments,1),r=function(){var i=Mf(n,xf(arguments));return this instanceof r?function(e,t,i){if(!Df(Ff,t)){for(var n=[],r=0;r<t;r++)n[r]="a["+r+"]";Ff[t]=Of("C,a","return new C("+Nf(n,",")+")")}return Ff[t](e,i)}(t,i.length,i):t.apply(e,i)};return wf(i)&&(r.prototype=i),r},Bf=Uf;Ci({target:"Function",proto:!0,forced:Function.bind!==Bf},{bind:Bf});var Hf=Qo("Function").bind,Gf=le,Vf=Hf,Kf=Function.prototype,Wf=function(e){var t=e.bind;return e===Kf||Gf(Kf,e)&&t===Kf.bind?Vf:t},jf=i(Wf);Ci({target:"Object",stat:!0},{setPrototypeOf:ku});var Yf=ie.Object.setPrototypeOf,zf=i(Yf),qf=Qe,Xf=zl,Qf=Bl;Ci({target:"Object",stat:!0,forced:s((function(){Xf(1)})),sham:!Qf},{getPrototypeOf:function(e){return Xf(qf(e))}});var $f=ie.Object.getPrototypeOf,Zf=i($f);function Jf(e){var t;return(Jf=zf?jf(t=Zf).call(t):function(e){return e.__proto__||Zf(e)})(e)}function ev(){var e;"undefined"!=typeof Reflect&&Lf?ev=jf(e=Lf).call(e):ev=function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Jf(e)););return e}(e,t);if(n){var r=dl(n,t);return r.get?r.get.call(arguments.length<3?e:i):r.value}};return ev.apply(this,arguments)}var tv={exports:{}},iv=s((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),nv=s,rv=te,av=E,sv=iv,ov=Object.isExtensible,lv=nv((function(){ov(1)}))||sv?function(e){return!!rv(e)&&((!sv||"ArrayBuffer"!=av(e))&&(!ov||ov(e)))}:ov,uv=!s((function(){return Object.isExtensible(Object.preventExtensions({}))})),cv=Ci,hv=m,dv=qi,fv=te,vv=Je,gv=Zt.f,pv=qn,mv=$n,yv=lv,kv=uv,Tv=!1,Ev=rt("meta"),Sv=0,_v=function(e){gv(e,Ev,{value:{objectID:"O"+Sv++,weakData:{}}})},bv=tv.exports={enable:function(){bv.enable=function(){},Tv=!0;var e=pv.f,t=hv([].splice),i={};i[Ev]=1,e(i).length&&(pv.f=function(i){for(var n=e(i),r=0,a=n.length;r<a;r++)if(n[r]===Ev){t(n,r,1);break}return n},cv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:mv.f}))},fastKey:function(e,t){if(!fv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!vv(e,Ev)){if(!yv(e))return"F";if(!t)return"E";_v(e)}return e[Ev].objectID},getWeakData:function(e,t){if(!vv(e,Ev)){if(!yv(e))return!0;if(!t)return!1;_v(e)}return e[Ev].weakData},onFreeze:function(e){return kv&&Tv&&yv(e)&&!vv(e,Ev)&&_v(e),e}};dv[Ev]=!0;var Av=tv.exports,Rv=$t,Lv=P,Iv=ni,Cv=Ie,wv=Hd,Dv=Vi,xv=le,Pv=zd,Ov=sd,Mv=Od,Nv=TypeError,Fv=function(e,t){this.stopped=e,this.result=t},Uv=Fv.prototype,Bv=function(e,t,i){var n,r,a,s,o,l,u,c=i&&i.that,h=!(!i||!i.AS_ENTRIES),d=!(!i||!i.IS_RECORD),f=!(!i||!i.IS_ITERATOR),v=!(!i||!i.INTERRUPTED),g=Rv(t,c),p=function(e){return n&&Mv(n,"normal",e),new Fv(!0,e)},m=function(e){return h?(Iv(e),v?g(e[0],e[1],p):g(e[0],e[1])):v?g(e,p):g(e)};if(d)n=e.iterator;else if(f)n=e;else{if(!(r=Ov(e)))throw Nv(Cv(e)+" is not iterable");if(wv(r)){for(a=0,s=Dv(e);s>a;a++)if((o=m(e[a]))&&xv(Uv,o))return o;return new Fv(!1)}n=Pv(e,r)}for(l=d?e.next:n.next;!(u=Lv(l,n)).done;){try{o=m(u.value)}catch(GG){Mv(n,"throw",GG)}if("object"==typeof o&&o&&xv(Uv,o))return o}return new Fv(!1)},Hv=le,Gv=TypeError,Vv=function(e,t){if(Hv(t,e))return e;throw Gv("Incorrect invocation")},Kv=Ci,Wv=a,jv=Av,Yv=s,zv=mi,qv=Bv,Xv=Vv,Qv=I,$v=te,Zv=Gr,Jv=Zt.f,eg=Ua.forEach,tg=w,ig=na.set,ng=na.getterFor,rg=function(e,t,i){var n,r=-1!==e.indexOf("Map"),a=-1!==e.indexOf("Weak"),s=r?"set":"add",o=Wv[e],l=o&&o.prototype,u={};if(tg&&Qv(o)&&(a||l.forEach&&!Yv((function(){(new o).entries().next()})))){var c=(n=t((function(t,i){ig(Xv(t,c),{type:e,collection:new o}),null!=i&&qv(i,t[s],{that:t,AS_ENTRIES:r})}))).prototype,h=ng(e);eg(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in l)||a&&"clear"==e||zv(c,e,(function(i,n){var r=h(this).collection;if(!t&&a&&!$v(i))return"get"==e&&void 0;var s=r[e](0===i?0:i,n);return t?this:s}))})),a||Jv(c,"size",{configurable:!0,get:function(){return h(this).collection.size}})}else n=i.getConstructor(t,e,r,s),jv.enable();return Zv(n,e,!1,!0),u[e]=n,Kv({global:!0,forced:!0},u),a||i.setStrong(n,e,r),n},ag=gr,sg=function(e,t,i){for(var n in t)i&&i.unsafe&&e[n]?e[n]=t[n]:ag(e,n,t[n],i);return e},og=oe,lg=mr,ug=w,cg=ft("species"),hg=function(e){var t=og(e);ug&&t&&!t[cg]&&lg(t,cg,{configurable:!0,get:function(){return this}})},dg=zn,fg=mr,vg=sg,gg=$t,pg=Vv,mg=Y,yg=Bv,kg=Nu,Tg=Fu,Eg=hg,Sg=w,_g=Av.fastKey,bg=na.set,Ag=na.getterFor,Rg={getConstructor:function(e,t,i,n){var r=e((function(e,r){pg(e,a),bg(e,{type:t,index:dg(null),first:void 0,last:void 0,size:0}),Sg||(e.size=0),mg(r)||yg(r,e[n],{that:e,AS_ENTRIES:i})})),a=r.prototype,s=Ag(t),o=function(e,t,i){var n,r,a=s(e),o=l(e,t);return o?o.value=i:(a.last=o={index:r=_g(t,!0),key:t,value:i,previous:n=a.last,next:void 0,removed:!1},a.first||(a.first=o),n&&(n.next=o),Sg?a.size++:e.size++,"F"!==r&&(a.index[r]=o)),e},l=function(e,t){var i,n=s(e),r=_g(t);if("F"!==r)return n.index[r];for(i=n.first;i;i=i.next)if(i.key==t)return i};return vg(a,{clear:function(){for(var e=s(this),t=e.index,i=e.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete t[i.index],i=i.next;e.first=e.last=void 0,Sg?e.size=0:this.size=0},delete:function(e){var t=this,i=s(t),n=l(t,e);if(n){var r=n.next,a=n.previous;delete i.index[n.index],n.removed=!0,a&&(a.next=r),r&&(r.previous=a),i.first==n&&(i.first=r),i.last==n&&(i.last=a),Sg?i.size--:t.size--}return!!n},forEach:function(e){for(var t,i=s(this),n=gg(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!l(this,e)}}),vg(a,i?{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)}}),Sg&&fg(a,"size",{configurable:!0,get:function(){return s(this).size}}),r},setStrong:function(e,t,i){var n=t+" Iterator",r=Ag(t),a=Ag(n);kg(e,t,(function(e,t){bg(this,{type:n,target:e,state:r(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;return e.target&&(e.last=i=i?i.next:e.state.first)?Tg("keys"==t?i.key:"values"==t?i.value:[i.key,i.value],!1):(e.target=void 0,Tg(void 0,!0))}),i?"entries":"values",!i,!0),Eg(t)}};rg("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Rg);var Lg=ie.Map,Ig=_a,Cg=Ie,wg=TypeError,Dg=function(e){if(Ig(e))return e;throw wg(Cg(e)+" is not a constructor")},xg=$t,Pg=P,Og=xe,Mg=Dg,Ng=Y,Fg=Bv,Ug=[].push,Bg=function(e){var t,i,n,r,a=arguments.length,s=a>1?arguments[1]:void 0;return Mg(this),(t=void 0!==s)&&Og(s),Ng(e)?new this:(i=[],t?(n=0,r=xg(s,a>2?arguments[2]:void 0),Fg(e,(function(e){Pg(Ug,i,r(e,n++))}))):Fg(e,Ug,{that:i}),new this(i))};Ci({target:"Map",stat:!0,forced:!0},{from:Bg});var Hg=lo,Gg=function(){return new this(Hg(arguments))};Ci({target:"Map",stat:!0,forced:!0},{of:Gg});var Vg=Ie,Kg=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(Vg(e)+" is not a map")},Wg=function(e,t){return 1==t?function(t,i){return t[e](i)}:function(t,i,n){return t[e](i,n)}},jg=Wg,Yg=oe("Map"),zg={Map:Yg,set:jg("set",2),get:jg("get",1),has:jg("has",1),remove:jg("delete",1),proto:Yg.prototype},qg=Kg,Xg=zg.remove;Ci({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=qg(this),i=!0,n=0,r=arguments.length;n<r;n++)e=Xg(t,arguments[n]),i=i&&e;return!!i}});var Qg=Kg,$g=zg.get,Zg=zg.has,Jg=zg.set;Ci({target:"Map",proto:!0,real:!0,forced:!0},{emplace:function(e,t){var i,n,r=Qg(this);return Zg(r,e)?(i=$g(r,e),"update"in t&&(i=t.update(i,e,r),Jg(r,e,i)),i):(n=t.insert(e,r),Jg(r,e,n),n)}});var ep=P,tp=function(e,t,i){for(var n,r,a=i||e.next;!(n=ep(a,e)).done;)if(void 0!==(r=t(n.value)))return r},ip=tp,np=function(e,t,i){return i?ip(e.entries(),(function(e){return t(e[1],e[0])})):e.forEach(t)},rp=$t,ap=Kg,sp=np;Ci({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=ap(this),i=rp(e,arguments.length>1?arguments[1]:void 0);return!1!==sp(t,(function(e,n){if(!i(e,n,t))return!1}),!0)}});var op=$t,lp=Kg,up=np,cp=zg.Map,hp=zg.set;Ci({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=lp(this),i=op(e,arguments.length>1?arguments[1]:void 0),n=new cp;return up(t,(function(e,r){i(e,r,t)&&hp(n,r,e)})),n}});var dp=$t,fp=Kg,vp=np;Ci({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=fp(this),i=dp(e,arguments.length>1?arguments[1]:void 0),n=vp(t,(function(e,n){if(i(e,n,t))return{value:e}}),!0);return n&&n.value}});var gp=$t,pp=Kg,mp=np;Ci({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=pp(this),i=gp(e,arguments.length>1?arguments[1]:void 0),n=mp(t,(function(e,n){if(i(e,n,t))return{key:n}}),!0);return n&&n.key}});var yp=Ci,kp=P,Tp=I,Ep=xe,Sp=Bv,_p=zg.Map,bp=m([].push);yp({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){var i=new(Tp(this)?this:_p);Ep(t);var n=Ep(i.has),r=Ep(i.get),a=Ep(i.set);return Sp(e,(function(e){var s=t(e);kp(n,i,s)?bp(kp(r,i,s),e):kp(a,i,s,[e])})),i}});var Ap=function(e,t){return e===t||e!=e&&t!=t},Rp=Kg,Lp=np;Ci({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return!0===Lp(Rp(this),(function(t){if(Ap(t,e))return!0}),!0)}});var Ip=P,Cp=Bv,wp=I,Dp=xe,xp=zg.Map;Ci({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var i=new(wp(this)?this:xp);Dp(t);var n=Dp(i.set);return Cp(e,(function(e){Ip(n,i,t(e),e)})),i}});var Pp=Kg,Op=np;Ci({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){var t=Op(Pp(this),(function(t,i){if(t===e)return{key:i}}),!0);return t&&t.key}});var Mp=$t,Np=Kg,Fp=np,Up=zg.Map,Bp=zg.set;Ci({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=Np(this),i=Mp(e,arguments.length>1?arguments[1]:void 0),n=new Up;return Fp(t,(function(e,r){Bp(n,i(e,r,t),e)})),n}});var Hp=$t,Gp=Kg,Vp=np,Kp=zg.Map,Wp=zg.set;Ci({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=Gp(this),i=Hp(e,arguments.length>1?arguments[1]:void 0),n=new Kp;return Vp(t,(function(e,r){Wp(n,r,i(e,r,t))})),n}});var jp=Kg,Yp=Bv,zp=zg.set;Ci({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=jp(this),i=arguments.length,n=0;n<i;)Yp(arguments[n++],(function(e,i){zp(t,e,i)}),{AS_ENTRIES:!0});return t}});var qp=xe,Xp=Kg,Qp=np,$p=TypeError;Ci({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=Xp(this),i=arguments.length<2,n=i?void 0:arguments[1];if(qp(e),Qp(t,(function(r,a){i?(i=!1,n=r):n=e(n,r,a,t)})),i)throw $p("Reduce of empty map with no initial value");return n}});var Zp=$t,Jp=Kg,em=np;Ci({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=Jp(this),i=Zp(e,arguments.length>1?arguments[1]:void 0);return!0===em(t,(function(e,n){if(i(e,n,t))return!0}),!0)}});var tm=xe,im=Kg,nm=TypeError,rm=zg.get,am=zg.has,sm=zg.set;Ci({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var i=im(this),n=arguments.length;tm(t);var r=am(i,e);if(!r&&n<3)throw nm("Updating absent value");var a=r?rm(i,e):tm(n>2?arguments[2]:void 0)(e,i);return sm(i,e,t(a,e,i)),i}});var om=P,lm=xe,um=I,cm=ni,hm=TypeError,dm=function(e,t){var i,n=cm(this),r=lm(n.get),a=lm(n.has),s=lm(n.set),o=arguments.length>2?arguments[2]:void 0;if(!um(t)&&!um(o))throw hm("At least one callback required");return om(a,n,e)?(i=om(r,n,e),um(t)&&(i=t(i),om(s,n,e,i))):um(o)&&(i=o(),om(s,n,e,i)),i};Ci({target:"Map",proto:!0,real:!0,forced:!0},{upsert:dm}),Ci({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:dm});var fm=Lg,vm=i(fm);Ci({target:"Object",stat:!0,sham:!w},{create:zn});var gm=ie.Object,pm=function(e,t){return gm.create(e,t)},mm=i(pm);function ym(e,t){var i;return(ym=zf?jf(i=zf).call(i):function(e,t){return e.__proto__=t,e})(e,t)}var km=Ci,Tm=zi.indexOf,Em=ic,Sm=b([].indexOf),_m=!!Sm&&1/Sm([1],1,-0)<0;km({target:"Array",proto:!0,forced:_m||!Em("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return _m?Sm(this,e,t)||0:Tm(this,e,t)}});var bm=Qo("Array").indexOf,Am=le,Rm=bm,Lm=Array.prototype,Im=function(e){var t=e.indexOf;return e===Lm||Am(Lm,e)&&t===Lm.indexOf?Rm:t},Cm=i(Im);var wm=Ci,Dm=d,xm=Uf,Pm=Dg,Om=ni,Mm=te,Nm=zn,Fm=s,Um=oe("Reflect","construct"),Bm=Object.prototype,Hm=[].push,Gm=Fm((function(){function e(){}return!(Um((function(){}),[],e)instanceof e)})),Vm=!Fm((function(){Um((function(){}))})),Km=Gm||Vm;wm({target:"Reflect",stat:!0,forced:Km,sham:Km},{construct:function(e,t){Pm(e),Om(t);var i=arguments.length<3?e:Pm(arguments[2]);if(Vm&&!Gm)return Um(e,t,i);if(e==i){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 Dm(Hm,n,t),new(Dm(xm,e,n))}var r=i.prototype,a=Nm(Mm(r)?r:Bm),s=Dm(e,a,t);return Mm(s)?s:a}});var Wm=ie.Reflect.construct,jm=i(Wm);function Ym(){if("undefined"==typeof Reflect||!jm)return!1;if(jm.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(jm(Boolean,[],(function(){}))),!0}catch(e){return!1}}function zm(e,t,i){var n;Ym()?zm=jf(n=jm).call(n):zm=function(e,t,i){var n=[null];Dl(n).apply(n,t);var r=new(jf(Function).apply(e,n));return i&&ym(r,i.prototype),r};return zm.apply(null,arguments)}function qm(e){var t="function"==typeof vm?new vm:void 0;return qm=function(e){if(null===e||(i=e,-1===Cm(n=Function.toString.call(i)).call(n,"[native code]")))return e;var i,n;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 zm(e,arguments,Jf(this).constructor)}return r.prototype=mm(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ym(r,e)},qm(e)}function Xm(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qm(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=mm(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Gc(e,"prototype",{writable:!1}),t&&ym(e,t)}function $m(e){var t=Ym();return function(){var i,n=Jf(e);if(t){var r=Jf(this).constructor;i=jm(n,arguments,r)}else i=n.apply(this,arguments);return function(e,t){if(t&&("object"===qh(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Xm(e)}(this,i)}}function Zm(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jm(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Gc(e,$h(n.key),n)}}function ey(e,t,i){return t&&Jm(e.prototype,t),i&&Jm(e,i),Gc(e,"prototype",{writable:!1}),e}var ty=a.isFinite;Ci({target:"Number",stat:!0},{isFinite:Number.isFinite||function(e){return"number"==typeof e&&ty(e)}});var iy=i(ie.Number.isFinite),ny=te,ry=Math.floor,ay=Number.isInteger||function(e){return!ny(e)&&isFinite(e)&&ry(e)===e},sy=Ci,oy=ay,ly=Math.abs;sy({target:"Number",stat:!0},{isSafeInteger:function(e){return oy(e)&&ly(e)<=9007199254740991}});var uy=i(ie.Number.isSafeInteger);Ci({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991});var cy=i(9007199254740991),hy=i(Xh),dy=i(Hc),fy=w,vy=m,gy=P,py=s,my=an,yy=fr,ky=O,Ty=Qe,Ey=j,Sy=Object.assign,_y=Object.defineProperty,by=vy([].concat),Ay=!Sy||py((function(){if(fy&&1!==Sy({b:1},Sy(_y({},"a",{enumerable:!0,get:function(){_y(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol(),n="abcdefghijklmnopqrst";return e[i]=7,n.split("").forEach((function(e){t[e]=e})),7!=Sy({},e)[i]||my(Sy({},t)).join("")!=n}))?function(e,t){for(var i=Ty(e),n=arguments.length,r=1,a=yy.f,s=ky.f;n>r;)for(var o,l=Ey(arguments[r++]),u=a?by(my(l),a(l)):my(l),c=u.length,h=0;c>h;)o=u[h++],fy&&!gy(s,l,o)||(i[o]=l[o]);return i}:Sy,Ry=Ay;Ci({target:"Object",stat:!0,arity:2,forced:Object.assign!==Ry},{assign:Ry});var Ly=i(ie.Object.assign),Iy=i(Wf),Cy=i(ln),wy=i(Vo),Dy=i(tl),xy=i(hl),Py=i(dc),Oy=i(bc),My=i(xc),Ny=Qo("Array").concat,Fy=le,Uy=Ny,By=Array.prototype,Hy=i((function(e){var t=e.concat;return e===By||Fy(By,e)&&t===By.concat?Uy:t})),Gy=Ua.some;Ci({target:"Array",proto:!0,forced:!ic("some")},{some:function(e){return Gy(this,e,arguments.length>1?arguments[1]:void 0)}});var Vy=Qo("Array").some,Ky=le,Wy=Vy,jy=Array.prototype,Yy=i((function(e){var t=e.some;return e===jy||Ky(jy,e)&&t===jy.some?Wy:t})),zy=i(Im),qy=xe,Xy=Qe,Qy=j,$y=Vi,Zy=TypeError,Jy=function(e){return function(t,i,n,r){qy(i);var a=Xy(t),s=Qy(a),o=$y(a),l=e?o-1:0,u=e?-1:1;if(n<2)for(;;){if(l in s){r=s[l],l+=u;break}if(l+=u,e?l<0:o<=l)throw Zy("Reduce of empty array with no initial value")}for(;e?l>=0:o>l;l+=u)l in s&&(r=i(r,s[l],l,a));return r}},ek={left:Jy(!1),right:Jy(!0)},tk="undefined"!=typeof process&&"process"==E(process),ik=ek.left;Ci({target:"Array",proto:!0,forced:!tk&&pe>79&&pe<83||!ic("reduce")},{reduce:function(e){var t=arguments.length;return ik(this,e,t,t>1?arguments[1]:void 0)}});var nk=Qo("Array").reduce,rk=le,ak=nk,sk=Array.prototype,ok=i((function(e){var t=e.reduce;return e===sk||rk(sk,e)&&t===sk.reduce?ak:t})),lk=te,uk=E,ck=ft("match"),hk=function(e){var t;return lk(e)&&(void 0!==(t=e[ck])?!!t:"RegExp"==uk(e))},dk=TypeError,fk=function(e){if(hk(e))throw dk("The method doesn't accept regular expressions");return e},vk=ft("match"),gk=function(e){var t=/./;try{"/./"[e](t)}catch(i){try{return t[vk]=!1,"/./"[e](t)}catch(n){}}return!1},pk=Ci,mk=b;C.f;var yk=Hi,kk=En,Tk=fk,Ek=X,Sk=gk,_k=mk("".startsWith),bk=mk("".slice),Ak=Math.min;pk({target:"String",proto:!0,forced:!Sk("startsWith")},{startsWith:function(e){var t=kk(Ek(this));Tk(e);var i=yk(Ak(arguments.length>1?arguments[1]:void 0,t.length)),n=kk(e);return _k?_k(t,n,i):bk(t,i,i+n.length)===n}});var Rk=Qo("String").startsWith,Lk=le,Ik=Rk,Ck=String.prototype,wk=i((function(e){var t=e.startsWith;return"string"==typeof e||e===Ck||Lk(Ck,e)&&t===Ck.startsWith?Ik:t})),Dk="\t\n\v\f\r                 \u2028\u2029\ufeff",xk=X,Pk=En,Ok=Dk,Mk=m("".replace),Nk=RegExp("^["+Ok+"]+"),Fk=RegExp("(^|[^"+Ok+"])["+Ok+"]+$"),Uk=function(e){return function(t){var i=Pk(xk(t));return 1&e&&(i=Mk(i,Nk,"")),2&e&&(i=Mk(i,Fk,"$1")),i}},Bk={start:Uk(1),end:Uk(2),trim:Uk(3)},Hk=a,Gk=s,Vk=m,Kk=En,Wk=Bk.trim,jk=Dk,Yk=Hk.parseInt,zk=Hk.Symbol,qk=zk&&zk.iterator,Xk=/^[+-]?0x/i,Qk=Vk(Xk.exec),$k=8!==Yk(jk+"08")||22!==Yk(jk+"0x16")||qk&&!Gk((function(){Yk(Object(qk))}))?function(e,t){var i=Wk(Kk(e));return Yk(i,t>>>0||(Qk(Xk,i)?16:10))}:Yk;Ci({global:!0,forced:parseInt!=$k},{parseInt:$k});var Zk=i(ie.parseInt),Jk=Je,eT=kc,tT=C,iT=Zt,nT=te,rT=mi,aT=Error,sT=m("".replace),oT=String(aT("zxcasd").stack),lT=/\n\s*at [^:]*:[^\n]*/,uT=lT.test(oT),cT=H,hT=!s((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",cT(1,7)),7!==e.stack)})),dT=mi,fT=function(e,t){if(uT&&"string"==typeof e&&!aT.prepareStackTrace)for(;t--;)e=sT(e,lT,"");return e},vT=hT,gT=Error.captureStackTrace,pT=En,mT=Ci,yT=le,kT=zl,TT=ku,ET=function(e,t,i){for(var n=eT(t),r=iT.f,a=tT.f,s=0;s<n.length;s++){var o=n[s];Jk(e,o)||i&&Jk(i,o)||r(e,o,a(t,o))}},ST=zn,_T=mi,bT=H,AT=function(e,t){nT(t)&&"cause"in t&&rT(e,"cause",t.cause)},RT=function(e,t,i,n){vT&&(gT?gT(e,t):dT(e,"stack",fT(i,n)))},LT=Bv,IT=function(e,t){return void 0===e?arguments.length<2?"":t:pT(e)},CT=ft("toStringTag"),wT=Error,DT=[].push,xT=function(e,t){var i,n=yT(PT,this);TT?i=TT(wT(),n?kT(this):PT):(i=n?this:ST(PT),_T(i,CT,"Error")),void 0!==t&&_T(i,"message",IT(t)),RT(i,xT,i.stack,1),arguments.length>2&&AT(i,arguments[2]);var r=[];return LT(e,DT,{that:r}),_T(i,"errors",r),i};TT?TT(xT,wT):ET(xT,wT,{name:!0});var PT=xT.prototype=ST(wT.prototype,{constructor:bT(1,xT),message:bT(1,""),name:bT(1,"AggregateError")});mT({global:!0,constructor:!0,arity:2},{AggregateError:xT});var OT,MT,NT,FT,UT=ni,BT=Dg,HT=Y,GT=ft("species"),VT=function(e,t){var i,n=UT(e).constructor;return void 0===n||HT(i=UT(n)[GT])?t:BT(i)},KT=TypeError,WT=function(e,t){if(e<t)throw KT("Not enough arguments");return e},jT=/(?:ipad|iphone|ipod).*applewebkit/i.test(ue),YT=a,zT=d,qT=$t,XT=I,QT=Je,$T=s,ZT=wn,JT=lo,eE=Lt,tE=WT,iE=jT,nE=tk,rE=YT.setImmediate,aE=YT.clearImmediate,sE=YT.process,oE=YT.Dispatch,lE=YT.Function,uE=YT.MessageChannel,cE=YT.String,hE=0,dE={},fE="onreadystatechange";$T((function(){OT=YT.location}));var vE=function(e){if(QT(dE,e)){var t=dE[e];delete dE[e],t()}},gE=function(e){return function(){vE(e)}},pE=function(e){vE(e.data)},mE=function(e){YT.postMessage(cE(e),OT.protocol+"//"+OT.host)};rE&&aE||(rE=function(e){tE(arguments.length,1);var t=XT(e)?e:lE(e),i=JT(arguments,1);return dE[++hE]=function(){zT(t,void 0,i)},MT(hE),hE},aE=function(e){delete dE[e]},nE?MT=function(e){sE.nextTick(gE(e))}:oE&&oE.now?MT=function(e){oE.now(gE(e))}:uE&&!iE?(FT=(NT=new uE).port2,NT.port1.onmessage=pE,MT=qT(FT.postMessage,FT)):YT.addEventListener&&XT(YT.postMessage)&&!YT.importScripts&&OT&&"file:"!==OT.protocol&&!$T(mE)?(MT=mE,YT.addEventListener("message",pE,!1)):MT=fE in eE("script")?function(e){ZT.appendChild(eE("script"))[fE]=function(){ZT.removeChild(this),vE(e)}}:function(e){setTimeout(gE(e),0)});var yE={set:rE,clear:aE},kE=function(){this.head=null,this.tail=null};kE.prototype={add:function(e){var t={item:e,next:null},i=this.tail;i?i.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 TE,EE,SE,_E,bE,AE=kE,RE=/ipad|iphone|ipod/i.test(ue)&&"undefined"!=typeof Pebble,LE=/web0s(?!.*chrome)/i.test(ue),IE=a,CE=$t,wE=C.f,DE=yE.set,xE=AE,PE=jT,OE=RE,ME=LE,NE=tk,FE=IE.MutationObserver||IE.WebKitMutationObserver,UE=IE.document,BE=IE.process,HE=IE.Promise,GE=wE(IE,"queueMicrotask"),VE=GE&&GE.value;if(!VE){var KE=new xE,WE=function(){var e,t;for(NE&&(e=BE.domain)&&e.exit();t=KE.get();)try{t()}catch(GG){throw KE.head&&TE(),GG}e&&e.enter()};PE||NE||ME||!FE||!UE?!OE&&HE&&HE.resolve?((_E=HE.resolve(void 0)).constructor=HE,bE=CE(_E.then,_E),TE=function(){bE(WE)}):NE?TE=function(){BE.nextTick(WE)}:(DE=CE(DE,IE),TE=function(){DE(WE)}):(EE=!0,SE=UE.createTextNode(""),new FE(WE).observe(SE,{characterData:!0}),TE=function(){SE.data=EE=!EE}),VE=function(e){KE.head||TE(),KE.add(e)}}var jE=VE,YE=function(e){try{return{error:!1,value:e()}}catch(GG){return{error:!0,value:GG}}},zE=a.Promise,qE="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,XE=!qE&&!tk&&"object"==typeof window&&"object"==typeof document,QE=a,$E=zE,ZE=I,JE=zt,eS=ua,tS=ft,iS=XE,nS=qE,rS=pe,aS=$E&&$E.prototype,sS=tS("species"),oS=!1,lS=ZE(QE.PromiseRejectionEvent),uS={CONSTRUCTOR:JE("Promise",(function(){var e=eS($E),t=e!==String($E);if(!t&&66===rS)return!0;if(!aS.catch||!aS.finally)return!0;if(!rS||rS<51||!/native code/.test(e)){var i=new $E((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((i.constructor={})[sS]=n,!(oS=i.then((function(){}))instanceof n))return!0}return!t&&(iS||nS)&&!lS})),REJECTION_EVENT:lS,SUBCLASSING:oS},cS={},hS=xe,dS=TypeError,fS=function(e){var t,i;this.promise=new e((function(e,n){if(void 0!==t||void 0!==i)throw dS("Bad Promise constructor");t=e,i=n})),this.resolve=hS(t),this.reject=hS(i)};cS.f=function(e){return new fS(e)};var vS,gS,pS=Ci,mS=tk,yS=a,kS=P,TS=gr,ES=Gr,SS=hg,_S=xe,bS=I,AS=te,RS=Vv,LS=VT,IS=yE.set,CS=jE,wS=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(GG){}},DS=YE,xS=AE,PS=na,OS=zE,MS=uS,NS=cS,FS="Promise",US=MS.CONSTRUCTOR,BS=MS.REJECTION_EVENT,HS=PS.getterFor(FS),GS=PS.set,VS=OS&&OS.prototype,KS=OS,WS=VS,jS=yS.TypeError,YS=yS.document,zS=yS.process,qS=NS.f,XS=qS,QS=!!(YS&&YS.createEvent&&yS.dispatchEvent),$S="unhandledrejection",ZS=function(e){var t;return!(!AS(e)||!bS(t=e.then))&&t},JS=function(e,t){var i,n,r,a=t.value,s=1==t.state,o=s?e.ok:e.fail,l=e.resolve,u=e.reject,c=e.domain;try{o?(s||(2===t.rejection&&r_(t),t.rejection=1),!0===o?i=a:(c&&c.enter(),i=o(a),c&&(c.exit(),r=!0)),i===e.promise?u(jS("Promise-chain cycle")):(n=ZS(i))?kS(n,i,l,u):l(i)):u(a)}catch(GG){c&&!r&&c.exit(),u(GG)}},e_=function(e,t){e.notified||(e.notified=!0,CS((function(){for(var i,n=e.reactions;i=n.get();)JS(i,e);e.notified=!1,t&&!e.rejection&&i_(e)})))},t_=function(e,t,i){var n,r;QS?((n=YS.createEvent("Event")).promise=t,n.reason=i,n.initEvent(e,!1,!0),yS.dispatchEvent(n)):n={promise:t,reason:i},!BS&&(r=yS["on"+e])?r(n):e===$S&&wS("Unhandled promise rejection",i)},i_=function(e){kS(IS,yS,(function(){var t,i=e.facade,n=e.value;if(n_(e)&&(t=DS((function(){mS?zS.emit("unhandledRejection",n,i):t_($S,i,n)})),e.rejection=mS||n_(e)?2:1,t.error))throw t.value}))},n_=function(e){return 1!==e.rejection&&!e.parent},r_=function(e){kS(IS,yS,(function(){var t=e.facade;mS?zS.emit("rejectionHandled",t):t_("rejectionhandled",t,e.value)}))},a_=function(e,t,i){return function(n){e(t,n,i)}},s_=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,e_(e,!0))},o_=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw jS("Promise can't be resolved itself");var n=ZS(t);n?CS((function(){var i={done:!1};try{kS(n,t,a_(o_,i,e),a_(s_,i,e))}catch(GG){s_(i,GG,e)}})):(e.value=t,e.state=1,e_(e,!1))}catch(GG){s_({done:!1},GG,e)}}};US&&(WS=(KS=function(e){RS(this,WS),_S(e),kS(vS,this);var t=HS(this);try{e(a_(o_,t),a_(s_,t))}catch(GG){s_(t,GG)}}).prototype,(vS=function(e){GS(this,{type:FS,done:!1,notified:!1,parent:!1,reactions:new xS,rejection:!1,state:0,value:void 0})}).prototype=TS(WS,"then",(function(e,t){var i=HS(this),n=qS(LS(this,KS));return i.parent=!0,n.ok=!bS(e)||e,n.fail=bS(t)&&t,n.domain=mS?zS.domain:void 0,0==i.state?i.reactions.add(n):CS((function(){JS(n,i)})),n.promise})),gS=function(){var e=new vS,t=HS(e);this.promise=e,this.resolve=a_(o_,t),this.reject=a_(s_,t)},NS.f=qS=function(e){return e===KS||undefined===e?new gS(e):XS(e)}),pS({global:!0,constructor:!0,wrap:!0,forced:US},{Promise:KS}),ES(KS,FS,!1,!0),SS(FS);var l_=zE,u_=uS.CONSTRUCTOR||!hf((function(e){l_.all(e).then(void 0,(function(){}))})),c_=P,h_=xe,d_=cS,f_=YE,v_=Bv;Ci({target:"Promise",stat:!0,forced:u_},{all:function(e){var t=this,i=d_.f(t),n=i.resolve,r=i.reject,a=f_((function(){var i=h_(t.resolve),a=[],s=0,o=1;v_(e,(function(e){var l=s++,u=!1;o++,c_(i,t,e).then((function(e){u||(u=!0,a[l]=e,--o||n(a))}),r)})),--o||n(a)}));return a.error&&r(a.value),i.promise}});var g_=Ci,p_=uS.CONSTRUCTOR;zE&&zE.prototype,g_({target:"Promise",proto:!0,forced:p_,real:!0},{catch:function(e){return this.then(void 0,e)}});var m_=P,y_=xe,k_=cS,T_=YE,E_=Bv;Ci({target:"Promise",stat:!0,forced:u_},{race:function(e){var t=this,i=k_.f(t),n=i.reject,r=T_((function(){var r=y_(t.resolve);E_(e,(function(e){m_(r,t,e).then(i.resolve,n)}))}));return r.error&&n(r.value),i.promise}});var S_=P,__=cS;Ci({target:"Promise",stat:!0,forced:uS.CONSTRUCTOR},{reject:function(e){var t=__.f(this);return S_(t.reject,void 0,e),t.promise}});var b_=ni,A_=te,R_=cS,L_=function(e,t){if(b_(e),A_(t)&&t.constructor===e)return t;var i=R_.f(e);return(0,i.resolve)(t),i.promise},I_=Ci,C_=zE,w_=uS.CONSTRUCTOR,D_=L_,x_=oe("Promise"),P_=!w_;I_({target:"Promise",stat:!0,forced:true},{resolve:function(e){return D_(P_&&this===x_?C_:this,e)}});var O_=P,M_=xe,N_=cS,F_=YE,U_=Bv;Ci({target:"Promise",stat:!0,forced:u_},{allSettled:function(e){var t=this,i=N_.f(t),n=i.resolve,r=i.reject,a=F_((function(){var i=M_(t.resolve),r=[],a=0,s=1;U_(e,(function(e){var o=a++,l=!1;s++,O_(i,t,e).then((function(e){l||(l=!0,r[o]={status:"fulfilled",value:e},--s||n(r))}),(function(e){l||(l=!0,r[o]={status:"rejected",reason:e},--s||n(r))}))})),--s||n(r)}));return a.error&&r(a.value),i.promise}});var B_=P,H_=xe,G_=oe,V_=cS,K_=YE,W_=Bv,j_="No one promise resolved";Ci({target:"Promise",stat:!0,forced:u_},{any:function(e){var t=this,i=G_("AggregateError"),n=V_.f(t),r=n.resolve,a=n.reject,s=K_((function(){var n=H_(t.resolve),s=[],o=0,l=1,u=!1;W_(e,(function(e){var c=o++,h=!1;l++,B_(n,t,e).then((function(e){h||u||(u=!0,r(e))}),(function(e){h||u||(h=!0,s[c]=e,--l||a(new i(s,j_)))}))})),--l||a(new i(s,j_))}));return s.error&&a(s.value),n.promise}});var Y_=Ci,z_=zE,q_=s,X_=oe,Q_=I,$_=VT,Z_=L_,J_=z_&&z_.prototype;Y_({target:"Promise",proto:!0,real:!0,forced:!!z_&&q_((function(){J_.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=$_(this,X_("Promise")),i=Q_(e);return this.then(i?function(i){return Z_(t,e()).then((function(){return i}))}:e,i?function(i){return Z_(t,e()).then((function(){throw i}))}:e)}});var eb=ie.Promise,tb=cS,ib=YE;Ci({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=tb.f(this),i=ib(e);return(i.error?t.reject:t.resolve)(i.value),t.promise}});var nb=i(eb),rb=Ua.map;Ci({target:"Array",proto:!0,forced:!zo("map")},{map:function(e){return rb(this,e,arguments.length>1?arguments[1]:void 0)}});var ab=Qo("Array").map,sb=le,ob=ab,lb=Array.prototype,ub=i((function(e){var t=e.map;return e===lb||sb(lb,e)&&t===lb.map?ob:t})),cb=a,hb=s,db=En,fb=Bk.trim,vb=Dk,gb=m("".charAt),pb=cb.parseFloat,mb=cb.Symbol,yb=mb&&mb.iterator,kb=1/pb(vb+"-0")!=-1/0||yb&&!hb((function(){pb(Object(yb))}))?function(e){var t=fb(db(e)),i=pb(t);return 0===i&&"-"==gb(t,0)?-0:i}:pb;Ci({global:!0,forced:parseFloat!=kb},{parseFloat:kb});var Tb=i(ie.parseFloat),Eb=s,Sb=ft("iterator"),_b=!Eb((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,i="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),i+=n+e})),!e.toJSON||!t.size&&true||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[Sb]||"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"!==i||"x"!==new URL("http://x",void 0).host})),bb=m,Ab=2147483647,Rb=/[^\0-\u007E]/,Lb=/[.\u3002\uFF0E\uFF61]/g,Ib="Overflow: input needs wider integers to process",Cb=RangeError,wb=bb(Lb.exec),Db=Math.floor,xb=String.fromCharCode,Pb=bb("".charCodeAt),Ob=bb([].join),Mb=bb([].push),Nb=bb("".replace),Fb=bb("".split),Ub=bb("".toLowerCase),Bb=function(e){return e+22+75*(e<26)},Hb=function(e,t,i){var n=0;for(e=i?Db(e/700):e>>1,e+=Db(e/t);e>455;)e=Db(e/35),n+=36;return Db(n+36*e/(e+38))},Gb=function(e){var t=[];e=function(e){for(var t=[],i=0,n=e.length;i<n;){var r=Pb(e,i++);if(r>=55296&&r<=56319&&i<n){var a=Pb(e,i++);56320==(64512&a)?Mb(t,((1023&r)<<10)+(1023&a)+65536):(Mb(t,r),i--)}else Mb(t,r)}return t}(e);var i,n,r=e.length,a=128,s=0,o=72;for(i=0;i<e.length;i++)(n=e[i])<128&&Mb(t,xb(n));var l=t.length,u=l;for(l&&Mb(t,"-");u<r;){var c=Ab;for(i=0;i<e.length;i++)(n=e[i])>=a&&n<c&&(c=n);var h=u+1;if(c-a>Db((Ab-s)/h))throw Cb(Ib);for(s+=(c-a)*h,a=c,i=0;i<e.length;i++){if((n=e[i])<a&&++s>Ab)throw Cb(Ib);if(n==a){for(var d=s,f=36;;){var v=f<=o?1:f>=o+26?26:f-o;if(d<v)break;var g=d-v,p=36-v;Mb(t,xb(Bb(v+g%p))),d=Db(g/p),f+=36}Mb(t,xb(Bb(d))),o=Hb(s,h,u==l),s=0,u++}}s++,a++}return Ob(t,"")},Vb=or,Kb=Math.floor,Wb=function(e,t){var i=e.length,n=Kb(i/2);return i<8?jb(e,t):Yb(e,Wb(Vb(e,0,n),t),Wb(Vb(e,n),t),t)},jb=function(e,t){for(var i,n,r=e.length,a=1;a<r;){for(n=a,i=e[a];n&&t(e[n-1],i)>0;)e[n]=e[--n];n!==a++&&(e[n]=i)}return e},Yb=function(e,t,i,n){for(var r=t.length,a=i.length,s=0,o=0;s<r||o<a;)e[s+o]=s<r&&o<a?n(t[s],i[o])<=0?t[s++]:i[o++]:s<r?t[s++]:i[o++];return e},zb=Wb,qb=Ci,Xb=a,Qb=P,$b=m,Zb=w,Jb=_b,eA=gr,tA=mr,iA=sg,nA=Gr,rA=cu,aA=na,sA=Vv,oA=I,lA=Je,uA=$t,cA=yn,hA=ni,dA=te,fA=En,vA=zn,gA=H,pA=zd,mA=sd,yA=WT,kA=zb,TA=ft("iterator"),EA="URLSearchParams",SA=EA+"Iterator",_A=aA.set,bA=aA.getterFor(EA),AA=aA.getterFor(SA),RA=Object.getOwnPropertyDescriptor,LA=function(e){if(!Zb)return Xb[e];var t=RA(Xb,e);return t&&t.value},IA=LA("fetch"),CA=LA("Request"),wA=LA("Headers"),DA=CA&&CA.prototype,xA=wA&&wA.prototype,PA=Xb.RegExp,OA=Xb.TypeError,MA=Xb.decodeURIComponent,NA=Xb.encodeURIComponent,FA=$b("".charAt),UA=$b([].join),BA=$b([].push),HA=$b("".replace),GA=$b([].shift),VA=$b([].splice),KA=$b("".split),WA=$b("".slice),jA=/\+/g,YA=Array(4),zA=function(e){return YA[e-1]||(YA[e-1]=PA("((?:%[\\da-f]{2}){"+e+"})","gi"))},qA=function(e){try{return MA(e)}catch(GG){return e}},XA=function(e){var t=HA(e,jA," "),i=4;try{return MA(t)}catch(GG){for(;i;)t=HA(t,zA(i--),qA);return t}},QA=/[!'()~]|%20/g,$A={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},ZA=function(e){return $A[e]},JA=function(e){return HA(NA(e),QA,ZA)},eR=rA((function(e,t){_A(this,{type:SA,iterator:pA(bA(e).entries),kind:t})}),"Iterator",(function(){var e=AA(this),t=e.kind,i=e.iterator.next(),n=i.value;return i.done||(i.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),i}),!0),tR=function(e){this.entries=[],this.url=null,void 0!==e&&(dA(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===FA(e,0)?WA(e,1):e:fA(e)))};tR.prototype={type:EA,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,n,r,a,s,o,l=mA(e);if(l)for(i=(t=pA(e,l)).next;!(n=Qb(i,t)).done;){if(a=(r=pA(hA(n.value))).next,(s=Qb(a,r)).done||(o=Qb(a,r)).done||!Qb(a,r).done)throw OA("Expected sequence with length 2");BA(this.entries,{key:fA(s.value),value:fA(o.value)})}else for(var u in e)lA(e,u)&&BA(this.entries,{key:u,value:fA(e[u])})},parseQuery:function(e){if(e)for(var t,i,n=KA(e,"&"),r=0;r<n.length;)(t=n[r++]).length&&(i=KA(t,"="),BA(this.entries,{key:XA(GA(i)),value:XA(UA(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],n=0;n<t.length;)e=t[n++],BA(i,JA(e.key)+"="+JA(e.value));return UA(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var iR=function(){sA(this,nR);var e=_A(this,new tR(arguments.length>0?arguments[0]:void 0));Zb||(this.length=e.entries.length)},nR=iR.prototype;if(iA(nR,{append:function(e,t){yA(arguments.length,2);var i=bA(this);BA(i.entries,{key:fA(e),value:fA(t)}),Zb||this.length++,i.updateURL()},delete:function(e){yA(arguments.length,1);for(var t=bA(this),i=t.entries,n=fA(e),r=0;r<i.length;)i[r].key===n?VA(i,r,1):r++;Zb||(this.length=i.length),t.updateURL()},get:function(e){yA(arguments.length,1);for(var t=bA(this).entries,i=fA(e),n=0;n<t.length;n++)if(t[n].key===i)return t[n].value;return null},getAll:function(e){yA(arguments.length,1);for(var t=bA(this).entries,i=fA(e),n=[],r=0;r<t.length;r++)t[r].key===i&&BA(n,t[r].value);return n},has:function(e){yA(arguments.length,1);for(var t=bA(this).entries,i=fA(e),n=0;n<t.length;)if(t[n++].key===i)return!0;return!1},set:function(e,t){yA(arguments.length,1);for(var i,n=bA(this),r=n.entries,a=!1,s=fA(e),o=fA(t),l=0;l<r.length;l++)(i=r[l]).key===s&&(a?VA(r,l--,1):(a=!0,i.value=o));a||BA(r,{key:s,value:o}),Zb||(this.length=r.length),n.updateURL()},sort:function(){var e=bA(this);kA(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=bA(this).entries,n=uA(e,arguments.length>1?arguments[1]:void 0),r=0;r<i.length;)n((t=i[r++]).value,t.key,this)},keys:function(){return new eR(this,"keys")},values:function(){return new eR(this,"values")},entries:function(){return new eR(this,"entries")}},{enumerable:!0}),eA(nR,TA,nR.entries,{name:"entries"}),eA(nR,"toString",(function(){return bA(this).serialize()}),{enumerable:!0}),Zb&&tA(nR,"size",{get:function(){return bA(this).entries.length},configurable:!0,enumerable:!0}),nA(iR,EA),qb({global:!0,constructor:!0,forced:!Jb},{URLSearchParams:iR}),!Jb&&oA(wA)){var rR=$b(xA.has),aR=$b(xA.set),sR=function(e){if(dA(e)){var t,i=e.body;if(cA(i)===EA)return t=e.headers?new wA(e.headers):new wA,rR(t,"content-type")||aR(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),vA(e,{body:gA(0,fA(i)),headers:gA(0,t)})}return e};if(oA(IA)&&qb({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return IA(e,arguments.length>1?sR(arguments[1]):{})}}),oA(CA)){var oR=function(e){return sA(this,DA),new CA(e,arguments.length>1?sR(arguments[1]):{})};DA.constructor=oR,oR.prototype=DA,qb({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:oR})}}var lR,uR=Ci,cR=w,hR=_b,dR=a,fR=$t,vR=m,gR=gr,pR=mr,mR=Vv,yR=Je,kR=Ay,TR=sf,ER=or,SR=Fh.codeAt,_R=function(e){var t,i,n=[],r=Fb(Nb(Ub(e),Lb,"."),".");for(t=0;t<r.length;t++)i=r[t],Mb(n,wb(Rb,i)?"xn--"+Gb(i):i);return Ob(n,".")},bR=En,AR=Gr,RR=WT,LR={URLSearchParams:iR,getState:bA},IR=na,CR=IR.set,wR=IR.getterFor("URL"),DR=LR.URLSearchParams,xR=LR.getState,PR=dR.URL,OR=dR.TypeError,MR=dR.parseInt,NR=Math.floor,FR=Math.pow,UR=vR("".charAt),BR=vR(/./.exec),HR=vR([].join),GR=vR(1..toString),VR=vR([].pop),KR=vR([].push),WR=vR("".replace),jR=vR([].shift),YR=vR("".split),zR=vR("".slice),qR=vR("".toLowerCase),XR=vR([].unshift),QR="Invalid scheme",$R="Invalid host",ZR="Invalid port",JR=/[a-z]/i,eL=/[\d+-.a-z]/i,tL=/\d/,iL=/^0x/i,nL=/^[0-7]+$/,rL=/^\d+$/,aL=/^[\da-f]+$/i,sL=/[\0\t\n\r #%/:<>?@[\\\]^|]/,oL=/[\0\t\n\r #/:<>?@[\\\]^|]/,lL=/^[\u0000-\u0020]+/,uL=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,cL=/[\t\n\r]/g,hL=function(e){var t,i,n,r;if("number"==typeof e){for(t=[],i=0;i<4;i++)XR(t,e%256),e=NR(e/256);return HR(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,i=1,n=null,r=0,a=0;a<8;a++)0!==e[a]?(r>i&&(t=n,i=r),n=null,r=0):(null===n&&(n=a),++r);return r>i&&(t=n,i=r),t}(e),i=0;i<8;i++)r&&0===e[i]||(r&&(r=!1),n===i?(t+=i?":":"::",r=!0):(t+=GR(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},dL={},fL=kR({},dL,{" ":1,'"':1,"<":1,">":1,"`":1}),vL=kR({},fL,{"#":1,"?":1,"{":1,"}":1}),gL=kR({},vL,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),pL=function(e,t){var i=SR(e,0);return i>32&&i<127&&!yR(t,e)?e:encodeURIComponent(e)},mL={ftp:21,file:null,http:80,https:443,ws:80,wss:443},yL=function(e,t){var i;return 2==e.length&&BR(JR,UR(e,0))&&(":"==(i=UR(e,1))||!t&&"|"==i)},kL=function(e){var t;return e.length>1&&yL(zR(e,0,2))&&(2==e.length||"/"===(t=UR(e,2))||"\\"===t||"?"===t||"#"===t)},TL=function(e){return"."===e||"%2e"===qR(e)},EL={},SL={},_L={},bL={},AL={},RL={},LL={},IL={},CL={},wL={},DL={},xL={},PL={},OL={},ML={},NL={},FL={},UL={},BL={},HL={},GL={},VL=function(e,t,i){var n,r,a,s=bR(e);if(t){if(r=this.parse(s))throw OR(r);this.searchParams=null}else{if(void 0!==i&&(n=new VL(i,!0)),r=this.parse(s,null,n))throw OR(r);(a=xR(new DR)).bindURL(this),this.searchParams=a}};VL.prototype={type:"URL",parse:function(e,t,i){var n,r,a,s,o,l=this,u=t||EL,c=0,h="",d=!1,f=!1,v=!1;for(e=bR(e),t||(l.scheme="",l.username="",l.password="",l.host=null,l.port=null,l.path=[],l.query=null,l.fragment=null,l.cannotBeABaseURL=!1,e=WR(e,lL,""),e=WR(e,uL,"$1")),e=WR(e,cL,""),n=TR(e);c<=n.length;){switch(r=n[c],u){case EL:if(!r||!BR(JR,r)){if(t)return QR;u=_L;continue}h+=qR(r),u=SL;break;case SL:if(r&&(BR(eL,r)||"+"==r||"-"==r||"."==r))h+=qR(r);else{if(":"!=r){if(t)return QR;h="",u=_L,c=0;continue}if(t&&(l.isSpecial()!=yR(mL,h)||"file"==h&&(l.includesCredentials()||null!==l.port)||"file"==l.scheme&&!l.host))return;if(l.scheme=h,t)return void(l.isSpecial()&&mL[l.scheme]==l.port&&(l.port=null));h="","file"==l.scheme?u=OL:l.isSpecial()&&i&&i.scheme==l.scheme?u=bL:l.isSpecial()?u=IL:"/"==n[c+1]?(u=AL,c++):(l.cannotBeABaseURL=!0,KR(l.path,""),u=BL)}break;case _L:if(!i||i.cannotBeABaseURL&&"#"!=r)return QR;if(i.cannotBeABaseURL&&"#"==r){l.scheme=i.scheme,l.path=ER(i.path),l.query=i.query,l.fragment="",l.cannotBeABaseURL=!0,u=GL;break}u="file"==i.scheme?OL:RL;continue;case bL:if("/"!=r||"/"!=n[c+1]){u=RL;continue}u=CL,c++;break;case AL:if("/"==r){u=wL;break}u=UL;continue;case RL:if(l.scheme=i.scheme,r==lR)l.username=i.username,l.password=i.password,l.host=i.host,l.port=i.port,l.path=ER(i.path),l.query=i.query;else if("/"==r||"\\"==r&&l.isSpecial())u=LL;else if("?"==r)l.username=i.username,l.password=i.password,l.host=i.host,l.port=i.port,l.path=ER(i.path),l.query="",u=HL;else{if("#"!=r){l.username=i.username,l.password=i.password,l.host=i.host,l.port=i.port,l.path=ER(i.path),l.path.length--,u=UL;continue}l.username=i.username,l.password=i.password,l.host=i.host,l.port=i.port,l.path=ER(i.path),l.query=i.query,l.fragment="",u=GL}break;case LL:if(!l.isSpecial()||"/"!=r&&"\\"!=r){if("/"!=r){l.username=i.username,l.password=i.password,l.host=i.host,l.port=i.port,u=UL;continue}u=wL}else u=CL;break;case IL:if(u=CL,"/"!=r||"/"!=UR(h,c+1))continue;c++;break;case CL:if("/"!=r&&"\\"!=r){u=wL;continue}break;case wL:if("@"==r){d&&(h="%40"+h),d=!0,a=TR(h);for(var g=0;g<a.length;g++){var p=a[g];if(":"!=p||v){var m=pL(p,gL);v?l.password+=m:l.username+=m}else v=!0}h=""}else if(r==lR||"/"==r||"?"==r||"#"==r||"\\"==r&&l.isSpecial()){if(d&&""==h)return"Invalid authority";c-=TR(h).length+1,h="",u=DL}else h+=r;break;case DL:case xL:if(t&&"file"==l.scheme){u=NL;continue}if(":"!=r||f){if(r==lR||"/"==r||"?"==r||"#"==r||"\\"==r&&l.isSpecial()){if(l.isSpecial()&&""==h)return $R;if(t&&""==h&&(l.includesCredentials()||null!==l.port))return;if(s=l.parseHost(h))return s;if(h="",u=FL,t)return;continue}"["==r?f=!0:"]"==r&&(f=!1),h+=r}else{if(""==h)return $R;if(s=l.parseHost(h))return s;if(h="",u=PL,t==xL)return}break;case PL:if(!BR(tL,r)){if(r==lR||"/"==r||"?"==r||"#"==r||"\\"==r&&l.isSpecial()||t){if(""!=h){var y=MR(h,10);if(y>65535)return ZR;l.port=l.isSpecial()&&y===mL[l.scheme]?null:y,h=""}if(t)return;u=FL;continue}return ZR}h+=r;break;case OL:if(l.scheme="file","/"==r||"\\"==r)u=ML;else{if(!i||"file"!=i.scheme){u=UL;continue}if(r==lR)l.host=i.host,l.path=ER(i.path),l.query=i.query;else if("?"==r)l.host=i.host,l.path=ER(i.path),l.query="",u=HL;else{if("#"!=r){kL(HR(ER(n,c),""))||(l.host=i.host,l.path=ER(i.path),l.shortenPath()),u=UL;continue}l.host=i.host,l.path=ER(i.path),l.query=i.query,l.fragment="",u=GL}}break;case ML:if("/"==r||"\\"==r){u=NL;break}i&&"file"==i.scheme&&!kL(HR(ER(n,c),""))&&(yL(i.path[0],!0)?KR(l.path,i.path[0]):l.host=i.host),u=UL;continue;case NL:if(r==lR||"/"==r||"\\"==r||"?"==r||"#"==r){if(!t&&yL(h))u=UL;else if(""==h){if(l.host="",t)return;u=FL}else{if(s=l.parseHost(h))return s;if("localhost"==l.host&&(l.host=""),t)return;h="",u=FL}continue}h+=r;break;case FL:if(l.isSpecial()){if(u=UL,"/"!=r&&"\\"!=r)continue}else if(t||"?"!=r)if(t||"#"!=r){if(r!=lR&&(u=UL,"/"!=r))continue}else l.fragment="",u=GL;else l.query="",u=HL;break;case UL:if(r==lR||"/"==r||"\\"==r&&l.isSpecial()||!t&&("?"==r||"#"==r)){if(".."===(o=qR(o=h))||"%2e."===o||".%2e"===o||"%2e%2e"===o?(l.shortenPath(),"/"==r||"\\"==r&&l.isSpecial()||KR(l.path,"")):TL(h)?"/"==r||"\\"==r&&l.isSpecial()||KR(l.path,""):("file"==l.scheme&&!l.path.length&&yL(h)&&(l.host&&(l.host=""),h=UR(h,0)+":"),KR(l.path,h)),h="","file"==l.scheme&&(r==lR||"?"==r||"#"==r))for(;l.path.length>1&&""===l.path[0];)jR(l.path);"?"==r?(l.query="",u=HL):"#"==r&&(l.fragment="",u=GL)}else h+=pL(r,vL);break;case BL:"?"==r?(l.query="",u=HL):"#"==r?(l.fragment="",u=GL):r!=lR&&(l.path[0]+=pL(r,dL));break;case HL:t||"#"!=r?r!=lR&&("'"==r&&l.isSpecial()?l.query+="%27":l.query+="#"==r?"%23":pL(r,dL)):(l.fragment="",u=GL);break;case GL:r!=lR&&(l.fragment+=pL(r,fL))}c++}},parseHost:function(e){var t,i,n;if("["==UR(e,0)){if("]"!=UR(e,e.length-1))return $R;if(t=function(e){var t,i,n,r,a,s,o,l=[0,0,0,0,0,0,0,0],u=0,c=null,h=0,d=function(){return UR(e,h)};if(":"==d()){if(":"!=UR(e,1))return;h+=2,c=++u}for(;d();){if(8==u)return;if(":"!=d()){for(t=i=0;i<4&&BR(aL,d());)t=16*t+MR(d(),16),h++,i++;if("."==d()){if(0==i)return;if(h-=i,u>6)return;for(n=0;d();){if(r=null,n>0){if(!("."==d()&&n<4))return;h++}if(!BR(tL,d()))return;for(;BR(tL,d());){if(a=MR(d(),10),null===r)r=a;else{if(0==r)return;r=10*r+a}if(r>255)return;h++}l[u]=256*l[u]+r,2!=++n&&4!=n||u++}if(4!=n)return;break}if(":"==d()){if(h++,!d())return}else if(d())return;l[u++]=t}else{if(null!==c)return;h++,c=++u}}if(null!==c)for(s=u-c,u=7;0!=u&&s>0;)o=l[u],l[u--]=l[c+s-1],l[c+--s]=o;else if(8!=u)return;return l}(zR(e,1,-1)),!t)return $R;this.host=t}else if(this.isSpecial()){if(e=_R(e),BR(sL,e))return $R;if(t=function(e){var t,i,n,r,a,s,o,l=YR(e,".");if(l.length&&""==l[l.length-1]&&l.length--,(t=l.length)>4)return e;for(i=[],n=0;n<t;n++){if(""==(r=l[n]))return e;if(a=10,r.length>1&&"0"==UR(r,0)&&(a=BR(iL,r)?16:8,r=zR(r,8==a?1:2)),""===r)s=0;else{if(!BR(10==a?rL:8==a?nL:aL,r))return e;s=MR(r,a)}KR(i,s)}for(n=0;n<t;n++)if(s=i[n],n==t-1){if(s>=FR(256,5-t))return null}else if(s>255)return null;for(o=VR(i),n=0;n<i.length;n++)o+=i[n]*FR(256,3-n);return o}(e),null===t)return $R;this.host=t}else{if(BR(oL,e))return $R;for(t="",i=TR(e),n=0;n<i.length;n++)t+=pL(i[n],dL);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return yR(mL,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&yL(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,n=e.password,r=e.host,a=e.port,s=e.path,o=e.query,l=e.fragment,u=t+":";return null!==r?(u+="//",e.includesCredentials()&&(u+=i+(n?":"+n:"")+"@"),u+=hL(r),null!==a&&(u+=":"+a)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?s[0]:s.length?"/"+HR(s,"/"):"",null!==o&&(u+="?"+o),null!==l&&(u+="#"+l),u},setHref:function(e){var t=this.parse(e);if(t)throw OR(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new KL(e.path[0]).origin}catch(GG){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+hL(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(bR(e)+":",EL)},getUsername:function(){return this.username},setUsername:function(e){var t=TR(bR(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=pL(t[i],gL)}},getPassword:function(){return this.password},setPassword:function(e){var t=TR(bR(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=pL(t[i],gL)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?hL(e):hL(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,DL)},getHostname:function(){var e=this.host;return null===e?"":hL(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,xL)},getPort:function(){var e=this.port;return null===e?"":bR(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=bR(e))?this.port=null:this.parse(e,PL))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+HR(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,FL))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=bR(e))?this.query=null:("?"==UR(e,0)&&(e=zR(e,1)),this.query="",this.parse(e,HL)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=bR(e))?("#"==UR(e,0)&&(e=zR(e,1)),this.fragment="",this.parse(e,GL)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var KL=function(e){var t=mR(this,WL),i=RR(arguments.length,1)>1?arguments[1]:void 0,n=CR(t,new VL(e,!1,i));cR||(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())},WL=KL.prototype,jL=function(e,t){return{get:function(){return wR(this)[e]()},set:t&&function(e){return wR(this)[t](e)},configurable:!0,enumerable:!0}};if(cR&&(pR(WL,"href",jL("serialize","setHref")),pR(WL,"origin",jL("getOrigin")),pR(WL,"protocol",jL("getProtocol","setProtocol")),pR(WL,"username",jL("getUsername","setUsername")),pR(WL,"password",jL("getPassword","setPassword")),pR(WL,"host",jL("getHost","setHost")),pR(WL,"hostname",jL("getHostname","setHostname")),pR(WL,"port",jL("getPort","setPort")),pR(WL,"pathname",jL("getPathname","setPathname")),pR(WL,"search",jL("getSearch","setSearch")),pR(WL,"searchParams",jL("getSearchParams")),pR(WL,"hash",jL("getHash","setHash"))),gR(WL,"toJSON",(function(){return wR(this).serialize()}),{enumerable:!0}),gR(WL,"toString",(function(){return wR(this).serialize()}),{enumerable:!0}),PR){var YL=PR.createObjectURL,zL=PR.revokeObjectURL;YL&&gR(KL,"createObjectURL",fR(YL,PR)),zL&&gR(KL,"revokeObjectURL",fR(zL,PR))}AR(KL,"URL"),uR({global:!0,constructor:!0,forced:!hR,sham:!cR},{URL:KL});var qL=Ci,XL=s,QL=WT,$L=En,ZL=_b,JL=oe("URL");qL({target:"URL",stat:!0,forced:!(ZL&&XL((function(){JL.canParse()})))},{canParse:function(e){var t=QL(arguments.length,1),i=$L(e),n=t<2||void 0===arguments[1]?void 0:$L(arguments[1]);try{return!!new JL(i,n)}catch(GG){return!1}}});var eI,tI=i(ie.URL),iI=i(Cd),nI="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,rI=a,aI=d,sI=I,oI=nI,lI=ue,uI=lo,cI=WT,hI=rI.Function,dI=/MSIE .\./.test(lI)||oI&&((eI=rI.Bun.version.split(".")).length<3||0==eI[0]&&(eI[1]<3||3==eI[1]&&0==eI[2])),fI=function(e,t){var i=t?2:1;return dI?function(n,r){var a=cI(arguments.length,1)>i,s=sI(n)?n:hI(n),o=a?uI(arguments,i):[],l=a?function(){aI(s,this,o)}:s;return t?e(l,r):e(l)}:e},vI=Ci,gI=a,pI=fI(gI.setInterval,!0);vI({global:!0,bind:!0,forced:gI.setInterval!==pI},{setInterval:pI});var mI=Ci,yI=a,kI=fI(yI.setTimeout,!0);mI({global:!0,bind:!0,forced:yI.setTimeout!==kI},{setTimeout:kI});var TI=i(ie.setInterval),EI=ie,SI=d;EI.JSON||(EI.JSON={stringify:JSON.stringify});var _I=function(e,t,i){return SI(EI.JSON.stringify,null,arguments)},bI=i(_I),AI=ni,RI=P,LI=Je,II=le,CI=function(){var e=AI(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},wI=RegExp.prototype,DI=le,xI=function(e){var t=e.flags;return void 0!==t||"flags"in wI||LI(e,"flags")||!II(wI,e)?t:RI(CI,e)},PI=RegExp.prototype,OI=i((function(e){return e===PI||DI(PI,e)?xI(e):e.flags})),MI=i(pm),NI=Ul.PROPER,FI=s,UI=Dk,BI=Bk.trim;Ci({target:"String",proto:!0,forced:function(e){return FI((function(){return!!UI[e]()||"​…᠎"!=="​…᠎"[e]()||NI&&UI[e].name!==e}))}("trim")},{trim:function(){return BI(this)}});var HI=Qo("String").trim,GI=le,VI=HI,KI=String.prototype,WI=i((function(e){var t=e.trim;return"string"==typeof e||e===KI||GI(KI,e)&&t===KI.trim?VI:t})),jI=d,YI=Z,zI=Pi,qI=Vi,XI=ic,QI=Math.min,$I=[].lastIndexOf,ZI=!!$I&&1/[1].lastIndexOf(1,-0)<0,JI=XI("lastIndexOf"),eC=ZI||!JI?function(e){if(ZI)return jI($I,this,arguments)||0;var t=YI(this),i=qI(t),n=i-1;for(arguments.length>1&&(n=QI(n,zI(arguments[1]))),n<0&&(n=i+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:$I;Ci({target:"Array",proto:!0,forced:eC!==[].lastIndexOf},{lastIndexOf:eC});var tC=Qo("Array").lastIndexOf,iC=le,nC=tC,rC=Array.prototype,aC=i((function(e){var t=e.lastIndexOf;return e===rC||iC(rC,e)&&t===rC.lastIndexOf?nC:t})),sC=Ci,oC=aa,lC=m([].reverse),uC=[1,2];sC({target:"Array",proto:!0,forced:String(uC)===String(uC.reverse())},{reverse:function(){return oC(this)&&(this.length=this.length),lC(this)}});var cC=Qo("Array").reverse,hC=le,dC=cC,fC=Array.prototype,vC=i((function(e){var t=e.reverse;return e===fC||hC(fC,e)&&t===fC.reverse?dC:t})),gC=i(ie.setTimeout),pC=Ie,mC=TypeError,yC=function(e,t){if(!delete e[t])throw mC("Cannot delete property "+pC(t)+" of "+pC(e))},kC=ue.match(/firefox\/(\d+)/i),TC=!!kC&&+kC[1],EC=/MSIE|Trident/.test(ue),SC=ue.match(/AppleWebKit\/(\d+)\./),_C=!!SC&&+SC[1],bC=Ci,AC=m,RC=xe,LC=Qe,IC=Vi,CC=yC,wC=En,DC=s,xC=zb,PC=ic,OC=TC,MC=EC,NC=pe,FC=_C,UC=[],BC=AC(UC.sort),HC=AC(UC.push),GC=DC((function(){UC.sort(void 0)})),VC=DC((function(){UC.sort(null)})),KC=PC("sort"),WC=!DC((function(){if(NC)return NC<70;if(!(OC&&OC>3)){if(MC)return!0;if(FC)return FC<603;var e,t,i,n,r="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(n=0;n<47;n++)UC.push({k:t+n,v:i})}for(UC.sort((function(e,t){return t.v-e.v})),n=0;n<UC.length;n++)t=UC[n].k.charAt(0),r.charAt(r.length-1)!==t&&(r+=t);return"DGBEFHACIJK"!==r}}));bC({target:"Array",proto:!0,forced:GC||!VC||!KC||!WC},{sort:function(e){void 0!==e&&RC(e);var t=LC(this);if(WC)return void 0===e?BC(t):BC(t,e);var i,n,r=[],a=IC(t);for(n=0;n<a;n++)n in t&&HC(r,t[n]);for(xC(r,function(e){return function(t,i){return void 0===i?-1:void 0===t?1:void 0!==e?+e(t,i)||0:wC(t)>wC(i)?1:-1}}(e)),i=IC(r),n=0;n<i;)t[n]=r[n++];for(;n<a;)CC(t,n++);return t}});var jC=Qo("Array").sort,YC=le,zC=jC,qC=Array.prototype,XC=i((function(e){var t=e.sort;return e===qC||YC(qC,e)&&t===qC.sort?zC:t})),QC=Ci,$C=Date,ZC=m($C.prototype.getTime);QC({target:"Date",stat:!0},{now:function(){return ZC(new $C)}});var JC=i(ie.Date.now),ew=Ci,tw=Qe,iw=Fi,nw=Pi,rw=Vi,aw=ml,sw=kl,ow=wa,lw=tr,uw=yC,cw=zo("splice"),hw=Math.max,dw=Math.min;ew({target:"Array",proto:!0,forced:!cw},{splice:function(e,t){var i,n,r,a,s,o,l=tw(this),u=rw(l),c=iw(e,u),h=arguments.length;for(0===h?i=n=0:1===h?(i=0,n=u-c):(i=h-2,n=dw(hw(nw(t),0),u-c)),sw(u+i-n),r=ow(l,n),a=0;a<n;a++)(s=c+a)in l&&lw(r,a,l[s]);if(r.length=n,i<n){for(a=c;a<u-n;a++)o=a+i,(s=a+n)in l?l[o]=l[s]:uw(l,o);for(a=u;a>u-n+i;a--)uw(l,a-1)}else if(i>n)for(a=u-n;a>c;a--)o=a+i-1,(s=a+n-1)in l?l[o]=l[s]:uw(l,o);for(a=0;a<i;a++)l[a+c]=arguments[a+2];return aw(l,u-n+i),r}});var fw=Qo("Array").splice,vw=le,gw=fw,pw=Array.prototype,mw=i((function(e){var t=e.splice;return e===pw||vw(pw,e)&&t===pw.splice?gw:t})),yw=i(ff),kw=i(ud);Ci({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{EPSILON:Math.pow(2,-52)});var Tw=i(Math.pow(2,-52)),Ew=i(fm);rg("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Rg);var Sw=ie.Set,_w=Ie,bw=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(_w(e)+" is not a set")},Aw=Wg,Rw=oe("Set"),Lw=Rw.prototype,Iw={Set:Rw,add:Aw("add",1),has:Aw("has",1),remove:Aw("delete",1),proto:Lw},Cw=tp,ww=function(e,t,i){return i?Cw(e.keys(),t):e.forEach(t)},Dw=ww,xw=Iw.Set,Pw=Iw.add,Ow=function(e){var t=new xw;return Dw(e,(function(e){Pw(t,e)})),t},Mw=function(e){return e.size},Nw=xe,Fw=ni,Uw=P,Bw=Pi,Hw=TypeError,Gw=Math.max,Vw=function(e,t,i,n){this.set=e,this.size=t,this.has=i,this.keys=n};Vw.prototype={getIterator:function(){return Fw(Uw(this.keys,this.set))},includes:function(e){return Uw(this.has,this.set,e)}};var Kw=function(e){Fw(e);var t=+e.size;if(t!=t)throw Hw("Invalid size");return new Vw(e,Gw(Bw(t),0),Nw(e.has),Nw(e.keys))},Ww=bw,jw=Ow,Yw=Mw,zw=Kw,qw=ww,Xw=tp,Qw=Iw.has,$w=Iw.remove,Zw=function(e){var t=Ww(this),i=zw(e),n=jw(t);return Yw(t)<=i.size?qw(t,(function(e){i.includes(e)&&$w(n,e)})):Xw(i.getIterator(),(function(e){Qw(t,e)&&$w(n,e)})),n},Jw=function(){return!1},eD=Zw;Ci({target:"Set",proto:!0,real:!0,forced:!Jw()},{difference:eD});var tD=bw,iD=Mw,nD=Kw,rD=ww,aD=tp,sD=Iw.Set,oD=Iw.add,lD=Iw.has,uD=function(e){var t=tD(this),i=nD(e),n=new sD;return iD(t)>i.size?aD(i.getIterator(),(function(e){lD(t,e)&&oD(n,e)})):rD(t,(function(e){i.includes(e)&&oD(n,e)})),n},cD=uD;Ci({target:"Set",proto:!0,real:!0,forced:!Jw()},{intersection:cD});var hD=bw,dD=Iw.has,fD=Mw,vD=Kw,gD=ww,pD=tp,mD=Od,yD=function(e){var t=hD(this),i=vD(e);if(fD(t)<=i.size)return!1!==gD(t,(function(e){if(i.includes(e))return!1}),!0);var n=i.getIterator();return!1!==pD(n,(function(e){if(dD(t,e))return mD(n,"normal",!1)}))},kD=yD;Ci({target:"Set",proto:!0,real:!0,forced:!Jw()},{isDisjointFrom:kD});var TD=bw,ED=Mw,SD=ww,_D=Kw,bD=function(e){var t=TD(this),i=_D(e);return!(ED(t)>i.size)&&!1!==SD(t,(function(e){if(!i.includes(e))return!1}),!0)},AD=bD;Ci({target:"Set",proto:!0,real:!0,forced:!Jw()},{isSubsetOf:AD});var RD=bw,LD=Iw.has,ID=Mw,CD=Kw,wD=tp,DD=Od,xD=function(e){var t=RD(this),i=CD(e);if(ID(t)<i.size)return!1;var n=i.getIterator();return!1!==wD(n,(function(e){if(!LD(t,e))return DD(n,"normal",!1)}))},PD=xD;Ci({target:"Set",proto:!0,real:!0,forced:!Jw()},{isSupersetOf:PD});var OD=bw,MD=Ow,ND=Kw,FD=tp,UD=Iw.add,BD=Iw.has,HD=Iw.remove,GD=function(e){var t=OD(this),i=ND(e).getIterator(),n=MD(t);return FD(i,(function(e){BD(t,e)?HD(n,e):UD(n,e)})),n},VD=GD;Ci({target:"Set",proto:!0,real:!0,forced:!Jw()},{symmetricDifference:VD});var KD=bw,WD=Iw.add,jD=Ow,YD=Kw,zD=tp,qD=function(e){var t=KD(this),i=YD(e).getIterator(),n=jD(t);return zD(i,(function(e){WD(n,e)})),n},XD=qD;Ci({target:"Set",proto:!0,real:!0,forced:!Jw()},{union:XD});var QD=Sw;Ci({target:"Set",stat:!0,forced:!0},{from:Bg}),Ci({target:"Set",stat:!0,forced:!0},{of:Gg});var $D=bw,ZD=Iw.add;Ci({target:"Set",proto:!0,real:!0,forced:!0},{addAll:function(){for(var e=$D(this),t=0,i=arguments.length;t<i;t++)ZD(e,arguments[t]);return e}});var JD=bw,ex=Iw.remove;Ci({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=JD(this),i=!0,n=0,r=arguments.length;n<r;n++)e=ex(t,arguments[n]),i=i&&e;return!!i}});var tx=$t,ix=bw,nx=ww;Ci({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=ix(this),i=tx(e,arguments.length>1?arguments[1]:void 0);return!1!==nx(t,(function(e){if(!i(e,e,t))return!1}),!0)}});var rx=yn,ax=Je,sx=Y,ox=xl,lx=ft("iterator"),ux=Object,cx=I,hx=function(e){if(sx(e))return!1;var t=ux(e);return void 0!==t[lx]||"@@iterator"in t||ax(ox,rx(t))},dx=te,fx=oe("Set"),vx=function(e){return function(e){return dx(e)&&"number"==typeof e.size&&cx(e.has)&&cx(e.keys)}(e)?e:hx(e)?new fx(e):e},gx=P,px=vx,mx=Zw;Ci({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){return gx(mx,this,px(e))}});var yx=$t,kx=bw,Tx=ww,Ex=Iw.Set,Sx=Iw.add;Ci({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=kx(this),i=yx(e,arguments.length>1?arguments[1]:void 0),n=new Ex;return Tx(t,(function(e){i(e,e,t)&&Sx(n,e)})),n}});var _x=$t,bx=bw,Ax=ww;Ci({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=bx(this),i=_x(e,arguments.length>1?arguments[1]:void 0),n=Ax(t,(function(e){if(i(e,e,t))return{value:e}}),!0);return n&&n.value}});var Rx=P,Lx=vx,Ix=uD;Ci({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){return Rx(Ix,this,Lx(e))}});var Cx=P,wx=vx,Dx=yD;Ci({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){return Cx(Dx,this,wx(e))}});var xx=P,Px=vx,Ox=bD;Ci({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){return xx(Ox,this,Px(e))}});var Mx=P,Nx=vx,Fx=xD;Ci({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){return Mx(Fx,this,Nx(e))}});var Ux=Ci,Bx=m,Hx=bw,Gx=ww,Vx=En,Kx=Bx([].join),Wx=Bx([].push);Ux({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=Hx(this),i=void 0===e?",":Vx(e),n=[];return Gx(t,(function(e){Wx(n,e)})),Kx(n,i)}});var jx=$t,Yx=bw,zx=ww,qx=Iw.Set,Xx=Iw.add;Ci({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=Yx(this),i=jx(e,arguments.length>1?arguments[1]:void 0),n=new qx;return zx(t,(function(e){Xx(n,i(e,e,t))})),n}});var Qx=xe,$x=bw,Zx=ww,Jx=TypeError;Ci({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=$x(this),i=arguments.length<2,n=i?void 0:arguments[1];if(Qx(e),Zx(t,(function(r){i?(i=!1,n=r):n=e(n,r,r,t)})),i)throw Jx("Reduce of empty set with no initial value");return n}});var eP=$t,tP=bw,iP=ww;Ci({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=tP(this),i=eP(e,arguments.length>1?arguments[1]:void 0);return!0===iP(t,(function(e){if(i(e,e,t))return!0}),!0)}});var nP=P,rP=vx,aP=GD;Ci({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){return nP(aP,this,rP(e))}});var sP=P,oP=vx,lP=qD;Ci({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){return sP(lP,this,oP(e))}});var uP=i(QD),cP=zi.includes;Ci({target:"Array",proto:!0,forced:s((function(){return!Array(1).includes()}))},{includes:function(e){return cP(this,e,arguments.length>1?arguments[1]:void 0)}});var hP=Qo("Array").includes,dP=Ci,fP=fk,vP=X,gP=En,pP=gk,mP=m("".indexOf);dP({target:"String",proto:!0,forced:!pP("includes")},{includes:function(e){return!!~mP(gP(vP(this)),gP(fP(e)),arguments.length>1?arguments[1]:void 0)}});var yP=Qo("String").includes,kP=le,TP=hP,EP=yP,SP=Array.prototype,_P=String.prototype,bP=i((function(e){var t=e.includes;return e===SP||kP(SP,e)&&t===SP.includes?TP:"string"==typeof e||e===_P||kP(_P,e)&&t===_P.includes?EP:t}));Ci({target:"Number",stat:!0},{isInteger:ay});var AP=i(ie.Number.isInteger),RP=w,LP=m,IP=an,CP=Z,wP=LP(O.f),DP=LP([].push),xP=function(e){return function(t){for(var i,n=CP(t),r=IP(n),a=r.length,s=0,o=[];a>s;)i=r[s++],RP&&!wP(n,i)||DP(o,e?[i,n[i]]:n[i]);return o}},PP={entries:xP(!0),values:xP(!1)}.entries;Ci({target:"Object",stat:!0},{entries:function(e){return PP(e)}});var OP=i(ie.Object.entries),MP=Qo("Array").entries,NP=yn,FP=Je,UP=le,BP=MP,HP=Array.prototype,GP={DOMTokenList:!0,NodeList:!0},VP=i((function(e){var t=e.entries;return e===HP||UP(HP,e)&&t===HP.entries||FP(GP,NP(e))?BP:t})),KP=Ci,WP=Ua.find,jP="find",YP=!0;jP in[]&&Array(1)[jP]((function(){YP=!1})),KP({target:"Array",proto:!0,forced:YP},{find:function(e){return WP(this,e,arguments.length>1?arguments[1]:void 0)}});var zP=Qo("Array").find,qP=le,XP=zP,QP=Array.prototype,$P=i((function(e){var t=e.find;return e===QP||qP(QP,e)&&t===QP.find?XP:t})),ZP=Qo("Array").values,JP=yn,eO=Je,tO=le,iO=ZP,nO=Array.prototype,rO={DOMTokenList:!0,NodeList:!0},aO=i((function(e){var t=e.values;return e===nO||tO(nO,e)&&t===nO.values||eO(rO,JP(e))?iO:t})),sO=Ci,oO=uv,lO=s,uO=te,cO=Av.onFreeze,hO=Object.freeze;sO({target:"Object",stat:!0,forced:lO((function(){hO(1)})),sham:!oO},{freeze:function(e){return hO&&uO(e)?hO(cO(e)):e}});var dO=i(ie.Object.freeze),fO={exports:{}};Ci({target:"Number",stat:!0},{isNaN:function(e){return e!=e}});var vO=i(ie.Number.isNaN),gO=Qo("Array").keys,pO=yn,mO=Je,yO=le,kO=gO,TO=Array.prototype,EO={DOMTokenList:!0,NodeList:!0},SO=i((function(e){var t=e.keys;return e===TO||yO(TO,e)&&t===TO.keys||mO(EO,pO(e))?kO:t})),_O=i(Lh),bO=i(Yh),AO=i(Yf),RO=i($f),LO=i(Wm),IO=i(Rf),CO=i(od);function wO(e,t){var i=Cy(e);if(wy){var n=wy(e);t&&(n=Dy(n).call(n,(function(t){return xy(e,t).enumerable}))),i.push.apply(i,n)}return i}function DO(e){for(var t=1;t<arguments.length;t++){var i,n,r=null!=arguments[t]?arguments[t]:{};t%2?Py(i=wO(Object(r),!0)).call(i,(function(t){NO(e,t,r[t])})):Oy?My(e,Oy(r)):Py(n=wO(Object(r))).call(n,(function(t){dy(e,t,xy(r,t))}))}return e}function xO(e){return(xO="function"==typeof _O&&"symbol"==typeof bO?function(e){return typeof e}:function(e){return e&&"function"==typeof _O&&e.constructor===_O&&e!==_O.prototype?"symbol":typeof e})(e)}function PO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function OO(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,YO(n.key),n)}}function MO(e,t,i){return t&&OO(e.prototype,t),i&&OO(e,i),dy(e,"prototype",{writable:!1}),e}function NO(e,t,i){return(t=YO(t))in e?dy(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function FO(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=MI(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),dy(e,"prototype",{writable:!1}),t&&BO(e,t)}function UO(e){var t;return(UO=AO?Iy(t=RO).call(t):function(e){return e.__proto__||RO(e)})(e)}function BO(e,t){var i;return(BO=AO?Iy(i=AO).call(i):function(e,t){return e.__proto__=t,e})(e,t)}function HO(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function GO(e,t){if(t&&("object"===qh(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return HO(e)}function VO(e){var t=function(){if("undefined"==typeof Reflect||!LO)return!1;if(LO.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(LO(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=UO(e);if(t){var r=UO(this).constructor;i=LO(n,arguments,r)}else i=n.apply(this,arguments);return GO(this,i)}}function KO(){var e;"undefined"!=typeof Reflect&&IO?KO=Iy(e=IO).call(e):KO=function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=UO(e)););return e}(e,t);if(n){var r=xy(n,t);return r.get?r.get.call(arguments.length<3?e:i):r.value}};return KO.apply(this,arguments)}function WO(e){return function(e){if(kw(e))return jO(e)}(e)||function(e){if(void 0!==_O&&null!=CO(e)||null!=e["@@iterator"])return yw(e)}(e)||function(e,t){var i;if(!e)return;if("string"==typeof e)return jO(e,t);var n=iI(i=Object.prototype.toString.call(e)).call(i,8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return yw(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jO(e,t)}(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 jO(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function YO(e){var t=function(e,t){if("object"!==qh(e)||null===e)return e;var i=e[hy];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==qh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===qh(t)?t:String(t)}var zO={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function a(e,t,n,a,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new r(n,a||e,s),l=i?i+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}MI&&(n.prototype=MI(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var e,n,r=[];if(0===this._eventsCount)return r;for(n in e=this._events)t.call(e,n)&&r.push(i?iI(n).call(n,1):n);return wy?Hy(r).call(r,wy(e)):r},o.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,a=n.length,s=new Array(a);r<a;r++)s[r]=n[r].fn;return s},o.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},o.prototype.emit=function(e,t,n,r,a,s){var o=i?i+e:e;if(!this._events[o])return!1;var l,u,c=this._events[o],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,a),!0;case 6:return c.fn.call(c.context,t,n,r,a,s),!0}for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var d,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),h){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,n);break;case 4:c[u].fn.call(c[u].context,t,n,r);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];c[u].fn.apply(c[u].context,l)}}return!0},o.prototype.on=function(e,t,i){return a(this,e,t,i,!1)},o.prototype.once=function(e,t,i){return a(this,e,t,i,!0)},o.prototype.removeListener=function(e,t,n,r){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||r&&!o.once||n&&o.context!==n||s(this,a);else{for(var l=0,u=[],c=o.length;l<c;l++)(o[l].fn!==t||r&&!o[l].once||n&&o[l].context!==n)&&u.push(o[l]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+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=i,o.EventEmitter=o,e.exports=o}(zO);var qO=zO.exports,XO=i(qO),QO=Pi,$O=En,ZO=X,JO=RangeError,eM=function(e){var t=$O(ZO(this)),i="",n=QO(e);if(n<0||n==1/0)throw JO("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(i+=t);return i},tM=m,iM=Hi,nM=En,rM=X,aM=tM(eM),sM=tM("".slice),oM=Math.ceil,lM=function(e){return function(t,i,n){var r,a,s=nM(rM(t)),o=iM(i),l=s.length,u=void 0===n?" ":nM(n);return o<=l||""==u?s:((a=aM(u,oM((r=o-l)/u.length))).length>r&&(a=sM(a,0,r)),e?s+a:a+s)}},uM={start:lM(!1),end:lM(!0)},cM=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(ue),hM=uM.start;Ci({target:"String",proto:!0,forced:cM},{padStart:function(e){return hM(this,e,arguments.length>1?arguments[1]:void 0)}});var dM=Qo("String").padStart,fM=le,vM=dM,gM=String.prototype,pM=i((function(e){var t=e.padStart;return"string"==typeof e||e===gM||fM(gM,e)&&t===gM.padStart?vM:t})),mM=Ua.every;Ci({target:"Array",proto:!0,forced:!ic("every")},{every:function(e){return mM(this,e,arguments.length>1?arguments[1]:void 0)}});var yM,kM=Qo("Array").every,TM=le,EM=kM,SM=Array.prototype,_M=i((function(e){var t=e.every;return e===SM||TM(SM,e)&&t===SM.every?EM:t})),bM="undefined"!=typeof window&&window.location&&zy(yM=window.location.href).call(yM,"xgplayerdebugger=1")>-1,AM="color: #525252; background-color: #90ee90;",RM="color: #525252; background-color: red;",LM="color: #525252; background-color: yellow; ",IM="%c[xgplayer]",CM={config:{debug:bM?3:0},logInfo:function(e){for(var t,i,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];this.config.debug>=3&&(i=console).log.apply(i,Hy(t=[IM,AM,e]).call(t,r))},logWarn:function(e){for(var t,i,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];this.config.debug>=1&&(i=console).warn.apply(i,Hy(t=[IM,LM,e]).call(t,r))},logError:function(e){var t,i;if(!(this.config.debug<1)){for(var n=this.config.debug>=2?"trace":"error",r=arguments.length,a=new Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];(i=console)[n].apply(i,Hy(t=[IM,RM,e]).call(t,a))}}};var wM=function(){function e(t){PO(this,e),this.bufferedList=t}return MO(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}(),DM={};function xM(e){var t=xO(e);return null!==e&&("object"===t||"function"===t)}function PM(e,t,i){var n,r,a,s,o,l,u=0,c=!1,h=!1,d=!0,f=!t&&0!==t&&"function"==typeof window.requestAnimationFrame;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var i=n,a=r;return n=r=void 0,u=t,s=e.apply(a,i)}function g(e,t){return f?(window.cancelAnimationFrame(o),window.requestAnimationFrame(e)):gC(e,t)}function p(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-u>=a}function m(){var e=JC();if(p(e))return y(e);o=g(m,function(e){var i=e-u,n=t-(e-l);return h?Math.min(n,a-i):n}(e))}function y(e){return o=void 0,d&&n?v(e):(n=r=void 0,s)}function k(){for(var e=JC(),i=p(e),a=arguments.length,d=new Array(a),f=0;f<a;f++)d[f]=arguments[f];if(n=d,r=this,l=e,i){if(void 0===o)return function(e){return u=e,o=g(m,t),c?v(e):s}(l);if(h)return o=g(m,t),v(l)}return void 0===o&&(o=g(m,t)),s}return t=+t||0,xM(i)&&(c=!!i.leading,a=(h="maxWait"in i)?Math.max(+i.maxWait||0,t):a,d="trailing"in i?!!i.trailing:d),k.cancel=function(){void 0!==o&&function(e){if(f)return window.cancelAnimationFrame(e);clearTimeout(e)}(o),u=0,n=l=r=o=void 0},k.flush=function(){return void 0===o?s:y(JC())},k.pending=function(){return void 0!==o},k}DM.createDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=document.createElement(t);return a.className=r,a.innerHTML=i,Py(e=Cy(n)).call(e,(function(e){var i=e,r=n[e];"video"===t||"audio"===t||"live-video"===t?r&&a.setAttribute(i,r):a.setAttribute(i,r)})),a},DM.createDomFromHtml=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";try{var n=document.createElement("div");n.innerHTML=e;var r=n.children;if(n=null,r.length>0){var a;if(r=r[0],i&&DM.addClass(r,i),t)Py(a=Cy(t)).call(a,(function(e){r.setAttribute(e,t[e])}));return r}return null}catch(s){return CM.logError("util.createDomFromHtml",s),null}},DM.hasClass=function(e,t){if(!e||!t)return!1;try{return Yy(Array.prototype).call(e.classList,(function(e){return e===t}))}catch(n){var i=e.className&&"object"===xO(e.className)?e.getAttribute("class"):e.className;return i&&!!i.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}},DM.addClass=function(e,t){if(e&&t)try{var i;Py(i=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(i,(function(t){t&&e.classList.add(t)}))}catch(n){DM.hasClass(e,t)||(e.className&&"object"===xO(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t)}},DM.removeClass=function(e,t){if(e&&t)try{var i;Py(i=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(i,(function(t){t&&e.classList.remove(t)}))}catch(r){var n;if(DM.hasClass(e,t))Py(n=t.split(/\s+/g)).call(n,(function(t){var i=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===xO(e.className)?e.setAttribute("class",e.getAttribute("class").replace(i," ")):e.className=e.className.replace(i," ")}))}},DM.toggleClass=function(e,t){var i;e&&Py(i=t.split(/\s+/g)).call(i,(function(t){DM.hasClass(e,t)?DM.removeClass(e,t):DM.addClass(e,t)}))},DM.classNames=function(){for(var e=arguments,t=[],i=function(i){if("String"===DM.typeOf(e[i]))t.push(e[i]);else if("Object"===DM.typeOf(e[i])){var n;ub(n=Cy(e[i])).call(n,(function(n){e[i][n]&&t.push(n)}))}},n=0;n<arguments.length;n++)i(n);return t.join(" ")},DM.findDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,i=arguments.length>1?arguments[1]:void 0;try{e=t.querySelector(i)}catch(n){CM.logError("util.findDom",n),0===zy(i).call(i,"#")&&(e=t.getElementById(iI(i).call(i,1)))}return e},DM.getCss=function(e,t){return e.currentStyle?e.currentStyle[t]:document.defaultView.getComputedStyle(e,!1)[t]},DM.padStart=function(e,t,i){for(var n=String(i),r=t>>0,a=Math.ceil(r/n.length),s=[],o=String(e);a--;)s.push(n);return s.join("").substring(0,r-o.length)+o},DM.format=function(e){if(window.isNaN(e))return"";e=Math.round(e);var t=pM(DM).call(DM,Math.floor(e/3600),2,0),i=pM(DM).call(DM,Math.floor((e-3600*t)/60),2,0),n=pM(DM).call(DM,Math.floor(e-3600*t-60*i),2,0);return("00"===t?[i,n]:[t,i,n]).join(":")},DM.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},DM.typeOf=function(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]},DM.deepCopy=function(e,t){var i;if("Object"===DM.typeOf(t)&&"Object"===DM.typeOf(e))return Py(i=Cy(t)).call(i,(function(i){if("Object"!==DM.typeOf(t[i])||t[i]instanceof Node)if("Array"===DM.typeOf(t[i])){var n;e[i]="Array"===DM.typeOf(e[i])?Hy(n=e[i]).call(n,t[i]):t[i]}else e[i]=t[i];else void 0===e[i]||void 0===e[i]?e[i]=t[i]:DM.deepCopy(e[i],t[i])})),e},DM.deepMerge=function(e,t){var i;return ub(i=Cy(t)).call(i,(function(i){var n;"Array"===DM.typeOf(t[i])&&"Array"===DM.typeOf(e[i])?"Array"===DM.typeOf(e[i])&&(n=e[i]).push.apply(n,WO(t[i])):DM.typeOf(e[i])!==DM.typeOf(t[i])||null===e[i]||"Object"!==DM.typeOf(e[i])||t[i]instanceof window.Node?null!==t[i]&&(e[i]=t[i]):DM.deepMerge(e[i],t[i])})),e},DM.getBgImage=function(e){var t=(e.currentStyle||window.getComputedStyle(e,null)).backgroundImage;if(!t||"none"===t)return"";var i=document.createElement("a");return i.href=t.replace(/url\("|"\)/g,""),i.href},DM.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Py(Array.prototype).call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},DM.setInterval=function(e,t,i,n){e._interval[t]||(e._interval[t]=TI(Iy(i).call(i,e),n))},DM.clearInterval=function(e,t){clearInterval(e._interval[t]),e._interval[t]=null},DM.setTimeout=function(e,t,i){e._timers||(e._timers=[]);var n=gC((function(){t(),DM.clearTimeout(e,n)}),i);return e._timers.push(n),n},DM.clearTimeout=function(e,t){var i=e._timers;if("Array"===DM.typeOf(i)){for(var n=0;n<i.length;n++)if(i[n]===t){mw(i).call(i,n,1),clearTimeout(t);break}}else clearTimeout(t)},DM.clearAllTimers=function(e){var t=e._timers;"Array"===DM.typeOf(t)&&(ub(t).call(t,(function(e){clearTimeout(e)})),e._timerIds=[])},DM.createImgBtn=function(e,t,i,n){var r,a,s,o,l,u,c,h,d,f,v,g,p=DM.createDom("xg-".concat(e),"",{},"xgplayer-".concat(e,"-img"));(p.style.backgroundImage='url("'.concat(t,'")'),i&&n)&&(_M(r=["px","rem","em","pt","dp","vw","vh","vm","%"]).call(r,(function(e){var t,r;return!(zy(i).call(i,e)>-1&&zy(n).call(n,e)>-1)||(c=Tb(WI(t=iI(i).call(i,0,zy(i).call(i,e))).call(t)),h=Tb(WI(r=iI(n).call(n,0,zy(n).call(n,e))).call(r)),d=e,!1)})),p.style.width=Hy(a="".concat(c)).call(a,d),p.style.height=Hy(s="".concat(h)).call(s,d),p.style.backgroundSize=Hy(o=Hy(l=Hy(u="".concat(c)).call(u,d," ")).call(l,h)).call(o,d),p.style.margin="start"===e?Hy(f=Hy(v=Hy(g="-".concat(h/2)).call(g,d," auto auto -")).call(v,c/2)).call(f,d):"auto 5px auto 5px");return p},DM.Hex2RGBA=function(e,t){var i,n=[];if(/^\#[0-9A-F]{3}$/i.test(e)){var r="#";e.replace(/[0-9A-F]/gi,(function(e){r+=e+e})),e=r}return/^#[0-9A-F]{6}$/i.test(e)?(e.replace(/[0-9A-F]{2}/gi,(function(e){n.push(Zk(e,16))})),Hy(i="rgba(".concat(n.join(","),", ")).call(i,t,")")):"rgba(255, 255, 255, 0.1)"},DM.getFullScreenEl=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},DM.checkIsFunction=function(e){return e&&"function"==typeof e},DM.checkIsObject=function(e){return null!==e&&"object"===xO(e)},DM.hide=function(e){e.style.display="none"},DM.show=function(e,t){e.style.display=t||"block"},DM.isUndefined=function(e){if(null==e)return!0},DM.isNotNull=function(e){return!(null==e)},DM.setStyleFromCsstext=function(e,t){if(t)if("String"===DM.typeOf(t)){var i=t.replace(/\s+/g,"").split(";");ub(i).call(i,(function(t){if(t){var i=t.split(":");i.length>1&&(e.style[i[0]]=i[1])}}))}else{var n;ub(n=Cy(t)).call(n,(function(i){e.style[i]=t[i]}))}},DM.filterStyleFromText=function(e){var t,i=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 r=n.replace(/\s+/g,"").split(";"),a={},s={};return ub(r).call(r,(function(e){if(e){var t=e.split(":");t.length>1&&(!function(e,t){for(var i=0,n=t.length;i<n;i++)if(zy(e).call(e,t[i])>-1)return!0;return!1}(t[0],i)?s[t[0]]=t[1]:a[t[0]]=t[1])}})),e.setAttribute("style",""),ub(t=Cy(s)).call(t,(function(t){e.style[t]=s[t]})),a},DM.getStyleFromCsstext=function(e){var t=e.style.cssText;if(!t)return{};var i=t.replace(/\s+/g,"").split(";"),n={};return ub(i).call(i,(function(e){if(e){var t=e.split(":");t.length>1&&(n[t[0]]=t[1])}})),n},DM.preloadImg=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},i=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,i&&i(e)},n.src=e}},DM.stopPropagation=function(e){e&&e.stopPropagation()},DM.scrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},DM.scrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0},DM.checkTouchSupport=function(){return"ontouchstart"in window},DM.getBuffered2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=[],n=0;n<e.length;n++)i.push({start:e.start(n)<.5?0:e.start(n),end:e.end(n)});XC(i).call(i,(function(e,t){var i=e.start-t.start;return i||t.end-e.end}));var r=[];if(t)for(var a=0;a<i.length;a++){var s=r.length;if(s){var o=r[s-1].end;i[a].start-o<t?i[a].end>o&&(r[s-1].end=i[a].end):r.push(i[a])}else r.push(i[a])}else r=i;return new wM(r)},DM.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}},DM.requestAnimationFrame=function(e){var t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(t)return t(e)},DM.getHostFromUrl=function(e){if("String"!==DM.typeOf(e))return"";var t=e.split("/"),i="";return t.length>3&&t[2]&&(i=t[2]),i},DM.cancelAnimationFrame=function(e){var t=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.cancelRequestAnimationFrame;t&&t(e)},DM.isMSE=function(e){return e.media&&(e=e.media),!!(e&&e instanceof HTMLMediaElement)&&(/^blob/.test(e.currentSrc)||/^blob/.test(e.src))},DM.isBlob=function(e){return"string"==typeof e&&/^blob/.test(e)},DM.generateSessionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=(new Date).getTime();try{e=Zk(e)}catch(i){e=0}return t+=e,window.performance&&"function"==typeof window.performance.now&&(t+=Zk(window.performance.now())),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?i:3&i|8).toString(16)}))},DM.createEvent=function(e){var t;return"function"==typeof window.Event?t=new Event(e):(t=document.createEvent("Event")).initEvent(e,!0,!0),t},DM.adjustTimeByDuration=function(e,t,i){return t&&e&&(e>t||i&&e<t)?t:e},DM.createPositionBar=function(e,t){var i=DM.createDom("xg-bar","",{"data-index":-1},e);return t.appendChild(i),i},DM.getTransformStyle=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0,scale:1,rotate:0},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n={scale:"".concat(t.scale||1),translate:Hy(e="".concat(t.x||0,"%, ")).call(e,t.y||0,"%"),rotate:"".concat(t.rotate||0,"deg")},r=Cy(n);return Py(r).call(r,(function(e){var t,r=new RegExp("".concat(e,"\\([^\\(]+\\)"),"g"),a=Hy(t="".concat(e,"(")).call(t,n[e],")");r.test(i)?(r.lastIndex=-1,i=i.replace(r,a)):i+="".concat(a," ")})),i},DM.convertDeg=function(e){return Math.abs(e)<=1?360*e:e%360},DM.getIndexByTime=function(e,t){var i=t.length,n=-1;if(i<1)return n;if(e<=t[0].end||i<2)n=0;else if(e>t[i-1].end)n=i-1;else for(var r=1;r<i;r++)if(e>t[r-1].end&&e<=t[r].end){n=r;break}return n},DM.getOffsetCurrentTime=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=-1;if((n=i>=0&&i<t.length?i:DM.getIndexByTime(e,t))<0)return-1;var r=t.length,a=t[n],s=a.start,o=a.end,l=a.cTime,u=a.offset;return e<s?l:e>=s&&e<=o?e-u:e>o&&n>=r-1?o:-1},DM.getCurrentTimeByOffset=function(e,t){var i=-1;if(!t||t.length<0)return e;for(var n=0;n<t.length;n++)if(e<=t[n].duration){i=n;break}if(-1!==i){var r=t[i].start;return i-1<0?r+e:r+(e-t[i-1].duration)}return e};var OM=/(Android)\s([\d.]+)/,MM=/(Version)\/([\d.]+)/,NM=["avc1.42E01E, mp4a.40.2","avc1.58A01E, mp4a.40.2","avc1.4D401E, mp4a.40.2","avc1.64001E, mp4a.40.2","avc1.42E01E","mp4v.20.8","mp4v.20.8, mp4a.40.2","mp4v.20.240, mp4a.40.2"],FM={get device(){return FM.os.isPc?"pc":"mobile"},get browser(){var e,t;if("undefined"==typeof navigator)return"";var i=navigator.userAgent.toLowerCase(),n={ie:/rv:([\d.]+)\) like gecko/,firefox:/firefox\/([\d.]+)/,chrome:/chrome\/([\d.]+)/,opera:/opera.([\d.]+)/,safari:/version\/([\d.]+).*safari/};return Hy(e=[]).call(e,Dy(t=Cy(n)).call(t,(function(e){return n[e].test(i)})))[0]},get os(){if("undefined"==typeof navigator)return{};var e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),i=/(?:SymbianOS)/.test(e)||t,n=/(?:Android)/.test(e),r=/(?:Firefox)/.test(e),a=/(?:iPad|PlayBook)/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,s=a||n&&!/(?:Mobile)/.test(e)||r&&/(?:Tablet)/.test(e),o=/(?:iPhone)/.test(e)&&!s;return{isTablet:s,isPhone:o,isIpad:a,isIos:o||a,isAndroid:n,isPc:!(o||n||i||s),isSymbian:i,isWindowsPhone:t,isFireFox:r}},get osVersion(){if("undefined"==typeof navigator)return 0;var e=navigator.userAgent,t="",i=(t=/(?:iPhone)|(?:iPad|PlayBook)/.test(e)?MM:OM)?t.exec(e):[];if(i&&i.length>=3){var n=i[2].split(".");return n.length>0?Zk(n[0]):0}return 0},get isWeixin(){if("undefined"==typeof navigator)return!1;return!!/(micromessenger)\/([\d.]+)/.exec(navigator.userAgent.toLocaleLowerCase())},isSupportMP4:function(){var e={isSupport:!1,mime:""};if("undefined"==typeof document)return e;if(this.supportResult)return this.supportResult;var t=document.createElement("video");return"function"==typeof t.canPlayType&&ub(NM).call(NM,(function(i){"probably"===t.canPlayType('video/mp4; codecs="'.concat(i,'"'))&&(e.isSupport=!0,e.mime+="||".concat(i))})),this.supportResult=e,t=null,e},isMSESupport:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';if("undefined"==typeof MediaSource||!MediaSource)return!1;try{return MediaSource.isTypeSupported(e)}catch(GG){return this._logger.error(e,GG),!1}},isHevcSupported:function(){return!("undefined"==typeof MediaSource||!MediaSource.isTypeSupported)&&(MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"')||MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"'))},probeConfigSupported:function(e){var t={supported:!1,smooth:!1,powerEfficient:!1};if(!e||"undefined"==typeof navigator)return nb.resolve(t);if(navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo)return navigator.mediaCapabilities.decodingInfo(e);var i=e.video||{},n=e.audio||{};try{var r=MediaSource.isTypeSupported(i.contentType),a=MediaSource.isTypeSupported(n.contentType);return nb.resolve({supported:r&&a,smooth:!1,powerEfficient:!1})}catch(s){return nb.resolve(t)}}},UM="3.0.21-rc.21",BM={1:"media",2:"media",3:"media",4:"media",5:"media",6:"media"},HM={1:5101,2:5102,3:5103,4:5104,5:5105,6:5106},GM=MO((function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{errorType:"",errorCode:0,errorMessage:"",originError:"",ext:{},mediaError:null};PO(this,e);var n=t&&t.i18n?t.i18n.ERROR_TYPES:null;if(t.media){var r,a=i.mediaError?i.mediaError:t.media.error||{},s=t.duration,o=t.currentTime,l=t.ended,u=t.src,c=t.currentSrc,h=t.media,d=h.readyState,f=h.networkState,v=i.errorCode||a.code;HM[v]&&(v=HM[v]);var g={playerVersion:UM,currentTime:o,duration:s,ended:l,readyState:d,networkState:f,src:u||c,errorType:i.errorType,errorCode:v,message:i.errorMessage||a.message,mediaError:a,originError:i.originError?i.originError.stack:"",host:DM.getHostFromUrl(u||c)};return i.ext&&ub(r=Cy(i.ext)).call(r,(function(e){g[e]=i.ext[e]})),g}if(arguments.length>1){for(var p={playerVersion:UM,domain:document.domain},m=["errorType","currentTime","duration","networkState","readyState","src","currentSrc","ended","errd","errorCode","mediaError"],y=0;y<arguments.length;y++)p[m[y]]=arguments[y];return p.ex=n?(n[arguments[0]]||{}).msg:"",p}})),VM="play",KM="playing",WM="ended",jM="pause",YM="error",zM="seeking",qM="seeked",XM="timeupdate",QM="waiting",$M="canplay",ZM="durationchange",JM="volumechange",eN="loadeddata",tN="ratechange",iN="progress",nN="loadstart",rN="emptied",aN="focus",sN="blur",oN="ready",lN="urlNull",uN="autoplay_started",cN="autoplay_was_prevented",hN="complete",dN="replay",fN="destroy",vN="urlchange",gN="download_speed_change",pN="leaveplayer",mN="enterplayer",yN="loading",kN="fullscreen_change",TN="cssFullscreen_change",EN="mini_state_change",SN="definition_change",_N="after_definition_change",bN="video_resize",AN="pip_change",RN="rotate",LN="screenShot",IN="playnext",CN="shortcut",wN="xglog",DN="user_action",xN="reset",PN="source_error",ON="source_success",MN=["play","playing","ended","pause","error","seeking","seeked","timeupdate","waiting","canplay","canplaythrough","durationchange","volumechange","loadeddata","loadedmetadata","ratechange","progress","loadstart","emptied","stalled","suspend","abort","lowdecode"],NN={STATS_INFO:"stats_info",STATS_DOWNLOAD:"stats_download",STATS_RESET:"stats_reset"},FN="fps_stuck",UN=Object.freeze({__proto__:null,ABORT:"abort",AFTER_DEFINITION_CHANGE:_N,AUTOPLAY_PREVENTED:cN,AUTOPLAY_STARTED:uN,BEFORE_DEFINITION_CHANGE:"before_definition_change",BUFFER_CHANGE:"bufferedChange",CANPLAY:$M,CANPLAY_THROUGH:"canplaythrough",COMPLETE:hN,CSS_FULLSCREEN_CHANGE:TN,DEFINITION_CHANGE:SN,DESTROY:fN,DOWNLOAD_SPEED_CHANGE:gN,DURATION_CHANGE:ZM,EMPTIED:rN,ENDED:WM,ENTER_PLAYER:mN,ERROR:YM,FPS_STUCK:FN,FULLSCREEN_CHANGE:kN,LEAVE_PLAYER:pN,LOADED_DATA:eN,LOADED_METADATA:"loadedmetadata",LOADING:yN,LOAD_START:nN,MINI_STATE_CHANGE:EN,PAUSE:jM,PIP_CHANGE:AN,PLAY:VM,PLAYER_BLUR:sN,PLAYER_FOCUS:aN,PLAYING:KM,PLAYNEXT:IN,PROGRESS:iN,RATE_CHANGE:tN,READY:oN,REPLAY:dN,RESET:xN,RETRY:"retry",ROTATE:RN,SCREEN_SHOT:LN,SEEKED:qM,SEEKING:zM,SEI_PARSED:"SEI_PARSED",SHORTCUT:CN,SOURCE_ERROR:PN,SOURCE_SUCCESS:ON,STALLED:"stalled",STATS_EVENTS:NN,SUSPEND:"suspend",SWITCH_SUBTITLE:"switch_subtitle",TIME_UPDATE:XM,URL_CHANGE:vN,URL_NULL:lN,USER_ACTION:DN,VIDEO_EVENTS:MN,VIDEO_RESIZE:bN,VOLUME_CHANGE:JM,WAITING:QM,XGLOG:wN});function BN(e,t){this&&this.emit&&("error"===e?this.errorHandler(e,t.error):this.emit(e,t))}var HN=function(e){FO(i,e);var t=VO(i);function i(e){var n;PO(this,i),(n=t.call(this,e))._hasStart=!1,n._currentTime=0,n._duration=0,n._internalOp={},n._lastMuted=!1,n.vtype="MP4",n._rate=-1,n.mediaConfig=Ly({},{controls:!1,autoplay:e.autoplay,playsinline:e.playsinline,"x5-playsinline":e.playsinline,"webkit-playsinline":e.playsinline,"x5-video-player-fullscreen":e["x5-video-player-fullscreen"]||e.x5VideoPlayerFullscreen,"x5-video-orientation":e["x5-video-orientation"]||e.x5VideoOrientation,airplay:e.airplay,"webkit-airplay":e.airplay,tabindex:0|e.tabindex,mediaType:e.mediaType||"video","data-index":-1},e.videoConfig,e.videoAttributes);var r=e["x5-video-player-type"]||e.x5VideoPlayerType;return FM.isWeixin&&FM.os.isAndroid&&r&&(n.mediaConfig["x5-video-player-type"]=r,delete n.mediaConfig.playsinline,delete n.mediaConfig["webkit-playsinline"],delete n.mediaConfig["x5-playsinline"]),e.loop&&(n.mediaConfig.loop="loop"),e.autoplayMuted&&!Object.prototype.hasOwnProperty.call(n.mediaConfig,"muted")&&(n.mediaConfig.muted=!0),n.media=e.mediaEl instanceof HTMLMediaElement?e.mediaEl:"function"==typeof e.mediaEl?e.mediaEl(n.mediaConfig):DM.createDom(n.mediaConfig.mediaType,"",n.mediaConfig,""),e.defaultPlaybackRate&&(n.media.defaultPlaybackRate=n.media.playbackRate=e.defaultPlaybackRate),"Number"===DM.typeOf(e.volume)&&(n.volume=e.volume),e.autoplayMuted&&(n.media.muted=!0,n._lastMuted=!0),e.autoplay&&(n.media.autoplay=!0),e.playsinline&&(n.media.playsinline=!0),n._interval={},n.mediaEventMiddleware={},n.attachVideoEvents(),n}return MO(i,[{key:"setEventsMiddleware",value:function(e){var t,i=this;ub(t=Cy(e)).call(t,(function(t){i.mediaEventMiddleware[t]=e[t]}))}},{key:"removeEventsMiddleware",value:function(e){var t,i=this;ub(t=Cy(e)).call(t,(function(e){delete i.mediaEventMiddleware[e]}))}},{key:"attachVideoEvents",value:function(){var e,t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.media;this._evHandlers||(this._evHandlers=ub(MN).call(MN,(function(e){var i,n=Hy(i="on".concat(e.charAt(0).toUpperCase())).call(i,iI(e).call(e,1));return"function"==typeof t[n]&&t.on(e,t[n]),NO({},e,function(e,t){return function(i,n){var r={player:t,eventName:e,originalEvent:i,detail:i.detail||{},timeStamp:i.timeStamp,currentTime:t.currentTime,duration:t.duration,paused:t.paused,ended:t.ended,isInternalOp:!!t._internalOp[i.type],muted:t.muted,volume:t.volume,host:DM.getHostFromUrl(t.currentSrc),vtype:t.vtype};if(t.removeInnerOP(i.type),"timeupdate"===e&&(t._currentTime=t.media&&t.media.currentTime),"ratechange"===e){var a=t.media?t.media.playbackRate:0;if(a&&t._rate===a)return;t._rate=t.media&&t.media.playbackRate}if("durationchange"===e&&(t._duration=t.media.duration),"volumechange"===e&&(r.isMutedChange=t._lastMuted!==t.muted,t._lastMuted=t.muted),"error"===e&&(r.error=n||t.video.error),t.mediaEventMiddleware[e]){var s=Iy(BN).call(BN,t,e,r);try{t.mediaEventMiddleware[e].call(t,r,s)}catch(o){throw BN.call(t,e,r),o}}else BN.call(t,e,r)}}(e,t))}))),Py(e=this._evHandlers).call(e,(function(e){var t=Cy(e)[0];i.addEventListener(t,e[t],!1)}))}},{key:"detachVideoEvents",value:function(){var e,t,i=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.media;Py(e=this._evHandlers).call(e,(function(e){var t=Cy(e)[0];n.removeEventListener(t,e[t],!1)})),Py(t=this._evHandlers).call(t,(function(e){var t,n=Cy(e)[0],r=Hy(t="on".concat(n.charAt(0).toUpperCase())).call(t,iI(n).call(n,1));"function"==typeof i[r]&&i.off(n,i[r])})),this._evHandlers=null}},{key:"_attachSourceEvents",value:function(e,t){var i=this;e.removeAttribute("src"),e.load(),Py(t).call(t,(function(e,t){i.media.appendChild(DM.createDom("source","",{src:"".concat(e.src),type:"".concat(e.type||""),"data-index":t+1}))}));var n=e.children;if(n){this._videoSourceCount=n.length,this._videoSourceIndex=n.length,this._vLoadeddata=function(e){i.emit(ON,{src:e.target.currentSrc,host:DM.getHostFromUrl(e.target.currentSrc)})};for(var r=null,a=0;a<this._evHandlers.length;a++)if("error"===Cy(this._evHandlers[a])[0]){r=this._evHandlers[a];break}!this._sourceError&&(this._sourceError=function(e){var t=Zk(e.target.getAttribute("data-index"),10);if(i._videoSourceIndex--,0===i._videoSourceIndex||t>=i._videoSourceCount){var n={code:4,message:"sources_load_error"};r?r.error(e,n):i.errorHandler("error",n)}var a=BM[4];i.emit(PN,new GM(i,{errorType:a,errorCode:4,errorMessage:"sources_load_error",mediaError:{code:4,message:"sources_load_error"},src:e.target.src}))});for(var s=0;s<n.length;s++)n[s].addEventListener("error",this._sourceError);e.addEventListener("loadeddata",this._vLoadeddata)}}},{key:"_detachSourceEvents",value:function(e){var t=e.children;if(t&&0!==t.length&&this._sourceError){for(var i=0;i<t.length;i++)t[i].removeEventListener("error",this._sourceError);for(;t.length>0;)e.removeChild(t[0]);this._vLoadeddata&&e.removeEventListener("loadeddata",this._vLoadeddata)}}},{key:"errorHandler",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.media&&(this.media.error||t)){var i=this.media.error||t,n=i.code?BM[i.code]:"other";i.message;this.media.currentSrc||this.media.srcObject||(i={code:6,message:"empty_src"}),this.emit(e,new GM(this,{errorType:n,errorCode:i.code,errorMessage:i.message||"",mediaError:i}))}}},{key:"destroy",value:function(){for(var e in this.media&&(this.media.pause&&(this.media.pause(),this.media.muted=!0),this.media.removeAttribute("src"),this.media.load()),this._currentTime=0,this._duration=0,this.mediaConfig=null,this._interval)Object.prototype.hasOwnProperty.call(this._interval,e)&&(clearInterval(this._interval[e]),this._interval[e]=null);this.detachVideoEvents(),this.media=null,this.mediaEventMiddleware={},this.removeAllListeners()}},{key:"video",get:function(){return this.media},set:function(e){this.media=e}},{key:"play",value:function(){return this.media?this.media.play():null}},{key:"pause",value:function(){this.media&&this.media.pause()}},{key:"load",value:function(){this.media&&this.media.load()}},{key:"canPlayType",value:function(e){return!!this.media&&this.media.canPlayType(e)}},{key:"getBufferedRange",value:function(e){var t=[0,0];if(!this.media)return t;e||(e=this.media.buffered);var i=this.media.currentTime;if(e)for(var n=0,r=e.length;n<r&&(t[0]=e.start(n),t[1]=e.end(n),!(t[0]<=i&&i<=t[1]));n++);return t[0]-i<=0&&i-t[1]<=0?t:[0,0]}},{key:"autoplay",get:function(){return!!this.media&&this.media.autoplay},set:function(e){this.media&&(this.media.autoplay=e)}},{key:"buffered",get:function(){return this.media?this.media.buffered:null}},{key:"buffered2",get:function(){return this.media&&this.media.buffered?DM.getBuffered2(this.media.buffered):null}},{key:"bufferedPoint",get:function(){var e={start:0,end:0};if(!this.media)return e;var t=this.media.buffered;if(!t||0===t.length)return e;for(var i=0;i<t.length;i++)if((t.start(i)<=this.currentTime||t.start(i)<.1)&&t.end(i)>=this.currentTime)return{start:t.start(i),end:t.end(i)};return e}},{key:"crossOrigin",get:function(){return this.media?this.media.crossOrigin:""},set:function(e){this.media&&(this.media.crossOrigin=e)}},{key:"currentSrc",get:function(){return this.media?this.media.currentSrc:""},set:function(e){this.media&&(this.media.currentSrc=e)}},{key:"currentTime",get:function(){return this.media?void 0!==this.media.currentTime?this.media.currentTime:this._currentTime:0},set:function(e){this.media&&(this.media.currentTime=e)}},{key:"defaultMuted",get:function(){return!!this.media&&this.media.defaultMuted},set:function(e){this.media&&(this.media.defaultMuted=e)}},{key:"duration",get:function(){return this._duration}},{key:"ended",get:function(){return!!this.media&&this.media.ended}},{key:"error",get:function(){return this.media.error}},{key:"errorNote",get:function(){if(!this.media.error)return"";return["MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED"][this.media.error.code-1]}},{key:"loop",get:function(){return!!this.media&&this.media.loop},set:function(e){this.media&&(this.media.loop=e)}},{key:"muted",get:function(){return!!this.media&&this.media.muted},set:function(e){this.media&&this.media.muted!==e&&(this._lastMuted=this.media.muted,this.media.muted=e)}},{key:"networkState",get:function(){return this.media.networkState}},{key:"paused",get:function(){return!this.media||this.media.paused}},{key:"playbackRate",get:function(){return this.media?this.media.playbackRate:0},set:function(e){this.media&&e!==1/0&&(this.media.defaultPlaybackRate=e,this.media.playbackRate=e)}},{key:"played",get:function(){return this.media?this.media.played:null}},{key:"preload",get:function(){return!!this.media&&this.media.preload},set:function(e){this.media&&(this.media.preload=e)}},{key:"readyState",get:function(){return this.media.readyState}},{key:"seekable",get:function(){return!!this.media&&this.media.seekable}},{key:"seeking",get:function(){return!!this.media&&this.media.seeking}},{key:"src",get:function(){return this.media?this.media.src:""},set:function(e){this.media&&(this.emit(vN,e),this.emit(QM),this._currentTime=0,this._duration=0,DM.isMSE(this.media)?this.onWaiting():(this._detachSourceEvents(this.media),"Array"===DM.typeOf(e)?this._attachSourceEvents(this.media,e):e?this.media.src=e:this.media.removeAttribute("src"),this.load()))}},{key:"volume",get:function(){return this.media?this.media.volume:0},set:function(e){e!==1/0&&this.media&&(this.media.volume=e)}},{key:"aspectRatio",get:function(){return this.media?this.media.videoWidth/this.media.videoHeight:0}},{key:"addInnerOP",value:function(e){this._internalOp[e]=!0}},{key:"removeInnerOP",value:function(e){delete this._internalOp[e]}},{key:"emit",value:function(e,t){for(var n,r,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(r=KO(UO(i.prototype),"emit",this)).call.apply(r,Hy(n=[this,e,t]).call(n,s))}},{key:"on",value:function(e,t){for(var n,r,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(r=KO(UO(i.prototype),"on",this)).call.apply(r,Hy(n=[this,e,t]).call(n,s))}},{key:"once",value:function(e,t){for(var n,r,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(r=KO(UO(i.prototype),"once",this)).call.apply(r,Hy(n=[this,e,t]).call(n,s))}},{key:"off",value:function(e,t){for(var n,r,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(r=KO(UO(i.prototype),"off",this)).call.apply(r,Hy(n=[this,e,t]).call(n,s))}},{key:"offAll",value:function(){KO(UO(i.prototype),"removeAllListeners",this).call(this)}}]),i}(XO),GN=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{name:"xgplayer",version:1,db:null,ojstore:{name:"xg-m4a",keypath:"vid"}};PO(this,e),this.indexedDB=window.indexedDB||window.webkitindexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange,this.myDB=t}return MO(e,[{key:"openDB",value:function(e){var t=this,i=this,n=this.myDB.version||1,r=i.indexedDB.open(i.myDB.name,n);r.onerror=function(e){},r.onsuccess=function(n){t.myDB.db=n.target.result,e.call(i)},r.onupgradeneeded=function(e){var t=e.target.result;e.target.transaction,t.objectStoreNames.contains(i.myDB.ojstore.name)||t.createObjectStore(i.myDB.ojstore.name,{keyPath:i.myDB.ojstore.keypath})}}},{key:"deletedb",value:function(){this.indexedDB.deleteDatabase(this.myDB.name)}},{key:"closeDB",value:function(){this.myDB.db.close()}},{key:"addData",value:function(e,t){for(var i,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),r=0;r<t.length;r++)(i=n.add(t[r])).onerror=function(){},i.onsuccess=function(){}}},{key:"putData",value:function(e,t){for(var i,n=this.myDB.db.transaction(e,"readwrite").objectStore(e),r=0;r<t.length;r++)(i=n.put(t[r])).onerror=function(){},i.onsuccess=function(){}}},{key:"getDataByKey",value:function(e,t,i){var n=this,r=this.myDB.db.transaction(e,"readwrite").objectStore(e).get(t);r.onerror=function(){i.call(n,null)},r.onsuccess=function(e){var t=e.target.result;i.call(n,t)}}},{key:"deleteData",value:function(e,t){this.myDB.db.transaction(e,"readwrite").objectStore(e).delete(t)}},{key:"clearData",value:function(e){this.myDB.db.transaction(e,"readwrite").objectStore(e).clear()}}]),e}(),VN=["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],KN=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],WN=["exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen"],jN="data-xgplayerid";function YN(e,t,i){for(var n,r=arguments.length,a=new Array(r>3?r-3:0),s=3;s<r;s++)a[s-3]=arguments[s];var o,l=t.call.apply(t,Hy(n=[e]).call(n,a));i&&"function"==typeof i&&(l&&l.then?l.then((function(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];i.call.apply(i,Hy(t=[e]).call(t,r))})):i.call.apply(i,Hy(o=[e]).call(o,a)))}function zN(e,t){var i,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),Iy(i=function(){var i,r=arguments,a=this;if(n.pre)try{var s,o;(o=n.pre).call.apply(o,Hy(s=[this]).call(s,iI(Array.prototype).call(arguments)))}catch(g){var l,u;throw g.message=Hy(l=Hy(u="[pluginName: ".concat(this.pluginName,":")).call(u,e,":pre error] >> ")).call(l,g.message),g}if(this.__hooks&&this.__hooks[e])try{var c,h=tF(this,e,t);if(h)if(h.then)h.then((function(e){var i;!1!==e&&YN.apply(void 0,Hy(i=[a,t,n.next]).call(i,WO(r)))})).catch((function(e){throw e}));else YN.apply(void 0,Hy(c=[this,t,n.next]).call(c,iI(Array.prototype).call(arguments)));else if(void 0===h){var d;YN.apply(void 0,Hy(d=[this,t,n.next]).call(d,iI(Array.prototype).call(arguments)))}}catch(g){var f,v;throw g.message=Hy(f=Hy(v="[pluginName: ".concat(this.pluginName,":")).call(v,e,"] >> ")).call(f,g.message),g}else YN.apply(void 0,Hy(i=[this,t,n.next]).call(i,iI(Array.prototype).call(arguments)))}).call(i,this)}function qN(e,t){var i=this.__hooks;if(!i||!kw(i[e]))return-1;for(var n=i[e],r=0;r<n.length;r++)if(n[r]===t)return r;return-1}function XN(e,t){var i=this.__hooks;if(i)return i.hasOwnProperty(e)?(kw(i[e])||(i[e]=[]),-1===qN.call(this,e,t)&&i[e].push(t),!0):(console.warn("has no supported hook which name [".concat(e,"]")),!1)}function QN(e,t){var i=this.__hooks;if(i)if(kw(i[e])){var n=i[e],r=qN.call(this,e,t);-1!==r&&mw(n).call(n,r,1)}else i[e]&&(i[e]=null)}function $N(e){if(this.plugins&&this.plugins[e.toLowerCase()]){for(var t=this.plugins[e.toLowerCase()],i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return t.useHooks&&t.useHooks.apply(t,n)}}function ZN(e){if(this.plugins&&this.plugins[e.toLowerCase()]){var t=this.plugins[e.toLowerCase()];if(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return t.removeHooks&&t.removeHooks.apply(t,n)}}}function JN(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.__hooks={},t&&ub(t).call(t,(function(t){e.__hooks[t]=null})),dy(e,"hooks",{get:function(){var t;return e.__hooks&&ub(t=Cy(e.__hooks)).call(t,(function(t){if(e.__hooks[t])return t}))}})}function eF(e){e.__hooks=null}function tF(e,t,i){for(var n=arguments.length,r=new Array(n>3?n-3:0),a=3;a<n;a++)r[a-3]=arguments[a];if(e.__hooks&&kw(e.__hooks[t])){var s,o=e.__hooks[t],l=-1;return function e(t,i,n){for(var r,a,s=arguments.length,u=new Array(s>3?s-3:0),c=3;c<s;c++)u[c-3]=arguments[c];if(l++,0===o.length||l===o.length)return n.call.apply(n,Hy(a=[t,t]).call(a,u));var h,d=o[l],f=d.call.apply(d,Hy(r=[t,t]).call(r,u));return f&&f.then?f.then((function(r){var a;return!1===r?null:e.apply(void 0,Hy(a=[t,i,n]).call(a,u))})).catch((function(e){console.warn("[runHooks]".concat(i," reject"),e.message)})):!1!==f?e.apply(void 0,Hy(h=[t,i,n]).call(h,u)):void 0}.apply(void 0,Hy(s=[e,t,i]).call(s,r))}var u;return i.call.apply(i,Hy(u=[e,e]).call(u,r))}function iF(e,t){var i;CM.logError(Hy(i="[".concat(e,"] event or callback cant be undefined or null when call ")).call(i,t))}var nF=function(){function e(t){PO(this,e),DM.checkIsFunction(this.beforeCreate)&&this.beforeCreate(t),JN(this),this.__args=t,this.__events={},this.__onceEvents={},this.config=t.config||{},this.player=null,this.playerConfig={},this.pluginName="",this.__init(t)}return MO(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=DM.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 i=this;e&&t&&this.player?"string"==typeof e?(this.__events[e]=t,this.player.on(e,t)):kw(e)&&Py(e).call(e,(function(e){i.__events[e]=t,i.player.on(e,t)})):iF(this.pluginName,"plugin.on(event, callback)")}},{key:"once",value:function(e,t){var i=this;e&&t&&this.player?"string"==typeof e?(this.__onceEvents[e]=t,this.player.once(e,t)):kw(e)&&Py(e).call(e,(function(n){i.__onceEvents[n]=t,i.player.once(e,t)})):iF(this.pluginName,"plugin.once(event, callback)")}},{key:"off",value:function(e,t){var i=this;e&&t&&this.player?"string"==typeof e?(delete this.__events[e],this.player.off(e,t)):kw(e)&&Py(e).call(e,(function(n){delete i.__events[e],i.player.off(n,t)})):iF(this.pluginName,"plugin.off(event, callback)")}},{key:"offAll",value:function(){var e,t=this;Py(e=["__events","__onceEvents"]).call(e,(function(e){var i;Py(i=Cy(t[e])).call(i,(function(i){t[e][i]&&t.off(i,t[e][i]),i&&delete t[e][i]}))})),this.__events={},this.__onceEvents={}}},{key:"emit",value:function(e){var t,i;if(this.player){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];(i=this.player).emit.apply(i,Hy(t=[e]).call(t,r))}}},{key:"emitUserAction",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this.player){var n=DO(DO({},i),{},{pluginName:this.pluginName});this.player.emitUserAction(e,t,n)}}},{key:"hook",value:function(e,t){var i;return zN.call.apply(zN,Hy(i=[this]).call(i,iI(Array.prototype).call(arguments)))}},{key:"useHooks",value:function(e,t){for(var i,n=arguments.length,r=new Array(n>2?n-2:0),a=2;a<n;a++)r[a-2]=arguments[a];return XN.call.apply(XN,Hy(i=[this]).call(i,iI(Array.prototype).call(arguments)))}},{key:"removeHooks",value:function(e,t){for(var i,n=arguments.length,r=new Array(n>2?n-2:0),a=2;a<n;a++)r[a-2]=arguments[a];return QN.call.apply(QN,Hy(i=[this]).call(i,iI(Array.prototype).call(arguments)))}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(this.player)return i&&(t.pluginName=i),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,i=this.player,n=this.pluginName;this.offAll(),DM.clearAllTimers(this),DM.checkIsFunction(this.destroy)&&this.destroy(),ub(e=["player","playerConfig","pluginName","logger","__args","__hooks"]).call(e,(function(e){t[e]=null})),i.unRegisterPlugin(n),eF(this)}}],[{key:"defineGetterOrSetter",value:function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&dy(e,i,t[i])}},{key:"defineMethod",value:function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&"function"==typeof t[i]&&dy(e,i,{configurable:!0,value:t[i]})}},{key:"defaultConfig",get:function(){return{}}},{key:"pluginName",get:function(){return"pluginName"}}]),e}();if("undefined"!=typeof Element&&!Element.prototype.matches){var rF=Element.prototype;rF.matches=rF.matchesSelector||rF.mozMatchesSelector||rF.msMatchesSelector||rF.oMatchesSelector||rF.webkitMatchesSelector}var aF=function(e,t){for(;e&&9!==e.nodeType;){if("function"==typeof e.matches&&e.matches(t))return e;e=e.parentNode}};function sF(e,t,i,n,r){var a=oF.apply(this,arguments);return e.addEventListener(i,a,r),{destroy:function(){e.removeEventListener(i,a,r)}}}function oF(e,t,i,n){return function(i){i.delegateTarget=aF(i.target,t),i.delegateTarget&&n.call(e,i)}}var lF=function(e,t,i,n,r){return"function"==typeof e.addEventListener?sF.apply(null,arguments):"function"==typeof i?Iy(sF).call(sF,null,document).apply(null,arguments):("string"==typeof e&&(e=document.querySelectorAll(e)),ub(Array.prototype).call(e,(function(e){return sF(e,t,i,n,r)})))},uF=i(lF),cF={CONTROLS:"controls",ROOT:"root"},hF={ROOT:"root",ROOT_LEFT:"rootLeft",ROOT_RIGHT:"rootRight",ROOT_TOP:"rootTop",CONTROLS_LEFT:"controlsLeft",CONTROLS_RIGTH:"controlsRight",CONTROLS_RIGHT:"controlsRight",CONTROLS_CENTER:"controlsCenter",CONTROLS:"controls"},dF="xg-icon-disable";function fF(e){return!!e&&(zy(e)&&/^(?:http|data:|\/)/.test(e))}function vF(e,t){var i,n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=null;if(e instanceof window.Element)return DM.addClass(e,r),ub(n=Cy(a)).call(n,(function(t){e.setAttribute(t,a[t])})),e;if(fF(e)||fF(e.url))return a.src=fF(e)?e:e.url||"",o=DM.createDom(e.tag||"img","",a,"xg-img ".concat(r));if("function"==typeof e)try{var l,u;return(o=e())instanceof window.Element?(DM.addClass(o,r),ub(l=Cy(a)).call(l,(function(e){o.setAttribute(e,a[e])})),o):(CM.logWarn(Hy(u="warn>>icons.".concat(t," in config of plugin named [")).call(u,s,"] is a function mast return an Element Object")),null)}catch(c){return CM.logError("Plugin named [".concat(s,"]:createIcon"),c),null}return"string"==typeof e?DM.createDomFromHtml(e,a,r):(CM.logWarn(Hy(i="warn>>icons.".concat(t," in config of plugin named [")).call(i,s,"] is invalid")),null)}function gF(e,t){var i,n=t.config.icons||t.playerConfig.icons;ub(i=Cy(e)).call(i,(function(i){var r=e[i],a=r&&r.class?r.class:"",s=r&&r.attr?r.attr:{},o=null;n&&n[i]&&(a=function(e,t){var i;return"object"===xO(e)&&e.class&&"string"==typeof e.class?Hy(i="".concat(t," ")).call(i,e.class):t}(n[i],a),s=function(e,t){var i;return"object"===xO(e)&&e.attr&&"object"===xO(e.attr)&&ub(i=Cy(e.attr)).call(i,(function(i){t[i]=e.attr[i]})),t}(n[i],s),o=vF(n[i],i,a,s,t.pluginName)),!o&&r&&(o=vF(r.icon?r.icon:r,s,a,{},t.pluginName)),t.icons[i]=o}))}var pF=function(e){FO(i,e);var t=VO(i);function i(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return PO(this,i),(e=t.call(this,n)).__delegates=[],e}return MO(i,[{key:"__init",value:function(e){if(KO(UO(i.prototype),"__init",this).call(this,e),e.root){var t=e.root,n=null;this.icons={},this.root=null,this.parent=null,gF(this.registerIcons()||{},this),this.langText={};var r,a,s,o=this.registerLanguageTexts()||{};a=this,ub(s=Cy(r=o)).call(s,(function(e){dy(a.langText,e,{get:function(){var t=a.lang,i=a.i18n;return i[e]?i[e]:r[e]&&r[e][t]||""}})}));var l="";try{l=this.render()}catch(d){var u;throw CM.logError("Plugin:".concat(this.pluginName,":render"),d),new Error(Hy(u="Plugin:".concat(this.pluginName,":render:")).call(u,d.message))}if(l)(n=i.insert(l,t,e.index)).setAttribute("data-index",e.index);else{if(!e.tag)return;(n=DM.createDom(e.tag,"",e.attr,e.name)).setAttribute("data-index",e.index),t.appendChild(n)}this.root=n,this.parent=t;var c=this.config.attr||{},h=this.config.style||{};this.setAttr(c),this.setStyle(h),this.config.index&&this.root.setAttribute("data-index",this.config.index),this.__registerChildren()}}},{key:"__registerChildren",value:function(){var e=this;if(this.root){this._children=[];var t,i=this.children();if(i&&"object"===xO(i))if(Cy(i).length>0)ub(t=Cy(i)).call(t,(function(t){var n,r,a=t,s=i[a],o={root:e.root};"function"==typeof s?(n=e.config[a]||{},r=s):"object"===xO(s)&&"function"==typeof s.plugin&&(n=s.options?DM.deepCopy(e.config[a]||{},s.options):e.config[a]||{},r=s.plugin),o.config=n,void 0!==n.index&&(o.index=n.index),n.root&&(o.root=n.root),e.registerPlugin(r,o,a)}))}}},{key:"updateLang",value:function(e){e||(e=this.lang);var t=this.root,i=this.i18n,n=this.langText;t&&function e(t,i){for(var n=0;n<t.children.length;n++)t.children[n].children.length>0?e(t.children[n],i):i(t.children[n])}(t,(function(t){var r=t.getAttribute&&t.getAttribute("lang-key");if(r){var a=i[r.toUpperCase()]||n[r];a&&(t.innerHTML="function"==typeof a?a(e):a)}}))}},{key:"lang",get:function(){return this.player.lang}},{key:"changeLangTextKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=this.i18n||{},n=this.langText;e.setAttribute&&e.setAttribute("lang-key",t);var r=i[t]||n[t]||"";r&&(e.innerHTML=r)}},{key:"plugins",value:function(){return this._children}},{key:"disable",value:function(){this.config.disable=!0,DM.addClass($P(this).call(this,".xgplayer-icon"),dF)}},{key:"enable",value:function(){this.config.disable=!1,DM.removeClass($P(this).call(this,".xgplayer-icon"),dF)}},{key:"children",value:function(){return{}}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";t.root=t.root||this.root;var r=KO(UO(i.prototype),"registerPlugin",this).call(this,e,t,n);return this._children.push(r),r}},{key:"registerIcons",value:function(){return{}}},{key:"registerLanguageTexts",value:function(){return{}}},{key:"find",value:function(e){if(this.root)return this.root.querySelector(e)}},{key:"bind",value:function(e,t,n){var r=this;if(arguments.length<3&&"function"==typeof t)kw(e)?Py(e).call(e,(function(e){r.bindEL(e,t)})):this.bindEL(e,t);else{var a,s=i.delegate.call(this,this.root,e,t,n);this.__delegates=Hy(a=this.__delegates).call(a,s)}}},{key:"unbind",value:function(e,t){var i=this;if(arguments.length<3&&"function"==typeof t)kw(e)?Py(e).call(e,(function(e){i.unbindEL(e,t)})):this.unbindEL(e,t);else for(var n,r=Hy(n="".concat(e,"_")).call(n,t),a=0;a<this.__delegates.length;a++)if(this.__delegates[a].key===r){var s;this.__delegates[a].destroy(),mw(s=this.__delegates).call(s,a,1);break}}},{key:"setStyle",value:function(e,t){var i,n=this;if(this.root)return"String"===DM.typeOf(e)?this.root.style[e]=t:void("Object"===DM.typeOf(e)&&ub(i=Cy(e)).call(i,(function(t){n.root.style[t]=e[t]})))}},{key:"setAttr",value:function(e,t){var i,n=this;if(this.root)return"String"===DM.typeOf(e)?this.root.setAttribute(e,t):void("Object"===DM.typeOf(e)&&ub(i=Cy(e)).call(i,(function(t){n.root.setAttribute(t,e[t])})))}},{key:"setHtml",value:function(e,t){this.root&&(this.root.innerHTML=e,"function"==typeof t&&t())}},{key:"bindEL",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.addEventListener(e,t,i)}},{key:"unbindEL",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.root&&"on".concat(e)in this.root&&"function"==typeof t&&this.root.removeEventListener(e,t,i)}},{key:"show",value:function(e){if(this.root)return this.root.style.display=void 0!==e?e:"block","none"===window.getComputedStyle(this.root,null).getPropertyValue("display")?this.root.style.display="block":void 0}},{key:"hide",value:function(){this.root&&(this.root.style.display="none")}},{key:"appendChild",value:function(e,t){if(!this.root)return null;if(arguments.length<2&&arguments[0]instanceof window.Element)return this.root.appendChild(arguments[0]);if(!(t&&t instanceof window.Element))return null;try{return"string"==typeof e?$P(this).call(this,e).appendChild(t):e.appendChild(t)}catch(i){return CM.logError("Plugin:appendChild",i),null}}},{key:"render",value:function(){return""}},{key:"destroy",value:function(){}},{key:"__destroy",value:function(){var e,t,n,r=this,a=this.player;(ub(e=this.__delegates).call(e,(function(e){e.destroy()})),this.__delegates=[],this._children instanceof Array)&&(ub(n=this._children).call(n,(function(e){a.unRegisterPlugin(e.pluginName)})),this._children=null);this.root&&(this.root.hasOwnProperty("remove")?this.root.remove():this.root.parentNode&&this.root.parentNode.removeChild(this.root)),KO(UO(i.prototype),"__destroy",this).call(this),this.icons={},ub(t=["root","parent"]).call(t,(function(e){r[e]=null}))}}],[{key:"insert",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=t.children.length,r=Number(i),a=e instanceof window.Node;if(n){for(var s=0,o=null,l="";s<n;s++){o=t.children[s];var u=Number(o.getAttribute("data-index"));if(u>=r){l="beforebegin";break}u<r&&(l="afterend")}return a?"afterend"===l?t.appendChild(e):t.insertBefore(e,o):o.insertAdjacentHTML(l,e),"afterend"===l?t.children[t.children.length-1]:t.children[s]}return a?t.appendChild(e):t.insertAdjacentHTML("beforeend",e),t.children[t.children.length-1]}},{key:"defaultConfig",get:function(){return{}}},{key:"delegate",value:function(e,t,i,n){var r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=[];if(e instanceof window.Node&&"function"==typeof n)if(kw(i))Py(i).call(i,(function(i){var s,o=uF(e,t,i,n,r);o.key=Hy(s="".concat(t,"_")).call(s,i),a.push(o)}));else{var s,o=uF(e,t,i,n,r);o.key=Hy(s="".concat(t,"_")).call(s,i),a.push(o)}return a}},{key:"ROOT_TYPES",get:function(){return cF}},{key:"POSITIONS",get:function(){return hF}}]),i}(nF),mF=function(){function e(){var t=this;if(PO(this,e),NO(this,"__trigger",(function(e){var i=(new Date).getTime();t.timeStamp=i;for(var n=0;n<e.length;n++)t.__runHandler(e[n].target)})),this.__handlers=[],this.timeStamp=0,this.observer=null,window.ResizeObserver)try{this.observer=new window.ResizeObserver(function(e,t,i){var n=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return xM(i)&&(n="leading"in i?!!i.leading:n,r="trailing"in i?!!i.trailing:r),PM(e,t,{leading:n,trailing:r,maxWait:t})}(this.__trigger,100,{trailing:!0})),this.timeStamp=(new Date).getTime()}catch(i){console.error(i)}}return MO(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer.observe(e);for(var i=e.getAttribute(jN),n=this.__handlers,r=-1,a=0;a<n.length;a++)n[a]&&e===n[a].target&&(r=a);r>-1?this.__handlers[r].handler=t:this.__handlers.push({target:e,handler:t,playerId:i})}}},{key:"unObserver",value:function(e){var t,i,n=-1;ub(t=this.__handlers).call(t,(function(t,i){e===t.target&&(n=i)}));try{var r;null===(r=this.observer)||void 0===r||r.unobserve(e)}catch(a){}n>-1&&mw(i=this.__handlers).call(i,n,1)}},{key:"destroyObserver",value:function(){var e;null===(e=this.observer)||void 0===e||e.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,i=0;i<t.length;i++)if(t[i]&&e===t[i].target){try{t[i].handler(e)}catch(GG){console.error(GG)}return!0}return!1}}]),e}(),yF=null;var kF={pluginGroup:{},init:function(e){var t,i,n=e._pluginInfoId;n||(n=(new Date).getTime(),e._pluginInfoId=n),!e.config.closeResizeObserver&&(t=e.root,i=function(){e.resize()},yF||(yF=new mF),yF.addObserver(t,i)),this.pluginGroup[n]={_originalOptions:e.config||{},_plugins:{}}},formatPluginInfo:function(e,t){var i=null,n=null;return e.plugin&&"function"==typeof e.plugin?(i=e.plugin,n=e.options):(i=e,n={}),t&&(n.config=t||{}),{PLUFGIN:i,options:n}},checkPluginIfExits:function(e,t){for(var i=0;i<t.length;i++)if(e.toLowerCase()===t[i].pluginName.toLowerCase())return!0;return!1},getRootByConfig:function(e,t){for(var i=Cy(t),n=null,r=0;r<i.length;r++)if(e.toLowerCase()===i[r].toLowerCase()){n=t[i[r]];break}return"Object"===DM.typeOf(n)?{root:n.root,position:n.position}:{}},lazyRegister:function(e,t){var i=this,n=t.timeout||1500;return nb.race([t.loader().then((function(t){var n;n=t&&t.__esModule?t.default:t,i.register(e,n,t.options)})),new nb((function(e,t){gC((function(){t(new Error("timeout"))}),n)}))])},register:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e&&t&&"function"==typeof t&&void 0!==t.prototype){var n=e._pluginInfoId;if(n&&this.pluginGroup[n]){this.pluginGroup[n]._plugins||(this.pluginGroup[n]._plugins={});var r=this.pluginGroup[n]._plugins,a=this.pluginGroup[n]._originalOptions;i.player=e;var s=i.pluginName||t.pluginName;if(!s)throw new Error("The property pluginName is necessary");if(!t.isSupported||t.isSupported(e.config.mediaType,e.config.codecType)){i.config||(i.config={});for(var o,l=Cy(a),u=0;u<l.length;u++)if(s.toLowerCase()===l[u].toLowerCase()){var c=a[l[u]];"Object"===DM.typeOf(c)?i.config=Ly({},i.config,a[l[u]]):"Boolean"===DM.typeOf(c)&&(i.config.disable=!c);break}if(t.defaultConfig)Py(o=Cy(t.defaultConfig)).call(o,(function(e){void 0===i.config[e]&&(i.config[e]=t.defaultConfig[e])}));i.root?"string"==typeof i.root&&(i.root=e[i.root]):i.root=e.root,i.index=i.config.index||0;try{r[s.toLowerCase()]&&(this.unRegister(n,s.toLowerCase()),console.warn("the is one plugin with same pluginName [".concat(s,"] exist, destroy the old instance")));var h=new t(i);return r[s.toLowerCase()]=h,r[s.toLowerCase()].func=t,h&&"function"==typeof h.afterCreate&&h.afterCreate(),h}catch(d){throw console.error(d),d}}else console.warn("not supported plugin [".concat(s,"]"))}}},unRegister:function(e,t){e._pluginInfoId&&(e=e._pluginInfoId),t=t.toLowerCase();try{var i=this.pluginGroup[e]._plugins[t];i&&(i.pluginName&&i.__destroy(),delete this.pluginGroup[e]._plugins[t])}catch(r){var n;console.error(Hy(n="[unRegister:".concat(t,"] cgid:[")).call(n,e,"] error"),r)}},deletePlugin:function(e,t){var i=e._pluginInfoId;i&&this.pluginGroup[i]&&this.pluginGroup[i]._plugins&&delete this.pluginGroup[i]._plugins[t]},getPlugins:function(e){var t=e._pluginInfoId;return t&&this.pluginGroup[t]?this.pluginGroup[t]._plugins:{}},findPlugin:function(e,t){var i=e._pluginInfoId;if(!i||!this.pluginGroup[i])return null;var n=t.toLowerCase();return this.pluginGroup[i]._plugins[n]},beforeInit:function(e){var t=this;function i(e){return e&&e.then?e:new nb((function(e){e()}))}return new nb((function(n){if(t.pluginGroup)return(e._loadingPlugins&&e._loadingPlugins.length?nb.all(e._loadingPlugins):nb.resolve()).then((function(){var r,a,s=e._pluginInfoId;if(t.pluginGroup[s]){var o=t.pluginGroup[s]._plugins,l=[];Py(r=Cy(o)).call(r,(function(e){if(o[e]&&o[e].beforePlayerInit)try{var t=o[e].beforePlayerInit();l.push(i(t))}catch(n){throw l.push(i(null)),n}})),nb.all(Hy(a=[]).call(a,l)).then((function(){n()})).catch((function(e){console.error(e),n()}))}else n()}))}))},afterInit:function(e){var t,i=e._pluginInfoId;if(i&&this.pluginGroup[i]){var n=this.pluginGroup[i]._plugins;Py(t=Cy(n)).call(t,(function(e){n[e]&&n[e].afterPlayerInit&&n[e].afterPlayerInit()}))}},setLang:function(e,t){var i,n=t._pluginInfoId;if(n&&this.pluginGroup[n]){var r=this.pluginGroup[n]._plugins;Py(i=Cy(r)).call(i,(function(t){if(r[t].updateLang)r[t].updateLang(e);else try{r[t].lang=e}catch(GG){console.warn("".concat(t," setLang"))}}))}},reRender:function(e){var t,i=this,n=e._pluginInfoId;if(n&&this.pluginGroup[n]){var r=[],a=this.pluginGroup[n]._plugins;Py(t=Cy(a)).call(t,(function(e){"controls"!==e&&a[e]&&(r.push({plugin:a[e].func,options:a[e].__args}),i.unRegister(n,e))})),Py(r).call(r,(function(t){i.register(e,t.plugin,t.options)}))}},onPluginsReady:function(e){var t,i=e._pluginInfoId;if(i&&this.pluginGroup[i]){var n=this.pluginGroup[i]._plugins||{};Py(t=Cy(n)).call(t,(function(e){n[e].onPluginsReady&&"function"==typeof n[e].onPluginsReady&&n[e].onPluginsReady()}))}},destroy:function(e){var t=e._pluginInfoId;if(this.pluginGroup[t]){var i,n,r;i=e.root,null===(r=yF)||void 0===r||r.unObserver(i,n);for(var a=this.pluginGroup[t]._plugins,s=0,o=Cy(a);s<o.length;s++){var l=o[s];this.unRegister(t,l)}delete this.pluginGroup[t],delete e._pluginInfoId}}},TF={DEFAULT:"xgplayer",DEFAULT_SKIN:"xgplayer-skin-default",ENTER:"xgplayer-is-enter",PAUSED:"xgplayer-pause",PLAYING:"xgplayer-playing",ENDED:"xgplayer-ended",CANPLAY:"xgplayer-canplay",LOADING:"xgplayer-isloading",ERROR:"xgplayer-is-error",REPLAY:"xgplayer-replay",NO_START:"xgplayer-nostart",ACTIVE:"xgplayer-active",INACTIVE:"xgplayer-inactive",FULLSCREEN:"xgplayer-is-fullscreen",CSS_FULLSCREEN:"xgplayer-is-cssfullscreen",ROTATE_FULLSCREEN:"xgplayer-rotate-fullscreen",PARENT_ROTATE_FULLSCREEN:"xgplayer-rotate-parent",PARENT_FULLSCREEN:"xgplayer-fullscreen-parent",INNER_FULLSCREEN:"xgplayer-fullscreen-inner",NO_CONTROLS:"no-controls",FLEX_CONTROLS:"flex-controls",CONTROLS_FOLLOW:"controls-follow",CONTROLS_AUTOHIDE:"controls-autohide",TOP_BAR_AUTOHIDE:"top-bar-autohide",NOT_ALLOW_AUTOPLAY:"not-allow-autoplay",SEEKING:"seeking",PC:"xgplayer-pc",MOBILE:"xgplayer-mobile",MINI:"xgplayer-mini"};function EF(){return{id:"",el:null,url:"",domEventType:"default",nullUrlStart:!1,width:600,height:337.5,fluid:!1,fitVideoSize:"fixed",videoFillMode:"auto",volume:.6,autoplay:!1,autoplayMuted:!1,loop:!1,isLive:!1,zoom:1,videoInit:!0,poster:"",isMobileSimulateMode:!1,defaultPlaybackRate:1,execBeforePluginsCall:null,allowSeekAfterEnded:!0,enableContextmenu:!0,closeVideoClick:!1,closeVideoDblclick:!1,closePlayerBlur:!1,closeDelayBlur:!1,leavePlayerTime:3e3,closePlayVideoFocus:!1,closePauseVideoFocus:!1,closeFocusVideoFocus:!0,closeControlsBlur:!0,topBarAutoHide:!0,videoAttributes:{},startTime:0,seekedStatus:"play",miniprogress:!1,disableSwipeHandler:function(){},enableSwipeHandler:function(){},preProcessUrl:null,ignores:[],whitelist:[],inactive:3e3,lang:(e=(document.documentElement.getAttribute("lang")||navigator.language||"zh-cn").toLocaleLowerCase(),"zh-cn"===e&&(e="zh"),e),controls:!0,marginControls:!1,fullscreenTarget:null,screenShot:!1,rotate:!1,pip:!1,download:!1,mini:!1,cssFullscreen:!0,keyShortcut:!0,presets:[],plugins:[],playbackRate:1,definition:{list:[]},playsinline:!0,customDuration:0,timeOffset:0,icons:{},i18n:[],tabindex:0,thumbnail:null,videoConfig:{},isHideTips:!1,minWaitDelay:200,commonStyle:{progressColor:"",playedColor:"",cachedColor:"",sliderBtnStyle:{},volumeColor:""}};var e}var SF=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"onMouseEnter",(function(e){var t=HO(n),i=t.player;t.playerConfig.closeControlsBlur&&i.focus({autoHide:!1})})),NO(HO(n),"onMouseLeave",(function(e){HO(n).player.focus()})),n}return MO(i,[{key:"beforeCreate",value:function(e){e.config.mode||"mobile"!==FM.device||(e.config.mode="flex"),e.player.config.marginControls&&(e.config.autoHide=!1)}},{key:"afterCreate",value:function(){var e,t=this,i=this.config,n=i.disable,r=i.height,a=i.mode;if(!n){"flex"===a&&this.player.addClass(TF.FLEX_CONTROLS);var s={height:"".concat(r,"px")};ub(e=Cy(s)).call(e,(function(e){t.root.style[e]=s[e]})),this.left=$P(this).call(this,"xg-left-grid"),this.center=$P(this).call(this,"xg-center-grid"),this.right=$P(this).call(this,"xg-right-grid"),this.innerRoot=$P(this).call(this,"xg-inner-controls"),this.on(EN,(function(e){e?DM.addClass(t.root,"mini-controls"):DM.removeClass(t.root,"mini-controls")}));var o=this.playerConfig.isMobileSimulateMode;if("mobile"!==FM.device&&"mobile"!==o)Iy(this).call(this,"mouseenter",this.onMouseEnter),Iy(this).call(this,"mouseleave",this.onMouseLeave)}}},{key:"focus",value:function(){this.player.focus({autoHide:!1})}},{key:"focusAwhile",value:function(){this.player.focus({autoHide:!0})}},{key:"blur",value:function(){this.player.blur({ignorePaused:!0})}},{key:"recoverAutoHide",value:function(){this.config.autoHide&&DM.addClass(this.root,TF.CONTROLS_AUTOHIDE)}},{key:"pauseAutoHide",value:function(){DM.removeClass(this.root,TF.CONTROLS_AUTOHIDE)}},{key:"show",value:function(e){this.root.style.display="",this.player.focus()}},{key:"hide",value:function(){this.root.style.display="none"}},{key:"mode",get:function(){return this.config.mode}},{key:"registerPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(this.root){var r=e.defaultConfig||{};if(!t.root){switch(t.position?t.position:t.config&&t.config.position?t.config.position:r.position){case hF.CONTROLS_LEFT:t.root=this.left;break;case hF.CONTROLS_RIGHT:t.root=this.right;break;case hF.CONTROLS_CENTER:t.root=this.center;break;case hF.CONTROLS:t.root=this.root;break;default:t.root=this.left}return KO(UO(i.prototype),"registerPlugin",this).call(this,e,t,n)}}}},{key:"destroy",value:function(){"mobile"!==FM.device&&(this.unbind("mouseenter",this.onMouseEnter),this.unbind("mouseleave",this.onMouseLeave)),this.left=null,this.center=null,this.right=null,this.innerRoot=null}},{key:"render",value:function(){var e=this.config,t=e.mode,i=e.autoHide,n=e.initShow;if(!e.disable){var r=DM.classNames({"xgplayer-controls":!0},{"flex-controls":"flex"===t},{"bottom-controls":"bottom"===t},NO({},TF.CONTROLS_AUTOHIDE,i),{"xgplayer-controls-initshow":n||!i});return'<xg-controls class="'.concat(r,'" unselectable="on">\n <xg-inner-controls class="xg-inner-controls xg-pos">\n <xg-left-grid class="xg-left-grid">\n </xg-left-grid>\n <xg-center-grid class="xg-center-grid"></xg-center-grid>\n <xg-right-grid class="xg-right-grid">\n </xg-right-grid>\n </xg-inner-controls>\n </xg-controls>')}}}],[{key:"pluginName",get:function(){return"controls"}},{key:"defaultConfig",get:function(){return{disable:!1,autoHide:!0,mode:"",initShow:!1}}}]),i}(pF),_F={LANG:"en",TEXT:{ERROR_TYPES:{network:{code:1,msg:"video download error"},mse:{code:2,msg:"stream append error"},parse:{code:3,msg:"parsing error"},format:{code:4,msg:"wrong format"},decoder:{code:5,msg:"decoding error"},runtime:{code:6,msg:"grammatical errors"},timeout:{code:7,msg:"play timeout"},other:{code:8,msg:"other errors"}},HAVE_NOTHING:"There is no information on whether audio/video is ready",HAVE_METADATA:"Audio/video metadata is ready ",HAVE_CURRENT_DATA:"Data about the current play location is available, but there is not enough data to play the next frame/millisecond",HAVE_FUTURE_DATA:"Current and at least one frame of data is available",HAVE_ENOUGH_DATA:"The available data is sufficient to start playing",NETWORK_EMPTY:"Audio/video has not been initialized",NETWORK_IDLE:"Audio/video is active and has been selected for resources, but no network is used",NETWORK_LOADING:"The browser is downloading the data",NETWORK_NO_SOURCE:"No audio/video source was found",MEDIA_ERR_ABORTED:"The fetch process is aborted by the user",MEDIA_ERR_NETWORK:"An error occurred while downloading",MEDIA_ERR_DECODE:"An error occurred while decoding",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video is not supported",REPLAY:"Replay",ERROR:"Network is offline",PLAY_TIPS:"Play",PAUSE_TIPS:"Pause",PLAYNEXT_TIPS:"Play next",DOWNLOAD_TIPS:"Download",ROTATE_TIPS:"Rotate",RELOAD_TIPS:"Reload",FULLSCREEN_TIPS:"Fullscreen",EXITFULLSCREEN_TIPS:"Exit fullscreen",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Exit cssfullscreen",TEXTTRACK:"Caption",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Off",OPEN:"Open",MINI_DRAG:"Click and hold to drag",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Please Try",REFRESH:"Refresh",FORWARD:"forward",LIVE_TIP:"Live"}},bF={lang:{},langKeys:[],textKeys:[]};function AF(e,t){var i;return Py(i=Cy(t)).call(i,(function(i){var n,r=DM.typeOf(t[i]),a=DM.typeOf(e[i]);"Array"===r?("Array"!==a&&(e[i]=[]),(n=e[i]).push.apply(n,WO(t[i]))):"Object"===r?("Object"!==a&&(e[i]={}),AF(e[i],t[i])):e[i]=t[i]})),e}function RF(){var e;ub(e=Cy(bF.lang.en)).call(e,(function(e){bF.textKeys[e]=e}))}function LF(e,t){var i=e.LANG;if(t||(t=bF),t.lang){var n=e.TEXT||{};"zh"===i&&(i="zh-cn"),t.lang[i]?AF(t.lang[i],n):(t.langKeys.push(i),t.lang[i]=n),RF()}}LF(_F);var IF={get textKeys(){return bF.textKeys},get langKeys(){return bF.langKeys},get lang(){var e,t={};return ub(e=bF.langKeys).call(e,(function(e){t[e]=bF.lang[e]})),bF.lang["zh-cn"]&&(t.zh=bF.lang["zh-cn"]||{}),t},extend:function(e,t){var i=[];if(t||(t=bF),t.lang){var n;if("Array"!==DM.typeOf(e))i=ub(n=Cy(e)).call(n,(function(t){return{LANG:"zh"===t?"zh-cn":t,TEXT:e[t]}}));else i=e;var r=t.lang;ub(i).call(i,(function(e){"zh"===e.LANG&&(e.LANG="zh-cn"),r[e.LANG]?AF(r[e.LANG]||{},e.TEXT||{}):LF(e,t)})),RF()}},use:LF,init:function(e){var t,i={lang:{},langKeys:[],textKeys:{},pId:e};return AF(i.lang,bF.lang),(t=i.langKeys).push.apply(t,WO(bF.langKeys)),AF(i.textKeys,bF.textKeys),i}},CF={INITIAL:1,READY:2,ATTACHING:3,ATTACHED:4,NOTALLOW:5,RUNNING:6,ENDED:7,DESTROYED:8},wF=["ERROR","INITIAL","READY","ATTACHING","ATTACHED","NOTALLOW","RUNNING","ENDED","DESTROYED"],DF={},xF=null,PF=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"add",value:function(e){e&&(DF[e.playerId]=e,1===Cy(DF).length&&this.setActive(e.playerId,!0))}},{key:"remove",value:function(e){e&&(e.isUserActive,delete DF[e.playerId])}},{key:"_iterate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var i in DF)if(Object.prototype.hasOwnProperty.call(DF,i)){var n=DF[i];if(t){if(e(n))break}else e(n)}}},{key:"forEach",value:function(e){this._iterate(e)}},{key:"find",value:function(e){var t=null;return this._iterate((function(i){var n=e(i);return n&&(t=i),n}),!0),t}},{key:"findAll",value:function(e){var t=[];return this._iterate((function(i){e(i)&&t.push(i)})),t}},{key:"setActive",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(DF[e]){if(t)Py(this).call(this,(function(t){e===t.playerId?(t.isUserActive=!0,t.isInstNext=!1):t.isUserActive=!1}));else DF[e].isUserActive=t;return e}}},{key:"getActiveId",value:function(){for(var e=Cy(DF),t=0;t<e.length;t++){var i=DF[e[t]];if(i&&i.isUserActive)return e[t]}return null}},{key:"setNext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(DF[e]){if(t)Py(this).call(this,(function(t){e===t.playerId?(t.isUserActive=!1,t.isInstNext=!0):t.isInstNext=!1}));else DF[e].isInstNext=t;return e}}}],[{key:"getInstance",value:function(){return xF||(xF=new i),xF}}]),i}(qO.EventEmitter);var OF=["play","pause","replay","retry"],MF=0,NF=0,FF=null,UF=function(e){FO(i,e);var t=VO(i);function i(e){var n;PO(this,i);var r,a,s,o,l=DM.deepMerge(EF(),e);NO(HO(n=t.call(this,l)),"canPlayFunc",(function(){if(n.config){var e=n.config,t=e.autoplay,i=e.defaultPlaybackRate;CM.logInfo("player","canPlayFunc, startTime",n.__startTime),n._seekToStartTime(),n.playbackRate=i,(t||n._useAutoplay)&&n.mediaPlay(),n.off($M,n.canPlayFunc),n.removeClass(TF.ENTER)}})),NO(HO(n),"onFullscreenChange",(function(e,t){var i=function(){DM.setTimeout(HO(n),(function(){n.resize()}),100)},r=DM.getFullScreenEl();n._fullActionFrom?n._fullActionFrom="":n.emit(DN,{eventType:"system",action:"switch_fullscreen",pluginName:"player",currentTime:n.currentTime,duration:n.duration,props:[{prop:"fullscreen",from:!0,to:!1}]});var a=function(e,t,i){if(e){var n=e.getAttribute(i);return!(!n||n!==t||"VIDEO"!==e.tagName&&"AUDIO"!==e.tagName)}}(r,n.playerId,jN);if(t||r&&(r===n._fullscreenEl||a))i(),!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!0,n.changeFullStyle(n.root,r,TF.FULLSCREEN),n.emit(kN,!0,n._fullScreenOffset),n.cssfullscreen&&n.exitCssFullscreen();else if(n.fullscreen){i();var s=HO(n),o=s._fullScreenOffset;if(s.config.needFullscreenScroll?(window.scrollTo(o.left,o.top),DM.setTimeout(HO(n),(function(){n.fullscreen=!1,n._fullScreenOffset=null}),100)):(!n.config.closeFocusVideoFocus&&n.media.focus(),n.fullscreen=!1,n._fullScreenOffset=null),n.cssfullscreen)n.removeClass(TF.FULLSCREEN);else{var l=n._fullscreenEl;l||!n.root.contains(e.target)&&e.target!==n.root||(l=e.target),n.recoverFullStyle(n.root,l,TF.FULLSCREEN)}n._fullscreenEl=null,n.emit(kN,!1)}})),NO(HO(n),"_onWebkitbeginfullscreen",(function(e){n._fullscreenEl=n.media,n.onFullscreenChange(e,!0)})),NO(HO(n),"_onWebkitendfullscreen",(function(e){n.onFullscreenChange(e,!1)})),JN(HO(n),OF),n.config=l,n._pluginInfoId=DM.generateSessionId(),(r=HO(n)).logInfo=Iy(a=CM.logInfo).call(a,r),r.logWarn=Iy(s=CM.logWarn).call(s,r),r.logError=Iy(o=CM.logError).call(o,r);var u=n.constructor.defaultPreset;if(n.config.presets.length){var c,h=zy(c=n.config.presets).call(c,"default");h>=0&&u&&(n.config.presets[h]=u)}else u&&n.config.presets.push(u);if(n.userTimer=null,n.waitTimer=null,n.handleSource=!0,n._state=CF.INITIAL,n.isAd=!1,n.isError=!1,n._hasStart=!1,n.isSeeking=!1,n.isCanplay=!1,n._useAutoplay=!1,n.__startTime=-1,n.rotateDeg=0,n.isActive=!1,n.fullscreen=!1,n.cssfullscreen=!1,n.isRotateFullscreen=!1,n._fullscreenEl=null,n.timeSegments=[],n._cssfullscreenEl=null,n.curDefinition=null,n._orgCss="",n._fullScreenOffset=null,n._videoHeight=0,n._videoWidth=0,n.videoPos={pi:1,scale:0,rotate:-1,x:0,y:0,h:-1,w:-1,vy:0,vx:0},n.sizeInfo={width:0,height:0,left:0,top:0},n._accPlayed={t:0,acc:0,loopAcc:0},n._offsetInfo={currentTime:-1,duration:0},n.innerContainer=null,n.controls=null,n.topBar=null,n.root=null,n.__i18n=IF.init(n._pluginInfoId),FM.os.isAndroid&&FM.osVersion>0&&FM.osVersion<6&&(n.config.autoplay=!1),n.database=new GN,n.isUserActive=!1,n._onceSeekCanplay=null,n._isPauseBeforeSeek=0,n.innerStates={isActiveLocked:!1},n.instManager=FF,!n._initDOM())return console.error(new Error("can't find the dom which id is ".concat(n.config.id," or this.config.el does not exist"))),GO(n);var d=n.config,f=d.definition,v=void 0===f?{}:f;if(!d.url&&v.list&&v.list.length>0){var g,p=$P(g=v.list).call(g,(function(e){return e.definition&&e.definition===v.defaultDefinition}));p||(v.defaultDefinition=v.list[0].definition,p=v.list[0]),n.config.url=p.url,n.curDefinition=p}return n._bindEvents(),n._registerPresets(),n._registerPlugins(),kF.onPluginsReady(HO(n)),n.getInitDefinition(),n.setState(CF.READY),DM.setTimeout(HO(n),(function(){n.emit(oN)}),0),n.onReady&&n.onReady(),(n.config.videoInit||n.config.autoplay)&&(!n.hasStart||n.state<CF.ATTACHED)&&n.start(),n}return MO(i,[{key:"_initDOM",value:function(){var e,t,i,n,r=this;if(this.root=this.config.id?document.getElementById(this.config.id):null,!this.root){var a=this.config.el;if(!a||1!==a.nodeType)return this.emit(YM,new GM("use",this.config.vid,{line:32,handle:"Constructor",msg:"container id can't be empty"})),console.error("this.confg.id or this.config.el can't be empty"),!1;this.root=a}var s=function(e){for(var t=Cy(DF),i=0;i<t.length;i++){var n=DF[t[i]];if(n.root===e)return n}return null}(this.root);if(s&&(CM.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize"),s.destroy()),this.root.setAttribute(jN,this.playerId),this.media.setAttribute(jN,this.playerId),null===(n=FF)||void 0===n||n.add(this),kF.init(this),this._initBaseDoms(),this.config.controls){var o=this.config.controls.root||null,l=kF.register(this,SF,{root:o});this.controls=l}var u="mobile"===this.config.isMobileSimulateMode?"mobile":FM.device;if(this.addClass(Hy(e=Hy(t=Hy(i="".concat(TF.DEFAULT," ")).call(i,TF.INACTIVE," xgplayer-")).call(t,u," ")).call(e,this.config.controls?"":TF.NO_CONTROLS)),this.config.autoplay?this.addClass(TF.ENTER):this.addClass(TF.NO_START),this.config.fluid){var c,h=this.config,d=h.width,f=h.height;"number"==typeof d&&"number"==typeof f||(d=600,f=337.5);var v={width:"100%",height:"0","max-width":"100%","padding-top":"".concat(100*f/d,"%")};Py(c=Cy(v)).call(c,(function(e){r.root.style[e]=v[e]}))}else{var g;Py(g=["width","height"]).call(g,(function(e){r.config[e]&&("number"!=typeof r.config[e]?r.root.style[e]=r.config[e]:r.root.style[e]="".concat(r.config[e],"px"))}))}var p=this.root.getBoundingClientRect(),m=p.width,y=p.height,k=p.left,T=p.top;return this.sizeInfo.width=m,this.sizeInfo.height=y,this.sizeInfo.left=k,this.sizeInfo.top=T,!0}},{key:"_initBaseDoms",value:function(){this.topBar=null,this.leftBar=null,this.rightBar=null,this.config.marginControls&&(this.innerContainer=DM.createDom("xg-video-container","",{"data-index":-1},"xg-video-container"),this.root.appendChild(this.innerContainer))}},{key:"_bindEvents",value:function(){var e,t=this;Py(e=["focus","blur"]).call(e,(function(e){t.on(e,t["on"+e.charAt(0).toUpperCase()+iI(e).call(e,1)])})),Py(VN).call(VN,(function(e){document&&document.addEventListener(e,t.onFullscreenChange)})),FM.os.isIos&&(this.media.addEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.addEventListener("webkitendfullscreen",this._onWebkitendfullscreen)),this.once(eN,this.resize),this.playFunc=function(){t.config.closeFocusVideoFocus||t.media.focus()},this.once(VM,this.playFunc)}},{key:"_unbindEvents",value:function(){var e=this;this.root.removeEventListener("mousemove",this.mousemoveFunc),Py(VN).call(VN,(function(t){document.removeEventListener(t,e.onFullscreenChange)})),this.playFunc&&this.off(VM,this.playFunc),this.off($M,this.canPlayFunc),this.media.removeEventListener("webkitbeginfullscreen",this._onWebkitbeginfullscreen),this.media.removeEventListener("webkitendfullscreen",this._onWebkitendfullscreen)}},{key:"_clearUserTimer",value:function(){this.userTimer&&(DM.clearTimeout(this,this.userTimer),this.userTimer=null)}},{key:"_startInit",value:function(e){var t=this;if(this.media&&(e&&""!==e&&("Array"!==DM.typeOf(e)||0!==e.length)||(e="",this.emit(lN),CM.logWarn("config.url is null, please get url and run player._startInit(url)"),!this.config.nullUrlStart))){this.handleSource&&(this._detachSourceEvents(this.media),"Array"===DM.typeOf(e)&&e.length>0?this._attachSourceEvents(this.media,e):this.media.src&&this.media.src===e?e||this.media.removeAttribute("src"):this.media.src=e),"Number"===DM.typeOf(this.config.volume)&&(this.volume=this.config.volume);var i=this.innerContainer?this.innerContainer:this.root;this.media instanceof window.Element&&!i.contains(this.media)&&i.insertBefore(this.media,i.firstChild);var n=this.media.readyState;CM.logInfo("_startInit readyState",n),this.config.autoplay&&(!DM.isMSE(this.media)&&this.load(),(FM.os.isIpad||FM.os.isPhone)&&this.mediaPlay());var r=this.config.startTime;this.__startTime=r>0?r:-1,this.config.startTime=0,n>=2&&this.duration>0?this.canPlayFunc():this.on($M,this.canPlayFunc),(!this.hasStart||this.state<CF.ATTACHED)&&kF.afterInit(this),this.hasStart=!0,this.setState(CF.ATTACHED),DM.setTimeout(this,(function(){t.emit(hN)}),0)}}},{key:"_registerPlugins",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._loadingPlugins=[];var i=this.config.ignores||[],n=this.config.plugins||[],r=this.config.i18n||[];t&&IF.extend(r,this.__i18n);var a=i.join("||").toLowerCase().split("||"),s=this.plugins;Py(n).call(n,(function(i){try{var n=i.plugin?i.plugin.pluginName:i.pluginName;if(n&&zy(a).call(a,n.toLowerCase())>-1)return null;if(!t&&s[n.toLowerCase()])return;if(i.lazy&&i.loader){var r=kF.lazyRegister(e,i);return void(i.forceBeforeInit&&(r.then((function(){var t,i;mw(t=e._loadingPlugins).call(t,zy(i=e._loadingPlugins).call(i,r),1)})).catch((function(t){var i,n;CM.logError("_registerPlugins:loadingPlugin",t),mw(i=e._loadingPlugins).call(i,zy(n=e._loadingPlugins).call(n,r),1)})),e._loadingPlugins.push(r)))}return e.registerPlugin(i)}catch(o){CM.logError("_registerPlugins:",o)}}))}},{key:"_registerPresets",value:function(){var e,t=this;Py(e=this.config.presets).call(e,(function(e){!function(e,t){var i,n,r,a=t.preset&&t.options?new t.preset(t.options,e.config):new t({},e.config),s=a.plugins,o=void 0===s?[]:s,l=a.ignores,u=void 0===l?[]:l,c=a.icons,h=void 0===c?{}:c,d=a.i18n,f=void 0===d?[]:d;e.config.plugins||(e.config.plugins=[]),e.config.ignores||(e.config.ignores=[]),(n=e.config.plugins).push.apply(n,WO(o)),(r=e.config.ignores).push.apply(r,WO(u)),ub(i=Cy(h)).call(i,(function(t){e.config.icons[t]||(e.config.icons[t]=h[t])}));var v=e.config.i18n||[];f.push.apply(f,WO(v)),e.config.i18n=f}(t,e)}))}},{key:"_getRootByPosition",value:function(e){var t=null;switch(e){case hF.ROOT_RIGHT:this.rightBar||(this.rightBar=DM.createPositionBar("xg-right-bar",this.root)),t=this.rightBar;break;case hF.ROOT_LEFT:this.leftBar||(this.leftBar=DM.createPositionBar("xg-left-bar",this.root)),t=this.leftBar;break;case hF.ROOT_TOP:this.topBar||(this.topBar=DM.createPositionBar("xg-top-bar",this.root),this.config.topBarAutoHide&&DM.addClass(this.topBar,TF.TOP_BAR_AUTOHIDE)),t=this.topBar;break;default:t=this.innerContainer||this.root}return t}},{key:"registerPlugin",value:function(e,t){var i=kF.formatPluginInfo(e,t),n=i.PLUFGIN,r=i.options,a=this.config.plugins;!kF.checkPluginIfExits(n.pluginName,a)&&a.push(n);var s=kF.getRootByConfig(n.pluginName,this.config);s.root&&(r.root=s.root),s.position&&(r.position=s.position);var o,l=r.position?r.position:r.config&&r.config.position||n.defaultConfig&&n.defaultConfig.position;return!r.root&&"string"==typeof l&&zy(l).call(l,"controls")>-1?null===(o=this.controls)||void 0===o?void 0:o.registerPlugin(n,r,n.pluginName):(r.root||(r.root=this._getRootByPosition(l)),kF.register(this,n,r))}},{key:"deregister",value:function(e){"string"==typeof e?kF.unRegister(this,e):e instanceof nF&&kF.unRegister(this,e.pluginName)}},{key:"unRegisterPlugin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.deregister(e),t&&this.removePluginFromConfig(e)}},{key:"removePluginFromConfig",value:function(e){var t;if("string"==typeof e?t=e:e instanceof nF&&(t=e.pluginName),t)for(var i=this.config.plugins.length-1;i>-1;i--){if(this.config.plugins[i].pluginName.toLowerCase()===t.toLowerCase()){var n;mw(n=this.config.plugins).call(n,i,1);break}}}},{key:"plugins",get:function(){return kF.getPlugins(this)}},{key:"getPlugin",value:function(e){var t=kF.findPlugin(this,e);return t&&t.pluginName?t:null}},{key:"addClass",value:function(e){this.root&&(DM.hasClass(this.root,e)||DM.addClass(this.root,e))}},{key:"removeClass",value:function(e){this.root&&DM.removeClass(this.root,e)}},{key:"hasClass",value:function(e){if(this.root)return DM.hasClass(this.root,e)}},{key:"setAttribute",value:function(e,t){this.root&&this.root.setAttribute(e,t)}},{key:"removeAttribute",value:function(e,t){this.root&&this.root.removeAttribute(e,t)}},{key:"start",value:function(e){var t=this;if(!(this.state>CF.ATTACHING))return e||this.config.url||this.getInitDefinition(),this.hasStart=!0,this.setState(CF.ATTACHING),this._registerPlugins(!1),kF.beforeInit(this).then((function(){if(t.config){e||(e=t.url||t.config.url);var i=t.preProcessUrl(e);return t._startInit(i.url)}})).catch((function(e){throw e.fileName="player",e.lineNumber="236",CM.logError("start:beforeInit:",e),e}))}},{key:"switchURL",value:function(e,t){var i=this,n=e;"Object"===DM.typeOf(e)&&(n=e.url),n=this.preProcessUrl(n).url;var r=this.currentTime;this.__startTime=r;var a=this.paused&&!this.isError;return this.src=n,new nb((function(e,t){var r=function(e){i.off("timeupdate",s),i.off("canplay",s),t(e)},s=function(){i._seekToStartTime(),a&&i.pause(),i.off("error",r),e(!0)};i.once("error",r),n?(FM.os.isAndroid?i.once("timeupdate",s):i.once("canplay",s),i.play()):i.errorHandler("error",{code:6,message:"empty_src"})}))}},{key:"videoPlay",value:function(){this.mediaPlay()}},{key:"mediaPlay",value:function(){var e=this;if(!this.hasStart&&this.state<CF.ATTACHED)return this.removeClass(TF.NO_START),this.addClass(TF.ENTER),this.start(),void(this._useAutoplay=!0);this.state<CF.RUNNING&&(this.removeClass(TF.NO_START),!this.isCanplay&&this.addClass(TF.ENTER));var t=KO(UO(i.prototype),"play",this).call(this);return void 0!==t&&t&&t.then?t.then((function(){e.removeClass(TF.NOT_ALLOW_AUTOPLAY),e.addClass(TF.PLAYING),e.state<CF.RUNNING&&(CM.logInfo(">>>>playPromise.then"),e.setState(CF.RUNNING),e.emit(uN))})).catch((function(t){if(CM.logWarn(">>>>playPromise.catch",t.name),e.media&&e.media.error)return e.onError(),void e.removeClass(TF.ENTER);"NotAllowedError"===t.name&&(e._errorTimer=DM.setTimeout(e,(function(){e._errorTimer=null,e.emit(cN),e.addClass(TF.NOT_ALLOW_AUTOPLAY),e.removeClass(TF.ENTER),e.pause(),e.setState(CF.NOTALLOW)}),0))})):(CM.logWarn("video.play not return promise"),this.state<CF.RUNNING&&(this.setState(CF.RUNNING),this.removeClass(TF.NOT_ALLOW_AUTOPLAY),this.removeClass(TF.NO_START),this.removeClass(TF.ENTER),this.addClass(TF.PLAYING),this.emit(uN))),t}},{key:"mediaPause",value:function(){KO(UO(i.prototype),"pause",this).call(this)}},{key:"videoPause",value:function(){KO(UO(i.prototype),"pause",this).call(this)}},{key:"play",value:function(){var e=this;return this.removeClass(TF.PAUSED),tF(this,"play",(function(){return e.mediaPlay()}))}},{key:"pause",value:function(){var e=this;tF(this,"pause",(function(){KO(UO(i.prototype),"pause",e).call(e)}))}},{key:"seek",value:function(e,t){var i=this;if(this.media&&!vO(Number(e))&&this.hasStart){var n=this.config,r=n.isSeekedPlay,a=n.seekedStatus,s=t||(r?"play":a);e=e<0?0:e>this.duration?Zk(this.duration,10):e,!this._isPauseBeforeSeek&&(this._isPauseBeforeSeek=this.paused?2:1),this._onceSeekCanplay&&this.off(qM,this._onceSeekCanplay),this._onceSeekCanplay=function(){switch(i.removeClass(TF.ENTER),i.isSeeking=!1,s){case"play":i.play();break;case"pause":i.pause();break;default:i._isPauseBeforeSeek>1||i.paused?i.pause():i.play()}i._isPauseBeforeSeek=0,i._onceSeekCanplay=null},this.once(qM,this._onceSeekCanplay),this.state<CF.RUNNING?(this.removeClass(TF.NO_START),this.currentTime=e,this.play()):this.currentTime=e}}},{key:"getInitDefinition",value:function(){var e,t=this,i=this.config,n=i.definition;!i.url&&n&&n.list&&n.list.length>0&&n.defaultDefinition&&ub(e=n.list).call(e,(function(e){e.definition===n.defaultDefinition&&(t.config.url=e.url,t.curDefinition=e)}))}},{key:"changeDefinition",value:function(e,t){var i,n=this,r=this.config.definition;kw(null==r?void 0:r.list)&&Py(i=r.list).call(i,(function(t){(null==e?void 0:e.definition)===t.definition&&(n.curDefinition=t)}));if(null!=e&&e.bitrate&&"number"!=typeof e.bitrate&&(e.bitrate=Zk(e.bitrate,10)||0),this.emit(SN,{from:t,to:e}),this.hasStart){var a=this.switchURL(e.url,DO({seamless:!1!==r.seamless&&"undefined"!=typeof MediaSource&&"function"==typeof MediaSource.isTypeSupported},e));a&&a.then?a.then((function(){n.emit(_N,{from:t,to:e})})):this.emit(_N,{from:t,to:e})}else this.config.url=e.url}},{key:"reload",value:function(){this.load(),this.reloadFunc=function(){this.play()},this.once(eN,this.reloadFunc)}},{key:"resetState",value:function(){var e=this,t=[TF.NOT_ALLOW_AUTOPLAY,TF.PLAYING,TF.NO_START,TF.PAUSED,TF.REPLAY,TF.ENTER,TF.ENDED,TF.ERROR,TF.LOADING];this.hasStart=!1,this.isError=!1,this._useAutoplay=!1,this.mediaPause(),this._accPlayed.acc=0,this._accPlayed.t=0,this._accPlayed.loopAcc=0,Py(t).call(t,(function(t){e.removeClass(t)})),this.addClass(TF.NO_START),this.emit(xN)}},{key:"reset",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1?arguments[1]:void 0;if(this.resetState(),this.plugins&&(ub(t).call(t,(function(t){e.deregister(t)})),i)){var n,r=EF();SO(n=Cy(this.config)).call(n,(function(t){"undefined"===e.config[t]||"plugins"!==t&&"presets"!==t&&"el"!==t&&"id"!==t||(e.config[t]=r[t])}))}}},{key:"destroy",value:function(){var e,t,n,r=this,a=this.innerContainer,s=this.root,o=this.media;if(s&&o){if(this.hasStart=!1,this._useAutoplay=!1,s.removeAttribute(jN),o.removeAttribute(jN),this.updateAcc("destroy"),this._unbindEvents(),this._detachSourceEvents(this.media),DM.clearAllTimers(this),this.emit(fN),null===(n=FF)||void 0===n||n.remove(this),kF.destroy(this),eF(this),KO(UO(i.prototype),"destroy",this).call(this),this.fullscreen&&this._fullscreenEl===this.root&&this.exitFullscreen(),a)for(var l=a.children,u=0;u<l.length;u++)a.removeChild(l[u]);!a&&o instanceof window.Node&&s.contains(o)&&!this.config.remainMediaAfterDestroy&&s.removeChild(o),ub(e=["topBar","leftBar","rightBar","innerContainer"]).call(e,(function(e){r[e]&&s.removeChild(r[e]),r[e]=null}));var c=s.className.split(" ");c.length>0?s.className=Dy(c).call(c,(function(e){return zy(e).call(e,"xgplayer")<0})).join(" "):s.className="",this.removeAttribute("data-xgfill"),Py(t=["isSeeking","isCanplay","isActive","cssfullscreen","fullscreen"]).call(t,(function(e){r[e]=!1}))}}},{key:"replay",value:function(){var e=this;this.removeClass(TF.ENDED),this.currentTime=0,this.isSeeking=!1,tF(this,"replay",(function(){e.once(qM,(function(){var t=e.mediaPlay();t&&t.catch&&t.catch((function(e){console.log(e)}))})),e.emit(dN),e.onPlay()}))}},{key:"retry",value:function(){var e=this;this.removeClass(TF.ERROR),this.addClass(TF.LOADING),tF(this,"retry",(function(){var t=e.currentTime,i=e.config.url,n=DM.isMSE(e.media)?{url:i}:e.preProcessUrl(i);e.src=n.url,!e.config.isLive&&(e.currentTime=t),e.once($M,(function(){e.mediaPlay()}))}))}},{key:"changeFullStyle",value:function(e,t,i,n){e&&(n||(n=TF.PARENT_FULLSCREEN),this._orgCss||(this._orgCss=DM.filterStyleFromText(e)),DM.addClass(e,i),t&&t!==e&&!this._orgPCss&&(this._orgPCss=DM.filterStyleFromText(t),DM.addClass(t,n),t.setAttribute(jN,this.playerId)))}},{key:"recoverFullStyle",value:function(e,t,i,n){n||(n=TF.PARENT_FULLSCREEN),this._orgCss&&(DM.setStyleFromCsstext(e,this._orgCss),this._orgCss=""),DM.removeClass(e,i),t&&t!==e&&this._orgPCss&&(DM.setStyleFromCsstext(t,this._orgPCss),this._orgPCss="",DM.removeClass(t,n),t.removeAttribute(jN))}},{key:"getFullscreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget,t=this.root,i=this.media;if("video"!==e&&"media"!==e||(e=this[e]),e||(e=t),this._fullScreenOffset={top:DM.scrollTop(),left:DM.scrollLeft()},this._fullscreenEl=e,this._fullActionFrom="get",DM.getFullScreenEl()===this._fullscreenEl)return this.onFullscreenChange(),nb.resolve();try{for(var n=0;n<KN.length;n++){var r=KN[n];if(e[r]){var a="webkitRequestFullscreen"===r?e.webkitRequestFullscreen(window.Element.ALLOW_KEYBOARD_INPUT):e[r]();return a&&a.then?a:nb.resolve()}}return i.fullscreenEnabled||i.webkitSupportsFullscreen?(i.webkitEnterFullscreen(),nb.resolve()):nb.reject(new Error("call getFullscreen fail"))}catch(s){return nb.reject(new Error("call getFullscreen fail"))}}},{key:"exitFullscreen",value:function(e){if(this.isRotateFullscreen&&this.exitRotateFullscreen(),this._fullscreenEl||DM.getFullScreenEl()){this.root;var t=this.media;this._fullActionFrom="exit";try{for(var i=0;i<WN.length;i++){var n=WN[i];if(document[n]){var r=document[n]();return r&&r.then?r:nb.resolve()}}return t&&t.webkitSupportsFullscreen?(t.webkitExitFullScreen(),nb.resolve()):nb.reject(new Error("call exitFullscreen fail"))}catch(a){return nb.reject(new Error("call exitFullscreen fail"))}}}},{key:"getCssFullscreen",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.isRotateFullscreen?this.exitRotateFullscreen():this.fullscreen&&this.exitFullscreen();var i=t?Hy(e="".concat(TF.INNER_FULLSCREEN," ")).call(e,TF.CSS_FULLSCREEN):TF.CSS_FULLSCREEN;this.changeFullStyle(this.root,t,i);var n=this.config.fullscreen,r=void 0===n?{}:n;(!0===r.useCssFullscreen||"function"==typeof r.useCssFullscreen&&r.useCssFullscreen())&&(this.fullscreen=!0,this.emit(kN,!0)),this._cssfullscreenEl=t,this.cssfullscreen=!0,this.emit(TN,!0)}},{key:"exitCssFullscreen",value:function(){var e,t=this._cssfullscreenEl?Hy(e="".concat(TF.INNER_FULLSCREEN," ")).call(e,TF.CSS_FULLSCREEN):TF.CSS_FULLSCREEN;if(this.fullscreen){var i=this.config.fullscreen,n=void 0===i?{}:i;!0===n.useCssFullscreen||"function"==typeof n.useCssFullscreen&&n.useCssFullscreen()?(this.recoverFullStyle(this.root,this._cssfullscreenEl,t),this.fullscreen=!1,this.emit(kN,!1)):this.removeClass(t)}else this.recoverFullStyle(this.root,this._cssfullscreenEl,t);this._cssfullscreenEl=null,this.cssfullscreen=!1,this.emit(TN,!1)}},{key:"getRotateFullscreen",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.fullscreenTarget;this.cssfullscreen&&this.exitCssFullscreen(t);var i=t?Hy(e="".concat(TF.INNER_FULLSCREEN," ")).call(e,TF.ROTATE_FULLSCREEN):TF.ROTATE_FULLSCREEN;this._fullscreenEl=t||this.root,this.changeFullStyle(this.root,t,i,TF.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!0,this.fullscreen=!0,this.setRotateDeg(90),this._rootStyle=this.root.getAttribute("style"),this.root.style.width="".concat(window.innerHeight,"px"),this.emit(kN,!0)}},{key:"exitRotateFullscreen",value:function(e){var t,i=this._fullscreenEl!==this.root?Hy(t="".concat(TF.INNER_FULLSCREEN," ")).call(t,TF.ROTATE_FULLSCREEN):TF.ROTATE_FULLSCREEN;this.recoverFullStyle(this.root,this._fullscreenEl,i,TF.PARENT_ROTATE_FULLSCREEN),this.isRotateFullscreen=!1,this.fullscreen=!1,this.setRotateDeg(0),this.emit(kN,!1),this._rootStyle&&(this.root.style.style=this._rootStyle,this._rootStyle=!1)}},{key:"setRotateDeg",value:function(e){90===window.orientation||-90===window.orientation?this.rotateDeg=0:this.rotateDeg=e}},{key:"focus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!this.config.closeDelayBlur,delay:this.config.inactive};this.isActive?this.onFocus(e):this.emit(aN,DO({paused:this.paused,ended:this.ended},e))}},{key:"blur",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ignorePaused:!1};this.isActive?(this._clearUserTimer(),this.emit(sN,DO({paused:this.paused,ended:this.ended},e))):this.onBlur(e)}},{key:"onFocus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{autoHide:!0,delay:3e3},i=this.innerStates;if(this.isActive=!0,this.removeClass(TF.INACTIVE),this._clearUserTimer(),void 0!==t.isLock&&(i.isActiveLocked=t.isLock),!1===t.autoHide||!0===t.isLock||i.isActiveLocked)this._clearUserTimer();else{var n=t&&t.delay?t.delay:this.config.inactive;this.userTimer=DM.setTimeout(this,(function(){e.userTimer=null,e.blur()}),n)}}},{key:"onBlur",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).ignorePaused,t=void 0!==e&&e;if(!this.innerStates.isActiveLocked){var i=this.config.closePauseVideoFocus;this.isActive=!1,(t||i||!this.paused&&!this.ended)&&this.addClass(TF.INACTIVE)}}},{key:"onEmptied",value:function(){this.updateAcc("emptied")}},{key:"onCanplay",value:function(){this.removeClass(TF.ENTER),this.removeClass(TF.ERROR),this.removeClass(TF.LOADING),this.isCanplay=!0,this.waitTimer&&DM.clearTimeout(this,this.waitTimer)}},{key:"onLoadeddata",value:function(){var e=this;this.isError=!1,this.isSeeking=!1,this.__startTime>0&&(this.duration>0?this._seekToStartTime():this.once(ZM,(function(){e._seekToStartTime()})))}},{key:"onLoadstart",value:function(){this.removeClass(TF.ERROR),this.isCanplay=!1}},{key:"onPlay",value:function(){this.state===CF.ENDED&&this.setState(CF.RUNNING),this.removeClass(TF.PAUSED),this.ended&&this.removeClass(TF.ENDED),!this.config.closePlayVideoFocus&&this.focus()}},{key:"onPause",value:function(){this.addClass(TF.PAUSED),this.updateAcc("pause"),this.config.closePauseVideoFocus||(this._clearUserTimer(),this.focus())}},{key:"onEnded",value:function(){this.updateAcc("ended"),this.addClass(TF.ENDED),this.setState(CF.ENDED)}},{key:"onError",value:function(){this.isError=!0,this.updateAcc("error"),this.removeClass(TF.NOT_ALLOW_AUTOPLAY),this.removeClass(TF.NO_START),this.removeClass(TF.ENTER),this.removeClass(TF.LOADING),this.addClass(TF.ERROR)}},{key:"onSeeking",value:function(){this.isSeeking||this.updateAcc("seeking"),this.isSeeking=!0,this.addClass(TF.SEEKING)}},{key:"onSeeked",value:function(){this.isSeeking=!1,this.waitTimer&&DM.clearTimeout(this,this.waitTimer),this.removeClass(TF.LOADING),this.removeClass(TF.SEEKING)}},{key:"onWaiting",value:function(){var e=this;this.waitTimer&&DM.clearTimeout(this,this.waitTimer),this.updateAcc("waiting"),this.waitTimer=DM.setTimeout(this,(function(){e.addClass(TF.LOADING),e.emit(yN),DM.clearTimeout(e,e.waitTimer),e.waitTimer=null}),this.config.minWaitDelay)}},{key:"onPlaying",value:function(){var e=this;this.isError=!1;var t=[TF.NO_START,TF.PAUSED,TF.ENDED,TF.ERROR,TF.REPLAY,TF.LOADING];Py(t).call(t,(function(t){e.removeClass(t)})),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onTimeupdate",value:function(){!this._videoHeight&&this.media.videoHeight&&this.resize(),(this.waitTimer||this.hasClass(TF.LOADING))&&this.media.readyState>2&&(this.removeClass(TF.LOADING),DM.clearTimeout(this,this.waitTimer),this.waitTimer=null),!this.paused&&this.state===CF.NOTALLOW&&this.duration&&(this.setState(CF.RUNNING),this.emit(uN)),this._accPlayed.t||this.paused||this.ended||(this._accPlayed.t=(new Date).getTime())}},{key:"onVolumechange",value:function(){"Number"===DM.typeOf(this.config.volume)&&(this.config.volume=this.volume)}},{key:"onRatechange",value:function(){this.config.defaultPlaybackRate=this.playbackRate}},{key:"emitUserAction",value:function(e,t,i){if(this.media&&t&&e){var n="String"===DM.typeOf(e)?e:e.type||"";i.props&&"Array"!==DM.typeOf(i.props)&&(i.props=[i.props]),this.emit(DN,DO({eventType:n,action:t,currentTime:this.currentTime,duration:this.duration,ended:this.ended,event:e},i))}}},{key:"updateAcc",value:function(e){if(this._accPlayed.t){var t=(new Date).getTime()-this._accPlayed.t;this._accPlayed.acc+=t,this._accPlayed.t=0,("ended"===e||this.ended)&&(this._accPlayed.loopAcc=this._accPlayed.acc)}}},{key:"checkBuffer",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{startDiff:0,endDiff:0})||{},i=t.startDiff,n=void 0===i?0:i,r=t.endDiff,a=void 0===r?0:r,s=this.media.buffered;if(!s||0===s.length||!this.duration)return!0;for(var o=e||this.media.currentTime||.2,l=s.length,u=0;u<l;u++)if(s.start(u)+n<=o&&s.end(u)-a>o)return!0;return!1}},{key:"resizePosition",value:function(){var e,t=this,i=this.videoPos,n=i.vy,r=i.vx,a=i.h,s=i.w,o=this.videoPos.rotate;if(!(o<0&&a<0&&s<0)){var l=this.videoPos._pi;if(!l&&this.media.videoHeight&&(l=this.media.videoWidth/this.media.videoHeight*100),l){this.videoPos.pi=l;var u={rotate:o=o<0?0:o},c=0,h=0,d=1,f=Math.abs(o/90),v=this.root,g=this.innerContainer,p=v.offsetWidth,m=g?g.offsetHeight:v.offsetHeight,y={},k=m,T=p;if(f%2==0)d=a>0?100/a:s>0?100/s:1,u.scale=d,c=n>0?(100-a)/2-n:0,u.y=2===f?0-c:c,h=r>0?(100-s)/2-r:0,u.x=2===f?0-h:h,y.width="".concat(T,"px"),y.height="".concat(k,"px"),y.maxWidth="",y.maxHeight="";else if(f%2==1){k=p;var E=m-p;h=-E/2/(T=m)*100,u.x=3===f?h+n/2:h-n/2,c=E/2/k*100,u.y=3===f?c+r/2:c-r/2,u.scale=d,y.width="".concat(T,"px"),y.maxWidth="".concat(T,"px"),y.height="".concat(k,"px"),y.maxHeight="".concat(k,"px")}var S=DM.getTransformStyle(u,this.media.style.transform||this.media.style.webkitTransform);y.transform=S,y.webkitTransform=S,ub(e=Cy(y)).call(e,(function(e){t.media.style[e]=y[e]}))}}}},{key:"position",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{h:0,y:0,x:0,w:0};if(this.media&&e&&e.h){var t=this.videoPos;t.h=100*e.h||0,t.w=100*e.w||0,t.vx=100*e.x||0,t.vy=100*e.y||0,this.resizePosition()}}},{key:"setConfig",value:function(e){var t,i=this;e&&ub(t=Cy(e)).call(t,(function(t){if("plugins"!==t){i.config[t]=e[t];var n=i.plugins[t.toLowerCase()];n&&"Function"===DM.typeOf(n.setConfig)&&n.setConfig(e[t])}}))}},{key:"playNext",value:function(e){var t=this;this.resetState(),this.setConfig(e),this._currentTime=0,this._duration=0,tF(this,"playnext",(function(){t.start(),t.emit(IN,e)}))}},{key:"resize",value:function(){var e=this;if(this.media){var t=this.root.getBoundingClientRect();this.sizeInfo.width=t.width,this.sizeInfo.height=t.height,this.sizeInfo.left=t.left,this.sizeInfo.top=t.top;var i=this.media,n=i.videoWidth,r=i.videoHeight,a=this.config,s=a.fitVideoSize,o=a.videoFillMode;if("fill"!==o&&"cover"!==o&&"contain"!==o||this.setAttribute("data-xgfill",o),r&&n){this._videoHeight=r,this._videoWidth=n;var l,u=this.controls&&this.innerContainer?this.controls.root.getBoundingClientRect().height:0,c=t.width,h=t.height-u,d=Zk(n/r*1e3,10),f=Zk(c/h*1e3,10),v=c,g=h,p={};if("auto"===s&&f>d||"fixWidth"===s?(g=c/d*1e3,this.config.fluid?p.paddingTop="".concat(100*g/v,"%"):p.height="".concat(g+u,"px")):("auto"===s&&f<d||"fixHeight"===s)&&(v=d*h/1e3,p.width="".concat(v,"px")),!this.fullscreen&&!this.cssfullscreen)Py(l=Cy(p)).call(l,(function(t){e.root.style[t]=p[t]}));("fillHeight"===o&&f<d||"fillWidth"===o&&f>d)&&this.setAttribute("data-xgfill","cover");var m={videoScale:d,vWidth:v,vHeight:g,cWidth:v,cHeight:g+u};this.resizePosition(),this.emit(bN,m)}}}},{key:"updateObjectPosition",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.media.updateObjectPosition?this.media.updateObjectPosition(t,i):this.media.style.objectPosition=Hy(e="".concat(100*t,"% ")).call(e,100*i,"%")}},{key:"setState",value:function(e){var t;CM.logInfo("setState",Hy(t="state from:".concat(wF[this.state]," to:")).call(t,wF[e])),this._state=e}},{key:"preProcessUrl",value:function(e,t){var i=this.config,n=i.preProcessUrl,r=i.preProcessUrlOptions,a=Ly({},r,t);return DM.isBlob(e)||"function"!=typeof n?{url:e}:n(e,a)}},{key:"_seekToStartTime",value:function(){this.__startTime>0&&this.duration>0&&(this.currentTime=this.__startTime>this.duration?this.duration:this.__startTime,this.__startTime=-1)}},{key:"state",get:function(){return this._state}},{key:"isFullscreen",get:function(){return this.fullscreen}},{key:"isCssfullScreen",get:function(){return this.cssfullscreen}},{key:"hasStart",get:function(){return this._hasStart},set:function(e){"boolean"==typeof e&&(this._hasStart=e,!1===e&&this.setState(CF.READY),this.emit("hasstart"))}},{key:"isPlaying",get:function(){return this._state===CF.RUNNING||this._state===CF.ENDED},set:function(e){e?this.setState(CF.RUNNING):this._state>=CF.RUNNING&&this.setState(CF.ATTACHED)}},{key:"definitionList",get:function(){return this.config&&this.config.definition&&this.config.definition.list||[]},set:function(e){var t=this,i=this.config.definition,n=null,r=null;i.list=e,this.emit("resourceReady",e),Py(e).call(e,(function(e){var a;(null===(a=t.curDefinition)||void 0===a?void 0:a.definition)===e.definition&&(n=e),i.defaultDefinition===e.definition&&(r=e)})),!r&&e.length>0&&(r=e[0]),n?this.changeDefinition(n):r&&this.changeDefinition(r)}},{key:"videoFrameInfo",get:function(){var e={total:0,dropped:0,corrupted:0,droppedRate:0,droppedDuration:0};if(!this.media||!this.media.getVideoPlaybackQuality)return e;var t=this.media.getVideoPlaybackQuality();return e.dropped=t.droppedVideoFrames||0,e.total=t.totalVideoFrames||0,e.corrupted=t.corruptedVideoFrames||0,e.total>0&&(e.droppedRate=e.dropped/e.total*100,e.droppedDuration=Zk(this.cumulateTime/e.total*e.dropped,0)),e}},{key:"lang",get:function(){return this.config.lang},set:function(e){var t,i;0!==Dy(t=IF.langKeys).call(t,(function(t){return t===e})).length||"zh"===e?(this.config.lang=e,kF.setLang(e,this)):console.error(Hy(i="Sorry, set lang fail, because the language [".concat(e,"] is not supported now, list of all supported languages is [")).call(i,IF.langKeys.join(),"] "))}},{key:"i18n",get:function(){var e=this.config.lang;return"zh"===e&&(e="zh-cn"),this.__i18n.lang[e]||this.__i18n.lang.en}},{key:"i18nKeys",get:function(){return this.__i18n.textKeys||{}}},{key:"version",get:function(){return UM}},{key:"playerId",get:function(){return this._pluginInfoId}},{key:"url",get:function(){return this.__url||this.config.url},set:function(e){this.__url=e}},{key:"poster",get:function(){return this.plugins.poster?this.plugins.poster.config.poster:this.config.poster},set:function(e){this.plugins.poster&&this.plugins.poster.update(e)}},{key:"readyState",get:function(){return KO(UO(i.prototype),"readyState",this)}},{key:"error",get:function(){var e=KO(UO(i.prototype),"error",this);return this.i18n[e]||e}},{key:"networkState",get:function(){return KO(UO(i.prototype),"networkState",this)}},{key:"fullscreenChanging",get:function(){return!(null===this._fullScreenOffset)}},{key:"cumulateTime",get:function(){var e=this._accPlayed,t=e.acc,i=e.t;return i?(new Date).getTime()-i+t:t}},{key:"zoom",get:function(){return this.config.zoom},set:function(e){this.config.zoom=e}},{key:"videoRotateDeg",get:function(){return this.videoPos.rotate},set:function(e){(e=DM.convertDeg(e))%90==0&&e!==this.videoPos.rotate&&(this.videoPos.rotate=e,this.resizePosition())}},{key:"avgSpeed",get:function(){return NF},set:function(e){NF=e}},{key:"realTimeSpeed",get:function(){return MF},set:function(e){MF=e}},{key:"offsetCurrentTime",get:function(){return this._offsetInfo.currentTime||0},set:function(e){this._offsetInfo.currentTime=e}},{key:"offsetDuration",get:function(){return this._offsetInfo.duration||0},set:function(e){this._offsetInfo.duration=e||0}},{key:"hook",value:function(e,t){var i;return zN.call.apply(zN,Hy(i=[this]).call(i,iI(Array.prototype).call(arguments)))}},{key:"useHooks",value:function(e,t){var i;return XN.call.apply(XN,Hy(i=[this]).call(i,iI(Array.prototype).call(arguments)))}},{key:"removeHooks",value:function(e,t){var i;return QN.call.apply(QN,Hy(i=[this]).call(i,iI(Array.prototype).call(arguments)))}},{key:"usePluginHooks",value:function(e,t,i){for(var n,r=arguments.length,a=new Array(r>3?r-3:0),s=3;s<r;s++)a[s-3]=arguments[s];return $N.call.apply($N,Hy(n=[this]).call(n,iI(Array.prototype).call(arguments)))}},{key:"removePluginHooks",value:function(e,t,i){for(var n,r=arguments.length,a=new Array(r>3?r-3:0),s=3;s<r;s++)a[s-3]=arguments[s];return ZN.call.apply(ZN,Hy(n=[this]).call(n,iI(Array.prototype).call(arguments)))}},{key:"setUserActive",value:function(e,t){var i;"boolean"==typeof t&&t!==this.muted&&(this.addInnerOP("volumechange"),DM.typeOf(t)===Boolean&&(this.muted=t)),null===(i=FF)||void 0===i||i.setActive(this.playerId,e)}}],[{key:"debugger",get:function(){return CM.config.debug},set:function(e){CM.config.debug=e}},{key:"instManager",get:function(){return FF},set:function(e){FF=e}},{key:"getCurrentUserActivePlayerId",value:function(){var e;return null===(e=FF)||void 0===e?void 0:e.getActiveId()}},{key:"setCurrentUserActive",value:function(e,t){var i;null===(i=FF)||void 0===i||i.setActive(e,t)}},{key:"isHevcSupported",value:function(){return FM.isHevcSupported()}},{key:"probeConfigSupported",value:function(e){return FM.probeConfigSupported(e)}},{key:"install",value:function(e,t){i.plugins||(i.plugins={}),i.plugins[e]||(i.plugins[e]=t)}},{key:"use",value:function(e,t){i.plugins||(i.plugins={}),i.plugins[e]=t}}]),i}(HN);function BF(){return(new Date).getTime()}NO(UF,"defaultPreset",null),NO(UF,"XgVideoProxy",null),UF.instManager=PF.getInstance();var HF="loadstart",GF="loadeddata",VF="firstFrame",KF="waitingStart",WF="waitingEnd",jF="seekStart",YF="seekEnd",zF=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"_onTimeupdate",(function(){n._state.isTimeUpdate=!0,n._state.autoplayStart&&(CM.logInfo("[xgLogger]".concat(n.player.playerId," _onTimeupdate")),n._sendFF("onTimeupdate"))})),NO(HO(n),"_onAutoplayStart",(function(){CM.logInfo("[xgLogger]".concat(n.player.playerId," _onAutoplayStart")),n._state.autoplayStart=!0,n.vt&&n._sendFF("onAutoplayStart")})),NO(HO(n),"_onReset",(function(){n._state={autoplayStart:!1,isFFLoading:!1,isTimeUpdate:!1,isFFSend:!1,isLs:!1},n.vt=0,n.pt=0,n.fvt=0,n.newPointTime=BF(),n.loadedCostTime=0,n.startCostTime=0,n._isSeeking=!1,n.seekingStart=0,n.waitingStart=0,n.fixedWaitingStart=0,n._isWaiting=!1,n._waitTimer&&DM.clearTimeout(HO(n),n._waitTimer),n._waittTimer&&DM.clearTimeout(HO(n),n._waittTimer),n._waitTimer=null,n._waittTimer=null,n._waitType=0})),NO(HO(n),"_onSeeking",(function(){n.seekingStart||(n.suspendWaitingStatus("seek"),n.seekingStart=BF(),n.emitLog(jF,{start:BF()}))})),NO(HO(n),"_onSeeked",(function(){n.suspendSeekingStatus("seeked")})),NO(HO(n),"_onWaitingLoadStart",(function(){n._isWaiting||n.vt||(n._isWaiting=!0,n.waitingStart=BF(),n.fixedWaitingStart=BF(),n._waitType=1,n.emitLog(KF,{fixedStart:n.fixedWaitingStart,start:n.waitingStart,type:1,endType:"loadstart"}))})),NO(HO(n),"_onWaiting",(function(){!n._isWaiting&&n.vt&&(n._isWaiting=!0,n.vt?n.seekingStart?n._waitType=2:n._waitType=0:n._waitType=1,n.fixedWaitingStart=BF(),n._waitTimer=DM.setTimeout(HO(n),(function(){n._isWaiting&&(n.waitingStart=BF(),DM.clearTimeout(HO(n),n._waitTimer),n._waitTimer=null,n._startWaitTimeout(),n.emitLog(KF,{fixedStart:n.fixedWaitingStart,start:n.waitingStart,type:n._waitType,endType:2===n._waitType?"seek":"playing"}))}),200))})),NO(HO(n),"_onError",(function(){n.suspendSeekingStatus("error"),n.suspendWaitingStatus("error")})),NO(HO(n),"_onPlaying",(function(){n._isWaiting&&n.suspendWaitingStatus("playing")})),n}return MO(i,[{key:"afterCreate",value:function(){var e=this;this._onReset(),this._waitType="firstFrame",this._initOnceEvents(),this.newPointTime=BF(),this.loadedCostTime=0,this.startCostTime=0,this.on(nN,(function(){var t,i,n,r=e._state,a=r.autoplayStart,s=r.isFFSend;e.startCostTime=BF()-e.newPointTime,CM.logInfo("[xgLogger]".concat(e.player.playerId," LOAD_START"),Hy(t=Hy(i=Hy(n="autoplayStart:".concat(a," isFFSend:")).call(n,s," startCostTime:")).call(i,e.startCostTime," newPointTime")).call(t,e.newPointTime)),s||(!r.isLs&&e.emitLog(HF,{}),r.isLs=!0,r.isTimeUpdate=!1,r.isFFLoading=!0,e.pt=BF(),e.vt=0,e.fvt=0,e._initOnceEvents(),e._onWaitingLoadStart())})),this.on(eN,(function(){var t,i;e.vt=BF(),e.fvt=e.vt-e.pt,e.loadedCostTime=e.vt-e.newPointTime;var n=e._state,r=n.isTimeUpdate,a=n.isFFSend,s=n.autoplayStart;CM.logInfo("[xgLogger]".concat(e.player.playerId," LOADED_DATA"),Hy(t=Hy(i="fvt:".concat(e.fvt," isTimeUpdate:")).call(i,e._state.isTimeUpdate," loadedCostTime:")).call(t,e.loadedCostTime)),(r||s)&&e._sendFF("loadedData"),a||e.emitLog(GF,{}),e.suspendWaitingStatus("loadeddata")})),this.on(zM,this._onSeeking),this.on(qM,this._onSeeked),this.on(fN,(function(){e.endState("destroy")})),this.on(vN,(function(){e.endState("urlChange"),CM.logInfo("[xgLogger]".concat(e.player.playerId," URL_CHANGE")),e._state.isFFSend&&e._onReset()})),this.on([KM,$M],this._onPlaying),this.on(QM,this._onWaiting),this.on(YM,this._onError),this.on(xN,(function(){CM.logInfo("[xgLogger]".concat(e.player.playerId," RESET")),e.endState("reset"),e._initOnceEvents(),e._onReset()}))}},{key:"_initOnceEvents",value:function(){this.off(uN,this._onAutoplayStart),this.off(XM,this._onTimeupdate),this.once(uN,this._onAutoplayStart),this.once(XM,this._onTimeupdate)}},{key:"_sendFF",value:function(e){var t,i,n;this.s=BF();var r=this._state,a=r.isFFLoading,s=r.isFFSend;CM.logInfo("[xgLogger]".concat(this.player.playerId," _sendFF"),Hy(t=Hy(i=Hy(n="".concat(e," fvt:")).call(n,this.fvt," isFFLoading:")).call(i,a," !isFFSend:")).call(t,!s)),this.vt>0&&a&&!s&&(CM.logInfo("[xgLogger]".concat(this.player.playerId," emitLog_firstFrame"),e),this._state.isFFLoading=!1,this._state.isFFSend=!0,this.emitLog(VF,{fvt:this.fvt,costTime:this.fvt,vt:this.vt,startCostTime:this.startCostTime,loadedCostTime:this.loadedCostTime}))}},{key:"_startWaitTimeout",value:function(){var e=this;this._waittTimer&&DM.clearTimeout(this,this._waittTimer),this._waittTimer=DM.setTimeout(this,(function(){e.suspendWaitingStatus("timeout"),DM.clearTimeout(e,e._waittTimer),e._waittTimer=null}),this.config.waitTimeout)}},{key:"endState",value:function(e){this.suspendWaitingStatus(e),this.suspendSeekingStatus(e)}},{key:"suspendSeekingStatus",value:function(e){if(this.seekingStart){var t=BF(),i=t-this.seekingStart;this.seekingStart=0,this.emitLog(YF,{end:t,costTime:i,endType:e})}}},{key:"suspendWaitingStatus",value:function(e){if(this._waitTimer&&(DM.clearTimeout(this,this._waitTimer),this._waitTimer=null),this._waittTimer&&(DM.clearTimeout(this,this._waittTimer),this._waittTimer=null),this._isWaiting=!1,this.waitingStart){var t=BF(),i=t-this.waitingStart,n=t-this.fixedWaitingStart,r=this.config.waitTimeout;this._isWaiting=!1,this.waitingStart=0,this.fixedWaitingStart=0,this.emitLog(WF,{fixedCostTime:n>r?r:n,costTime:i>r?r:i,type:"loadeddata"===e?1:this._waitType,endType:2===this._waitType?"seek":e})}}},{key:"emitLog",value:function(e,t){var i=this.player;this.emit(wN,DO({t:BF(),host:DM.getHostFromUrl(i.currentSrc),vtype:i.vtype,eventType:e,currentTime:this.player.currentTime,readyState:i.video.readyState,networkState:i.video.networkState},t))}}],[{key:"pluginName",get:function(){return"xgLogger"}},{key:"defaultConfig",get:function(){return{waitTimeout:1e4}}}]),i}(pF);function qF(){return(new DOMParser).parseFromString('<svg class="xgplayer-replay-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 78 78" width="78" height="78">\n <path fill="#fff" transform="translate(20, 20)" d="M8.22708362,13.8757234 L11.2677371,12.6472196 C11.7798067,12.4403301 12.3626381,12.6877273 12.5695276,13.1997969 L12.9441342,14.1269807 C13.1510237,14.6390502 12.9036264,15.2218816 12.3915569,15.4287712 L6.8284538,17.6764107 L5.90126995,18.0510173 C5.38920044,18.2579068 4.80636901,18.0105096 4.5994795,17.49844 L1.97723335,11.0081531 C1.77034384,10.4960836 2.0177411,9.91325213 2.52981061,9.70636262 L3.45699446,9.33175602 C3.96906396,9.12486652 4.5518954,9.37226378 4.75878491,9.88433329 L5.67885163,12.1615783 C7.99551726,6.6766934 13.3983951,3 19.5,3 C27.7842712,3 34.5,9.71572875 34.5,18 C34.5,26.2842712 27.7842712,33 19.5,33 C15.4573596,33 11.6658607,31.3912946 8.87004692,28.5831991 C8.28554571,27.9961303 8.28762719,27.0463851 8.87469603,26.4618839 C9.46176488,25.8773827 10.4115101,25.8794641 10.9960113,26.466533 C13.2344327,28.7147875 16.263503,30 19.5,30 C26.127417,30 31.5,24.627417 31.5,18 C31.5,11.372583 26.127417,6 19.5,6 C14.4183772,6 9.94214483,9.18783811 8.22708362,13.8757234 Z"></path>\n</svg>\n',"image/svg+xml").firstChild}var XF=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"registerIcons",value:function(){return{replay:qF}}},{key:"afterCreate",value:function(){var e=this;pF.insert(this.icons.replay,this.root,0),this.__handleReplay=this.hook("replayClick",(function(){e.player.replay()}),{pre:function(e){e.preventDefault(),e.stopPropagation()}}),Iy(this).call(this,".xgplayer-replay",["click","touchend"],this.__handleReplay),this.on(WM,(function(){if(e.playerConfig.loop||DM.addClass(e.player.root,"replay"),!e.config.disable){e.show();var t=e.root.querySelector("path");if(t){var i=window.getComputedStyle(t).getPropertyValue("transform");if("string"==typeof i&&zy(i).call(i,"none")>-1)return null;t.setAttribute("transform",i)}}})),this.on(VM,(function(){e.hide()}))}},{key:"handleReplay",value:function(e){e.preventDefault(),e.stopPropagation(),this.player.replay(),DM.removeClass(this.player.root,"replay")}},{key:"show",value:function(e){this.config.disable||(this.root.style.display="flex")}},{key:"enable",value:function(){this.config.disable=!1}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){this.unbind(".xgplayer-replay",["click","touchend"],this.__handleReplay)}},{key:"render",value:function(){var e;return Hy(e='<xg-replay class="xgplayer-replay">\n <xg-replay-txt class="xgplayer-replay-txt" lang-key="'.concat(this.i18nKeys.REPLAY,'">')).call(e,this.i18n.REPLAY,"</xg-replay-txt>\n </xg-replay>")}}],[{key:"pluginName",get:function(){return"replay"}},{key:"defaultConfig",get:function(){return{disable:!1}}}]),i}(pF),QF=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){DM.addClass(this.root,"hide")}},{key:"show",value:function(e){DM.removeClass(this.root,"hide")}},{key:"beforeCreate",value:function(e){"string"==typeof e.player.config.poster&&(e.config.poster=e.player.config.poster)}},{key:"afterCreate",value:function(){var e=this;this.on(WM,(function(){e.isEndedShow&&DM.removeClass(e.root,"hide")})),this.config.hideCanplay?(this.once(XM,(function(){e.onTimeUpdate()})),this.on(vN,(function(){DM.removeClass(e.root,"hide"),DM.addClass(e.root,"xg-showplay"),e.once(XM,(function(){e.onTimeUpdate()}))}))):this.on(VM,(function(){DM.addClass(e.root,"hide")}))}},{key:"setConfig",value:function(e){var t,i=this;Py(t=Cy(e)).call(t,(function(t){i.config[t]=e[t]}));var n=this.config.poster;this.update(n)}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?DM.removeClass(this.root,"xg-showplay"):this.once(XM,(function(){e.onTimeUpdate()}))}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"getBgSize",value:function(e){var t="";switch(e){case"cover":t="cover";break;case"contain":t="contain";break;case"fixHeight":t="auto 100%";break;default:t=""}return t?"background-size: ".concat(t,";"):""}},{key:"render",value:function(){var e,t,i=this.config,n=i.poster,r=i.hideCanplay,a=i.fillMode,s=i.notHidden,o=this.getBgSize(a),l=n?Hy(e="background-image:url(".concat(n,");")).call(e,o):o;return Hy(t='<xg-poster class="xgplayer-poster '.concat(s?"xg-not-hidden":r?"xg-showplay":"",'" style="')).call(t,l,'">\n </xg-poster>')}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}}]),i}(pF);function $F(){return(new DOMParser).parseFromString('<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>\n</svg>\n',"image/svg+xml").firstChild}function ZF(){return(new DOMParser).parseFromString('<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>\n</svg>\n',"image/svg+xml").firstChild}var JF={};function eU(e){var t;e?window.clearTimeout(e):ub(t=Cy(JF)).call(t,(function(e){window.clearTimeout(JF[e].id),delete JF[e]}))}var tU=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),NO(HO(n=t.call(this,e)),"onPlayerReset",(function(){n.autoPlayStart=!1;var e="auto"===n.config.mode?"auto-hide":"hide";n.setAttr("data-state","play"),DM.removeClass(n.root,e),n.show()})),NO(HO(n),"onAutoplayStart",(function(){if(!n.autoPlayStart){var e="auto"===n.config.mode?"auto-hide":"hide";DM.addClass(n.root,e),n.autoPlayStart=!0,n.toggleTo("play")}})),n.autoPlayStart=!1,n}return MO(i,[{key:"afterCreate",value:function(){var e=this.playerConfig;this.initIcons(),this.listenEvents(),this.bindClickEvents(),e.autoplay||this.show()}},{key:"listenEvents",value:function(){var e=this,t=this.player,i=this.playerConfig;this.once(oN,(function(){i&&(i.lang&&"en"===i.lang?DM.addClass(t.root,"lang-is-en"):"jp"===i.lang&&DM.addClass(t.root,"lang-is-jp"))})),this.on(uN,this.onAutoplayStart),this.on(cN,(function(){var t="auto"===e.config.mode?"auto-hide":"hide";e.setAttr("data-state","play"),DM.removeClass(e.root,t),e.show()})),this.on(VM,(function(){e.toggleTo("play")})),this.on(jM,(function(){e.toggleTo("pause")})),this.on(xN,(function(){e.onPlayerReset()}))}},{key:"bindClickEvents",value:function(){var e=this;this.clickHandler=this.hook("startClick",this.switchPausePlay,{pre:function(t){t.cancelable&&t.preventDefault(),t.stopPropagation();var i=e.player.paused;e.emitUserAction(t,"switch_play_pause",{props:"paused",from:i,to:!i})}}),Iy(this).call(this,["click","touchend"],this.clickHandler)}},{key:"registerIcons",value:function(){return{startPlay:{icon:$F,class:"xg-icon-play"},startPause:{icon:ZF,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild("xg-start-inner",e.startPlay),this.appendChild("xg-start-inner",e.startPause)}},{key:"hide",value:function(){DM.addClass(this.root,"hide")}},{key:"show",value:function(e){DM.removeClass(this.root,"hide")}},{key:"focusHide",value:function(){DM.addClass(this.root,"focus-hide")}},{key:"recover",value:function(){DM.removeClass(this.root,"focus-hide")}},{key:"switchStatus",value:function(e){e?this.setAttr("data-state",this.player.paused?"pause":"play"):this.setAttr("data-state",this.player.paused?"play":"pause")}},{key:"animate",value:function(e){var t=this;this._animateId=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{start:null,end:null};return JF[e]&&window.clearTimeout(JF[e].id),JF[e]={},i.start&&i.start(),JF[e].id=gC((function(){i.end&&i.end(),window.clearTimeout(JF[e].id),delete JF[e]}),t),JF[e].id}("pauseplay",400,{start:function(){DM.addClass(t.root,"interact"),t.show(),t.switchStatus(!0)},end:function(){DM.removeClass(t.root,"interact"),!e&&t.hide(),t._animateId=null}})}},{key:"endAnimate",value:function(){DM.removeClass(this.root,"interact"),eU(this._animateId),this._animateId=null}},{key:"switchPausePlay",value:function(e){var t=this.player;(e.cancelable&&e.preventDefault(),e.stopPropagation(),t.state<CF.READY)||(this.player.paused||t.state!==CF.RUNNING?t.play():t.pause())}},{key:"onPlayPause",value:function(e){this.toggleTo(e)}},{key:"toggleTo",value:function(e){var t=this.config,i=this.player;if(i&&!(i.state<CF.RUNNING)&&this.autoPlayStart){if("show"===t.mode)return this.switchStatus(),void this.show();if("auto"!==t.mode){if(t.isShowPause&&i.paused&&!i.ended||t.isShowEnd&&i.ended)return this.switchStatus(),this.show(),void this.endAnimate();if(t.disableAnimate)return this.switchStatus(),void this.hide();if("play"===e)this.autoPlayStart?this.animate():this.hide();else{if(!this.autoPlayStart||i.ended)return;this.animate()}}else this.switchStatus()}}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.clickHandler),eU(this._animateId)}},{key:"render",value:function(){var e=this.playerConfig.autoplay?"auto"===this.config.mode?"auto-hide":"hide":"";return'\n <xg-start class="xgplayer-start '.concat(e,'">\n <xg-start-inner></xg-start-inner>\n </xg-start>')}}],[{key:"pluginName",get:function(){return"start"}},{key:"defaultConfig",get:function(){return{isShowPause:!1,isShowEnd:!1,disableAnimate:!1,mode:"hide"}}}]),i}(pF),iU=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"render",value:function(){var e=this.config.innerHtml,t=DM.createDom("xg-enter","",{},"xgplayer-enter");if(e&&e instanceof window.HTMLElement)t.appendChild(e);else if(e&&"string"==typeof e)t.innerHTML=e;else{for(var i="",n=1;n<=12;n++)i+='<div class="xgplayer-enter-bar'.concat(n,'"></div>');t.innerHTML='<div class="xgplayer-enter-spinner">'.concat(i,"</div>")}return t}}],[{key:"pluginName",get:function(){return"enter"}},{key:"defaultConfig",get:function(){return{innerHtml:"",logo:""}}}]),i}(pF);function nU(e,t,i){try{var n,r;return Hy(n=Hy(r=' <div class="xg-tips '.concat(i?"hide":" ",'" lang-key="')).call(r,e.i18nKeys[t],'">\n ')).call(n,e.i18n[t],"\n </div>")}catch(a){return'<div class="xg-tips hide"></div>'}}var rU=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"afterCreate",value:function(){var e,t;this.getMini=Iy(e=this.getMini).call(e,this),this.exitMini=Iy(t=this.exitMini).call(t,this),Iy(this).call(this,"click",this.getMini)}},{key:"getMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"exitMini",value:function(){this.config.onClick&&this.config.onClick()}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.getMini)}},{key:"render",value:function(){var e,t="MINISCREEN";return Hy(e='\n <xg-icon class="xgplayer-miniicon">\n <div class="xgplayer-icon btn-text"><span class="icon-text" lang-key="'.concat(this.i18nKeys[t],'">')).call(e,this.i18n[t],"</span></div>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"miniscreenIcon"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:10}}}]),i}(pF);function aU(e){var t=Tb(e);return-1===zy(e).call(e,"%")&&!vO(t)&&t}var sU=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],oU=sU.length;function lU(e){if("string"==typeof e&&(e=document.querySelector(e)),e&&"object"===xO(e)&&e.nodeType){var t=function(e){return window.getComputedStyle(e)}(e);if("none"===t.display)return function(){for(var e={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},t=0;t<oU;t++)e[sU[t]]=0;return e}();var i={};i.width=e.offsetWidth,i.height=e.offsetHeight;for(var n=i.isBorderBox="border-box"===t.boxSizing,r=0;r<oU;r++){var a=sU[r],s=t[a],o=Tb(s);i[a]=vO(o)?0:o}var l=i.paddingLeft+i.paddingRight,u=i.paddingTop+i.paddingBottom,c=i.marginLeft+i.marginRight,h=i.marginTop+i.marginBottom,d=i.borderLeftWidth+i.borderRightWidth,f=i.borderTopWidth+i.borderBottomWidth,v=n,g=aU(t.width);!1!==g&&(i.width=g+(v?0:l+d));var p=aU(t.height);return!1!==p&&(i.height=p+(v?0:u+f)),i.innerWidth=i.width-(l+d),i.innerHeight=i.height-(u+f),i.outerWidth=i.width+c,i.outerHeight=i.height+h,i}}function uU(e,t){for(var i=0;i<e.length;i++){var n=e[i];if(n.identifier===t)return n}}var cU="dragStart",hU="dragMove",dU="dragEnded",fU={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},vU=function(e){FO(i,e);var t=VO(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return PO(this,i),(n=t.call(this)).isEnabled=!0,n.isDragging=!1,n.isDown=!1,n.position={},n.downPoint={},n.dragPoint={x:0,y:0},n.startPos={x:0,y:0},n._root=e instanceof Element?e:document.querySelector(e),n._handlerDom=r.handle instanceof Element?r.handle:document.querySelector(r.handle),n._root&&n._handlerDom?(n._bindStartEvent(),n):GO(n)}return MO(i,[{key:"_bindStartEvent",value:function(){var e,t,i=this;"ontouchstart"in window?this._startKey="touchstart":this._startKey="mousedown",this["on".concat(this._startKey)]=Iy(e=this["on".concat(this._startKey)]).call(e,this),this._handlerDom.addEventListener(this._startKey,this["on".concat(this._startKey)]),ub(t=fU[this._startKey]).call(t,(function(e){var t;i["on".concat(e)]=Iy(t=i["on".concat(e)]).call(t,i)}))}},{key:"_unbindStartEvent",value:function(){this._handlerDom.removeEventListener(this._startKey,this["on".concat(this._startKey)])}},{key:"_bindPostStartEvents",value:function(e){var t=this;if(e){var i=fU[this._startKey];ub(i).call(i,(function(e){window.addEventListener(e,t["on".concat(e)])})),this._boundPointerEvents=i}}},{key:"_unbindPostStartEvents",value:function(){var e,t=this;this._boundPointerEvents&&(ub(e=this._boundPointerEvents).call(e,(function(e){window.removeEventListener(e,t["on".concat(e)])})),delete this._boundPointerEvents)}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1,this.isDragging&&this.onUp()}},{key:"onDocUp",value:function(e){this.onUp()}},{key:"animate",value:function(){var e=this;this.isDragging&&(this.positionDrag(),window.requestAnimationFrame((function(){e.animate()})))}},{key:"positionDrag",value:function(){var e,t=Hy(e="translate3d(".concat(this.dragPoint.x,"px, ")).call(e,this.dragPoint.y,"px, 0)");this._root.style.transform=t,this._root.style.webKitTransform=t}},{key:"setLeftTop",value:function(){this._root.style.left=this.position.x+"px",this._root.style.top=this.position.y+"px"}},{key:"onmousedown",value:function(e){this.dragStart(e,e)}},{key:"onmousemove",value:function(e){this.dragMove(e,e)}},{key:"onmouseup",value:function(e){this.dragEnd(e,e)}},{key:"ontouchstart",value:function(e){var t=e.changedTouches[0];this.dragStart(e,t),this.touchIdentifier=void 0!==t.pointerId?t.pointerId:t.identifier,e.preventDefault()}},{key:"ontouchmove",value:function(e){var t=uU(e.changedTouches,this.touchIdentifier);t&&this.dragMove(e,t)}},{key:"ontouchend",value:function(e){var t=uU(e.changedTouches,this.touchIdentifier);t&&this.dragEnd(e,t),e.preventDefault()}},{key:"ontouchcancel",value:function(e){var t=uU(e.changedTouches,this.touchIdentifier);t&&this.dragCancel(e,t)}},{key:"dragStart",value:function(e,t){if(this._root&&!this.isDown&&this.isEnabled){this.downPoint=t,this.dragPoint.x=0,this.dragPoint.y=0,this._getPosition();var i=lU(this._root);this.startPos.x=this.position.x,this.startPos.y=this.position.y,this.startPos.maxY=window.innerHeight-i.height,this.startPos.maxX=window.innerWidth-i.width,this.setLeftTop(),this.isDown=!0,this._bindPostStartEvents(e)}}},{key:"dragRealStart",value:function(e,t){this.isDragging=!0,this.animate(),this.emit(cU,this.startPos)}},{key:"dragEnd",value:function(e,t){this._root&&(this._unbindPostStartEvents(),this.isDragging&&(this._root.style.transform="",this.setLeftTop(),this.emit(dU)),this.presetInfo())}},{key:"_dragPointerMove",value:function(e,t){var i={x:t.pageX-this.downPoint.pageX,y:t.pageY-this.downPoint.pageY};return!this.isDragging&&this.hasDragStarted(i)&&this.dragRealStart(e,t),i}},{key:"dragMove",value:function(e,t){if(e=e||window.event,this.isDown){var i=this.startPos,n=i.x,r=i.y,a=this._dragPointerMove(e,t),s=a.x,o=a.y;s=this.checkContain("x",s,n),o=this.checkContain("y",o,r),this.position.x=n+s,this.position.y=r+o,this.dragPoint.x=s,this.dragPoint.y=o,this.emit(hU,this.position)}}},{key:"dragCancel",value:function(e,t){this.dragEnd(e,t)}},{key:"presetInfo",value:function(){this.isDragging=!1,this.startPos={x:0,y:0},this.dragPoint={x:0,y:0},this.isDown=!1}},{key:"destroy",value:function(){this._unbindStartEvent(),this._unbindPostStartEvents(),this.isDragging&&this.dragEnd(),this.removeAllListeners(),this._handlerDom=null}},{key:"hasDragStarted",value:function(e){return Math.abs(e.x)>3||Math.abs(e.y)>3}},{key:"checkContain",value:function(e,t,i){return t+i<0?0-i:"x"===e&&t+i>this.startPos.maxX?this.startPos.maxX-i:"y"===e&&t+i>this.startPos.maxY?this.startPos.maxY-i:t}},{key:"_getPosition",value:function(){var e=window.getComputedStyle(this._root),t=this._getPositionCoord(e.left,"width"),i=this._getPositionCoord(e.top,"height");this.position.x=vO(t)?0:t,this.position.y=vO(i)?0:i,this._addTransformPosition(e)}},{key:"_addTransformPosition",value:function(e){var t=e.transform;if(0===zy(t).call(t,"matrix")){var i=t.split(","),n=0===zy(t).call(t,"matrix3d")?12:4,r=Zk(i[n],10),a=Zk(i[n+1],10);this.position.x+=r,this.position.y+=a}}},{key:"_getPositionCoord",value:function(e,t){if(-1!==zy(e).call(e,"%")){var i=lU(this._root.parentNode);return i?Tb(e)/100*i[t]:0}return Zk(e,10)}}]),i}(XO),gU=function(e){FO(i,e);var t=VO(i);function i(e){var n;PO(this,i),NO(HO(n=t.call(this,e)),"onCancelClick",(function(e){n.exitMini(),n.isClose=!0})),NO(HO(n),"onCenterClick",(function(e){var t=HO(n).player;t.paused?t.play():t.pause()})),NO(HO(n),"onScroll",(function(e){if(!(!window.scrollY&&0!==window.scrollY||Math.abs(window.scrollY-n.pos.scrollY)<50)){var t=Zk(DM.getCss(n.player.root,"height"));t+=n.config.scrollTop,n.pos.scrollY=window.scrollY,window.scrollY>t+5?!n.isMini&&!n.isClose&&n.getMini():window.scrollY<=t&&(n.isMini&&n.exitMini(),n.isClose=!1)}})),n.isMini=!1,n.isClose=!1;var r=HO(n).config;return n.pos={left:r.left<0?window.innerWidth-r.width-20:r.left,top:r.top<0?window.innerHeight-r.height-20:r.top,height:n.config.height,width:n.config.width,scrollY:window.scrollY||0},n.lastStyle=null,n}return MO(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.mini&&(e.config.isShowIcon=e.player.config.mini)}},{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.on(jM,(function(){e.setAttr("data-state","pause")})),this.on(VM,(function(){e.setAttr("data-state","play")}))}},{key:"onPluginsReady",value:function(){var e=this,t=this.player;if(!this.config.disable){if(this.config.isShowIcon){var i={config:{onClick:function(){e.getMini()}}};t.controls.registerPlugin(rU,i,rU.pluginName)}var n=DM.checkTouchSupport()?"touchend":"click";Iy(this).call(this,".mini-cancel-btn",n,this.onCancelClick),Iy(this).call(this,".play-icon",n,this.onCenterClick),this.config.disableDrag||(this._draggabilly=new vU(this.player.root,{handle:this.root})),this.config.isScrollSwitch&&window.addEventListener("scroll",this.onScroll)}}},{key:"registerIcons",value:function(){return{play:{icon:$F,class:"xg-icon-play"},pause:{icon:ZF,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".play-icon",e.play),this.appendChild(".play-icon",e.pause)}},{key:"getMini",value:function(){var e,t=this;if(!this.isMini){var i=this.player,n=this.playerConfig,r=this.config.target||this.player.root;this.lastStyle={},DM.addClass(i.root,"xgplayer-mini"),ub(e=["width","height","top","left"]).call(e,(function(e){t.lastStyle[e]=r.style[e],r.style[e]="".concat(t.pos[e],"px")})),n.fluid&&(r.style["padding-top"]=""),this.emit(EN,!0),i.isMini=this.isMini=!0}}},{key:"exitMini",value:function(){var e=this;if(!this.isMini)return!1;var t,i=this.player,n=this.playerConfig,r=this.config.target||this.player.root;(DM.removeClass(i.root,"xgplayer-mini"),this.lastStyle)&&ub(t=Cy(this.lastStyle)).call(t,(function(t){r.style[t]=e.lastStyle[t]}));this.lastStyle=null,n.fluid&&(i.root.style.width="100%",i.root.style.height="0",i.root.style["padding-top"]="".concat(100*n.height/n.width,"%")),this.emit(EN,!1),this.isMini=i.isMini=!1}},{key:"destroy",value:function(){window.removeEventListener("scroll",this.onScroll);var e=DM.checkTouchSupport()?"touchend":"click";this.unbind(".mini-cancel-btn",e,this.onCancelClick),this.unbind(".play-icon",e,this.onCenterClick),this._draggabilly&&this._draggabilly.destroy(),this._draggabilly=null,this.exitMini()}},{key:"render",value:function(){if(!this.config.disable)return'\n <xg-mini-layer class="xg-mini-layer">\n <xg-mini-header class="xgplayer-mini-header">\n '.concat(nU(this,"MINI_DRAG",this.playerConfig.isHideTips),'\n </xg-mini-header>\n <div class="mini-cancel-btn">\n <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">\n <path fill="#fff" fill-rule="evenodd" d="M3.99 3.49a1 1 0 0 1 1.414 0L10 8.085l4.596-4.595a1 1 0 1 1 1.414 1.414L11.414 9.5l4.596 4.596a1 1 0 0 1 .084 1.32l-.084.094a1 1 0 0 1-1.414 0L10 10.914 5.404 15.51a1 1 0 0 1-1.414-1.414L8.585 9.5 3.99 4.904a1 1 0 0 1-.084-1.32z"></path>\n </svg>\n </div>\n <div class="play-icon">\n </div>\n </xg-mini-layer>')}}],[{key:"pluginName",get:function(){return"miniscreen"}},{key:"defaultConfig",get:function(){return{index:10,disable:!1,width:320,height:180,left:-1,top:-1,isShowIcon:!1,isScrollSwitch:!1,scrollTop:0,disableDrag:!1}}}]),i}(pF),pU={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},mU=["videoClick","videoDbClick"],yU=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"onMouseMove",(function(e){var t=HO(n),i=t.player,r=t.playerConfig;i.isActive||(i.focus({autoHide:!r.closeDelayBlur}),!r.closeFocusVideoFocus&&i.media.focus())})),NO(HO(n),"onMouseEnter",(function(e){var t=HO(n),i=t.playerConfig,r=t.player;!i.closeFocusVideoFocus&&r.media.focus(),i.closeDelayBlur?r.focus({autoHide:!1}):r.focus(),n.emit(mN)})),NO(HO(n),"onMouseLeave",(function(e){var t=n.playerConfig,i=t.closePlayerBlur,r=t.leavePlayerTime,a=t.closeDelayBlur;i||a||(r?n.player.focus({autoHide:!0,delay:r}):n.player.blur({ignorePaused:!0})),n.emit(pN)})),NO(HO(n),"onVideoClick",(function(e){var t=HO(n),i=t.player,r=t.playerConfig;e.target&&r.closeVideoClick||e.target!==i.root&&e.target!==i.media&&e.target!==i.innerContainer&&e.target!==i.media.__canvas||(e.preventDefault(),r.closeVideoStopPropagation||e.stopPropagation(),n._clickCount++,n.clickTimer&&(clearTimeout(n.clickTimer),n.clickTimer=null),n.clickTimer=gC((function(){n._clickCount&&(n._clickCount--,tF(HO(n),mU[0],(function(e,t){n.switchPlayPause(t.e)}),{e:e,paused:i.paused}),clearTimeout(n.clickTimer),n.clickTimer=null)}),300))})),NO(HO(n),"onVideoDblClick",(function(e){var t=HO(n),i=t.player,r=t.playerConfig;r.closeVideoDblclick||!e.target||e.target!==i.media&&e.target!==i.media.__canvas||(!r.closeVideoClick&&n._clickCount<2?n._clickCount=0:(n._clickCount=0,n.clickTimer&&(clearTimeout(n.clickTimer),n.clickTimer=null),e.preventDefault(),e.stopPropagation(),tF(HO(n),mU[1],(function(e,t){n.emitUserAction(t.e,"switch_fullscreen",{props:"fullscreen",from:i.fullscreen,to:!i.fullscreen}),i.fullscreen?i.exitFullscreen():i.getFullscreen()}),{e:e,fullscreen:i.fullscreen})))})),n}return MO(i,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,ub(mU).call(mU,(function(t){e.__hooks[t]=null})),"mobile"===this.playerConfig.isMobileSimulateMode||"mobile"===FM.device&&!FM.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var e,t=this,i=this.player,n=i.media,r=i.root,a=this.playerConfig.enableContextmenu;r&&r.addEventListener("click",this.onVideoClick,!1),r&&r.addEventListener("dblclick",this.onVideoDblClick,!1),ub(e=Cy(pU)).call(e,(function(e){r.addEventListener(e,t[pU[e]],!1)})),!a&&n&&n.addEventListener("contextmenu",this.onContextmenu,!1)}},{key:"switchPlayPause",value:function(e){var t=this.player;this.emitUserAction(e,"switch_play_pause",{props:"paused",from:t.paused,to:!t.paused}),t.ended?t.duration!==1/0&&t.duration>0&&t.replay():t.paused?t.play():t.pause()}},{key:"onContextmenu",value:function(e){(e=e||window.event).preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var e,t=this,i=this.player,n=i.video,r=i.root;this.clickTimer&&clearTimeout(this.clickTimer),r.removeEventListener("click",this.onVideoClick,!1),r.removeEventListener("dblclick",this.onVideoDblClick,!1),n.removeEventListener("contextmenu",this.onContextmenu,!1),ub(e=Cy(pU)).call(e,(function(e){r.removeEventListener(e,t[pU[e]],!1)}))}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),i}(nF),kU="press",TU="pressend",EU="doubleclick",SU="click",_U="touchmove",bU="touchstart",AU="touchend",RU={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},LU={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"};function IU(e){return e&&e.length>0?e[e.length-1]:null}var CU=function(){function e(t){var i,n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{eventType:"touch"};PO(this,e),NO(this,"onTouchStart",(function(e){var t=n._pos,i=n.root,r=IU(e.touches);t.x=r?Zk(r.pageX,10):e.pageX,t.y=r?Zk(r.pageX,10):e.pageX,t.start=!0,n.__setPress(e),i.addEventListener(n.events.end,n.onTouchEnd),i.addEventListener(n.events.cancel,n.onTouchCancel),i.addEventListener(n.events.move,n.onTouchMove),n.trigger(bU,e)})),NO(this,"onTouchCancel",(function(e){n.onTouchEnd(e)})),NO(this,"onTouchEnd",(function(e){var t=n._pos,i=n.root;n.__clearPress(),i.removeEventListener(n.events.cancel,n.onTouchCancel),i.removeEventListener(n.events.end,n.onTouchEnd),i.removeEventListener(n.events.move,n.onTouchMove),e.moving=t.moving,e.press=t.press,t.press&&n.trigger(TU,e),n.trigger(AU,e),!t.press&&!t.moving&&n.__setDb(e),t.press=!1,t.start=!1,t.moving=!1})),NO(this,"onTouchMove",(function(e){var t=n._pos,i=n.config,r=IU(e.touches),a=r?Zk(r.pageX,10):e.pageX,s=r?Zk(r.pageY,10):e.pageX,o=a-t.x,l=s-t.y;Math.abs(l)<i.miniStep&&Math.abs(o)<i.miniStep||(n.__clearPress(),t.press&&n.trigger(TU,e),t.press=!1,t.moving=!0,n.trigger(_U,e))})),this._pos={moving:!1,start:!1,x:0,y:0},this.config={pressDelay:600,dbClickDelay:200,disablePress:!1,disableDbClick:!1,miniStep:2,needPreventDefault:!0},ub(i=Cy(r)).call(i,(function(e){n.config[e]=r[e]})),this.root=t,this.events="mouse"===r.eventType?LU:RU,this.pressIntrvalId=null,this.dbIntrvalId=null,this.__handlers={},this._initEvent()}return MO(e,[{key:"_initEvent",value:function(){this.root.addEventListener(this.events.start,this.onTouchStart)}},{key:"__setPress",value:function(e){var t=this,i=this.config;this.pressIntrvalId&&this.__clearPress(),this.pressIntrvalId=gC((function(){t.trigger(kU,e),t._pos.press=!0,t.__clearPress()}),i.pressDelay)}},{key:"__clearPress",value:function(){window.clearTimeout(this.pressIntrvalId),this.pressIntrvalId=null}},{key:"__setDb",value:function(e){var t=this,i=this.config;if(this.dbIntrvalId)return this.__clearDb(),void this.trigger(EU,e);this.dbIntrvalId=gC((function(){t.__clearDb(),t._pos.start||t._pos.press||t._pos.moving||t.trigger(SU,e)}),i.dbClickDelay)}},{key:"__clearDb",value:function(){clearTimeout(this.dbIntrvalId),this.dbIntrvalId=null}},{key:"on",value:function(e,t){this.__handlers[e]||(this.__handlers[e]=[]),this.__handlers[e].push(t)}},{key:"off",value:function(e,t){if(this.__handlers[e]){for(var i,n=this.__handlers[e],r=-1,a=0;a<n.length;a++)if(n[a]===t){r=a;break}if(r>=0)mw(i=this.__handlers[e]).call(i,r,1)}}},{key:"trigger",value:function(e,t){var i;this.__handlers[e]&&ub(i=this.__handlers[e]).call(i,(function(i){try{i(t)}catch(GG){console.error("trigger>>:".concat(e),GG)}}))}},{key:"destroy",value:function(){var e,t=this,i={touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"};Py(e=Cy(i)).call(e,(function(e){t.root.removeEventListener(e,t[i[e]])}))}}]),e}();function wU(){return(new DOMParser).parseFromString('<svg width="20" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink">\n <path opacity="0.54"\n d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z"\n fill="white" />\n <path transform="translate(5 0)" d="M7.5 3.63397C8.16667 4.01887 8.16667 4.98113 7.5 5.36603L1.5 8.83013C0.833334 9.21503 0 8.7339 0 7.9641L0 1.0359C0 0.266098 0.833333 -0.215027 1.5 0.169873L7.5 3.63397Z" fill="white"/>\n</svg>',"image/svg+xml").firstChild}var DU="auto",xU="seeking",PU="playbackrate",OU=["videoClick","videoDbClick"],MU=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),NO(HO(n=t.call(this,e)),"onTouchStart",(function(e){var t=HO(n),i=t.player,r=t.config,a=t.pos,s=t.playerConfig,o=n.getTouche(e);if(o&&!r.disableGesture&&n.duration>0&&!i.ended){a.isStart=!0,n.timer&&clearTimeout(n.timer),DM.checkIsFunction(s.disableSwipeHandler)&&s.disableSwipeHandler(),$P(n).call(n,".xg-dur").innerHTML=DM.format(n.duration);var l=n.root.getBoundingClientRect();90===i.rotateDeg?(a.top=l.left,a.left=l.top,a.width=l.height,a.height=l.width):(a.top=l.top,a.left=l.left,a.width=l.width,a.height=l.height);var u=Zk(o.pageX-a.left,10),c=Zk(o.pageY-a.top,10);a.x=90===i.rotateDeg?c:u,a.y=90===i.rotateDeg?u:c,a.scopeL=r.scopeL*a.width,a.scopeR=(1-r.scopeR)*a.width,a.scopeM1=a.width*(1-r.scopeM)/2,a.scopeM2=a.width-a.scopeM1}})),NO(HO(n),"onTouchMove",(function(e){var t=n.getTouche(e),i=HO(n),r=i.pos,a=i.config,s=i.player;if(t&&!a.disableGesture&&n.duration&&r.isStart){var o=a.miniMoveStep,l=a.hideControlsActive,u=Zk(t.pageX-r.left,10),c=Zk(t.pageY-r.top,10),h=90===s.rotateDeg?c:u,d=90===s.rotateDeg?u:c;if(Math.abs(h-r.x)>o||Math.abs(d-r.y)>o){var f=h-r.x,v=d-r.y,g=r.scope;if(-1===g&&(0===(g=n.checkScope(h,d,f,v,r))&&(l?s.blur():s.focus({autoHide:!1}),!r.time&&(r.time=Zk(1e3*s.currentTime,10)+1e3*n.timeOffset)),r.scope=g),-1===g||g>0&&!a.gestureY||0===g&&!a.gestureX)return;n.executeMove(f,v,g,r.width,r.height),r.x=h,r.y=d}}})),NO(HO(n),"onTouchEnd",(function(e){var t=HO(n),i=t.player,r=t.pos,a=t.playerConfig;if(gC((function(){i.getPlugin("progress")&&i.getPlugin("progress").resetSeekState()}),10),r.isStart){r.scope>-1&&e.cancelable&&e.preventDefault();var s=n.config,o=s.disableGesture,l=s.gestureX;!o&&l?n.endLastMove(r.scope):r.time=0,r.scope=-1,n.resetPos(),DM.checkIsFunction(a.enableSwipeHandler)&&a.enableSwipeHandler(),n.changeAction(DU)}})),NO(HO(n),"onRootTouchMove",(function(e){!n.config.disableGesture&&n.config.gestureX&&n.checkIsRootTarget(e)&&(e.stopPropagation(),n.pos.isStart?n.onTouchMove(e):n.onTouchStart(e))})),NO(HO(n),"onRootTouchEnd",(function(e){n.pos.scope>-1&&n.onTouchEnd(e)})),n.pos={isStart:!1,x:0,y:0,time:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1},n.timer=null,n}return MO(i,[{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"registerIcons",value:function(){return{seekTipIcon:{icon:wU,class:"xg-seek-pre"}}}},{key:"afterCreate",value:function(){var e,t=this;ub(OU).call(OU,(function(e){t.__hooks[e]=null}));var i=this.playerConfig,n=this.config,r=this.player;!0===i.closeVideoDblclick&&(n.closedbClick=!0),this.resetPos(),DM.isUndefined(i.disableGesture)||(n.disableGesture=!!i.disableGesture),this.appendChild(".xg-seek-icon",this.icons.seekTipIcon),this.xgMask=DM.createDom("xg-mask","",{},"xgmask"),r.root.appendChild(this.xgMask),this.initCustomStyle(),this.registerThumbnail();var a="mouse"===this.domEventType?"mouse":"touch";this.touch=new CU(this.root,{eventType:a,needPreventDefault:!this.config.disableGesture}),this.root.addEventListener("contextmenu",(function(e){e.preventDefault()})),r.root.addEventListener("touchmove",this.onRootTouchMove,!0),r.root.addEventListener("touchend",this.onRootTouchEnd,!0),r.root.addEventListener("touchcancel",this.onRootTouchEnd,!0);var s=this.player.controls;s&&s.center&&(s.center.addEventListener("touchmove",this.onRootTouchMove,!0),s.center.addEventListener("touchend",this.onRootTouchEnd,!0),s.center.addEventListener("touchcancel",this.onRootTouchEnd,!0)),this.on(ZM,(function(){var e=t.player,i=t.config;e.duration>0&&1e3*e.duration<i.moveDuration&&(i.moveDuration=1e3*e.duration)})),this.on([$M,WM],(function(){var e=t.pos,i=e.time;!e.isStart&&i>0&&(t.pos.time=0)}));var o={touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",press:"onPress",pressend:"onPressEnd",click:"onClick",doubleclick:"onDbClick"};if(ub(e=Cy(o)).call(e,(function(e){t.touch.on(e,(function(i){t[o[e]](i)}))})),!n.disableActive){var l,u=r.plugins.progress;if(u)u.addCallBack("dragmove",(function(e){t.activeSeekNote(e.currentTime,e.forward)})),Py(l=["dragend","click"]).call(l,(function(e){u.addCallBack(e,(function(){t.changeAction(DU)}))}))}}},{key:"registerThumbnail",value:function(){var e=this.player.plugins.thumbnail;if(e&&e.usable){this.thumbnail=e.createThumbnail(null,"mobile-thumbnail");var t=$P(this).call(this,".time-preview");t.insertBefore(this.thumbnail,t.children[0])}}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle,t=e.playedColor,i=e.progressColor,n=e.timePreviewStyle,r=e.curTimeColor,a=e.durationColor;t&&($P(this).call(this,".xg-curbar").style.backgroundColor=t);i&&($P(this).call(this,".xg-bar").style.backgroundColor=i);if(n){var s,o=$P(this).call(this,".time-preview");Py(s=Cy(n)).call(s,(function(e){o.style[e]=n[e]}))}var l=r||t,u=a;l&&($P(this).call(this,".xg-cur").style.color=l),u&&($P(this).call(this,".xg-dur").style.color=u),this.config.disableTimeProgress&&DM.addClass($P(this).call(this,".xg-timebar"),"hide")}},{key:"resetPos",value:function(){var e,t=this;this.pos?(this.pos.isStart=!1,this.pos.scope=-1,ub(e=["x","y","width","height","scopeL","scopeR","scopeM1","scopeM2"]).call(e,(function(e){t.pos[e]=0}))):this.pos={isStart:!1,x:0,y:0,volume:0,rate:1,light:0,width:0,height:0,scopeL:0,scopeR:0,scopeM1:0,scopeM2:0,scope:-1,time:0}}},{key:"changeAction",value:function(e){var t=this.player;this.root.setAttribute("data-xg-action",e);var i=t.plugins.start;i&&i.recover()}},{key:"getTouche",value:function(e){this.player.rotateDeg;var t=e.touches&&e.touches.length>0?e.touches[e.touches.length-1]:e;return{pageX:t.pageX,pageY:t.pageY}}},{key:"checkScope",value:function(e,t,i,n,r){var a=r.width,s=-1;if(e<0||e>a)return s;var o=0===n?Math.abs(i):Math.abs(i/n);return Math.abs(i)>0&&o>=1.73&&e>r.scopeM1&&e<r.scopeM2?s=0:(0===Math.abs(i)||o<=.57)&&(s=e<r.scopeL?1:e>r.scopeR?2:3),s}},{key:"executeMove",value:function(e,t,i,n,r){switch(i){case 0:this.updateTime(e/n*this.config.scopeM);break;case 1:this.updateBrightness(t/r);break;case 2:FM.os.isIos||this.updateVolume(t/r)}}},{key:"endLastMove",value:function(e){var t=this,i=this.pos,n=this.player,r=this.config,a=(i.time-this.timeOffset)/1e3;if(0===e)n.seek(Number(a).toFixed(1)),r.hideControlsEnd?n.blur():n.focus(),this.timer=gC((function(){t.pos.time=0}),500);this.changeAction(DU)}},{key:"checkIsRootTarget",value:function(e){var t=this.player.plugins||{};return(!t.progress||!t.progress.root.contains(e.target))&&(t.start&&t.start.root.contains(e.target)||t.controls&&t.controls.root.contains(e.target))}},{key:"sendUseAction",value:function(e){var t=this.player.paused;this.emitUserAction(e,"switch_play_pause",{prop:"paused",from:t,to:!t})}},{key:"clickHandler",value:function(e){var t=this.player,i=this.config,n=this.playerConfig;t.state<CF.RUNNING?n.closeVideoClick||(this.sendUseAction(DM.createEvent("click")),t.play()):!i.closedbClick||n.closeVideoClick?t.isActive?t.blur():t.focus():n.closeVideoClick||((t.isActive||i.focusVideoClick)&&(this.sendUseAction(DM.createEvent("click")),this.switchPlayPause()),t.focus())}},{key:"dbClickHandler",value:function(e){var t=this.config,i=this.player;!t.closedbClick&&i.state>=CF.RUNNING&&(this.sendUseAction(DM.createEvent("dblclick")),this.switchPlayPause())}},{key:"onClick",value:function(e){var t=this,i=this.player;tF(this,OU[0],(function(e,i){t.clickHandler(i.e)}),{e:e,paused:i.paused})}},{key:"onDbClick",value:function(e){var t=this,i=this.player;tF(this,OU[1],(function(e,i){t.dbClickHandler(i.e)}),{e:e,paused:i.paused})}},{key:"onPress",value:function(e){var t=this.pos,i=this.config,n=this.player;i.disablePress||(t.rate=this.player.playbackRate,this.emitUserAction("press","change_rate",{prop:"playbackRate",from:n.playbackRate,to:i.pressRate}),n.playbackRate=i.pressRate,this.changeAction(PU))}},{key:"onPressEnd",value:function(e){var t=this.pos,i=this.config,n=this.player;i.disablePress||(this.emitUserAction("pressend","change_rate",{prop:"playbackRate",from:n.playbackRate,to:t.rate}),n.playbackRate=t.rate,t.rate=1,this.changeAction(DU))}},{key:"updateTime",value:function(e){var t=this.player,i=this.config,n=this.player.duration;e=Number(e.toFixed(4));var r=Zk(e*i.moveDuration,10)+this.timeOffset;r=(r+=this.pos.time)<0?0:r>1e3*n?1e3*n-200:r,t.getPlugin("time")&&t.getPlugin("time").updateTime(r/1e3),t.getPlugin("progress")&&t.getPlugin("progress").updatePercent(r/1e3/this.duration,!0),this.activeSeekNote(r/1e3,e>0),i.isTouchingSeek&&t.seek(Number((r-this.timeOffset)/1e3).toFixed(1)),this.pos.time=r}},{key:"updateVolume",value:function(e){this.player.rotateDeg&&(e=-e);var t=this.player,i=this.pos;if(e=Zk(100*e,10),i.volume+=e,!(Math.abs(i.volume)<10)){var n=Zk(10*t.volume,10)-Zk(i.volume/10,10);n=n>10?10:n<1?0:n,t.volume=n/10,i.volume=0}}},{key:"updateBrightness",value:function(e){var t=this.pos,i=this.config,n=this.xgMask;if(i.darkness){this.player.rotateDeg&&(e=-e);var r=t.light+.8*e;r=r>i.maxDarkness?i.maxDarkness:r<0?0:r,n&&(n.style.backgroundColor="rgba(0,0,0,".concat(r,")")),t.light=r}}},{key:"activeSeekNote",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.player,n=this.config,r=!(this.duration!==1/0&&this.duration>0);if(e&&"number"==typeof e&&!r&&!n.disableActive){e<0?e=0:e>i.duration&&(e=i.duration-.2),this.changeAction(xU);var a=i.plugins.start;if(a&&a.focusHide(),$P(this).call(this,".xg-dur").innerHTML=DM.format(this.duration),$P(this).call(this,".xg-cur").innerHTML=DM.format(e),$P(this).call(this,".xg-curbar").style.width="".concat(e/this.duration*100,"%"),t)DM.removeClass($P(this).call(this,".xg-seek-show"),"xg-back");else DM.addClass($P(this).call(this,".xg-seek-show"),"xg-back");this.updateThumbnails(e)}}},{key:"updateThumbnails",value:function(e){var t=this.player.plugins.thumbnail;t&&t.usable&&this.thumbnail&&t.update(this.thumbnail,e,160,90)}},{key:"switchPlayPause",value:function(){var e=this.player;if(e.state<CF.ATTACHED)return!1;e.ended||(e.paused?e.play():e.pause())}},{key:"disableGesture",value:function(){this.config.disableGesture=!0}},{key:"enableGesture",value:function(){this.config.disableGesture=!1}},{key:"destroy",value:function(){var e=this.player;this.timer&&clearTimeout(this.timer),this.thumbnail=null,e.root.removeChild(this.xgMask),this.xgMask=null,this.touch&&this.touch.destroy(),this.touch=null,e.root.removeEventListener("touchmove",this.onRootTouchMove,!0),e.root.removeEventListener("touchend",this.onRootTouchEnd,!0),e.root.removeEventListener("touchcancel",this.onRootTouchEnd,!0);var t=this.player.controls;t&&t.center&&(t.center.removeEventListener("touchmove",this.onRootTouchMove,!0),t.center.removeEventListener("touchend",this.onRootTouchEnd,!0),t.center.removeEventListener("touchcancel",this.onRootTouchEnd,!0))}},{key:"render",value:function(){var e,t,i,n="normal"!==this.config.gradient?"gradient ".concat(this.config.gradient):"gradient";return Hy(e=Hy(t=Hy(i='\n <xg-trigger class="trigger">\n <div class="'.concat(n,'"></div>\n <div class="time-preview">\n <div class="xg-seek-show ')).call(i,this.config.disableSeekIcon?" hide-seek-icon":"",'">\n <i class="xg-seek-icon"></i>\n <span class="xg-cur">00:00</span>\n <span class="xg-separator">/</span>\n <span class="xg-dur">00:00</span>\n </div>\n <div class="xg-bar xg-timebar">\n <div class="xg-curbar"></div>\n </div>\n </div>\n <div class="xg-playbackrate xg-top-note">\n <span><i>')).call(t,this.config.pressRate,"X</i>")).call(e,this.i18n.FORWARD,"</span>\n </div>\n </xg-trigger>\n ")}}],[{key:"pluginName",get:function(){return"mobile"}},{key:"defaultConfig",get:function(){return{index:0,disableGesture:!1,gestureX:!0,gestureY:!0,gradient:"normal",isTouchingSeek:!1,miniMoveStep:5,miniYPer:5,scopeL:.25,scopeR:.25,scopeM:.9,pressRate:2,darkness:!0,maxDarkness:.8,disableActive:!1,disableTimeProgress:!1,hideControlsActive:!1,hideControlsEnd:!1,moveDuration:36e4,closedbClick:!1,disablePress:!0,disableSeekIcon:!1,focusVideoClick:!1}}}]),i}(pF);Ci({target:"String",proto:!0},{repeat:eM});var NU=Qo("String").repeat,FU=le,UU=NU,BU=String.prototype,HU=i((function(e){var t=e.repeat;return"string"==typeof e||e===BU||FU(BU,e)&&t===BU.repeat?UU:t}));function GU(e){var t=e.tagName;return!("INPUT"!==t&&"TEXTAREA"!==t&&!e.isContentEditable)}var VU=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"onBodyKeyDown",(function(e){if(n.player){var t=e||window.event,i=t.keyCode,r=HO(n),a=r._keyState,s=r.player,o=n.config,l=o.disable,u=o.disableBodyTrigger,c=o.isIgnoreUserActive;l||u||!s.isUserActive&&!c||GU(t.target)||!n.checkIsVisible()||t.metaKey||t.altKey||t.ctrlKey?a.isBodyKeyDown=!1:(HU(e)||a.isKeyDown||((t.target===document.body||n.config.isGlobalTrigger&&!GU(t.target))&&n.checkCode(i,!0)&&(a.isBodyKeyDown=!0),document.addEventListener("keyup",n.onBodyKeyUp)),a.isBodyKeyDown&&n.handleKeyDown(t))}})),NO(HO(n),"onBodyKeyUp",(function(e){n.player&&(document.removeEventListener("keyup",n.onBodyKeyUp),n.handleKeyUp(e))})),NO(HO(n),"onKeydown",(function(e){if(n.player){var t=e||window.event,i=HO(n)._keyState;if(!HU(t)){if(n.config.disable||n.config.disableRootTrigger||t.metaKey||t.altKey||t.ctrlKey)return;!t||37!==t.keyCode&&!n.checkCode(t.keyCode)||t.target!==n.player.root&&t.target!==n.player.video&&t.target!==n.player.controls.el||(i.isKeyDown=!0),n.player.root.addEventListener("keyup",n.onKeyup)}i.isKeyDown&&n.handleKeyDown(t)}})),NO(HO(n),"onKeyup",(function(e){n.player&&(n.player.root.removeEventListener("keyup",n.onKeyup),n.handleKeyUp(e))})),n}return MO(i,[{key:"mergekeyCodeMap",value:function(){var e,t=this,i=this.config.keyCodeMap;i&&ub(e=Cy(i)).call(e,(function(e){var n;t.keyCodeMap[e]?ub(n=["keyCode","action","disable","pressAction","disablePress","isBodyTarget"]).call(n,(function(n){i[e][n]&&(t.keyCodeMap[e][n]=i[e][n])})):t.keyCodeMap[e]=i[e]}))}},{key:"afterCreate",value:function(){this.config.disable=!this.playerConfig.keyShortcut;var e="function"==typeof this.config.seekStep?this.config.seekStep(this.player):this.config.seekStep;e&&"number"==typeof e&&(this.seekStep=e),this.keyCodeMap={space:{keyCode:32,action:"playPause",disable:!1,disablePress:!1,noBodyTarget:!1},up:{keyCode:38,action:"upVolume",disable:!1,disablePress:!1,noBodyTarget:!0},down:{keyCode:40,action:"downVolume",disable:!1,disablePress:!1,noBodyTarget:!0},left:{keyCode:37,action:"seekBack",disablePress:!1,disable:!1},right:{keyCode:39,action:"seek",pressAction:"changePlaybackRate",disablePress:!1,disable:!1},esc:{keyCode:27,action:"exitFullscreen",disablePress:!0,disable:!1}},this.mergekeyCodeMap(),this._keyState={isKeyDown:!1,isBodyKeyDown:!1,isPress:!1,tt:0,playbackRate:0},this.player.root.addEventListener("keydown",this.onKeydown),document.addEventListener("keydown",this.onBodyKeyDown)}},{key:"setConfig",value:function(e){var t,i=this;Py(t=Cy(e)).call(t,(function(t){i.config[t]=e[t]}))}},{key:"checkIsVisible",value:function(){if(!this.config.checkVisible)return!0;var e=this.player.root.getBoundingClientRect(),t=e.height,i=e.top,n=e.bottom,r=window.innerHeight;return!(i<0&&i<0-.9*t||n>0&&n-r>.9*t)}},{key:"checkCode",value:function(e,t){var i,n=this,r=!1;return ub(i=Cy(this.keyCodeMap)).call(i,(function(i){n.keyCodeMap[i]&&e===n.keyCodeMap[i].keyCode&&!n.keyCodeMap[i].disable&&(r=!t||t&&!n.keyCodeMap[i].noBodyTarget)})),r}},{key:"downVolume",value:function(e){var t=this.player;if(!(t.volume<=0)){var i=Tb((t.volume-.1).toFixed(1)),n={volume:{from:t.volume,to:i}};this.emitUserAction(e,"change_volume",{props:n}),t.volume=i>=0?i:0}}},{key:"upVolume",value:function(e){var t=this.player;if(!(t.volume>=1)){var i=Tb((t.volume+.1).toFixed(1)),n={volume:{from:t.volume,to:i}};this.emitUserAction(e,"change_volume",{props:n}),t.volume=i<=1?i:1}}},{key:"seek",value:function(e){var t=this.player,i=t.currentTime,n=t.offsetCurrentTime,r=t.duration,a=t.offsetDuration,s=t.timeSegments,o=n>-1?n:i,l=a||r,u=HU(e)&&this.seekStep>=4?Zk(this.seekStep/2,10):this.seekStep;o+u<=l?o+=u:o=l;var c=DM.getCurrentTimeByOffset(o,s),h={currentTime:{from:i,to:c}};this.emitUserAction(e,"seek",{props:h}),this.player.currentTime=c}},{key:"seekBack",value:function(e){var t=this.player,i=t.currentTime,n=t.offsetCurrentTime,r=t.timeSegments,a=(n>-1?n:i)-(HU(e)?Zk(this.seekStep/2,10):this.seekStep);a<0&&(a=0);var s={currentTime:{from:i,to:a=DM.getCurrentTimeByOffset(a,r)}};this.emitUserAction(e,"seek",{props:s}),this.player.currentTime=a}},{key:"changePlaybackRate",value:function(e){var t=this._keyState,i=this.config,n=this.player;0===t.playbackRate&&(t.playbackRate=n.playbackRate,n.playbackRate=i.playbackRate)}},{key:"playPause",value:function(e){var t=this.player;t&&(this.emitUserAction(e,"switch_play_pause"),t.paused?t.play():t.pause())}},{key:"exitFullscreen",value:function(e){var t=this.player,i=t.fullscreen,n=t.cssfullscreen;i&&(this.emitUserAction("keyup","switch_fullscreen",{prop:"fullscreen",from:i,to:!i}),t.exitFullscreen()),n&&(this.emitUserAction("keyup","switch_css_fullscreen",{prop:"cssfullscreen",from:n,to:!n}),t.exitCssFullscreen())}},{key:"handleKeyDown",value:function(e){var t=this._keyState;if(HU(e)){t.isPress=!0;var i=JC();if(i-t.tt<200)return;t.tt=i}this.handleKeyCode(e.keyCode,e,t.isPress)}},{key:"handleKeyUp",value:function(e){var t=this._keyState;t.playbackRate>0&&(this.player.playbackRate=t.playbackRate,t.playbackRate=0),t.isKeyDown=!1,t.isPress=!1,t.tt=0}},{key:"handleKeyCode",value:function(e,t,i){for(var n,r=Cy(this.keyCodeMap),a=0;a<r.length;a++){var s=this.keyCodeMap[r[a]],o=s.action,l=s.keyCode,u=s.disable,c=s.pressAction,h=s.disablePress;if(l===e){if(!(u||i&&h)){var d=i&&c||o;"function"==typeof d?o(t,this.player,i):"string"==typeof d&&"function"==typeof this[d]&&this[d](t,this.player,i),this.emit(CN,DO({key:r[a],target:t.target,isPress:i},this.keyCodeMap[r[a]]))}(n=t).preventDefault(),n.returnValue=!1,t.stopPropagation();break}}}},{key:"destroy",value:function(){this.player.root.removeEventListener("keydown",this.onKeydown),document.removeEventListener("keydown",this.onBodyKeyDown),this.player.root.removeEventListener("keyup",this.onKeyup),document.removeEventListener("keyup",this.onBodyKeyUp)}},{key:"disable",value:function(){this.config.disable=!0}},{key:"enable",value:function(){this.config.disable=!1}}],[{key:"pluginName",get:function(){return"keyboard"}},{key:"defaultConfig",get:function(){return{seekStep:10,checkVisible:!1,disableBodyTrigger:!1,disableRootTrigger:!1,isGlobalTrigger:!0,keyCodeMap:{},disable:!1,playbackRate:2,isIgnoreUserActive:!0}}}]),i}(nF);function KU(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="-5 -5 110 110">\n <path d="M100,50A50,50,0,1,1,50,0" stroke-width="5" stroke="#ddd" stroke-dasharray="236" fill="none"></path>\n</svg>\n',"image/svg+xml").firstChild}var WU=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"registerIcons",value:function(){return{loadingIcon:KU}}},{key:"afterCreate",value:function(){this.appendChild("xg-loading-inner",this.icons.loadingIcon)}},{key:"render",value:function(){return'\n <xg-loading class="xgplayer-loading">\n <xg-loading-inner></xg-loading-inner>\n </xg-loading>'}}],[{key:"pluginName",get:function(){return"loading"}},{key:"defaultConfig",get:function(){return{position:hF.ROOT}}}]),i}(pF),jU=Ci,YU=Ua.findIndex,zU="findIndex",qU=!0;zU in[]&&Array(1)[zU]((function(){qU=!1})),jU({target:"Array",proto:!0,forced:qU},{findIndex:function(e){return YU(this,e,arguments.length>1?arguments[1]:void 0)}});var XU=Qo("Array").findIndex,QU=le,$U=XU,ZU=Array.prototype,JU=i((function(e){var t=e.findIndex;return e===ZU||QU(ZU,e)&&t===ZU.findIndex?$U:t})),eB=[{tag:"xg-cache",className:"xgplayer-progress-cache",styleKey:"cachedColor"},{tag:"xg-played",className:"xgplayer-progress-played",styleKey:"playedColor"}],tB=function(){function e(t){PO(this,e),this.fragments=t.fragments||[],0===this.fragments.length&&this.fragments.push({percent:1}),this._callBack=t.actionCallback,this.fragConfig={fragFocusClass:t.fragFocusClass||"inner-focus-point",fragAutoFocus:!!t.fragAutoFocus,fragClass:t.fragClass||""},this.style=t.style||{playedColor:"",cachedColor:"",progressColor:""},this.duration=0,this.cachedIndex=0,this.playedIndex=0,this.focusIndex=-1}return MO(e,[{key:"updateDuration",value:function(e){var t=this;this.duration=e;var i=0,n=this.fragments;this.fragments=ub(n).call(n,(function(e){return e.start=Zk(i,10),e.end=Zk(i+e.percent*t.duration,10),e.duration=Zk(e.percent*t.duration,10),i+=e.percent*t.duration,e}))}},{key:"updateProgress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"played",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{newIndex:0,curIndex:0,millisecond:0},i=this.progressList,n=this.fragments;if(!(i.length<1)){var r=t.newIndex,a=t.curIndex,s=t.millisecond;r!==a&&ub(i).call(i,(function(t,i){i<r?t[e].style.width="100%":i>r&&(t[e].style.width=0)}));var o=n[r],l=0===s?0:(s-o.start)/o.duration;i[r][e].style.width=l<0?0:"".concat(100*l,"%")}}},{key:"updateFocus",value:function(e){if(this.fragConfig.fragAutoFocus&&!(this.fragments.length<2))if(e){var t=JU(this).call(this,1e3*e.currentTime,this.focusIndex);if(t>=0&&t!==this.focusIndex){this.focusIndex>-1&&this.unHightLight(this.focusIndex),this.setHightLight(t);var i={index:t,preIndex:this.focusIndex,fragment:this.fragments[this.focusIndex]};this.focusIndex=t,this._callBack&&this._callBack(i)}}else if(this.focusIndex>-1){this.unHightLight(this.focusIndex);var n={index:-1,preIndex:this.focusIndex,fragment:null};this._callBack&&this._callBack(n),this.focusIndex=-1}}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;if(!this.duration||Zk(1e3*t,10)!==this.duration){if(!t&&0!==t)return;this.updateDuration(Zk(1e3*t,10))}var i=this.playedIndex,n=this.cachedIndex;if("Undefined"!==DM.typeOf(e.played)){var r=JU(this).call(this,1e3*e.played,i);if(r<0)return;this.updateProgress("played",{newIndex:r,curIndex:i,millisecond:Zk(1e3*e.played,10)}),this.playedIndex=r}if("Undefined"!==DM.typeOf(e.cached)){var a=JU(this).call(this,1e3*e.cached,n);if(a<0)return;this.updateProgress("cached",{newIndex:a,curIndex:n,millisecond:Zk(1e3*e.cached,10)}),this.cachedIndex=a}}},{key:"findIndex",value:function(e,t){var i=this.fragments;if(!i||0===i.length)return-1;if(1===i.length)return 0;if(t>-1&&t<i.length&&e>i[t].start&&e<i[t].end)return t;if(e>i[i.length-1].start)return i.length-1;for(var n=0;n<i.length;n++)if(e>i[n].start&&e<=i[n].end){t=n;break}return t}},{key:"findHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)if(DM.hasClass(e[t],this.fragConfig.fragFocusClass))return{dom:e[t],pos:e[t].getBoundingClientRect()}}},{key:"findFragment",value:function(e){var t=this.root.children;return e<0||e>=t.length?null:{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"unHightLight",value:function(){for(var e=this.root.children,t=0;t<e.length;t++)DM.removeClass(e[t],this.fragConfig.fragFocusClass)}},{key:"setHightLight",value:function(e){var t=this.root.children;if(e<t.length)return DM.addClass(t[e],this.fragConfig.fragFocusClass),{dom:t[e],pos:t[e].getBoundingClientRect()}}},{key:"destroy",value:function(){this.progressList=null,this.fragments=null,this.root.innerHTML=""}},{key:"reset",value:function(e){var t,i=this;if(Py(t=Cy(this.fragConfig)).call(t,(function(t){void 0!==e[t]&&(i.fragConfig[t]=e[t])})),e.fragments){if(this.fragments=0===e.fragments.length?[{percent:1}]:e.fragments,this.updateDuration(this.duration),this.playedIndex=0,this.cachedIndex=0,this.root)for(var n=this.root.children;n.length>0;)this.root.removeChild(n[0]);this.render()}}},{key:"render",value:function(){var e=this,t=this.style.progressColor;if(this.root||(this.root=DM.createDom("xg-inners","",{},"progress-list")),this.fragments){var i,n=this.fragConfig,r=n.fragClass,a=n.fragFocusClass;this.progressList=ub(i=this.fragments).call(i,(function(i){var n,s,o=DM.createDom("xg-inner","",{style:t?Hy(n="background:".concat(t,"; flex: ")).call(n,i.percent):"flex: ".concat(i.percent)},Hy(s="".concat(i.isFocus?a:""," xgplayer-progress-inner ")).call(s,r));return e.root.appendChild(o),Py(eB).call(eB,(function(t){o.appendChild(DM.createDom(t.tag,"",{style:t.styleKey?"background: ".concat(e.style[t.styleKey],"; width:0;"):"width:0;"},t.className))})),{cached:o.children[0],played:o.children[1]}}))}return this.root}}]),e}(),iB={POINT:"inner-focus-point",HIGHLIGHT:"inner-focus-highlight"},nB=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),NO(HO(n=t.call(this,e)),"onMoveOnly",(function(e,t){var i=HO(n),r=i.pos,a=i.config,s=i.player,o=t;if(e){DM.event(e);var l=DM.getEventPos(e,s.zoom),u=90===s.rotateDeg?l.clientY:l.clientX;if(r.moving&&Math.abs(r.x-u)<a.miniMoveStep)return;r.moving=!0,r.x=u,o=n.computeTime(e,u)}n.triggerCallbacks("dragmove",o,e),n._updateInnerFocus(o)})),NO(HO(n),"onBodyClick",(function(e){n.pos.isLocked&&(n.pos.isLocked=!1,e.preventDefault(),e.stopPropagation())})),NO(HO(n),"_mouseDownHandler",(function(e,t){n._state.time=t.currentTime,n.updateWidth(t.currentTime,t.seekTime,t.percent,0),n._updateInnerFocus(t)})),NO(HO(n),"_mouseUpHandler",(function(e,t){HO(n).pos.moving&&n.updateWidth(t.currentTime,t.seekTime,t.percent,2)})),NO(HO(n),"_mouseMoveHandler",(function(e,t){var i=HO(n),r=i._state,a=i.pos,s=i.config,o=i.player;r.time<t.currentTime?t.forward=!0:t.forward=!1,r.time=t.currentTime,a.isDown&&!a.moving&&(a.moving=!0,s.isPauseMoving&&o.pause(),n.triggerCallbacks("dragstart",t,e),n.emitUserAction("drag","dragstart",t)),n.updateWidth(t.currentTime,t.seekTime,t.percent,1),n.triggerCallbacks("dragmove",t,e),n._updateInnerFocus(t)})),NO(HO(n),"onMouseDown",(function(e){var t=HO(n),i=t._state,r=t.player,a=t.pos,s=t.config,o=t.playerConfig,l=DM.getEventPos(e,r.zoom),u=90===r.rotateDeg?l.clientY:l.clientX;if(!(r.isMini||s.closeMoveSeek||!o.allowSeekAfterEnded&&r.ended)){if(r.duration||r.isPlaying){e.stopPropagation(),n.focus(),DM.checkIsFunction(o.disableSwipeHandler)&&o.disableSwipeHandler(),DM.checkIsFunction(s.onMoveStart)&&s.onMoveStart(),DM.event(e),a.x=u,a.isDown=!0,a.moving=!1,i.prePlayTime=r.currentTime,r.focus({autoHide:!1}),n.isProgressMoving=!0,DM.addClass(n.progressBtn,"active");var c=n.computeTime(e,u);return c.prePlayTime=i.prePlayTime,n._mouseDownHandlerHook(e,c),"touchstart"===e.type?(n.root.addEventListener("touchmove",n.onMouseMove),n.root.addEventListener("touchend",n.onMouseUp),n.root.addEventListener("touchcancel",n.onMouseUp)):(n.unbind("mousemove",n.onMoveOnly),document.addEventListener("mousemove",n.onMouseMove,!1),document.addEventListener("mouseup",n.onMouseUp,!1)),!0}r.play()}})),NO(HO(n),"onMouseUp",(function(e){var t=HO(n),i=t.player,r=t.config,a=t.pos,s=t.playerConfig,o=t._state;e.stopPropagation(),e.preventDefault(),DM.checkIsFunction(s.enableSwipeHandler)&&s.enableSwipeHandler(),DM.checkIsFunction(r.onMoveEnd)&&r.onMoveEnd(),DM.event(e),DM.removeClass(n.progressBtn,"active");var l=n.computeTime(e,a.x);l.prePlayTime=o.prePlayTime,a.moving?(n.triggerCallbacks("dragend",l,e),n.emitUserAction("drag","dragend",l)):(n.triggerCallbacks("click",l,e),n.emitUserAction("click","click",l)),n._mouseUpHandlerHook(e,l),a.moving=!1,a.isDown=!1,a.x=0,a.y=0,a.isLocked=!0,o.prePlayTime=0,o.time=0;var u=e.type;"touchend"===u||"touchcancel"===u?(n.root.removeEventListener("touchmove",n.onMouseMove),n.root.removeEventListener("touchend",n.onMouseUp),n.root.removeEventListener("touchcancel",n.onMouseUp),n.blur()):(document.removeEventListener("mousemove",n.onMouseMove,!1),document.removeEventListener("mouseup",n.onMouseUp,!1),a.isEnter?"mobile"!==s.isMobileSimulateMode&&Iy(n).call(n,"mousemove",n.onMoveOnly):n.onMouseLeave(e)),DM.setTimeout(HO(n),(function(){n.resetSeekState()}),1),i.focus()})),NO(HO(n),"onMouseMove",(function(e){var t=HO(n),i=t._state,r=t.pos,a=t.player,s=t.config;DM.checkTouchSupport()&&e.preventDefault(),DM.event(e);var o=DM.getEventPos(e,a.zoom),l=90===a.rotateDeg?o.clientY:o.clientX,u=Math.abs(r.x-l);if(!(r.moving&&u<s.miniMoveStep||!r.moving&&u<s.miniStartStep)){r.x=l;var c=n.computeTime(e,l);c.prePlayTime=i.prePlayTime,n._mouseMoveHandlerHook(e,c)}})),NO(HO(n),"onMouseOut",(function(e){n.triggerCallbacks("mouseout",null,e)})),NO(HO(n),"onMouseOver",(function(e){n.triggerCallbacks("mouseover",null,e)})),NO(HO(n),"onMouseEnter",(function(e){var t=HO(n),i=t.player,r=t.pos;if(!(r.isDown||r.isEnter||i.isMini||!i.config.allowSeekAfterEnded&&i.ended)){r.isEnter=!0,Iy(n).call(n,"mousemove",n.onMoveOnly),Iy(n).call(n,"mouseleave",n.onMouseLeave),DM.event(e);var a=DM.getEventPos(e,i.zoom),s=90===i.rotateDeg?a.clientY:a.clientX,o=n.computeTime(e,s);n.triggerCallbacks("mouseenter",o,e),n.focus()}})),NO(HO(n),"onMouseLeave",(function(e){n.triggerCallbacks("mouseleave",null,e),n.unlock(),n._updateInnerFocus(null)})),NO(HO(n),"onVideoResize",(function(){var e=n.pos,t=e.x,i=e.isDown;if(e.isEnter&&!i){var r=n.computeTime(null,t);n.onMoveOnly(null,r)}})),n.useable=!1,n.isProgressMoving=!1,n.__dragCallBacks=[],n._state={now:-1,direc:0,time:0,prePlayTime:-1},n._disableBlur=!1,"boolean"==typeof n.config.isDragingSeek&&(console.warn("[XGPLAYER] 'isDragingSeek' is deprecated, please use 'isDraggingSeek' instead"),n.config.isDraggingSeek=n.config.isDragingSeek),n}return MO(i,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"duration",get:function(){return this.playerConfig.customDuration||this.player.duration}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime,i=e.currentTime;return t>=0?t:i+this.timeOffset}},{key:"changeState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.useable=e}},{key:"show",value:function(e){this.root&&(this.root.style.display="flex")}},{key:"_initInner",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t&&0!==t.length||(t=[{percent:1}]);var n,r=DO(DO({fragments:t},i),{},{actionCallback:function(t){e.emitUserAction("fragment_focus","fragment_focus",t)}});this.innerList?this.innerList.reset(r):(this.innerList=new tB(r),this.outer.insertBefore(this.innerList.render(),this.outer.children[0]),ub(n=["findHightLight","unHightLight","setHightLight","findFragment"]).call(n,(function(t){var i;e[t]=Iy(i=e.innerList[t]).call(i,e.innerList)})))}},{key:"_updateInnerFocus",value:function(e){this.innerList&&this.innerList.updateFocus(e)}},{key:"afterCreate",value:function(){if(!this.config.disable&&!this.playerConfig.isLive){this.pos={x:0,y:0,moving:!1,isDown:!1,isEnter:!1,isLocked:!1},this.outer=$P(this).call(this,"xg-outer");var e=this.config,t=e.fragFocusClass,i=e.fragAutoFocus,n=e.fragClass;this._initInner(this.config.fragments,{fragFocusClass:t,fragAutoFocus:i,fragClass:n,style:this.playerConfig.commonStyle||{}}),"mobile"===FM.device&&(this.config.isDraggingSeek=!1,this.isMobile=!0),this.progressBtn=$P(this).call(this,".xgplayer-progress-btn"),this.listenEvents(),this.bindDomEvents(),this.initCustomStyle()}}},{key:"listenEvents",value:function(){var e=this;this.on(ZM,(function(){e.onMouseLeave()})),this.on(XM,(function(){e.onTimeupdate()})),this.on(qM,(function(){e.onTimeupdate(),e.onCacheUpdate()})),this.on(iN,(function(){e.onCacheUpdate()})),this.on(WM,(function(){e.onCacheUpdate(!0),e.onTimeupdate(!0),e._state.now=0})),this.on(rN,(function(){e.onReset()})),this.on(bN,(function(){e.onVideoResize()}))}},{key:"setConfig",value:function(e){var t,i=this,n=null;Py(t=Cy(e)).call(t,(function(t){i.config[t]=e[t],"fragments"===t&&(n=e[t])})),n&&this._initInner(n,e)}},{key:"initCustomStyle",value:function(){var e=(this.playerConfig||{}).commonStyle.sliderBtnStyle,t=this.progressBtn;if(e)if("string"==typeof e)t.style.boxShadow=e;else if("object"===xO(e)){var i;ub(i=Cy(e)).call(i,(function(i){t.style[i]=e[i]}))}}},{key:"triggerCallbacks",value:function(e,t,i){var n;this.__dragCallBacks.length>0&&ub(n=this.__dragCallBacks).call(n,(function(n){if(n&&n.handler&&n.type===e)try{n.handler(t,i)}catch(GG){console.error("[XGPLAYER][triggerCallbacks] ".concat(n," error"),GG)}}))}},{key:"addCallBack",value:function(e,t){t&&"function"==typeof t&&this.__dragCallBacks.push({type:e,handler:t})}},{key:"removeCallBack",value:function(e,t){var i=this.__dragCallBacks,n=-1;ub(i).call(i,(function(i,r){i&&i.type===e&&i.handler===t&&(n=r)})),n>-1&&mw(i).call(i,n,1)}},{key:"unlock",value:function(){var e=this.player,t=this.pos;t.isEnter=!1,t.isLocked=!1,e.isMini||(this.unbind("mousemove",this.onMoveOnly),t.isDown?this.unbind("mouseleave",this.onMouseLeave):this.blur())}},{key:"bindDomEvents",value:function(){var e=this.player.config;(this._mouseDownHandlerHook=this.hook("dragstart",this._mouseDownHandler),this._mouseUpHandlerHook=this.hook("dragend",this._mouseUpHandler),this._mouseMoveHandlerHook=this.hook("drag",this._mouseMoveHandler),"touch"!==this.domEventType&&"compatible"!==this.domEventType||this.root.addEventListener("touchstart",this.onMouseDown),"mouse"===this.domEventType||"compatible"===this.domEventType)&&(Iy(this).call(this,"mousedown",this.onMouseDown),"mobile"!==e.isMobileSimulateMode&&Iy(this).call(this,"mouseenter",this.onMouseEnter),Iy(this).call(this,"mouseover",this.onMouseOver),Iy(this).call(this,"mouseout",this.onMouseOut),this.player.root.addEventListener("click",this.onBodyClick,!0))}},{key:"focus",value:function(){this.player.controls.pauseAutoHide(),DM.addClass(this.root,"active")}},{key:"blur",value:function(){this._disableBlur||(this.player.controls.recoverAutoHide(),DM.removeClass(this.root,"active"))}},{key:"disableBlur",value:function(){this._disableBlur=!0}},{key:"enableBlur",value:function(){this._disableBlur=!1}},{key:"updateWidth",value:function(e,t,i,n){var r=this.config,a=this.player;if(!r.isCloseClickSeek||0!==n){var s=t=t>=a.duration?a.duration-r.endedDiff:Number(t).toFixed(1);this.updatePercent(i),this.updateTime(e),(1!==n||r.isDraggingSeek&&"audio"!==a.config.mediaType)&&(this._state.now=s,this._state.direc=s>a.currentTime?0:1,a.seek(s))}}},{key:"computeTime",value:function(e,t){var i,n,r=this.player,a=this.root.getBoundingClientRect(),s=a.width,o=a.height,l=a.top,u=a.left,c=t;90===r.rotateDeg?(i=o,n=l):(i=s,n=u);var h=c-n,d=(h=h>i?i:h<0?0:h)/i,f=Zk((d=d<0?0:d>1?1:d)*this.offsetDuration*1e3,10)/1e3;return{percent:d,currentTime:f,seekTime:DM.getCurrentTimeByOffset(f,r.timeSegments),offset:h,width:i,left:n,e:e}}},{key:"updateTime",value:function(e){var t=this.player,i=this.duration;e>i?e=i:e<0&&(e=0);var n=t.plugins.time;n&&n.updateTime(e)}},{key:"resetSeekState",value:function(){this.isProgressMoving=!1;var e=this.player.plugins.time;e&&e.resetActive()}},{key:"updatePercent",value:function(e,t){if(this.isProgressMoving=!0,!this.config.disable){e=e>1?1:e<0?0:e,this.progressBtn.style.left="".concat(100*e,"%"),this.innerList.update({played:e*this.offsetDuration},this.offsetDuration);var i=this.player.plugins.miniprogress;i&&i.update({played:e*this.offsetDuration},this.offsetDuration)}}},{key:"onTimeupdate",value:function(e){var t=this.player,i=this._state,n=this.offsetDuration;if(!(t.isSeeking&&t.media.seeking||this.isProgressMoving)&&t.hasStart){if(i.now>-1){var r=Zk(1e3*i.now,10)-Zk(1e3*t.currentTime,10);if(0===i.direc&&r>300||1===i.direc&&r>-300)return void(i.now=-1);i.now=-1}var a=this.currentTime;a=DM.adjustTimeByDuration(a,n,e),this.innerList.update({played:a},n),this.progressBtn.style.left="".concat(a/n*100,"%")}}},{key:"onCacheUpdate",value:function(e){var t=this.player,i=this.duration;if(t){var n=t.bufferedPoint.end;n=DM.adjustTimeByDuration(n,i,e),this.innerList.update({cached:n},i)}}},{key:"onReset",value:function(){this.innerList.update({played:0,cached:0},0),this.progressBtn.style.left="0%"}},{key:"destroy",value:function(){var e=this.player;this.thumbnailPlugin=null,this.innerList.destroy(),this.innerList=null;var t=this.domEventType;"touch"!==t&&"compatible"!==t||(this.root.removeEventListener("touchstart",this.onMouseDown),this.root.removeEventListener("touchmove",this.onMouseMove),this.root.removeEventListener("touchend",this.onMouseUp),this.root.removeEventListener("touchcancel",this.onMouseUp)),"mouse"!==t&&"compatible"!==t||(this.unbind("mousedown",this.onMouseDown),this.unbind("mouseenter",this.onMouseEnter),this.unbind("mousemove",this.onMoveOnly),this.unbind("mouseleave",this.onMouseLeave),document.removeEventListener("mousemove",this.onMouseMove,!1),document.removeEventListener("mouseup",this.onMouseUp,!1),e.root.removeEventListener("click",this.onBodyClick,!0))}},{key:"render",value:function(){if(!this.config.disable&&!this.playerConfig.isLive){var e=this.player.controls?this.player.controls.config.mode:"";return'\n <xg-progress class="xgplayer-progress '.concat("bottom"===e?"xgplayer-progress-bottom":"",'">\n <xg-outer class="xgplayer-progress-outer">\n <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>\n </xg-outer>\n </xg-progress>\n ')}}}],[{key:"pluginName",get:function(){return"progress"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_CENTER,index:0,disable:!1,isDraggingSeek:!0,closeMoveSeek:!1,isPauseMoving:!1,isCloseClickSeek:!1,fragments:[{percent:1}],fragFocusClass:iB.POINT,fragClass:"",fragAutoFocus:!1,miniMoveStep:5,miniStartStep:2,onMoveStart:function(){},onMoveEnd:function(){},endedDiff:.2}}},{key:"FRAGMENT_FOCUS_CLASS",get:function(){return iB}}]),i}(pF),rB=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"_onMouseenter",(function(e){n.emit("icon_mouseenter",{pluginName:n.pluginName})})),NO(HO(n),"_onMouseLeave",(function(e){n.emit("icon_mouseleave",{pluginName:n.pluginName})})),n}return MO(i,[{key:"afterCreate",value:function(){Iy(this).call(this,"mouseenter",this._onMouseenter),Iy(this).call(this,"mouseleave",this._onMouseLeave),this.config.disable&&this.disable()}},{key:"destroy",value:function(){this.unbind("mouseenter",this._onMouseenter),this.unbind("mouseleave",this._onMouseLeave)}}]),i}(pF),aB=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"btnClick",(function(e){e.preventDefault(),e.stopPropagation();var t=HO(n).player;return n.emitUserAction(e,"switch_play_pause",{prop:"paused",from:t.paused,to:!t.paused}),t.ended?t.replay():t.paused?(t.play(),n.animate(!1)):(t.pause(),n.animate(!0)),!1})),n}return MO(i,[{key:"afterCreate",value:function(){KO(UO(i.prototype),"afterCreate",this).call(this),this.config.disable||(this.initIcons(),Iy(this).call(this,["touchend","click"],this.btnClick),this.listenEvents(),this.animate(!0))}},{key:"listenEvents",value:function(){var e=this,t=this.player;this.on([VM,jM,YM,rN],(function(){e.animate(t.paused)}))}},{key:"registerIcons",value:function(){return{play:{icon:$F,class:"xg-icon-play"},pause:{icon:ZF,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.play),this.appendChild(".xgplayer-icon",e.pause)}},{key:"animate",value:function(e){if(this.player){var t=this.i18nKeys,i=$P(this).call(this,".xg-tips");e?(this.setAttr("data-state","pause"),i&&this.changeLangTextKey(i,t.PLAY_TIPS)):(this.setAttr("data-state","play"),i&&this.changeLangTextKey(i,t.PAUSE_TIPS))}}},{key:"destroy",value:function(){KO(UO(i.prototype),"destroy",this).call(this),this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-play">\n <div class="xgplayer-icon">\n </div>\n '.concat(nU(this,"PLAY_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_LEFT,index:0,disable:!1}}}]),i}(rB);function sB(){return(new DOMParser).parseFromString('<svg width="32px" height="40px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M11.2374369,14 L17.6187184,7.61871843 C17.9604272,7.27700968 17.9604272,6.72299032 17.6187184,6.38128157 C17.2770097,6.03957281 16.7229903,6.03957281 16.3812816,6.38128157 L9.38128157,13.3812816 C9.03957281,13.7229903 9.03957281,14.2770097 9.38128157,14.6187184 L16.3812816,21.6187184 C16.7229903,21.9604272 17.2770097,21.9604272 17.6187184,21.6187184 C17.9604272,21.2770097 17.9604272,20.7229903 17.6187184,20.3812816 L11.2374369,14 L11.2374369,14 Z" fill="#FFFFFF"></path>\n </g>\n</svg>',"image/svg+xml").firstChild}var oB=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"afterCreate",value:function(){var e=this;this.initIcons(),this.onClick=function(t){t.preventDefault(),t.stopPropagation(),e.config.onClick(t)},Iy(this).call(this,["click","touchend"],this.onClick)}},{key:"registerIcons",value:function(){return{screenBack:{icon:sB,class:"xg-fullscreen-back"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(this.root,e.screenBack)}},{key:"show",value:function(){DM.addClass(this.root,"show")}},{key:"hide",value:function(){DM.removeClass(this.root,"show")}},{key:"render",value:function(){return'<xg-icon class="xgplayer-back">\n </xg-icon>'}}],[{key:"pluginName",get:function(){return"topbackicon"}},{key:"defaultConfig",get:function(){return{position:hF.ROOT_TOP,index:0}}}]),i}(pF);function lB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z"></path>\n</svg>\n',"image/svg+xml").firstChild}function uB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M682 342h128v84h-212v-212h84v128zM598 810v-212h212v84h-128v128h-84zM342 342v-128h84v212h-212v-84h128zM214 682v-84h212v212h-84v-128h-128z"></path>\n</svg>\n',"image/svg+xml").firstChild}var cB=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"_onOrientationChange",(function(e){n.player.fullscreen&&n.config.rotateFullscreen&&(90===window.orientation||-90===window.orientation?n.player.setRotateDeg(0):n.player.setRotateDeg(90))})),n}return MO(i,[{key:"afterCreate",value:function(){var e=this;KO(UO(i.prototype),"afterCreate",this).call(this);var t=this.config,n=this.playerConfig;if(!t.disable){t.target&&(this.playerConfig.fullscreenTarget=this.config.target);var r=DM.getFullScreenEl();n.fullscreenTarget===r&&this.player.getFullscreen().catch((function(e){})),this.initIcons(),this.handleFullscreen=this.hook("fullscreenChange",this.toggleFullScreen,{pre:function(t){var i=e.player.fullscreen;e.emitUserAction(t,"switch_fullscreen",{prop:"fullscreen",from:i,to:!i})}}),Iy(this).call(this,".xgplayer-fullscreen",["touchend","click"],this.handleFullscreen),this.on(kN,(function(t){var i=$P(e).call(e,".xg-tips");i&&e.changeLangTextKey(i,t?e.i18nKeys.EXITFULLSCREEN_TIPS:e.i18nKeys.FULLSCREEN_TIPS),e.animate(t)})),this.config.needBackIcon&&(this.topBackIcon=this.player.registerPlugin({plugin:oB,options:{config:{onClick:function(t){e.handleFullscreen(t)}}}})),"mobile"===FM.device&&window.addEventListener("orientationchange",this._onOrientationChange)}}},{key:"registerIcons",value:function(){return{fullscreen:{icon:lB,class:"xg-get-fullscreen"},exitFullscreen:{icon:uB,class:"xg-exit-fullscreen"}}}},{key:"destroy",value:function(){KO(UO(i.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon","mobile"===FM.device?"touchend":"click",this.handleFullscreen),"mobile"===FM.device&&window.removeEventListener("orientationchange",this._onOrientationChange)}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.fullscreen),this.appendChild(".xgplayer-icon",e.exitFullscreen)}},{key:"toggleFullScreen",value:function(e){e instanceof Event&&(e.preventDefault(),e.stopPropagation());var t=this.player,i=this.config;!0===i.useCssFullscreen||"function"==typeof i.useCssFullscreen&&i.useCssFullscreen()?(t.fullscreen?t.exitCssFullscreen():t.getCssFullscreen(),this.animate(t.fullscreen)):i.rotateFullscreen?(t.fullscreen?t.exitRotateFullscreen():t.getRotateFullscreen(),this.animate(t.fullscreen)):i.switchCallback&&"function"==typeof i.switchCallback?i.switchCallback(t.fullscreen):t.fullscreen?(t.exitFullscreen(),i.useScreenOrientation&&this.unlockScreen()):(t.getFullscreen().catch((function(e){})),i.useScreenOrientation&&t.aspectRatio>1&&this.lockScreen(i.lockOrientationType))}},{key:"animate",value:function(e){e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.topBackIcon&&(e?(this.topBackIcon.show(),this.hide()):(this.topBackIcon.hide(),this.show()))}},{key:"render",value:function(){if(!this.config.disable){return'<xg-icon class="xgplayer-fullscreen">\n <div class="xgplayer-icon">\n </div>\n '.concat(nU(this,"FULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}},{key:"lockScreen",value:function(e){try{screen.orientation.lock(e).catch((function(e){}))}catch(t){}}},{key:"unlockScreen",value:function(){try{screen.orientation.unlock().catch((function(e){}))}catch(e){}}}],[{key:"pluginName",get:function(){return"fullscreen"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:0,useCssFullscreen:!1,rotateFullscreen:!1,useScreenOrientation:!1,lockOrientationType:"landscape",switchCallback:null,target:null,disable:!1,needBackIcon:!1}}}]),i}(rB),hB=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),(n=t.call(this,e)).isActiving=!1,n}return MO(i,[{key:"duration",get:function(){var e=this.player,t=e.offsetDuration,i=e.duration;return this.playerConfig.customDuration||t||i}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime,i=e.currentTime;return t>=0?t:i}},{key:"timeOffset",get:function(){return this.playerConfig.timeOffset||0}},{key:"afterCreate",value:function(){var e=this.player.controls.config.mode;this.mode="flex"===e?"flex":"normal",this.config.disable||("flex"===this.mode&&(this.createCenterTime(),this.root.style.display="none"),this.durationDom=$P(this).call(this,".time-duration"),this.timeDom=$P(this).call(this,".time-current"),this.listenEvents())}},{key:"listenEvents",value:function(){var e=this;this.on([ZM,qM,XM],(function(t){"durationchange"===t.eventName&&(e.isActiving=!1),e.onTimeUpdate()})),this.on(WM,(function(){e.onTimeUpdate(!0)})),this.on(rN,(function(){e.onReset()}))}},{key:"show",value:function(e){if("flex"===this.mode)return this.centerCurDom&&(this.centerCurDom.style.display="block"),void(this.centerDurDom&&(this.centerDurDom.style.display="block"));this.root.style.display="block"}},{key:"hide",value:function(){if("flex"===this.mode)return this.centerCurDom&&(this.centerCurDom.style.display="none"),void(this.centerDurDom&&(this.centerDurDom.style.display="none"));this.root.style.display="none"}},{key:"onTimeUpdate",value:function(e){var t=this.player,i=this.config,n=this.duration;if(!i.disable&&!this.isActiving&&t.hasStart){var r=this.currentTime+this.timeOffset;r=DM.adjustTimeByDuration(r,n,e),"flex"===this.mode?(this.centerCurDom.innerHTML=this.minWidthTime(DM.format(r)),n!==1/0&&n>0&&(this.centerDurDom.innerHTML=DM.format(n))):(this.timeDom.innerHTML=this.minWidthTime(DM.format(r)),n!==1/0&&n>0&&(this.durationDom.innerHTML=DM.format(n)))}}},{key:"onReset",value:function(){"flex"===this.mode?(this.centerCurDom.innerHTML=this.minWidthTime(DM.format(0)),this.centerDurDom.innerHTML=DM.format(0)):(this.timeDom.innerHTML=this.minWidthTime(DM.format(0)),this.durationDom.innerHTML=DM.format(0))}},{key:"createCenterTime",value:function(){var e=this.player;if(e.controls&&e.controls.center){var t=e.controls.center;this.centerCurDom=DM.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-left"),this.centerDurDom=DM.createDom("xg-icon","00:00",{},"xgplayer-time xg-time-right"),t.children.length>0?t.insertBefore(this.centerCurDom,t.children[0]):t.appendChild(this.centerCurDom),t.appendChild(this.centerDurDom)}}},{key:"afterPlayerInit",value:function(){var e=this.config;this.duration===1/0||this.playerConfig.isLive?(DM.hide(this.durationDom),DM.hide(this.timeDom),DM.hide($P(this).call(this,".time-separator")),DM.show($P(this).call(this,".time-live-tag"))):DM.hide($P(this).call(this,".time-live-tag"));e.hide?this.hide():this.show()}},{key:"changeLiveState",value:function(e){e?(DM.hide(this.durationDom),DM.hide(this.timeDom),DM.hide($P(this).call(this,".time-separator")),DM.show($P(this).call(this,".time-live-tag"))):(DM.hide($P(this).call(this,".time-live-tag")),DM.show($P(this).call(this,".time-separator")),DM.show(this.durationDom),DM.show(this.timeDom))}},{key:"updateTime",value:function(e){this.isActiving=!0,!e&&0!==e||e>this.duration||("flex"!==this.mode?this.timeDom.innerHTML=this.minWidthTime(DM.format(e)):this.centerCurDom.innerHTML=this.minWidthTime(DM.format(e)))}},{key:"minWidthTime",value:function(e){var t;return ub(t=e.split(":")).call(t,(function(e){return'<span class="time-min-width">'.concat(e,"</span>")})).join(":")}},{key:"resetActive",value:function(){var e=this,t=this.player,i=function(){e.isActiving=!1};this.off(qM,i),t.isSeeking&&t.media.seeking?this.once(qM,i):this.isActiving=!1}},{key:"destroy",value:function(){var e=this.player.controls.center;this.centerCurDom&&e.removeChild(this.centerCurDom),this.centerCurDom=null,this.centerDurDom&&e.removeChild(this.centerDurDom),this.centerDurDom=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-time">\n <span class="time-current">00:00</span>\n <span class="time-separator">/</span>\n <span class="time-duration">00:00</span>\n <span class="time-live-tag">'.concat(this.i18n.LIVE_TIP,"</span>\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"time"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_LEFT,index:2,disable:!1}}}]),i}(pF),dB=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"_onDurationChange",(function(){n.updateSegments();var e=n.player,t=e.currentTime,i=e.timeSegments;if(n._checkIfEnabled(i)){var r=DM.getIndexByTime(t,i),a=DM.getOffsetCurrentTime(t,i,r);n.player.offsetCurrentTime=a,n.changeIndex(r,i)}})),NO(HO(n),"_onLoadedData",(function(){var e=n.player.timeSegments;if(n._checkIfEnabled(e)){var t=DM.getOffsetCurrentTime(0,e);n.player.offsetCurrentTime=t,n.changeIndex(0,e),n.curPos.start>0&&(n.player.currentTime=n.curPos.start)}})),NO(HO(n),"_onTimeupdate",(function(){var e=n.player,t=e.currentTime,i=e.timeSegments;if(n._checkIfEnabled(i)){var r=i.length;n.lastCurrentTime=t;var a=DM.getIndexByTime(t,i);a!==n.curIndex&&n.changeIndex(a,i);var s=DM.getOffsetCurrentTime(t,i,a);if(n.player.offsetCurrentTime=s,n.curPos){var o=n.curPos,l=o.start,u=o.end;t<l?n.player.currentTime=l:t>u&&a>=r-1&&n.player.pause()}}})),NO(HO(n),"_onSeeking",(function(){var e=n.player,t=e.currentTime,i=e.timeSegments;if(n._checkIfEnabled(i))if(t<i[0].start)n.player.currentTime=i[0].start;else if(t>i[i.length-1].end)n.player.currentTime=i[i.length-1].end;else{var r=DM.getIndexByTime(t,i);if(r>=0){var a=n.getSeekTime(t,n.lastCurrentTime,r,i);a>=0&&(n.player.currentTime=a)}}})),NO(HO(n),"_onPlay",(function(){var e=n.player,t=e.currentTime,i=e.timeSegments;n._checkIfEnabled(i)&&t>=i[i.length-1].end&&(n.player.currentTime=i[0].start)})),n}return MO(i,[{key:"afterCreate",value:function(){this.curIndex=-1,this.curPos=null,this.lastCurrentTime=0,this.updateSegments(),this.on(ZM,this._onDurationChange),this.on(eN,this._onLoadedData),this.on(XM,this._onTimeupdate),this.on(zM,this._onSeeking),this.on(VM,this._onPlay)}},{key:"setConfig",value:function(e){var t=this;if(e){var i=Cy(e);i.length<1||(Py(i).call(i,(function(i){t.config[i]=e[i]})),this.updateSegments())}}},{key:"updateSegments",value:function(){var e=this.config,t=e.disable,i=e.segments,n=this.player;if(t||!i||0===i.length)n.timeSegments=[],n.offsetDuration=0,n.offsetCurrentTime=-1;else{var r=this.formatTimeSegments(i,n.duration);n.timeSegments=r,n.offsetDuration=r.length>0?r[r.length-1].duration:0}}},{key:"formatTimeSegments",value:function(e,t){var i=[];return e?(XC(e).call(e,(function(e,t){return e.start-t.start})),Py(e).call(e,(function(e,n){var r={};if(r.start=e.start<0?0:e.start,r.end=t>0&&e.end>t?t:e.end,!(t>0&&r.start>t)){i.push(r);var a=r.end-r.start;if(0===n)r.offset=e.start,r.cTime=0,r.segDuration=a,r.duration=a;else{var s=i[n-1];r.offset=s.offset+(r.start-s.end),r.cTime=s.duration+s.cTime,r.segDuration=a,r.duration=s.duration+a}}})),i):[]}},{key:"getSeekTime",value:function(e,t,i,n){var r=-1,a=n[i],s=a.start,o=a.end;if(e>=s&&e<=o)return r;var l=e-t;if(l<0&&e<s){var u=t>s?t-s:0;return r=i-1>=0?n[i-1].end+l+u:0}return-1}},{key:"_checkIfEnabled",value:function(e){return!(!e||e.length<1)}},{key:"changeIndex",value:function(e,t){this.curIndex=e,e>=0&&t.length>0?this.curPos=t[e]:this.curPos=null}}],[{key:"pluginName",get:function(){return"TimeSegmentsControls"}},{key:"defaultConfig",get:function(){return{disable:!0,segments:[]}}}]),i}(nF);function fB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M940.632 837.632l-72.192-72.192c65.114-64.745 105.412-154.386 105.412-253.44s-40.299-188.695-105.396-253.424l-0.016-0.016 72.192-72.192c83.639 83.197 135.401 198.37 135.401 325.632s-51.762 242.434-135.381 325.612l-0.020 0.020zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function vB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021zM795.648 693.248l-72.704-72.704c27.756-27.789 44.921-66.162 44.921-108.544s-17.165-80.755-44.922-108.546l0.002 0.002 72.704-72.704c46.713 46.235 75.639 110.363 75.639 181.248s-28.926 135.013-75.617 181.227l-0.021 0.021z"></path>\n</svg>\n',"image/svg+xml").firstChild}function gB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="0 -10 28 40">\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M358.4 358.4h-204.8v307.2h204.8l256 256v-819.2l-256 256z"></path>\n <path fill="#fff" transform="scale(0.0220625 0.0220625)" d="M920.4 439.808l-108.544-109.056-72.704 72.704 109.568 108.544-109.056 108.544 72.704 72.704 108.032-109.568 108.544 109.056 72.704-72.704-109.568-108.032 109.056-108.544-72.704-72.704-108.032 109.568z"></path>\n</svg>\n',"image/svg+xml").firstChild}var pB=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"onBarMousedown",(function(e){var t=HO(n).player,i=$P(n).call(n,".xgplayer-bar");DM.event(e);var r=i.getBoundingClientRect(),a=DM.getEventPos(e,t.zoom),s=r.height-(a.clientY-r.top);if(a.h=s,a.barH=r.height,n.pos=a,!(s<-2))return n.updateVolumePos(s,e),document.addEventListener("mouseup",n.onBarMouseUp),n._d.isStart=!0,!1})),NO(HO(n),"onBarMouseMove",(function(e){var t=HO(n)._d;if(t.isStart){var i=HO(n),r=i.pos,a=i.player;e.preventDefault(),e.stopPropagation(),DM.event(e);var s=DM.getEventPos(e,a.zoom);t.isMoving=!0;var o=r.h-s.clientY+r.clientY;o>r.barH||n.updateVolumePos(o,e)}})),NO(HO(n),"onBarMouseUp",(function(e){DM.event(e),document.removeEventListener("mouseup",n.onBarMouseUp);var t=HO(n)._d;t.isStart=!1,t.isMoving=!1})),NO(HO(n),"onMouseenter",(function(e){n._d.isActive=!0,n.focus(),n.emit("icon_mouseenter",{pluginName:n.pluginName})})),NO(HO(n),"onMouseleave",(function(e){n._d.isActive=!1,n.unFocus(100,!1,e),n.emit("icon_mouseleave",{pluginName:n.pluginName})})),NO(HO(n),"onVolumeChange",(function(e){if(n.player){var t=n.player,i=t.muted,r=t.volume;n._d.isMoving||($P(n).call(n,".xgplayer-drag").style.height=i||0===r?"4px":"".concat(100*r,"%"),n.config.showValueLabel&&n.updateVolumeValue()),n.animate(i,r)}})),n}return MO(i,[{key:"registerIcons",value:function(){return{volumeSmall:{icon:vB,class:"xg-volume-small"},volumeLarge:{icon:fB,class:"xg-volume"},volumeMuted:{icon:gB,class:"xg-volume-mute"}}}},{key:"afterCreate",value:function(){var e=this;if(this._timerId=null,this._d={isStart:!1,isMoving:!1,isActive:!1},!this.config.disable){this.initIcons();var t=this.playerConfig,i=t.commonStyle,n=t.volume;if(i.volumeColor)$P(this).call(this,".xgplayer-drag").style.backgroundColor=i.volumeColor;if(this.changeMutedHandler=this.hook("mutedChange",(function(t){e.changeMuted(t)}),{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this._onMouseenterHandler=this.hook("mouseenter",this.onMouseenter),this._onMouseleaveHandler=this.hook("mouseleave",this.onMouseleave),"mobile"!==FM.device&&"mobile"!==this.playerConfig.isMobileSimulateMode)Iy(this).call(this,"mouseenter",this._onMouseenterHandler),Iy(this).call(this,["blur","mouseleave"],this._onMouseleaveHandler),Iy(this).call(this,".xgplayer-slider","mousedown",this.onBarMousedown),Iy(this).call(this,".xgplayer-slider","mousemove",this.onBarMouseMove),Iy(this).call(this,".xgplayer-slider","mouseup",this.onBarMouseUp);Iy(this).call(this,".xgplayer-icon",["touchend","click"],this.changeMutedHandler),this.on(JM,this.onVolumeChange),this.once(eN,this.onVolumeChange),"Number"!==DM.typeOf(n)&&(this.player.volume=this.config.default),this.onVolumeChange()}}},{key:"updateVolumePos",value:function(e,t){var i=this.player,n=$P(this).call(this,".xgplayer-drag"),r=$P(this).call(this,".xgplayer-bar");if(r&&n){var a=Zk(e/r.getBoundingClientRect().height*1e3,10);n.style.height="".concat(e,"px");var s=Math.max(Math.min(a/1e3,1),0),o={volume:{from:i.volume,to:s}};i.muted&&(o.muted={from:!0,to:!1}),this.emitUserAction(t,"change_volume",{muted:i.muted,volume:i.volume,props:o}),i.volume=Math.max(Math.min(a/1e3,1),0),i.muted&&(i.muted=!1),this.config.showValueLabel&&this.updateVolumeValue()}}},{key:"updateVolumeValue",value:function(){var e=this.player,t=e.volume,i=e.muted,n=$P(this).call(this,".xgplayer-value-label"),r=Math.max(Math.min(t,1),0);n.innerText=i?0:Math.round(100*r)}},{key:"focus",value:function(){this.player.focus({autoHide:!1}),this._timerId&&(DM.clearTimeout(this,this._timerId),this._timerId=null),DM.addClass(this.root,"slide-show")}},{key:"unFocus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,r=this._d,a=this.player;r.isActive||(this._timerId&&(DM.clearTimeout(this,this._timerId),this._timerId=null),this._timerId=DM.setTimeout(this,(function(){r.isActive||(i?a.blur():a.focus(),DM.removeClass(e.root,"slide-show"),r.isStart&&e.onBarMouseUp(n)),e._timerId=null}),t))}},{key:"changeMuted",value:function(e){e&&e.stopPropagation();var t=this.player;this._d.isStart&&this.onBarMouseUp(e),this.emitUserAction(e,"change_muted",{muted:t.muted,volume:t.volume,props:{muted:{from:t.muted,to:!t.muted}}}),t.volume>0&&(t.muted=!t.muted),t.volume<.01&&(t.volume=this.config.miniVolume)}},{key:"animate",value:function(e,t){e||0===t?this.setAttr("data-state","mute"):t<.5&&this.icons.volumeSmall?this.setAttr("data-state","small"):this.setAttr("data-state","normal")}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.volumeSmall),this.appendChild(".xgplayer-icon",e.volumeLarge),this.appendChild(".xgplayer-icon",e.volumeMuted)}},{key:"destroy",value:function(){this._timerId&&(DM.clearTimeout(this,this._timerId),this._timerId=null),this.unbind("mouseenter",this.onMouseenter),this.unbind(["blur","mouseleave"],this.onMouseleave),this.unbind(".xgplayer-slider","mousedown",this.onBarMousedown),this.unbind(".xgplayer-slider","mousemove",this.onBarMouseMove),this.unbind(".xgplayer-slider","mouseup",this.onBarMouseUp),document.removeEventListener("mouseup",this.onBarMouseUp),this.unbind(".xgplayer-icon","mobile"===FM.device?"touchend":"click",this.changeMutedHandler)}},{key:"render",value:function(){var e;if(!this.config.disable){var t=this.config.default||this.player.volume,i=this.config.showValueLabel;return Hy(e='\n <xg-icon class="xgplayer-volume" data-state="normal">\n <div class="xgplayer-icon">\n </div>\n <xg-slider class="xgplayer-slider">\n '.concat(i?'<div class="xgplayer-value-label">'.concat(100*t,"</div>"):"",'\n <div class="xgplayer-bar">\n <xg-drag class="xgplayer-drag" style="height: ')).call(e,100*t,'%"></xg-drag>\n </div>\n </xg-slider>\n </xg-icon>')}}}],[{key:"pluginName",get:function(){return"volume"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:1,disable:!1,showValueLabel:!1,default:.6,miniVolume:.2}}}]),i}(pF);function mB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-4 -6 40 40" fill="none">\n <g>\n <path transform="scale(1.5 1.5)" d="M11.6665 9.16663H4.1665C2.78579 9.16663 1.6665 10.2859 1.6665 11.6666V15.8333C1.6665 17.214 2.78579 18.3333 4.1665 18.3333H11.6665C13.0472 18.3333 14.1665 17.214 14.1665 15.8333V11.6666C14.1665 10.2859 13.0472 9.16663 11.6665 9.16663Z" fill="white"/>\n <path transform="scale(1.5 1.5)" fill-rule="evenodd" clip-rule="evenodd" d="M3.88148 4.06298C3.75371 4.21005 3.67667 4.40231 3.67749 4.61242C3.67847 4.87253 3.79852 5.10435 3.98581 5.25646L6.99111 8.05895C7.32771 8.37283 7.85502 8.35443 8.16891 8.01782C8.48279 7.68122 8.46437 7.15391 8.12778 6.84003L6.62061 5.43457L9.8198 5.4224C9.82848 5.42239 9.8372 5.42221 9.84591 5.4219C10.9714 5.38233 12.0885 5.6285 13.0931 6.13744C14.0976 6.64635 14.957 7.40148 15.5908 8.33234C16.2246 9.2632 16.6122 10.3394 16.7177 11.4606C16.823 12.5819 16.6427 13.7115 16.1934 14.7442C16.0098 15.1661 16.203 15.6571 16.6251 15.8408C17.0471 16.0243 17.5381 15.8311 17.7216 15.4091C18.2833 14.1183 18.5087 12.7063 18.3771 11.3047C18.2453 9.90318 17.7607 8.55792 16.9684 7.39433C16.1761 6.23073 15.1021 5.28683 13.8463 4.65065C12.5946 4.01651 11.203 3.70872 9.80072 3.75583L6.43415 3.76862L7.96326 2.12885C8.27715 1.79225 8.25872 1.26494 7.92213 0.951061C7.58553 0.63718 7.05822 0.655585 6.74433 0.99219L3.90268 4.0395C3.89545 4.04724 3.88841 4.05509 3.88154 4.06303L3.88148 4.06298Z" fill="white"/>\n </g>\n <defs>\n <clipPath>\n <rect width="40" height="40" fill="white"/>\n </clipPath>\n </defs>\n</svg>\n',"image/svg+xml").firstChild}var yB=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),(n=t.call(this,e)).rotateDeg=n.config.rotateDeg||0,n}return MO(i,[{key:"afterCreate",value:function(){var e,t=this;if(!this.config.disable){KO(UO(i.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.rotate),this.onBtnClick=Iy(e=this.onBtnClick).call(e,this),Iy(this).call(this,".xgplayer-icon",["click","touchend"],this.onBtnClick),this.on(bN,(function(){t.rotateDeg&&t.config.innerRotate&&DM.setTimeout(t,(function(){t.updateRotateDeg(t.rotateDeg,t.config.innerRotate)}),100)}));var n=this.player.root;this.rootWidth=n.style.width||n.offsetWidth||n.clientWidth,this.rootHeight=n.style.height||n.offsetHeight||n.clientHeight,this.rotateDeg&&this.updateRotateDeg(this.rotateDeg,this.config.innerRotate)}}},{key:"destroy",value:function(){KO(UO(i.prototype),"destroy",this).call(this),this.unbind(".xgplayer-icon",["click","touchend"],this.onBtnClick)}},{key:"onBtnClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"rotate"),this.rotate(this.config.clockwise,this.config.innerRotate,1)}},{key:"updateRotateDeg",value:function(e,t){var i,n,r;if(e||(e=0),t)this.player.videoRotateDeg=e;else{var a=this.player,s=this.rootWidth,o=this.rootHeight,l=a.root,u=a.innerContainer,c=a.media,h=l.offsetWidth,d=u&&t?u.offsetHeight:l.offsetHeight,f=s,v=o,g=0,p=0;.75!==e&&.25!==e||(f="".concat(d,"px"),v="".concat(h,"px"),g=-(d-h)/2,p=-(h-d)/2);var m=Hy(i=Hy(n="translate(".concat(g,"px,")).call(n,p,"px) rotate(")).call(i,e,"turn)"),y={transformOrigin:"center center",transform:m,webKitTransform:m,height:v,width:f},k=t?c:l,T=t?a.getPlugin("poster"):null;ub(r=Cy(y)).call(r,(function(e){k.style[e]=y[e],T&&T.root&&(T.root.style[e]=y[e])}))}}},{key:"rotate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.player;this.rotateDeg||(this.rotateDeg=0);var r=e?1:-1;this.rotateDeg=(this.rotateDeg+1+.25*r*i)%1,this.updateRotateDeg(this.rotateDeg,t),n.emit(RN,360*this.rotateDeg)}},{key:"registerIcons",value:function(){return{rotate:mB}}},{key:"render",value:function(){if(!this.config.disable)return'\n <xg-icon class="xgplayer-rotate">\n <div class="xgplayer-icon">\n </div>\n '.concat(nU(this,"ROTATE_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"rotate"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:6,innerRotate:!0,clockwise:!1,rotateDeg:0,disable:!1}}}]),i}(rB);function kB(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n</svg>',"image/svg+xml").firstChild}function TB(){return(new DOMParser).parseFromString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M16.5 4.3H3.5C3.38954 4.3 3.3 4.38954 3.3 4.5V15.5C3.3 15.6105 3.38954 15.7 3.5 15.7H8.50005L8.50006 17.5H3.5C2.39543 17.5 1.5 16.6046 1.5 15.5V4.5C1.5 3.39543 2.39543 2.5 3.5 2.5H16.5C17.6046 2.5 18.5 3.39543 18.5 4.5V8.5H16.7V4.5C16.7 4.38954 16.6105 4.3 16.5 4.3ZM12 11.5C11.4477 11.5 11 11.9477 11 12.5L11 16.5C11 17.0523 11.4478 17.5 12 17.5H17.5C18.0523 17.5 18.5 17.0523 18.5 16.5L18.5 12.5C18.5 11.9477 18.0523 11.5 17.5 11.5H12Z"\n fill="white" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M9.4998 7.7C9.77595 7.7 9.9998 7.47614 9.9998 7.2V6.5C9.9998 6.22386 9.77595 6 9.4998 6H5.5402L5.52754 6.00016H5.5C5.22386 6.00016 5 6.22401 5 6.50016V10.4598C5 10.7359 5.22386 10.9598 5.5 10.9598H6.2C6.47614 10.9598 6.7 10.7359 6.7 10.4598V8.83005L8.76983 10.9386C8.96327 11.1357 9.27984 11.1386 9.47691 10.9451L9.97645 10.4548C10.1735 10.2613 10.1764 9.94476 9.983 9.7477L7.97289 7.7H9.4998Z"\n fill="white" />\n</svg>',"image/svg+xml").firstChild}var EB="picture-in-picture",SB="inline",_B="fullscreen",bB=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"switchPIP",(function(e){if(!n.isPIPAvailable())return!1;e.stopPropagation&&e.stopPropagation(),n.isPip?(n.exitPIP(),n.emitUserAction(e,"change_pip",{props:"pip",from:!0,to:!1}),n.setAttr("data-state","normal")):4===n.player.media.readyState&&(n.requestPIP(),n.emitUserAction(e,"change_pip",{props:"pip",from:!1,to:!0}),n.setAttr("data-state","pip"))})),n}return MO(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.pip&&(e.config.showIcon=e.player.config.pip)}},{key:"afterCreate",value:function(){var e=this;this.isPIPAvailable()&&(KO(UO(i.prototype),"afterCreate",this).call(this),this.pMode=SB,this.initPipEvents(),this.config.showIcon&&this.initIcons(),this.once(hN,(function(){e.config.showIcon&&(DM.removeClass($P(e).call(e,".xgplayer-icon"),"xg-icon-disable"),Iy(e).call(e,"click",e.switchPIP))})))}},{key:"registerIcons",value:function(){return{pipIcon:{icon:kB,class:"xg-get-pip"},pipIconExit:{icon:TB,class:"xg-exit-pip"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.pipIcon),this.appendChild(".xgplayer-icon",e.pipIconExit)}},{key:"initPipEvents",value:function(){var e=this,t=this.player;this.leavePIPCallback=function(){var i=t.paused;DM.setTimeout(e,(function(){!i&&t.mediaPlay()}),0),!i&&t.mediaPlay(),e.setAttr("data-state","normal"),e.pipWindow=null,t.emit(AN,!1)},this.enterPIPCallback=function(i){t.emit(AN,!0),null!=i&&i.pictureInPictureWindow&&(e.pipWindow=i.pictureInPictureWindow),e.setAttr("data-state","pip")},this.onWebkitpresentationmodechanged=function(i){var n=t.media.webkitPresentationMode;e.pMode===_B&&n!==_B&&t.onFullscreenChange(null,!1),e.pMode=n,n===EB?e.enterPIPCallback(i):n===SB&&e.leavePIPCallback(i)},t.media&&(t.media.addEventListener("enterpictureinpicture",this.enterPIPCallback),t.media.addEventListener("leavepictureinpicture",this.leavePIPCallback),i.checkWebkitSetPresentationMode(t.media)&&t.media.addEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged))}},{key:"copyStyleIntoPiPWindow",value:function(e){var t,i,n=Dy(t=ub(i=WO(document.styleSheets)).call(i,(function(t){try{var i;return ub(i=WO(t.cssRules)).call(i,(function(e){return e.cssText})).join("")}catch(r){var n=document.createElement("link");n.rel="stylesheet",n.type=t.type,n.media=t.media,n.href=t.href,e.document.head.appendChild(n)}return""}))).call(t,Boolean).join("\n"),r=document.createElement("style");r.textContent=n,e.document.head.appendChild(r)}},{key:"requestPIP",value:function(){var e=this,t=this.player,n=this.playerConfig,r=this.config;if(this.isPIPAvailable()&&!this.isPip)try{var a=n.poster;if(a&&(t.media.poster="String"===DM.typeOf(a)?a:a.poster),r.preferDocument&&this.isDocPIPAvailable()){var s={};if(r.width&&r.height)s.width=r.width,s.height=r.height;else{var o=t.root.getBoundingClientRect();s.width=o.width,s.height=o.height}documentPictureInPicture.requestWindow(s).then((function(i){var n=r.docPiPNode,a=r.docPiPStyle;e.enterPIPCallback();var s=n||t.root,o=s.parentElement,l=s.previousSibling,u=s.nextSibling;e.copyStyleIntoPiPWindow(i);var c=document.createElement("style");if(c.append("body{padding:0; margin:0;}"),a){var h="";"string"==typeof a?h=a:"function"==typeof a&&(h=a.call(r)),h&&c.append(h)}else s===t.root&&c.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");i.document.head.append(c),i.document.body.append(s),i.addEventListener("pagehide",(function(t){o&&(u?o.insertBefore(s,u):l?o.insertBefore(s,l.nextSibling):o.appendChild(s)),e.leavePIPCallback()}),{once:!0})}))}else i.checkWebkitSetPresentationMode(t.media)?t.media.webkitSetPresentationMode("picture-in-picture"):t.media.requestPictureInPicture();return!0}catch(l){return console.error("requestPiP",l),!1}}},{key:"exitPIP",value:function(){var e=this.player;try{var t;if(this.isPIPAvailable()&&this.isPip)this.isDocPIPAvailable()&&null!==(t=documentPictureInPicture)&&void 0!==t&&t.window?documentPictureInPicture.window.close():i.checkWebkitSetPresentationMode(e.media)?e.media.webkitSetPresentationMode("inline"):document.exitPictureInPicture();return!0}catch(n){return console.error("exitPIP",n),!1}}},{key:"isPip",get:function(){var e,t=this.player;return!(!this.isDocPIPAvailable()||null===(e=documentPictureInPicture)||void 0===e||!e.window)||document.pictureInPictureElement&&document.pictureInPictureElement===t.media||t.media.webkitPresentationMode===EB}},{key:"isPIPAvailable",value:function(){var e=this.player.media;return"Boolean"===DM.typeOf(document.pictureInPictureEnabled)&&document.pictureInPictureEnabled&&("Boolean"===DM.typeOf(e.disablePictureInPicture)&&!e.disablePictureInPicture||e.webkitSupportsPresentationMode&&"Function"===DM.typeOf(e.webkitSetPresentationMode))||this.isDocPIPAvailable()}},{key:"isDocPIPAvailable",value:function(){return"documentPictureInPicture"in window&&/^(https|file)/.test(location.protocol)}},{key:"destroy",value:function(){KO(UO(i.prototype),"destroy",this).call(this);var e=this.player;e.media.removeEventListener("enterpictureinpicture",this.enterPIPCallback),e.media.removeEventListener("leavepictureinpicture",this.leavePIPCallback),i.checkWebkitSetPresentationMode(e.media)&&e.media.removeEventListener("webkitpresentationmodechanged",this.onWebkitpresentationmodechanged),this.exitPIP(),this.unbind("click",this.btnClick)}},{key:"render",value:function(){if(this.config.showIcon&&this.isPIPAvailable())return'<xg-icon class="xgplayer-pip">\n <div class="xgplayer-icon xg-icon-disable">\n </div>\n '.concat(nU(this,"PIP",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"pip"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:6,showIcon:!1,preferDocument:!1,width:void 0,height:void 0,docPiPNode:void 0,docPiPStyle:void 0}}},{key:"checkWebkitSetPresentationMode",value:function(e){return"function"==typeof e.webkitSetPresentationMode}}]),i}(rB);function AB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="40" viewBox="10 0 24 40">\n <path transform="scale(0.038 0.028)" d="M800 380v768h-128v-352l-320 320v-704l320 320v-352z"></path>\n</svg>\n',"image/svg+xml").firstChild}var RB=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),NO(HO(n=t.call(this,e)),"playNext",(function(e){var t=HO(n).player;e.preventDefault(),e.stopPropagation(),n.idx+1<n.config.urlList.length?(n.idx++,n.nextHandler(n.config.urlList[n.idx],n.idx),t.emit(IN,n.idx+1)):(n.nextHandler(),t.emit(IN))})),n.idx=-1,n}return MO(i,[{key:"afterCreate",value:function(){this.config.urlList&&0!==this.config.urlList.length&&(this.appendChild(".xgplayer-icon",this.icons.playNext),this.initEvents())}},{key:"registerIcons",value:function(){return{playNext:AB}}},{key:"initEvents",value:function(){this.nextHandler=this.hook("nextClick",this.changeSrc);var e="mobile"===FM.device?"touchend":"click";Iy(this).call(this,e,this.playNext),this.show()}},{key:"changeSrc",value:function(e){var t=this.player;e&&(t.pause(),t.currentTime=0,t.switchURL?t.switchURL(e):t.src=e,t.config.url=e,t.play())}},{key:"destroy",value:function(){this.unbind(["touchend","click"],this.playNext)}},{key:"render",value:function(){if(this.config.urlList&&0!==this.config.urlList.length)return'\n <xg-icon class="xgplayer-playnext">\n <div class="xgplayer-icon">\n </div>\n '.concat(nU(this,"PLAYNEXT_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>\n ")}}],[{key:"pluginName",get:function(){return"playNext"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_LEFT,index:1,url:null,urlList:[]}}}]),i}(pF),LB={exports:{}};LB.exports=function e(t,i,n){var r,a,s,o=window,l="application/octet-stream",u=n||l,c=t,h=!i&&!n&&c,d=document.createElement("a"),f=function(e){return String(e)},v=o.Blob||o.MozBlob||o.WebKitBlob||f,g=i||"download";if(v=v.call?Iy(v).call(v,o):Blob,"true"===String(this)&&(u=(c=[c,u])[0],c=c[1]),h&&h.length<2048&&(g=h.split("/").pop().split("?")[0],d.href=h,-1!==zy(s=d.href).call(s,h))){var p=new XMLHttpRequest;return p.open("GET",h,!0),p.responseType="blob",p.onload=function(t){e(t.target.response,g,l)},gC((function(){p.send()}),0),p}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(c)){if(!(c.length>2096103.424&&v!==f))return navigator.msSaveBlob?navigator.msSaveBlob(T(c),g):E(c);u=(c=T(c)).type||l}else if(/([\x80-\xff])/.test(c)){for(var m=0,y=new Uint8Array(c.length),k=y.length;m<k;++m)y[m]=c.charCodeAt(m);c=new v([y],{type:u})}function T(e){for(var t=e.split(/[:;,]/),i=t[1],n=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),r=n.length,a=0,s=new Uint8Array(r);a<r;++a)s[a]=n.charCodeAt(a);return new v([s],{type:i})}function E(e,t){if("download"in d)return d.href=e,d.setAttribute("download",g),d.className="download-js-link",d.innerHTML="downloading...",d.style.display="none",document.body.appendChild(d),gC((function(){d.click(),document.body.removeChild(d),!0===t&&gC((function(){tI.revokeObjectURL(d.href)}),250)}),66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,l)),window.open(e)||confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")&&(location.href=e),!0;var i=document.createElement("iframe");document.body.appendChild(i),!t&&/^data:/.test(e)&&(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,l)),i.src=e,gC((function(){document.body.removeChild(i)}),333)}if(r=c instanceof v?c:new v([c],{type:u}),navigator.msSaveBlob)return navigator.msSaveBlob(r,g);if(tI)E(tI.createObjectURL(r),!0);else{if("string"==typeof r||r.constructor===f)try{return E("data:"+u+";base64,"+o.btoa(r))}catch(S){return E("data:"+u+","+encodeURIComponent(r))}(a=new FileReader).onload=function(e){E(this.result)},a.readAsDataURL(r)}return!0};var IB=i(LB.exports);function CB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24">\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <g transform="translate(-488.000000, -340.000000)" fill="#FFFFFF">\n <g id="Group-2">\n <g id="volme_big-copy" transform="translate(488.000000, 340.000000)">\n <rect id="Rectangle-18" x="11" y="4" width="2" height="12" rx="1"></rect>\n <rect id="Rectangle-2" x="3" y="18" width="18" height="2" rx="1"></rect>\n <rect id="Rectangle-2" transform="translate(4.000000, 17.500000) rotate(90.000000) translate(-4.000000, -17.500000) " x="1.5" y="16.5" width="5" height="2" rx="1"></rect><rect id="Rectangle-2-Copy-3" transform="translate(20.000000, 17.500000) rotate(90.000000) translate(-20.000000, -17.500000) " x="17.5" y="16.5" width="5" height="2" rx="1"></rect>\n <path d="M9.48791171,8.26502656 L9.48791171,14.2650266 C9.48791171,14.8173113 9.04019646,15.2650266 8.48791171,15.2650266 C7.93562696,15.2650266 7.48791171,14.8173113 7.48791171,14.2650266 L7.48791171,7.26502656 C7.48791171,6.71274181 7.93562696,6.26502656 8.48791171,6.26502656 L15.4879117,6.26502656 C16.0401965,6.26502656 16.4879117,6.71274181 16.4879117,7.26502656 C16.4879117,7.81731131 16.0401965,8.26502656 15.4879117,8.26502656 L9.48791171,8.26502656 Z" id="Combined-Shape" transform="translate(11.987912, 10.765027) scale(1, -1) rotate(45.000000) translate(-11.987912, -10.765027) "></path>\n </g>\n </g>\n </g>\n </g>\n</svg>\n',"image/svg+xml").firstChild}var wB=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),NO(HO(n=t.call(this,e)),"download",(function(e){if(!n.isLock){n.emitUserAction(e,"download");var t=n.playerConfig.url,i="";"String"===DM.typeOf(t)?i=t:"Array"===DM.typeOf(t)&&t.length>0&&(i=t[0].src);var r=n.getAbsoluteURL(i);IB(r),n.isLock=!0,n.timer=gC((function(){n.isLock=!1,window.clearTimeout(n.timer),n.timer=null}),300)}})),n.timer=null,n.isLock=!1,n}return MO(i,[{key:"afterCreate",value:function(){KO(UO(i.prototype),"afterCreate",this).call(this),this.config.disable||(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),Iy(this).call(this,["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:CB}}},{key:"getAbsoluteURL",value:function(e){if(!e.match(/^https?:\/\//)){var t=document.createElement("div");t.innerHTML='<a href="'.concat(e,'">x</a>'),e=t.firstChild.href}return e}},{key:"destroy",value:function(){KO(UO(i.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-download">\n <div class="xgplayer-icon">\n </div>\n '.concat(nU(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:3,disable:!0}}}]),i}(rB),DB=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.screenShot&&(e.config.disable=!e.player.config.screenShot)}},{key:"afterCreate",value:function(){KO(UO(i.prototype),"afterCreate",this).call(this),this.appendChild(".xgplayer-icon",this.icons.screenshotIcon);var e=this.config;this.initSize=function(t){e.fitVideo&&(e.width=t.vWidth,e.height=t.vHeight)},this.once(bN,this.initSize)}},{key:"onPluginsReady",value:function(){var e;this.show(),this.onClickBtn=Iy(e=this.onClickBtn).call(e,this),Iy(this).call(this,["click","touchend"],this.onClickBtn)}},{key:"saveScreenShot",value:function(e,t){var i,n=document.createElement("a");n.href=e,n.download=t;try{"undefined"!=typeof MouseEvent?i=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window}):(i=document.createEvent("MouseEvents")).initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}catch(r){console.error("MouseEvent unsupported",r)}i&&n.dispatchEvent(i)}},{key:"createCanvas",value:function(e,t){var i=document.createElement("canvas"),n=i.getContext("2d");this.canvasCtx=n,this.canvas=i,i.width=e||this.config.width,i.height=t||this.config.height,n.imageSmoothingEnabled=!0,n.imageSmoothingEnabled&&(n.imageSmoothingQuality="high")}},{key:"onClickBtn",value:function(e){var t=this;e.preventDefault(),e.stopPropagation(),this.emitUserAction(e,"shot");var i=this.config;this.shot(i.width,i.height).then((function(e){t.emit(LN,e),i.saveImg&&t.saveScreenShot(e,i.name+i.format)}))}},{key:"shot",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{quality:.92,type:"image/png"},r=this.config,a=this.player,s=n.quality||r.quality,o=n.type||r.type;return new nb((function(n,l){var u,c=null;if(a.media.canvas)c=a.media.canvas;else{i.canvas?(i.canvas.width=e||r.width,i.canvas.height=t||r.height):i.createCanvas(e,t),c=i.canvas,u=i.canvasCtx;var h,d,f,v,g=a.media.videoWidth/a.media.videoHeight,p=c.width/c.height,m=a.media.videoWidth,y=a.media.videoHeight;g>p?(f=c.width,v=c.width/g,h=0,d=Math.round((c.height-v)/2)):g===p?(f=c.width,v=c.height,h=0,d=0):g<p&&(f=c.height*g,v=c.height,h=Math.round((c.width-f)/2),d=0),u.drawImage(a.media,0,0,m,y,h,d,f,v)}var k=c.toDataURL(o,s).replace(o,"image/octet-stream");n(k=k.replace(/^data:image\/[^;]+/,"data:application/octet-stream"))}))}},{key:"registerIcons",value:function(){return{screenshotIcon:null}}},{key:"destroy",value:function(){KO(UO(i.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.onClickBtn),this.off(bN,this.initSize)}},{key:"render",value:function(){var e,t;if(!this.config.disable){var i=this.icons.screenshotIcon?"xgplayer-icon":"xgplayer-icon btn-text",n="SCREENSHOT";return Hy(e='\n <xg-icon class="xgplayer-shot">\n <div class="'.concat(i,'">\n ')).call(e,this.icons.screenshotIcon?"":Hy(t='<span lang-key="'.concat(this.i18nKeys[n],'">')).call(t,this.i18n[n],"</span>"),"\n </div>\n </xg-icon>")}}}],[{key:"pluginName",get:function(){return"screenShot"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:5,quality:.92,type:"image/png",format:".png",width:600,height:337,saveImg:!0,fitVideo:!0,disable:!1,name:"screenshot"}}}]),i}(rB),xB=function(){function e(t){var i;PO(this,e),this.config=t.config,this.parent=t.root,this.root=DM.createDom("ul","",{},"xg-options-list xg-list-slide-scroll ".concat(this.config.className)),t.root.appendChild(this.root);var n=this.config.maxHeight;n&&this.setStyle({maxHeight:n}),this.onItemClick=Iy(i=this.onItemClick).call(i,this),this.renderItemList();var r="touch"===this.config.domEventType?"touchend":"click";this._delegates=pF.delegate.call(this,this.root,"li",r,this.onItemClick)}return MO(e,[{key:"renderItemList",value:function(e){var t,i=this,n=this.config,r=this.root;(e?n.data=e:e=n.data,n.style)&&ub(t=Cy(n.style)).call(t,(function(e){r.style[e]=n[e]}));e.length>0&&(this.attrKeys=Cy(e[0])),this.root.innerHTML="",ub(e).call(e,(function(e,t){var n=e.selected?"option-item selected":"option-item";e["data-index"]=t,i.root.appendChild(DM.createDom("li","<span>".concat(e.showText,"</span>"),e,n))}))}},{key:"onItemClick",value:function(e){e.delegateTarget||(e.delegateTarget=e.target);var t=e.delegateTarget;if(t&&DM.hasClass(t,"selected"))return!1;var i="function"==typeof this.config.onItemClick?this.config.onItemClick:null,n=this.root.querySelector(".selected");DM.addClass(t,"selected"),n&&DM.removeClass(n,"selected"),i(e,{from:n?this.getAttrObj(n,this.attrKeys):null,to:this.getAttrObj(t,this.attrKeys)})}},{key:"getAttrObj",value:function(e,t){if(!e||!t)return{};var i={};ub(t).call(t,(function(t){i[t]=e.getAttribute(t)}));var n=e.getAttribute("data-index");return n&&(i.index=Number(n)),i}},{key:"show",value:function(){DM.removeClass(this.root,"hide"),DM.addClass(this.root,"active")}},{key:"hide",value:function(){DM.removeClass(this.root,"active"),DM.addClass(this.root,"hide")}},{key:"setStyle",value:function(e){var t,i=this;Py(t=Cy(e)).call(t,(function(t){i.root.style[t]=e[t]}))}},{key:"destroy",value:function(){var e;this._delegates&&(ub(e=this._delegates).call(e,(function(e){e.destroy&&e.destroy()})),this._delegates=null);this.root.innerHTML=null,this.parent.removeChild(this.root),this.root=null}}]),e}(),PB="side",OB="middle",MB="default",NB="click",FB="hover";var UB="mobile"===FM.device,BB=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),NO(HO(n=t.call(this,e)),"onEnter",(function(e){e.stopPropagation(),n.emit("icon_mouseenter",{pluginName:n.pluginName}),n.switchActiveState(e)})),NO(HO(n),"switchActiveState",(function(e){e.stopPropagation(),n.config.toggleMode===NB?n.toggle(!n.isActive):n.toggle(!0)})),NO(HO(n),"onLeave",(function(e){e.stopPropagation(),n.emit("icon_mouseleave",{pluginName:n.pluginName}),n.config.listType!==PB&&n.isActive&&n.toggle(!1)})),NO(HO(n),"onListEnter",(function(e){n.enterType=2})),NO(HO(n),"onListLeave",(function(e){n.enterType=0,n.isActive&&n.toggle(!1)})),n.isIcons=!1,n.isActive=!1,n.curValue=null,n.curIndex=0,n}return MO(i,[{key:"updateLang",value:function(e){this.renderItemList(this.config.list,this.curIndex)}},{key:"afterCreate",value:function(){var e=this,t=this.config;(this.initIcons(),(UB=UB||"touch"===this.domEventType)&&"mobile"===FM.device&&t.listType===MB&&(t.listType=PB),t.hidePortrait&&DM.addClass(this.root,"portrait"),this.on([bN,kN],(function(){e._resizeList()})),this.once($M,(function(){t.list&&t.list.length>0&&(e.renderItemList(t.list),e.show())})),UB&&this.on(aN,(function(){e.isActive&&(e.optionsList&&e.optionsList.hide(),e.isActive=!1)})),UB?(t.toggleMode=NB,this.activeEvent="touchend"):this.activeEvent=t.toggleMode===NB?"click":"mouseenter",t.toggleMode===NB)?Iy(this).call(this,this.activeEvent,this.switchActiveState):(Iy(this).call(this,this.activeEvent,this.onEnter),Iy(this).call(this,"mouseleave",this.onLeave));this.isIcons&&Iy(this).call(this,"click",this.onIconClick)}},{key:"initIcons",value:function(){var e=this,t=this.icons,i=Cy(t),n=!1;i.length>0&&(Py(i).call(i,(function(i){e.appendChild(".xgplayer-icon",t[i]),!n&&(n=t[i])})),this.isIcons=n),n||(this.appendChild(".xgplayer-icon",DM.createDom("span","",{},"icon-text")),DM.addClass($P(this).call(this,".xgplayer-icon"),"btn-text"))}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||DM.addClass(this.root,"show")}},{key:"hide",value:function(){DM.removeClass(this.root,"show")}},{key:"getTextByLang",value:function(e,t,i){if(void 0===e)return"";var n=this.config.list;!i&&(i=this.player.lang),t=!t||DM.isUndefined(e[t])?"text":t,"number"==typeof e&&(e=n[e]);try{return"object"===xO(e[t])?e[t][i]||e[t].en:e[t]}catch(r){return console.warn(r),""}}},{key:"toggle",value:function(e){if(e!==this.isActive&&!this.config.disable){var t=this.player.controls,i=this.config.listType;e?(i===PB?t.blur():t.focus(),this.optionsList&&this.optionsList.show()):(i===PB?t.focus():t.focusAwhile(),this.optionsList&&this.optionsList.hide()),this.isActive=e}}},{key:"onItemClick",value:function(e,t){e.stopPropagation();var i=this.config,n=i.listType,r=i.list;this.curIndex=t.to.index,this.curItem=r[this.curIndex],this.changeCurrentText(),(this.config.isItemClickHide||UB||n===PB)&&this.toggle(!1)}},{key:"onIconClick",value:function(e){}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,t=e[this.curIndex<e.length?this.curIndex:0];t&&($P(this).call(this,".icon-text").innerHTML=this.getTextByLang(t,"iconText"))}}},{key:"renderItemList",value:function(e,t){var i=this,n=this.config,r=this.optionsList,a=this.player;if("number"==typeof t&&(this.curIndex=t,this.curItem=n.list[t]),r)return r.renderItemList(e),void this.changeCurrentText();var s,o,l={config:{data:e||[],className:(s=n.listType,o=n.position,s===PB?o===hF.CONTROLS_LEFT?"xg-side-list xg-left-side":"xg-side-list xg-right-side":""),onItemClick:function(e,t){i.onItemClick(e,t)},domEventType:UB?"touch":"mouse"},root:n.listType===PB?a.innerContainer||a.root:this.root};if(this.config.isShowIcon){var u=this.player.root.getBoundingClientRect().height,c=n.listType===OB?u-50:u;c&&n.heightLimit&&(l.config.maxHeight="".concat(c,"px")),this.optionsList=new xB(l),this.changeCurrentText(),this.show()}this._resizeList()}},{key:"_resizeList",value:function(){if(this.config.heightLimit){var e=this.player.root.getBoundingClientRect().height,t=this.config.listType===OB?e-50:e;this.optionsList&&this.optionsList.setStyle({maxHeight:"".concat(t,"px")})}}},{key:"destroy",value:function(){this.config.toggleMode===NB?this.unbind(this.activeEvent,this.switchActiveState):(this.unbind(this.activeEvent,this.onEnter),this.unbind("mouseleave",this.onLeave)),this.isIcons&&this.unbind("click",this.onIconClick),this.optionsList&&(this.optionsList.destroy(),this.optionsList=null)}},{key:"render",value:function(){if(this.config.isShowIcon)return'<xg-icon class="xg-options-icon '.concat(this.config.className||"",'">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>')}}],[{key:"pluginName",get:function(){return"optionsIcon"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:100,list:[],listType:"default",listStyle:{},hidePortrait:!0,isShowIcon:!1,isItemClickHide:!0,toggleMode:FB,heightLimit:!0}}}]),i}(pF),HB=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),(n=t.call(this,e)).curTime=0,n.isPaused=!0,n}return MO(i,[{key:"beforeCreate",value:function(e){var t=e.config.list;kw(t)&&t.length>0&&(e.config.list=ub(t).call(t,(function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e})))}},{key:"afterCreate",value:function(){var e=this;KO(UO(i.prototype),"afterCreate",this).call(this),this.on("resourceReady",(function(t){e.changeDefinitionList(t)})),this.on(SN,(function(t){e.renderItemList(e.config.list,t.to)})),this.player.definitionList.length<2&&this.hide()}},{key:"show",value:function(e){!this.config.list||this.config.list.length<2||DM.addClass(this.root,"show")}},{key:"initDefinition",value:function(){var e=this.config,t=e.list,i=e.defaultDefinition;if(t.length>0){var n=null;ub(t).call(t,(function(e){e.definition===i&&(n=e)})),n||(n=t[0]),this.changeDefinition(n)}}},{key:"renderItemList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.config.list||[],n=arguments.length>1?arguments[1]:void 0,r=n&&n.definition?n.definition:this.config.defaultDefinition;n&&Py(t).call(t,(function(e){e.selected=!1}));var a=0,s=ub(t).call(t,(function(t,i){var n=DO(DO({},t),{},{showText:e.getTextByLang(t)||t.definition,selected:!1});return(t.selected||t.definition&&t.definition==r)&&(n.selected=!0,a=i),n}));KO(UO(i.prototype),"renderItemList",this).call(this,s,a)}},{key:"changeDefinitionList",value:function(e){kw(e)&&(this.config.list=ub(e).call(e,(function(e){return!e.text&&e.name&&(e.text=e.name),e.text||(e.text=e.definition),e})),this.renderItemList(),this.config.list.length<2?this.hide():this.show())}},{key:"changeDefinition",value:function(e,t){this.player.changeDefinition(e,t)}},{key:"onItemClick",value:function(e,t){var n=this.player.definitionList;KO(UO(i.prototype),"onItemClick",this).apply(this,arguments),this.emitUserAction(e,"change_definition",{from:t.from,to:t.to});for(var r=0;r<n.length;r++)t.to&&n[r].definition===t.to.definition&&(t.to.url=n[r].url),t.from&&n[r].definition===t.from.definition&&(t.from.url=n[r].url);this.player.changeDefinition(t.to,t.from)}}],[{key:"pluginName",get:function(){return"definition"}},{key:"defaultConfig",get:function(){return DO(DO({},BB.defaultConfig),{},{position:hF.CONTROLS_RIGHT,index:3,list:[],defaultDefinition:"",disable:!1,hidePortrait:!1,className:"xgplayer-definition",isShowIcon:!0})}}]),i}(BB),GB=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),(n=t.call(this,e)).curRate=1,n}return MO(i,[{key:"beforeCreate",value:function(e){var t=e.player.config.playbackRate,i=t?kw(t)?t:e.config.list:[];kw(i)&&(e.config.list=ub(i).call(i,(function(e){return"number"==typeof e?e={rate:e,text:"".concat(e,"x")}:!e.text&&e.rate&&(e.text="".concat(e.rate,"x")),e})))}},{key:"afterCreate",value:function(){var e=this;KO(UO(i.prototype),"afterCreate",this).call(this),this.on(tN,(function(){e.curValue!==e.player.playbackRate&&e.renderItemList()})),this.renderItemList()}},{key:"show",value:function(e){this.config.list&&0!==this.config.list.length&&KO(UO(i.prototype),"show",this).call(this)}},{key:"onItemClick",value:function(e,t){KO(UO(i.prototype),"onItemClick",this).call(this,e,t);var n=e.delegateTarget,r=Number(n.getAttribute("rate"));if(!r||r===this.curValue)return!1;var a={playbackRate:{from:this.player.playbackRate,to:r}};this.emitUserAction(e,"change_rate",{props:a}),this.curValue=r,this.player.playbackRate=r}},{key:"renderItemList",value:function(){var e,t=this,n=this.player.playbackRate||1;this.curValue=n;var r=-1,a=ub(e=this.config.list).call(e,(function(e,i){var a={rate:e.rate};return a.rate===n&&(a.selected=!0,r=i),a.showText=t.getTextByLang(e),a}));KO(UO(i.prototype),"renderItemList",this).call(this,a,r)}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config.list,t=e[this.curIndex<e.length?this.curIndex:0],i="";i=!t||this.curIndex<0?"".concat(this.player.playbackRate,"x"):this.getTextByLang(t,"iconText"),$P(this).call(this,".icon-text").innerHTML=i}}},{key:"destroy",value:function(){KO(UO(i.prototype),"destroy",this).call(this)}}],[{key:"pluginName",get:function(){return"playbackRate"}},{key:"defaultConfig",get:function(){return DO(DO({},BB.defaultConfig),{},{position:hF.CONTROLS_RIGHT,index:4,list:[2,1.5,1,.75,.5],className:"xgplayer-playbackrate",isShowIcon:!0,hidePortrait:!1})}}]),i}(BB);function VB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" class=\'path_full\' d="M9,10v1a.9.9,0,0,1-1,1,.9.9,0,0,1-1-1V9A.9.9,0,0,1,8,8h2a.9.9,0,0,1,1,1,.9.9,0,0,1-1,1Zm6,4V13a1,1,0,0,1,2,0v2a.9.9,0,0,1-1,1H14a1,1,0,0,1,0-2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}function KB(){return(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" d="M9,10V9a.9.9,0,0,1,1-1,.9.9,0,0,1,1,1v2a.9.9,0,0,1-1,1H8a.9.9,0,0,1-1-1,.9.9,0,0,1,1-1Zm6,4v1a1,1,0,0,1-2,0V13a.9.9,0,0,1,1-1h2a1,1,0,0,1,0,2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n',"image/svg+xml").firstChild}var WB=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"beforeCreate",value:function(e){"boolean"==typeof e.player.config.cssFullscreen&&(e.config.disable=!e.player.config.cssFullscreen)}},{key:"afterCreate",value:function(){var e,t=this;KO(UO(i.prototype),"afterCreate",this).call(this),this.config.disable||(this.config.target&&(this.playerConfig.fullscreenTarget=this.config.target),this.initIcons(),this.on(TN,(function(e){t.animate(e)})),this.btnClick=Iy(e=this.btnClick).call(e,this),this.handleCssFullscreen=this.hook("cssFullscreen_change",this.btnClick,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),Iy(this).call(this,["click","touchend"],this.handleCssFullscreen))}},{key:"initIcons",value:function(){var e=this.icons,t=$P(this).call(this,".xgplayer-icon");t.appendChild(e.cssFullscreen),t.appendChild(e.exitCssFullscreen)}},{key:"btnClick",value:function(e){e.preventDefault(),e.stopPropagation();var t=this.player.isCssfullScreen;this.emitUserAction(e,"switch_cssfullscreen",{cssfullscreen:t}),t?this.player.exitCssFullscreen():this.player.getCssFullscreen()}},{key:"animate",value:function(e){this.root&&(e?this.setAttr("data-state","full"):this.setAttr("data-state","normal"),this.switchTips(e))}},{key:"switchTips",value:function(e){var t=this.i18nKeys,i=$P(this).call(this,".xg-tips");i&&this.changeLangTextKey(i,e?t.EXITCSSFULLSCREEN_TIPS:t.CSSFULLSCREEN_TIPS)}},{key:"registerIcons",value:function(){return{cssFullscreen:{icon:VB,class:"xg-get-cssfull"},exitCssFullscreen:{icon:KB,class:"xg-exit-cssfull"}}}},{key:"destroy",value:function(){KO(UO(i.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return"<xg-icon class='xgplayer-cssfullscreen'>\n <div class=\"xgplayer-icon\">\n </div>\n ".concat(nU(this,"CSSFULLSCREEN_TIPS",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"cssFullscreen"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:1,disable:!1,target:null}}}]),i}(rB),jB=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"afterCreate",value:function(){var e=this;this.clickHandler=this.hook("errorRetry",this.errorRetry,{pre:function(e){e.preventDefault(),e.stopPropagation()}}),this.onError=this.hook("showError",this.handleError),Iy(this).call(this,".xgplayer-error-refresh","click",this.clickHandler),this.on(YM,(function(t){e.onError(t)}))}},{key:"errorRetry",value:function(e){this.emitUserAction(e,"error_retry",{}),this.player.retry()}},{key:"handleError",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this.player,n=t.errorType,r=i.errorNote?this.i18n[i.errorNote]:"";if(!r)switch(n){case"decoder":r=this.i18n.MEDIA_ERR_DECODE;break;case"network":r=this.i18n.MEDIA_ERR_NETWORK;break;default:r=this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED}$P(this).call(this,".xgplayer-error-text").innerHTML=r,$P(this).call(this,".xgplayer-error-tips").innerHTML=Hy(e="".concat(this.i18n.REFRESH_TIPS,'<span class="xgplayer-error-refresh">')).call(e,this.i18n.REFRESH,"</span>")}},{key:"destroy",value:function(){this.unbind(".xgplayer-error-refresh","click",this.clickHandler)}},{key:"render",value:function(){return'<xg-error class="xgplayer-error">\n <div class="xgplayer-errornote">\n <span class="xgplayer-error-text"></span>\n <span class="xgplayer-error-tips"><em class="xgplayer-error-refresh"></em></span>\n </div>\n </xg-error>'}}],[{key:"pluginName",get:function(){return"error"}}]),i}(pF),YB=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"afterCreate",value:function(){var e=this;this.intervalId=0,this.customConfig=null,Iy(this).call(this,".highlight",["click","touchend"],(function(t){(e.config.onClick||e.customOnClick)&&(t.preventDefault(),t.stopPropagation(),e.customOnClick?e.customOnClick(t):e.config.onClick(t))})),this.player.showPrompt=function(){e.showPrompt.apply(e,arguments)},this.player.hidePrompt=function(){e.hide()}}},{key:"setStyle",value:function(e){var t,i=this;ub(t=Cy(e)).call(t,(function(t){i.root.style[t]=e[t]}))}},{key:"showPrompt",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};if(e){this.customOnClick=n;var r=this.config.interval;if(this.intervalId&&(clearTimeout(this.intervalId),this.intervalId=null),DM.addClass(this.root,"show"),"arrow"===i.mode&&DM.addClass(this.root,"arrow"),"string"==typeof e)$P(this).call(this,".xgplayer-prompt-detail").innerHTML=e;else $P(this).call(this,".xgplayer-prompt-detail").innerHTML="".concat(e.text||"")+"".concat(e.highlight?'<i class="highlight">'.concat(e.highlight,"</i>"):"");if(i.style&&this.setStyle(i.style),"boolean"==typeof i.autoHide?i.autoHide:this.config.autoHide){var a=i.interval||r;this.intervalId=gC((function(){t.hide()}),a)}}}},{key:"hide",value:function(){DM.removeClass(this.root,"show"),DM.removeClass(this.root,"arrow"),this.root.removeAttribute("style"),this.customOnClick=null}},{key:"render",value:function(){return'<xg-prompt class="xgplayer-prompt '.concat(TF.CONTROLS_FOLLOW,'">\n <span class="xgplayer-prompt-detail"></span>\n </xg-prompt>')}}],[{key:"pluginName",get:function(){return"prompt"}},{key:"defaultConfig",get:function(){return{interval:3e3,style:{},mode:"arrow",autoHide:!0,detail:{text:"",highlight:""},onClick:function(){}}}}]),i}(pF),zB={time:0,text:"",id:1,duration:1,color:"#fff",style:{},width:6,height:6};function qB(e){var t;ub(t=Cy(zB)).call(t,(function(t){void 0===e[t]&&(e[t]=zB[t])}))}var XB={_updateDotDom:function(e,t){var i;if(t){var n=this.calcuPosition(e.time,e.duration),r=e.style||{};r.left="".concat(n.left,"%"),r.width="".concat(n.width,"%"),t.setAttribute("data-text",e.text),t.setAttribute("data-time",e.time),n.isMini?DM.addClass(t,"mini"):DM.removeClass(t,"mini"),ub(i=Cy(r)).call(i,(function(e){t.style[e]=r[e]}))}},initDots:function(){var e,t=this;ub(e=this._ispots).call(e,(function(e){t.createDot(e,!1)})),this.ispotsInit=!0},createDot:function(e){var t,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.player.plugins.progress;if(n&&(i&&(qB(e),this._ispots.push(e)),this.ispotsInit||!i)){var r=this.calcuPosition(e.time,e.duration),a=e.style||{};a.left="".concat(r.left,"%"),a.width="".concat(r.width,"%");var s="xgspot_".concat(e.id," xgplayer-spot");r.isMini&&(s+=" mini");var o=e.template?'<div class="xgplayer-spot-pop">'.concat(e.template,"</div>"):"",l=DM.createDom("xg-spot",o,{"data-text":e.text,"data-time":e.time,"data-id":e.id},s);ub(t=Cy(a)).call(t,(function(e){l.style[e]=a[e]})),n.outer&&n.outer.appendChild(l),this.positionDot(l,e.id)}},findDot:function(e){var t;if(this.player.plugins.progress){var i=Dy(t=this._ispots).call(t,(function(t,i){return t.id===e}));return i.length>0?i[0]:null}},updateDot:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.player.plugins.progress;if(i){var n,r=this.findDot(e.id);if(r)ub(n=Cy(e)).call(n,(function(t){r[t]=e[t]}));if(this.ispotsInit){var a=$P(i).call(i,'xg-spot[data-id="'.concat(e.id,'"]'));a&&(this._updateDotDom(e,a),t&&this.showDot(e.id))}}},deleteDot:function(e){var t=this._ispots,i=this.player.plugins.progress;if(i){for(var n=[],r=0;r<t.length;r++)t[r].id===e&&n.push(r);for(var a=n.length-1;a>=0;a--)if(mw(t).call(t,n[a],1),this.ispotsInit){var s=$P(i).call(i,'xg-spot[data-id="'.concat(e,'"]'));s&&s.parentElement.removeChild(s)}}},deleteAllDots:function(){var e=this.player.plugins.progress;if(e)if(this.ispotsInit){for(var t=e.root.getElementsByTagName("xg-spot"),i=t.length-1;i>=0;i--)e.outer.removeChild(t[i]);this._ispots=[]}else this._ispots=[]},updateAllDots:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=this.player.plugins.progress;if(i)if(this.ispotsInit){this._ispots=[];var n=i.root.getElementsByTagName("xg-spot"),r=n.length;if(r>t.length)for(var a=r-1;a>t.length-1;a--)i.outer.removeChild(n[a]);Py(t).call(t,(function(t,i){i<r?(n[i].setAttribute("data-id","".concat(t.id)),e._ispots.push(t),e.updateDot(t)):e.createDot(t)}))}else this._ispots=t},positionDots:function(){var e=this,t=this._ispots,i=this.playerSize,n=this.player.sizeInfo,r=this.player.plugins.progress;r&&n.width!==i.width&&(i.width=n.width,i.left=n.left,Py(t).call(t,(function(t){var i=$P(r).call(r,'xg-spot[data-id="'.concat(t.id,'"]'));i&&e.positionDot(i,t.id)})))},positionDot:function(e,t){var i=DM.findDom(e,".xgplayer-spot-pop");if(i){var n=this.playerSize,r=e.getBoundingClientRect(),a=i.getBoundingClientRect(),s=r.left-n.left,o=n.width-s-r.width/2;if(s<a.width/2||n.width<a.width){var l=a.width/2-s;i.style.left="".concat(l,"px")}else if(o<a.width/2){var u=o-a.width/2+r.width/2;i.style.left="".concat(u,"px")}else i.style.left="50%"}},updateDuration:function(){var e=this,t=this.player.plugins.progress;if(t){var i=this._ispots;Py(i).call(i,(function(i){var n=$P(t).call(t,'xg-spot[data-id="'.concat(i.id,'"]'));e._updateDotDom(i,n)}))}},getAllDotsDom:function(){var e=this.player.plugins.progress;return e?e.root.getElementsByTagName("xg-spot"):[]},getDotDom:function(e){var t=this.player.plugins.progress;if(t)return $P(t).call(t,'xg-spot[data-id="'.concat(e,'"]'))}};var QB={dragmove:"onProgressMove",dragstart:"onProgressDragStart",dragend:"onProgressDragEnd",click:"onProgressClick",mouseover:"onProgressMouseOver",mouseenter:"onProgressMouseOver"},$B=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),NO(HO(n=t.call(this,e)),"onMousemove",(function(e){n.config.disable||(DM.hasClass(e.target,"xg-spot-content")&&n.config.isHideThumbnailHover?n.player.plugins.progress.onMouseLeave(e):(n._state.f||DM.hasClass(e.target,"xg-spot-content"))&&(DM.event(e),e.stopPropagation()))})),NO(HO(n),"onMousedown",(function(e){n.config.disable||(n._state.f||DM.hasClass(e.target,"xg-spot-content"))&&(DM.event(e),e.stopPropagation())})),NO(HO(n),"onMouseup",(function(e){if(n.isDrag){var t=n.player.plugins.progress;t&&t.pos&&(t.onMouseUp(e),!t.pos.isEnter&&t.onMouseLeave(e))}})),NO(HO(n),"onDotMouseLeave",(function(e){if(!n.config.disable){n._curDot.removeEventListener("mouseleave",n.onDotMouseLeave),n.blurDot(e.target),n._curDot=null;var t=n.player.plugins.progress;t&&t.enableBlur(),n.show()}})),NO(HO(n),"onProgressMouseOver",(function(e,t){if(!n.config.disable&&DM.hasClass(t.target,"xgplayer-spot")&&!n._curDot){n._curDot=t.target,n.focusDot(t.target),n._curDot.children.length>0&&n.hide();var i=n.player.plugins.progress;i&&i.disableBlur(),n._curDot.addEventListener("mouseleave",n.onDotMouseLeave)}})),n._ispots=[],n.videoPreview=null,n.videothumbnail=null,n.thumbnail=null,n.timeStr="",n._state={now:0,f:!1},n}return MO(i,[{key:"beforeCreate",value:function(e){var t=e.player.plugins.progress;t&&(e.root=t.root)}},{key:"afterCreate",value:function(){var e=this;this._curDot=null,this.handlerSpotClick=this.hook("spotClick",(function(t,i){i.seekTime&&e.player.seek(i.seekTime)})),this.transformTimeHook=this.hook("transformTime",(function(t){e.setTimeContent(DM.format(t))})),function(e){var t,i=e.config,n=e.player;ub(t=Cy(XB)).call(t,(function(t){var i;e[t]=Iy(i=XB[t]).call(i,e)}));var r=n.config.progressDot||i.ispots||[];e._ispots=ub(r).call(r,(function(e){return qB(e),e})),e.ispotsInit=!1,e.playerSize={left:n.sizeInfo.left,width:n.sizeInfo.width},e.on(ZM,(function(){e.ispotsInit?e.updateDuration():e.initDots()})),e.on(bN,(function(){e.positionDots()}))}(this),this.on(ZM,(function(){e.show()})),this.config.disable&&this.disable(),this.extTextRoot=$P(this).call(this,".xg-spot-ext-text")}},{key:"setConfig",value:function(e){var t,i=this;e&&ub(t=Cy(e)).call(t,(function(t){i.config[t]=e[t]}))}},{key:"onPluginsReady",value:function(){this.player.plugins.progress&&(this.previewLine=$P(this).call(this,".xg-spot-line"),this.timePoint=$P(this).call(this,".xgplayer-progress-point"),this.timeText=$P(this).call(this,".xg-spot-time"),this.tipText=$P(this).call(this,".spot-inner-text"),this._hasThumnail=!1,this.registerThumbnail(),this.bindEvents())}},{key:"bindEvents",value:function(){var e,t=this,i=this.player.plugins.progress;if(i&&(ub(e=Cy(QB)).call(e,(function(e){var n;t[QB[e]]=Iy(n=t[QB[e]]).call(n,t),i.addCallBack(e,t[QB[e]])})),"mobile"!==FM.device)){Iy(this).call(this,".xg-spot-info","mousemove",this.onMousemove),Iy(this).call(this,".xg-spot-info","mousedown",this.onMousedown),Iy(this).call(this,".xg-spot-info","mouseup",this.onMouseup);var n=this.hook("previewClick",(function(){}));this.handlerPreviewClick=function(e){e.stopPropagation(),n(Zk(1e3*t._state.now,10)/1e3,e)},Iy(this).call(this,".xg-spot-content","mouseup",this.handlerPreviewClick)}}},{key:"onProgressMove",value:function(e,t){!this.config.disable&&this.player.duration&&this.updatePosition(e.offset,e.width,e.currentTime,e.e)}},{key:"onProgressDragStart",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!0,this.videoPreview&&DM.addClass(this.videoPreview,"show"))}},{key:"onProgressDragEnd",value:function(e){!this.config.disable&&this.player.duration&&(this.isDrag=!1,this.videoPreview&&DM.removeClass(this.videoPreview,"show"))}},{key:"onProgressClick",value:function(e,t){var i;this.config.disable||DM.hasClass(t.target,"xgplayer-spot")&&(t.stopPropagation(),t.preventDefault(),ub(i=["time","id","text"]).call(i,(function(i){e[i]=t.target.getAttribute("data-".concat(i))})),e.time&&(e.time=Number(e.time)),this.handlerSpotClick(t,e))}},{key:"updateLinePos",value:function(e,t){var i=this.root,n=this.previewLine,r=this.player,a=this.config,s="flex"===r.controls.mode,o=i.getBoundingClientRect().width;if(o||!this._hasThumnail){var l,u=e-(o=this._hasThumnail&&o<a.width?a.width:o)/2;u<0&&!s?(u=0,l=e-o/2):u>t-o&&!s?(l=u-(t-o),u=t-o):l=0,void 0!==l&&(n.style.transform="translateX(".concat(l.toFixed(2),"px)")),i.style.transform="translateX(".concat(u.toFixed(2),"px) translateZ(0)")}}},{key:"updateTimeText",value:function(e){var t=this.timeText,i=this.timePoint;t.innerHTML=e,!this.thumbnail&&(i.innerHTML=e)}},{key:"updatePosition",value:function(e,t,i,n){var r=this.root,a=this.config,s=this._state;if(r){s.now=i,this.transformTimeHook(i);var o=this.timeStr;n&&n.target&&DM.hasClass(n.target,"xgplayer-spot")?(this.showTips(n.target.getAttribute("data-text"),!1,o),this.focusDot(n.target),s.f=!0,a.isFocusDots&&s.f&&(s.now=Zk(n.target.getAttribute("data-time"),10))):a.defaultText?(s.f=!1,this.showTips(a.defaultText,!0,o)):(s.f=!1,this.hideTips("")),this.updateTimeText(o),this.updateThumbnails(s.now),this.updateLinePos(e,t)}}},{key:"setTimeContent",value:function(e){this.timeStr=e}},{key:"updateThumbnails",value:function(e){var t=this.player,i=this.videoPreview,n=this.config,r=t.plugins.thumbnail;if(r&&r.usable){this.thumbnail&&r.update(this.thumbnail,e,n.width,n.height);var a=i&&i.getBoundingClientRect();this.videothumbnail&&r.update(this.videothumbnail,e,a.width,a.height)}}},{key:"registerThumbnail",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("mobile"!==FM.device){var t=this.player,i=this.config,n=t.getPlugin("thumbnail");if(n&&n.setConfig(e),n&&n.usable&&i.isShowThumbnail){DM.removeClass(this.root,"short-line no-thumbnail"),"short"===i.mode&&DM.addClass(this.root,"short-line"),this._hasThumnail=!0;var r=$P(this).call(this,".xg-spot-thumbnail");this.thumbnail=n.createThumbnail(r,"progress-thumbnail"),i.isShowCoverPreview&&(this.videoPreview=DM.createDom("xg-video-preview","",{},"xgvideo-preview"),t.root.appendChild(this.videoPreview),this.videothumbnail=n.createThumbnail(this.videoPreview,"xgvideo-thumbnail")),this.updateThumbnails(0)}else DM.addClass(this.root,"short-line no-thumbnail")}}},{key:"calcuPosition",value:function(e,t){var i=this.player.plugins.progress,n=this.player,r=i.root.getBoundingClientRect().width,a=n.duration/r*6;return e+t>n.duration&&(t=n.duration-e),n.duration,n.duration,{left:e/n.duration*100,width:t/n.duration*100,isMini:t<a}}},{key:"showDot",value:function(e){var t=this.findDot(e);if(t){var i=this.root.getBoundingClientRect().width,n=t.time/this.player.duration*i;this.updatePosition(n,i,t.time)}}},{key:"focusDot",value:function(e,t){e&&(t||(t=e.getAttribute("data-id")),DM.addClass(e,"active"),this._activeDotId=t)}},{key:"blurDot",value:function(e){if(!e){var t=this._activeDotId;e=this.getDotDom(t)}e&&(DM.removeClass(e,"active"),this._activeDotId=null)}},{key:"showTips",value:function(e,t){var i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";(DM.addClass(this.root,"no-timepoint"),e)&&(DM.addClass($P(this).call(this,".xg-spot-content"),"show-text"),t&&"production"===this.config.mode?(DM.addClass(this.root,"product"),this.tipText.textContent=e):(DM.removeClass(this.root,"product"),this.tipText.textContent=this._hasThumnail?e:Hy(i="".concat(n," ")).call(i,e)))}},{key:"hideTips",value:function(){DM.removeClass(this.root,"no-timepoint"),this.tipText.textContent="",DM.removeClass($P(this).call(this,".xg-spot-content"),"show-text"),DM.removeClass(this.root,"product")}},{key:"hide",value:function(){DM.addClass(this.root,"hide")}},{key:"show",value:function(e){DM.removeClass(this.root,"hide")}},{key:"enable",value:function(){var e=this.config,t=this.playerConfig;this.config.disable=!1,this.show(),!this.thumbnail&&e.isShowThumbnail&&this.registerThumbnail(t.thumbnail||{})}},{key:"disable",value:function(){this.config.disable=!0,this.hide()}},{key:"destroy",value:function(){var e,t=this,i=this.player.plugins.progress;i&&ub(e=Cy(QB)).call(e,(function(e){i.removeCallBack(e,t[QB[e]])})),this.videothumbnail=null,this.thumbnail=null,this.videoPreview&&this.player.root.removeChild(this.videoPreview),this.unbind(".xg-spot-info","mousemove",this.onMousemove),this.unbind(".xg-spot-info","mousedown",this.onMousedown),this.unbind(".xg-spot-info","mouseup",this.onMouseup),this.unbind(".xg-spot-content","mouseup",this.handlerPreviewClick)}},{key:"render",value:function(){return"mobile"===FM.device||"mobile"===this.playerConfig.isMobileSimulateMode?"":'<div class="xg-spot-info hide '.concat("short"===this.config.mode?"short-line":"",'">\n <div class="xg-spot-content">\n <div class="xg-spot-thumbnail">\n <span class="xg-spot-time"></span>\n </div>\n <div class="xg-spot-text"><span class="spot-inner-text"></span></div>\n </div>\n <div class="xgplayer-progress-point">00:00</div>\n <div class="xg-spot-ext-text"></div>\n <div class="xg-spot-line"></div>\n </div>')}}],[{key:"pluginName",get:function(){return"progresspreview"}},{key:"defaultConfig",get:function(){return{index:1,miniWidth:6,ispots:[],defaultText:"",isFocusDots:!0,isHideThumbnailHover:!0,isShowThumbnail:!0,isShowCoverPreview:!1,mode:"",disable:!1,width:160,height:90}}}]),i}(pF),ZB=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),(n=t.call(this,e)).ratio=1,n.interval=null,n._preloadMark={},n}return MO(i,[{key:"afterCreate",value:function(){var e=this;this.usable&&this.initThumbnail(),this.on([ZM],(function(){var t=e.config,i=t.pic_num,n=t.interval;e.usable&&(e.interval=n>0?n:Math.round(1e3*e.player.duration/i)/1e3)}))}},{key:"setConfig",value:function(e){var t=this;if(e){var i=Cy(e);i.length<1||(Py(i).call(i,(function(i){t.config[i]=e[i]})),this.usable&&this.initThumbnail())}}},{key:"usable",get:function(){var e=this.config,t=e.urls,i=e.pic_num;return t&&t.length>0&&i>0}},{key:"initThumbnail",value:function(){var e=this.config,t=e.width,i=e.height,n=e.pic_num,r=e.interval;this.ratio=t/i*100,this.interval=r||Math.round(this.player.duration/n),this._preloadMark={}}},{key:"getUrlByIndex",value:function(e){return e>=0&&e<this.config.urls.length?this.config.urls[e]:""}},{key:"preload",value:function(e){var t=this;if(!this._preloadMark[e]){var i=this.config.urls,n=i.length,r=[];e>0&&r.push(e-1),r.push(e),e>0&&e<n-1&&r.push(e+1),ub(r).call(r,(function(e){!t._preloadMark[e]&&e>=0&&e<n&&(t._preloadMark[e]=1,DM.preloadImg(i[e],(function(){t._preloadMark[e]=2})))}))}}},{key:"getPosition",value:function(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.config,a=r.pic_num,s=r.row,o=r.col,l=r.width,u=r.height;this.interval=Math.round(this.player.duration/a);var c=Math.ceil(e/this.interval),h=(c=c>a?a:c)<s*o?0:Math.ceil(c/(s*o))-1,d=c-h*(o*s),f=d>0?Math.ceil(d/o)-1:0,v=d>0?d-f*o-1:0,g=0,p=0;i&&n?i/n<l/u?g=(p=n)*(l/u):p=(g=i)/(l/u):n?i||(g=(p=n||u)*(l/u)):p=(g=i||l)/(l/u);var m=this.getUrlByIndex(h);return{urlIndex:h,rowIndex:f,colIndex:v,url:m,height:p,width:g,style:{backgroundImage:"url(".concat(m,")"),backgroundSize:"".concat(g*o,"px auto"),backgroundPosition:Hy(t="-".concat(v*g,"px -")).call(t,f*p,"px"),width:"".concat(g,"px"),height:"".concat(p,"px")}}}},{key:"update",value:function(e,t){var i,n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=this.config,l=o.pic_num,u=o.urls;if(!(l<=0)&&u&&0!==u.length){var c=this.getPosition(t,r,a);this.preload(c.urlIndex),ub(i=Cy(c.style)).call(i,(function(t){e.style[t]=c.style[t]})),ub(n=Cy(s)).call(n,(function(t){e.style[t]=s[t]}))}}},{key:"changeConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setConfig(e)}},{key:"createThumbnail",value:function(e,t){var i=DM.createDom("xg-thumbnail","",{},"thumbnail ".concat(t));return e&&e.appendChild(i),i}}],[{key:"pluginName",get:function(){return"thumbnail"}},{key:"defaultConfig",get:function(){return{isShow:!1,urls:[],pic_num:0,col:0,row:0,height:90,width:160,scale:1,className:"",hidePortrait:!1}}}]),i}(pF);function JB(e){return e?"background:".concat(e,";"):""}var eH=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"onTimeupdate",(function(){var e=n.player.ended,t=HO(n).offsetDuration,i=n.currentTime;i=DM.adjustTimeByDuration(i,t,e),n.update({played:i},t)})),n}return MO(i,[{key:"offsetDuration",get:function(){return this.playerConfig.customDuration||this.player.offsetDuration||this.player.duration}},{key:"currentTime",get:function(){var e=this.player,t=e.offsetCurrentTime,i=e.currentTime;return t>=0?t:i}},{key:"afterCreate",value:function(){var e=this;this.root&&(this.on(XM,this.onTimeupdate),this.on(rN,(function(){e.reset()})))}},{key:"reset",value:function(){this.update({played:0,cached:0},0)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cached:0,played:0},t=arguments.length>1?arguments[1]:void 0;if(t&&this.root){if(e.cached)$P(this).call(this,"xg-mini-progress-cache").style.width="".concat(e.cached/t*100,"%");if(e.played)$P(this).call(this,"xg-mini-progress-played").style.width="".concat(e.played/t*100,"%")}}},{key:"render",value:function(){var e,t,i,n,r=this.playerConfig,a=r.commonStyle;if(r.miniprogress){var s=this.config,o=s.mode,l=s.height,u={cached:JB(a.cachedColor),played:JB(a.playedColor),progress:JB(a.progressColor),height:l>0&&2!==l?"height: ".concat(l,"px;"):""};return Hy(e=Hy(t=Hy(i=Hy(n='<xg-mini-progress class="xg-mini-progress '.concat("show"===o?"xg-mini-progress-show":"",'" style="')).call(n,u.progress," ")).call(i,u.height,'">\n <xg-mini-progress-cache class="xg-mini-progress-cache" style="')).call(t,u.cached,'"></xg-mini-progress-cache>\n <xg-mini-progress-played class="xg-mini-progress-played" style="')).call(e,u.played,'"></xg-mini-progress-played>\n </xg-mini-progress>')}}}],[{key:"pluginName",get:function(){return"MiniProgress"}},{key:"defaultConfig",get:function(){return{mode:"auto",height:2}}}]),i}(pF),tH="realtime",iH="firstframe",nH="poster";var rH=null,aH=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"onLoadedData",(function(e){n.player&&(n._frameCount=n.config.startFrameCount,n.stop(),n.renderOnTimeupdate(e),n.off(XM,n.renderOnTimeupdate),n.on(XM,n.renderOnTimeupdate))})),NO(HO(n),"onVisibilitychange",(function(e){"visible"===document.visibilityState?n._checkIfCanStart()&&n.start():"hidden"===document.visibilityState&&n.stop()})),NO(HO(n),"renderOnTimeupdate",(function(e){if(n._frameCount>0)n.renderOnce(),n._frameCount--;else{n._isLoaded=!0,n.off(XM,n.renderOnTimeupdate);var t=n.config.startInterval;!n.player.paused&&n._checkIfCanStart()&&n.start(0,t)}})),NO(HO(n),"start",(function(e,t){var i=n.player.video,r=function(){try{return Zk(window.performance.now(),10)}catch(e){return(new Date).getTime()}}(),a=n.checkVideoIsSupport(i);a&&n.canvasCtx&&(t||(t=n.interval),n.stop(),i.videoWidth&&i.videoHeight&&(n.videoPI=i.videoHeight>0?Zk(i.videoWidth/i.videoHeight*100,10):0,(n.config.mode===tH||r-n.preTime>=t)&&(i&&i.videoWidth&&n.update(a,n.videoPI),n.preTime=r)),n.frameId="timer"===n._loopType?DM.setTimeout(HO(n),n.start,t):DM.requestAnimationFrame(n.start))})),NO(HO(n),"stop",(function(){n.frameId&&("timer"===n._loopType?DM.clearTimeout(HO(n),n.frameId):DM.cancelAnimationFrame(n.frameId),n.frameId=null)})),n}return MO(i,[{key:"afterCreate",value:function(){var e=this;!0===this.playerConfig.dynamicBg&&(this.config.disable=!1),i.isSupport||(this.config.disable=!0);var t=this.config,n=t.disable,r=t.mode,a=t.frameRate;n||(this._pos={width:0,height:0,rwidth:0,rheight:0,x:0,y:0,pi:0},this.isStart=!1,this._isLoaded=!1,this.videoPI=0,this.preTime=0,this.interval=Zk(1e3/a,10),this.canvas=null,this.canvasCtx=null,this._frameCount=0,this._loopType=this.config.mode!==tH&&this.interval>=1e3?"timer":"animation",this.once(hN,(function(){e.player&&(e.init(),e.renderByPoster(),e.player.paused||e.start())})),r!==nH&&(r!==iH&&(this.on(rN,(function(){e.stop()})),this.on(VM,(function(){var t=e.config.startInterval;e._checkIfCanStart()&&e.start(0,t)})),this.on(jM,(function(){e.stop()}))),this.on(eN,this.onLoadedData),this.on(nN,(function(){e._isLoaded=!1,e.stop()})),document.addEventListener("visibilitychange",this.onVisibilitychange)))}},{key:"setConfig",value:function(e){var t,i=this;Py(t=Cy(e)).call(t,(function(t){"root"===t&&e[t]!==i.config[t]?i.reRender(e[t]):"frameRate"===t?i.interval=Zk(1e3/e[t],10):"disable"===t&&e[t]&&i.stop(),i.config[t]=e[t]}))}},{key:"init",value:function(e){var t=this.player,n=this.config;this.canvasFilter=i.supportCanvasFilter();try{var r=e||n.root;r||(r=n.isInnerRender&&t.innerContainer||t.root),r.insertAdjacentHTML("afterbegin",'<div class="xgplayer-dynamic-bg" data-index="'.concat(n.index,'"><canvas>\n </canvas><xgmask></xgmask></div>')),this.root=r.children[0],this.canvas=$P(this).call(this,"canvas"),this.canvasFilter||(this.canvas.style.filter=Dy(n),this.canvas.style.webkitFilter=Dy(n)),this.mask=$P(this).call(this,"xgmask"),n.addMask&&(this.mask.style.background=n.maskBg),this.canvasCtx=this.canvas.getContext("2d")}catch(a){CM.logError("plugin:DynamicBg",a)}}},{key:"reRender",value:function(e){if(this.config.disable||this.root){this.stop();var t=this.root?this.root.parentElement:null;if(t!==e&&t.removeChild(this.root),e){this.init(e),this.renderOnce();var i=this.config.startInterval;this._checkIfCanStart()&&this.start(0,i)}else this.root=null}}},{key:"checkVideoIsSupport",value:function(e){if(!e)return null;var t=e&&e instanceof window.HTMLVideoElement?e:e.canvas?e.canvas:e.flyVideo?e.flyVideo:null;if(t&&("safari"!==FM.browser||!DM.isMSE(t)))return t;var i=t?t.tagName.toLowerCase():"";return"canvas"===i||"img"===i?t:null}},{key:"renderByPoster",value:function(){var e=this.playerConfig.poster;if(e){var t="String"===DM.typeOf(e)?e:"String"===DM.typeOf(e.poster)?e.poster:null;this.updateImg(t)}}},{key:"_checkIfCanStart",value:function(){var e=this.config.mode;return this._isLoaded&&!this.player.paused&&e!==iH&&e!==nH}},{key:"renderOnce",value:function(){var e=this.player.video;if(e.videoWidth&&e.videoHeight){this.videoPI=Zk(e.videoWidth/e.videoHeight*100,10);var t=this.checkVideoIsSupport(e);t&&this.update(t,this.videoPI)}}},{key:"updateImg",value:function(e){var t=this;if(e){var i=this.canvas.getBoundingClientRect(),n=i.width,r=i.height,a=new window.Image;a.onload=function(){if(t.canvas&&!t.frameId&&!t.isStart){t.canvas.height=r,t.canvas.width=n;var e=Zk(n/r*100,10);t.update(a,e),a=null}},a.src=e}}},{key:"update",value:function(e,t){if(this.canvas&&this.canvasCtx&&t)try{var i=this._pos,n=this.config,r=this.canvas.getBoundingClientRect(),a=r.width,s=r.height;if(a!==i.width||s!==i.height||i.pi!==t){var o=Zk(a/s*100,10);i.pi=t,i.width!==a&&(i.width=this.canvas.width=a),i.height!==s&&(i.height=this.canvas.height=s);var l=s,u=a;o<t?u=Zk(s*t/100,10):o>t&&(l=Zk(100*a/t,10)),i.rwidth=u*n.multiple,i.rheight=l*n.multiple,i.x=(a-i.rwidth)/2,i.y=(s-i.rheight)/2}this.canvasFilter&&(this.canvasCtx.filter=Dy(n)),this.canvasCtx.drawImage(e,i.x,i.y,i.rwidth,i.rheight)}catch(c){CM.logError("plugin:DynamicBg",c)}}},{key:"destroy",value:function(){this.stop(),document.removeEventListener("visibilitychange",this.onVisibilitychange),this.canvasCtx=null,this.canvas=null}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"dynamicBg"}},{key:"defaultConfig",get:function(){return{isInnerRender:!1,disable:!0,index:-1,mode:"framerate",frameRate:10,filter:"blur(50px)",startFrameCount:2,startInterval:0,addMask:!0,multiple:1.2,maskBg:"rgba(0,0,0,0.7)"}}},{key:"isSupport",get:function(){return"boolean"==typeof rH?rH:rH=function(){try{return!!document.createElement("canvas").getContext}catch(e){return!1}}()}},{key:"supportCanvasFilter",value:function(){return!("safari"===FM.browser||"firefox"===FM.browser)}}]),i}(pF),sH={LANG:"zh-cn",TEXT:{ERROR_TYPES:{network:{code:1,msg:"视频下载错误"},mse:{code:2,msg:"流追加错误"},parse:{code:3,msg:"解析错误"},format:{code:4,msg:"格式错误"},decoder:{code:5,msg:"解码错误"},runtime:{code:6,msg:"语法错误"},timeout:{code:7,msg:"播放超时"},other:{code:8,msg:"其他错误"}},HAVE_NOTHING:"没有关于音频/视频是否就绪的信息",HAVE_METADATA:"音频/视频的元数据已就绪",HAVE_CURRENT_DATA:"关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒",HAVE_FUTURE_DATA:"当前及至少下一帧的数据是可用的",HAVE_ENOUGH_DATA:"可用数据足以开始播放",NETWORK_EMPTY:"音频/视频尚未初始化",NETWORK_IDLE:"音频/视频是活动的且已选取资源,但并未使用网络",NETWORK_LOADING:"浏览器正在下载数据",NETWORK_NO_SOURCE:"未找到音频/视频来源",MEDIA_ERR_ABORTED:"取回过程被用户中止",MEDIA_ERR_NETWORK:"网络错误",MEDIA_ERR_DECODE:"解码错误",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音频/视频格式",REPLAY:"重播",ERROR:"网络连接似乎出现了问题",PLAY_TIPS:"播放",PAUSE_TIPS:"暂停",PLAYNEXT_TIPS:"下一集",DOWNLOAD_TIPS:"下载",ROTATE_TIPS:"旋转",RELOAD_TIPS:"重新载入",FULLSCREEN_TIPS:"进入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"进入样式全屏",EXITCSSFULLSCREEN_TIPS:"退出样式全屏",TEXTTRACK:"字幕",PIP:"画中画",SCREENSHOT:"截图",LIVE:"正在直播",OFF:"关闭",OPEN:"开启",MINI_DRAG:"点击按住可拖动视频",MINISCREEN:"小屏幕",REFRESH_TIPS:"请试试",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}},oH="info",lH=NN,uH=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"_recordUserActions",(function(e){var t=n._getTime(),i=Ly({},e,{msg:e.msg||e.action});n._stats[oH].push(DO(DO({type:"userAction"},t),{},{payload:i}))})),NO(HO(n),"_onReset",(function(){n.reset()})),NO(HO(n),"_recordInfo",(function(e){n.info(e)})),NO(HO(n),"_downloadStats",(function(){var e=n.getStats(),t=new Blob([bI(e)],{type:"application/json"}),i=tI.createObjectURL(t),r=document.createElement("a");r.style.display="none",r.href=i,r.download="player.txt",r.disabled=!1,r.click()})),n}return MO(i,[{key:"_getTime",value:function(){return{timestamp:JC(),timeFormat:(new Date).toISOString()}}},{key:"afterCreate",value:function(){this.reset(),this.on(DN,this._recordUserActions),this.on(lH.STATS_INFO,this._recordInfo),this.on(lH.STATS_DOWNLOAD,this._downloadStats),this.on(lH.STATS_RESET,this._onReset)}},{key:"destroy",value:function(){this.offAll()}},{key:"downloadStats",value:function(){this._downloadStats()}},{key:"info",value:function(e){e.profile?this._infoProfile(e):this._info(e)}},{key:"_info",value:function(e){var t=this._getTime();this._stats[oH].push(DO(DO({},t),{},{payload:e}))}},{key:"_infoProfile",value:function(e){if(e&&e.startMs){var t=DO({cat:"function",dur:JC()-e.startMs,name:e.name||e.msg,ph:"X",pid:0,tid:0,ts:e.startMs,profile:!0},e);this._info(t)}else console.warn("infoProfile need object data, include startMs")}},{key:"reset",value:function(){var e;this._stats=(NO(e={},oH,[]),NO(e,"media",{}),e)}},{key:"getStats",value:function(){for(var e=this.player.media,t=[],i=0;i<e.buffered.length;i++)t.push({start:e.buffered.start(i),end:e.buffered.end(i)});var n={currentTime:e.currentTime,readyState:e.readyState,buffered:t,paused:e.paused,ended:e.ended};return this._stats.media=n,{raw:this._stats,timestat:this._getTimeStats(),profile:this._getProfile()}}},{key:"_getTimeStats",value:function(){var e=this._stats[oH];return ub(e).call(e,(function(e){var t,i,n=e.payload.data,r="";try{n instanceof Error?r=n.msg:void 0!==n&&(r=bI(n))}catch(GG){console.log("err",GG)}return Hy(t=Hy(i="[".concat(e.timeFormat,"] : ")).call(i,e.payload.msg," ")).call(t,r," ")}))}},{key:"_getProfile",value:function(){var e={traceEvents:[]},t=this._stats[oH];return Py(t).call(t,(function(t){t.payload.profile&&e.traceEvents.push(t.payload)})),e}}],[{key:"pluginName",get:function(){return"stats"}},{key:"defaultConfig",get:function(){return{}}}]),i}(nF),cH=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"onGapJump",(function(){var e=HO(n),t=e.player,r=e.config;if(t.media.readyState!==HTMLMediaElement.HAVE_NOTHING){if(t.media.seeking){if(!n.seekingEventReceived)return}else n.seekingEventReceived=!1;if(!t.media.paused||0===t.media.currentTime||!n.hasPlayed){var a=t.media.buffered,s=r.smallGapLimit||.5,o=r.gapDetectionThreshold||.3,l=t.media.currentTime,u=n._getIndex(a,l,o);if(null!==u&&0!==u){console.log("GapJump bufferRange ",a.start(u),a.end(u));var c=a.start(u)+.1;if(!(c>t.media.duration)){var h=c-l,d=h<=s;h<i.BROWSER_GAP_TOLERANCE||d&&(!1!==r.useGapJump&&(t.media.currentTime=n.isSafari?c+.1:c),n.player&&n.player.emit("detectGap"),console.log("gapJump gapIndex",u," isGapSamll:",d," currentTime:",t.media.currentTime," jumpSize:",l-t.media.currentTime),.08!==c&&t&&t.emit("log",{type:"oneevent",end_type:"gap",vid:t.config.vid,ext:{video_postion:Math.floor(1e3*c)}}))}}}}})),n}return MO(i,[{key:"afterCreate",value:function(){var e=this;!1!==this.config.useGapJump&&(this.hasPlayed=!1,this.seekingEventReceived=!1,this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),this.on(QM,this.onGapJump),this.on(VM,(function(){e.hasPlayed=!0})),this.on(zM,(function(){e.seekingEventReceived=!0})))}},{key:"_getIndex",value:function(e,t,i){if(!e||!e.length)return null;if(1===e.length&&e.end(0)-e.start(0)<1e-6)return null;for(var n=this._getBuffered(e),r=null,a=0;a<n.length;a++){if(n[a].start>t&&(0===a||n[a-1].end-t<=i)){r=a;break}}return r}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}}],[{key:"pluginName",get:function(){return"gapJump"}},{key:"defaultConfig",get:function(){return{useGapJump:!1,smallGapLimit:.5,gapDetectionThreshold:.3}}}]),i}(pF);cH.BROWSER_GAP_TOLERANCE=.001;var hH=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"onWaiting",(function(){var e=HO(n).config;n.jumpCnt>e.jumpCntMax||n.timer||!1===e.useWaitingTimeoutJump||(n.timer=gC(n.onJump,1e3*e.waitingTime))})),NO(HO(n),"onJump",(function(){var e=HO(n),t=e.player,i=e.config;if(clearTimeout(n.timer),n.timer=null,!(n.jumpCnt>i.jumpCntMax||!1===i.useWaitingTimeoutJump||t.media.paused&&0!==t.media.currentTime&&n.hasPlayed)){n.jumpSize=i.jumpSize*(n.jumpCnt+1),n.jumpCnt===i.jumpSize&&n.jumpSize<6&&(n.jumpSize=6);var r=t.currentTime+n.jumpSize;r>t.media.duration||(n.jumpCnt++,t.currentTime=r)}})),n}return MO(i,[{key:"afterCreate",value:function(){var e=this,t=this.config,i=t.useWaitingTimeoutJump,n=t.jumpSize;!1!==i&&(this.hasPlayed=!1,this.jumpCnt=0,this.timer=null,this.jumpSize=n,this.on(QM,this.onWaiting),this.on([KM,$M],(function(){clearTimeout(e.timer),e.timer=null,e.jumpSize=e.config.jumpSize})),this.on(VM,(function(){e.hasPlayed=!0})))}}],[{key:"pluginName",get:function(){return"waitingTimeoutJump"}},{key:"defaultConfig",get:function(){return{useWaitingTimeoutJump:!1,waitingTime:15,jumpSize:2,jumpCntMax:4}}}]),i}(pF),dH="cdn",fH=["cdn"],vH=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"getSpeed",(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dH;if(!n.speedListCache||!n.speedListCache[t])return 0;if(n.speedListCache[t].length<=0)return 0;var i=0;return ub(e=n.speedListCache[t]).call(e,(function(e){i+=e})),Math.floor(i/n.speedListCache[t].length)})),NO(HO(n),"startTimer",(function(){DM.isMSE(n.player.video)||(n.initSpeedList(),n.cnt=0,n.timer=gC(n.testSpeed,n.config.testTimeStep))})),NO(HO(n),"initSpeedList",(function(){n.speedListCache={},Py(fH).call(fH,(function(e){n.speedListCache[e]=[]}))})),NO(HO(n),"_onRealSpeedChange",(function(e){e.speed&&n.appendList(e.speed,e.type||dH)})),NO(HO(n),"testSpeed",(function(){if(clearTimeout(n.timer),n.timer=null,n.player&&n.config.openSpeed){var e=n.config,t=e.url,i=e.loadSize,r=e.testCnt,a=e.testTimeStep,s=t+(zy(t).call(t,"?")<0?"?testst=":"&testst=")+JC();if(!(n.cnt>=r)){n.cnt++;try{var o=(new Date).getTime(),l=null,u=new XMLHttpRequest;n.xhr=u,u.open("GET",s);var c,h={},d=Math.floor(10*Math.random());if(h.Range="bytes="+d+"-"+(i+d),h)Py(c=Cy(h)).call(c,(function(e){u.setRequestHeader(e,h[e])}));u.onreadystatechange=function(){if(4===u.readyState){n.xhr=null,l=(new Date).getTime();var e=u.getResponseHeader("Content-Length")/1024*8,t=Math.round(1e3*e/(l-o));n.appendList(t),n.timer=gC(n.testSpeed,a)}},u.send()}catch(f){console.error(f)}}}})),NO(HO(n),"appendList",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dH;if(n.speedListCache&&n.speedListCache[t]){var i=n.config.saveSpeedMax;n.speedListCache[t].length>=i&&n.speedListCache[t].shift(),n.speedListCache[t].push(e);var r=HO(n).player;r&&(t===dH?r.realTimeSpeed=e:r[n.getSpeedName("realTime",t)]=e),n.updateSpeed(t)}})),NO(HO(n),"updateSpeed",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:dH,t=n.getSpeed(e),i=HO(n).player;if(i)if(e===dH)i.avgSpeed&&t===i.avgSpeed||(i.avgSpeed=t,i.emit(gN,{speed:t,realTimeSpeed:i.realTimeSpeed}));else{var r=n.getSpeedName("avg",e);i[r]&&t===i[r]||(i[r]=t,i.emit(gN,{speed:t,realTimeSpeed:i.realTimeSpeed}))}})),n}return MO(i,[{key:"afterCreate",value:function(){var e=this.config,t=e.openSpeed,i=e.addSpeedTypeList;(null==i?void 0:i.length)>0&&fH.push.apply(fH,WO(i)),this.initSpeedList(),this.on("real_time_speed",this._onRealSpeedChange),this.timer=null,this.cnt=0,this.xhr=null,t&&this.on([eN,dN],this.startTimer)}},{key:"getSpeedName",value:function(e,t){return e+"Speed"+t.toUpperCase()}},{key:"openSpeed",get:function(){return this.config.openSpeed},set:function(e){if(this.config.openSpeed=e,!e&&this.timer)return clearTimeout(this.timer),void(this.timer=null);if(this.config.openSpeed){if(this.timer)return;this.timer=gC(this.testSpeed,this.config.testTimeStep)}}},{key:"destroy",value:function(){var e=this;this.off("real_time_speed",this._onRealSpeedChange),this.off([eN,dN],this.startTimer),Py(fH).call(fH,(function(t){e.speedListCache&&e.speedListCache[t]&&(e.speedListCache[t]=[])})),this.speedListCache&&(this.speedListCache={}),clearTimeout(this.timer),this.timer=null,this.xhr&&4!==this.xhr.readyState&&(this.xhr.cancel&&this.xhr.cancel(),this.xhr=null)}}],[{key:"pluginName",get:function(){return"testspeed"}},{key:"defaultConfig",get:function(){return{openSpeed:!1,testCnt:3,loadSize:204800,testTimeStep:3e3,url:"",saveSpeedMax:5,addSpeedTypeList:[]}}}]),i}(pF),gH=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"afterCreate",value:function(){var e=this,t=this.player,i=this.config,n=t.media||t.video;(this.timer=null,this._lastDecodedFrames=0,this._currentStuckCount=0,this._lastCheckPoint=null,this._payload=[],i.disabled)||n.getVideoPlaybackQuality&&(this.on(VM,(function(){e._startTick()})),this.on(jM,(function(){e._stopTick()})),this.on(WM,(function(){e._stopTick()})),this.on(rN,(function(){e._stopTick()})))}},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._timer=gC((function(){e._checkDecodeFPS(),e._startTick()}),this.config.tick)}},{key:"_stopTick",value:function(){clearTimeout(this._timer),this._timer=null}},{key:"_checkBuffer",value:function(e,t){for(var i=!1,n=[],r=0;r<t.length;r++){var a=t.start(r),s=t.end(r);if(n.push({start:a,end:s}),a<=e&&e<=s-1){i=!0;break}}return{enoughBuffer:i,buffers:n}}},{key:"_checkStuck",value:function(e,t,i,n){var r=this.player.media||this.player.video,a=document.hidden,s=r.paused,o=r.readyState,l=r.currentTime,u=r.buffered;if(!(a||s||o<4)){var c=this._checkBuffer(l,u),h=c.enoughBuffer,d=c.buffers;h&&(e<=this.config.reportFrame?(this._currentStuckCount++,this._payload.push({currentTime:l,buffers:d,curDecodedFrames:e,totalVideoFrames:t,droppedVideoFrames:i,checkInterval:n}),this._currentStuckCount>=this.config.stuckCount&&(this.emit(FN,this._payload),this._reset())):this._reset())}}},{key:"_reset",value:function(){this._payload=[],this._currentStuckCount=0}},{key:"_checkDecodeFPS",value:function(){var e=this.player.media||this.player.video;if(e){var t=e.getVideoPlaybackQuality(),i=t.totalVideoFrames,n=t.droppedVideoFrames,r=performance.now();if(i&&this._lastCheckPoint){var a=i-this._lastDecodedFrames,s=r-this._lastCheckPoint;this._checkStuck(a,i,n,s)}this._lastDecodedFrames=i,this._lastCheckPoint=r}}},{key:"destroy",value:function(){this._stopTick()}}],[{key:"pluginName",get:function(){return"FpsDetect"}},{key:"defaultConfig",get:function(){return{disabled:!1,tick:1e3,stuckCount:3,reportFrame:0}}}]),i}(pF);IF.use(sH);var pH=MO((function e(t,i){var n,r,a,s,o;PO(this,e);var l=i&&"mobile"===i.isMobileSimulateMode,u=i.isLive?[]:[dB,nB,eH,$B,hB],c=Hy(n=[]).call(n,u,[aB,cB,yB,RB,HB,GB,wB,DB,pB,bB]),h=[XF,QF,tU,WU,iU,jB,YB,ZB,gU];this.plugins=Hy(r=[uH,zF]).call(r,WO(c),h,[cH,hH]);var d=l?"mobile":FM.device;switch(d){case"pc":(a=this.plugins).push.apply(a,[VU,yU,WB,vH,gH]);break;case"mobile":(s=this.plugins).push.apply(s,[MU]);break;default:(o=this.plugins).push.apply(o,[VU,yU,WB])}(FM.os.isIpad||"pc"===d)&&this.plugins.push(aH),FM.os.isIpad&&this.plugins.push(yU),this.ignores=[],this.i18n=[]})),mH=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i)}(UF);NO(mH,"defaultPreset",pH),NO(mH,"Util",DM),NO(mH,"Sniffer",FM),NO(mH,"Errors",GM),NO(mH,"Events",UN),NO(mH,"Plugin",pF),NO(mH,"BasePlugin",nF),NO(mH,"I18N",IF),NO(mH,"STATE_CLASS",TF),NO(mH,"InstManager",PF);var yH=MO((function e(t,i){var n,r,a,s,o;PO(this,e);var l=i&&"mobile"===i.isMobileSimulateMode,u=i.isLive?[]:[nB,eH,$B,hB],c=Hy(n=[]).call(n,u,[aB,cB,yB,RB,HB,GB,wB,DB,pB,bB]),h=[XF,QF,tU,WU,iU,jB,YB,ZB,gU];this.plugins=Hy(r=[uH,zF]).call(r,WO(c),h,[cH,hH]);var d=l?"mobile":FM.device;switch(d){case"pc":(a=this.plugins).push.apply(a,[VU,yU,WB,vH,gH]);break;case"mobile":(s=this.plugins).push.apply(s,[MU]);break;default:(o=this.plugins).push.apply(o,[VU,yU,WB])}(FM.os.isIpad||"pc"===d)&&this.plugins.push(aH),this.ignores=[],this.i18n=[]})),kH=MO((function e(){var t,i,n;PO(this,e);var r=[aB,cB,hB,pB,yB,HB,GB,WB,bB];switch(this.plugins=Hy(t=[QF,tU,WU,iU,jB]).call(t,r),FM.device){case"pc":(i=this.plugins).push.apply(i,[VU,yU]);break;case"mobile":this.plugins.push(MU);break;default:(n=this.plugins).push.apply(n,[VU,yU])}this.ignores=[],this.i18n=[sH]})),TH=MO((function e(){var t;PO(this,e);var i=[MU,nB,aB,cB,hB,yB,RB,HB,GB,wB,DB,pB,bB],n=[XF,QF,tU,WU,iU,jB,YB,ZB,eH];this.plugins=Hy(t=[zF]).call(t,i,n),this.ignores=[],this.i18n=[sH]})),EH=i(yr.f("toStringTag")),SH={exports:{}};!function(e,t){window,e.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||dy(e,t,{enumerable:!0,get:n})},i.r=function(e){void 0!==_O&&EH&&dy(e,EH,{value:"Module"}),dy(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==qh(e)&&e&&e.__esModule)return e;var n=MI(null);if(i.r(n),dy(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e){var a;i.d(n,r,Iy(a=function(t){return e[t]}).call(a,null,r))}return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=5)}([function(e,t,i){function n(e,t){return e.classList?Yy(Array.prototype).call(e.classList,(function(e){return e===t})):!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function r(e,t){var i;e.classList?Py(i=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(i,(function(t){t&&e.classList.add(t)})):n(e,t)||(e.className+=" "+t)}function a(e,t){var i,r;e.classList?Py(i=t.split(/\s+/g)).call(i,(function(t){e.classList.remove(t)})):n(e,t)&&Py(r=t.split(/\s+/g)).call(r,(function(t){var i=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(i," ")}))}function s(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}dy(t,"__esModule",{value:!0}),t.createDom=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=document.createElement(t);return a.className=r,a.innerHTML=i,Py(e=Cy(n)).call(e,(function(e){var i=e,r=n[e];"video"===t||"audio"===t?r&&a.setAttribute(i,r):a.setAttribute(i,r)})),a},t.hasClass=n,t.addClass=r,t.removeClass=a,t.toggleClass=function(e,t){var i;Py(i=t.split(/\s+/g)).call(i,(function(t){n(e,t)?a(e,t):r(e,t)}))},t.findDom=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=arguments[1],i=void 0;try{i=e.querySelector(t)}catch(n){wk(t).call(t,"#")&&(i=e.getElementById(iI(t).call(t,1)))}return i},t.deepCopy=function e(t,i){var n;if("Object"===s(i)&&"Object"===s(t))return Py(n=Cy(i)).call(n,(function(n){var r;"Object"!==s(i[n])||i[n]instanceof Node?"Array"===s(i[n])?t[n]="Array"===s(t[n])?Hy(r=t[n]).call(r,i[n]):i[n]:t[n]=i[n]:t[n]?e(t[n],i[n]):t[n]=i[n]})),t},t.typeOf=s,t.copyDom=function(e){if(e&&1===e.nodeType){var t=document.createElement(e.tagName);return Py(Array.prototype).call(e.attributes,(function(e){t.setAttribute(e.name,e.value)})),e.innerHTML&&(t.innerHTML=e.innerHTML),t}return""},t.attachEventListener=function(e,t,i,n){var r,a,s,o;n?(e.on(t,i),a=t,s=i,o=n,(r=e).once(o,(function e(){r.off(a,s),r.off(o,e)}))):e.on(t,(function n(r){i(r),e.off(t,n)}))},t.styleUtil=function(e,t,i){var n=e.style;try{n[t]=i}catch(r){n.setProperty(t,i)}},t.styleCSSText=function(e,t){var i=e.style;try{i.cssText=t}catch(n){}},t.isNumber=function(e){return"number"==typeof e&&!vO(e)},t.isFunction=function(e){return"function"==typeof e},t.throttle=function(e,t){var i=this,n=0;return function(){for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];clearTimeout(n),n=gC((function(){return e.apply(i,a)}),t)}},t.hasOwnProperty=Object.prototype.hasOwnProperty},function(e,t,i){dy(t,"__esModule",{value:!0});var n,r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=(n=i(4))&&n.__esModule?n:{default:n},s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"setLogger",value:function(e){this.logger=e instanceof a.default?e:new a.default((e||"")+".js")}}]),e}();t.default=s,e.exports=t.default},function(e,t,i){var n=i(19)();e.exports=function(e){return e!==n&&null!==e}},function(e,t,i){e.exports=function(e){return null!=e}},function(e,t,i){var n;dy(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a="undefined"!=typeof window&&zy(n=window.location.href).call(n,"danmu-debug")>-1,s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.constructorName=t||""}return r(e,[{key:"info",value:function(e){for(var t,i,n=arguments.length,r=Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];a&&(i=console).log.apply(i,Hy(t=["[Danmu Log]["+this.constructorName+"]",e]).call(t,r))}}]),e}();t.default=s,e.exports=t.default},function(e,t,i){dy(t,"__esModule",{value:!0});var n,r=(n=i(6))&&n.__esModule?n:{default:n};i(34),t.default=r.default,e.exports=t.default},function(e,t,i){dy(t,"__esModule",{value:!0}),t.DanmuJs=void 0;var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=h(i(7)),a=i(26),s=h(i(1)),o=h(i(27)),l=h(i(32)),u=i(33),c=i(0);function h(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=qh(t)&&"function"!=typeof t?e:t}var f=t.DanmuJs=function(e){function t(e){var i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=d(this,(t.__proto__||RO(t)).call(this));n.setLogger("danmu"),n.logger&&n.logger.info("danmu.js version: "+a.version);var s=n.config={overlap:!1,area:{start:0,end:1,lines:void 0},hooks:void 0,live:!1,comments:[],direction:"r2l",needResizeObserver:!1,dropStaleComments:!1,channelSize:void 0,maxCommentsLength:void 0,bulletOffset:void 0,interval:2e3,highScorePriority:!0,chaseEffect:!0};if((0,c.deepCopy)(s,e),(0,r.default)(n),n.globalHooks={},s.hooks&&n.hooks(s.hooks),n.hideArr=[],n.recycler=new l.default,n.freezeId=null,Py(i=s.comments).call(i,(function(e){e.duration=e.duration?e.duration:5e3,e.mode||(e.mode="scroll")})),n.container=s.container&&1===s.container.nodeType?s.container:null,!n.container)return n.emit("error","container id can't be empty"),d(n,!1);if(s.containerStyle){var u,h=s.containerStyle;Py(u=Cy(h)).call(u,(function(e){n.container.style[e]=h[e]}))}return(0,c.addClass)(n.container,"danmu"),n.live=s.live,n.player=s.player,n.direction=s.direction,n.bulletBtn=new o.default(n),n.main=n.bulletBtn.main,n.isReady=!0,n.emit("ready"),n.logger&&n.logger.info("ready"),n.addResizeObserver(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+qh(t));e.prototype=MI(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(AO?AO(e,t):e.__proto__=t)}(t,e),n(t,[{key:"hooks",value:function(e){(0,c.deepCopy)(this.globalHooks,e)}},{key:"addResizeObserver",value:function(){var e=this;this.config.needResizeObserver&&this.container&&(0,u.addObserver)(this.container,(function(){e.logger&&e.logger.info("needResizeObserver"),e.resize()}))}},{key:"start",value:function(){this.logger&&this.logger.info("start"),this.main&&this.main.start()}},{key:"pause",value:function(){this.logger&&this.logger.info("pause"),this.main&&this.main.pause()}},{key:"play",value:function(){this.logger&&this.logger.info("play"),this.main&&this.main.play()}},{key:"stop",value:function(){this.logger&&this.logger.info("stop"),this.main&&this.main.stop()}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.main&&this.main.clear()}},{key:"destroy",value:function(){for(var e in(0,u.unObserver)(this.container),this.logger&&this.logger.info("destroy"),this.stop(),this.bulletBtn&&this.bulletBtn.destroy(),this.recycler&&this.recycler.destroy(),this)delete this[e];this.emit("destroy")}},{key:"sendComment",value:function(e){var t=this.main,i=this.logger;i&&i.info("sendComment: "+(e.txt||"[DOM Element]")),t&&(e.duration||(e.duration=15e3),e&&e.id&&e.duration&&(e.el||e.elLazyInit||e.txt)&&(e.duration=e.duration?e.duration:5e3,e.style||(e.style={opacity:void 0,fontSize:void 0}),e.style&&(this.opacity&&this.opacity!==e.style.opacity&&(e.style.opacity=this.opacity),this.fontSize&&this.fontSize!==e.style.fontSize&&(e.style.fontSize=this.fontSize)),e.prior||e.realTime?(t.data.unshift(e),e.realTime&&(t.readData(),t.dataHandle())):t.data.push(e),t.sortData(),t.keepPoolWatermark()))}},{key:"setCommentID",value:function(e,t){var i,n,r=this;this.logger&&this.logger.info("setCommentID: oldID "+e+" newID "+t),e&&t&&(Yy(i=this.main.data).call(i,(function(i){return i.id===e&&(i.id=t,!0)})),Yy(n=this.main.queue).call(n,(function(i){return i.id===e&&(i.id=t,i.pauseMove(),"paused"!==r.main.status&&i.startMove(),!0)})))}},{key:"setCommentDuration",value:function(e,t){var i,n,r=this;this.logger&&this.logger.info("setCommentDuration: id "+e+" duration "+t),e&&t&&(t=t||5e3,Yy(i=this.main.data).call(i,(function(i){return i.id===e&&(i.duration=t,!0)})),Yy(n=this.main.queue).call(n,(function(i){return i.id===e&&(i.duration=t,i.pauseMove(),"paused"!==r.main.status&&i.startMove(),!0)})))}},{key:"setCommentLike",value:function(e,t){var i,n;this.logger&&this.logger.info("setCommentLike: id "+e+" like "+t),e&&t&&(Yy(i=this.main.data).call(i,(function(i){return i.id===e&&(i.like=t,!0)})),Yy(n=this.main.queue).call(n,(function(i){return i.id===e&&(i.pauseMove(),i.setLikeDom(t.el,t.style),"paused"!==i.danmu.main.status&&i.startMove(),!0)})))}},{key:"restartComment",value:function(e){if(this.logger&&this.logger.info("restartComment: id "+e),e){var t,i=this.main;if(this._releaseCtrl(e),"closed"===i.status)return;Yy(t=i.queue).call(t,(function(t){return t.id===e&&("paused"!==i.status?t.startMove(!0):t.status="paused",!0)}))}}},{key:"_releaseCtrl",value:function(e){this.freezeId&&e===this.freezeId&&(this.mouseControl=!1,this.freezeId=null)}},{key:"_freezeCtrl",value:function(e){this.mouseControl=!0,this.freezeId=e}},{key:"freezeComment",value:function(e){var t;this.logger&&this.logger.info("freezeComment: id "+e),e&&(this._freezeCtrl(e),Yy(t=this.main.queue).call(t,(function(t){return t.id===e&&(t.status="forcedPause",t.pauseMove(),t.el&&t.el.style&&(0,c.styleUtil)(t.el,"zIndex",10),!0)})))}},{key:"removeComment",value:function(e){if(this.logger&&this.logger.info("removeComment: id "+e),e){var t,i,n=this.main;this._releaseCtrl(e),n.queue=Dy(t=n.queue).call(t,(function(t){return t.id!==e||(t.remove(),!1)})),n.data=Dy(i=n.data).call(i,(function(t){return t.id!==e}))}}},{key:"updateComments",value:function(e){var t,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.logger&&this.logger.info("updateComments: "+e.length+", isClear "+i);var n=this.main;"boolean"==typeof i&&i&&(n.data=[]),n.data=Hy(t=n.data).call(t,e),n.sortData(),n.keepPoolWatermark()}},{key:"setAllDuration",value:function(){var e,t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",n=this,r=arguments[1],a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.logger&&this.logger.info("setAllDuration: mode "+i+" duration "+r+" force "+a),r&&(r=r||5e3,a&&(this.main.forceDuration=r),Py(e=this.main.data).call(e,(function(e){i===e.mode&&(e.duration=r)})),Py(t=this.main.queue).call(t,(function(e){i===e.mode&&(e.duration=r,e.pauseMove(),"paused"!==n.main.status&&e.startMove())})))}},{key:"setPlayRate",value:function(){var e,t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",n=arguments[1];this.logger&&this.logger.info("setPlayRate: "+n),(0,c.isNumber)(n)&&n>0&&(this.main.playRate=n,Py(e=this.main.queue).call(e,(function(e){i===e.mode&&(e.pauseMove(),"paused"!==t.main.status&&e.startMove())})))}},{key:"setOpacity",value:function(e){this.logger&&this.logger.info("setOpacity: opacity "+e),this.container&&(this.container.style.opacity=e)}},{key:"setFontSize",value:function(e,t){var i,n,r=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{reflow:!0};this.logger&&this.logger.info("setFontSize: size "+e+" channelSize "+t),this.fontSize=e+"px",e&&(Py(i=this.main.data).call(i,(function(e){e.style&&(e.style.fontSize=r.fontSize)})),Py(n=this.main.queue).call(n,(function(e){e.options.style||(e.options.style={}),e.options.style.fontSize=r.fontSize,e.setFontSize(r.fontSize),t&&(e.top=e.channel_id[0]*t,e.topInit())}))),t&&(this.config.channelSize=t,a.reflow&&this.main.channel.resizeSync())}},{key:"setArea",value:function(e){this.logger&&this.logger.info("setArea: area "+e),this.config.area=e,!1!==e.reflow&&this.main.channel.resizeSync()}},{key:"hide",value:function(){var e,t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("hide: mode "+i),zy(e=this.hideArr).call(e,i)<0&&this.hideArr.push(i);var n=Dy(t=this.main.queue).call(t,(function(e){return i===e.mode||"color"===i&&e.color}));Py(n).call(n,(function(e){return e.remove()}))}},{key:"show",value:function(){var e,t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.logger&&this.logger.info("show: mode "+i);var n=zy(e=this.hideArr).call(e,i);n>-1&&mw(t=this.hideArr).call(t,n,1)}},{key:"setDirection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.logger&&this.logger.info("setDirection: direction "+e),this.direction=e,this.emit("changeDirection",e)}},{key:"resize",value:function(){this.logger&&this.logger.info("resize"),this.emit("channel_resize")}},{key:"status",get:function(){return this.main.status}},{key:"state",get:function(){var e=this.main;return{status:e.status,comments:e.data,bullets:e.queue,displayArea:e.channel.getRealOccupyArea()}}},{key:"containerPos",get:function(){return this.main.channel.containerPos}}]),t}(s.default);t.default=f},function(e,t,i){var n,r,a,s,o,l,u,c=i(8),h=i(25),d=Function.prototype.apply,f=Function.prototype.call,v=MI,g=dy,p=My,m=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};r=function(e,t){var i,r;return h(t),r=this,n.call(this,e,i=function(){a.call(r,e,i),d.call(t,this,arguments)}),i.__eeOnceListener__=t,this},o={on:n=function(e,t){var i;return h(t),m.call(this,"__ee__")?i=this.__ee__:(i=y.value=v(null),g(this,"__ee__",y),y.value=null),i[e]?"object"==qh(i[e])?i[e].push(t):i[e]=[i[e],t]:i[e]=t,this},once:r,off:a=function(e,t){var i,n,r,a;if(h(t),!m.call(this,"__ee__"))return this;if(!(i=this.__ee__)[e])return this;if("object"==qh(n=i[e]))for(a=0;r=n[a];++a)r!==t&&r.__eeOnceListener__!==t||(2===n.length?i[e]=n[a?0:1]:mw(n).call(n,a,1));else n!==t&&n.__eeOnceListener__!==t||delete i[e];return this},emit:s=function(e){var t,i,n,r,a;if(m.call(this,"__ee__")&&(r=this.__ee__[e]))if("object"==qh(r)){for(i=arguments.length,a=new Array(i-1),t=1;t<i;++t)a[t-1]=arguments[t];for(r=iI(r).call(r),t=0;n=r[t];++t)d.call(n,this,a)}else switch(arguments.length){case 1:f.call(r,this);break;case 2:f.call(r,this,arguments[1]);break;case 3:f.call(r,this,arguments[1],arguments[2]);break;default:for(i=arguments.length,a=new Array(i-1),t=1;t<i;++t)a[t-1]=arguments[t];d.call(r,this,a)}}},l={on:c(n),once:c(r),off:c(a),emit:c(s)},u=p({},l),e.exports=t=function(e){return null==e?v(u):p(Object(e),l)},t.methods=o},function(e,t,i){var n=i(3),r=i(9),a=i(13),s=i(21),o=i(22);(e.exports=function(e,t){var i,r,l,u,c;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],n(e)?(i=o.call(e,"c"),r=o.call(e,"e"),l=o.call(e,"w")):(i=l=!0,r=!1),c={value:t,configurable:i,enumerable:r,writable:l},u?a(s(u),c):c}).gs=function(e,t,i){var l,u,c,h;return"string"!=typeof e?(c=i,i=t,t=e,e=null):c=arguments[3],n(t)?r(t)?n(i)?r(i)||(c=i,i=void 0):i=void 0:(c=t,t=i=void 0):t=void 0,n(e)?(l=o.call(e,"c"),u=o.call(e,"e")):(l=!0,u=!1),h={get:t,set:i,configurable:l,enumerable:u},c?a(s(c),h):h}},function(e,t,i){var n=i(10),r=/^\s*class[\s{/}]/,a=Function.prototype.toString;e.exports=function(e){return!!n(e)&&!r.test(a.call(e))}},function(e,t,i){var n=i(11);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(t){return!1}return!n(e)}},function(e,t,i){var n=i(12);e.exports=function(e){if(!n(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(t){return!1}}},function(e,t,i){var n=i(3),r={object:!0,function:!0,undefined:!0};e.exports=function(e){return!!n(e)&&hasOwnProperty.call(r,qh(e))}},function(e,t,i){e.exports=i(14)()?Ly:i(15)},function(e,t,i){e.exports=function(){var e;return"function"==typeof Ly&&(Ly(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,i){var n=i(16),r=i(20),a=Math.max;e.exports=function(e,t){var i,s,o,l=a(arguments.length,2);for(e=Object(r(e)),o=function(n){try{e[n]=t[n]}catch(r){i||(i=r)}},s=1;s<l;++s){var u;Py(u=n(t=arguments[s])).call(u,o)}if(void 0!==i)throw i;return e}},function(e,t,i){e.exports=i(17)()?Cy:i(18)},function(e,t,i){e.exports=function(){try{return Cy("primitive"),!0}catch(e){return!1}}},function(e,t,i){var n=i(2),r=Cy;e.exports=function(e){return r(n(e)?Object(e):e)}},function(e,t,i){e.exports=function(){}},function(e,t,i){var n=i(2);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,i){var n=i(2),r=Py(Array.prototype),a=MI,s=function(e,t){var i;for(i in e)t[i]=e[i]};e.exports=function(e){var t=a(null);return r.call(arguments,(function(e){n(e)&&s(Object(e),t)})),t}},function(e,t,i){e.exports=i(23)()?String.prototype.contains:i(24)},function(e,t,i){var n="razdwatrzy";e.exports=function(){return"function"==typeof n.contains&&!0===n.contains("dwa")&&!1===n.contains("foo")}},function(e,t,i){var n=zy(String.prototype);e.exports=function(e){return n.call(this,e,arguments[1])>-1}},function(e,t,i){e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e){e.exports=JSON.parse('{"version":"1.1.13"}')},function(e,t,i){dy(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=o(i(1)),a=o(i(28)),s=i(0);function o(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=qh(t)&&"function"!=typeof t?e:t}(this,(t.__proto__||RO(t)).call(this));return i.setLogger("control"),i.danmu=e,i.main=new a.default(e),e.config.defaultOff||i.main.start(),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+qh(t));e.prototype=MI(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(AO?AO(e,t):e.__proto__=t)}(t,e),n(t,[{key:"createSwitch",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.logger&&this.logger.info("createSwitch"),this.switchBtn=(0,s.createDom)("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(e?"danmu-switch-active":"")),this.switchBtn}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this.main.destroy(),this)s.hasOwnProperty.call(this,e)&&delete this[e]}}]),t}(r.default);t.default=l,e.exports=t.default},function(e,t,i){dy(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=l(i(1)),a=l(i(29)),s=l(i(30)),o=i(0);function l(e){return e&&e.__esModule?e:{default:e}}var u=function(e){function t(e){var i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=qh(t)&&"function"!=typeof t?e:t}(this,(t.__proto__||RO(t)).call(this));return n.setLogger("main"),n.danmu=e,n.container=e.container,n.channel=new s.default(e),n.data=Hy(i=[]).call(i,e.config.comments),n.playedData=[],n.queue=[],n.timer=null,n.playRate=1,n.retryStatus="normal",n.interval=e.config.interval,n._status="idle",n._events=[],n._bindEvents(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+qh(t));e.prototype=MI(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(AO?AO(e,t):e.__proto__=t)}(t,e),n(t,[{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),this._unbindEvents(),this._cancelTick(),this.channel&&this.channel.destroy(),this.data=[],this)delete this[e]}},{key:"_bindEvents",value:function(){var e,t=this,i=this.danmu,n=this.container;this._unbindEvents(),this._events.push([i,"bullet_remove",function(e){var i=e.bullet,n=t.data,r=t.queue;Yy(r).call(r,(function(e,t){return e.id===i.id&&(mw(r).call(r,t,1),!0)})),Yy(n).call(n,(function(e){return e.id===i.id&&(e.attached_=!1,!0)}))}]),this._events.push([n,"transitionend",function(e){var i=t._getBulletByEvt(e);i&&(i.status="end",i.remove(!1))}]),(i.config.mouseControl||i.config.mouseEnterControl)&&this._events.push([n,"mouseover",function(e){var i,n=t.danmu;!n||n.mouseControl&&n.config.mouseControlPause||(i=t._getBulletByEvt(e))&&"waiting"!==i.status&&"end"!==i.status&&n.emit("bullet_hover",{bullet:i,event:e})}]),Py(e=this._events).call(e,(function(e){e[0].addEventListener?e[0].addEventListener(e[1],e[2],!1):e[0].on&&e[0].on(e[1],e[2])}))}},{key:"_unbindEvents",value:function(){var e;this._events.length&&(Py(e=this._events).call(e,(function(e){e[0].removeEventListener?e[0].removeEventListener(e[1],e[2],!1):e[0].off&&e[0].off(e[1],e[2])})),this._events=[])}},{key:"_cancelTick",value:function(){this.handleTimer&&(clearTimeout(this.handleTimer),this.handleTimer=null)}},{key:"_startTick",value:function(){var e=this;e.retryStatus="normal",e._cancelTick(),e.sortData(),function t(){"closed"!==e._status||"stop"!==e.retryStatus?("playing"===e._status&&(e.readData(),e.dataHandle()),"stop"===e.retryStatus&&"paused"!==e._status||(e.handleTimer=gC(t,250))):e._cancelTick()}()}},{key:"start",value:function(){this.logger&&this.logger.info("start"),"playing"!==this._status&&(this._status="playing",this.queue=[],this.container.innerHTML="",this.channel.reset(),this._startTick())}},{key:"stop",value:function(){this.logger&&this.logger.info("stop"),"closed"!==this._status&&(this._status="closed",this.retryStatus="stop",this.queue=[],this.container&&(this.container.innerHTML=""),this.channel&&this.channel.reset(),this._cancelTick())}},{key:"clear",value:function(){this.logger&&this.logger.info("clear"),this.channel&&this.channel.reset(),this.data=[],this.queue=[],this.container&&(this.container.innerHTML="")}},{key:"play",value:function(){var e=this;if("closed"!==this._status){var t;this.logger&&this.logger.info("play"),this._status="playing";var i=this.channel.channels;i&&i.length>0&&Py(t=["scroll","top","bottom"]).call(t,(function(t){var n;Py(n=e.queue).call(n,(function(e){e.startMove(),e.resized=!0}));for(var r=0;r<i.length;r++){var a;Py(a=i[r].queue[t]).call(a,(function(e){e.resized=!1}))}})),this._startTick()}else this.logger&&this.logger.info("play ignored")}},{key:"pause",value:function(){if("closed"!==this._status){var e;this.logger&&this.logger.info("pause"),this._status="paused",this._cancelTick();var t=this.channel.channels;t&&t.length>0&&Py(e=this.queue).call(e,(function(e){e.pauseMove()}))}else this.logger&&this.logger.info("pause ignored")}},{key:"dataHandle",value:function(){var e;"paused"!==this._status&&"closed"!==this._status&&this.queue.length&&Py(e=this.queue).call(e,(function(e){"waiting"===e.status&&e.startMove()}))}},{key:"readData",value:function(){var e=this.danmu,t=this.interval,i=this.channel,n=e.player,r=void 0,s=void 0;if(e.isReady&&e.main){var l,u;if(n){var c,h=n.currentTime?Math.floor(1e3*n.currentTime):0;s=Dy(c=this.data).call(c,(function(i){var n,r,a,s;return!i.start&&zy(n=e.hideArr).call(n,i.mode)<0&&(!i.color||zy(r=e.hideArr).call(r,"color")<0)&&(i.start=h),!i.attached_&&zy(a=e.hideArr).call(a,i.mode)<0&&(!i.color||zy(s=e.hideArr).call(s,"color")<0)&&i.start-t<=h&&h<=i.start+t})),e.config.highScorePriority&&XC(s).call(s,(function(e,t){return t.prior&&!e.prior||(t.score||-1)-(e.score||-1)})),e.live&&(this.data=[])}else 0===(s=mw(l=this.data).call(l,0,1)).length&&(s=mw(u=this.playedData).call(u,0,1));if(s.length>0&&i.checkAvailableTrack(s[0].mode)){i.updatePos();var d=0;e:for(var f,v=0;v<s.length;v++)if(f=s[v],this.forceDuration&&this.forceDuration!==f.duration&&(f.duration=this.forceDuration),(r=new a.default(e,f)).bulletCreateFail){if(0===d)break e;d--}else if(r.attach(),f.attached_=!0,i.addBullet(r).result)this.queue.push(r),r.topInit(),d=0;else{for(var g in r.detach(),r)o.hasOwnProperty.call(r,g)&&delete r[g];if(r=null,f.attached_=!1,f.noDiscard&&(f.prior?this.data.unshift(f):this.data.push(f)),0===d)break e;d--}}}}},{key:"sortData",value:function(){var e;XC(e=this.data).call(e,(function(e,t){return(e.start||-1)-(t.start||-1)}))}},{key:"keepPoolWatermark",value:function(){var e=this.danmu,t=e.config,i=e.player,n=this.data,r=[],a=0;if("number"==typeof t.maxCommentsLength&&n.length>t.maxCommentsLength){a=n.length-t.maxCommentsLength;for(var s,o=0;o<a;o++)(s=n[o]).prior&&!s.attached_&&r.push(n[o])}else if(t.dropStaleComments&&i&&i.currentTime){var l=Math.floor(1e3*i.currentTime)-t.interval;if(l>0)for(var u,c=0;c<n.length;c++)if((u=n[c]).prior&&!u.attached_&&r.push(n[c]),u.start>l){a=c;break}}a>0&&(mw(n).call(n,0,a),this.data=Hy(r).call(r,n))}},{key:"_getBulletByEvt",value:function(e){for(var t,i=e.target||e.srcElement,n=this.queue,r=void 0,a=0;a<n.length;a++)if((t=n[a])&&t.el&&(t.el===i||t.el.contains(i))){r=t;break}return r}},{key:"status",get:function(){return this._status}}]),t}(r.default);t.default=u,e.exports=t.default},function(e,t,i){dy(t,"__esModule",{value:!0}),t.Bullet=void 0;var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=o(i(1)),a=o(i(4)),s=i(0);function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=qh(t)&&"function"!=typeof t?e:t}var c=new a.default("bullet"),h=t.Bullet=function(e){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l(this,t);var n=u(this,(t.__proto__||RO(t)).call(this)),r=e.container,a=e.recycler,s=e.config;return n.setLogger(c),n.danmu=e,n.options=i,n.duration=i.duration,n.id=i.id,n.container=r,n.mode="top"===i.mode||"bottom"===i.mode?i.mode:"scroll",n.start=i.start,n.prior=i.prior,n.realTime=i.realTime,n.color=i.color,n.bookChannelId=i.bookChannelId,n.reuseDOM=!0,n.noCopyEl=!(!s.disableCopyDOM&&!i.disableCopyDOM),n.recycler=a,n._fullySlideInScreenDuration=void 0,n._lastMoveTime=void 0,n.status="waiting",i.elLazyInit||(n.bulletCreateFail=!n._makeEl()),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+qh(t));e.prototype=MI(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(AO?AO(e,t):e.__proto__=t)}(t,e),n(t,[{key:"_makeEl",value:function(){var e,t=this.danmu,i=this.options,n=t.config,r=t.globalHooks,a=void 0,o="",l=i.style||{};if(l.perspective="500em",i.el||i.elLazyInit){if(this.noCopyEl&&(this.reuseDOM=!1),i.elLazyInit){if((0,s.isFunction)(r.bulletCreateEl))try{var u=r.bulletCreateEl(i);a=u instanceof HTMLElement?u:u.el}catch(p){}}else if(1===i.el.nodeType&&!i.el.parentNode)if(this.reuseDOM){var c,h=(0,s.copyDom)(i.el);i.eventListeners&&i.eventListeners.length>0&&Py(c=i.eventListeners).call(c,(function(e){h.addEventListener(e.event,e.listener,e.useCapture||!1)})),(a=this.recycler.use()).childNodes.length>0&&(a.innerHTML=""),a.textContent&&(a.textContent=""),a.appendChild(h)}else a=i.el}else"string"==typeof i.txt&&((a=this.recycler.use()).textContent=i.txt);if(!a||!t.main)return!1;var d=void 0;if((0,s.isNumber)(n.bulletOffset)&&n.bulletOffset>=0)d=n.bulletOffset;else{var f=t.containerPos;d=f.width/10>100?100:f.width/10}var v=i.realTime?0:Math.floor(Math.random()*d),g=this.updateOffset(v,!0);return l.left=g,Py(e=Cy(l)).call(e,(function(e){var t=e.replace(/[A-Z]/g,(function(e){return"-"+e.toLowerCase()}));o+=t+":"+l[e]+";"})),(0,s.styleCSSText)(a,o),this.el=a,i.like&&i.like.el&&this.setLikeDom(i.like.el,i.like.style),!0}},{key:"updateOffset",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.random=e;var i=this.danmu.containerPos.width+e+"px";return t||(0,s.styleUtil)(this.el,"left",this.danmu.containerPos.width+e+"px"),i}},{key:"attach",value:function(){if(this.options.elLazyInit&&!this.el&&this._makeEl(),this.danmu&&this.danmu.main){var e=this.danmu,t=this.options,i=this.el,n=e.globalHooks;n.bulletAttaching&&n.bulletAttaching(t),this.container.contains(i)||this.container.appendChild(i),this.elPos=i.getBoundingClientRect(),"b2t"===this.direction?(this.width=this.elPos.height,this.height=this.elPos.width):(this.width=this.elPos.width,this.height=this.elPos.height),this.moveV&&(this.duration=(this.danmu.containerPos.width+this.random+this.width)/this.moveV*1e3),n.bulletAttached&&n.bulletAttached(t,i)}}},{key:"detach",value:function(){var e=this.el,t=this.danmu,i=this.options,n=t.globalHooks;e&&(n.bulletDetaching&&n.bulletDetaching(i),this.reuseDOM?this.recycler.unused(e):e.parentNode&&e.parentNode.removeChild(e),n.bulletDetached&&n.bulletDetached(i,e),this.el=null),this.elPos=void 0}},{key:"topInit",value:function(){this.logger&&this.logger.info("topInit #"+(this.options.txt||"[DOM Element]")+"#"),"b2t"===this.direction?((0,s.styleUtil)(this.el,"transformOrigin","left top"),(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+this.danmu.containerPos.height+"px) translateZ(0px) rotate(90deg)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")):(0,s.styleUtil)(this.el,"top",this.top+"px")}},{key:"pauseMove",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this;if("paused"!==t.status&&("forcedPause"!==t.status&&(this.status="paused"),t._moveV=void 0,this.el))if("scroll"===this.mode){var i=t.danmu.containerPos;if(e){var n=((new Date).getTime()-t._lastMoveTime)/1e3*this.moveV,r=0;r=t.moveMoreS-n>=0?"b2t"===this.direction?(t.moveMoreS-n)/t.moveContainerHeight*i.height:(t.moveMoreS-n)/t.moveContainerWidth*i.width:t.moveMoreS-n,"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+r+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",r+"px")}else"b2t"===this.direction?(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-i.top)+"px) translateZ(0px) rotate(90deg)"):(0,s.styleUtil)(this.el,"left",this.el.getBoundingClientRect().left-i.left+"px");"b2t"===this.direction||(0,s.styleUtil)(this.el,"transform","translateX(0px) translateY(0px) translateZ(0px)"),(0,s.styleUtil)(this.el,"transition","transform 0s linear 0s")}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(e){if(this.hasMove||(this.danmu.emit("bullet_start",this),this.hasMove=!0),("forcedPause"!==this.status||e)&&this.el&&"start"!==this.status)if(this.status="start","scroll"===this.mode){var t=this.danmu.containerPos;if(!this.el)return;var i=this.el.getBoundingClientRect(),n=void 0;if("b2t"===this.direction){n=i.bottom-t.bottom;var r=(i.bottom-t.top)/this.moveV;(0,s.styleUtil)(this.el,"transition","transform "+r+"s linear 0s"),(0,s.styleUtil)(this.el,"transform","translateX(-"+this.top+"px) translateY(-"+this.height+"px) translateZ(0px) rotate(90deg)"),this._lastMoveTime=(new Date).getTime(),this.moveMoreS=i.top-t.top,this.moveContainerHeight=t.height}else{n=i.right-t.right;var a=i.right-t.left,o=a/this.moveV;i.right>t.left?((0,s.styleUtil)(this.el,"transition","transform "+o+"s linear 0s"),(0,s.styleUtil)(this.el,"transform","translateX(-"+a+"px) translateY(0px) translateZ(0px)"),this._lastMoveTime=(new Date).getTime(),this.moveMoreS=i.left-t.left,this.moveContainerWidth=t.width):(this.status="end",this.remove())}this._fullySlideInScreenDuration=n/this.moveV}else{var l=(new Date).getTime(),u=(this.startTime&&l-this.startTime>this.duration?l-this.startTime:this.duration)/1e3;(0,s.styleUtil)(this.el,"left","50%"),(0,s.styleUtil)(this.el,"margin","0 0 0 -"+this.width/2+"px"),(0,s.styleUtil)(this.el,"visibility","hidden"),(0,s.styleUtil)(this.el,"transition","visibility "+u+"s 0s"),this.pastDuration||(this.pastDuration=1),this.startTime=l}}},{key:"remove",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.logger&&this.logger.info("remove #"+(this.options.txt||"[DOM Element]")+"#");var t=this;e&&t.pauseMove(),t.el&&t.el.parentNode&&(t.detach(),this.options.el&&1===this.options.el.nodeType&&this.noCopyEl&&(0,s.styleUtil)(this.options.el,"transform","none"),t.danmu.emit("bullet_remove",{bullet:t}))}},{key:"setFontSize",value:function(e){this.el&&(this.el.style.fontSize=e)}},{key:"setLikeDom",value:function(e,t){var i;if(e&&(Py(i=Cy(t)).call(i,(function(i){e.style[i]=t[i]})),e.className="danmu-like",this.el)){var n=this.el.querySelector(".danmu-like");n&&this.el.removeChild(n),this.el.innerHTML=""+this.el.innerHTML+e.outerHTML}return e}},{key:"moveV",get:function(){var e=this.danmu,t=this.options,i=this._moveV;if(!i){if(t.moveV)i=t.moveV;else if(this.elPos){var n=e.containerPos;i=("b2t"===this.direction?n.height+(e.config.chaseEffect?this.height:0):n.width+(e.config.chaseEffect?this.width:0))/this.duration*1e3}i&&(i*=e.main.playRate,this._moveV=i)}return i}},{key:"direction",get:function(){return this.danmu.direction}},{key:"fullySlideIntoScreen",get:function(){var e=!0;return"scroll"===this.mode&&this._lastMoveTime&&this._fullySlideInScreenDuration>0&&(e=((new Date).getTime()-this._lastMoveTime)/1e3>=this._fullySlideInScreenDuration),e}}]),t}(r.default);t.default=h},function(e,t,i){dy(t,"__esModule",{value:!0});var n,r=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),a=(n=i(1))&&n.__esModule?n:{default:n},s=i(0),o=i(31),l=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=qh(t)&&"function"!=typeof t?e:t}(this,(t.__proto__||RO(t)).call(this)),n=i;return n.setLogger("channel"),n.danmu=e,n.width=0,n.height=0,n.reset(!0),n.channels=[],n.updatePos(),(0,s.attachEventListener)(i.danmu,"bullet_remove",(function(e){n.removeBullet(e.bullet)}),"destroy"),(0,s.attachEventListener)(i.danmu,"channel_resize",(function(){n.resize()}),"destroy"),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+qh(t));e.prototype=MI(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(AO?AO(e,t):e.__proto__=t)}(t,e),r(t,[{key:"checkAvailableTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",t=this.channels,i=!1;if("scroll"===e)for(var n,r=0;r<t.length;r++)if(i=!0,(n=t[r]).operating[e])i=!1;else{var a=n.queue[e][0];if(!a||a.fullySlideIntoScreen){if(i)break}else i=!1}else i=!0;return i}},{key:"destroy",value:function(){for(var e in this.logger&&this.logger.info("destroy"),mw(t=this.channels).call(t,0,this.channels.length),this._cancelResizeTimer(),this){var t;s.hasOwnProperty.call(this,e)&&delete this[e]}}},{key:"reset",value:function(){var e,t,i,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger&&this.logger.info("reset");var r=this,a=r.danmu,s=a.container,o=a.bulletBtn;function l(){if(r.danmu&&r.danmu.container){var e=r.danmu.container.getBoundingClientRect();r.width=e.width,r.height=e.height,r.resetId&&(cancelAnimationFrame(r.resetId),r.resetId=null);var t=r._initChannels(),i=t.channelSize,n=t.channelCount,a=t.channels;r.channelCount=n,r.channels=a,"b2t"===r.direction?r.channelWidth=i:r.channelHeight=i}}r.container=s,o&&o.main&&Py(e=o.main.queue).call(e,(function(e){e.remove()})),r.channels&&r.channels.length>0&&Py(t=["scroll","top","bottom"]).call(t,(function(e){for(var t=0;t<r.channels.length;t++){var i;Py(i=r.channels[t].queue[e]).call(i,(function(e){e.remove()}))}})),o&&o.main&&o.main.data&&Py(i=o.main.data).call(i,(function(e){e.attached_=!1})),n?this.resetId=requestAnimationFrame(l):l()}},{key:"getRealOccupyArea",value:function(){return{width:this.width,height:this.height}}},{key:"updatePos",value:function(){var e=this.container.getBoundingClientRect();this.containerPos=e,this.containerWidth=e.width,this.containerHeight=e.height,this.containerTop=e.top,this.containerBottom=e.bottom,this.containerLeft=e.left,this.containerRight=e.right}},{key:"addBullet",value:function(e){var t=this,i=this.danmu,n=this.channels,r=void 0,a=void 0,s=void 0;if("b2t"===t.direction?(a=this.channelWidth,s=Math.ceil(e.width/a)):(r=this.channelHeight,s=Math.ceil(e.height/r)),s>n.length)return{result:!1,message:"exceed channels.length, occupy="+s+",channelsSize="+n.length};for(var o=!0,l=void 0,u=-1,c=0,h=n.length;c<h;c++){var d;if(Yy(d=n[c].queue[e.mode]).call(d,(function(t){return t.id===e.id})))return{result:!1,message:"exited, channelOrder="+c+",danmu_id="+e.id}}if("scroll"===e.mode)for(var f=0,v=n.length-s;f<=v;f+=s){o=!0;for(var g=f;g<f+s;g++){if((l=n[g]).operating.scroll||l.bookId.scroll&&l.bookId.scroll!==e.id){o=!1;break}l.operating.scroll=!0;var p=l.queue.scroll[0];if(p){var m=p.el.getBoundingClientRect();if("b2t"===t.direction){if(m.bottom>=t.containerPos.bottom){o=!1,l.operating.scroll=!1;break}}else if(m.right>=t.containerPos.right){o=!1,l.operating.scroll=!1;break}var y=void 0,k=p.moveV,T=void 0,E=e.moveV,S=void 0;if("b2t"===t.direction?(T=(y=m.bottom-t.containerTop)/k,S=t.containerHeight+e.random-y):(T=(y=m.right-t.containerLeft)/k,S=t.containerWidth+e.random-y),E>k){var _=S/(E-k);if(i.config.bOffset||(i.config.bOffset=0),T+i.config.bOffset>=_){var b=T*E-t.containerPos.width;b>0&&e.updateOffset(b+(1+Math.ceil(5*Math.random())))}}}l.operating.scroll=!1}if(o){u=f;break}}else if("top"===e.mode)for(var A=0,R=n.length-s;A<=R;A++){o=!0;for(var L=A;L<A+s;L++){if(L>Math.floor(n.length/2)){o=!1;break}if((l=n[L]).operating[e.mode]){o=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){o=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){o=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(o){u=A;break}}else if("bottom"===e.mode)for(var I=n.length-s;I>=0;I--){o=!0;for(var C=I;C<I+s;C++){if(C<=Math.floor(n.length/2)){o=!1;break}if((l=n[C]).operating[e.mode]){o=!1;break}if((l.bookId[e.mode]||e.prior)&&l.bookId[e.mode]!==e.id){o=!1;break}if(l.operating[e.mode]=!0,l.queue[e.mode].length>0){o=!1,l.operating[e.mode]=!1;break}l.operating[e.mode]=!1}if(o){u=I;break}}if(-1!==u){for(var w,D=u,x=u+s;D<x;D++)(l=n[D]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&(delete l.bookId[e.mode],t.logger&&t.logger.info(D+"号轨道恢复正常使用")),l.operating[e.mode]=!1;return e.prior&&(t.logger&&t.logger.info(e.id+"号优先弹幕运行完毕"),delete e.bookChannelId,i.player&&Yy(w=i.bulletBtn.main.data).call(w,(function(t){return t.id===e.id&&(delete t.bookChannelId,!0)}))),e.channel_id=[u,s],e.el.setAttribute("data-line-index",u+1),"b2t"===t.direction?(e.top=u*a,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerWidth*t.danmu.config.area.start)):(e.top=u*r,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start)),{result:e,message:"success"}}if(e.options.realTime){var P,O=0,M=-1,N=null;if(Py(P=t.danmu.bulletBtn.main.queue).call(P,(function(e,i){!e.prior&&!e.options.realTime&&e.el&&e.el.getBoundingClientRect().left>t.containerPos.right&&e.start>=O&&(O=e.start,M=i,N=e)})),N){var F;N.remove(),t.removeBullet(N),mw(F=t.danmu.bulletBtn.main.queue).call(F,M,1),e.channel_id=N.channel_id;for(var U=N.channel_id[0],B=N.channel_id[0]+N.channel_id[1];U<B;U++)(l=n[U]).operating[e.mode]=!0,l.queue[e.mode].unshift(e),e.prior&&delete l.bookId[e.mode],l.operating[e.mode]=!1;return e.top=N.top,t.danmu.config.area&&t.danmu.config.area.start&&(e.top+=t.containerHeight*t.danmu.config.area.start),{result:e,message:"success"}}}if(e.prior)if(e.bookChannelId||t.danmu.live){var H;i.player&&Yy(H=i.bulletBtn.main.data).call(H,(function(i){return i.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),i.start+=2e3,!0)}))}else{u=-1;for(var G=0,V=n.length-s;G<=V;G++){o=!0;for(var K=G;K<G+s;K++)if(n[K].bookId[e.mode]){o=!1;break}if(o){u=G;break}}if(-1!==u){for(var W,j=u;j<u+s;j++)n[j].bookId[e.mode]=e.id,t.logger&&t.logger.info(j+"号轨道被"+e.id+"号优先弹幕预定");i.player&&Yy(W=i.bulletBtn.main.data).call(W,(function(i){return i.id===e.id&&(t.logger&&t.logger.info(e.id+"号优先弹幕将于2秒后再次请求注册"),i.start+=2e3,i.bookChannelId=[u,s],t.logger&&t.logger.info(e.id+"号优先弹幕预定了"+u+"~"+(u+s-1)+"号轨道"),!0)}))}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(e){this.logger&&this.logger.info("removeBullet "+(e.options.txt||"[DOM Element]"));for(var t=this.channels,i=e.channel_id,n=void 0,r=i[0],a=i[0]+i[1];r<a;r++)if(n=t[r]){var s,o;n.operating[e.mode]=!0;var l=-1;Yy(s=n.queue[e.mode]).call(s,(function(t,i){return t.id===e.id&&(l=i,!0)})),l>-1&&mw(o=n.queue[e.mode]).call(o,l,1),n.operating[e.mode]=!1}e.options.loop&&this.danmu.bulletBtn.main.playedData.push(e.options)}},{key:"resizeSync",value:function(){this.resize(!0)}},{key:"_initChannels",value:function(){if(this.danmu&&this.danmu.config){var e=this.danmu.config,t=e.channelSize||(/mobile/gi.test(navigator.userAgent)?10:12),i=void 0;if(e.area){var n=e.area,r=n.lines,a=n.start,l=n.end;if((0,o.validAreaLineRule)(r))i=r,"b2t"===this.direction?this.width=i*t:this.height=i*t;else if(a>=0&&l>=a){var u=l-a;"b2t"===this.direction?this.width=Math.floor(this.width*u):this.height=Math.floor(this.height*u)}}(0,s.isNumber)(i)||(i="b2t"===this.direction?Math.floor(this.width/t):Math.floor(this.height/t));for(var c=[],h=0;h<i;h++)c[h]={id:h,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};return{channelSize:t,channelCount:i,channels:c}}}},{key:"resize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger&&this.logger.info("resize");var t=this;function i(e,t){e[t]={id:t,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}}}function n(e,n){function r(i){var n;Py(n=["scroll","top"]).call(n,(function(n){var r;Py(r=t.channels[i].queue[n]).call(r,(function(t){t.el&&e[i].queue[n].push(t)}))}))}function a(i){var r;Py(r=t.channels[i].queue.bottom).call(r,(function(r){if(r.el&&(e[i+e.length-t.channels.length].queue.bottom.push(r),r.channel_id[0]+r.channel_id[1]-1===i)){var a,s=Hy(a=[]).call(a,r.channel_id);r.channel_id=[s[0]-t.channels.length+e.length,s[1]],r.top=r.channel_id[0]*n,t.danmu.config.area&&t.danmu.config.area.start&&(r.top+=t.containerHeight*t.danmu.config.area.start),r.topInit()}}))}for(var s=0;s<t.channels.length;s++)i(e,s),r(s),a(s);for(var o=function(t){var i;Py(i=["scroll","top","bottom"]).call(i,(function(i){var n;Py(n=e[t].queue[i]).call(n,(function(e){e.resized=!1}))}))},l=0;l<e.length;l++)o(l);t.channels=e,"b2t"===t.direction?t.channelWidth=n:t.channelHeight=n}function r(e,n){for(var r=["scroll","top","bottom"],a=function(a){i(e,a),Py(r).call(r,(function(i){if("top"===i&&a>Math.floor(e.length/2));else if("bottom"===i&&a<=Math.floor(e.length/2));else{var r,s="bottom"===i?a-e.length+t.channels.length:a;Py(r=t.channels[s].queue[i]).call(r,(function(r,o){if(r.el){var l;if(e[a].queue[i].push(r),"bottom"===i&&r.channel_id[0]+r.channel_id[1]-1===s){var u,c=Hy(u=[]).call(u,r.channel_id);r.channel_id=[c[0]-t.channels.length+e.length,c[1]],r.top=r.channel_id[0]*n,t.danmu.config.area&&t.danmu.config.area.start&&(r.top+=t.containerHeight*t.danmu.config.area.start),r.topInit()}mw(l=t.channels[s].queue[i]).call(l,o,1)}}))}}))},s=0;s<e.length;s++)a(s);var o=function(t){Py(r).call(r,(function(i){var n;Py(n=e[t].queue[i]).call(n,(function(e){e.resized=!1}))}))};for(s=0;s<e.length;s++)o(s);t.channels=e,"b2t"===t.direction?t.channelWidth=n:t.channelHeight=n}function a(){var e,i=t.danmu,a=i.container,s=i.bulletBtn;t.container=a,t.updatePos(),t._cancelResizeTimer(),s.main.data&&Py(e=s.main.data).call(e,(function(e){e.bookChannelId&&(delete e.bookChannelId,t.logger&&t.logger.info("resize导致"+e.id+"号优先弹幕预定取消"))})),t.logger&&t.logger.info("resize导致所有轨道恢复正常使用"),t.width=t.containerWidth,t.height=t.containerHeight;var o=t._initChannels(),l=o.channelSize,u=o.channels;t.channels&&(t.channels.length<=u.length?n(u,l):r(u,l)),t.resizing=!1}t.resizing||(t.resizing=!0,e?a():(this._cancelResizeTimer(),this.resizeId=requestAnimationFrame(a)))}},{key:"_cancelResizeTimer",value:function(){this.resizeId&&(cancelAnimationFrame(this.resizeId),this.resizeId=null)}},{key:"direction",get:function(){return this.danmu.direction}}]),t}(a.default);t.default=l,e.exports=t.default},function(e,t,i){dy(t,"__esModule",{value:!0}),t.validAreaLineRule=function(e){return"number"==typeof e&&e>=0&&AP(e)}},function(e,t,i){dy(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=i(0),a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t={initDOM:function(){return document.createElement("div")},initSize:10},this.init(t)}return n(e,[{key:"init",value:function(e){this.idleList=[],this.usingList=[],this._id=0,this.options=e,this._expand(e.initSize)}},{key:"use",value:function(){this.idleList.length||this._expand(1);var e=this.idleList.shift();return this.usingList.push(e),e}},{key:"unused",value:function(e){var t,i,n=zy(t=this.usingList).call(t,e);n<0||(mw(i=this.usingList).call(i,n,1),e.style.opacity=0,this.idleList.push(e))}},{key:"_expand",value:function(e){for(var t=0;t<e;t++)this.idleList.push(this.options.initDOM(this._id++))}},{key:"destroy",value:function(){for(var e=0;e<this.idleList.length;e++)this.idleList[e].innerHTML="",this.idleList[e].textcontent="",this.clearElementStyle(this.idleList[e]);for(var t=0;t<this.usingList.length;t++)this.usingList[t].innerHTML="",this.usingList[t].textcontent="",this.clearElementStyle(this.usingList[t]);for(var i in this)r.hasOwnProperty.call(this,i)&&delete this[i]}},{key:"clearElementStyle",value:function(e){var t="undefined"!=typeof window?window.navigator.userAgent:null;t&&(zy(t).call(t,"MSIE ")>-1||zy(t).call(t,"Trident/")>-1?(0,r.styleUtil)(e,"transform","none"):e.setAttribute("style",""))}}]),e}();t.default=a,e.exports=t.default},function(e,t,i){dy(t,"__esModule",{value:!0}),t.destroyObserver=t.unObserver=t.addObserver=void 0;var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=i(0),a=new(function(){function e(){var t=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.__handlers=[],window.ResizeObserver)try{this.observer=new window.ResizeObserver((0,r.throttle)((function(e){t.__trigger(e)}),100))}catch(i){}}return n(e,[{key:"addObserver",value:function(e,t){if(this.observer&&e){this.observer&&this.observer.observe(e);for(var i=this.__handlers,n=-1,r=0;r<i.length;r++)i[r]&&e===i[r].target&&(n=r);n>-1?this.__handlers[n].handler.push(t):this.__handlers.push({target:e,handler:[t]})}}},{key:"unObserver",value:function(e){if(e){var t,i,n=-1;ub(t=this.__handlers).call(t,(function(t,i){e===t.target&&(n=i)})),this.observer&&this.observer.unobserve(e),n>-1&&mw(i=this.__handlers).call(i,n,1)}}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e){for(var t=this.__handlers,i=0;i<t.length;i++)if(t[i]&&e===t[i].target){var n;t[i].handler&&ub(n=t[i].handler).call(n,(function(e){try{e()}catch(t){console.error(t)}}));break}}},{key:"__trigger",value:function(e){var t=this;ub(e).call(e,(function(e){t.__runHandler(e.target)}))}}]),e}());t.addObserver=function(e,t){a.addObserver(e,t)},t.unObserver=function(e,t){a.unObserver(e,t)},t.destroyObserver=function(e,t){a.destroyObserver(e,t)}},function(e,t,i){var n=i(35);"string"==typeof n&&(n=[[e.i,n,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};i(37)(n,r),n.locals&&(e.exports=n.locals)},function(e,t,i){(e.exports=i(36)(!1)).push([e.i,".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#fff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){var t;return ub(t=this).call(t,(function(t){var i=function(e,t){var i=e[1]||"",n=e[3];if(!n)return i;if(t&&"function"==typeof btoa){var r,a,s,o="/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(bI(n))))+" */",l=ub(r=n.sources).call(r,(function(e){return"/*# sourceURL="+n.sourceRoot+e+" */"}));return Hy(a=Hy(s=[i]).call(s,l)).call(a,[o]).join("\n")}return[i].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+i+"}":i})).join("")},t.i=function(e,i){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},r=0;r<this.length;r++){var a=this[r][0];"number"==typeof a&&(n[a]=!0)}for(r=0;r<e.length;r++){var s=e[r];"number"==typeof s[0]&&n[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),t.push(s))}},t}},function(e,t,i){var n,r,a,s={},o=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===r&&(r=n.apply(this,arguments)),r}),l=function(e){return document.querySelector(e)},u=(a={},function(e){if("function"==typeof e)return e();if(void 0===a[e]){var t=l.call(this,e);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(i){t=null}a[e]=t}return a[e]}),c=null,h=0,d=[],f=i(38);function v(e,t){for(var i=0;i<e.length;i++){var n=e[i],r=s[n.id];if(r){r.refs++;for(var a=0;a<r.parts.length;a++)r.parts[a](n.parts[a]);for(;a<n.parts.length;a++)r.parts.push(T(n.parts[a],t))}else{var o=[];for(a=0;a<n.parts.length;a++)o.push(T(n.parts[a],t));s[n.id]={id:n.id,refs:1,parts:o}}}}function g(e,t){for(var i=[],n={},r=0;r<e.length;r++){var a=e[r],s=t.base?a[0]+t.base:a[0],o={css:a[1],media:a[2],sourceMap:a[3]};n[s]?n[s].parts.push(o):i.push(n[s]={id:s,parts:[o]})}return i}function p(e,t){var i=u(e.insertInto);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=d[d.length-1];if("top"===e.insertAt)n?n.nextSibling?i.insertBefore(t,n.nextSibling):i.appendChild(t):i.insertBefore(t,i.firstChild),d.push(t);else if("bottom"===e.insertAt)i.appendChild(t);else{if("object"!=qh(e.insertAt)||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var r=u(e.insertInto+" "+e.insertAt.before);i.insertBefore(t,r)}}function m(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=zy(d).call(d,e);t>=0&&mw(d).call(d,t,1)}function y(e){var t=document.createElement("style");return void 0===e.attrs.type&&(e.attrs.type="text/css"),k(t,e.attrs),p(e,t),t}function k(e,t){var i;Py(i=Cy(t)).call(i,(function(i){e.setAttribute(i,t[i])}))}function T(e,t){var i,n,r,a,s,o;if(t.transform&&e.css){if(!(a=t.transform(e.css)))return function(){};e.css=a}if(t.singleton){var l=h++;i=c||(c=y(t)),n=Iy(_).call(_,null,i,l,!1),r=Iy(_).call(_,null,i,l,!0)}else e.sourceMap&&"function"==typeof tI&&"function"==typeof tI.createObjectURL&&"function"==typeof tI.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(s=t,o=document.createElement("link"),void 0===s.attrs.type&&(s.attrs.type="text/css"),s.attrs.rel="stylesheet",k(o,s.attrs),p(s,o),i=o,n=Iy(A).call(A,null,i,t),r=function(){m(i),i.href&&tI.revokeObjectURL(i.href)}):(i=y(t),n=Iy(b).call(b,null,i),r=function(){m(i)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=("undefined"==typeof document?"undefined":qh(document)))throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==qh(t.attrs)?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=o()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var i=g(e,t);return v(i,t),function(e){for(var n=[],r=0;r<i.length;r++){var a=i[r];(o=s[a.id]).refs--,n.push(o)}for(e&&v(g(e,t),t),r=0;r<n.length;r++){var o;if(0===(o=n[r]).refs){for(var l=0;l<o.parts.length;l++)o.parts[l]();delete s[o.id]}}}};var E,S=(E=[],function(e,t){return E[e]=t,Dy(E).call(E,Boolean).join("\n")});function _(e,t,i,n){var r=i?"":n.css;if(e.styleSheet)e.styleSheet.cssText=S(t,r);else{var a=document.createTextNode(r),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function b(e,t){var i=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}function A(e,t,i){var n=i.css,r=i.sourceMap,a=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||a)&&(n=f(n)),r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(bI(r))))+" */");var s=new Blob([n],{type:"text/css"}),o=e.href;e.href=tI.createObjectURL(s),o&&tI.revokeObjectURL(o)}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var i=t.protocol+"//"+t.host,n=i+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var r,a=WI(t).call(t).replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(a)?e:(r=0===zy(a).call(a,"//")?a:0===zy(a).call(a,"/")?i+a:n+a.replace(/^\.\//,""),"url("+bI(r)+")")}))}}])}(SH);var _H=i(SH.exports);var bH=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),(n=t.call(this,e)).set={speed:1,area:{},opacity:1,fonSize:"middle"},n}return MO(i,[{key:"afterCreate",value:function(){var e,t;"mobile"===FM.device?this.activeEvent="click":this.activeEvent="mouseenter",this.onStateChange=Iy(e=this.onStateChange).call(e,this),this.onToggle=Iy(t=this.onToggle).call(t,this),Iy(this).call(this,this.activeEvent,this.onToggle),Iy(this).call(this,"mouseleave",this.onToggle),this.appendChild(".xgplayer-panel-icon",(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg" viewBox="-5 -11 40 40" width="40" height="40">\n <path fill="#f85959" transform="scale(0.8 0.8)" d="M36.5,18.73a1.19,1.19,0,0,0,1-1.14V16.33a1.2,1.2,0,0,0-1-1.13l-.61-.08a1.75,1.75,0,0,1-1.3-.86l-.21-.36-.2-.36A1.72,1.72,0,0,1,34,12l.23-.58a1.18,1.18,0,0,0-.5-1.42l-1.1-.62a1.18,1.18,0,0,0-1.47.3l-.39.51a1.82,1.82,0,0,1-1.41.72c-.44,0-1.88-.27-2.22-.7l-.39-.49a1.18,1.18,0,0,0-1.48-.28l-1.09.64a1.19,1.19,0,0,0-.47,1.43l.25.59a1.87,1.87,0,0,1-.08,1.58c-.26.37-1.17,1.5-1.71,1.58l-.63.09a1.19,1.19,0,0,0-1,1.14l0,1.27a1.17,1.17,0,0,0,1,1.12l.61.08a1.74,1.74,0,0,1,1.3.87l.21.36.2.35A1.69,1.69,0,0,1,24,22.08l-.23.59a1.19,1.19,0,0,0,.5,1.42l1.1.62a1.19,1.19,0,0,0,1.48-.31l.38-.5a1.83,1.83,0,0,1,1.41-.72c.44,0,1.88.25,2.22.69l.39.49a1.18,1.18,0,0,0,1.48.28L33.86,24a1.19,1.19,0,0,0,.47-1.43L34.09,22a1.84,1.84,0,0,1,.07-1.58c.26-.37,1.17-1.5,1.72-1.58ZM31,18.94a2.76,2.76,0,0,1-4.65-1.2A2.71,2.71,0,0,1,27,15.13a2.76,2.76,0,0,1,4.64,1.2A2.7,2.7,0,0,1,31,18.94Z"/>\n <path fill="#f85959" transform="scale(0.8 0.8)" d="M32,0H3.59A3.59,3.59,0,0,0,0,3.59v17A3.59,3.59,0,0,0,3.59,24.2H19.72a12.59,12.59,0,0,1-.81-1.2A11.73,11.73,0,0,1,35.54,7.28V3.59A3.59,3.59,0,0,0,32,0ZM13,14.18H4.29a1.52,1.52,0,0,1,0-3H13a1.52,1.52,0,0,1,0,3ZM16.45,8H4.29a1.51,1.51,0,0,1,0-3H16.45a1.51,1.51,0,1,1,0,3Z"/>\n</svg>\n',"image/svg+xml").firstChild)}},{key:"onStateChange",value:function(e){this.config.onChangeSet&&this.config.onChangeSet(this.set)}},{key:"onToggle",value:function(e){e.preventDefault(),e.stopPropagation(),DM.hasClass(this.root,"slider-show")?DM.removeClass(this.root,"slider-show"):DM.addClass(this.root,"slider-show")}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.onStateChange)}},{key:"render",value:function(){return'\n <xg-icon class="xgplayer-panel">\n <xg-panel-icon class="xgplayer-panel-icon">\n </xg-panel-icon>\n <xg-panel-slider class="xgplayer-panel-slider">\n <xg-hidemode class="xgplayer-hidemode">\n <p class="xgplayer-hidemode-font">屏蔽类型</p>\n <ul class="xgplayer-hidemode-radio">\n <li class="xgplayer-hidemode-scroll" id="false">滚动</li><li class="xgplayer-hidemode-top" id="false">顶部</li><li class="xgplayer-hidemode-bottom" id="false">底部</li><li class="xgplayer-hidemode-color" id="false">色彩</li>\n </ul>\n </xg-hidemode>\n <xg-transparency class="xgplayer-transparency">\n <span>不透明度</span>\n <input class="xgplayer-transparency-line xgplayer-transparency-color xgplayer-transparency-bar xgplayer-transparency-gradient" type="range" min="0" max="100" step="0.1" value="50"></input>\n </xg-transparency>\n <xg-showarea class="xgplayer-showarea">\n <div class="xgplayer-showarea-name">显示区域</div>\n <div class="xgplayer-showarea-control">\n <div class="xgplayer-showarea-control-up">\n <span class="xgplayer-showarea-control-up-item xgplayer-showarea-onequarters">1/4</span>\n <span class="xgplayer-showarea-control-up-item xgplayer-showarea-twoquarters selected-color">1/2</span>\n <span class="xgplayer-showarea-control-up-item xgplayer-showarea-threequarters">3/4</span>\n <span class="xgplayer-showarea-control-up-item xgplayer-showarea-full">1</span>\n </div>\n <div class="xgplayer-showarea-control-down">\n <div class="xgplayer-showarea-control-down-dots">\n <span class="xgplayer-showarea-onequarters-dot"></span>\n <span class="xgplayer-showarea-twoquarters-dot"></span>\n <span class="xgplayer-showarea-threequarters-dot"></span>\n <span class="xgplayer-showarea-full-dot"></span>\n </div>\n <input class="xgplayer-showarea-line xgplayer-showarea-color xgplayer-showarea-bar xgplayer-gradient" type="range" min="1" max="4" step="1" value="1">\n </div>\n </div>\n </xg-showarea>\n <xg-danmuspeed class="xgplayer-danmuspeed">\n <div class="xgplayer-danmuspeed-name">弹幕速度</div>\n <div class="xgplayer-danmuspeed-control">\n <div class="xgplayer-danmuspeed-control-up">\n <span class="xgplayer-danmuspeed-control-up-item xgplayer-danmuspeed-small">慢</span>\n <span class="xgplayer-danmuspeed-control-up-item xgplayer-danmuspeed-middle selected-color">中</span>\n <span class="xgplayer-danmuspeed-control-up-item xgplayer-danmuspeed-large">快</span>\n </div>\n <div class="xgplayer-danmuspeed-control-down">\n <div class="xgplayer-danmuspeed-control-down-dots">\n <span class="xgplayer-danmuspeed-small-dot"></span>\n <span class="xgplayer-danmuspeed-middle-dot"></span>\n <span class="xgplayer-danmuspeed-large-dot"></span>\n </div>\n <input class="xgplayer-danmuspeed-line xgplayer-danmuspeed-color xgplayer-danmuspeed-bar xgplayer-gradient" type="range" min="50" max="150" step="50" value="100">\n </div>\n </div>\n </xg-danmuspeed>\n <xg-danmufont class="xgplayer-danmufont">\n <div class="xgplayer-danmufont-name">字体大小</div>\n <div class="xgplayer-danmufont-control">\n <div class="xgplayer-danmufont-control-up">\n <span class="xgplayer-danmufont-control-up-item xgplayer-danmufont-small">小</span>\n <span class="xgplayer-danmufont-control-up-item xgplayer-danmufont-middle">中</span>\n <span class="xgplayer-danmufont-control-up-item xgplayer-danmufont-large selected-color">大</span>\n </div>\n <div class="xgplayer-danmufont-control-down">\n <div class="xgplayer-danmufont-control-down-dots">\n <span class="xgplayer-danmufont-small-dot"></span>\n <span class="xgplayer-danmufont-middle-dot"></span>\n <span class="xgplayer-danmufont-large-dot"></span>\n </div>\n <input class="xgplayer-danmufont-line xgplayer-danmufont-color xgplayer-danmufont-bar xgplayer-gradient" type="range" min="20" max="30" step="5" value="25">\n </div>\n </div>\n </xg-danmufont>\n </xg-panel-slider>\n </xg-icon>'}}],[{key:"pluginName",get:function(){return"danmuPanel"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:11,onChangeSet:function(e){console.log("DanmuPanel:".concat(e))},speed:1,area:{},opacity:1,fonSize:"middle"}}}]),i}(pF),AH='<dk-switch class="danmu-switch">\n<span class="txt">弹</span>\n</dk-switch>',RH=function(e){FO(i,e);var t=VO(i);function i(){return PO(this,i),t.apply(this,arguments)}return MO(i,[{key:"afterCreate",value:function(){var e;this.initIcons(),this.onStateChange=Iy(e=this.onStateChange).call(e,this),Iy(this).call(this,["click","touchend"],this.onStateChange)}},{key:"registerIcons",value:function(){return{openDanmu:{icon:AH,class:"danmu-switch-open"},closeDanmu:{icon:AH,class:"danmu-switch-closed"}}}},{key:"switchState",value:function(e){e?this.setAttr("data-state","active"):this.setAttr("data-state","normal"),this.switchTips(e)}},{key:"initIcons",value:function(){var e=this.icons,t=$P(this).call(this,".xgplayer-icon");t.appendChild(e.openDanmu),t.appendChild(e.closeDanmu)}},{key:"switchTips",value:function(e){var t=$P(this).call(this,".xg-tips");t&&this.changeLangTextKey(t,e?"OFF":"OPEN")}},{key:"onStateChange",value:function(e){e.preventDefault(),e.stopPropagation();var t="active"===this.root.getAttribute("data-state");this.switchState(!t),this.config.onSwitch&&this.config.onSwitch(e,!t)}},{key:"destroy",value:function(){this.unbind(["click","touchend"],this.getMini)}},{key:"render",value:function(){return'\n <xg-icon class="danmu-icon">\n <div class="xgplayer-icon">\n </div>\n '.concat(nU(this,"OPEN",this.playerConfig.isHideTips),"\n </xg-icon>")}}],[{key:"pluginName",get:function(){return"danmuIcon"}},{key:"defaultConfig",get:function(){return{position:hF.CONTROLS_RIGHT,index:11,onSwitch:function(e,t){}}}}]),i}(pF),LH=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),(n=t.call(this,e)).danmujs=null,n.danmuPanel=null,n.isOpen=!1,n.seekCost=0,n.intervalId=0,n.isUseClose=!1,n}return MO(i,[{key:"afterCreate",value:function(){var e=this;this.playerConfig.isLive&&(this.config.isLive=!0),this.initDanmu(),this.registerExtIcons(),this.once(XM,(function(){e.config.defaultOpen&&!e.isUseClose&&e.start()})),this.on(jM,(function(){e.isOpen&&e.danmujs&&e.danmujs.pause()})),this.on(VM,(function(){e.isOpen&&e.danmujs&&e.danmujs.play()})),this.on(zM,(function(){e.seekCost=window.performance.now(),!e.config.isLive&&e.danmujs&&e.danmujs.stop()})),this.on(bN,(function(){e.resize()})),this.on(qM,(function(){if(e.danmujs&&e.isOpen){e.intervalId&&(DM.clearTimeout(e,e.intervalId),e.intervalId=null);var t=window.performance.now()-e.seekCost>300?100:300;e.intervalId=DM.setTimeout(e,(function(){e.danmujs.start(),e.intervalId=null,e.player.paused&&e.danmujs.pause()}),t)}}))}},{key:"onPluginsReady",value:function(){var e=this.player.plugins.pc;e&&(e.onVideoDblClick&&Iy(this).call(this,"dblclick",e.onVideoDblClick),e.onVideoClick&&Iy(this).call(this,"click",e.onVideoClick))}},{key:"initDanmu",value:function(){var e,t=this.player,i=this.config,n=this.config,r=n.channelSize,a=n.fontSize,s=n.opacity,o=n.mouseControl,l=n.mouseControlPause,u=n.area,c=n.defaultOff,h={container:this.root,player:t.media,comments:this.config.comments,live:i.isLive,defaultOff:c,area:u,mouseControl:o,mouseControlPause:l};i.ext&&ub(e=Cy(i.ext)).call(e,(function(e){h[e]=i.ext[e]}));var d=new _H(h);this.danmujs=d,t.danmu=d,this.setFontSize(a,r),this.setArea(u),this.resize(),1!==s&&this.setOpacity(s)}},{key:"registerExtIcons",value:function(){var e=this,t=this.player,i=this.config;if(i.panel&&t.controls){var n={config:{onChangeset:function(t){e.changeSet(t)}}};this.danmuPanel=t.controls.registerPlugin(bH,n,bH.pluginName)}var r=i.switchConfig;if(!i.closeDefaultBtn&&t.controls){var a,s={config:{onSwitch:function(t,i){e.onSwitch(t,i)}}};ub(a=Cy(r)).call(a,(function(e){s.config[e]=r[e]})),this.danmuButton=t.controls.registerPlugin(RH,s,RH.pluginName),this.config.defaultOpen&&this.danmuButton.switchState(!0)}}},{key:"changeSet",value:function(e){}},{key:"onSwitch",value:function(e,t){this.emitUserAction(e,"switch_danmu",{prop:"isOpen",from:!t,to:t}),t?this.start():this.stop()}},{key:"start",value:function(){var e=this;!this.isOpen&&this.danmujs&&(this.isUseClose=!1,this.show(),this.resize(),DM.setTimeout(this,(function(){e.danmujs.start(),e.player.paused&&e.danmujs.pause(),e.isOpen=!0}),0))}},{key:"stop",value:function(){this.isUseClose=!0,this.isOpen&&this.danmujs&&(this.danmujs.stop(),this.config.isLive&&this.clear(),this.isOpen=!1,this.hide())}},{key:"clear",value:function(){this.danmujs&&this.danmujs.clear()}},{key:"setCommentLike",value:function(e,t){this.danmujs&&this.danmujs.setCommentLike(e,t)}},{key:"setCommentDuration",value:function(e,t){this.danmujs&&this.danmujs.setCommentDuration(e,t)}},{key:"setAllDuration",value:function(e,t){this.danmujs&&this.danmujs.setAllDuration(e,t)}},{key:"setCommentID",value:function(e,t){this.danmujs&&this.danmujs.setCommentID(e,t)}},{key:"hideMode",value:function(e){this.danmujs&&this.danmujs.hide(e)}},{key:"showMode",value:function(e){this.danmujs&&this.danmujs.show(e)}},{key:"setArea",value:function(e){this.danmujs&&this.danmujs.setArea(e)}},{key:"setOpacity",value:function(e){this.danmujs&&this.danmujs.setOpacity(e)}},{key:"setFontSize",value:function(e,t){this.danmujs&&this.danmujs.setFontSize(e,t)}},{key:"resize",value:function(){this.danmujs&&this.danmujs.resize()}},{key:"sendComment",value:function(e){this.danmujs&&this.danmujs.sendComment(e)}},{key:"updateComments",value:function(e,t){this.danmujs&&this.danmujs.updateComments(e,t)}},{key:"hideIcon",value:function(){this.danmuButton&&this.danmuButton.hide()}},{key:"showIcon",value:function(){this.danmuButton&&this.danmuButton.show()}},{key:"destroy",value:function(){this.danmujs.stop(),this.danmujs.destroy(),this.danmujs=null,this.player.danmu=null;var e=this.danmuButton,t=this.danmuPanel;this.danmuButton&&this.danmuButton.root&&e.__destroy&&e.__destroy(),this.danmuPanel&&this.danmuPanel.root&&t.__destroy&&t.__destroy(),this.danmuButton=null,this.danmuPanel=null}},{key:"render",value:function(){return'<xg-danmu class="xgplayer-danmu">\n </xg-danmu>'}}],[{key:"pluginName",get:function(){return"danmu"}},{key:"defaultConfig",get:function(){return{comments:[],area:{start:0,end:1},closeDefaultBtn:!1,defaultOff:!1,panel:!1,panelConfig:{},switchConfig:{},defaultOpen:!0,isLive:!1,channelSize:24,fontSize:14,opacity:1,mouseControl:!1,mouseControlPause:!1,ext:{},style:{}}}}]),i}(pF);function IH(e,t){var i=Cy(e);if(wy){var n=wy(e);t&&(n=Dy(n).call(n,(function(t){return xy(e,t).enumerable}))),i.push.apply(i,n)}return i}function CH(e){for(var t=1;t<arguments.length;t++){var i,n,r=null!=arguments[t]?arguments[t]:{};t%2?Py(i=IH(Object(r),!0)).call(i,(function(t){OH(e,t,r[t])})):Oy?My(e,Oy(r)):Py(n=IH(Object(r))).call(n,(function(t){dy(e,t,xy(r,t))}))}return e}function wH(e){return(wH="function"==typeof _O&&"symbol"==typeof bO?function(e){return typeof e}:function(e){return e&&"function"==typeof _O&&e.constructor===_O&&e!==_O.prototype?"symbol":typeof e})(e)}function DH(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xH(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),dy(e,GH(n.key),n)}}function PH(e,t,i){return t&&xH(e.prototype,t),i&&xH(e,i),dy(e,"prototype",{writable:!1}),e}function OH(e,t,i){return(t=GH(t))in e?dy(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function MH(e){var t;return(MH=AO?Iy(t=RO).call(t):function(e){return e.__proto__||RO(e)})(e)}function NH(e,t){var i;return(NH=AO?Iy(i=AO).call(i):function(e,t){return e.__proto__=t,e})(e,t)}function FH(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function UH(e,t){if(t&&("object"===qh(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return FH(e)}function BH(e){var t=function(){if("undefined"==typeof Reflect||!LO)return!1;if(LO.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(LO(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=MH(e);if(t){var r=MH(this).constructor;i=LO(n,arguments,r)}else i=n.apply(this,arguments);return UH(this,i)}}function HH(){var e;"undefined"!=typeof Reflect&&IO?HH=Iy(e=IO).call(e):HH=function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=MH(e)););return e}(e,t);if(n){var r=xy(n,t);return r.get?r.get.call(arguments.length<3?e:i):r.value}};return HH.apply(this,arguments)}function GH(e){var t=function(e,t){if("object"!==qh(e)||null===e)return e;var i=e[hy];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==qh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===qh(t)?t:String(t)}var VH=/^WEBVTT/,KH=/^STYLE+$/,WH=/^\:\:cue/,jH=/^}+$/,YH=/^\[Script Info\].*/,zH=[/[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,3}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,3}:[0-9]{2}\.[0-9]{1,3}/,/[0-9]{1,2}\.[0-9]{1,3}-->[0-9]{1,2}\.[0-9]{1,3}/],qH=/^Format:\s/,XH=/^Style:\s/,QH=/^Dialogue:\s/;function $H(e){var t=e.length;return 3===t?(60*(60*Number(e[0])+Number(e[1]))*1e3+1e3*Number(e[2]))/1e3:2===t?(60*Number(e[0])*1e3+1e3*Number(e[1]))/1e3:Number(e[0])}function ZH(e){return/^(\-|\+)?\d+(\.\d+)?$/.test(e)}function JH(e,t){return e>=0&&e<t.length?t[e]:""}var eG=function(){function e(){DH(this,e)}return PH(e,null,[{key:"parseJson",value:function(e){for(var t=[],i=0,n=0;n<e.length;n++){if(i>=50&&(i=0),0===i){var r={start:e[n].start,list:[e[n]],end:e[n].end};t.push(r)}else t[t.length-1].list.push(e[n]),t[t.length-1].end=e[n].end;i++}return t}},{key:"parse",value:function(t,i){var n=e.checkFormat(t);n||i({format:n});try{var r=[];"ass"===n?r=e.parseASS(t):"vtt"===n&&(r=e.parseVTT(t)),i({format:n,list:r.list,styles:r.styles})}catch(GG){console.error(GG),i({format:n},GG)}}},{key:"parseASSItem",value:function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(","),i={},n="";try{var r=t.length-e.length;return n=(n=r>0?mw(t).call(t,e.length-1,r+1).join(",")+"":t[t.length-1]+"").replace(/\\n+/g,""),t[e.length-1]=n,ub(e).call(e,(function(e,n){"end"===e||"start"===e?i[e]=$H(t[n].split(":")):"text"===e?i[e]=[t[n]]:"layer"===e?(i[e]=[t[n]],i.textTag=[t[n]]):i[e]="style"===e?[t[n]]:Number(t[n])?Number(t[n]):t[n]})),i}catch(GG){return console.error(GG),{}}}},{key:"parseASS",value:function(t){for(var i=t.split("\n"),n=[],r=0,a=0,s=[],o=[],l=null;r<i.length;){if(qH.test(i[r]))o=i[r].replace(qH,"").replace(/\s+/g,"").split(","),o=ub(o).call(o,(function(e){return e.toLocaleLowerCase()}));else if(XH.test(i[r]))s.push(i[r].replace(XH,"").replace(/\s+/g,""));else if(QH.test(i[r])){var u=e.parseASSItem(i[r].replace(QH,""),o);if(l&&u.start===l.start&&u.end===l.end)try{var c=l,h=c.text,d=c.textTag,f=c.style;h.push(u.text[0]),d.push(u.textTag[0]),f.push(u.style[0])}catch(GG){console.error(GG)}else{l=u;var v=null;a%50==0?((v={start:l.start,end:l.end,list:[]}).list.push(l),n.push(v)):((v=n[n.length-1]).end=l.end,v.list.push(l)),a++}}r++}return{list:n,style:{}}}},{key:"parseVTTStyle",value:function(e,t){var i=e.split(":");if(i.length>1){var n,r,a=WI(n=i[0]).call(n).split("-"),s="";a.length>1?ub(a).call(a,(function(e,t){s+=0===t?e:e.charAt(0).toUpperCase()+iI(e).call(e,1)})):s=a[0],t[s]=WI(r=i[1]).call(r).replace(/;$/,"")}return t}},{key:"parseVTT",value:function(e){for(var t=(e=e.replace(VH,"")).split("\n"),i=[],n=0,r=0,a=null,s=!1,o=!1,l=null,u=null,c=[];n<t.length;){var h,d,f=WI(h=JH(n,t)).call(h);if(!f||s&&ZH(f))s=!f;else if(WH.test(f)&&KH.test(WI(d=JH(n-1,t)).call(d))){o=!0;var v=/\((.+?)\)/g.exec(f);u=v?v[1]:"",l=""}else if(o)jH.test(f)?(c.push({key:u,style:l}),l=null,u=null,o=!1):l+=f;else if(f){s=!1;var g=this.checkIsTime(t[n]);if(g){var p=this.parseVttTime(g);if(!a||p.start!==a.start||p.end!==a.end){(a=p).text=[],a.textTag=[];var m=null;r%50==0?((m={start:a.start,end:a.end,list:[]}).list.push(a),i.push(m)):((m=i[i.length-1]).end=a.end,m.list.push(a)),r++}}else if(a){var y=a,k=y.text,T=y.textTag,E=this.parseVttText(t[n]);k.push(E.text),T.push(E.tag)}s=!1}n++}return{list:i,styles:c}}},{key:"checkIsTime",value:function(e){e=e.replace(/\s+/g,"");for(var t=0,i=null;t<zH.length&&!(i=zH[t].exec(e));)t++;return i?i[0]:null}},{key:"parseVttText",value:function(e){var t=/^(<?.+?>)/g.exec(e),i="",n="default";if(t){var r;n=t[0].replace(/\<|\>|\&/g,"");var a=RegExp(Hy(r="^<".concat(n,">(([\\s\\S])*?)</")).call(r,n,">$")).exec(e);a?i=a[1]:(i=e,n="")}else i=e;for(var s=/<(\w+).(\w+)>/g,o=s.exec(i);o&&o.length>2;){var l;i=i.replace(o[0],Hy(l="<".concat(o[1],' class="')).call(l,o[2],'">')),o=s.exec(i)}return{tag:n,text:i.replace(/\\n+/g,"<br/>")}}},{key:"parseVttTime",value:function(e){var t,i=e.split("--\x3e"),n=0;if(2===i.length){var r=i[0].split(":"),a=i[1].split(":");t=$H(r),n=$H(a)}return{start:t,end:n,time:e}}},{key:"isVTT",value:function(e){return VH.test(e)}},{key:"isASS",value:function(e){return YH.test(e)}},{key:"checkFormat",value:function(e){return e?VH.test(e)?"vtt":YH.test(e)?"ass":null:null}}]),e}(),tG=[{code:0,msg:"SUCCESS"},{code:1,msg:"LOAD_ERROR"},{code:2,msg:"PARSER_ERROR"},{code:3,msg:"FORMAT_NOT_SUPPORTED"},{code:4,msg:"ID_OR_LANGUAGE_NOT_EXIST"},{code:5,msg:"PARAMETERS_ERROR"},{code:6,msg:"ABORT"},{code:7,msg:"UNKNOWN"},{code:8,msg:"DATA_ERROR:subtitle.url is null"},{code:9,msg:"DATA_ERROR:subtitle.url length is 0"}];function iG(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={code:tG[e].code,msg:tG[e].msg};return ub(t=Cy(i)).call(t,(function(e){n[e]=i[e]})),n}var nG=PH((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.url,n=t.method,r=void 0===n?"GET":n,a=t.type,s=void 0===a?"arraybuffer":a,o=t.timeout,l=void 0===o?1e4:o,u=t.data,c=void 0===u?{}:u,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return DH(this,e),new nb((function(e,t){var n,a=new window.XMLHttpRequest,o=r.toUpperCase(),u=[];if(s&&(a.responseType=s),l&&(a.timeout=l),Py(n=Cy(c)).call(n,(function(e){u.push("k=".concat(c[e]))})),a.onload=function(){200===a.status||206===a.status?e({context:h,res:a}):t(new Error({context:h,res:a,type:"error"}))},a.onerror=function(e){t(new Error({context:h,res:a,type:"error"}))},a.ontimeout=function(e){t(new Error({context:h,res:a,type:"error"}))},a.onabort=function(){t(new Error({context:h,res:a,type:"error"}))},"GET"===o)a.open(o,"".concat(i)),a.send();else{if("post"!==o)throw new Error("xhr ".concat(o," is not supported"));a.open(o,i),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send(u.join("&"))}}))})),rG=function(){function e(){var t,i;DH(this,e);var n=new nb((function(e,n){t=e,i=n}));return n.resolve=function(e){t(e),n.state="fulfilled"},n.reject=function(e){i(e),n.state="rejected",n.isBreak="DESTROYED"===e},n.state="pending",n}return PH(e,[{key:"resolve",value:function(e){}},{key:"reject",value:function(e){}}]),e}();function aG(e,t){if(!e)return!1;if(e.classList)return Yy(Array.prototype).call(e.classList,(function(e){return e===t}));var i=e.className&&"object"===wH(e.className)?e.getAttribute("class"):e.className;return i&&!!i.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function sG(e,t){var i;e&&(e.classList?Py(i=t.replace(/(^\s+|\s+$)/g,"").split(/\s+/g)).call(i,(function(t){t&&e.classList.add(t)})):aG(e,t)||(e.className&&"object"===wH(e.className)?e.setAttribute("class",e.getAttribute("class")+" "+t):e.className+=" "+t))}function oG(e,t,i){var n=t.length;if(n<1)return-1;if(t[i=i<0?0:i>=n?n-1:i].start<=e&&e<t[i].end)return i;for(var r=t[i].end<=e?i+1:0;r<n;r++){if(t[r].start<=e&&e<t[r].end)return r;if(e>t[r].end&&r+1<n&&e<t[r+1].start)return-1;if(e>t[r].end&&r+1>=n)return-1}return-1}function lG(e,t,i){var n=t.length;if(n<1)return[];var r=[];if((i=i<0?0:i>=n?n-1:i)<n)for(var a=t[i].end<=e?i:0;a<n&&(t[a].start<=e&&e<t[a].end&&r.push(a),!(e<t[a].start));a++);return r}function uG(e){return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0]}function cG(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=document.createElement(t);return a.className=r,a.innerHTML=i,Py(e=Cy(n)).call(e,(function(e){var i=e,r=n[e];"video"===t||"audio"===t||"live-video"===t?r&&a.setAttribute(i,r):a.setAttribute(i,r)})),a}function hG(e,t,i){if(i||(i=new rG),"json"===t){var n=eG.parseJson(e);i.resolve({list:n,format:"json"})}else"string"===t&&eG.parse(e,(function(e,t){if(t){var n=iG(2,t);i.reject(n,{format:e.format})}else if(e.format)i.resolve({styles:e.styles,list:e.list,format:e.format});else{var r=iG(3);i.reject(r)}}));return i}function dG(e,t){return t||(t=new rG),new nG({url:e.url,type:"text"}).then((function(i){hG(i.res.response,"string").then((function(i){t.resolve(CH(CH({},i),e))})).catch((function(e){t.reject(e)}))})).catch((function(i){var n=iG(1,CH({statusText:i.statusText,status:i.status,type:i.type,message:"http load error",url:e.src},e));t.reject(n)})),t}function fG(e,t){return!!(e.id&&t.id&&e.id===t.id||e.language&&t.language&&e.language===t.language)}function vG(e){return null!==e&&""!==WI(e).call(e)&&/^[a-zA-Z]+$/.test(e)}function gG(e){return!!/[\x21-\x2f\x3a-\x40\x5b-\x60\x7B-\x7F]/.test(e)}var pG=function(){function e(){var t=this;DH(this,e),this.__handlers=[],window.ResizeObserver&&(this.observer=new window.ResizeObserver((function(e){t.__trigger(e)})))}return PH(e,[{key:"addObserver",value:function(e,t){if(this.observer){this.observer&&this.observer.observe(e);for(var i=this.__handlers,n=-1,r=0;r<i.length;r++)i[r]&&e===i[r].target&&(n=r);n>-1?this.__handlers[n].handler.push(t):this.__handlers.push({target:e,handler:[t]})}}},{key:"unObserver",value:function(e){var t,i,n=-1;ub(t=this.__handlers).call(t,(function(t,i){e===t.target&&(n=i)})),this.observer&&this.observer.unobserve(e),n>-1&&mw(i=this.__handlers).call(i,n,1)}},{key:"destroyObserver",value:function(){this.observer&&this.observer.disconnect(),this.observer=null,this.__handlers=null}},{key:"__runHandler",value:function(e,t){for(var i=this.__handlers,n=0;n<i.length;n++)if(i[n]&&e===i[n].target){var r;i[n].handler&&Py(r=i[n].handler).call(r,(function(i){try{i(e,t)}catch(GG){console.error(GG)}}));break}}},{key:"__trigger",value:function(e){var t=this;ub(e).call(e,(function(e){var i=e.contentRect;t.__runHandler(e.target,i)}))}}]),e}(),mG=null;var yG="resize",kG="change",TG="off";function EG(e){var t=[];return e&&"String"===uG(e)?t.push({url:e,index:0,start:-1,end:-1}):"Array"===uG(e)&&Py(e).call(e,(function(e,i){t.push({url:e.url||e.src,index:i,start:e.start||-1,end:e.end||-1})})),t}var SG=!1,_G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=MI(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),dy(e,"prototype",{writable:!1}),t&&NH(e,t)}(i,e);var t=BH(i);function i(e){var n,r,a,s,o,l,u,c;return DH(this,i),OH(FH(r=t.call(this)),"_onPause",(function(){r.stopRender()})),OH(FH(r),"_onPlay",(function(){r._curRenderTask.length>0&&r.startRender(-1)})),OH(FH(r),"_onTimeupdate",(function(){if(r._isOpen){var e=r.player.video,t=e.videoWidth,i=e.videoHeight;!r._videoMeta.scale&&t&&i&&r._onResize(r.player.root);var n=r._getPlayerCurrentTime();Math.round(Math.abs(1e3*n-r._ctime))<200||(r._ctime=1e3*n,r.currentText&&r.currentText.list&&("live"===r.config.updateMode?r._liveUpdate(n):r._update(n)))}})),OH(FH(r),"_onResize",(function(e){var t=FH(r),i=t._videoMeta;if(t.config.domRender){if(e&&e instanceof window.Element||(e=r.player.root),r._iId&&(clearTimeout(r._iId),r._iId=null),!i.scale){if(!r.player.video)return;var n=r.player.video,a=n.videoWidth,s=n.videoHeight;if(!a||!s)return;i.videoWidth=a,i.videoHeight=s,i.scale=Zk(s/a*100,10)}r.__startResize(e)}})),OH(FH(r),"_onCoreEvents",(function(e){try{switch(e.eventName){case"core.subtitlesegments":r._onSubtitleSegment(e.list||[]);break;case"core.subtitleplaylist":r._onSubtitlePlaylist(e.list||[]);break;case"core.seipayloadtime":r._onCoreSeiintime(e)}}catch(t){console.error(t)}})),OH(FH(r),"startRender",(function(e){if(e>0&&r._renderIntervalId&&(window.cancelAnimationFrame(r._renderIntervalId),r._renderIntervalId=-1),r.textTrack){var t=FH(r)._curRenderTask;r._lastTimeStamp=(new Date).getTime();var i=[];Py(t).call(t,(function(t,n){var a=t.lastTime,s=t.wordList,o=t.interval,l=t.dom,u=t.ids;if(e<0||r._lastTimeStamp<0||r._lastTimeStamp-a>=o){var c=s.shift();c&&l.appendData(c),t.lastTime=r._lastTimeStamp}s.length<1&&i.push({index:n,ids:u})})),r._log(">>>>_renderByWords emptyArr",i.length,t.length),Py(i).call(i,(function(e){mw(t).call(t,e.index,1),r._log(">>>_renderByWords remove emptyArr",e.index,t.length)})),t.length>0&&(r._renderIntervalId=window.requestAnimationFrame(r.startRender))}})),OH(FH(r),"destroy",(function(){r.detachPlayer(),r.removeAllListeners(),r.player=null,r.textTrack=null,r._curRenderTask=[],r.stopRender()})),a=navigator.userAgent,s=/(?:Windows Phone)/.test(a),o=/(?:SymbianOS)/.test(a)||s,l=/(?:Android)/.test(a),u=/(?:Firefox)/.test(a),c=/(?:iPad|PlayBook)/.test(a)||l&&!/(?:Mobile)/.test(a)||u&&/(?:Tablet)/.test(a),SG=/(?:iPhone)/.test(a)&&!c||l||o||c,r.currentText=null,r.currentExtText=null,r.textTrack=[],r._cid=-1,r._gid=-1,r._cids=[],r._iId=null,r._iC=0,r.player=null,r.root=null,r.config={line:"double",bottom:0,mode:"stroke",defaultOpen:!1,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,fitVideo:!0,offsetBottom:2,fontColor:"#fff",domRender:!0,updateMode:"vod",renderMode:"",debugger:!1},r._ctime=0,r._loadingTrack={},ub(n=Cy(r.config)).call(n,(function(t){void 0!==e[t]&&null!==e[t]&&(r.config[t]=e[t])})),r._isOpen=r.config.defaultOpen||!1,r._videoMeta={scale:0,videoHeight:0,videoWidth:0,lwidth:0,lheight:0,vWidth:0,vHeight:0,vBottom:0,vLeft:0,marginBottom:0},e.subTitles&&"Array"===uG(e.subTitles)?(e.player&&r.attachPlayer(e.player),r.seiTime=0,r.lastSeiTime=0,r._curTexts=[],r._curRenderTask=[],r._renderIntervalId=-1,r._lastTimeStamp=-1,r.setSubTitles(e.subTitles,r.config.defaultOpen),r):UH(r)}return PH(i,[{key:"version",get:function(){return"3.0.21-rc.21"}},{key:"setSubTitles",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=this._isOpen||i;n&&this.innerRoot&&this.switchOff(),this.currentText=null,this.textTrack=[],Py(t).call(t,(function(t){var i,n={};ub(i=Cy(t)).call(i,(function(e){n[e]=t[e]})),n.url=EG(n.url),n.isDefault&&(e.currentText=n),e.textTrack.push(n)})),this._log("setSubTitles",r),r&&this.switch().catch((function(t){e._log("[switch]",t)})),this.currentText&&this._loadTrack(this.currentText).then((function(t){e.addStyles(t)})),this.emit("reset",{list:this.textTrack,isOpen:r})}},{key:"updateSubTitle",value:function(e){for(var t=this,i=-1,n=0;n<this.textTrack.length;n++)if(fG(e,this.textTrack[n])){i=n;break}if(this._log("updateSubTitle",i,e),i>-1){var r=fG(this.currentText,this.textTrack[i]);if(this._log("updateSubTitle","_isCurrent",r,"this.isOpen",this.isOpen,this.currentText),!r)return;var a=EG(e.url);this.isOpen?(Py(a).call(a,(function(e){t.textTrack[i].url.push(e)})),this._log("updateSubTitle _loadTrackUrls",this.textTrack[i]),this._loadTrackUrls(this.currentText,2)):this.textTrack[i].url=a}}},{key:"addStyles",value:function(e){var t=e.styles,i=e.format;t&&"vtt"===i&&(ub(t).call(t,(function(e){e.key||(e.key="xg-text-track-span")})),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i="";ub(e).call(e,(function(e){var n,r;i+=Hy(n=Hy(r=" ".concat(t," ")).call(r,e.key," {")).call(n,e.style,"}")}));var n=document.createElement("style"),r=document.head||document.getElementsByTagName("head")[0];if(n.type="text/css",n.id="ssss",n.styleSheet){var a=function(){try{n.styleSheet.cssText=i}catch(e){}};n.styleSheet.disabled?gC(a,10):a()}else{var s=document.createTextNode(i);n.appendChild(s)}r.appendChild(n)}(t,"xg-text-track"))}},{key:"attachPlayer",value:function(e){var t=this;if(this._log("attachPlayer"),e){this.player&&this.detachPlayer();var i,n,r=this.config,a=r.fontColor,s=r.mode,o=r.fitVideo,l=r.domRender;if(this.player=e,l){var u;if(this.root=document.createElement("xg-text-track"),this.root.className="xg-text-track",!this._isOpen&&sG(this.root,"text-track-hide"),!o&&sG(this.root,"text-track-no-fitvideo"),s&&sG(this.root,"text-track-".concat(s)),this.innerRoot=document.createElement("xg-text-track-inner"),this.root.appendChild(this.innerRoot),a&&(this.root.style.color=a),this.currentText)ub(u=["language","id","label"]).call(u,(function(e){t.root.setAttribute("data-".concat(e),t.currentText[e]||"")}));this.player.root.appendChild(this.root),i=e.root,n=this._onResize,mG||(mG=new pG),mG.addObserver(i,n)}this.player.on("destroy",this.destroy),this.player.on("timeupdate",this._onTimeupdate),this.player.on("pause",this._onPause),this.player.on("play",this._onPlay),this.player.on("core_event",this._onCoreEvents),this._isOpen&&this.switch().catch((function(e){t._log("[switch]",e)}))}}},{key:"detachPlayer",value:function(){var e,t,i=this.player,n=this.config;i&&(i.off("destroy",this.destroy),i.off("timeupdate",this._onTimeupdate),i.off("pause",this._onPause),i.off("play",this._onPlay),i.off("core_event",this._onCoreEvents),n.domRender&&(i.root&&(e=i.root,t=this._onResize,mG&&mG.unObserver(e,t),i.root.removeChild(this.root)),this.innerRoot=null,this.root=null),this.player=null)}},{key:"switch",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};return this._log("switch",t),this._loadingTrack=t,new nb((function(i,n){if(t.id||t.language)if(e.currentText&&fG(t,e.currentText))e._loadingTrack={},e._updateCurrent(e.currentText),e.switchOn(),i(iG(0));else{var r=null;e.__removeByTime(e._curTexts,0);for(var a=0;a<e.textTrack.length;a++)if(fG(t,e.textTrack[a])){r=e.textTrack[a];break}if(e._log("nextSubtitle",r),r)e._emitPlayerSwitch(e.currentText,r),r.list?(e._loadingTrack={},e._updateCurrent(r),e.switchOn(),i(iG(0))):(e._log("this._loadTrack",r),e._updateCurrent(r),e._loadTrack(r).then((function(t){if(e.addStyles(t),e._loadingTrack.id===r.id||e._loadingTrack.language===t.language)e._loadingTrack={},e._updateCurrent(t),e.switchOn(),i(iG(0));else{var a,s=iG(6,{message:Hy(a="check _loadingTrack fail id: ".concat(e._loadingTrack.id," nextSubtitle:")).call(a,t.id)});n(s)}})).catch((function(e){n(e)})));else{var s,o=iG(4,new Error(Hy(s="The is no subtitle with id:[{".concat(t.id,"}] or language:[")).call(s,t.language,"]")));n(o)}}else{if(e.currentText){e._loadingTrack={},e._updateCurrent(e.currentText),e.switchOn();var l=iG(0,{message:"switch default subtitle success"});return void i(l)}var u=iG(5,{message:"no default subtitle"});n(u)}}))}},{key:"switchExt",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};return new nb((function(i,n){if(t.id||t.language){for(var r=null,a=0;a<e.textTrack.length;a++)if(fG(t,e.textTrack[a])){r=e.textTrack[a];break}r&&!fG(r,e.currentText)&&e._loadTrack(r).then((function(t){e.currentExtText=t,i(iG(0))}))}else e.currentExtText=null,i(iG(0))}))}},{key:"switchOn",value:function(){this._log("switchOn"),this._isOpen=!0,this.show(),this.emit(kG,this.currentText)}},{key:"switchOff",value:function(){this._isOpen=!1,this.hide(),this.emit(TG)}},{key:"isOpen",get:function(){return this._isOpen}},{key:"_log",value:function(){if(this.config.debugger){for(var e,t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];(t=console).log.apply(t,Hy(e=["[xgSubtitle]"]).call(e,n))}}},{key:"_loadTrack",value:function(e){var t=this;this._log("_loadTrack",e.language,e);var i=new rG,n="",r="";if(e.json?(n="json",r=e.json):e.stringContent&&!e.url&&(n="string",r=e.stringContent),r)return hG(r,n).then((function(t){e.format=t.format,e.styles=t.styles,e.list=t.list,i.resolve(e)})).catch((function(e){i.reject(e)})),i;var a=e.url;return 0===a.length?(i.resolve(e),i):(dG(mw(a).call(a,0,1)[0]).then((function(n){e.format=n.format,e.styles=n.styles,e.list||(e.list=[]),t._pushList(e.list,n.list),a.length>1&&t._loadTrackUrls(e,2),i.resolve(e)})).catch((function(e){i.reject(e)})),i)}},{key:"_emitPlayerSwitch",value:function(e,t){e&&"live"===this.config.updateMode&&(e.list=[],e.url=[]);var i=CH({lang:t.language},t);this._log("emit subtile_switch ",t,i),this.player&&this.player.emit("switch_subtitle",i)}},{key:"_loadTrackUrls",value:function(e,t,i){var n,r,a=this,s=e.url.length,o=s>t?mw(n=e.url).call(n,0,t):mw(r=e.url).call(r,0,s),l=o.length;this._log("_loadTrackUrls",e.language,s,o.length,l),Py(o).call(o,(function(t,n){dG(CH(CH({},t),{},{index:n})).then((function(t){e.format=t.format,e.styles=t.format,e.list||(e.list=[]),a._pushList(e.list,t.list),l--})).catch((function(e){l--})).finally((function(t){0===l&&(i&&i.resolve(e),a._loadTrackUrls(e,2))}))}))}},{key:"_freshUrl",value:function(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{url:""},r=-1;(Py(t=e.url).call(t,(function(e,t){e.url===n.url&&(r=t)})),r>-1)&&mw(i=e.url).call(i,r,1)}},{key:"_pushList",value:function(e,t){var i=t[0].start,n=t[t.length-1].end;if(0===e.length||i>=e[e.length-1].end)Py(t).call(t,(function(t){e.push(t)}));else{for(var r=-1,a=0;a<e.length;a++)if(e[a].start>n){r=a;break}r>-1&&Py(t).call(t,(function(t,i){mw(e).call(e,r+i,0,t)}))}return e}},{key:"_updateCurrent",value:function(e){var t,i=this;(this.currentText=e,this.config.domRender&&this.root)&&(ub(t=["language","id","label"]).call(t,(function(e){i.root.setAttribute("data-".concat(e),i.currentText[e]||"")})),this.__remove(this._cids));this._cids=[],this._gid=-1,this._cid=-1,this._curTexts=[];var n=this._getPlayerCurrentTime();n&&("live"===this.config.updateMode?this._liveUpdate(n):this._update(n))}},{key:"__loadAll",value:function(){var e,t=this;Py(e=this.textTrack).call(e,(function(e){t._loadTrack(e)}))}},{key:"getDelCid",value:function(e,t){for(var i=[],n=0;n<e.length;n++)bP(t).call(t,e[n])||i.push(e[n]);return i}},{key:"getNewCid",value:function(e,t){for(var i=[],n=0;n<t.length;n++)bP(e).call(e,t[n])||i.push(t[n]);return i}},{key:"_liveUpdate",value:function(e){var t=this;if(this.currentText&&this.currentText.list&&this.currentText.list.length){var i=[],n=oG(e,this.currentText.list,this._gid);if(n>-1&&(i=lG(e,this.currentText.list[n].list,this._cid)),this.__removeByTime(this._curTexts,e),this._log("_liveUpdate",e,n,i,this.currentText.list[0].list[0].start,this.currentText.list[0].list[0].end),i.length>0){var r=function(e,t,i){if(0===e.length||t<0||t>e.length-1)return[];var n=e[t].list;if(0===i.length)return[];var r=mw(n).call(n,i[0],i.length);return t>0&&mw(e).call(e,0,t),0===n.length&&mw(e).call(e,0,1),r}(this.currentText.list,n,i),a=this._curTexts.length,s=a>0?this._curTexts[a-1].index:0;Py(r).call(r,(function(e,i){e.index=i+s,t._curTexts.push(e)})),this.__render(r)}this.emit("update",this._curTexts)}}},{key:"_update",value:function(e){var t=this;if(this.currentText&&this.currentText.list&&this.currentText.list.length){var i=oG(e,this.currentText.list,this._gid),n=[];if(i>-1&&(n=lG(e,this.currentText.list[i].list,this._cid)),n.length<1)return this._cids.length>0&&this.config.domRender&&this.__remove(this._cids),void(this._cids=[]);if(this._cids!==n||i!==this._gid){this._gid=i,this._cid=n[0];var r=this.getDelCid(this._cids,n),a=this.getNewCid(this._cids,n);this._cids=n,this.config.domRender&&this.__remove(r);var s=[];ub(a).call(a,(function(e){var n=t.currentText.list[i].list[e];n.index=e,s.push(n)})),this.currentExtText&&ub(a).call(a,(function(e){var n=t.currentText.list[i].list[e];n.index=e,s.push(n)})),this._log("update",s,e),this.emit("update",s),this.__render(s,e)}}}},{key:"_getPlayerCurrentTime",value:function(){if(!this.player)return 0;var e=this.player.currentTime;return Zk(1e3*e+1e3*this.seiTime-1e3*this.lastSeiTime,10)/1e3}},{key:"_onSubtitlePlaylist",value:function(e){this._log("_onSubtitlePlaylist",e);var t=ub(e).call(e,(function(e){return{label:e.name,language:e.lang,id:e.id,isDefault:e.default,url:[],mUrl:e.url}}));this.setSubTitles(t)}},{key:"_onSubtitleSegment",value:function(e){if(this._log("_onSubtitleSegment",e.length,e[0].lang,e[0].sn,e[e.length-1].sn,e[0].start,e[e.length-1].end),e&&0!==e.length){var t={language:e[0].lang,url:ub(e).call(e,(function(e){return{id:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end}}))};fG(t,this.currentText)&&this.updateSubTitle(t)}}},{key:"_onCoreSeiintime",value:function(e){try{var t=e.time/1e3;this._log("_onCoreSeiintime sei",t,this.seiTime,this.lastSeiTime),this.seiTime=t,this.lastSeiTime=this.player?this.player.currentTime:0}catch(i){}}},{key:"resize",value:function(e,t){var i,n,r=this,a=this.config,s=a.baseSizeX,o=a.baseSizeY,l=a.minMobileSize,u=a.minSize,c=a.fitVideo,h=a.offsetBottom,d=this._videoMeta.scale;this._videoMeta.lwidth=e,this._videoMeta.lheight=t;var f=0;t/e*100>=d?(f=Zk(d*e,10)/100,n=e):(f=t,n=Zk(t/d*100,10)),this._videoMeta.vWidth=n,this._videoMeta.vHeight=f;var v=0,g=0;g=Zk(d>120?(v=o)*f/1080:(v=s)*n/1920,10);var p=SG?l:u,m={fontSize:g=g<p?p:g>v?v:g},y=Zk((t-f)/2,10),k=Zk((e-n)/2,10),T=Zk(f*h,10)/100;this._videoMeta.vBottom=y,this._videoMeta.vLeft=k,this._videoMeta.marginBottom=T,c&&(m.bottom=y+T,m.left=m.right=k),ub(i=Cy(m)).call(i,(function(e){r.root.style[e]="".concat(m[e],"px")})),this.emit(yG,{vLeft:k,vBottom:y,marginBottom:T,vWidth:n,vHeight:f,fontSize:g,scale:d})}},{key:"__startResize",value:function(e){var t=this,i=e.getBoundingClientRect(),n=this._videoMeta,r=i.width,a=i.height;if(this._iId&&(clearTimeout(this._iId),this._iId=null),r>0&&a>0&&(r!==n.lwidth||a!==n.lheight))this._iC=0,this.resize(r,a);else{if(this._iC>=5)return void(this._iC=0);this._iC++,this._iId=gC((function(){t.__startResize(e)}),50)}}},{key:"__removeByTime",value:function(e,t){for(var i=[],n=0;n<e.length;n++)(!t||e[n].end<t)&&i.push(n);0!==i.length&&(mw(e).call(e,i[0],i.length),this.config.domRender&&this.__remove(i))}},{key:"__remove",value:function(e){var t=this;if(e&&!(e.length<1)){this._log(">>>>_renderByWords__remove",e);for(var i=this.innerRoot.children,n=[],r=0;r<i.length;r++){var a=Number(i[r].getAttribute("data-index"));bP(e).call(e,a)&&n.push(i[r])}ub(n).call(n,(function(e){t.innerRoot.removeChild(e)}))}}},{key:"__render",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._log("__render",t.length,this.config.domRender);var i=this.config,n=i.renderMode,r=i.domRender;t.length>0&&r&&Py(t).call(t,(function(t){var i,r="text-track-".concat(e.config.line);Py(i=t.text).call(i,(function(i,a){a>0&&(r+=" text-track-deputy");var s={"data-start":t.start,"data-end":t.end,"data-index":t.index},o=cG("xg-text-track-span","",s,r);if(e.innerRoot.appendChild(o),"step"===n){var l=cG("xg-text-track-span","",s,"".concat(r," text-track-space"));e.innerRoot.appendChild(l),l.innerHTML=i,gC((function(){e._renderByWords(o,a,t.start,t.end,i)}),600)}else o.innerHTML=i}))}))}},{key:"_renderByWords",value:function(e,t,i,n,r){var a=document.createTextNode("");e.appendChild(a);var s=function(e){for(var t=e.split(""),i=[],n=!1,r=0;r<t.length;r++){var a=t[r];if(vG(a))if(n){var s,o=i.length-1;i[o]=Hy(s="".concat(i[o])).call(s,a)}else i.push(a),n=!0;else if(a.match(/^[ ]*$/)||gG(a)||/[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/.test(a)){var l;n=!1;var u=i.length-1;i[u]=Hy(l="".concat(i[u])).call(l,a)}else n=!1,i.push(a)}return i}(r),o=this._getPlayerCurrentTime(),l=Zk(1e3*(n-o),10);if(!(o>=n)){i>=o&&(o=i),l>300&&(l-=50);var u={dom:a,ids:t,wordList:s,interval:l/s.length,start:o,end:n,duration:l,lastTime:0};this._log(">>>>_renderByWords",l,u);for(var c=this._curRenderTask,h=-1,d=0;d<c.length;d++)if(c[d].ids===t){h=d;break}h>-1&&iI(c).call(c,h,1),c.push(u),this.startRender(-1)}}},{key:"stopRender",value:function(){this._renderIntervalId&&window.cancelAnimationFrame(this._renderIntervalId)}},{key:"show",value:function(){this.config.domRender&&function(e,t){var i;if(e)if(e.classList)Py(i=t.split(/\s+/g)).call(i,(function(t){e.classList.remove(t)}));else if(aG(e,t)){var n;Py(n=t.split(/\s+/g)).call(n,(function(t){var i=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className&&"object"===wH(e.className)?e.setAttribute("class",e.getAttribute("class").replace(i," ")):e.className=e.className.replace(i," ")}))}}(this.root,"text-track-hide")}},{key:"hide",value:function(){this.config.domRender&&(sG(this.root,"text-track-hide"),this.innerRoot.innerHTML="")}},{key:"emit",value:function(e,t){for(var n,r,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(r=HH(MH(i.prototype),"emit",this)).call.apply(r,Hy(n=[this,e,t]).call(n,s))}},{key:"on",value:function(e,t){for(var n,r,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(r=HH(MH(i.prototype),"on",this)).call.apply(r,Hy(n=[this,e,t]).call(n,s))}},{key:"once",value:function(e,t){for(var n,r,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(r=HH(MH(i.prototype),"once",this)).call.apply(r,Hy(n=[this,e,t]).call(n,s))}},{key:"off",value:function(e,t){for(var n,r,a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];(r=HH(MH(i.prototype),"off",this)).call.apply(r,Hy(n=[this,e,t]).call(n,s))}},{key:"offAll",value:function(){HH(MH(i.prototype),"removeAllListeners",this).call(this)}},{key:"marginBottom",get:function(){var e=this._videoMeta,t=e.bottom,i=e.marginBottom;return this.config.fitVideo?t+i:i}}]),i}(XO),bG=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),NO(HO(n=t.call(this)),"_onChange",(function(e){var t=n._media.textTracks;if(t&&0!==t.length){for(var i=[],r=[],a=-1,s=0;s<t.length;s++){var o=t[s];"subtitles"===o.kind&&(i.push({id:o.id||o.language,language:o.language,text:o.label,isDefault:"showing"===o.mode}),-1===a&&"showing"===o.mode&&(a=s),r.push(o.language))}r.join("|")!==n._languages?(n._languages=r.join("|"),n.emit("reset",{list:i,isOpen:a>-1})):-1===a?n.emit("off"):n.curIndex!==a&&n.emit("change",i[a]),n.curIndex=a}})),n._media=e,n._list=[],n._languages="",n.curIndex=-1,n._init(),n}return MO(i,[{key:"_init",value:function(){this._media.textTracks.addEventListener("change",this._onChange)}},{key:"switch",value:function(e){for(var t=this._media.textTracks,i=0;i<t.length;i++){var n=t[i];n.language===e.language?n.mode="showing":"showing"===n.mode&&(n.mode="disabled")}}},{key:"switchOff",value:function(){for(var e=this._media.textTracks,t=0;t<e.length;t++)e[t].mode="disabled";this.curIndex=-1}},{key:"destroy",value:function(){this._media.textTracks.removeEventListener("change",this._onChange),this._media=null,this._list=[],this._languages="",this.curIndex=-1}}]),i}(XO),AG="close",RG="text-close";function LG(e){var t=-1;return Py(e).call(e,(function(e,i){e.id||e.language||(e.id=i),e.id=String(e.id),!e.url&&(e.url=e.src),!e.text&&(e.text=e.label),!e.language&&(e.language=e.srclang),void 0===e.isDefault&&(e.isDefault=e.default||!1),(e.isDefault||e.default)&&(t<0?t=i:e.isDefault=e.default=!1)})),t}var IG=function(e){FO(i,e);var t=VO(i);function i(){var e,n;PO(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return NO(HO(n=t.call.apply(t,Hy(e=[this]).call(e,a))),"_onOff",(function(){n.switchOffSubtitle()})),NO(HO(n),"_onChange",(function(e){var t=n.getSubTitleIndex(n.config.list,e);t<0||n.updateCurItem(t,e)})),NO(HO(n),"_onListReset",(function(e){n.updateList(e)})),NO(HO(n),"clickSwitch",(function(e,t){var i=t.type===AG||t.type===RG;n.subTitles&&(i?n.subTitles.switchOff():n.switchSubTitle({language:t.language,id:t.id}))})),NO(HO(n),"onIconClick",(function(e){n.curItem?n.subTitles.switchOff():n.switchOnSubtitle(e)})),NO(HO(n),"onPlayerFocus",(function(e){n.subTitles&&n.config.style.follow&&n.rePosition()})),NO(HO(n),"onPlayerBlur",(function(e){n.subTitles&&n.config.style.follow&&!n.playerConfig.marginControls&&n.subTitles.root&&(n.subTitles.root.style.transform="translate(0, 0)")})),n}return MO(i,[{key:"beforeCreate",value:function(e){var t=e.player.config.texttrack||e.player.config.textTrack;"Array"===DM.typeOf(t)&&(e.config.list=t)}},{key:"afterCreate",value:function(){var e=this.config,t=e.list,n=e.mode,r=LG(t);KO(UO(i.prototype),"afterCreate",this).call(this),this.curIndex=-1,this.lastIndex=-1,this.curItem=null,this._nativeTracks=null,this.handlerClickSwitch=this.hook("subtitle_change",this.clickSwitch),"native"===n?this._initNativeSubtitle():this._initExtSubTitle(r)}},{key:"_initNativeSubtitle",value:function(){var e=this.player;e._subTitles||(e._subTitles=new bG(e.media)),this.subTitles=e._subTitles,this.subTitles.on("off",this._onOff),this.subTitles.on("change",this._onChange),this.subTitles.on("reset",this._onListReset)}},{key:"_initExtSubTitle",value:function(e){var t,i=this.config,n=i.list,r=i.style,a=i.isDefaultOpen,s=i.updateMode,o=i.renderMode;a&&e<0&&n.length>0&&(e=0,n[0].isDefault=!0);var l={subTitles:n,defaultOpen:a,updateMode:s,renderMode:o,debugger:this.config.debugger};ub(t=Cy(r)).call(t,(function(e){l[e]=r[e]})),!this.playerConfig.marginControls&&this.player.controls.root&&(this.on(aN,this.onPlayerFocus),this.on(sN,this.onPlayerBlur));var u=this.player;u._subTitles?u._subTitles._isOpen&&(e=this.getSubTitleIndex(this.config.list,u._subTitles.currentText)):(u._subTitles=new _G(l),u._subTitles.attachPlayer(this.player)),this.subTitles=u._subTitles,this.subTitles.on("off",this._onOff),this.subTitles.on("change",this._onChange),this.subTitles.on("reset",this._onListReset),r.follow&&this.subTitles.root&&DM.addClass(this.subTitles.root,"follow-control"),this._renderList(n,a,e)}},{key:"_renderList",value:function(e,t,i){e&&0!==e.length&&(t?(e[i=i<0?0:i].isDefault=!0,this.curIndex=i,this.curItem=e[i],this.switchIconState(!0)):this.switchIconState(!1),this.player.isCanplay&&e.length>0&&(this.renderItemList(e),this.show()))}},{key:"registerIcons",value:function(){return{textTrackOpen:{icon:"",class:"xg-texttrak-open"},textTrackClose:{icon:"",class:"xg-texttrak-close"}}}},{key:"show",value:function(e){!this.config.list||this.config.list.length<1||DM.addClass(this.root,"show")}},{key:"getSubTitleIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{id:"",language:""},i=-1;return t&&(t.id||t.language)?(Py(e).call(e,(function(e,n){var r,a,s,o;r=e,a=t,s=DM.isNotNull(r.id)&&DM.isNotNull(a.id)&&r.id===a.id,o=DM.isNotNull(r.language)&&DM.isNotNull(a.language)&&r.language===a.language,(s||o)&&(i=n)})),i):i}},{key:"updateSubtitles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&(this.updateList({list:e}),this.subTitles&&this.subTitles.setSubTitles(this.config.list,this.curIndex>-1,t))}},{key:"updateList",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.list){var i=[];Py(e=t.list).call(e,(function(e){i.push(e)}));var n=LG(i);t.isOpen?(this.curIndex=n,this.curItem=n>-1?i[n]:null):(this.curIndex=-1,this.curItem=null),this.config.list=i,i.length>0?this.show():(this.switchOffSubtitle(),this.hide()),this.renderItemList()}}},{key:"switchSubTitle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:"",language:""};this.switchIconState(!0),this.getSubTitleIndex(this.config.list,e)<0||this.subTitles.switch(e).catch((function(e){}))}},{key:"switchOffSubtitle",value:function(e){this.emit("subtitle_change",{off:!0,isListUpdate:!1,list:[]}),this.lastIndex=this.curIndex,this.curIndex=-1,this.curItem=null,this.switchIconState(!1),this.renderItemList()}},{key:"switchOnSubtitle",value:function(){var e=this.config.list[this.lastIndex>-1?this.lastIndex:0];this.switchIconState(!0),this.switchSubTitle(e)}},{key:"switchIconState",value:function(e){this.setAttr("data-state",e?"open":"close")}},{key:"onItemClick",value:function(e,t){var n=e.delegateTarget,r=n.getAttribute("language"),a=n.getAttribute("data-id"),s=n.getAttribute("data-type");KO(UO(i.prototype),"onItemClick",this).apply(this,arguments),this.handlerClickSwitch(e,{language:r,id:a,type:s})}},{key:"changeCurrentText",value:function(){if(!this.isIcons){var e=this.config,t=e.list,i=e.closeText,n=this.curIndex;if(n-1<0)$P(this).call(this,".icon-text").innerHTML=this.getTextByLang(i,"iconText");else if(n-1<t.length){var r=t[n-1];if(!r)return;$P(this).call(this,".icon-text").innerHTML=this.getTextByLang(r,"iconText")}}}},{key:"updateCurItem",value:function(e,t){this.curIndex=e,this.curItem=this.config.list[e-1],this.renderItemList(),this.emit("subtitle_change",DO({off:!1,isListUpdate:!1,list:[]},t))}},{key:"renderItemList",value:function(){var e=this,t=this.config,n=t.list,r=t.closeText,a=t.needCloseText,s=[],o=this.curIndex,l=this.curIndex;a&&(s.push({showText:this.getTextByLang(r),"data-type":RG,selected:-1===this.curIndex}),o++),ub(n).call(n,(function(t,i){var n={language:t.language||t.srclang||"","data-id":t.id||""};n.selected=e.curIndex===i,n.showText=e.getTextByLang(t),s.push(n)})),KO(UO(i.prototype),"renderItemList",this).call(this,s,o),this.curIndex=l,this.curItem=n[l]}},{key:"rePosition",value:function(){var e=this.config.style.fitVideo,t=0-this.player.controls.root.getBoundingClientRect().height;if(e){var i=this.player,n=i.video,r=i.root.getBoundingClientRect(),a=r.height,s=r.width,o=n.videoHeight,l=n.videoWidth,u=Zk(o/l*100,10)*s/100;u>a&&(u=a);var c=(a-u)/2-t;c<0&&(this.subTitles.root.style.transform="translate(0, ".concat(c,"px)"))}else this.subTitles.root.style.transform="translate(0, ".concat(t,"px)")}},{key:"destroy",value:function(){this.subTitles&&(this.subTitles.destroy(),this.subTitles=null),KO(UO(i.prototype),"destroy",this).call(this)}}],[{key:"pluginName",get:function(){return"texttrack"}},{key:"defaultConfig",get:function(){return DO(DO({},BB.defaultConfig),{},{position:hF.CONTROLS_RIGHT,index:6,list:[],isDefaultOpen:!0,style:{follow:!0,mode:"stroke",followBottom:50,fitVideo:!0,offsetBottom:2,baseSizeX:49,baseSizeY:28,minSize:16,minMobileSize:13,line:"double",fontColor:"#fff"},closeText:{text:"不开启",iconText:"字幕"},needCloseText:!0,className:"xgplayer-texttrack",hidePortrait:!1,isShowIcon:!0,renderMode:"normal",mode:"external",debugger:!1})}}]),i}(BB),CG=Qe,wG=Fi,DG=Vi,xG=function(e){for(var t=CG(this),i=DG(t),n=arguments.length,r=wG(n>1?arguments[1]:void 0,i),a=n>2?arguments[2]:void 0,s=void 0===a?i:wG(a,i);s>r;)t[r++]=e;return t};Ci({target:"Array",proto:!0},{fill:xG});var PG=Qo("Array").fill,OG=le,MG=PG,NG=Array.prototype,FG=i((function(e){var t=e.fill;return e===NG||OG(NG,e)&&t===NG.fill?MG:t})),UG=function(e){FO(i,e);var t=VO(i);function i(e){var n;return PO(this,i),(n=t.call(this,e)).canvasHeight=0,n.canvasWidth=0,n.width=0,n.height=0,n.dataFloatLen=2,n.xData=[],n.yData=[],n.yMax=0,n._duration=0,n.curData=[],n}return MO(i,[{key:"afterPlayerInit",value:function(){this.root||(this.createRoot(),this.reset())}},{key:"afterCreate",value:function(){var e=this;this.on(bN,(function(){e.resize()})),this.on(ZM,(function(){e._duration=e.player.duration,e.reset()}))}},{key:"setConfig",value:function(e){var t,i=this;Py(t=Cy(e)).call(t,(function(t){i.config[t]=e[t]})),this.reset()}},{key:"reset",value:function(){var e=this.config.data;this.setData(e),this.resize()}},{key:"createRoot",value:function(){if(!this.root){var e=this.config.mode,t=this.player.plugins.progress.root,i="activeShow"===e?"xg-heatmap-active-show":"xg-heatmap-normal",n=DM.createDom("div","",{},"xg-heatmap ".concat(i)),r=t.children.length>0?t.children[0]:null;t.insertBefore(n,r),this.root=n;var a=DM.createDom("canvas","",{},"xg-heatmap-canvas");this.root.appendChild(a),this.root.style.height="".concat(this.config.height,"px"),this.canvas=a}}},{key:"resize",value:function(){var e=this.config.dpi,t=this.root.getBoundingClientRect(),i=t.width,n=t.height;i===this.width&&n*e===this.height||(this.width=i,this.height=n,this.canvas.width=this.canvasWidth=i*e,this.canvas.height=this.canvasHeight=n*e,this.yMax=0,this.curData.length&&(this.setData(),this.drawLinePath()))}},{key:"formatData",value:function(e,t,i){var n=[];if(e.length<1)return n;var r=Zk(1e3*t,10);if("Object"===DM.typeOf(e[0])&&void 0!==e[0].time){if(!r)return n;var a=1,s=0;Py(e).call(e,(function(e){var t=Zk(1e3*e.time,10);s&&(a<0||e.time-s<a)&&(a=e.time-s),s=e.time,n.push(DO(DO({},e),{},{percent:t/r}))}));var o=n[0].time;if(o>0){var l=o-a>0?[o-a,0]:[0];Py(l).call(l,(function(e){var t=Zk(1e3*e,10);n.unshift({time:e,score:i,percent:t/r})}))}var u,c=n[n.length-1];if(t-c.time>a)Py(u=[c.time+a,t]).call(u,(function(e){var t=Zk(1e3*e,10);n.push({time:e,score:i,percent:t/r})}))}else Py(e).call(e,(function(e){n.push(e)}));return n}},{key:"_getX",value:function(e,t,i,n){return void 0!==i.percent?this.fixFloat(n*i.percent,this.dataFloatLen):this.fixFloat((e-1)*t,this.dataFloatLen)}},{key:"_getY",value:function(e,t,i){var n=this.config,r=n.maxValue,a=n.minValue,s=a;return s=void 0!==e.score?e.score:e,s=Math.min(s,r),s=Math.max(s,a),s=1-(s/=t),s=this.fixFloat(s*i,this.dataFloatLen)}},{key:"setData",value:function(e){var t=this.config,i=t.maxValue,n=t.minValue,r=t.maxLength;if(e&&e.length&&(this.curData=this.formatData(e,this._duration,n)),!((e=this.curData).length<1)){this.xData=[],this.yData=[],this.yMax=0;var a=i-n,s=this.canvasHeight,o=e.length,l=o>r?this.fixFloat(o/r,this.dataFloatLen):1;o=Zk(o/l);var u=this.canvasWidth/(o-1);if(u=this.fixFloat(u,this.dataFloatLen),!vO(u))for(var c=Zk(this.fixFloat(l-1,0)),h=0;h<o;){var d=this._getX(h,u,e[c],this.canvasWidth);this.xData.push(d);var f=this._getY(e[c],a,s);this.yMax=Math.max(this.yMax,s-f),this.yData.push(f),h++,c=Zk(this.fixFloat(h*l,0))}}}},{key:"_getFillStyle",value:function(e){var t=this.config,i=t.gradient,n=t.gradientColors,r=t.fillStyle;if(i&&4===i.length){var a=e.createLinearGradient(i[0],i[1],i[2],i[3]);n.length<2?console.warn(this.pluginName,"渐变颜色配置gradientColors异常"):(Py(n).call(n,(function(e){a.addColorStop(e.start,e.color)})),r=a)}return r}},{key:"drawLinePath",value:function(){this.clearCanvas();var e,t,i=this.canvas.getContext("2d"),n=this.xData,r=this.yData,a=0,s=this.config,o=s.lineWidth,l=s.alpha,u=s.strokeStyle,c=this._getFillStyle(i);for(i.beginPath(),i.lineWidth=o,i.globalAlpha=l,i.strokeStyle=u||c,i.fillStyle=c,i.moveTo(0,this.canvasHeight),e=n[a],t=r[a];void 0!==e&&void 0!==t;)i.lineTo(e,t),e=n[++a],t=r[a];i.lineTo(this.canvasWidth,this.canvasHeight),i.closePath(),i.stroke(),FG(i).call(i)}},{key:"clearCanvas",value:function(){this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight}},{key:"fixFloat",value:function(e,t){return"number"==typeof e?Tb(e.toFixed(t)):NaN}},{key:"render",value:function(){return""}}],[{key:"pluginName",get:function(){return"heatmap"}},{key:"defaultConfig",get:function(){return{lineWidth:0,dpi:2,alpha:.7,gradient:[],gradientColors:[],strokeStyle:"",fillColor:"#FA1F41",height:20,data:[],maxValue:100,minValue:0,maxLength:400,mode:"activeShow"}}}]),i}(pF);(function(e,t){var i,n,r,a=iy||function(e){return"number"==typeof e&&isFinite(e)},s=uy||function(e){return"number"==typeof e&&Math.abs(e)<=o},o=cy||9007199254740991,l=((r={}).NETWORK_ERROR="networkError",r.MEDIA_ERROR="mediaError",r.KEY_SYSTEM_ERROR="keySystemError",r.MUX_ERROR="muxError",r.OTHER_ERROR="otherError",r),u=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}({}),c=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}({}),h="manifest",d="level",f="audioTrack",v="subtitleTrack",g={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},p=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;Zm(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_=i,this.totalWeight_=n}return ey(e,[{key:"sample",value:function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*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}(),m=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;Zm(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 p(t),this.fast_=new p(i),this.defaultTTFB_=r,this.ttfb_=new p(t)}return ey(e,[{key:"update",value:function(e,t){var i=this.slow_,n=this.fast_,r=this.ttfb_;i.halfLife!==e&&(this.slow_=new p(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new p(t,n.getEstimate(),n.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new p(e,r.getEstimate(),r.getTotalWeight()))}},{key:"sample",value:function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,n=8*t/i;this.fast_.sample(i,n),this.slow_.sample(i,n)}},{key:"sampleTTFB",value:function(e){var t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,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 y(e,t,i){return n=function(e,t){if("object"!=qh(e)||!e)return e;var i=e[hy];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=qh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==qh(n)?n:n+"")in e?dy(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e;var n}function k(){var e;return k=Ly?Iy(e=Ly).call(e):function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},k.apply(null,arguments)}function T(e,t){var i=Cy(e);if(wy){var n=wy(e);t&&(n=Dy(n).call(n,(function(t){return xy(e,t).enumerable}))),i.push.apply(i,n)}return i}function E(e){for(var t=1;t<arguments.length;t++){var i,n,r=null!=arguments[t]?arguments[t]:{};t%2?Py(i=T(Object(r),!0)).call(i,(function(t){y(e,t,r[t])})):Oy?My(e,Oy(r)):Py(n=T(Object(r))).call(n,(function(t){dy(e,t,xy(r,t))}))}return e}var S=ey((function e(t,i){var n,r,a,s,o;Zm(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=_,this.debug=Iy(n=i.debug).call(n,null,l),this.log=Iy(r=i.log).call(r,null,l),this.warn=Iy(a=i.warn).call(a,null,l),this.info=Iy(s=i.info).call(s,null,l),this.error=Iy(o=i.error).call(o,null,l)})),_=function(){},b={trace:_,debug:_,log:_,warn:_,info:_,error:_};function A(){return k({},b)}function R(e,t,i){var n,r,a,s,o;return t[e]?Iy(n=t[e]).call(n,t):(r=e,a=i,(o=self.console[r])?Iy(o).call(o,self.console,Hy(s="".concat(a?"["+a+"] ":"","[")).call(s,r,"] >")):_)}var L=A(),I=L;function C(){if("undefined"!=typeof self)return(!(arguments.length>0&&void 0!==arguments[0])||arguments[0]||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function w(e,t){var i=Cy(e),n=Cy(t),r=i.length,a=n.length;return!r||!a||r===a&&!Yy(i).call(i,(function(e){return-1===zy(n).call(n,e)}))}var D={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 x(e,t){var i,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return!Yy(i=e.split(",")).call(i,(function(e){return!P(e,t,n)}))}function P(e,t){var i,n=C(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);return null!=(i=null==n?void 0:n.isTypeSupported(O(e,t)))&&i}function O(e,t){var i;return Hy(i="".concat(t,"/mp4;codecs=")).call(i,e)}function M(e){if(e){var t=e.substring(0,4);return D.video[t]}return 2}function N(e){var t;return ok(t=e.split(",")).call(t,(function(e,t){var i=D.video[t];return i?(2*i+e)/(e?3:2):(D.audio[t]+e)/(e?2:1)}),0)}var F={},U=/flac|opus|mp4a\.40\.34/i;function B(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.replace(U,(function(e){return function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(F[e])return F[e];for(var i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e],n=0;n<i.length;n++){var r;if(P(i[n],"audio",t))return F[e]=i[n],i[n];if("mp3"===i[n]&&null!=(r=C(t))&&r.isTypeSupported("audio/mpeg"))return""}return e}(e.toLowerCase(),t)}))}function H(e,t){var i;if(e&&(e.length>4||-1!==zy(i=["ac-3","ec-3","alac","fLaC","Opus"]).call(i,e)))return e;if(t){var n=t.split(",");if(n.length>1){if(e)for(var r=n.length;r--;)if(n[r].substring(0,4)===e.substring(0,4))return n[r];return n[0]}}return t||e}function G(e){if(wk(e).call(e,"av01.")){for(var t=e.split("."),i=["0","111","01","01","01","0"],n=t.length;n>4&&n<10;n++)t[n]=i[n-4];return t.join(".")}return e}function V(e){var t=C(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 K={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},W={};function j(e,t,i,n,r,s){var o,l=e.audioCodec?e.audioGroups:null,u=null==s?void 0:s.audioCodec,c=null==s?void 0:s.channels,h=c?Zk(c):u?1/0:2,d=null;if(null!=l&&l.length)try{d=1===l.length&&l[0]?t.groups[l[0]].channels:ok(l).call(l,(function(e,i){if(i){var n,r=t.groups[i];if(!r)throw new Error("Audio track group ".concat(i," not found"));Py(n=Cy(r.channels)).call(n,(function(t){e[t]=(e[t]||0)+r.channels[t]}))}return e}),{2:0})}catch(f){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!==i||e.bitrate>Math.max(r,8e6))||!!d&&a(h)&&Yy(o=Cy(d)).call(o,(function(e){return Zk(e)>h}))}function Y(e,t,i){var n,r=e.videoCodec,s=e.audioCodec;if(!r&&!s||!i)return nb.resolve(K);var o=[];if(r){var l,u={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&&(u.transferFunction=c.toLowerCase()),o.push.apply(o,ub(l=r.split(",")).call(l,(function(e){return{type:"media-source",video:E(E({},u),{},{contentType:O(G(e),"video")})}})))}return s&&e.audioGroups&&Py(n=e.audioGroups).call(n,(function(e){var i,n;e&&(null==(n=t.groups[e])||Py(i=n.tracks).call(i,(function(t){if(t.groupId===e){var i,n=t.channels||"",r=Tb(n);a(r)&&r>2&&o.push.apply(o,ub(i=s.split(",")).call(i,(function(e){return{type:"media-source",audio:{contentType:O(e,"audio"),channels:""+r}}})))}})))})),nb.all(ub(o).call(o,(function(e){var t=function(e){var t=e.audio,i=e.video,n=i||t;if(n){var r,a,s,o,l,u,c,h=n.contentType.split('"')[1];if(i)return Hy(r=Hy(a=Hy(s=Hy(o=Hy(l="r".concat(i.height,"x")).call(l,i.width,"f")).call(o,Math.ceil(i.framerate))).call(s,i.transferFunction||"sd","_")).call(a,h,"_")).call(r,Math.ceil(i.bitrate/1e5));if(t)return Hy(u=Hy(c="c".concat(t.channels)).call(c,t.spatialRendering?"s":"n","_")).call(u,h)}return""}(e);return W[t]||(W[t]=i.decodingInfo(e))}))).then((function(e){return{supported:!Yy(e).call(e,(function(e){return!e.supported})),configurations:o,decodingInfoResults:e}})).catch((function(e){return{supported:!1,configurations:o,decodingInfoResults:[],error:e}}))}var z=["NONE","TYPE-0","TYPE-1",null],q=["SDR","PQ","HLG"],X={No:"",Yes:"YES",v2:"v2"};function Q(e){var t=e.canSkipUntil,i=e.canSkipDateRanges,n=e.age;return t&&n<t/2?i?X.v2:X.Yes:X.No}var $=function(){function e(t,i,n){Zm(this,e),this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=i,this.skip=n}return ey(e,[{key:"addDirectives",value:function(e){var t=new tI(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}(),Z=function(){function e(t){var i,n;Zm(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=ub(i=Dy(n=[t.videoCodec,t.audioCodec]).call(n,(function(e){return!!e}))).call(i,(function(e){return e.substring(0,4)})).join(","),this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}return ey(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 J(this._audioGroups,e)}},{key:"hasSubtitleGroup",value:function(e){return J(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 i=this._audioGroups;i||(i=this._audioGroups=[]),-1===zy(i).call(i,t)&&i.push(t)}else if("text"===e){var n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),-1===zy(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 J(e,t){return!(!t||!e)&&-1!==zy(e).call(e,t)}function ee(e,t){var i=!1,n=[];if(e&&(i="SDR"!==e,n=[e]),t){var r="SDR"!==(n=t.allowedVideoRanges||iI(q).call(q,0)).join("")&&!t.videoCodec;(i=void 0!==t.preferHDR?t.preferHDR:r&&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:i,allowedVideoRanges:n}}function te(e,t){var i;I.log(Hy(i='[abr] start candidates with "'.concat(e,'" ignored because ')).call(i,t))}function ie(e){return ok(e).call(e,(function(e,t){var i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);var n=t.channels||"2";return i.channels[n]=(i.channels[n]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function ne(e){return e?{lang:e.lang,assocLang:e.assocLang,characteristics:e.characteristics,channels:e.channels,audioCodec:e.audioCodec}:e}function re(e,t,i){if("attrs"in e){var n=zy(t).call(t,e);if(-1!==n)return n}for(var r=0;r<t.length;r++)if(ae(e,t[r],i))return r;return-1}function ae(e,t,i){var n=e.groupId,r=e.name,a=e.lang,s=e.assocLang,o=e.characteristics,l=e.default,u=e.forced;return(void 0===n||t.groupId===n)&&(void 0===r||t.name===r)&&(void 0===a||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--";return e.length===t.length?e===t:wk(e).call(e,t)||wk(t).call(t,e)}(a,t.lang))&&(void 0===a||t.assocLang===s)&&(void 0===l||t.default===l)&&(void 0===u||t.forced===u)&&(void 0===o||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.split(","),n=t.split(",");return i.length===n.length&&!Yy(i).call(i,(function(e){return-1===zy(n).call(n,e)}))}(o,t.characteristics))&&(void 0===i||i(e,t))}function se(e,t){var i=e.audioCodec,n=e.channels;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==n&&n!==(t.channels||"2"))}function oe(e,t,i){for(var n=t;n>-1;n--)if(i(e[n]))return n;for(var r=t+1;r<e.length;r++)if(i(e[r]))return r;return-1}function le(e,t){var i;return!!e&&e!==(null==(i=t.levels[t.loadLevel])?void 0:i.uri)}var ue=function(e){Qm(i,e);var t=$m(i);function i(e){var n;return Zm(this,i),(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,i,r,s,o,l,u,h,d,f,v,g=Xm(n),p=g.fragCurrent,m=g.partCurrent,y=g.hls,k=y.autoLevelEnabled,T=y.media;if(p&&T){var E=performance.now(),S=m?m.stats:p.stats,_=m?m.duration:p.duration,b=E-S.loading.start,A=y.minAutoLevel;if(S.aborted||S.loaded&&S.loaded===S.total||p.level<=A)return n.clearTimer(),void(n._nextAutoLevel=-1);if(k&&!T.paused&&T.playbackRate&&T.readyState){var R=y.mainForwardBufferInfo;if(null!==R){var L=n.bwEstimator.getEstimateTTFB(),I=Math.abs(T.playbackRate);if(!(b<=Math.max(L,_/(2*I)*1e3))){var C=R.len/I,w=S.loading.first?S.loading.first-S.loading.start:-1,D=S.loaded&&w>-1,x=n.getBwEstimate(),P=y.levels,O=P[p.level],M=Math.max(S.loaded,Math.round(_*(p.bitrate||O.averageBitrate)/8)),N=D?b-w:b;N<1&&D&&(N=Math.min(b,8*S.loaded/x));var F=D?1e3*S.loaded/N:0,U=L/1e3,B=F?(M-S.loaded)/F:8*M/x+U;if(!(B<=C)){var H,G=F?8*F:x,V=!0===(null==(v=n.hls.latestLevelDetails)?void 0:v.live),K=n.hls.config.abrBandWidthUpFactor,W=Number.POSITIVE_INFINITY;for(H=p.level-1;H>A;H--){var j=P[H].maxBitrate,Y=!P[H].details||V;if((W=n.getTimeToLoadFrag(U,G,_*j,Y))<Math.min(C,_+U))break}if(!(W>=B||W>10*_)){D?n.bwEstimator.sample(b-Math.min(L,w),S.loaded):n.bwEstimator.sampleTTFB(b);var z=P[H].maxBitrate;n.getBwEstimate()*K>z&&n.resetEstimator(z);var q=n.findBestLevel(z,A,H,0,C,1,1);q>-1&&(H=q),n.warn(Hy(e=Hy(t=Hy(i=Hy(r=Hy(s=Hy(o=Hy(l=Hy(u=Hy(h=Hy(d=Hy(f="Fragment ".concat(p.sn)).call(f,m?" part "+m.index:""," of level ")).call(d,p.level," is loading too slowly;\n Fragment duration: ")).call(h,p.duration.toFixed(3),"\n Time to underbuffer: ")).call(u,C.toFixed(3)," s\n Estimated load time for current fragment: ")).call(l,B.toFixed(3)," s\n Estimated load time for down switch fragment: ")).call(o,W.toFixed(3)," s\n TTFB estimate: ")).call(s,0|w," ms\n Current BW estimate: ")).call(r,a(x)?0|x:"Unknown"," bps\n New BW estimate: ")).call(i,0|n.getBwEstimate()," bps\n Switching to level ")).call(t,H," @ ")).call(e,0|z," bps")),y.nextLoadLevel=y.nextAutoLevel=H,n.clearTimer(),n.timer=TI((function(){if(n.clearTimer(),n.fragCurrent===p&&n.hls.loadLevel===H&&H>0){var e,t,i=n.getStarvationDelay();if(n.warn(Hy(e=Hy(t="Aborting inflight request ".concat(H>0?"and switching down":"","\n Fragment duration: ")).call(t,p.duration.toFixed(3)," s\n Time to underbuffer: ")).call(e,i.toFixed(3)," s")),p.abortRequests(),n.fragCurrent=n.partCurrent=null,H>A){var r=n.findBestLevel(n.hls.levels[A].bitrate,A,H,0,i,1,1);-1===r&&(r=A),n.hls.nextLoadLevel=n.hls.nextAutoLevel=r,n.resetEstimator(n.hls.levels[r].bitrate)}}}),1e3*W),y.trigger(c.FRAG_LOAD_EMERGENCY_ABORTED,{frag:p,part:m,stats:S})}}}}}}},n.hls=e,n.bwEstimator=n.initEstimator(),n.registerListeners(),n}return ey(i,[{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 m(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}},{key:"registerListeners",value:function(){var e=this.hls;e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.FRAG_LOADING,this.onFragLoading,this),e.on(c.FRAG_LOADED,this.onFragLoaded,this),e.on(c.FRAG_BUFFERED,this.onFragBuffered,this),e.on(c.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(c.LEVEL_LOADED,this.onLevelLoaded,this),e.on(c.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(c.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(c.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.FRAG_LOADING,this.onFragLoading,this),e.off(c.FRAG_LOADED,this.onFragLoaded,this),e.off(c.FRAG_BUFFERED,this.onFragBuffered,this),e.off(c.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(c.LEVEL_LOADED,this.onLevelLoaded,this),e.off(c.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(c.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(c.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 i,n=t.frag;this.ignoreFragment(n)||(n.bitrateTest||(this.fragCurrent=n,this.partCurrent=null!=(i=t.part)?i:null),this.clearTimer(),this.timer=TI(this._abandonRulesCheck,100))}},{key:"onLevelSwitching",value:function(e,t){this.clearTimer()}},{key:"onError",value:function(e,t){if(!t.fatal)switch(t.details){case u.BUFFER_ADD_CODEC_ERROR:case u.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case u.FRAG_LOAD_TIMEOUT:var i=t.frag,n=this.fragCurrent,r=this.partCurrent;if(i&&n&&i.sn===n.sn&&i.level===n.level){var a=performance.now(),s=r?r.stats:i.stats,o=a-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,i,n){return e+i/t+(n?this.lastLevelLoadSec:0)}},{key:"onLevelLoaded",value:function(e,t){var i=this.hls.config,n=t.stats.loading,r=n.end-n.start;a(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}},{key:"onFragLoaded",value:function(e,t){var i=t.frag,n=t.part,r=n?n.stats:i.stats;if(i.type===g.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(i)){if(this.clearTimer(),i.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var a=n?n.duration:i.duration,s=this.hls.levels[i.level],o=(s.loaded?s.loaded.bytes:0)+r.loaded,l=(s.loaded?s.loaded.duration:0)+a;s.loaded={bytes:o,duration:l},s.realBitrate=Math.round(8*o/l)}if(i.bitrateTest){var u={stats:r,frag:i,part:n,id:i.type};this.onFragBuffered(c.FRAG_BUFFERED,u),i.bitrateTest=!1}else this.lastLoadedFragLevel=i.level}}},{key:"onFragBuffered",value:function(e,t){var i=t.frag,n=t.part,r=null!=n&&n.stats.loaded?n.stats:i.stats;if(!r.aborted&&!this.ignoreFragment(i)){var a=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}}},{key:"ignoreFragment",value:function(e){return e.type!==g.MAIN||"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,i=t.maxAutoLevel,n=t.minAutoLevel,r=this.getBwEstimate(),a=this.hls.config.maxStarvationDelay,s=this.findBestLevel(r,n,i,0,a,1,1);if(s>-1)return s;var o=this.hls.firstLevel,l=Math.min(Math.max(o,n),i);return this.warn(Hy(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(),i=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;var n=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){var r=this.hls.levels;if(r.length>Math.max(e,n)&&r[e].loadError<=r[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n},set:function(e){var t=this.hls,i=t.maxAutoLevel,n=t.minAutoLevel,r=Math.min(Math.max(e,n),i);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}},{key:"getAutoLevelKey",value:function(){var e;return Hy(e="".concat(this.getBwEstimate(),"_")).call(e,this.getStarvationDelay().toFixed(2))}},{key:"getNextABRAutoLevel",value:function(){var e,t=this.fragCurrent,i=this.partCurrent,n=this.hls;if(n.levels.length<=1)return n.loadLevel;var r=n.maxAutoLevel,a=n.config,s=n.minAutoLevel,o=i?i.duration:t?t.duration:0,l=this.getBwEstimate(),u=this.getStarvationDelay(),c=a.abrBandWidthFactor,h=a.abrBandWidthUpFactor;if(u){var d=this.findBestLevel(l,s,r,u,0,c,h);if(d>=0)return d}var f=o?Math.min(o,a.maxStarvationDelay):a.maxStarvationDelay;if(!u){var v,g=this.bitrateTestDelay;g&&(f=(o?Math.min(o,a.maxLoadingDelay):a.maxLoadingDelay)-g,this.info(Hy(v="bitrate test took ".concat(Math.round(1e3*g),"ms, set first fragment max fetchDuration to ")).call(v,Math.round(1e3*f)," ms")),c=h=1)}var p=this.findBestLevel(l,s,r,u,f,c,h);if(this.info(Hy(e="".concat(u?"rebuffering expected":"buffer is empty",", optimal quality level ")).call(e,p)),p>-1)return p;var m=n.levels[s],y=n.levels[n.loadLevel];return(null==m?void 0:m.bitrate)<(null==y?void 0:y.bitrate)?s:n.loadLevel}},{key:"getStarvationDelay",value:function(){var e=this.hls,t=e.media;if(!t)return 1/0;var i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/i}},{key:"getBwEstimate",value:function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}},{key:"findBestLevel",value:function(e,t,i,n,r,s,o){var l,u=this,c=n+r,h=this.lastLoadedFragLevel,d=-1===h?this.hls.firstLevel:h,f=this.fragCurrent,v=this.partCurrent,g=this.hls,p=g.levels,m=g.allAudioTracks,y=g.loadLevel,k=g.config;if(1===p.length)return 0;var T,E,S,_,b,A,R=p[d],L=!(null==(l=this.hls.latestLevelDetails)||!l.live),I=-1===y||-1===h,C="SDR",w=(null==R?void 0:R.frameRate)||0,D=k.audioPreference,x=k.videoPreference,P=this.audioTracksByGroup||(this.audioTracksByGroup=ie(m)),O=-1;if(I){if(-1!==this.firstSelection)return this.firstSelection;var M=function(e,t,i,n,r){for(var s=Cy(e),o=null==n?void 0:n.channels,l=null==n?void 0:n.audioCodec,u=null==r?void 0:r.videoCodec,c=o&&2===Zk(o),h=!1,d=!1,f=1/0,v=1/0,g=1/0,p=1/0,m=0,y=[],k=ee(t,r),T=k.preferHDR,E=k.allowedVideoRanges,S=function(){var t=e[s[_]];h||(h=t.channels[2]>0),f=Math.min(f,t.minHeight),v=Math.min(v,t.minFramerate),g=Math.min(g,t.minBitrate),Dy(E).call(E,(function(e){return t.videoRanges[e]>0})).length>0&&(d=!0)},_=s.length;_--;)S();f=a(f)?f:0,v=a(v)?v:0;var b=Math.max(1080,f),A=Math.max(30,v);g=a(g)?g:i,i=Math.max(g,i),d||(t=void 0);var R=s.length>1;return{codecSet:ok(s).call(s,(function(t,n){var r=e[n];if(n===t)return t;if(y=d?Dy(E).call(E,(function(e){return r.videoRanges[e]>0})):[],R){var a,s,f,v,g;if(r.minBitrate>i)return te(n,Hy(a="min bitrate of ".concat(r.minBitrate," > current estimate of ")).call(a,i)),t;if(!r.hasDefaultAudio)return te(n,"no renditions with default or auto-select sound found"),t;if(l&&zy(n).call(n,l.substring(0,4))%5!=0)return te(n,'audio codec preference "'.concat(l,'" not found')),t;if(o&&!c){if(!r.channels[o])return te(n,Hy(g="no renditions with ".concat(o," channel sound found (channels options: ")).call(g,Cy(r.channels),")")),t}else if((!l||c)&&h&&0===r.channels[2])return te(n,"no renditions with stereo sound found"),t;if(r.minHeight>b)return te(n,Hy(s="min resolution of ".concat(r.minHeight," > maximum of ")).call(s,b)),t;if(r.minFramerate>A)return te(n,Hy(f="min framerate of ".concat(r.minFramerate," > maximum of ")).call(f,A)),t;if(!Yy(y).call(y,(function(e){return r.videoRanges[e]>0})))return te(n,"no variants with VIDEO-RANGE of ".concat(bI(y)," found")),t;if(u&&zy(n).call(n,u.substring(0,4))%5!=0)return te(n,'video codec preference "'.concat(u,'" not found')),t;if(r.maxScore<m)return te(n,Hy(v="max score of ".concat(r.maxScore," < selected max of ")).call(v,m)),t}return t&&(N(n)>=N(t)||r.fragmentError>e[t].fragmentError)?t:(p=r.minIndex,m=r.maxScore,n)}),void 0),videoRanges:y,preferHDR:T,minFramerate:v,minBitrate:g,minIndex:p}}(this.codecTiers||(this.codecTiers=(S=P,_=t,b=i,ok(A=iI(E=p).call(E,_,b+1)).call(A,(function(e,t,i){if(!t.codecSet)return e;var n=t.audioGroups,r=e[t.codecSet];r||(e[t.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:i,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!n,fragmentError:0}),r.minBitrate=Math.min(r.minBitrate,t.bitrate);var a=Math.min(t.height,t.width);return r.minHeight=Math.min(r.minHeight,a),r.minFramerate=Math.min(r.minFramerate,t.frameRate),r.minIndex=Math.min(r.minIndex,i),r.maxScore=Math.max(r.maxScore,t.score),r.fragmentError+=t.fragmentError,r.videoRanges[t.videoRange]=(r.videoRanges[t.videoRange]||0)+1,n&&Py(n).call(n,(function(e){var t;if(e){var i=S.groups[e];i&&(r.hasDefaultAudio=r.hasDefaultAudio||S.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!S.hasDefaultAudio&&!S.hasAutoSelectAudio,Py(t=Cy(i.channels)).call(t,(function(e){r.channels[e]=(r.channels[e]||0)+i.channels[e]})))}})),e}),{}))),C,e,D,x),F=M.codecSet,U=M.videoRanges,B=M.minFramerate,H=M.minBitrate,G=M.minIndex,V=M.preferHDR;O=G,T=F,C=V?U[U.length-1]:U[0],w=B,e=Math.max(e,H),this.log("picked start tier ".concat(bI(M)))}else T=null==R?void 0:R.codecSet,C=null==R?void 0:R.videoRange;for(var W=v?v.duration:f?f.duration:0,z=this.bwEstimator.getEstimateTTFB()/1e3,q=[],X=function(){var t=p[Q],l=Q>d;if(!t)return"continue";if(k.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){var f=navigator.mediaCapabilities;"function"!=typeof(null==f?void 0:f.decodingInfo)||!j(t,P,C,w,e,D)&&"hvc1"!==(null==(Z=t.videoCodec)?void 0:Z.substring(0,4))?t.supportedResult=K:(t.supportedPromise=Y(t,P,f),t.supportedPromise.then((function(e){var i,n,r;if(u.hls){t.supportedResult=e;var a=u.hls.levels,s=zy(a).call(a,t);e.error?u.warn(Hy(i=Hy(n='MediaCapabilities decodingInfo error: "'.concat(e.error,'" for level ')).call(n,s," ")).call(i,bI(e))):e.supported||(u.warn(Hy(r="Unsupported MediaCapabilities decodingInfo result for level ".concat(s," ")).call(r,bI(e))),s>-1&&a.length>1&&(u.log("Removing unsupported level ".concat(s)),u.hls.removeLevel(s),-1===u.hls.loadLevel&&(u.hls.nextLoadLevel=0)))}})))}if((T&&t.codecSet!==T||C&&t.videoRange!==C||l&&w>t.frameRate||!l&&w>0&&w<t.frameRate||t.supportedResult&&(null==($=t.supportedResult.decodingInfoResults)||!$[0].smooth))&&(!I||Q!==O))return q.push(Q),"continue";var g,m=t.details,E=(v?null==m?void 0:m.partTarget:null==m?void 0:m.averagetargetduration)||W;g=l?o*e:s*e;var S=W&&n>=2*W&&0===r?t.averageBitrate:t.maxBitrate,_=u.getTimeToLoadFrag(z,g,S*E,void 0===m);if(g>=S&&(Q===h||0===t.loadError&&0===t.fragmentError)&&(_<=z||!a(_)||L&&!u.bitrateTestDelay||_<c)){var b,A,R,x,M,N,F,U,B,H,G,V,X,J,ee,te,ie=u.forcedAutoLevel;return{v:(Q===y||-1!==ie&&ie===y||(q.length&&u.trace(Hy(b=Hy(A=Hy(R=Hy(x=Hy(M="Skipped level(s) ".concat(q.join(",")," of ")).call(M,i,' max with CODECS and VIDEO-RANGE:"')).call(x,p[q[0]].codecs,'" ')).call(R,p[q[0]].videoRange,'; not compatible with "')).call(A,T,'" ')).call(b,C)),u.info(Hy(N=Hy(F=Hy(U=Hy(B=Hy(H=Hy(G=Hy(V=Hy(X=Hy(J=Hy(ee=Hy(te="switch candidate:".concat(d,"->")).call(te,Q," adjustedbw(")).call(ee,Math.round(g),")-bitrate=")).call(J,Math.round(g-S)," ttfb:")).call(X,z.toFixed(1)," avgDuration:")).call(V,E.toFixed(1)," maxFetchDuration:")).call(G,c.toFixed(1)," fetchDuration:")).call(H,_.toFixed(1)," firstSelection:")).call(B,I," codecSet:")).call(U,t.codecSet," videoRange:")).call(F,t.videoRange," hls.loadLevel:")).call(N,y))),I&&(u.firstSelection=Q),Q)}}},Q=i;Q>=t;Q--){var $,Z,J=X();if("continue"!==J&&"object"===qh(J))return J.v}return-1}}]),i}(S),ce=function(e,t){for(var i=0,n=e.length-1,r=null,a=null;i<=n;){var s=t(a=e[r=(i+n)/2|0]);if(s>0)i=r+1;else{if(!(s<0))return a;n=r-1}}return null};function he(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.005,a=null;if(e){a=t[1+e.sn-t[0].sn]||null;var s=e.endDTS-i;s>0&&s<15e-7&&(i+=15e-7),a&&e.level!==a.level&&a.end<=e.end&&(a=t[2+e.sn-t[0].sn]||null)}else 0===i&&0===t[0].start&&(a=t[0]);if(a&&((!e||e.level===a.level)&&0===de(i,n,a)||function(e,t,i){if(t&&0===t.start&&t.level<e.level&&(t.endPTS||0)>0){var n,r=ok(n=t.tagList).call(n,(function(e,t){return"INF"===t[0]&&(e+=Tb(t[1])),e}),i);return e.start<=r}return!1}(a,e,Math.min(r,n))))return a;var o=ce(t,Iy(de).call(de,null,i,n));return!o||o===e&&a?a:o}function de(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;if(i.start<=e&&i.start+i.duration>e)return 0;var n=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-n<=e?1:i.start-n>e&&i.start?-1:0}function fe(e,t,i){var n=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-n>e}function ve(e,t){return ce(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}function ge(e){switch(e.details){case u.FRAG_LOAD_TIMEOUT:case u.KEY_LOAD_TIMEOUT:case u.LEVEL_LOAD_TIMEOUT:case u.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function pe(e,t){var i=ge(t);return e.default[(i?"timeout":"error")+"Retry"]}function me(e,t){var i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function ye(e){return E(E({},e),{errorRetry:null,timeoutRetry:null})}function ke(e,t,i,n){if(!e)return!1;var r,a=null==n?void 0:n.code,s=t<e.maxNumRetry&&(0===(r=a)&&!1===navigator.onLine||!!r&&(r<400||r>499)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,n,s):s}var Te={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ee={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4},Se=function(e){Qm(i,e);var t=$m(i);function i(e){var n;return Zm(this,i),(n=t.call(this,"error-controller",e.logger)).hls=void 0,n.playlistError=0,n.penalizedRenditions={},n.hls=e,n.registerListeners(),n}return ey(i,[{key:"registerListeners",value:function(){var e=this.hls;e.on(c.ERROR,this.onError,this),e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.LEVEL_UPDATED,this.onLevelUpdated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(c.ERROR,this.onError,this),e.off(c.ERROR,this.onErrorOut,this),e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.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)===g.MAIN?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 i;if(!t.fatal){var n=this.hls,r=t.context;switch(t.details){case u.FRAG_LOAD_ERROR:case u.FRAG_LOAD_TIMEOUT:case u.KEY_LOAD_ERROR:case u.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case u.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction=_e());case u.FRAG_GAP:case u.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=Te.SendAlternateToPenaltyBox);case u.LEVEL_EMPTY_ERROR:case u.LEVEL_PARSING_ERROR:var a,s,o=t.parent===g.MAIN?t.level:n.loadLevel;return void(t.details===u.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(s=a.levelDetails)&&s.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,o)));case u.LEVEL_LOAD_ERROR:case u.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==r?void 0:r.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level)));case u.AUDIO_TRACK_LOAD_ERROR:case u.AUDIO_TRACK_LOAD_TIMEOUT:case u.SUBTITLE_LOAD_ERROR:case u.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){var c=n.levels[n.loadLevel];if(c&&(r.type===f&&c.hasAudioGroup(r.groupId)||r.type===v&&c.hasSubtitleGroup(r.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=Te.SendAlternateToPenaltyBox,void(t.errorAction.flags=Ee.MoveAllAlternatesMatchingHost)}return;case u.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var h=n.levels[n.loadLevel],d=null==h?void 0:h.attrs["HDCP-LEVEL"];return void(d?t.errorAction={action:Te.SendAlternateToPenaltyBox,flags:Ee.MoveAllAlternatesMatchingHDCP,hdcpLevel:d}:this.keySystemError(t));case u.BUFFER_ADD_CODEC_ERROR:case u.REMUX_ALLOC_ERROR:case u.BUFFER_APPEND_ERROR:var p;return void(t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,null!=(p=t.level)?p:n.loadLevel)));case u.INTERNAL_EXCEPTION:case u.BUFFER_APPENDING_ERROR:case u.BUFFER_FULL_ERROR:case u.LEVEL_SWITCH_ERROR:case u.BUFFER_STALLED_ERROR:case u.BUFFER_SEEK_OVER_HOLE:case u.BUFFER_NUDGE_ON_STALL:return void(t.errorAction=_e())}t.type===l.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 i=pe(this.hls.config.playlistLoadPolicy,e),n=this.playlistError++;if(ke(i,n,ge(e),e.response))return{action:Te.RetryRequest,flags:Ee.None,retryConfig:i,retryCount:n};var r=this.getLevelSwitchAction(e,t);return i&&(r.retryConfig=i,r.retryCount=n),r}},{key:"getFragRetryOrSwitchAction",value:function(e){var t,i,n=this.hls,r=this.getVariantLevelIndex(e.frag),a=n.levels[r],s=n.config,o=s.fragLoadPolicy,l=s.keyLoadPolicy,c=pe(wk(t=e.details).call(t,"key")?l:o,e),h=ok(i=n.levels).call(i,(function(e,t){return e+t.fragmentError}),0);if(a&&(e.details!==u.FRAG_GAP&&a.fragmentError++,ke(c,h,ge(e),e.response)))return{action:Te.RetryRequest,flags:Ee.None,retryConfig:c,retryCount:h};var d=this.getLevelSwitchAction(e,r);return c&&(d.retryConfig=c,d.retryCount=h),d}},{key:"getLevelSwitchAction",value:function(e,t){var i=this.hls;null==t&&(t=i.loadLevel);var n=this.hls.levels[t];if(n){var r,a,s=e.details;n.loadError++,s===u.BUFFER_APPEND_ERROR&&n.fragmentError++;var o=-1,l=i.levels,c=i.loadLevel,h=i.minAutoLevel,d=i.maxAutoLevel;i.autoLevelEnabled||(i.loadLevel=-1);for(var p=null==(r=e.frag)?void 0:r.type,m=(p===g.AUDIO&&s===u.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(s===u.BUFFER_ADD_CODEC_ERROR||s===u.BUFFER_APPEND_ERROR))&&Yy(l).call(l,(function(e){var t=e.audioCodec;return n.audioCodec!==t})),y="video"===e.sourceBufferName&&(s===u.BUFFER_ADD_CODEC_ERROR||s===u.BUFFER_APPEND_ERROR)&&Yy(l).call(l,(function(e){var t=e.codecSet,i=e.audioCodec;return n.codecSet!==t&&n.audioCodec===i})),k=null!=(a=e.context)?a:{},T=k.type,E=k.groupId,S=function(){var t=(_+c)%l.length;if(t!==c&&t>=h&&t<=d&&0===l[t].loadError){var i=l[t];if(s===u.FRAG_GAP&&p===g.MAIN&&e.frag){var r=l[t].details;if(r){var a=he(e.frag,r.fragments,e.frag.start);if(null!=a&&a.gap)return"continue"}}else{if(T===f&&i.hasAudioGroup(E)||T===v&&i.hasSubtitleGroup(E))return"continue";if(p===g.AUDIO&&null!=(b=n.audioGroups)&&Yy(b).call(b,(function(e){return i.hasAudioGroup(e)}))||p===g.SUBTITLE&&null!=(A=n.subtitleGroups)&&Yy(A).call(A,(function(e){return i.hasSubtitleGroup(e)}))||m&&n.audioCodec===i.audioCodec||!m&&n.audioCodec!==i.audioCodec||y&&n.codecSet===i.codecSet)return"continue"}return o=t,"break"}},_=l.length;_--;){var b,A,R=S();if("continue"!==R&&"break"===R)break}if(o>-1&&i.loadLevel!==o)return e.levelRetry=!0,this.playlistError=0,{action:Te.SendAlternateToPenaltyBox,flags:Ee.None,nextAutoLevel:o}}return{action:Te.SendAlternateToPenaltyBox,flags:Ee.MoveAllAlternatesMatchingHost}}},{key:"onErrorOut",value:function(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case Te.DoNothing:break;case Te.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===u.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,i=e.errorAction;if(i){var n=OI(i),r=i.hdcpLevel,a=i.nextAutoLevel;switch(n){case Ee.None:this.switchLevel(e,a);break;case Ee.MoveAllAlternatesMatchingHDCP:r&&(t.maxHdcpLevel=z[zy(z).call(z,r)-1],i.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'.concat(t.maxHdcpLevel,'" or lower'))}i.resolved||this.switchLevel(e,a)}}},{key:"switchLevel",value:function(e,t){var i;void 0!==t&&e.errorAction&&(this.warn(Hy(i="switching to level ".concat(t," after ")).call(i,e.details)),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}]),i}(S);function _e(e){var t={action:Te.DoNothing,flags:Ee.None};return e&&(t.resolved=!0),t}var be="NOT_LOADED",Ae="APPENDING",Re="PARTIAL",Le="OK",Ie=function(){function e(t){Zm(this,e),this.activePartLists=MI(null),this.endListFragments=MI(null),this.fragments=MI(null),this.timeRanges=MI(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=t,this._registerListeners()}return ey(e,[{key:"_registerListeners",value:function(){var e=this.hls;e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.BUFFER_APPENDED,this.onBufferAppended,this),e.on(c.FRAG_BUFFERED,this.onFragBuffered,this),e.on(c.FRAG_LOADED,this.onFragLoaded,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.BUFFER_APPENDED,this.onBufferAppended,this),e.off(c.FRAG_BUFFERED,this.onFragBuffered,this),e.off(c.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 i=this.activePartLists[t];if(i)for(var n=i.length;n--;){var r=i[n];if(!r)break;var a=r.end;if(r.start<=e&&null!==a&&e<=a)return r}return this.getBufferedFrag(e,t)}},{key:"getBufferedFrag",value:function(e,t){return this.getFragAtPos(e,t,!0)}},{key:"getFragAtPos",value:function(e,t,i){for(var n=this.fragments,r=Cy(n),a=r.length;a--;){var s=n[r[a]];if((null==s?void 0:s.body.type)===t&&(!i||s.buffered)){var o=s.body;if(o.start<=e&&e<=o.end)return o}}return null}},{key:"detectEvictedFragments",value:function(e,t,i,n,r){var a,s=this;this.timeRanges&&(this.timeRanges[e]=t);var o=(null==n?void 0:n.fragment.sn)||-1;Py(a=Cy(this.fragments)).call(a,(function(n){var a,l=s.fragments[n];if(l&&!(o>=l.body.sn))if(l.buffered||l.loaded&&!r){var u=l.range[e];u&&(0!==u.time.length?Yy(a=u.time).call(a,(function(e){var i=!s.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&s.removeFragment(l.body),i})):s.removeFragment(l.body))}else l.body.type===i&&s.removeFragment(l.body)}))}},{key:"detectPartialFragments",value:function(e){var t,i=this,n=this.timeRanges;if(n&&"initSegment"!==e.frag.sn){var r=e.frag,a=we(r),s=this.fragments[a];if(!(!s||s.buffered&&r.gap)){var o=!r.relurl;Py(t=Cy(n)).call(t,(function(t){var a=r.elementaryStreams[t];if(a){var l=n[t],u=o||!0===a.partial;s.range[t]=i.getBufferedTimes(r,e.part,u,l)}})),s.loaded=null,Cy(s.range).length?(s.buffered=!0,(s.body.endList=r.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),Ce(s)||this.removeParts(r.sn-1,r.type)):this.removeFragment(s.body)}}}},{key:"removeParts",value:function(e,t){var i=this.activePartLists[t];i&&(this.activePartLists[t]=Dy(i).call(i,(function(t){return t.fragment.sn>=e})))}},{key:"fragBuffered",value:function(e,t){var i=we(e),n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:MI(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}},{key:"getBufferedTimes",value:function(e,t,i,n){for(var r={time:[],partial:i},a=e.start,s=e.end,o=e.minEndPTS||s,l=e.maxStartPTS||a,u=0;u<n.length;u++){var c=n.start(u)-this.bufferPadding,h=n.end(u)+this.bufferPadding;if(l>=c&&o<=h){r.time.push({startPTS:Math.max(a,n.start(u)),endPTS:Math.min(s,n.end(u))});break}if(a<h&&s>c){var d=Math.max(a,n.start(u)),f=Math.min(s,n.end(u));f>d&&(r.partial=!0,r.time.push({startPTS:d,endPTS:f}))}else if(s<=c)break}return r}},{key:"getPartialFragment",value:function(e){var t,i,n,r,a=null,s=0,o=this.bufferPadding,l=this.fragments;return Py(t=Cy(l)).call(t,(function(t){var u=l[t];u&&Ce(u)&&(n=u.body.start-o,r=u.body.end+o,e>=n&&e<=r&&(i=Math.min(e-n,r-e),s<=i&&(a=u.body,s=i)))})),a}},{key:"isEndListAppended",value:function(e){var t=this.endListFragments[e];return void 0!==t&&(t.buffered||Ce(t))}},{key:"getState",value:function(e){var t=we(e),i=this.fragments[t];return i?i.buffered?Ce(i)?Re:Le:Ae:be}},{key:"isTimeBuffered",value:function(e,t,i){for(var n,r,a=0;a<i.length;a++){if(n=i.start(a)-this.bufferPadding,r=i.end(a)+this.bufferPadding,e>=n&&t<=r)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 i=t.frag,n=t.part?null:t,r=we(i);this.fragments[r]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:MI(null)}}}},{key:"onBufferAppended",value:function(e,t){var i=t.frag,n=t.part,r=t.timeRanges,a=t.type;if("initSegment"!==i.sn){var s=i.type;if(n){var o=this.activePartLists[s];o||(this.activePartLists[s]=o=[]),o.push(n)}this.timeRanges=r;var l=r[a];this.detectEvictedFragments(a,l,s,n)}}},{key:"onFragBuffered",value:function(e,t){this.detectPartialFragments(t)}},{key:"hasFragment",value:function(e){var t=we(e);return!!this.fragments[t]}},{key:"hasFragments",value:function(e){var t=this.fragments,i=Cy(t);if(!e)return i.length>0;for(var n=i.length;n--;){var r=t[i[n]];if((null==r?void 0:r.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,i,n,r){var a,s=this;n&&!this.hasGaps||Py(a=Cy(this.fragments)).call(a,(function(a){var o=s.fragments[a];if(o){var l=o.body;l.type!==i||n&&!l.gap||l.start<t&&l.end>e&&(o.buffered||r)&&s.removeFragment(l)}}))}},{key:"removeFragment",value:function(e){var t=we(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var i=this.activePartLists[e.type];if(i){var n=e.sn;this.activePartLists[e.type]=Dy(i).call(i,(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=MI(null),this.endListFragments=MI(null),this.activePartLists=MI(null),this.hasGaps=!1;var i=null==(e=this.hls)||null==(t=e.latestLevelDetails)?void 0:t.partList;i&&Py(i).call(i,(function(e){return e.clearElementaryStreamInfo()}))}}]),e}();function Ce(e){var t,i,n;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(i=e.range.audio)?void 0:i.partial)||(null==(n=e.range.audiovideo)?void 0:n.partial))}function we(e){var t,i;return Hy(t=Hy(i="".concat(e.type,"_")).call(i,e.level,"_")).call(t,e.sn)}var De=0,xe=1,Pe=function(){function e(t,i,n){Zm(this,e),this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=t,this.aesIV=i,this.aesMode=n}return ey(e,[{key:"decrypt",value:function(e,t){switch(this.aesMode){case De:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case xe: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 Oe(e,t,i){return iI(Uint8Array.prototype)?iI(e).call(e,t,i):new Uint8Array(iI(Array.prototype).call(e,t,i))}var Me=function(){function e(){Zm(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 ey(e,[{key:"uint8ArrayToUint32Array_",value:function(e){for(var t=new DataView(e),i=new Uint32Array(4),n=0;n<4;n++)i[n]=t.getUint32(4*n);return i}},{key:"initTable",value:function(){var e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],r=i[1],a=i[2],s=i[3],o=this.invSubMix,l=o[0],u=o[1],c=o[2],h=o[3],d=new Uint32Array(256),f=0,v=0,g=0;for(g=0;g<256;g++)d[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var p=v^v<<1^v<<2^v<<3^v<<4;p=p>>>8^255&p^99,e[f]=p,t[p]=f;var m=d[f],y=d[m],k=d[y],T=257*d[p]^16843008*p;n[f]=T<<24|T>>>8,r[f]=T<<16|T>>>16,a[f]=T<<8|T>>>24,s[f]=T,T=16843009*k^65537*y^257*m^16843008*f,l[p]=T<<24|T>>>8,u[p]=T<<16|T>>>16,c[p]=T<<8|T>>>24,h[p]=T,f?(f=m^d[d[d[k^m]]],v^=d[d[v]]):f=v=1}}},{key:"expandKey",value:function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,n=0;n<t.length&&i;)i=t[n]===this.key[n],n++;if(!i){this.key=t;var r=this.keySize=t.length;if(4!==r&&6!==r&&8!==r)throw new Error("Invalid aes key size="+r);var a,s,o,l,u=this.ksRows=4*(r+6+1),c=this.keySchedule=new Uint32Array(u),h=this.invKeySchedule=new Uint32Array(u),d=this.sBox,f=this.rcon,v=this.invSubMix,g=v[0],p=v[1],m=v[2],y=v[3];for(a=0;a<u;a++)a<r?o=c[a]=t[a]:(l=o,a%r==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[a/r|0]<<24):r>6&&a%r==4&&(l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l]),c[a]=o=(c[a-r]^l)>>>0);for(s=0;s<u;s++)a=u-s,l=3&s?c[a]:c[a-4],h[s]=s<4||a<=4?l:g[d[l>>>24]]^p[d[l>>>16&255]]^m[d[l>>>8&255]]^y[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,i){for(var n,r,a,s,o,l,u,c,h,d,f,v,g,p,m=this.keySize+6,y=this.invKeySchedule,k=this.invSBox,T=this.invSubMix,E=T[0],S=T[1],_=T[2],b=T[3],A=this.uint8ArrayToUint32Array_(i),R=A[0],L=A[1],I=A[2],C=A[3],w=new Int32Array(e),D=new Int32Array(w.length),x=this.networkToHostOrderSwap;t<w.length;){for(h=x(w[t]),d=x(w[t+1]),f=x(w[t+2]),v=x(w[t+3]),o=h^y[0],l=v^y[1],u=f^y[2],c=d^y[3],g=4,p=1;p<m;p++)n=E[o>>>24]^S[l>>16&255]^_[u>>8&255]^b[255&c]^y[g],r=E[l>>>24]^S[u>>16&255]^_[c>>8&255]^b[255&o]^y[g+1],a=E[u>>>24]^S[c>>16&255]^_[o>>8&255]^b[255&l]^y[g+2],s=E[c>>>24]^S[o>>16&255]^_[l>>8&255]^b[255&u]^y[g+3],o=n,l=r,u=a,c=s,g+=4;n=k[o>>>24]<<24^k[l>>16&255]<<16^k[u>>8&255]<<8^k[255&c]^y[g],r=k[l>>>24]<<24^k[u>>16&255]<<16^k[c>>8&255]<<8^k[255&o]^y[g+1],a=k[u>>>24]<<24^k[c>>16&255]<<16^k[o>>8&255]<<8^k[255&l]^y[g+2],s=k[c>>>24]<<24^k[o>>16&255]<<16^k[l>>8&255]<<8^k[255&u]^y[g+3],D[t]=x(n^R),D[t+1]=x(s^L),D[t+2]=x(a^I),D[t+3]=x(r^C),R=h,L=d,I=f,C=v,t+=4}return D.buffer}}]),e}(),Ne=function(){function e(t,i,n){Zm(this,e),this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=t,this.key=i,this.aesMode=n}return ey(e,[{key:"expandKey",value:function(){var e=function(e){switch(e){case De:return"AES-CBC";case xe: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 Fe(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("undefined"!=typeof TextDecoder){var i=new TextDecoder("utf-8").decode(e);if(t){var n=zy(i).call(i,"\0");return-1!==n?i.substring(0,n):i}return i.replace(/\0/g,"")}for(var r,a,s,o=e.length,l="",u=0;u<o;){if(0===(r=e[u++])&&t)return l;if(0!==r&&3!==r)switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(r);break;case 12:case 13:a=e[u++],l+=String.fromCharCode((31&r)<<6|63&a);break;case 14:a=e[u++],s=e[u++],l+=String.fromCharCode((15&r)<<12|(63&a)<<6|63&s)}}return l}var Ue=function(e){for(var t="",i=0;i<e.length;i++){var n=e[i].toString(16);n.length<2&&(n="0"+n),t+=n}return t};function Be(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var He,Ge,Ve,Ke,We,je={exports:{}};He=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,Ge=/^(?=([^\/?#]*))\1([^]*)$/,Ve=/(?:\/|^)\.(?=\/)/g,Ke=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,je.exports=We={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=WI(e).call(e),!(t=WI(t).call(t))){if(!i.alwaysNormalize)return e;var n=We.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=We.normalizePath(n.path),We.buildURLFromParts(n)}var r=We.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=We.normalizePath(r.path),We.buildURLFromParts(r)):t;var a=We.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var s=Ge.exec(a.path);a.netLoc=s[1],a.path=s[2]}a.netLoc&&!a.path&&(a.path="/");var o={scheme:a.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(o.netLoc=a.netLoc,"/"!==r.path[0]))if(r.path){var l=a.path,u=l.substring(0,aC(l).call(l,"/")+1)+r.path;o.path=We.normalizePath(u)}else o.path=a.path,r.params||(o.params=a.params,r.query||(o.query=a.query));return null===o.path&&(o.path=i.alwaysNormalize?We.normalizePath(r.path):r.path),We.buildURLFromParts(o)},parseURL:function(e){var t=He.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=vC(i=e.split("")).call(i).join("").replace(Ve,"");e.length!==(e=e.replace(Ke,"")).length;)var i;return vC(t=e.split("")).call(t).join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};var Ye=je.exports,ze=ey((function e(){Zm(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}})),qe="audio",Xe="video",Qe="audiovideo",$e=function(){function e(t){Zm(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 ey(e,[{key:"setByteRange",value:function(e,t){var i,n=e.split("@",2);i=1===n.length?(null==t?void 0:t.byteRangeEndOffset)||0:Zk(n[1]),this._byteRange=[i,Zk(n[0])+i]}},{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=(Zh(e={},qe,null),Zh(e,Xe,null),Zh(e,Qe,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 ze),this._stats},set:function(e){this._stats=e}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Ye.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}},{key:"clearElementaryStreamInfo",value:function(){var e=this.elementaryStreams;e[qe]=null,e[Xe]=null,e[Qe]=null}}]),e}();function Ze(e){return"initSegment"!==e.sn}var Je=function(e){Qm(i,e);var t=$m(i);function i(e,n){var r;return Zm(this,i),(r=t.call(this,n))._decryptdata=null,r._programDateTime=null,r._ref=null,r._bitrate=void 0,r.rawProgramDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkeys=void 0,r.type=void 0,r.loader=null,r.keyLoader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.playlistOffset=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.endList=void 0,r.gap=void 0,r.urlId=0,r.type=e,r}return ey(i,[{key:"byteLength",get:function(){if(this.hasStats){var e=this.stats.total;if(e)return e}if(this.byteRange){var t=this.byteRange[0],i=this.byteRange[1];if(a(t)&&a(i))return i-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=Cy(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=a(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=Cy(this.levelkeys),i=t.length;if(i>1||1===i&&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){a(e)?this._programDateTime=e:this._programDateTime=this.rawProgramDateTime=null}},{key:"ref",get:function(){return Ze(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,i,n,r){var a=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,i),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,r)):s[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:r,partial:a}}}]),i}($e),et=function(e){Qm(i,e);var t=$m(i);function i(e,n,r,a,s){var o;Zm(this,i),(o=t.call(this,r)).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=a;var l=e.enumeratedString("BYTERANGE");return l&&o.setByteRange(l,s),s&&(o.fragOffset=s.fragOffset+s.duration),o}return ey(i,[{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)}}]),i}($e),tt=Math.pow(2,32)-1,it=[].push,nt={video:1,audio:2,id3:3,text:4};function rt(e){return String.fromCharCode.apply(null,e)}function at(e,t){var i=e[t]<<8|e[t+1];return i<0?65536+i:i}function st(e,t){var i=lt(e,t);return i<0?4294967296+i:i}function ot(e,t){var i=st(e,t);return i*=Math.pow(2,32),i+=st(e,t+4)}function lt(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function ut(e,t,i){e[t]=i>>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function ct(e,t){var i=[];if(!t.length)return i;for(var n=e.byteLength,r=0;r<n;){var a=st(e,r),s=a>1?r+a:n;if(rt(e.subarray(r+4,r+8))===t[0])if(1===t.length)i.push(e.subarray(r+8,s));else{var o=ct(e.subarray(r+8,s),iI(t).call(t,1));o.length&&it.apply(i,o)}r=s}return i}function ht(e){var t=[],i=e[0],n=8,r=st(e,n);n+=4;var a=0,s=0;0===i?(a=st(e,n),s=st(e,n+4),n+=8):(a=ot(e,n),s=ot(e,n+8),n+=16),n+=2;var o=e.length+s,l=at(e,n);n+=2;for(var u=0;u<l;u++){var c=n,h=st(e,c);c+=4;var d=2147483647&h;if(1==(2147483648&h)>>>31)return I.warn("SIDX has hierarchical references (not supported)"),null;var f=st(e,c);c+=4,t.push({referenceSize:d,subsegmentDuration:f,info:{duration:f/r,start:o,end:o+d-1}}),o+=d,n=c+=4}return{earliestPresentationTime:a,timescale:r,version:i,referencesCount:l,references:t}}function dt(e){for(var t,i=[],n=ct(e,["moov","trak"]),r=0;r<n.length;r++){var a=n[r],s=ct(a,["tkhd"])[0];if(s){var o=s[0],l=st(s,0===o?12:20),u=ct(a,["mdia","mdhd"])[0];if(u){var c=st(u,0===(o=u[0])?12:20),h=ct(a,["mdia","hdlr"])[0];if(h){var d=rt(h.subarray(8,12)),f={soun:qe,vide:Xe}[d];if(f){var v=ft(ct(a,["mdia","minf","stbl","stsd"])[0]);i[l]={timescale:c,type:f},i[f]=E({timescale:c,id:l},v)}}}}}return Py(t=ct(e,["moov","mvex","trex"])).call(t,(function(e){var t=st(e,4),n=i[t];n&&(n.default={duration:st(e,12),flags:st(e,20)})})),i}function ft(e){var t=e.subarray(8),i=t.subarray(86),n=rt(t.subarray(4,8)),r=n,a="enca"===n||"encv"===n;if(a){var s,o=ct(t,[n])[0];Py(s=ct(o.subarray("enca"===n?28:78),["sinf"])).call(s,(function(e){var t=ct(e,["schm"])[0];if(t){var i=rt(t.subarray(4,8));if("cbcs"===i||"cenc"===i){var n=ct(e,["frma"])[0];n&&(r=rt(n))}}}))}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":var l=ct(i,["avcC"])[0];r+="."+gt(l[1])+gt(l[2])+gt(l[3]);break;case"mp4a":var u=ct(t,[n])[0],c=ct(u.subarray(28),["esds"])[0];if(c&&c.length>7){var h=4;if(3!==c[h++])break;h=vt(c,h),h+=2;var d=c[h++];if(128&d&&(h+=2),64&d&&(h+=c[h++]),4!==c[h++])break;h=vt(c,h);var f=c[h++];if(64!==f)break;if(r+="."+gt(f),h+=12,5!==c[h++])break;h=vt(c,h);var v=c[h++],g=(248&v)>>3;31===g&&(g+=1+((7&v)<<3)+((224&c[h])>>5)),r+="."+g}break;case"hvc1":case"hev1":var p=ct(i,["hvcC"])[0],m=p[1],y=["","A","B","C"][m>>6],k=31&m,T=st(p,2),E=(32&m)>>5?"H":"L",S=p[12],_=p.subarray(6,12);r+="."+y+k,r+="."+T.toString(16).toUpperCase(),r+="."+E+S;for(var b="",A=_.length;A--;){var R=_[A];(R||b)&&(b="."+R.toString(16).toUpperCase()+b)}r+=b;break;case"dvh1":case"dvhe":var L=ct(i,["dvcC"])[0],I=L[2]>>1&127,C=L[2]<<5&32|L[3]>>3&31;r+="."+pt(I)+"."+pt(C);break;case"vp09":var w=ct(i,["vpcC"])[0],D=w[4],x=w[5],P=w[6]>>4&15;r+="."+pt(D)+"."+pt(x)+"."+pt(P);break;case"av01":var O=ct(i,["av1C"])[0],M=O[1]>>>5,N=31&O[1],F=O[2]>>>7?"H":"M",U=(64&O[2])>>6,B=(32&O[2])>>5,H=2===M&&U?B?12:10:U?10:8,G=(16&O[2])>>4,V=(8&O[2])>>3,K=(4&O[2])>>2,W=3&O[2],j=1,Y=1,z=1,q=0;r+="."+M+"."+pt(N)+F+"."+pt(H)+"."+G+"."+V+K+W+"."+pt(j)+"."+pt(Y)+"."+pt(z)+"."+q}return{codec:r,encrypted:a}}function vt(e,t){for(var i=t+5;128&e[t++]&&t<i;);return t}function gt(e){var t;return iI(t="0"+e.toString(16).toUpperCase()).call(t,-2)}function pt(e){return(e<10?"0":"")+e}function mt(e){var t=ct(e,["schm"])[0];if(t){var i=rt(t.subarray(4,8));if("cbcs"===i||"cenc"===i)return ct(e,["schi","tenc"])[0]}return null}function yt(e){var t=st(e,0),i=8;1&t&&(i+=4),4&t&&(i+=4);for(var n=0,r=st(e,4),a=0;a<r;a++)256&t&&(n+=st(e,i),i+=4),512&t&&(i+=4),1024&t&&(i+=4),2048&t&&(i+=4);return n}function kt(e,t){var i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}function Tt(e,t){var i,n=[],r=t.samples,a=t.timescale,s=t.id,o=!1;return ub(i=ct(r,["moof"])).call(i,(function(i){var l,u=i.byteOffset-8;ub(l=ct(i,["traf"])).call(l,(function(i){var l,c,h=ub(l=ct(i,["tfdt"])).call(l,(function(e){var t=e[0],i=st(e,4);return 1===t&&(i*=Math.pow(2,32),i+=st(e,8)),i/a}))[0];return void 0!==h&&(e=h),ub(c=ct(i,["tfhd"])).call(c,(function(l){var c,h=st(l,4),d=16777215&st(l,0),f=0,v=!!(16&d),g=0,p=!!(32&d),m=8;h===s&&(!!(1&d)&&(m+=8),!!(2&d)&&(m+=4),!!(8&d)&&(f=st(l,m),m+=4),v&&(g=st(l,m),m+=4),p&&(m+=4),"video"===t.type&&(o=function(e){if(!e)return!1;var t=zy(e).call(e,"."),i=t<0?e:e.substring(0,t);return"hvc1"===i||"hev1"===i||"dvh1"===i||"dvhe"===i}(t.codec)),ub(c=ct(i,["trun"])).call(c,(function(i){var s=i[0],l=16777215&st(i,0),c=!!(1&l),h=0,d=!!(4&l),v=!!(256&l),p=0,m=!!(512&l),y=0,k=!!(1024&l),T=!!(2048&l),E=0,S=st(i,4),_=8;c&&(h=st(i,_),_+=4),d&&(_+=4);for(var b=h+u,A=0;A<S;A++){if(v?(p=st(i,_),_+=4):p=f,m?(y=st(i,_),_+=4):y=g,k&&(_+=4),T&&(E=0===s?st(i,_):lt(i,_),_+=4),t.type===Xe)for(var R=0;R<y;){var L=st(r,b);Et(o,r[b+=4])&&St(r.subarray(b,b+L),o?2:1,e+E/a,n),b+=L,R+=L+4}e+=p/a}})))}))}))})),n}function Et(e,t){if(e){var i=t>>1&63;return 39===i||40===i}return 6==(31&t)}function St(e,t,i,n){var r=_t(e),a=0;a+=t;for(var s=0,o=0,l=0;a<r.length;){s=0;do{if(a>=r.length)break;s+=l=r[a++]}while(255===l);o=0;do{if(a>=r.length)break;o+=l=r[a++]}while(255===l);var u=r.length-a,c=a;if(o<u)a+=o;else if(o>u){var h;I.error(Hy(h="Malformed SEI payload. ".concat(o," is too small, only ")).call(h,u," bytes left to parse."));break}if(4===s){if(181===r[c++]){var d=at(r,c);if(c+=2,49===d){var f=st(r,c);if(c+=4,1195456820===f){var v=r[c++];if(3===v){var g=r[c++],p=64&g,m=p?2+3*(31&g):0,y=new Uint8Array(m);if(p){y[0]=g;for(var k=1;k<m;k++)y[k]=r[c++]}n.push({type:v,payloadType:s,pts:i,bytes:y})}}}}}else if(5===s&&o>16){for(var T=[],E=0;E<16;E++){var S=r[c++].toString(16);T.push(1==S.length?"0"+S:S),3!==E&&5!==E&&7!==E&&9!==E||T.push("-")}for(var _=o-16,b=new Uint8Array(_),A=0;A<_;A++)b[A]=r[c++];n.push({payloadType:s,pts:i,uuid:T.join(""),userData:Fe(b),userDataBytes:b})}}}function _t(e){for(var t=e.byteLength,i=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return e;var r=t-i.length,a=new Uint8Array(r),s=0;for(n=0;n<r;s++,n++)s===i[0]&&(s++,i.shift()),a[n]=e[s];return a}function bt(e,t,i){if(16!==e.byteLength)throw new RangeError("Invalid system id");var n,r;n=new Uint8Array,r=new Uint8Array;var a=new Uint8Array(4);return i&&i.byteLength>0&&new DataView(a.buffer).setUint32(0,i.byteLength,!1),function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r=i.length,a=8,s=r;s--;)a+=i[s].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),s=0,a=8;s<r;s++)o.set(i[s],a),a+=i[s].byteLength;return o}([112,115,115,104],new Uint8Array([0,0,0,0]),e,r,n,a,i||new Uint8Array)}function At(e){var t=e.getUint32(0),i=e.byteOffset,n=e.byteLength;if(n<t)return{offset:i,size:n};if(1886614376!==e.getUint32(4))return{offset:i,size:t};var r=e.getUint32(8)>>>24;if(0!==r&&1!==r)return{offset:i,size:t};var a=e.buffer,s=Ue(new Uint8Array(a,i+12,16)),o=e.getUint32(28),l=null,u=null;if(0===r){if(t-32<o||o<22)return{offset:i,size:t};u=new Uint8Array(a,i+32,o)}else if(1===r){if(!o||n<i+32+16*o+16)return{offset:i,size:t};l=[];for(var c=0;c<o;c++)l.push(new Uint8Array(a,i+32+16*c,16))}return{version:r,systemId:s,kids:l,data:u,offset:i,size:t}}var Rt=function(){function e(t){var i=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).removePKCS7Padding,n=void 0===i||i;if(Zm(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 r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch(a){}this.useSoftware=!this.subtle}return ey(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 i,n,r,a=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(n=(i=a).byteLength,(r=n&&new DataView(i.buffer).getUint8(n-1))?Oe(i,0,n-r):i):a}},{key:"reset",value:function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}},{key:"decrypt",value:function(e,t,i,n){var r=this;return this.useSoftware?new nb((function(a,s){var o=ArrayBuffer.isView(e)?e:new Uint8Array(e);r.softwareDecrypt(o,t,i,n);var l=r.flush();l?a(l.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}},{key:"softwareDecrypt",value:function(e,t,i,n){var r=this.currentIV,a=this.currentResult,s=this.remainderData;if(n!==De||16!==t.byteLength)return I.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),s&&(e=kt(s,e),this.remainderData=null);var o=this.getValidChunk(e);if(!o.length)return null;r&&(i=r);var l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new Me),l.expandKey(t);var u=a;return this.currentResult=l.decrypt(o.buffer,0,i),this.currentIV=Oe(o,-16).buffer,u||null}},{key:"webCryptoDecrypt",value:function(e,t,i,n){var r=this;if(this.key!==t||!this.fastAesKey){if(!this.subtle)return nb.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new Ne(this.subtle,t,n)}return this.fastAesKey.expandKey().then((function(t){return r.subtle?(r.logOnce("WebCrypto AES decrypt"),new Pe(r.subtle,new Uint8Array(i),n).decrypt(e.buffer,t)):nb.reject(new Error("web crypto not initialized"))})).catch((function(a){var s;return I.warn(Hy(s="[decrypter]: WebCrypto Error, disable WebCrypto API, ".concat(a.name,": ")).call(s,a.message)),r.onWebCryptoError(e,t,i,n)}))}},{key:"onWebCryptoError",value:function(e,t,i,n){var r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);var a=this.flush();if(a)return a.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}},{key:"getValidChunk",value:function(e){var t=e,i=e.length-e.length%16;return i!==e.length&&(t=Oe(e,0,i),this.remainderData=Oe(e,i)),t}},{key:"logOnce",value:function(e){this.logEnabled&&(I.log("[decrypter]: ".concat(e)),this.logEnabled=!1)}}]),e}(),Lt=Math.pow(2,17),It=function(){function e(t){Zm(this,e),this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}return ey(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 i=this,n=e.url;if(!n)return nb.reject(new Dt({type:l.NETWORK_ERROR,details:u.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error("Fragment does not have a "+(n?"part list":"url")),networkDetails:null}));this.abort();var r=this.config,a=r.fLoader,s=r.loader;return new nb((function(o,c){if(i.loader&&i.loader.destroy(),e.gap){var h;if(Yy(h=e.tagList).call(h,(function(e){return"GAP"===e[0]})))return void c(wt(e));e.gap=!1}var d=i.loader=a?new a(r):new s(r),f=Ct(e);e.loader=d;var v=ye(r.fragLoadPolicy.default),g={loadPolicy:v,timeout:v.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:Lt};e.stats=d.stats;var p={onSuccess:function(t,n,r,a){i.resetLoader(e,d);var s=t.data;r.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(iI(s).call(s,0,16)),s=iI(s).call(s,16)),o({frag:e,part:null,payload:s,networkDetails:a})},onError:function(t,r,a,s){var o;i.resetLoader(e,d),c(new Dt({type:l.NETWORK_ERROR,details:u.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:E({url:n,data:void 0},t),error:new Error(Hy(o="HTTP Error ".concat(t.code," ")).call(o,t.text)),networkDetails:a,stats:s}))},onAbort:function(t,n,r){i.resetLoader(e,d),c(new Dt({type:l.NETWORK_ERROR,details:u.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:r,stats:t}))},onTimeout:function(t,n,r){i.resetLoader(e,d),c(new Dt({type:l.NETWORK_ERROR,details:u.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error("Timeout after ".concat(g.timeout,"ms")),networkDetails:r,stats:t}))}};t&&(p.onProgress=function(i,n,r,a){return t({frag:e,part:null,payload:r,networkDetails:a})}),d.load(f,g,p)}))}},{key:"loadPart",value:function(e,t,i){var n=this;this.abort();var r=this.config,a=r.fLoader,s=r.loader;return new nb((function(o,c){if(n.loader&&n.loader.destroy(),e.gap||t.gap)c(wt(e,t));else{var h=n.loader=a?new a(r):new s(r),d=Ct(e,t);e.loader=h;var f=ye(r.fragLoadPolicy.default),v={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Lt};t.stats=h.stats,h.load(d,v,{onSuccess:function(r,a,s,l){n.resetLoader(e,h),n.updateStatsFromPart(e,t);var u={frag:e,part:t,payload:r.data,networkDetails:l};i(u),o(u)},onError:function(i,r,a,s){var o;n.resetLoader(e,h),c(new Dt({type:l.NETWORK_ERROR,details:u.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:E({url:d.url,data:void 0},i),error:new Error(Hy(o="HTTP Error ".concat(i.code," ")).call(o,i.text)),networkDetails:a,stats:s}))},onAbort:function(i,r,a){e.stats.aborted=t.stats.aborted,n.resetLoader(e,h),c(new Dt({type:l.NETWORK_ERROR,details:u.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:a,stats:i}))},onTimeout:function(i,r,a){n.resetLoader(e,h),c(new Dt({type:l.NETWORK_ERROR,details:u.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error("Timeout after ".concat(v.timeout,"ms")),networkDetails:a,stats:i}))}})}}))}},{key:"updateStatsFromPart",value:function(e,t){var i=e.stats,n=t.stats,r=n.total;if(i.loaded+=n.loaded,r){var a=Math.round(e.duration/t.duration),s=Math.min(Math.round(i.loaded/r),a),o=(a-s)*Math.round(i.loaded/s);i.total=i.loaded+o}else i.total=Math.max(i.loaded,i.total);var l=i.loading,u=n.loading;l.start?l.first+=u.first-u.start:(l.start=u.start,l.first=u.first),l.end=u.end}},{key:"resetLoader",value:function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}]),e}();function Ct(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=i||e,r={frag:e,part:i,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},s=n.byteRangeStartOffset,o=n.byteRangeEndOffset;if(a(s)&&a(o)){var l,u=s,c=o;if("initSegment"===e.sn&&("AES-128"===(t=null==(l=e.decryptdata)?void 0:l.method)||"AES-256"===t)){var h=o-s;h%16&&(c=o+(16-h%16)),0!==s&&(r.resetIV=!0,u=s-16)}r.rangeStart=u,r.rangeEnd=c}return r}function wt(e,t){var i=new Error("GAP ".concat(e.gap?"tag":"attribute"," found")),n={type:l.MEDIA_ERROR,details:u.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(n.part=t),(t||e).stats.aborted=!0,new Dt(n)}var Dt=function(e){Qm(i,e);var t=$m(i);function i(e){var n;return Zm(this,i),(n=t.call(this,e.error.message)).data=void 0,n.data=e,n}return ey(i)}(qm(Error)),xt=function(e){Qm(i,e);var t=$m(i);function i(e,n){var r,a;return Zm(this,i),(a=t.call(this,e,n))._boundTick=void 0,a._tickTimer=null,a._tickInterval=null,a._tickCallCount=0,a._boundTick=Iy(r=a.tick).call(r,Xm(a)),a}return ey(i,[{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=TI(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=gC(this._boundTick,0)}},{key:"doTick",value:function(){}}]),i}(S),Pt=ey((function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];Zm(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=i,this.id=n,this.size=r,this.part=a,this.partial=s})),Ot={length:0,start:function(){return 0},end:function(){return 0}},Mt=function(){function e(){Zm(this,e)}return ey(e,null,[{key:"isBuffered",value:function(t,i){if(t)for(var n=e.getBuffered(t),r=n.length;r--;)if(i>=n.start(r)&&i<=n.end(r))return!0;return!1}},{key:"bufferInfo",value:function(t,i,n){if(t){var r=e.getBuffered(t);if(r.length){for(var a=[],s=0;s<r.length;s++)a.push({start:r.start(s),end:r.end(s)});return e.bufferedInfo(a,i,n)}}return{len:0,start:i,end:i,nextStart:void 0}}},{key:"bufferedInfo",value:function(e,t,i){t=Math.max(0,t),XC(e).call(e,(function(e,t){return e.start-t.start||t.end-e.end}));var n=[];if(i)for(var r=0;r<e.length;r++){var a=n.length;if(a){var s=n[a-1].end;e[r].start-s<i?e[r].end>s&&(n[a-1].end=e[r].end):n.push(e[r])}else n.push(e[r])}else n=e;for(var o,l=0,u=t,c=t,h=0;h<n.length;h++){var d=n[h].start,f=n[h].end;if(t+i>=d&&t<f)u=d,l=(c=f)-t;else if(t+i<d){o=d;break}}return{len:l,start:u||0,end:c||0,nextStart:o}}},{key:"getBuffered",value:function(e){try{return e.buffered||Ot}catch(t){return I.log("failed to get media.buffered",t),Ot}}}]),e}(),Nt=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ft(e){return Nt.test(e)}function Ut(e,t){if(null!==e.variableList||e.hasVariableRefs){var i=e.variableList;return t.replace(Nt,(function(t){var n=t.substring(2,t.length-1),r=null==i?void 0:i[n];return void 0===r?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'.concat(n,'"'))),t):r}))}return t}function Bt(e,t,i){var n,r,a=e.variableList;if(a||(e.variableList=a={}),"QUERYPARAM"in t){n=t.QUERYPARAM;try{var s,o=new tI(i).searchParams;if(!o.has(n))throw new Error(Hy(s='"'.concat(n,'" does not match any query parameter in URI: "')).call(s,i,'"'));r=o.get(n)}catch(l){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: ".concat(l.message)))}}else n=t.NAME,r=t.VALUE;n in a?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'.concat(n,'"'))):a[n]=r||""}function Ht(e,t,i){var n=t.IMPORT;if(i&&n in i){var r=e.variableList;r||(e.variableList=r={}),r[n]=i[n]}else e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'.concat(n,'"')))}var Gt=/^(\d+)x(\d+)$/,Vt=/(.+?)=(".*?"|.*?)(?:,|$)/g,Kt=function(){function e(t,i){Zm(this,e),"string"==typeof t&&(t=e.parseAttrList(t,i)),k(this,t)}return ey(e,[{key:"clientAttrs",get:function(){var e;return Dy(e=Cy(this)).call(e,(function(e){return"X-"===e.substring(0,2)}))}},{key:"decimalInteger",value:function(e){var t=Zk(this[e],10);return t>cy?1/0:t}},{key:"hexadecimalInteger",value:function(e){if(this[e]){var t,i=iI(t=this[e]||"0x").call(t,2);i=(1&i.length?"0":"")+i;for(var n=new Uint8Array(i.length/2),r=0;r<i.length/2;r++)n[r]=Zk(iI(i).call(i,2*r,2*r+2),16);return n}return null}},{key:"hexadecimalIntegerAsNumber",value:function(e){var t=Zk(this[e],16);return t>cy?1/0:t}},{key:"decimalFloatingPoint",value:function(e){return Tb(this[e])}},{key:"optionalFloat",value:function(e,t){var i=this[e];return i?Tb(i):t}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"enumeratedStringList",value:function(e,t){var i,n=this[e];return ok(i=n?n.split(/[ ,]+/):[]).call(i,(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=Gt.exec(this[e]);if(null!==t)return{width:Zk(t[1],10),height:Zk(t[2],10)}}}],[{key:"parseAttrList",value:function(e,t){var i,n,r={};for(Vt.lastIndex=0;null!==(n=Vt.exec(e));){var a,s=WI(a=n[1]).call(a),o=n[2],l=0===zy(o).call(o,'"')&&aC(o).call(o,'"')===o.length-1,u=!1;if(l)o=iI(o).call(o,1,-1);else switch(s){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(l||u))o=Ut(t,o);else if(!u&&!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":I.warn(Hy(i="".concat(e,": attribute ")).call(i,s," is missing quotes"))}r[s]=o}return r}}]),e}();function Wt(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e||"SCTE35-CMD"===e}var jt=function(){function e(t,i){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(Zm(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==i?void 0:i.tagAnchor)||null,this.tagOrder=null!=(n=null==i?void 0:i.tagOrder)?n:r,i){var s=i.attr;for(var o in s)if(Object.prototype.hasOwnProperty.call(t,o)&&t[o]!==s[o]){var l;I.warn(Hy(l='DATERANGE tag attribute: "'.concat(o,'" does not match for tags with ID: "')).call(l,t.ID,'"')),this._badValueForSameId=o;break}t=k(new Kt({}),s,t)}if(this.attr=t,i?(this._startDate=i._startDate,this._cue=i._cue,this._endDate=i._endDate,this._dateAtEnd=i._dateAtEnd):this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){var u=(null==i?void 0:i.endDate)||new Date(this.attr["END-DATE"]);a(u.getTime())&&(this._endDate=u)}}return ey(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?(I.warn(Hy(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(a(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&&a(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}(),Yt=function(){function e(t){Zm(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 ey(e,[{key:"reloaded",value:function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}},{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&a(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(JC()-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 i=e.length;i--;)if(e[i].index>t)return e[i].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 zt(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function qt(e){switch(e){case"AES-128":case"AES-256":return De;case"AES-256-CTR":return xe;default:throw new Error("invalid full segment method ".concat(e))}}function Xt(e){return Uint8Array.from(atob(e),(function(e){return e.charCodeAt(0)}))}function Qt(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(function(e){return e.charCodeAt(0)}))}function $t(e){var t,i,n=e.split(":"),r=null;if("data"===n[0]&&2===n.length){var a=n[1].split(";"),s=a[a.length-1].split(",");if(2===s.length){var o="base64"===s[0],l=s[1];o?(mw(a).call(a,-1,1),r=Xt(l)):(t=Qt(l).subarray(0,16),(i=new Uint8Array(16)).set(t,16-t.length),r=i)}}return r}var Zt="undefined"!=typeof self?self:void 0,Jt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ei={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function ti(e){switch(e){case ei.FAIRPLAY:return Jt.FAIRPLAY;case ei.PLAYREADY:return Jt.PLAYREADY;case ei.WIDEVINE:return Jt.WIDEVINE;case ei.CLEARKEY:return Jt.CLEARKEY}}var ii="1077efecc0b24d02ace33c1e52e2fb4b",ni="e2719d58a985b3c9781ab030af78d30e",ri="9a04f07998404286ab92e65be0885f95",ai="edef8ba979d64acea3c827dcd51d21ed";function si(e){return e===ai?Jt.WIDEVINE:e===ri?Jt.PLAYREADY:e===ii||e===ni?Jt.CLEARKEY:void 0}function oi(e){switch(e){case Jt.FAIRPLAY:return ei.FAIRPLAY;case Jt.PLAYREADY:return ei.PLAYREADY;case Jt.WIDEVINE:return ei.WIDEVINE;case Jt.CLEARKEY:return ei.CLEARKEY}}function li(e){var t,i=e.drmSystems,n=e.widevineLicenseUrl,r=i?Dy(t=[Jt.FAIRPLAY,Jt.WIDEVINE,Jt.PLAYREADY,Jt.CLEARKEY]).call(t,(function(e){return!!i[e]})):[];return!r[Jt.WIDEVINE]&&n&&r.push(Jt.WIDEVINE),r}var ui,ci=null!=Zt&&null!=(ui=Zt.navigator)&&ui.requestMediaKeySystemAccess?Iy(i=self.navigator.requestMediaKeySystemAccess).call(i,self.navigator):null;function hi(e){var t,i,n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),r=String.fromCharCode.apply(null,yw(n)),a=r.substring(zy(r).call(r,"<"),r.length),s=(new DOMParser).parseFromString(a,"text/xml").getElementsByTagName("KID")[0];if(s){var o=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(o){var l=Xt(o).subarray(0,16);return(i=function(e,t,i){var n=e[t];e[t]=e[i],e[i]=n})(t=l,0,3),i(t,1,2),i(t,4,5),i(t,6,7),l}}return null}var di={},fi=function(){function e(t,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[1],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;Zm(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=i,this.keyFormat=n,this.keyFormatVersions=r,this.iv=a,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&!zt(t)}return ey(e,[{key:"isSupported",value:function(){var e;if(this.method){if(zt(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case ei.FAIRPLAY:case ei.WIDEVINE:case ei.PLAYREADY:case ei.CLEARKEY:return-1!==zy(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(zt(this.method)&&this.uri&&!this.iv){"number"!=typeof t&&(I.warn('missing IV for initialization segment with method="'.concat(this.method,'" - compliance issue')),t=0);var i=function(e){for(var t=new Uint8Array(16),i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t}(t);return new e(this.method,this.uri,"identity",this.keyFormatVersions,i)}var n=$t(this.uri);if(n)switch(this.keyFormat){case ei.WIDEVINE:this.pssh=n,n.length>=22&&(this.keyId=n.subarray(n.length-22,n.length-6));break;case ei.PLAYREADY:var r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=bt(r,0,n),this.keyId=hi(n);break;default:var a=n.subarray(0,16);if(16!==a.length){var s=new Uint8Array(16);s.set(a,16-a.length),a=s}this.keyId=a}if(!this.keyId||16!==this.keyId.byteLength){var o=di[this.uri];if(!o){var l=Cy(di).length%cy;o=new Uint8Array(16),new DataView(o.buffer,12,4).setUint32(0,l),di[this.uri]=o}this.keyId=o}return this}}],[{key:"clearKeyUriToKeyIdMap",value:function(){di={}}}]),e}(),vi=/#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,gi=/#EXT-X-MEDIA:(.*)/g,pi=/^#EXT(?:INF|-X-TARGETDURATION):/m,mi=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),yi=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("|")),ki=function(){function e(){Zm(this,e)}return ey(e,null,[{key:"findGroup",value:function(e,t){for(var i=0;i<e.length;i++){var n=e[i];if(n.id===t)return n}}},{key:"resolve",value:function(e,t){return Ye.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}},{key:"isMediaPlaylist",value:function(e){return pi.test(e)}},{key:"parseMasterPlaylist",value:function(t,i){var n,r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Ft(t)},a=[];for(vi.lastIndex=0;null!=(n=vi.exec(t));)if(n[1]){var s,o=new Kt(n[1],r),l=Ut(r,n[2]),u={attrs:o,bitrate:o.decimalInteger("BANDWIDTH")||o.decimalInteger("AVERAGE-BANDWIDTH"),name:o.NAME,url:e.resolve(l,i)},c=o.decimalResolution("RESOLUTION");c&&(u.width=c.width,u.height=c.height),bi(o.CODECS,u),null!=(s=u.unknownCodecs)&&s.length||a.push(u),r.levels.push(u)}else if(n[3]){var h=n[3],d=n[4];switch(h){case"SESSION-DATA":var f=new Kt(d,r),v=f["DATA-ID"];v&&(null===r.sessionData&&(r.sessionData={}),r.sessionData[v]=f);break;case"SESSION-KEY":var g=Si(d,i,r);g.encrypted&&g.isSupported()?(null===r.sessionKeys&&(r.sessionKeys=[]),r.sessionKeys.push(g)):I.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'.concat(d,'"'));break;case"DEFINE":Bt(r,new Kt(d,r),i);break;case"CONTENT-STEERING":var p=new Kt(d,r);r.contentSteering={uri:e.resolve(p["SERVER-URI"],i),pathwayId:p["PATHWAY-ID"]||"."};break;case"START":r.startTimeOffset=_i(d)}}var m=a.length>0&&a.length<r.levels.length;return r.levels=m?a:r.levels,0===r.levels.length&&(r.playlistParsingError=new Error("no levels found in manifest")),r}},{key:"parseMasterPlaylistMedia",value:function(t,i,n){var r,a={},s=n.levels,o={AUDIO:ub(s).call(s,(function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),SUBTITLES:ub(s).call(s,(function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),"CLOSED-CAPTIONS":[]},l=0;for(gi.lastIndex=0;null!==(r=gi.exec(t));){var u=new Kt(r[1],n),c=u.TYPE;if(c){var h=o[c],d=a[c]||[];a[c]=d;var f=u.LANGUAGE,v=u["ASSOC-LANGUAGE"],g=u.CHANNELS,p=u.CHARACTERISTICS,m=u["INSTREAM-ID"],y={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",name:u.NAME||f||"",type:c,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:f,url:u.URI?e.resolve(u.URI,i):""};if(v&&(y.assocLang=v),g&&(y.channels=g),p&&(y.characteristics=p),m&&(y.instreamId=m),null!=h&&h.length){var k=e.findGroup(h,y.groupId)||h[0];Ai(y,k,"audioCodec"),Ai(y,k,"textCodec")}d.push(y)}}return a}},{key:"parseLevelPlaylist",value:function(e,t,i,n,r,s){var o,l,u,c={url:t},h=new Yt(t),d=h.fragments,f=[],v=null,g=0,p=0,m=0,y=0,T=0,E=null,S=new Je(n,c),_=-1,b=!1,A=null;for(mi.lastIndex=0,h.m3u8=e,h.hasVariableRefs=Ft(e);null!==(o=mi.exec(e));){b&&(b=!1,(S=new Je(n,c)).playlistOffset=m,S.start=m,S.sn=g,S.cc=y,T&&(S.bitrate=T),S.level=i,v&&(S.initSegment=v,v.rawProgramDateTime&&(S.rawProgramDateTime=v.rawProgramDateTime,v.rawProgramDateTime=null),A&&(S.setByteRange(A),A=null)));var R=o[1];if(R){var L;S.duration=Tb(R);var C=iI(L=" "+o[2]).call(L,1);S.title=C||null,S.tagList.push(C?["INF",R,C]:["INF",R])}else if(o[3]){if(a(S.duration)){var w;S.playlistOffset=m,S.start=m,u&&Ii(S,u,h),S.sn=g,S.level=i,S.cc=y,d.push(S);var D=iI(w=" "+o[3]).call(w,1);S.relurl=Ut(h,D),Ri(S,E,f),E=S,m+=S.duration,g++,p=0,b=!0}}else{var x,P,O;if(!(o=o[0].match(yi))){I.warn("No matches on slow regex match for level playlist!");continue}for(l=1;l<o.length&&void 0===o[l];l++);var M=iI(x=" "+o[l]).call(x,1),N=iI(P=" "+o[l+1]).call(P,1),F=o[l+2]?iI(O=" "+o[l+2]).call(O,1):null;switch(M){case"BYTERANGE":E?S.setByteRange(N,E):S.setByteRange(N);break;case"PROGRAM-DATE-TIME":S.rawProgramDateTime=N,S.tagList.push(["PROGRAM-DATE-TIME",N]),-1===_&&(_=d.length);break;case"PLAYLIST-TYPE":h.type=N.toUpperCase();break;case"MEDIA-SEQUENCE":g=h.startSN=Zk(N);break;case"SKIP":var U;h.skippedSegments&&(h.playlistParsingError=new Error("#EXT-X-SKIP MUST NOT appear more than once in a Playlist"));var B=new Kt(N,h),H=B.decimalInteger("SKIPPED-SEGMENTS");if(a(H)){h.skippedSegments+=H;for(var G=H;G--;)d.push(null);g+=H}var V=B.enumeratedString("RECENTLY-REMOVED-DATERANGES");V&&(h.recentlyRemovedDateranges=Hy(U=h.recentlyRemovedDateranges||[]).call(U,V.split("\t")));break;case"TARGETDURATION":h.targetduration=Math.max(Zk(N),1);break;case"VERSION":h.version=Zk(N);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"#":(N||F)&&S.tagList.push(F?[N,F]:[N]);break;case"DISCONTINUITY":y++,S.tagList.push(["DIS"]);break;case"GAP":S.gap=!0,S.tagList.push([M]);break;case"BITRATE":S.tagList.push([M,N]),T=1e3*Zk(N),a(T)?S.bitrate=T:T=0;break;case"DATERANGE":var K=new Kt(N,h),W=new jt(K,h.dateRanges[K.ID],h.dateRangeTagCount);h.dateRangeTagCount++,W.isValid||h.skippedSegments?h.dateRanges[W.id]=W:I.warn('Ignoring invalid DATERANGE tag: "'.concat(N,'"')),S.tagList.push(["EXT-X-DATERANGE",N]);break;case"DEFINE":var j=new Kt(N,h);"IMPORT"in j?Ht(h,j,s):Bt(h,j,t);break;case"DISCONTINUITY-SEQUENCE":h.startCC=y=Zk(N);break;case"KEY":var Y=Si(N,t,h);if(Y.isSupported()){if("NONE"===Y.method){u=void 0;break}u||(u={}),u[Y.keyFormat]&&(u=k({},u)),u[Y.keyFormat]=Y}else I.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'.concat(N,'"'));break;case"START":h.startTimeOffset=_i(N);break;case"MAP":var z=new Kt(N,h);if(S.duration){var q=new Je(n,c);Li(q,z,i,u),v=q,S.initSegment=v,v.rawProgramDateTime&&!S.rawProgramDateTime&&(S.rawProgramDateTime=v.rawProgramDateTime)}else{var X=S.byteRangeEndOffset;if(X){var Q,$=S.byteRangeStartOffset;A=Hy(Q="".concat(X-$,"@")).call(Q,$)}else A=null;Li(S,z,i,u),v=S,b=!0}v.cc=y;break;case"SERVER-CONTROL":var Z=new Kt(N);h.canBlockReload=Z.bool("CAN-BLOCK-RELOAD"),h.canSkipUntil=Z.optionalFloat("CAN-SKIP-UNTIL",0),h.canSkipDateRanges=h.canSkipUntil>0&&Z.bool("CAN-SKIP-DATERANGES"),h.partHoldBack=Z.optionalFloat("PART-HOLD-BACK",0),h.holdBack=Z.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var J=new Kt(N);h.partTarget=J.decimalFloatingPoint("PART-TARGET");break;case"PART":var ee=h.partList;ee||(ee=h.partList=[]);var te=p>0?ee[ee.length-1]:void 0,ie=p++,ne=new Kt(N,h),re=new et(ne,S,c,ie,te);ee.push(re),S.duration+=re.duration;break;case"PRELOAD-HINT":var ae=new Kt(N,h);h.preloadHint=ae;break;case"RENDITION-REPORT":var se=new Kt(N,h);h.renditionReports=h.renditionReports||[],h.renditionReports.push(se);break;default:I.warn("line parsed but not handled: ".concat(o))}}}E&&!E.relurl?(d.pop(),m-=E.duration,h.partList&&(h.fragmentHint=E)):h.partList&&(Ri(S,E,f),S.cc=y,h.fragmentHint=S,u&&Ii(S,u,h));var oe=d.length,le=d[0],ue=d[oe-1];if((m+=h.skippedSegments*h.targetduration)>0&&oe&&ue){h.averagetargetduration=m/oe;var ce=ue.sn;h.endSN="initSegment"!==ce?ce:0,h.live||(ue.endList=!0),le&&!h.startCC&&(h.startCC=le.cc),_>0&&(function(e,t){for(var i=e[t],n=t;n--;){var r=e[n];if(!r)return;r.programDateTime=i.programDateTime-1e3*r.duration,i=r}}(d,_),le&&f.unshift(le))}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(m+=h.fragmentHint.duration),h.totalduration=m,f.length&&h.dateRangeTagCount&&le&&Ti(f,h),h.endCC=y,h}}]),e}();function Ti(e,t){for(var i=e.length,n=e[i-1],r=t.live?1/0:t.totalduration,a=Cy(t.dateRanges),s=a.length;s--;){var o=t.dateRanges[a[s]],l=o.startDate.getTime();o.tagAnchor=n.ref;for(var u=i;u--;){var c=Ei(t,l,e,u,r);if(-1!==c){o.tagAnchor=t.fragments[c].ref;break}}}}function Ei(e,t,i,n,r){var a=i[n];if(a){var s,o=a.programDateTime;if((t>=o||0===n)&&t<=o+1e3*(((null==(s=i[n+1])?void 0:s.start)||r)-a.start)){var l=i[n].sn-e.startSN,u=e.fragments;if(u.length>i.length)for(var c=(i[n+1]||u[u.length-1]).sn-e.startSN;c>l;c--){var h=u[c].programDateTime;if(t>=h&&t<h+1e3*u[c].duration)return c}return l}}return-1}function Si(e,t,i){var n,r,a,s,o=new Kt(e,i),l=null!=(a=o.METHOD)?a:"",u=o.URI,c=o.hexadecimalInteger("IV"),h=o.KEYFORMATVERSIONS,d=null!=(s=o.KEYFORMAT)?s:"identity";u&&o.IV&&!c&&I.error("Invalid IV: ".concat(o.IV));var f=u?ki.resolve(u,t):"",v=Dy(n=ub(r=(h||"1").split("/")).call(r,Number)).call(n,iy);return new fi(l,f,d,v,c)}function _i(e){var t=new Kt(e).decimalFloatingPoint("TIME-OFFSET");return a(t)?t:null}function bi(e,t){var i,n,r=Dy(i=(e||"").split(/[ ,]+/)).call(i,(function(e){return e}));Py(n=["video","audio","text"]).call(n,(function(e){var i=Dy(r).call(r,(function(t){return i=t,!!(n=D[e])&&!!n[iI(i).call(i,0,4)];var i,n}));i.length&&(t["".concat(e,"Codec")]=i.join(","),r=Dy(r).call(r,(function(e){return-1===zy(i).call(i,e)})))})),t.unknownCodecs=r}function Ai(e,t,i){var n=t[i];n&&(e[i]=n)}function Ri(e,t,i){e.rawProgramDateTime?i.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function Li(e,t,i,n){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",n&&(e.levelkeys=n),e.initSegment=null}function Ii(e,t,i){var n;e.levelkeys=t;var r=i.encryptedFragments;r.length&&r[r.length-1].levelkeys===t||!Yy(n=Cy(t)).call(n,(function(e){return t[e].isCommonEncryption}))||r.push(e)}function Ci(e,t){var i=t.startPTS;if(a(i)){var n,r=0;t.sn>e.sn?(r=i-e.start,n=e):(r=e.start-i,n=t),n.duration!==r&&n.setDuration(r)}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 wi(e,t,i,n,r,s){n-i<=0&&(I.warn("Fragment should have a positive duration",t),n=i+t.duration,s=r+t.duration);var o=i,l=n,u=t.startPTS,c=t.endPTS;if(a(u)){var h=Math.abs(u-i);a(t.deltaPTS)?t.deltaPTS=Math.max(h,t.deltaPTS):t.deltaPTS=h,o=Math.max(i,u),i=Math.min(i,u),r=Math.min(r,t.startDTS),l=Math.min(n,c),n=Math.max(n,c),s=Math.max(s,t.endDTS)}var d=i-t.start;0!==t.start&&t.setStart(i),t.setDuration(n-t.start),t.startPTS=i,t.maxStartPTS=o,t.startDTS=r,t.endPTS=n,t.minEndPTS=l,t.endDTS=s;var f,v=t.sn;if(!e||v<e.startSN||v>e.endSN)return 0;var g=v-e.startSN,p=e.fragments;for(p[g]=t,f=g;f>0;f--)Ci(p[f],p[f-1]);for(f=g;f<p.length-1;f++)Ci(p[f],p[f+1]);return e.fragmentHint&&Ci(p[p.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,d}function Di(e,t){for(var i,n,r=null,s=e.fragments,o=s.length-1;o>=0;o--){var l=s[o].initSegment;if(l){r=l;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var u,c=0;!function(e,t,i,n,r){for(var a=t.skippedSegments,s=Math.max(e.startSN,t.startSN)-t.startSN,o=(e.fragmentHint?1:0)+(a?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,l=t.startSN-e.startSN,u=t.fragmentHint?Hy(n=t.fragments).call(n,t.fragmentHint):t.fragments,c=e.fragmentHint?Hy(r=e.fragments).call(r,e.fragmentHint):e.fragments,h=s;h<=o;h++){var d=c[l+h],f=u[h];a&&!f&&d&&(f=t.fragments[h]=d),d&&f&&i(d,f)}}(e,t,(function(e,i){e.relurl&&(c=e.cc-i.cc),a(e.startPTS)&&a(e.endPTS)&&(i.setStart(i.startPTS=e.startPTS),i.startDTS=e.startDTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.setDuration(e.endPTS-e.startPTS),i.duration&&(u=i),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(i.elementaryStreams=e.elementaryStreams),i.loader=e.loader,e.hasStats&&(i.stats=e.stats),e.initSegment&&(i.initSegment=e.initSegment,r=e.initSegment)}));var h=t.fragmentHint?Hy(i=t.fragments).call(i,t.fragmentHint):t.fragments;if(r&&Py(h).call(h,(function(e){var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=r)?void 0:t.relurl)||(e.initSegment=r)})),t.skippedSegments)if(t.deltaUpdateFailed=Yy(n=t.fragments).call(n,(function(e){return!e})),t.deltaUpdateFailed){I.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=t.skippedSegments;d--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC||(t.startCC=t.fragments[0].cc)}else{var f;t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){var n=t.dateRanges,r=t.recentlyRemovedDateranges,a=k({},e);r&&Py(r).call(r,(function(e){delete a[e]}));var s=Cy(a).length;return s&&Py(i=Cy(n)).call(i,(function(e){var t=a[e],i=new jt(n[e].attr,t);i.isValid?(a[e]=i,t||(i.tagOrder+=s)):I.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'.concat(bI(n[e].attr),'"'))})),a}(e.dateRanges,t));var v=Dy(f=e.fragments).call(f,(function(e){return e.rawProgramDateTime}));if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(var g=1;g<h.length;g++)null===h[g].programDateTime&&Ri(h[g],h[g-1],v);Ti(v,t)}var p=t.fragments;if(c){I.warn("discontinuity sliding from playlist, take drift into account");for(var m=0;m<p.length;m++)p[m].cc+=c}t.skippedSegments&&(t.startCC=t.fragments[0].cc),function(e,t,i){if(e&&t)for(var n=0,r=0,a=e.length;r<=a;r++){var s=e[r],o=t[r+n];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?i(s,o):n--}}(e.partList,t.partList,(function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),u?wi(t,u,u.startPTS,u.endPTS,u.startDTS,u.endDTS):xi(e,t),p.length&&(t.totalduration=t.edge-p[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;var y=t.advancedDateTime;if(t.advanced&&y){var T=t.edge;t.driftStart||(t.driftStartTime=y,t.driftStart=T),t.driftEndTime=y,t.driftEnd=T}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}function xi(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=t.startSN+t.skippedSegments-e.startSN,r=e.fragments,a=n>=0,s=0;if(a&&n<r.length)s=r[n].start;else if(a&&t.startSN===e.endSN+1)s=e.fragmentEnd;else if(a&&i)s=e.fragmentStart+n*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return;s=e.fragmentStart}Pi(t,s)}function Pi(e,t){if(t){for(var i=e.fragments,n=e.skippedSegments;n<i.length;n++)i[n].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}function Oi(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0,i=1e3*e.targetduration;if(e.updated){var n=e.fragments,r=4;if(n.length&&i*r>t){var a=1e3*n[n.length-1].duration;a<i&&(i=a)}}else i/=2;return Math.round(i)}function Mi(e,t,i){return e?Ni(e.partList,t,i):null}function Ni(e,t,i){if(e)for(var n=e.length;n--;){var r=e[n];if(r.index===i&&r.fragment.sn===t)return r}return null}function Fi(e){Py(e).call(e,(function(e,t){var i,n=null==(i=e.details)?void 0:i.fragments;n&&Py(n).call(n,(function(e){e.level=t,e.initSegment&&(e.initSegment.level=t)}))}))}function Ui(e,t){for(var i=0,n=e.length;i<n;i++){var r;if((null==(r=e[i])?void 0:r.cc)===t)return e[i]}return null}function Bi(e,t){if(e){var i=e.start+t;e.start=e.startPTS=i,e.endPTS=i+e.duration}}function Hi(e,t){for(var i=t.fragments,n=0,r=i.length;n<r;n++)Bi(i[n],e);t.fragmentHint&&Bi(t.fragmentHint,e),t.alignedSliding=!0}function Gi(e,t){if(n=e,(i=t)&&n.startCC<i.endCC&&n.endCC>i.startCC){var i,n,r=Math.min(t.endCC,e.endCC),a=Ui(t.fragments,r),s=Ui(e.fragments,r);a&&s&&(I.log("Aligning playlist at start of dicontinuity sequence ".concat(r)),Hi(a.start-s.start,e))}}function Vi(e,t){if(e.hasProgramDateTime&&t.hasProgramDateTime){var i=e.fragments,n=t.fragments;if(i.length&&n.length){var r,a,s=Math.min(t.endCC,e.endCC);t.startCC<s&&e.startCC<s&&(r=Ui(n,s),a=Ui(i,s)),r&&a||(a=Ui(i,(r=n[Math.floor(n.length/2)]).cc)||i[Math.floor(i.length/2)]);var o=r.programDateTime,l=a.programDateTime;o&&l&&Hi((l-o)/1e3-(a.start-r.start),e)}}}var Ki=function(e){for(var t="",i=e.length,n=0;n<i;n++){var r;t+=Hy(r="[".concat(e.start(n).toFixed(3),"-")).call(r,e.end(n).toFixed(3),"]")}return t},Wi="STOPPED",ji="IDLE",Yi="KEY_LOADING",zi="FRAG_LOADING",qi="FRAG_LOADING_WAITING_RETRY",Xi="WAITING_TRACK",Qi="PARSING",$i="PARSED",Zi="ENDED",Ji="ERROR",en="WAITING_INIT_PTS",tn="WAITING_LEVEL",nn=function(e){Qm(i,e);var t=$m(i);function i(e,n,r,s,o){var l;return Zm(this,i),(l=t.call(this,s,e.logger)).hls=void 0,l.fragPrevious=null,l.fragCurrent=null,l.fragmentTracker=void 0,l.transmuxer=null,l._state=Wi,l.playlistType=void 0,l.media=null,l.mediaBuffer=null,l.config=void 0,l.bitrateTest=!1,l.lastCurrentTime=0,l.nextLoadPosition=0,l.startPosition=0,l.startTimeOffset=null,l.retryDate=0,l.levels=null,l.fragmentLoader=void 0,l.keyLoader=void 0,l.levelLastLoaded=null,l.startFragRequested=!1,l.decrypter=void 0,l.initPTS=[],l.buffering=!0,l.loadingParts=!1,l.loopSn=void 0,l.onMediaSeeking=function(){var e,t=Xm(l),i=t.config,n=t.fragCurrent,r=t.media,s=t.mediaBuffer,o=t.state,u=r?r.currentTime:0,c=Mt.bufferInfo(s||r,u,i.maxBufferHole);if(l.log(Hy(e="media seeking to ".concat(a(u)?u.toFixed(3):u,", state: ")).call(e,o)),l.state===Zi)l.resetLoadingState();else if(n){var h=i.maxFragLookUpTolerance,d=n.start-h,f=n.start+n.duration+h;if(!c.len||f<c.start||d>c.end){var v=u>f;(u<d||v)&&(v&&n.loader&&(l.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),n.abortRequests(),l.resetLoadingState()),l.fragPrevious=null)}}if(r&&(l.fragmentTracker.removeFragmentsInRange(u,1/0,l.playlistType,!0),u>l.lastCurrentTime&&(l.lastCurrentTime=u),!l.loadingParts)){var g,p=Math.max(c.end,u),m=l.shouldLoadParts(l.getLevelDetails(),p);m&&(l.log(Hy(g="LL-Part loading ON after seeking to ".concat(u.toFixed(2)," with buffer @")).call(g,p.toFixed(2))),l.loadingParts=m)}l.hls.hasEnoughToStart||c.len||(l.log("setting startPosition to ".concat(u," because of seek before start")),l.nextLoadPosition=l.startPosition=u),l.tickImmediate()},l.onMediaEnded=function(){l.log("setting startPosition to 0 because media ended"),l.startPosition=l.lastCurrentTime=0,l.triggerEnded()},l.playlistType=o,l.hls=e,l.fragmentLoader=new It(e.config),l.keyLoader=r,l.fragmentTracker=n,l.config=e.config,l.decrypter=new Rt(e.config),l}return ey(i,[{key:"registerListeners",value:function(){var e=this.hls;e.on(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(c.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(c.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!==Wi){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=Wi}}},{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 i=void 0!==this.config.timelineOffset,n=e.nextStart,r=n&&(!i||n<t.edge);if(t.live||r||!e.end||!this.media)return!1;var a=t.partList;if(null!=a&&a.length){var s=a[a.length-1];return Mt.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 i=this.media=this.mediaBuffer=t.media;i.removeEventListener("seeking",this.onMediaSeeking),i.removeEventListener("ended",this.onMediaEnded),i.addEventListener("seeking",this.onMediaSeeking),i.addEventListener("ended",this.onMediaEnded);var n=this.config;this.levels&&n.autoStartLoad&&this.state===Wi&&this.startLoad(n.startPosition)}},{key:"onMediaDetaching",value:function(e,t){var i=!!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&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i?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),ev(Jf(i.prototype),"onHandlerDestroying",this).call(this),this.hls=this.onMediaSeeking=this.onMediaEnded=null}},{key:"onHandlerDestroyed",value:function(){this.state=Wi,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,ev(Jf(i.prototype),"onHandlerDestroyed",this).call(this)}},{key:"loadFragment",value:function(e,t,i){var n=this.hls.config;if(n.interstitialsController&&!1!==n.enableInterstitialPlayback&&e.type!==g.SUBTITLE){var r=this.hls.interstitialsManager,a=null==r?void 0:r.bufferingItem;if(a){var s=a.event;if(s){if(s.appendInPlace||Math.abs(e.start-a.start)>1||0===a.start)return}else{var o;if(e.end<=a.start&&!1===(null==(o=t.details)?void 0:o.live))return;if(e.start>a.end&&a.nextEvent)return}}}this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}},{key:"_loadFragForPlayback",value:function(e,t,i){var n=this;this._doFragLoad(e,t,i,(function(e){var t,i,r,a=e.frag;if(n.fragContextChanged(a))return n.warn(Hy(t=Hy(i=Hy(r="".concat(a.type," sn: ")).call(r,a.sn)).call(i,e.part?" part: "+e.part.index:""," of ")).call(t,n.fragInfo(a,!1,e.part),") was dropped during download.")),void n.fragmentTracker.removeFragment(a);a.stats.chunkCount++,n._handleFragmentLoadProgress(e)})).then((function(e){var t,i,r;if(e){var a=n.state,s=e.frag;n.fragContextChanged(s)?(a===zi||!n.fragCurrent&&a===Qi)&&(n.fragmentTracker.removeFragment(s),n.state=ji):("payload"in e&&(n.log(Hy(t=Hy(i=Hy(r="Loaded ".concat(s.type," sn: ")).call(r,s.sn," of ")).call(i,n.playlistLabel()," ")).call(t,s.level)),n.hls.trigger(c.FRAG_LOADED,e)),n._handleFragmentLoadComplete(e))}})).catch((function(t){n.state!==Wi&&n.state!==Ji&&(n.warn("Frag error: ".concat((null==t?void 0:t.message)||t)),n.resetFragmentLoading(e))}))}},{key:"clearTrackerIfNeeded",value:function(e){var t,i=this.fragmentTracker;if(i.getState(e)===Ae){var n=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,n),a=Math.max(e.duration,r?r.len:this.config.maxBufferLength),s=this.backtrackFragment;(1==(s?e.sn-s.sn:0)||this.reduceMaxBufferLength(a,e.duration))&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Re&&i.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 i={startOffset:e,endOffset:t,type:arguments.length>2&&void 0!==arguments[2]?arguments[2]:null};this.hls.trigger(c.BUFFER_FLUSHING,i)}}},{key:"_loadInitSegment",value:function(e,t){var i=this;this._doFragLoad(e,t).then((function(e){var t=null==e?void 0:e.frag;if(!t||i.fragContextChanged(t)||!i.levels)throw new Error("init load aborted");return e})).then((function(e){var t=i.hls,n=e.frag,r=e.payload,a=n.decryptdata;if(r&&r.byteLength>0&&null!=a&&a.key&&a.iv&&zt(a.method)){var s=self.performance.now();return i.decrypter.decrypt(new Uint8Array(r),a.key.buffer,a.iv.buffer,qt(a.method)).catch((function(e){throw t.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:n}),e})).then((function(r){var a=self.performance.now();return t.trigger(c.FRAG_DECRYPTED,{frag:n,payload:r,stats:{tstart:s,tdecrypt:a}}),e.payload=r,i.completeInitSegmentLoad(e)}))}return i.completeInitSegmentLoad(e)})).catch((function(t){i.state!==Wi&&i.state!==Ji&&(i.warn(t),i.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!==Wi&&(this.state=ji),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 i,n,r,a,s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(Hy(i=Hy(n=Hy(r=Hy(a="Buffered ".concat(e.type," sn: ")).call(a,e.sn)).call(r,t?" part: "+t.index:""," of ")).call(n,this.fragInfo(e,!1,t)," > buffer:")).call(i,s?Ki(Mt.getBuffered(s)):"(detached)",")")),Ze(e)){var o;if(e.type!==g.SUBTITLE){var l,u=e.elementaryStreams;if(!Yy(l=Cy(u)).call(l,(function(e){return!!u[e]})))return void(this.state=ji)}var c=null==(o=this.levels)?void 0:o[e.level];null!=c&&c.fragmentError&&(this.log("Resetting level fragment error count of ".concat(c.fragmentError," on frag buffered")),c.fragmentError=0)}this.state=ji}},{key:"_handleFragmentLoadComplete",value:function(e){var t=this.transmuxer;if(t){var i=e.frag,n=e.part,r=e.partsLoaded,a=!r||0===r.length||Yy(r).call(r,(function(e){return!e})),s=new Pt(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!a);t.flush(s)}}},{key:"_handleFragmentLoadProgress",value:function(e){}},{key:"_doFragLoad",value:function(e,t){var i,n,r,s,o,l,u,h,d,f,v=this,g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,p=arguments.length>3?arguments[3]:void 0;this.fragCurrent=e;var m=null==t?void 0:t.details;if(!this.levels||!m)throw new Error("frag load aborted, missing level".concat(m?"":" detail","s"));var y=null;!e.encrypted||null!=(f=e.decryptdata)&&f.key?!e.encrypted&&m.encryptedFragments.length&&this.keyLoader.loadClear(e,m.encryptedFragments):(this.log(Hy(i=Hy(n=Hy(r=Hy(s="Loading key for ".concat(e.sn," of [")).call(s,m.startSN,"-")).call(r,m.endSN,"], ")).call(n,this.playlistLabel()," ")).call(i,e.level)),this.state=Yi,this.fragCurrent=e,y=this.keyLoader.load(e).then((function(e){if(!v.fragContextChanged(e.frag))return v.hls.trigger(c.KEY_LOADED,e),v.state===Yi&&(v.state=ji),e})),this.hls.trigger(c.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(y=nb.reject(new Error("frag load aborted, context changed in KEY_LOADING"))));var k=this.fragPrevious;if(Ze(e)&&(!k||e.sn!==k.sn)){var T,E,S=this.shouldLoadParts(t.details,e.end);S!==this.loadingParts&&(this.log(Hy(T=Hy(E="LL-Part loading ".concat(S?"ON":"OFF"," loading sn ")).call(E,null==k?void 0:k.sn,"->")).call(T,e.sn)),this.loadingParts=S)}if(g=Math.max(e.start,g||0),this.loadingParts&&Ze(e)){var _=m.partList;if(_&&p){g>e.end&&m.fragmentHint&&(e=m.fragmentHint);var b=this.getNextPart(_,e,g);if(b>-1){var A,R,L,I,C,w,D,x,P,O,M=_[b];return e=this.fragCurrent=M.fragment,this.log(Hy(A=Hy(R=Hy(L=Hy(I=Hy(C=Hy(w=Hy(D=Hy(x=Hy(P="Loading ".concat(e.type," sn: ")).call(P,e.sn," part: ")).call(x,M.index," (")).call(D,b,"/")).call(w,_.length-1,") of ")).call(C,this.fragInfo(e,!1,M),") cc: ")).call(I,e.cc," [")).call(L,m.startSN,"-")).call(R,m.endSN,"], target: ")).call(A,Tb(g.toFixed(3)))),this.nextLoadPosition=M.start+M.duration,this.state=zi,O=y?y.then((function(i){return!i||v.fragContextChanged(i.frag)?null:v.doFragPartsLoad(e,M,t,p)})).catch((function(e){return v.handleFragLoadError(e)})):this.doFragPartsLoad(e,M,t,p).catch((function(e){return v.handleFragLoadError(e)})),this.hls.trigger(c.FRAG_LOADING,{frag:e,part:M,targetBufferTime:g}),null===this.fragCurrent?nb.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):O}if(!e.url||this.loadedEndOfParts(_,g))return nb.resolve(null)}}if(Ze(e)&&this.loadingParts)this.log("LL-Part loading OFF after next part miss @".concat(g.toFixed(2))),this.loadingParts=!1;else if(!e.url)return nb.resolve(null);this.log(Hy(o=Hy(l=Hy(u=Hy(h=Hy(d="Loading ".concat(e.type," sn: ")).call(d,e.sn," of ")).call(h,this.fragInfo(e,!1),") cc: ")).call(u,e.cc," ")).call(l,m?"["+m.startSN+"-"+m.endSN+"]":"",", target: ")).call(o,Tb(g.toFixed(3)))),a(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=zi;var N,F=this.config.progressive;return N=F&&y?y.then((function(t){return!t||v.fragContextChanged(null==t?void 0:t.frag)?null:v.fragmentLoader.load(e,p)})).catch((function(e){return v.handleFragLoadError(e)})):nb.all([this.fragmentLoader.load(e,F?p:void 0),y]).then((function(e){var t=yf(e,1)[0];return!F&&t&&p&&p(t),t})).catch((function(e){return v.handleFragLoadError(e)})),this.hls.trigger(c.FRAG_LOADING,{frag:e,targetBufferTime:g}),null===this.fragCurrent?nb.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):N}},{key:"doFragPartsLoad",value:function(e,t,i,n){var r=this;return new nb((function(a,s){var o,l=[],u=null==(o=i.details)?void 0:o.partList;!function t(o){r.fragmentLoader.loadPart(e,o,n).then((function(n){l[o.index]=n;var s=n.part;r.hls.trigger(c.FRAG_LOADED,n);var h=Mi(i.details,e.sn,o.index+1)||Ni(u,e.sn,o.index+1);if(!h)return a({frag:e,part:s,partsLoaded:l});t(h)})).catch(s)}(t)}))}},{key:"handleFragLoadError",value:function(e){if("data"in e){var t=e.data;e.data&&t.details===u.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(c.ERROR,t)}else this.hls.trigger(c.ERROR,{type:l.OTHER_ERROR,details:u.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}},{key:"_handleTransmuxerFlush",value:function(e){var t,i=this.getCurrentContext(e);if(i&&this.state===Qi){var n=i.frag,r=i.part,a=i.level,s=self.performance.now();n.stats.parsing.end=s,r&&(r.stats.parsing.end=s);var o=this.getLevelDetails(),l=o&&n.sn>o.endSN||this.shouldLoadParts(o,n.end);l!==this.loadingParts&&(this.log(Hy(t="LL-Part loading ".concat(l?"ON":"OFF"," after parsing segment ending @")).call(t,n.end.toFixed(2))),this.loadingParts=l),this.updateLevelTiming(n,r,a,e.partial)}else this.fragCurrent||this.state===Wi||this.state===Ji||(this.state=ji)}},{key:"shouldLoadParts",value:function(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(null!=e&&e.partList){var i,n,r=e.partList[0];if(t>=r.end+((null==(i=e.fragmentHint)?void 0:i.duration)||0)&&(this.hls.hasEnoughToStart?(null==(n=this.media)?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}return!1}},{key:"getCurrentContext",value:function(e){var t,i,n=this.levels,r=this.fragCurrent,a=e.level,s=e.sn,o=e.part;if(null==n||!n[a])return this.warn(Hy(t=Hy(i="Levels object was unset while buffering fragment ".concat(s," of ")).call(i,this.playlistLabel()," ")).call(t,a,". The current chunk will not be buffered.")),null;var l=n[a],u=l.details,c=o>-1?Mi(u,s,o):null,h=c?c.fragment:function(e,t,i){if(!e)return null;var n=e.fragments[t-e.startSN];return n||((n=e.fragmentHint)&&n.sn===t?n:t<e.startSN&&i&&i.sn===t?i:null)}(u,s,r);return h?(r&&r!==h&&(h.stats=r.stats),{frag:h,part:c,level:l}):null}},{key:"bufferFragmentData",value:function(e,t,i,n,r){var a;if(e&&this.state===Qi){var s=e.data1,o=e.data2,l=s;if(s&&o&&(l=kt(s,o)),null!=(a=l)&&a.length){var u={type:e.type,frag:t,part:i,chunkMeta:n,parent:t.type,data:l};if(this.hls.trigger(c.BUFFER_APPENDING,u),e.dropped&&e.independent&&!i){if(r)return;this.flushBufferGap(t)}}}}},{key:"flushBufferGap",value:function(e){var t=this.media;if(t)if(Mt.isBuffered(t,t.currentTime)){var i=t.currentTime,n=Mt.bufferInfo(t,i,0),r=e.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*r),s=Math.max(Math.min(e.start-a,n.end-a),i+a);e.start-s>a&&this.flushMainBuffer(s,e.start)}else this.flushMainBuffer(0,e.start)}},{key:"getFwdBufferInfo",value:function(e,t){var i,n=this.getLoadPosition();if(!a(n))return null;var r=this.lastCurrentTime>n||null!=(i=this.media)&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,r)}},{key:"getFwdBufferInfoAtPos",value:function(e,t,i,n){var r=Mt.bufferInfo(e,t,n);if(0===r.len&&void 0!==r.nextStart){var a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&(r.nextStart<=a.end||a.gap))return Mt.bufferInfo(e,t,Math.max(r.nextStart,n))}return r}},{key:"getMaxBufferLength",value:function(e){var t,i=this.config;return t=e?Math.max(8*i.maxBufferSize/e,i.maxBufferLength):i.maxBufferLength,Math.min(t,i.maxMaxBufferLength)}},{key:"reduceMaxBufferLength",value:function(e,t){var i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),r=Math.max(e-3*t,i.maxMaxBufferLength/2,n);return r>=n&&(i.maxMaxBufferLength=r,this.warn("Reduce max buffer length to ".concat(r,"s")),!0)}},{key:"getAppendedFrag",value:function(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.MAIN,n=null==(t=this.fragmentTracker)?void 0:t.getAppendedFrag(e,i);return n&&"fragment"in n?n.fragment:n}},{key:"getNextFragment",value:function(e,t){var i=t.fragments,n=i.length;if(!n)return null;var r=this.config,a=i[0].start,s=r.lowLatencyMode&&!!t.partList,o=null;if(t.live){var l,u=r.initialLiveManifestSize;if(n<u)return this.warn(Hy(l="Not enough fragments to start playback (have: ".concat(n,", need: ")).call(l,u,")")),null;if(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<a){var c,h,d,f;s&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(t,i);var v=this.hls.startPosition,g=this.hls.liveSyncPosition,p=o?(-1!==v?v:g)||o.start:e;this.log(Hy(c=Hy(h=Hy(d="Setting startPosition to ".concat(p," to match initial live edge. mainStart: ")).call(d,v," liveSyncPosition: ")).call(h,g," frag.start: ")).call(c,null==(f=o)?void 0:f.start)),this.startPosition=this.nextLoadPosition=p}}else e<=a&&(o=i[0]);if(!o){var m=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,m,t)}return this.mapToInitFragWhenRequired(o)}},{key:"isLoopLoading",value:function(e,t){var i=this.fragmentTracker.getState(e);return(i===Le||i===Re&&!!e.gap)&&this.nextLoadPosition>t}},{key:"getNextFragmentLoopLoading",value:function(e,t,i,n,r){var a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t))&&!a.gap&&i.nextStart){var s=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(null!==s&&i.len+s.len>=r){var o,l=a.sn;return this.loopSn!==l&&(this.log(Hy(o='buffer full after gaps in "'.concat(n,'" playlist starting at sn: ')).call(o,l)),this.loopSn=l),null}}return this.loopSn=void 0,a}},{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,i){for(var n=-1,r=!1,a=!0,s=0,o=e.length;s<o;s++){var l=e[s];if(a=a&&!l.independent,n>-1&&i<l.start)break;var u=l.loaded;u?n=-1:(r||l.independent||a)&&l.fragment===t&&(n=s),r=u}return n}},{key:"loadedEndOfParts",value:function(e,t){var i=e[e.length-1];return i&&t>i.start&&i.loaded}},{key:"getInitialLiveFragment",value:function(e,t){var i=this.fragPrevious,n=null;if(i){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: ".concat(i.programDateTime)),n=function(e,t,i){if(null===t||!kw(e)||!e.length||!a(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;i=i||0;for(var n=0;n<e.length;++n){var r=e[n];if(fe(t,i,r))return r}return null}(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){var r=i.sn+1;if(r>=e.startSN&&r<=e.endSN){var s=t[r-e.startSN];i.cc===s.cc&&(n=s,this.log("Live playlist, switching playlist, load frag with next SN: ".concat(n.sn)))}n||(n=ve(t,i.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: ".concat(n.sn))}}else{var o=this.hls.liveSyncPosition;null!==o&&(n=this.getFragmentAtPosition(o,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}},{key:"getFragmentAtPosition",value:function(e,t,i){var n,r,a=this.config,s=this.fragPrevious,o=i.fragments,l=i.endSN,u=i.fragmentHint,c=a.maxFragLookUpTolerance,h=i.partList,d=!!(this.loadingParts&&null!=h&&h.length&&u);if(d&&u&&!this.bitrateTest&&h[h.length-1].fragment.sn===u.sn&&(o=Hy(o).call(o,u),l=u.sn),n=e<t?he(s,o,e,e<this.lastCurrentTime||e>t-c||null!=(r=this.media)&&r.paused||!this.startFragRequested?0:c):o[o.length-1]){var f=n.sn-i.startSN,v=this.fragmentTracker.getState(n);if((v===Le||v===Re&&n.gap)&&(s=n),s&&n.sn===s.sn&&(!d||h[0].fragment.sn>n.sn||!i.live&&!d)&&s&&n.level===s.level){var g=o[f+1];n=n.sn<l&&this.fragmentTracker.getState(g)!==Le?g:null}}return n}},{key:"alignPlaylists",value:function(e,t,i){var n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;var r,s,o=e.fragmentStart,l=!t,u=e.alignedSliding&&a(o);if(l||!u&&!o){var c,h,d;s=e,(r=i)&&(Gi(s,r),!s.alignedSliding&&r&&Vi(s,r),s.alignedSliding||!r||s.skippedSegments||xi(r,s,!1));var f=e.fragmentStart;return this.log(Hy(c=Hy(h=Hy(d="Live playlist sliding: ".concat(f.toFixed(2)," start-sn: ")).call(d,t?t.startSN:"na","->")).call(h,e.startSN," fragments: ")).call(c,n)),f}return o}},{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 i=this.startPosition;if(i<t&&(i=-1),-1===i){var n,r,s=null!==this.startTimeOffset,o=s?this.startTimeOffset:e.startTimeOffset;null!==o&&a(o)?(i=t+o,o<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(Hy(n=Hy(r="Setting startPosition to ".concat(i," for start time offset ")).call(r,o," found in ")).call(n,s?"multivariant":"media"," playlist")),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i}this.nextLoadPosition=i}},{key:"getLoadPosition",value:function(){var e,t=this.media,i=0;return null!=(e=this.hls)&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}},{key:"handleFragLoadAborted",value:function(e,t){var i,n,r;this.transmuxer&&e.type===this.playlistType&&Ze(e)&&e.stats.aborted&&(this.warn(Hy(i=Hy(n=Hy(r="Fragment ".concat(e.sn)).call(r,t?" part "+t.index:""," of ")).call(n,this.playlistLabel()," ")).call(i,e.level," was aborted")),this.resetFragmentLoading(e))}},{key:"resetFragmentLoading",value:function(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===qi)||(this.state=ji)}},{key:"onFragmentOrKeyLoadError",value:function(e,t){var i;if(t.chunkMeta&&!t.frag){var n=this.getCurrentContext(t.chunkMeta);n&&(t.frag=n.frag)}var r,a=t.frag;if(a&&a.type===e&&this.levels)if(this.fragContextChanged(a))this.warn(Hy(i="Frag load error must match current frag to retry ".concat(a.url," > ")).call(i,null==(r=this.fragCurrent)?void 0:r.url));else{var s=t.details===u.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(a,!0);var o=t.errorAction,l=o||{},c=l.action,h=OI(l),d=l.retryCount,f=void 0===d?0:d,v=l.retryConfig,g=!!o&&!!v,p=g&&c===Te.RetryRequest,m=g&&!o.resolved&&h===Ee.MoveAllAlternatesMatchingHost;if(!p&&m&&Ze(a)&&!a.endList)this.resetFragmentErrors(e),this.treatAsGap(a),o.resolved=!0;else if((p||m)&&f<v.maxNumRetry){var y,k,T,E,S,_;this.resetStartWhenNotLoaded(this.levelLastLoaded);var b=me(v,f);this.warn(Hy(y=Hy(k=Hy(T=Hy(E=Hy(S=Hy(_="Fragment ".concat(a.sn," of ")).call(_,e," ")).call(S,a.level," errored with ")).call(E,t.details,", retrying loading ")).call(T,f+1,"/")).call(k,v.maxNumRetry," in ")).call(y,b,"ms")),o.resolved=!0,this.retryDate=self.performance.now()+b,this.state=qi}else if(v&&o){var A;if(this.resetFragmentErrors(e),!(f<v.maxNumRetry))return void this.warn(Hy(A="".concat(t.details," reached or exceeded max retry (")).call(A,f,")"));s||c===Te.RemoveAlternatePermanently||(o.resolved=!0)}else this.state=c===Te.SendAlternateToPenaltyBox?tn:Ji;this.tickImmediate()}}},{key:"reduceLengthAndFlushBuffer",value:function(e){if(this.state===Qi||this.state===$i){var t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),r=n&&n.len>.5;r&&this.reduceMaxBufferLength(n.len,(null==t?void 0:t.duration)||10);var a=!r;return a&&this.warn("Buffer full error while media.currentTime is not buffered, flush ".concat(i," buffer")),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}},{key:"resetFragmentErrors",value:function(e){e===g.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Wi&&(this.state=ji)}},{key:"afterBufferFlushed",value:function(e,t,i){if(e){var n=Mt.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===Zi&&this.resetLoadingState()}}},{key:"resetLoadingState",value:function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Wi&&(this.state=ji)}},{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,i;this.warn(Hy(t=Hy(i="The loading context changed while buffering fragment ".concat(e.sn," of ")).call(i,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,i,n){var r,a,s,o,h,d=this,f=i.details;if(f){if(!ok(r=Cy(e.elementaryStreams)).call(r,(function(t,r){var a=e.elementaryStreams[r];if(a){var s,o,l=a.endPTS-a.startPTS;if(l<=0)return d.warn(Hy(s=Hy(o="Could not parse fragment ".concat(e.sn," ")).call(o,r," duration reliably (")).call(s,l,")")),t||!1;var u=n?0:wi(f,e,a.startPTS,a.endPTS,a.startDTS,a.endDTS);return d.hls.trigger(c.LEVEL_PTS_UPDATED,{details:f,level:i,drift:u,type:r,frag:e,start:a.startPTS,end:a.endPTS}),!0}return t}),!1)&&null===(null==(h=this.transmuxer)?void 0:h.error)){var v,g,p,m,y=new Error(Hy(v=Hy(g="Found no media in fragment ".concat(e.sn," of ")).call(g,this.playlistLabel()," ")).call(v,e.level," resetting transmuxer to fallback to playlist timing"));if(0===i.fragmentError&&this.treatAsGap(e,i),this.warn(y.message),this.hls.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.FRAG_PARSING_ERROR,fatal:!1,error:y,frag:e,reason:Hy(p=Hy(m="Found no media in msn ".concat(e.sn," of ")).call(m,this.playlistLabel(),' "')).call(p,i.url,'"')}),!this.hls)return;this.resetTransmuxer()}this.state=$i,this.log(Hy(a=Hy(s=Hy(o="Parsed ".concat(e.type," sn: ")).call(o,e.sn)).call(s,t?" part: "+t.index:""," of ")).call(a,this.fragInfo(e,!1,t),")")),this.hls.trigger(c.FRAG_PARSED,{frag:e,part:t})}else this.warn("level.details undefined")}},{key:"playlistLabel",value:function(){return this.playlistType===g.MAIN?"level":"track"}},{key:"fragInfo",value:function(e){var t,i,n,r,a,s,o,l=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=arguments.length>2?arguments[2]:void 0;return Hy(t=Hy(i=Hy(n=Hy(r=Hy(a="".concat(this.playlistLabel()," ")).call(a,e.level," (")).call(r,u?"part":"frag",":[")).call(n,(null!=(s=l&&!u?e.startPTS:(u||e).start)?s:NaN).toFixed(3),"-")).call(i,(null!=(o=l&&!u?e.endPTS:(u||e).end)?o:NaN).toFixed(3),"]")).call(t,u&&"main"===e.type?"INDEPENDENT="+(u.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,i=this._state;i!==e&&(this._state=e,this.log(Hy(t="".concat(i,"->")).call(t,e)))}}]),i}(xt),rn=function(){function e(){Zm(this,e),this.chunks=[],this.dataLength=0}return ey(e,[{key:"push",value:function(e){this.chunks.push(e),this.dataLength+=e.length}},{key:"flush",value:function(){var e,t=this.chunks,i=this.dataLength;return t.length?(e=1===t.length?t[0]:function(e,t){for(var i=new Uint8Array(t),n=0,r=0;r<e.length;r++){var a=e[r];i.set(a,n),n+=a.length}return i}(t,i),this.reset(),e):new Uint8Array(0)}},{key:"reset",value:function(){this.chunks.length=0,this.dataLength=0}}]),e}(),an={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function a(e,t,n,a,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new r(n,a||e,s),l=i?i+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}MI&&(n.prototype=MI(null),(new n).__proto__||(i=!1)),o.prototype.eventNames=function(){var e,n,r=[];if(0===this._eventsCount)return r;for(n in e=this._events)t.call(e,n)&&r.push(i?iI(n).call(n,1):n);return wy?Hy(r).call(r,wy(e)):r},o.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,a=n.length,s=new Array(a);r<a;r++)s[r]=n[r].fn;return s},o.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},o.prototype.emit=function(e,t,n,r,a,s){var o=i?i+e:e;if(!this._events[o])return!1;var l,u,c=this._events[o],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,a),!0;case 6:return c.fn.call(c.context,t,n,r,a,s),!0}for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var d,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),h){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,n);break;case 4:c[u].fn.call(c[u].context,t,n,r);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];c[u].fn.apply(c[u].context,l)}}return!0},o.prototype.on=function(e,t,i){return a(this,e,t,i,!1)},o.prototype.once=function(e,t,i){return a(this,e,t,i,!0)},o.prototype.removeListener=function(e,t,n,r){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||r&&!o.once||n&&o.context!==n||s(this,a);else{for(var l=0,u=[],c=o.length;l<c;l++)(o[l].fn!==t||r&&!o[l].once||n&&o[l].context!==n)&&u.push(o[l]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+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=i,o.EventEmitter=o,e.exports=o}(an);var sn=Be(an.exports),on="1.6.0-beta.2",ln={};function un(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 cn(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 hn(e,t){var i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3]}function dn(e,t){for(var i=t,n=0;cn(e,t);)n+=10,n+=hn(e,t+6),un(e,t+10)&&(n+=10),t+=n;if(n>0)return e.subarray(i,i+n)}function fn(e,t){return 255===e[t]&&240==(246&e[t+1])}function vn(e,t){return 1&e[t+1]?7:9}function gn(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function pn(e,t){return t+1<e.length&&fn(e,t)}function mn(e,t){if(pn(e,t)){var i=vn(e,t);if(t+i>=e.length)return!1;var n=gn(e,t);if(n<=i)return!1;var r=t+n;return r===e.length||pn(e,r)}return!1}function yn(e,t,i,n,r){if(!e.samplerate){var a=function(e,t,i,n,r,a,s,o,h){var d=t[i+2],f=d>>2&15;if(!(f>12)){var v=1+(d>>6&3),g=t[i+3]>>6&3|(1&d)<<2,p="mp4a.40."+v,m=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][f],y=f;5!==v&&29!==v||(y-=3);var k=[v<<3|(14&y)>>1,(1&y)<<7|g<<3];return I.log(Hy(r=Hy(a=Hy(s=Hy(o=Hy(h="manifest codec:".concat(n,", parsed codec:")).call(h,p,", channels:")).call(o,g,", rate:")).call(s,m," (ADTS object type:")).call(a,v," sampling index:")).call(r,f,")")),{config:k,samplerate:m,channelCount:g,codec:p,parsedCodec:p,manifestCodec:n}}var T=new Error("invalid ADTS sampling index:".concat(f));e.emit(c.ERROR,c.ERROR,{type:l.MEDIA_ERROR,details:u.FRAG_PARSING_ERROR,fatal:!0,error:T,reason:T.message})}(t,i,n,r);if(!a)return;k(e,a)}}function kn(e){return 9216e4/e}function Tn(e,t,i,n,r){var a,s=n+r*kn(e.samplerate),o=function(e,t){var i=vn(e,t);if(t+i<=e.length){var n=gn(e,t)-i;if(n>0)return{headerLength:i,frameLength:n}}}(t,i);if(o){var l=o.frameLength,u=o.headerLength,c=u+l,h=Math.max(0,i+c-t.length);h?(a=new Uint8Array(c-u)).set(t.subarray(i+u,t.length),0):a=t.subarray(i+u,i+c);var d={unit:a,pts:s};return h||e.samples.push(d),{sample:d,length:c,missing:h}}var f=t.length-i;return(a=new Uint8Array(f)).set(t.subarray(i,t.length),0),{sample:{unit:a,pts:s},length:f,missing:-1}}function En(e,t){return cn(e,t)&&hn(e,t+6)+10<=e.length-t}function Sn(e){return function(e,t,i,n){var r,a=(r=e)instanceof ArrayBuffer?r:r.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,u=(l+e.byteLength)/s,c=(l+t)/s,h=Math.floor(Math.max(0,Math.min(c,u)));return new n(a,h,Math.floor(Math.min(h+Math.max(i,0),u))-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 _n(e,t){if(e<0)return-_n(-e,t);var i=Math.pow(10,t);if(Math.abs(e*i%1-.5)<Tw){var n=Math.floor(e*i);return(n%2==0?n:n+1)/i}return Math.round(e*i)/i}function bn(e){var t,i,n={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(!(e.size<2))if(3===e.data[0]){var r=zy(t=e.data.subarray(1)).call(t,0);if(-1!==r){var a=Fe(Sn(e.data,1,r)),s=e.data[2+r],o=zy(i=e.data.subarray(3+r)).call(i,0);if(-1!==o){var l,u,c=Fe(Sn(e.data,3+r,o));return l="--\x3e"===a?Fe(Sn(e.data,4+r+o)):(u=e.data.subarray(4+r+o))instanceof ArrayBuffer?u:0==u.byteOffset&&u.byteLength==u.buffer.byteLength?u.buffer:new Uint8Array(u).buffer,n.mimeType=a,n.pictureType=s,n.description=c,n.data=l,n}}}else console.log("Ignore frame with unrecognized character encoding")}function An(e){return"PRIV"===e.type?function(e){if(!(e.size<2)){var t=Fe(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}}}(e):"W"===e.type[0]?function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,i=Fe(e.data.subarray(t),!0);t+=i.length+1;var n=Fe(e.data.subarray(t));return{key:e.type,info:i,data:n}}var r=Fe(e.data);return{key:e.type,info:"",data:r}}(e):"APIC"===e.type?bn(e):function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,i=Fe(e.data.subarray(t),!0);t+=i.length+1;var n=Fe(e.data.subarray(t));return{key:e.type,info:i,data:n}}var r=Fe(e.data.subarray(1));return{key:e.type,info:"",data:r}}}(e)}function Rn(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=hn(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}}function Ln(e){for(var t=0,i=[];cn(e,t);){var n=hn(e,t+6);e[t+5]>>6&1&&(t+=10);for(var r=(t+=10)+n;t+10<r;){var a=Rn(e.subarray(t)),s=An(a);s&&i.push(s),t+=a.size+10}un(e,t)&&(t+=10)}return i}function In(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function Cn(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),i=1&t[3],n=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return n/=45,i&&(n+=47721858.84),Math.round(n)}}function wn(e){for(var t=Ln(e),i=0;i<t.length;i++){var n=t[i];if(In(n))return Cn(n)}}var Dn=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 xn(){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 Pn=function(){function e(){Zm(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 ey(e,[{key:"resetInitSegment",value:function(e,t,i,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,i){}},{key:"demux",value:function(e,t){this.cachedData&&(e=kt(this.cachedData,e),this.cachedData=null);var i,n=dn(e,0),r=n?n.length:0,s=this._audioTrack,o=this._id3Track,l=n?wn(n):void 0,u=e.length;for((null===this.basePTS||0===this.frameIndex&&a(l))&&(this.basePTS=On(l,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),n&&n.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:Dn.audioId3,duration:Number.POSITIVE_INFINITY});r<u;){if(this.canParse(e,r)){var c=this.appendFrame(s,e,r);c?(this.frameIndex++,this.lastPTS=c.sample.pts,i=r+=c.length):r=u}else En(e,r)?(n=dn(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:Dn.audioId3,duration:Number.POSITIVE_INFINITY}),i=r+=n.length):r++;if(r===u&&i!==u){var h=Oe(e,i);this.cachedData?this.cachedData=kt(this.cachedData,h):this.cachedData=h}}return{audioTrack:s,videoTrack:xn(),id3Track:o,textTrack:xn()}}},{key:"demuxSampleAes",value:function(e,t,i){return nb.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:xn(),id3Track:this._id3Track,textTrack:xn()}}},{key:"destroy",value:function(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}]),e}(),On=function(e,t,i){return a(e)?90*e:9e4*t+(i?9e4*i.baseTime/i.timescale:0)},Mn=null,Nn=[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],Fn=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Un=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Bn=[0,1,1,4];function Hn(e,t,i,n,r){if(!(i+24>t.length)){var a=Gn(t,i);if(a&&i+a.frameLength<=t.length){var s=n+r*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:t.subarray(i,i+a.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(o),{sample:o,length:a.frameLength,missing:0}}}}function Gn(e,t){var i=e[t+1]>>3&3,n=e[t+1]>>1&3,r=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==i&&0!==r&&15!==r&&3!==a){var s=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*Nn[14*(3===i?3-n:3===n?3:4)+r-1],u=Fn[3*(3===i?0:2===i?1:2)+a],c=3===o?1:2,h=Un[i][n],d=Bn[n],f=8*h*d,v=Math.floor(h*l/u+s)*d;if(null===Mn){var g=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Mn=g?Zk(g[1]):0}return!!Mn&&Mn<=87&&2===n&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:u,channelCount:c,frameLength:v,samplesPerFrame:f}}}function Vn(e,t){return!(255!==e[t]||224&~e[t+1]||!(6&e[t+1]))}function Kn(e,t){return t+1<e.length&&Vn(e,t)}function Wn(e,t){if(t+1<e.length&&Vn(e,t)){var i=4,n=Gn(e,t),r=i;null!=n&&n.frameLength&&(r=n.frameLength);var a=t+r;return a===e.length||Kn(e,a)}return!1}var jn=function(e,t){var i=0,n=5;t+=n;for(var r=new Uint32Array(1),a=new Uint32Array(1),s=new Uint8Array(1);n>0;){s[0]=e[t];var o=Math.min(n,8),l=8-o;a[0]=4278190080>>>24+l<<l,r[0]=(s[0]&a[0])>>l,i=i?i<<o|r[0]:r[0],t+=1,n-=o}return i},Yn=function(e){Qm(i,e);var t=$m(i);function i(e){var n;return Zm(this,i),(n=t.call(this)).observer=void 0,n.observer=e,n}return ey(i,[{key:"resetInitSegment",value:function(e,t,n,r){ev(Jf(i.prototype),"resetInitSegment",this).call(this,e,t,n,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return t+64<e.length}},{key:"appendFrame",value:function(e,t,i){var n=zn(e,t,i,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=dn(e,0);if(!t)return!1;var i=t.length;return 11===e[i]&&119===e[i+1]&&void 0!==wn(t)&&jn(e,i)<16}}]),i}(Pn);function zn(e,t,i,n,r){if(i+8>t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;var a=t[i+4]>>6;if(a>=3)return-1;var s=[48e3,44100,32e3][a],o=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+a];if(i+l>t.length)return-1;var u=t[i+6]>>5,c=0;2===u?c+=2:(1&u&&1!==u&&(c+=2),4&u&&(c+=2));var h=(t[i+6]<<8|t[i+7])>>12-c&1,d=[2,1,2,3,3,4,4,5][u]+h,f=t[i+5]>>3,v=7&t[i+5],g=new Uint8Array([a<<6|f<<1|v>>2,(3&v)<<6|u<<3|h<<2|o>>4,o<<4&224]),p=n+r*(1536/s*9e4),m=t.subarray(i,i+l);return e.config=g,e.channelCount=d,e.samplerate=s,e.samples.push({unit:m,pts:p}),l}var qn=/\/emsg[-/]ID3/i;function Xn(e,t){return a(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}var Qn=function(){function e(t,i,n){Zm(this,e),this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Rt(i,{removePKCS7Padding:!1})}return ey(e,[{key:"decryptBuffer",value:function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,De)}},{key:"decryptAacSample",value:function(e,t,i){var n,r=this,a=e[t].unit;if(!(a.length<=16)){var s=a.subarray(16,a.length-a.length%16),o=iI(n=s.buffer).call(n,s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(o).then((function(n){var s=new Uint8Array(n);a.set(s,16),r.decrypter.isSync()||r.decryptAacSamples(e,t+1,i)}))}}},{key:"decryptAacSamples",value:function(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,i),this.decrypter.isSync())))return}}},{key:"getAvcEncryptedData",value:function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),n=0,r=32;r<e.length-16;r+=160,n+=16)i.set(e.subarray(r,r+16),n);return i}},{key:"getAvcDecryptedUnit",value:function(e,t){for(var i=new Uint8Array(t),n=0,r=32;r<e.length-16;r+=160,n+=16)e.set(i.subarray(n,n+16),r);return e}},{key:"decryptAvcSample",value:function(e,t,i,n,r){var a=this,s=_t(r.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then((function(o){r.data=a.getAvcDecryptedUnit(s,o),a.decrypter.isSync()||a.decryptAvcSamples(e,t,i+1,n)}))}},{key:"decryptAvcSamples",value:function(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void n();for(var r=e[t].units;!(i>=r.length);i++){var a=r[i];if(!(a.data.length<=48||1!==a.type&&5!==a.type||(this.decryptAvcSample(e,t,i,n,a),this.decrypter.isSync())))return}}}}]),e}(),$n=function(){function e(){Zm(this,e),this.VideoSample=null}return ey(e,[{key:"createVideoSample",value:function(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}},{key:"getLastNalUnit",value:function(e){var t,i,n=this.VideoSample;if(n&&0!==n.units.length||(n=e[e.length-1]),null!=(t=n)&&t.units){var r=n.units;i=r[r.length-1]}return i}},{key:"pushAccessUnit",value:function(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var i=t.samples,n=i.length;if(!n)return void t.dropped++;var r=i[n-1];e.pts=r.pts,e.dts=r.dts}t.samples.push(e)}}},{key:"parseNALu",value:function(e,t,i){var n,r,a=t.byteLength,s=e.naluState||0,o=s,l=[],u=0,c=-1,h=0;for(-1===s&&(c=0,h=this.getNALuType(t,0),s=0,u=1);u<a;)if(n=t[u++],s)if(1!==s)if(n)if(1===n){if(r=u-s-1,c>=0){var d={data:t.subarray(c,r),type:h};l.push(d)}else{var f=this.getLastNalUnit(e.samples);f&&(o&&u<=4-o&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-o)),r>0&&(f.data=kt(f.data,t.subarray(0,r)),f.state=0))}u<a?(c=u,h=this.getNALuType(t,u),s=0):s=-1}else s=0;else s=3;else s=n?0:2;else s=n?0:1;if(c>=0&&s>=0){var v={data:t.subarray(c,a),type:h,state:s};l.push(v)}if(0===l.length){var g=this.getLastNalUnit(e.samples);g&&(g.data=kt(g.data,t))}return e.naluState=s,l}}]),e}(),Zn=function(){function e(t){Zm(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 ey(e,[{key:"loadWord",value:function(){var e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");n.set(e.subarray(i,i+r)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}},{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),i=this.word>>>32-t;if(e>32&&I.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?i<<t|this.readBits(t):i}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitsAvailable;++e)if(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}(),Jn=function(e){Qm(i,e);var t=$m(i);function i(){return Zm(this,i),t.apply(this,arguments)}return ey(i,[{key:"parsePES",value:function(e,t,i,n){var r,a=this,s=this.parseNALu(e,i.data,n),o=this.VideoSample,l=!1;i.data=null,o&&s.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),Py(s).call(s,(function(n){var s,u;switch(n.type){case 1:var c=!1;r=!0;var h,d=n.data;if(l&&d.length>4){var f=a.readSliceType(d);2!==f&&4!==f&&7!==f&&9!==f||(c=!0)}c&&null!=(h=o)&&h.frame&&!o.key&&(a.pushAccessUnit(o,e),o=a.VideoSample=null),o||(o=a.VideoSample=a.createVideoSample(!0,i.pts,i.dts)),o.frame=!0,o.key=c;break;case 5:r=!0,null!=(s=o)&&s.frame&&!o.key&&(a.pushAccessUnit(o,e),o=a.VideoSample=null),o||(o=a.VideoSample=a.createVideoSample(!0,i.pts,i.dts)),o.key=!0,o.frame=!0;break;case 6:r=!0,St(n.data,1,i.pts,t.samples);break;case 7:var v,g;r=!0,l=!0;var p=n.data,m=a.readSPS(p);if(!e.sps||e.width!==m.width||e.height!==m.height||(null==(v=e.pixelRatio)?void 0:v[0])!==m.pixelRatio[0]||(null==(g=e.pixelRatio)?void 0:g[1])!==m.pixelRatio[1]){e.width=m.width,e.height=m.height,e.pixelRatio=m.pixelRatio,e.sps=[p];for(var y=p.subarray(1,4),k="avc1.",T=0;T<3;T++){var E=y[T].toString(16);E.length<2&&(E="0"+E),k+=E}e.codec=k}break;case 8:r=!0,e.pps=[n.data];break;case 9:r=!0,e.audFound=!0,null!=(u=o)&&u.frame&&(a.pushAccessUnit(o,e),o=null),o||(o=a.VideoSample=a.createVideoSample(!1,i.pts,i.dts));break;case 12:r=!0;break;default:r=!1}o&&r&&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 Zn(e);return t.readUByte(),t.readUEG(),t.readUEG()}},{key:"skipScalingList",value:function(e,t){for(var i=8,n=8,r=0;r<e;r++)0!==n&&(n=(i+t.readEG()+256)%256),i=0===n?i:n}},{key:"readSPS",value:function(e){var t,i,n,r,a,s,o,l,u,c,h,d=new Zn(e),f=0,v=0,g=0,p=0,m=Iy(t=d.readUByte).call(t,d),y=Iy(i=d.readBits).call(i,d),k=Iy(n=d.readUEG).call(n,d),T=Iy(r=d.readBoolean).call(r,d),E=Iy(a=d.skipBits).call(a,d),S=Iy(s=d.skipEG).call(s,d),_=Iy(o=d.skipUEG).call(o,d),b=Iy(l=this.skipScalingList).call(l,this);m();var A=m();if(y(5),E(3),m(),_(),100===A||110===A||122===A||244===A||44===A||83===A||86===A||118===A||128===A){var R=k();if(3===R&&E(1),_(),_(),E(1),T())for(c=3!==R?8:12,h=0;h<c;h++)T()&&b(h<6?16:64,d)}_();var L=k();if(0===L)k();else if(1===L)for(E(1),S(),S(),u=k(),h=0;h<u;h++)S();_(),E(1);var I=k(),C=k(),w=y(1);0===w&&E(1),E(1),T()&&(f=k(),v=k(),g=k(),p=k());var D=[1,1];if(T()&&T())switch(m()){case 1:D=[1,1];break;case 2:D=[12,11];break;case 3:D=[10,11];break;case 4:D=[16,11];break;case 5:D=[40,33];break;case 6:D=[24,11];break;case 7:D=[20,11];break;case 8:D=[32,11];break;case 9:D=[80,33];break;case 10:D=[18,11];break;case 11:D=[15,11];break;case 12:D=[64,33];break;case 13:D=[160,99];break;case 14:D=[4,3];break;case 15:D=[3,2];break;case 16:D=[2,1];break;case 255:D=[m()<<8|m(),m()<<8|m()]}return{width:Math.ceil(16*(I+1)-2*f-2*v),height:(2-w)*(C+1)*16-(w?2:4)*(g+p),pixelRatio:D}}}]),i}($n),er=function(e){Qm(i,e);var t=$m(i);function i(){var e,n;Zm(this,i);for(var r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return(n=t.call.apply(t,Hy(e=[this]).call(e,a))).initVPS=null,n}return ey(i,[{key:"parsePES",value:function(e,t,i,n){var r,a=this,s=this.parseNALu(e,i.data,n),o=this.VideoSample,l=!1;i.data=null,o&&s.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),Py(s).call(s,(function(n){var s,u;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=a.VideoSample=a.createVideoSample(!1,i.pts,i.dts)),o.frame=!0,r=!0;break;case 16:case 17:case 18:case 21:var c;r=!0,l&&null!=(c=o)&&c.frame&&!o.key&&(a.pushAccessUnit(o,e),o=a.VideoSample=null),o||(o=a.VideoSample=a.createVideoSample(!0,i.pts,i.dts)),o.key=!0,o.frame=!0;break;case 19:case 20:r=!0,null!=(s=o)&&s.frame&&!o.key&&(a.pushAccessUnit(o,e),o=a.VideoSample=null),o||(o=a.VideoSample=a.createVideoSample(!0,i.pts,i.dts)),o.key=!0,o.frame=!0;break;case 39:r=!0,St(n.data,2,i.pts,t.samples);break;case 32:if(r=!0,!e.vps){var h=a.readVPS(n.data);e.params=E({},h),a.initVPS=n.data}e.vps=[n.data];break;case 33:if(r=!0,l=!0,"object"==qh(e.params)){if(void 0===e.vps||e.vps[0]===a.initVPS||void 0===e.sps||a.matchSPS(e.sps[0],n.data)||(a.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){var d=a.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]===a.initVPS&&e.sps.push(n.data)}o||(o=a.VideoSample=a.createVideoSample(!0,i.pts,i.dts)),o.key=!0;break;case 34:if(r=!0,"object"==qh(e.params)){if(!e.pps){e.pps=[];var v=a.readPPS(n.data);for(var g in v)e.params[g]=v[g]}void 0!==e.vps&&e.vps[0]===a.initVPS&&e.pps.push(n.data)}break;case 35:r=!0,e.audFound=!0,null!=(u=o)&&u.frame&&(a.pushAccessUnit(o,e),o=null),o||(o=a.VideoSample=a.createVideoSample(!1,i.pts,i.dts));break;default:r=!1}o&&r&&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),i=0,n=0;n<e.byteLength;n++)n>=2&&3===e[n]&&0===e[n-1]&&0===e[n-2]||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}},{key:"pushAccessUnit",value:function(e,t){ev(Jf(i.prototype),"pushAccessUnit",this).call(this,e,t),this.initVPS&&(this.initVPS=null)}},{key:"readVPS",value:function(e){var t=new Zn(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,i,n,r,a=new Zn(this.ebsp2rbsp(e));a.readUByte(),a.readUByte(),a.readBits(4);var s=a.readBits(3);a.readBoolean();for(var o=a.readBits(2),l=a.readBoolean(),u=a.readBits(5),c=a.readUByte(),h=a.readUByte(),d=a.readUByte(),f=a.readUByte(),v=a.readUByte(),g=a.readUByte(),p=a.readUByte(),m=a.readUByte(),y=a.readUByte(),k=a.readUByte(),T=a.readUByte(),E=[],S=[],_=0;_<s;_++)E.push(a.readBoolean()),S.push(a.readBoolean());if(s>0)for(var b=s;b<8;b++)a.readBits(2);for(var A=0;A<s;A++)E[A]&&(a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte(),a.readUByte()),S[A]&&a.readUByte();a.readUEG();var R=a.readUEG();3==R&&a.skipBits(1);var L=a.readUEG(),I=a.readUEG(),C=a.readBoolean(),w=0,D=0,x=0,P=0;C&&(w+=a.readUEG(),D+=a.readUEG(),x+=a.readUEG(),P+=a.readUEG());for(var O=a.readUEG(),M=a.readUEG(),N=a.readUEG(),F=a.readBoolean()?0:s;F<=s;F++)a.skipUEG(),a.skipUEG(),a.skipUEG();if(a.skipUEG(),a.skipUEG(),a.skipUEG(),a.skipUEG(),a.skipUEG(),a.skipUEG(),a.readBoolean()&&a.readBoolean())for(var U=0;U<4;U++)for(var B=0;B<(3===U?2:6);B++)if(a.readBoolean()){var H=Math.min(64,1<<4+(U<<1));U>1&&a.readEG();for(var G=0;G<H;G++)a.readEG()}else a.readUEG();a.readBoolean(),a.readBoolean(),a.readBoolean()&&(a.readUByte(),a.skipUEG(),a.skipUEG(),a.readBoolean());for(var V=a.readUEG(),K=0,W=0;W<V;W++){var j=!1;if(0!==W&&(j=a.readBoolean()),j){W===V&&a.readUEG(),a.readBoolean(),a.readUEG();for(var Y=0,z=0;z<=K;z++){var q=a.readBoolean(),X=!1;q||(X=a.readBoolean()),(q||X)&&Y++}K=Y}else{var Q=a.readUEG(),$=a.readUEG();K=Q+$;for(var Z=0;Z<Q;Z++)a.readUEG(),a.readBoolean();for(var J=0;J<$;J++)a.readUEG(),a.readBoolean()}}if(a.readBoolean())for(var ee=a.readUEG(),te=0;te<ee;te++){for(var ie=0;ie<N+4;ie++)a.readBits(1);a.readBits(1)}var ne=0,re=1,ae=1,se=!0,oe=1,le=0;a.readBoolean(),a.readBoolean();var ue=!1;if(a.readBoolean()){if(a.readBoolean()){var ce=a.readUByte();ce>0&&ce<16?(re=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][ce-1],ae=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][ce-1]):255===ce&&(re=a.readBits(16),ae=a.readBits(16))}if(a.readBoolean()&&a.readBoolean(),a.readBoolean()&&(a.readBits(3),a.readBoolean(),a.readBoolean()&&(a.readUByte(),a.readUByte(),a.readUByte())),a.readBoolean()&&(a.readUEG(),a.readUEG()),a.readBoolean(),a.readBoolean(),a.readBoolean(),(ue=a.readBoolean())&&(w+=a.readUEG(),D+=a.readUEG(),x+=a.readUEG(),P+=a.readUEG()),a.readBoolean()&&(oe=a.readBits(32),le=a.readBits(32),a.readBoolean()&&a.readUEG(),a.readBoolean())){var he=a.readBoolean(),de=a.readBoolean(),fe=!1;(he||de)&&((fe=a.readBoolean())&&(a.readUByte(),a.readBits(5),a.readBoolean(),a.readBits(5)),a.readBits(4),a.readBits(4),fe&&a.readBits(4),a.readBits(5),a.readBits(5),a.readBits(5));for(var ve=0;ve<=s;ve++){var ge=!1;(se=a.readBoolean())||a.readBoolean()?a.readEG():ge=a.readBoolean();var pe=ge?1:a.readUEG()+1;if(he)for(var me=0;me<pe;me++)a.readUEG(),a.readUEG(),fe&&(a.readUEG(),a.readUEG()),a.skipBits(1);if(de)for(var ye=0;ye<pe;ye++)a.readUEG(),a.readUEG(),fe&&(a.readUEG(),a.readUEG()),a.skipBits(1)}}a.readBoolean()&&(a.readBoolean(),a.readBoolean(),a.readBoolean(),ne=a.readUEG())}var ke=L,Te=I;if(C||ue){var Ee=1,Se=1;1===R?Ee=Se=2:2==R&&(Ee=2),ke=L-Ee*D-Ee*w,Te=I-Se*P-Se*x}for(var _e=o?["A","B","C"][o]:"",be=c<<24|h<<16|d<<8|f,Ae=0,Re=0;Re<32;Re++)Ae=(Ae|(be>>Re&1)<<31-Re)>>>0;var Le=Ae.toString(16);return 1===u&&"2"===Le&&(Le="6"),{codecString:Hy(t=Hy(i=Hy(n=Hy(r="hvc1.".concat(_e)).call(r,u,".")).call(n,Le,".")).call(i,l?"H":"L")).call(t,T,".B0"),params:{general_tier_flag:l,general_profile_idc:u,general_profile_space:o,general_profile_compatibility_flags:[c,h,d,f],general_constraint_indicator_flags:[v,g,p,m,y,k],general_level_idc:T,bit_depth:O+8,bit_depth_luma_minus8:O,bit_depth_chroma_minus8:M,min_spatial_segmentation_idc:ne,chroma_format_idc:R,frame_rate:{fixed:se,fps:le/oe}},width:ke,height:Te,pixelRatio:[re,ae]}}},{key:"readPPS",value:function(e){var t=new Zn(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 i=t.readBoolean(),n=t.readBoolean(),r=1;return n&&i?r=0:n?r=3:i&&(r=2),{parallelismType:r}}},{key:"matchSPS",value:function(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}]),i}($n),tr=188,ir=function(){function e(t,i,n,r){Zm(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=i,this.typeSupported=n,this.logger=r,this.videoParser=null}return ey(e,[{key:"resetInitSegment",value:function(t,i,n,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=e.createTrack("audio",r),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=i,this.videoCodec=n}},{key:"resetTimeStamp",value:function(){}},{key:"resetContiguity",value:function(){var e=this._audioTrack,t=this._videoTrack,i=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}},{key:"demux",value:function(t,i){var n,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];r||(this.sampleAes=null);var s=this._videoTrack,o=this._audioTrack,l=this._id3Track,u=this._txtTrack,c=s.pid,h=s.pesData,d=o.pid,f=l.pid,v=o.pesData,g=l.pesData,p=null,m=this.pmtParsed,y=this._pmtId,k=t.length;if(this.remainderData&&(k=(t=kt(this.remainderData,t)).length,this.remainderData=null),k<tr&&!a)return this.remainderData=t,{audioTrack:o,videoTrack:s,id3Track:l,textTrack:u};var T=Math.max(0,e.syncOffset(t));(k-=(k-T)%tr)<t.byteLength&&!a&&(this.remainderData=new Uint8Array(t.buffer,k,t.buffer.byteLength-k));for(var E=0,S=T;S<k;S+=tr)if(71===t[S]){var _=!!(64&t[S+1]),b=nr(t,S),A=void 0;if((48&t[S+3])>>4>1){if((A=S+5+t[S+4])===S+tr)continue}else A=S+4;switch(b){case c:if(_){if(h&&(n=lr(h,this.logger))){if(null===this.videoParser)switch(s.segmentCodec){case"avc":this.videoParser=new Jn;break;case"hevc":this.videoParser=new er}null!==this.videoParser&&this.videoParser.parsePES(s,u,n,!1)}h={data:[],size:0}}h&&(h.data.push(t.subarray(A,S+tr)),h.size+=S+tr-A);break;case d:if(_){if(v&&(n=lr(v,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)}v={data:[],size:0}}v&&(v.data.push(t.subarray(A,S+tr)),v.size+=S+tr-A);break;case f:_&&(g&&(n=lr(g,this.logger))&&this.parseID3PES(l,n),g={data:[],size:0}),g&&(g.data.push(t.subarray(A,S+tr)),g.size+=S+tr-A);break;case 0:_&&(A+=t[A]+1),y=this._pmtId=rr(t,A);break;case y:var R,L;_&&(A+=t[A]+1);var I=ar(t,A,this.typeSupported,r,this.observer,this.logger);(c=I.videoPid)>0&&(s.pid=c,s.segmentCodec=I.segmentVideoCodec),(d=I.audioPid)>0&&(o.pid=d,o.segmentCodec=I.segmentAudioCodec),(f=I.id3Pid)>0&&(l.pid=f),null===p||m||(this.logger.warn(Hy(R=Hy(L="MPEG-TS PMT found at ".concat(S," after unknown PID '")).call(L,p,"'. Backtracking to sync byte @")).call(R,T," to parse all TS packets.")),p=null,S=T-188),m=this.pmtParsed=!0;break;case 17:case 8191:break;default:p=b}}else E++;E>0&&sr(this.observer,new Error("Found ".concat(E," TS packet/s that do not start with 0x47")),void 0,this.logger),s.pesData=h,o.pesData=v,l.pesData=g;var C={audioTrack:o,videoTrack:s,id3Track:l,textTrack:u};return a&&this.extractRemainingSamples(C),C}},{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,i=e.audioTrack,n=e.videoTrack,r=e.id3Track,a=e.textTrack,s=n.pesData,o=i.pesData,l=r.pesData;if(s&&(t=lr(s,this.logger))){if(null===this.videoParser)switch(n.segmentCodec){case"avc":this.videoParser=new Jn;break;case"hevc":this.videoParser=new er}null!==this.videoParser&&(this.videoParser.parsePES(n,a,t,!0),n.pesData=null)}else n.pesData=s;if(o&&(t=lr(o,this.logger))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,t);break;case"mp3":this.parseMPEGPES(i,t);break;case"ac3":this.parseAC3PES(i,t)}i.pesData=null}else null!=o&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=o;l&&(t=lr(l,this.logger))?(this.parseID3PES(r,t),r.pesData=null):r.pesData=l}},{key:"demuxSampleAes",value:function(e,t,i){var n=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new Qn(this.observer,this.config,t);return this.decrypt(n,r)}},{key:"decrypt",value:function(e,t){return new nb((function(i){var n=e.audioTrack,r=e.videoTrack;n.samples&&"aac"===n.segmentCodec?t.decryptAacSamples(n.samples,0,(function(){r.samples?t.decryptAvcSamples(r.samples,0,0,(function(){i(e)})):i(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(function(){i(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 i,n,r,a=0,s=this.aacOverFlow,o=t.data;if(s){this.aacOverFlow=null;var l=s.missing,u=s.sample.unit.byteLength;if(-1===l)o=kt(s.sample.unit,o);else{var c=u-l;s.sample.unit.set(o.subarray(0,l),c),e.samples.push(s.sample),a=s.missing}}for(i=a,n=o.length;i<n-1&&!pn(o,i);i++);if(i!==a){var h,d=i<n-1;if(h=d?"AAC PES did not start with ADTS header,offset:".concat(i):"No ADTS header found in AAC PES",sr(this.observer,new Error(h),d,this.logger),!d)return}if(yn(e,this.observer,o,i,this.audioCodec),void 0!==t.pts)r=t.pts;else{if(!s)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var f=kn(e.samplerate);r=s.sample.pts+f}for(var v,g=0;i<n;){if(i+=(v=Tn(e,o,i,r,g)).length,v.missing){this.aacOverFlow=v;break}for(g++;i<n-1&&!pn(o,i);i++);}}},{key:"parseMPEGPES",value:function(e,t){var i=t.data,n=i.length,r=0,a=0,s=t.pts;if(void 0!==s)for(;a<n;)if(Kn(i,a)){var o=Hn(e,i,a,s,r);if(!o)break;a+=o.length,r++}else a++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}},{key:"parseAC3PES",value:function(e,t){var i=t.data,n=t.pts;if(void 0!==n)for(var r,a=i.length,s=0,o=0;o<a&&(r=zn(e,i,o,n,s++))>0;)o+=r;else this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS")}},{key:"parseID3PES",value:function(e,t){if(void 0!==t.pts){var i=k({},t,{type:this._videoTrack?Dn.emsg:Dn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}else this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")}}],[{key:"probe",value:function(t,i){var n=e.syncOffset(t);return n>0&&i.warn("MPEG2-TS detected but first sync word found @ offset ".concat(n)),-1!==n}},{key:"syncOffset",value:function(e){for(var t=e.length,i=Math.min(940,t-tr)+1,n=0;n<i;){for(var r=!1,a=-1,s=0,o=n;o<t;o+=tr){if(71!==e[o]||t-o!==tr&&71!==e[o+tr]){if(s)return-1;break}if(s++,-1===a&&0!==(a=o)&&(i=Math.min(a+18612,e.length-tr)+1),r||(r=0===nr(e,o)),r&&s>1&&(0===a&&s>2||o+tr>i))return a}n++}return-1}},{key:"createTrack",value:function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:nt[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}}]),e}();function nr(e,t){return((31&e[t+1])<<8)+e[t+2]}function rr(e,t){return(31&e[t+10])<<8|e[t+11]}function ar(e,t,i,n,r,a){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=nr(e,t),u=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!n){or("ADTS AAC",a);break}case 15:-1===s.audioPid&&(s.audioPid=l);break;case 21:-1===s.id3Pid&&(s.id3Pid=l);break;case 219:if(!n){or("H.264",a);break}case 27:-1===s.videoPid&&(s.videoPid=l,s.segmentVideoCodec="avc");break;case 3:case 4:i.mpeg||i.mp3?-1===s.audioPid&&(s.audioPid=l,s.segmentAudioCodec="mp3"):a.log("MPEG audio found, not supported in this browser");break;case 193:if(!n){or("AC-3",a);break}case 129:i.ac3?-1===s.audioPid&&(s.audioPid=l,s.segmentAudioCodec="ac3"):a.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===s.audioPid&&u>0)for(var c=t+5,h=u;h>2;){106===e[c]&&(!0!==i.ac3?a.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=l,s.segmentAudioCodec="ac3"));var d=e[c+1]+2;c+=d,h-=d}break;case 194:case 135:return sr(r,new Error("Unsupported EC-3 in M2TS found"),void 0,a),s;case 36:-1===s.videoPid&&(s.videoPid=l,s.segmentVideoCodec="hevc",a.log("HEVC in M2TS found"))}t+=u+5}return s}function sr(e,t,i,n){n.warn("parsing error: ".concat(t.message)),e.emit(c.ERROR,c.ERROR,{type:l.MEDIA_ERROR,details:u.FRAG_PARSING_ERROR,fatal:!1,levelRetry:i,error:t,reason:t.message})}function or(e,t){t.log("".concat(e," with AES-128-CBC encryption found in unencrypted stream"))}function lr(e,t){var i,n,r,a,s,o=0,l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=kt(l[0],l[1]),mw(l).call(l,1,1);if(1===((i=l[0])[0]<<16)+(i[1]<<8)+i[2]){if((n=(i[4]<<8)+i[5])&&n>e.size-6)return null;var u=i[7];192&u&&(a=536870912*(14&i[9])+4194304*(255&i[10])+16384*(254&i[11])+128*(255&i[12])+(254&i[13])/2,64&u?a-(s=536870912*(14&i[14])+4194304*(255&i[15])+16384*(254&i[16])+128*(255&i[17])+(254&i[18])/2)>54e5&&(t.warn("".concat(Math.round((a-s)/9e4),"s delta between PTS and DTS, align them")),a=s):s=a);var c=(r=i[8])+9;if(e.size<=c)return null;e.size-=c;for(var h=new Uint8Array(e.size),d=0,f=l.length;d<f;d++){var v=(i=l[d]).byteLength;if(c){if(c>v){c-=v;continue}i=i.subarray(c),v-=c,c=0}h.set(i,o),o+=v}return n&&(n-=r+3),{data:h,pts:a,dts:s,len:n}}return null}var ur=function(){function e(){Zm(this,e)}return ey(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}(),cr=Math.pow(2,32)-1,hr=function(){function e(){Zm(this,e)}return ey(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 i=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:i,audio:n};var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,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,r))}},{key:"box",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r=8,a=i.length,s=a;a--;)r+=i[a].byteLength;var o=new Uint8Array(r);for(o[0]=r>>24&255,o[1]=r>>16&255,o[2]=r>>8&255,o[3]=255&r,o.set(e,4),a=0,r=8;a<s;a++)o.set(i[a],r),r+=i[a].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,i){i*=t;var n=Math.floor(i/(cr+1)),r=Math.floor(i%(cr+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,r>>24,r>>16&255,r>>8&255,255&r,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,i,n){return e.box(e.types.moof,e.mfhd(t),e.traf(n,i))}},{key:"moov",value:function(t){for(var i,n,r=t.length,a=[];r--;)a[r]=e.trak(t[r]);return e.box.apply(null,Hy(i=Hy(n=[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)]).call(n,a)).call(i,e.mvex(t)))}},{key:"mvex",value:function(t){for(var i,n=t.length,r=[];n--;)r[n]=e.trex(t[n]);return e.box.apply(null,Hy(i=[e.types.mvex]).call(i,r))}},{key:"mvhd",value:function(t,i){i*=t;var n=Math.floor(i/(cr+1)),r=Math.floor(i%(cr+1)),a=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,r>>24,r>>16&255,r>>8&255,255&r,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,a)}},{key:"sdtp",value:function(t){var i,n,r=t.samples||[],a=new Uint8Array(4+r.length);for(i=0;i<r.length;i++)n=OI(r[i]),a[i+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return e.box(e.types.sdtp,a)}},{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 i,n,r,a,s,o,l=[],u=[];for(a=0;a<t.sps.length;a++)o=(s=t.sps[a]).byteLength,l.push(o>>>8&255),l.push(255&o),l=Hy(l).call(l,iI(Array.prototype).call(s));for(a=0;a<t.pps.length;a++)o=(s=t.pps[a]).byteLength,u.push(o>>>8&255),u.push(255&o),u=Hy(u).call(u,iI(Array.prototype).call(s));var c=e.box(e.types.avcC,new Uint8Array(Hy(i=Hy(n=Hy(r=[1,l[3],l[4],l[5],255,224|t.sps.length]).call(r,l)).call(n,[t.pps.length])).call(i,u))),h=t.width,d=t.height,f=t.pixelRatio[0],v=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]),c,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,v>>24,v>>16&255,v>>8&255,255&v])))}},{key:"esds",value:function(e){var t,i=e.config;return new Uint8Array(Hy(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,mf(i),[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 i=t.id,n=t.duration*t.timescale,r=t.width,a=t.height,s=Math.floor(n/(cr+1)),o=Math.floor(n%(cr+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,i>>24&255,i>>16&255,i>>8&255,255&i,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,r>>8&255,255&r,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(t,i){var n=e.sdtp(t),r=t.id,a=Math.floor(i/(cr+1)),s=Math.floor(i%(cr+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,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 i=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,i){var n,r,a,s,o,l,u=t.samples||[],c=u.length,h=12+16*c,d=new Uint8Array(h);for(i+=8+h,d.set(["video"===t.type?1:0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0),n=0;n<c;n++)a=(r=u[n]).duration,s=r.size,o=OI(r),l=r.cts,d.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,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 i=e.moov(t);return kt(e.FTYP,i)}},{key:"hvc1",value:function(t){for(var i=t.params,n=[t.vps,t.sps,t.pps],r=new Uint8Array([1,i.general_profile_space<<6|(i.general_tier_flag?32:0)|i.general_profile_idc,i.general_profile_compatibility_flags[0],i.general_profile_compatibility_flags[1],i.general_profile_compatibility_flags[2],i.general_profile_compatibility_flags[3],i.general_constraint_indicator_flags[0],i.general_constraint_indicator_flags[1],i.general_constraint_indicator_flags[2],i.general_constraint_indicator_flags[3],i.general_constraint_indicator_flags[4],i.general_constraint_indicator_flags[5],i.general_level_idc,240|i.min_spatial_segmentation_idc>>8,255&i.min_spatial_segmentation_idc,252|i.parallelismType,252|i.chroma_format_idc,248|i.bit_depth_luma_minus8,248|i.bit_depth_chroma_minus8,0,Zk(i.frame_rate.fps),3|i.temporal_id_nested<<2|i.num_temporal_layers<<3|(i.frame_rate.fixed?64:0),n.length]),a=r.length,s=0;s<n.length;s+=1){a+=3;for(var o=0;o<n[s].length;o+=1)a+=2+n[s][o].length}var l=new Uint8Array(a);l.set(r,0),a=r.length;for(var u=n.length-1,c=0;c<n.length;c+=1){l.set(new Uint8Array([32+c|(c===u?128:0),0,n[c].length]),a),a+=3;for(var h=0;h<n[c].length;h+=1)l.set(new Uint8Array([n[c][h].length>>8,255&n[c][h].length]),a),a+=2,l.set(n[c][h],a),a+=n[c][h].length}var d=e.box(e.types.hvcC,l),f=t.width,v=t.height,g=t.pixelRatio[0],p=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,v>>8&255,255&v,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([g>>24,g>>16&255,g>>8&255,255&g,p>>24,p>>16&255,p>>8&255,255&p])))}}]),e}();function dr(e,t){var i=e*t*(arguments.length>2&&void 0!==arguments[2]?arguments[2]:1);return arguments.length>3&&void 0!==arguments[3]&&arguments[3]?Math.round(i):i}function fr(e){return dr(e,1e3,1/9e4,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}hr.types=void 0,hr.HDLR_TYPES=void 0,hr.STTS=void 0,hr.STSC=void 0,hr.STCO=void 0,hr.STSZ=void 0,hr.VMHD=void 0,hr.SMHD=void 0,hr.STSD=void 0,hr.FTYP=void 0,hr.DINF=void 0;var vr,gr=null,pr=null,mr=function(){function e(t,i,n,r){if(Zm(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=i,this.typeSupported=n,this.logger=r,this.ISGenerated=!1,null===gr){var a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);gr=a?Zk(a[1]):0}if(null===pr){var s=navigator.userAgent.match(/Safari\/(\d+)/i);pr=s?Zk(s[1]):0}}return ey(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,i=e[0].pts,n=ok(e).call(e,(function(e,n){var r=n.pts,a=r-e;return a<-4294967296&&(t=!0,a=(r=yr(r,i))-e),a>0?e:r}),i);return t&&this.logger.debug("PTS rollover detected"),n}},{key:"remux",value:function(e,t,i,n,r,a,s,o){var l,u,c,h,d,f,v=r,p=r,m=e.pid>-1,y=t.pid>-1,k=t.samples.length,T=e.samples.length>0,E=s&&k>0||k>1;if((!m||T)&&(!y||E)||this.ISGenerated||s){if(this.ISGenerated){var S,_,b,A,R=this.videoTrackConfig;(R&&(t.width!==R.width||t.height!==R.height||(null==(S=t.pixelRatio)?void 0:S[0])!==(null==(_=R.pixelRatio)?void 0:_[0])||(null==(b=t.pixelRatio)?void 0:b[1])!==(null==(A=R.pixelRatio)?void 0:A[1]))||!R&&E||null===this.nextAudioPts&&T)&&this.resetInitSegment()}this.ISGenerated||(c=this.generateIS(e,t,r,a));var L,I=this.isVideoContiguous,C=-1;if(E&&(C=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!I&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,C>0){var w,D;this.logger.warn(Hy(w="[mp4-remuxer]: Dropped ".concat(C," out of ")).call(w,k," video samples due to a missing keyframe"));var x=this.getVideoStartPts(t.samples);t.samples=iI(D=t.samples).call(D,C),t.dropped+=C,L=p+=(t.samples[0].pts-x)/t.inputTimeScale}else-1===C&&(this.logger.warn("[mp4-remuxer]: No keyframe found out of ".concat(k," video samples")),f=!1);if(this.ISGenerated){if(T&&E){var P=this.getVideoStartPts(t.samples),O=(yr(e.samples[0].pts,P)-P)/t.inputTimeScale;v+=Math.max(0,O),p+=Math.max(0,-O)}if(T){if(e.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),c=this.generateIS(e,t,r,a)),u=this.remuxAudio(e,v,this.isAudioContiguous,a,y||E||o===g.AUDIO?p:void 0),E){var M=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(e,t,r,a)),l=this.remuxVideo(t,p,I,M)}}else E&&(l=this.remuxVideo(t,p,I,0));l&&(l.firstKeyFrame=C,l.independent=-1!==C,l.firstKeyFramePTS=L)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=kr(i,r,this._initPTS,this._initDTS)),n.samples.length&&(h=Tr(n,r,this._initPTS))),{audio:u,video:l,initSegment:c,independent:f,text:h,id3:d}}},{key:"generateIS",value:function(e,t,i,n){var r,a,s,o=e.samples,l=t.samples,u=this.typeSupported,c={},h=this._initPTS,d=!h||n,f="audio/mp4";if(d&&(r=a=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":u.mpeg?(f="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}c.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&u.mpeg?new Uint8Array(0):hr.initSegment([e]),metadata:{channelCount:e.channelCount}},d&&(s=e.inputTimeScale,h&&s===h.timescale?d=!1:r=a=o[0].pts-Math.round(s*i))}if(t.sps&&t.pps&&l.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:hr.initSegment([t]),metadata:{width:t.width,height:t.height}},d)if(s=t.inputTimeScale,h&&s===h.timescale)d=!1;else{var v=this.getVideoStartPts(l),g=Math.round(s*i);a=Math.min(a,yr(l[0].dts,v)-g),r=Math.min(r,v-g)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Cy(c).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:r,timescale:s},this._initDTS={baseTime:a,timescale:s}):r=s=void 0,{tracks:c,initPTS:r,timescale:s}}},{key:"remuxVideo",value:function(e,t,i,n){var r,a,s=e.inputTimeScale,o=e.samples,h=[],d=o.length,f=this._initPTS,v=this.nextAvcDts,g=8,p=this.videoSampleDuration,m=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,T=!1;if(!i||null===v){var E=t*s,S=o[0].pts-yr(o[0].dts,o[0].pts);gr&&null!==v&&Math.abs(E-S-v)<15e3?i=!0:v=E-S}for(var _=f.baseTime*s/f.timescale,b=0;b<d;b++){var A=o[b];A.pts=yr(A.pts-_,v),A.dts=yr(A.dts-_,v),A.dts<o[b>0?b-1:b].dts&&(T=!0)}T&&XC(o).call(o,(function(e,t){var i=e.dts-t.dts,n=e.pts-t.pts;return i||n})),r=o[0].dts;var R=(a=o[o.length-1].dts)-r,L=R?Math.round(R/(d-1)):p||e.inputTimeScale/30;if(i){var I,C,w,D,x,P,O=r-v,M=O>L,N=O<-1;if((M||N)&&(M?this.logger.warn(Hy(I=Hy(C=Hy(w="".concat((e.segmentCodec||"").toUpperCase(),": ")).call(w,fr(O,!0)," ms (")).call(C,O,"dts) hole between fragments detected at ")).call(I,t.toFixed(3))):this.logger.warn(Hy(D=Hy(x=Hy(P="".concat((e.segmentCodec||"").toUpperCase(),": ")).call(P,fr(-O,!0)," ms (")).call(x,O,"dts) overlapping between fragments detected at ")).call(D,t.toFixed(3))),!N||v>=o[0].pts||gr)){var F,U;r=v;var B=o[0].pts-O;if(M)o[0].dts=r,o[0].pts=B;else for(var H=!0,G=0;G<o.length&&!(o[G].dts>B&&H);G++){var V=o[G].pts;if(o[G].dts-=O,o[G].pts-=O,G<o.length-1){var K=o[G+1].pts;H=K<=o[G].pts==K<=V}}this.logger.log(Hy(F=Hy(U="Video: Initial PTS/DTS adjusted: ".concat(fr(B,!0),"/")).call(U,fr(r,!0),", delta: ")).call(F,fr(O,!0)," ms"))}}for(var W=0,j=0,Y=r=Math.max(0,r),z=0;z<d;z++){for(var q=o[z],X=q.units,Q=X.length,$=0,Z=0;Z<Q;Z++)$+=X[Z].data.length;j+=$,W+=Q,q.length=$,q.dts<Y?(q.dts=Y,Y+=L/4|0||1):Y=q.dts,m=Math.min(q.pts,m),y=Math.max(q.pts,y)}a=o[d-1].dts;var J,ee=j+4*W+8;try{J=new Uint8Array(ee)}catch(De){return void this.observer.emit(c.ERROR,c.ERROR,{type:l.MUX_ERROR,details:u.REMUX_ALLOC_ERROR,fatal:!1,error:De,bytes:ee,reason:"fail allocating video mdat ".concat(ee)})}var te=new DataView(J.buffer);te.setUint32(0,ee),J.set(hr.types.mdat,4);for(var ie=!1,ne=Number.POSITIVE_INFINITY,re=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,se=Number.NEGATIVE_INFINITY,oe=0;oe<d;oe++){for(var le=o[oe],ue=le.units,ce=void 0,he=0,de=0,fe=ue.length;de<fe;de++){var ve=ue[de],ge=ve.data,pe=ve.data.byteLength;te.setUint32(g,pe),g+=4,J.set(ge,g),g+=pe,he+=4+pe}if(oe<d-1)p=o[oe+1].dts-le.dts,ce=o[oe+1].pts-le.pts;else{var me=this.config,ye=oe>0?le.dts-o[oe-1].dts:L;if(ce=oe>0?le.pts-o[oe-1].pts:L,me.stretchShortVideoTrack&&null!==this.nextAudioPts){var ke,Te=Math.floor(me.maxBufferHole*s),Ee=(n?m+n*s:this.nextAudioPts)-le.pts;Ee>Te?((p=Ee-ye)<0?p=ye:ie=!0,this.logger.log(Hy(ke="[mp4-remuxer]: It is approximately ".concat(Ee/90," ms to the next segment; using duration ")).call(ke,p/90," ms for the last video frame."))):p=ye}else p=ye}var Se=Math.round(le.pts-le.dts);ne=Math.min(ne,p),ae=Math.max(ae,p),re=Math.min(re,ce),se=Math.max(se,ce),h.push(new Er(le.key,p,he,Se))}if(h.length)if(gr){if(gr<70){var _e=OI(h[0]);_e.dependsOn=2,_e.isNonSync=0}}else if(pr&&se-re<ae-ne&&L/ae<.025&&0===h[0].cts){this.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var be=r,Ae=0,Re=h.length;Ae<Re;Ae++){var Le=be+h[Ae].duration,Ie=be+h[Ae].cts;if(Ae<Re-1){var Ce=Le+h[Ae+1].cts;h[Ae].duration=Ce-Ie}else h[Ae].duration=Ae?h[Ae-1].duration:L;h[Ae].cts=0,be=Le}}p=ie||!p?L:p,this.nextAvcDts=v=a+p,this.videoSampleDuration=p,this.isVideoContiguous=!0;var we={data1:hr.moof(e.sequenceNumber++,r,k({},e,{samples:h})),data2:J,startPTS:m/s,endPTS:(y+p)/s,startDTS:r/s,endDTS:v/s,type:"video",hasAudio:!1,hasVideo:!0,nb:h.length,dropped:e.dropped};return e.samples=[],e.dropped=0,we}},{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,i,n,r){var a=e.inputTimeScale,s=a/(e.samplerate?e.samplerate:a),o=this.getSamplesPerFrame(e),h=o*s,d=this._initPTS,f="mp3"===e.segmentCodec&&this.typeSupported.mpeg,v=[],g=void 0!==r,p=e.samples,m=f?0:8,y=this.nextAudioPts||-1,T=t*a,E=d.baseTime*a/d.timescale;if(this.isAudioContiguous=i=i||p.length&&y>0&&(n&&Math.abs(T-y)<9e3||Math.abs(yr(p[0].pts-E,T)-y)<20*h),Py(p).call(p,(function(e){e.pts=yr(e.pts-E,T)})),!i||y<0){if(!(p=Dy(p).call(p,(function(e){return e.pts>=0}))).length)return;y=0===r?0:n&&!g?Math.max(0,T):p[0].pts}if("aac"===e.segmentCodec)for(var S=this.config.maxAudioFramesDrift,_=0,b=y;_<p.length;_++){var A,R=p[_],L=R.pts,I=L-b,C=Math.abs(1e3*I/a);if(I<=-S*h&&g)0===_&&(this.logger.warn(Hy(A="Audio frame @ ".concat((L/a).toFixed(3),"s overlaps nextAudioPts by ")).call(A,Math.round(1e3*I/a)," ms.")),this.nextAudioPts=y=b=L);else if(I>=S*h&&C<1e4&&g){var w,D,x=Math.round(I/h);(b=L-x*h)<0&&(x--,b+=h),0===_&&(this.nextAudioPts=y=b),this.logger.warn(Hy(w=Hy(D="[mp4-remuxer]: Injecting ".concat(x," audio frame @ ")).call(D,(b/a).toFixed(3),"s due to ")).call(w,Math.round(1e3*I/a)," ms gap."));for(var P=0;P<x;P++){var O=Math.max(b,0),M=ur.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);M||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),M=R.unit.subarray()),mw(p).call(p,_,0,{unit:M,pts:O}),b+=h,_++}}R.pts=b,b+=h}for(var N,F=null,U=null,B=0,H=p.length;H--;)B+=p[H].unit.byteLength;for(var G=0,V=p.length;G<V;G++){var K=p[G],W=K.unit,j=K.pts;if(null!==U)v[G-1].duration=Math.round((j-U)/s);else{if(i&&"aac"===e.segmentCodec&&(j=y),F=j,!(B>0))return;B+=m;try{N=new Uint8Array(B)}catch(J){return void this.observer.emit(c.ERROR,c.ERROR,{type:l.MUX_ERROR,details:u.REMUX_ALLOC_ERROR,fatal:!1,error:J,bytes:B,reason:"fail allocating audio mdat ".concat(B)})}f||(new DataView(N.buffer).setUint32(0,B),N.set(hr.types.mdat,4))}N.set(W,m);var Y=W.byteLength;m+=Y,v.push(new Er(!0,o,Y,0)),U=j}var z=v.length;if(z){var q=v[v.length-1];this.nextAudioPts=y=U+s*q.duration;var X=f?new Uint8Array(0):hr.moof(e.sequenceNumber++,F/s,k({},e,{samples:v}));e.samples=[];var Q=F/a,$=y/a,Z={data1:X,data2:N,startPTS:Q,endPTS:$,startDTS:Q,endDTS:$,type:"audio",hasAudio:!0,hasVideo:!1,nb:z};return this.isAudioContiguous=!0,Z}}}]),e}();function yr(e,t){var i;if(null===t)return e;for(i=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=i;return e}function kr(e,t,i,n){var r=e.samples.length;if(r){for(var a=e.inputTimeScale,s=0;s<r;s++){var o=e.samples[s];o.pts=yr(o.pts-i.baseTime*a/i.timescale,t*a)/a,o.dts=yr(o.dts-n.baseTime*a/n.timescale,t*a)/a}var l=e.samples;return e.samples=[],{samples:l}}}function Tr(e,t,i){var n,r=e.samples.length;if(r){for(var a=e.inputTimeScale,s=0;s<r;s++){var o=e.samples[s];o.pts=yr(o.pts-i.baseTime*a/i.timescale,t*a)/a}XC(n=e.samples).call(n,(function(e,t){return e.pts-t.pts}));var l=e.samples;return e.samples=[],{samples:l}}}var Er=ey((function e(t,i,n,r){Zm(this,e),this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=i,this.size=n,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}));function Sr(e,t){var i=null==e?void 0:e.codec;return i&&i.length>4?i:t===qe?"ec-3"===i||"ac-3"===i||"alac"===i?i:"fLaC"===i||"Opus"===i?B(i,!1):(I.warn('Unhandled audio codec "'.concat(i,'" in mp4 MAP')),i||"mp4a"):(I.warn('Unhandled video codec "'.concat(i,'" in mp4 MAP')),i||"avc1")}try{var _r;vr=Iy(_r=self.performance.now).call(_r,self.performance)}catch(Eo){vr=JC}var br=[{demux:function(){function e(t,i){Zm(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=i}return ey(e,[{key:"resetTimeStamp",value:function(){}},{key:"resetInitSegment",value:function(e,t,i,n){var r=this.videoTrack=xn("video",1),a=this.audioTrack=xn("audio",1),s=this.txtTrack=xn("text",1);if(this.id3Track=xn("id3",1),this.timeOffset=0,null!=e&&e.byteLength){var o=dt(e);if(o.video){var l=o.video,u=l.id,c=l.timescale,h=l.codec;r.id=u,r.timescale=s.timescale=c,r.codec=h}if(o.audio){var d=o.audio,f=d.id,v=d.timescale,g=d.codec;a.id=f,a.timescale=v,a.codec=g}s.id=nt.text,r.sampleDuration=0,r.duration=a.duration=n}}},{key:"resetContiguity",value:function(){this.remainderData=null}},{key:"demux",value:function(e,t){this.timeOffset=t;var i=e,n=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=kt(this.remainderData,e));var a=function(e){var t={valid:null,remainder:null},i=ct(e,["moof"]);if(i.length<2)return t.remainder=e,t;var n=i[i.length-1];return t.valid=Oe(e,0,n.byteOffset-8),t.remainder=Oe(e,n.byteOffset-8),t}(i);this.remainderData=a.remainder,n.samples=a.valid||new Uint8Array}else n.samples=i;var s=this.extractID3Track(n,t);return r.samples=Tt(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}},{key:"flush",value:function(){var e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;var n=this.extractID3Track(t,this.timeOffset);return i.samples=Tt(e,t),{videoTrack:t,audioTrack:xn(),id3Track:n,textTrack:xn()}}},{key:"extractID3Track",value:function(e,t){var i=this,n=this.id3Track;if(e.samples.length){var r=ct(e.samples,["emsg"]);r&&Py(r).call(r,(function(e){var r,a=function(e){var t=e[0],i="",n="",r=0,a=0,o=0,l=0,u=0,c=0;if(0===t){for(;"\0"!==rt(e.subarray(c,c+1));)i+=rt(e.subarray(c,c+1)),c+=1;for(i+=rt(e.subarray(c,c+1)),c+=1;"\0"!==rt(e.subarray(c,c+1));)n+=rt(e.subarray(c,c+1)),c+=1;n+=rt(e.subarray(c,c+1)),c+=1,r=st(e,12),a=st(e,16),l=st(e,20),u=st(e,24),c=28}else if(1===t){r=st(e,c+=4);var h=st(e,c+=4),d=st(e,c+=4);for(c+=4,o=Math.pow(2,32)*h+d,s(o)||(o=cy,I.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=st(e,c),u=st(e,c+=4),c+=4;"\0"!==rt(e.subarray(c,c+1));)i+=rt(e.subarray(c,c+1)),c+=1;for(i+=rt(e.subarray(c,c+1)),c+=1;"\0"!==rt(e.subarray(c,c+1));)n+=rt(e.subarray(c,c+1)),c+=1;n+=rt(e.subarray(c,c+1)),c+=1}return{schemeIdUri:i,value:n,timeScale:r,presentationTime:o,presentationTimeDelta:a,eventDuration:l,id:u,payload:e.subarray(c,e.byteLength)}}(e);if(qn.test(a.schemeIdUri)){var o=Xn(a,t),l=4294967295===a.eventDuration?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);var u=a.payload;n.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Dn.emsg,duration:l})}else if(i.config.enableEmsgKLVMetadata&&wk(r=a.schemeIdUri).call(r,"urn:misb:KLV:bin:1910.1")){var c=Xn(a,t);n.samples.push({data:a.payload,len:a.payload.byteLength,dts:c,pts:c,type:Dn.misbklv,duration:Number.POSITIVE_INFINITY})}}))}return n}},{key:"demuxSampleAes",value:function(e,t,i){return nb.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,i=0;i<t;){var n=st(e,i);if(n>8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=n>1?i+n:t}return!1}(e)}}]),e}(),remux:function(){function e(t,i,n,r){Zm(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=r}return ey(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,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(e,t,i){if(!e||!t)return e;var n=t.keyId;return n&&t.isCommonEncryption&&Py(i=ct(e,["moov","trak"])).call(i,(function(e){var t=ct(e,["mdia","minf","stbl","stsd"])[0].subarray(8),i=ct(t,["enca"]),r=i.length>0;r||(i=ct(t,["encv"])),Py(i).call(i,(function(e){var t;Py(t=ct(r?e.subarray(28):e.subarray(78),["sinf"])).call(t,(function(e){var t=mt(e);if(t){var i,a,s=t.subarray(8,24);Yy(s).call(s,(function(e){return 0!==e}))||(I.log(Hy(i=Hy(a="[eme] Patching keyId in 'enc".concat(r?"a":"v",">sinf>>tenc' box: ")).call(a,Ue(s)," -> ")).call(i,Ue(n))),t.set(n,8))}}))}))})),e}(e,n)),this.emitInitSegment=!0}},{key:"generateInitSegment",value:function(e){var t=this.audioCodec,i=this.videoCodec;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var n=this.initData=dt(e);n.audio&&(t=Sr(n.audio,qe)),n.video&&(i=Sr(n.video,Xe));var r={};n.audio&&n.video?r.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:n.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?r.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:this.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}},{key:"remux",value:function(e,t,i,n,r,s){var o,l,u,c,h=this.initPTS,d=this.lastEndTime,f={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};a(d)||(d=this.lastEndTime=r||0);var v=t.samples;if(null==v||!v.length)return f;var g={initPTS:void 0,timescale:1},p=this.initData;if(null!=(u=p)&&u.length||(this.generateInitSegment(v),p=this.initData),null==(c=p)||!c.length)return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(g.tracks=this.initTracks,this.emitInitSegment=!1);var m,y,k=function(e,t){for(var i=0,n=0,r=0,s=ct(e,["moof","traf"]),o=0;o<s.length;o++){var l=s[o],u=ct(l,["tfhd"])[0],c=t[st(u,4)];if(c){var h=c.default,d=st(u,0)|(null==h?void 0:OI(h)),f=null==h?void 0:h.duration;8&d&&(f=st(u,2&d?12:8));for(var v=c.timescale||9e4,g=ct(l,["trun"]),p=0;p<g.length;p++)!(i=yt(g[p]))&&f&&(i=f*st(g[p],4)),c.type===Xe?n+=i/v:c.type===qe&&(r+=i/v)}}if(0===n&&0===r){for(var m=1/0,y=0,k=0,T=ct(e,["sidx"]),E=0;E<T.length;E++){var S=ht(T[E]);if(null!=S&&S.references){var _;m=Math.min(m,S.earliestPresentationTime/S.timescale);var b=ok(_=S.references).call(_,(function(e,t){return e+t.info.duration||0}),0);k=(y=Math.max(y,b+S.earliestPresentationTime/S.timescale))-m}}if(k&&a(k))return k}return n||r}(v,p),T=(m=p,ok(y=ct(v,["moof","traf"])).call(y,(function(e,t){var i,n=ct(t,["tfdt"])[0],r=n[0],s=ok(i=ct(t,["tfhd"])).call(i,(function(e,t){var i=st(t,4),s=m[i];if(s){var o=st(n,4);if(1===r){if(o===tt)return I.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;o*=tt+1,o+=st(n,8)}var l=o/(s.timescale||9e4);if(a(l)&&(null===e||l<e))return l}return e}),null);return null!==s&&a(s)&&(null===e||s<e)?s:e}),null)),E=null===T?r:T;(function(e,t,i,n){if(null===e)return!0;var r=Math.max(n,1),a=t-e.baseTime/e.timescale;return Math.abs(a-i)>r}(h,E,r,k)||g.timescale!==h.timescale&&s)&&(g.initPTS=E-r,h&&1===h.timescale&&this.logger.warn(Hy(o=Hy(l="Adjusting initPTS @".concat(r," from ")).call(l,h.baseTime/h.timescale," to ")).call(o,g.initPTS)),this.initPTS=h={baseTime:g.initPTS,timescale:1});var S=e?E-h.baseTime/h.timescale:d,_=S+k;!function(e,t,i,n){Py(n=ct(t,["moof","traf"])).call(n,(function(t){var n;Py(n=ct(t,["tfhd"])).call(n,(function(n){var r,a=st(n,4),s=e[a];if(s){var o=s.timescale||9e4;Py(r=ct(t,["tfdt"])).call(r,(function(e){var t=e[0],n=i*o;if(n){var r=st(e,4);if(0===t)r-=n,ut(e,4,r=Math.max(r,0));else{r*=Math.pow(2,32),r+=st(e,8),r-=n,r=Math.max(r,0);var a=Math.floor(r/(tt+1)),s=Math.floor(r%(tt+1));ut(e,4,a),ut(e,8,s)}}}))}}))}))}(p,v,h.baseTime/h.timescale),k>0?this.lastEndTime=_:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var b=!!p.audio,A=!!p.video,R="";b&&(R+="audio"),A&&(R+="video");var L={data1:v,startPTS:S,startDTS:S,endPTS:_,endDTS:_,type:R,hasAudio:b,hasVideo:A,nb:1,dropped:0};return f.audio="audio"===L.type?L:void 0,f.video="audio"!==L.type?L:void 0,f.initSegment=g,f.id3=kr(i,r,h,h),n.samples.length&&(f.text=Tr(n,r,h)),f}}]),e}()},{demux:ir,remux:mr},{demux:function(e){Qm(i,e);var t=$m(i);function i(e,n){var r;return Zm(this,i),(r=t.call(this)).observer=void 0,r.config=void 0,r.observer=e,r.config=n,r}return ey(i,[{key:"resetInitSegment",value:function(e,t,n,r){ev(Jf(i.prototype),"resetInitSegment",this).call(this,e,t,n,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return(n=t)+5<(i=e).length&&fn(i,n)&&gn(i,n)<=i.length-n;var i,n}},{key:"appendFrame",value:function(e,t,i){yn(e,this.observer,t,i,e.manifestCodec);var n=Tn(e,t,i,this.basePTS,this.frameIndex);if(n&&0===n.missing)return n}}],[{key:"probe",value:function(e,t){if(!e)return!1;var i=dn(e,0),n=(null==i?void 0:i.length)||0;if(Wn(e,n))return!1;for(var r=e.length;n<r;n++)if(mn(e,n))return t.log("ADTS sync word found !"),!0;return!1}}]),i}(Pn),remux:mr},{demux:function(e){Qm(i,e);var t=$m(i);function i(){return Zm(this,i),t.apply(this,arguments)}return ey(i,[{key:"resetInitSegment",value:function(e,t,n,r){ev(Jf(i.prototype),"resetInitSegment",this).call(this,e,t,n,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return Vn(i=e,n=t)&&4<=i.length-n;var i,n}},{key:"appendFrame",value:function(e,t,i){if(null!==this.basePTS)return Hn(e,t,i,this.basePTS,this.frameIndex)}}],[{key:"probe",value:function(e){if(!e)return!1;var t=dn(e,0),i=(null==t?void 0:t.length)||0;if(t&&11===e[i]&&119===e[i+1]&&void 0!==wn(t)&&jn(e,i)<=16)return!1;for(var n=e.length;i<n;i++)if(Wn(e,i))return I.log("MPEG Audio sync word found !"),!0;return!1}}]),i}(Pn),remux:mr}];mw(br).call(br,2,0,{demux:Yn,remux:mr});var Ar=function(){function e(t,i,n,r,a,s){Zm(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=i,this.config=n,this.id=a,this.logger=s}return ey(e,[{key:"configure",value:function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}},{key:"push",value:function(e,t,i,n){var r=this,a=i.transmuxing;a.executeStart=vr();var s=new Uint8Array(e),o=this.currentTransmuxState,h=this.transmuxConfig;n&&(this.currentTransmuxState=n);var d,f,v=n||o,g=v.contiguous,p=v.discontinuity,m=v.trackSwitch,y=v.accurateTimeOffset,k=v.timeOffset,T=v.initSegmentChange,E=h.audioCodec,S=h.videoCodec,_=h.defaultInitPts,b=h.duration,A=h.initSegmentData,R=(d=t,f=null,s.byteLength>0&&null!=(null==d?void 0:d.key)&&null!==d.iv&&null!=d.method&&(f=d),f);if(R&&zt(R.method)){var L=this.getDecrypter(),I=qt(R.method);if(!L.isSync())return this.asyncResult=!0,this.decryptionPromise=L.webCryptoDecrypt(s,R.key.buffer,R.iv.buffer,I).then((function(e){var t=r.push(e,null,i);return r.decryptionPromise=null,t})),this.decryptionPromise;var C=L.softwareDecrypt(s,R.key.buffer,R.iv.buffer,I);if(i.part>-1){var w=L.flush();C=w?w.buffer:w}if(!C)return a.executeEnd=vr(),Rr(i);s=new Uint8Array(C)}var D=this.needsProbing(p,m);if(D){var x=this.configureTransmuxer(s);if(x)return this.logger.warn("[transmuxer] ".concat(x.message)),this.observer.emit(c.ERROR,c.ERROR,{type:l.MEDIA_ERROR,details:u.FRAG_PARSING_ERROR,fatal:!1,error:x,reason:x.message}),a.executeEnd=vr(),Rr(i)}(p||m||T||D)&&this.resetInitSegment(A,E,S,b,t),(p||T||D)&&this.resetInitialTimestamp(_),g||this.resetContiguity();var P=this.transmux(s,R,k,y,i);this.asyncResult=Lr(P);var O=this.currentTransmuxState;return O.contiguous=!0,O.discontinuity=!1,O.trackSwitch=!1,a.executeEnd=vr(),P}},{key:"flush",value:function(e){var t=this,i=e.transmuxing;i.executeStart=vr();var n=this.decrypter,r=this.currentTransmuxState,a=this.decryptionPromise;if(a)return this.asyncResult=!0,a.then((function(){return t.flush(e)}));var s=[],o=r.timeOffset;if(n){var l=n.flush();l&&s.push(this.push(l.buffer,null,e))}var u=this.demuxer,c=this.remuxer;if(!u||!c){i.executeEnd=vr();var h=[Rr(e)];return this.asyncResult?nb.resolve(h):h}var d=u.flush(o);return Lr(d)?(this.asyncResult=!0,d.then((function(i){return t.flushRemux(s,i,e),s}))):(this.flushRemux(s,d,e),this.asyncResult?nb.resolve(s):s)}},{key:"flushRemux",value:function(e,t,i){var n,r,a,s,o=t.audioTrack,l=t.videoTrack,u=t.id3Track,c=t.textTrack,h=this.currentTransmuxState,d=h.accurateTimeOffset,f=h.timeOffset;this.logger.log(Hy(n=Hy(r=Hy(a=Hy(s="[transmuxer.ts]: Flushed ".concat(this.id," sn: ")).call(s,i.sn)).call(a,i.part>-1?" part: "+i.part:""," of ")).call(r,this.id===g.MAIN?"level":"track"," ")).call(n,i.level));var v=this.remuxer.remux(o,l,u,c,f,d,!0,this.id);e.push({remuxResult:v,chunkMeta:i}),i.transmuxing.executeEnd=vr()}},{key:"resetInitialTimestamp",value:function(e){var t=this.demuxer,i=this.remuxer;t&&i&&(t.resetTimeStamp(e),i.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,i,n,r){var a=this.demuxer,s=this.remuxer;a&&s&&(a.resetInitSegment(e,t,i,n),s.resetInitSegment(e,t,i,r))}},{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,i,n,r){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,n,r):this.transmuxUnencrypted(e,i,n,r)}},{key:"transmuxUnencrypted",value:function(e,t,i,n){var r=this.demuxer.demux(e,t,!1,!this.config.progressive),a=r.audioTrack,s=r.videoTrack,o=r.id3Track,l=r.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,l,t,i,!1,this.id),chunkMeta:n}}},{key:"transmuxSampleAes",value:function(e,t,i,n,r){var a=this;return this.demuxer.demuxSampleAes(e,t,i).then((function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,n,!1,a.id),chunkMeta:r}}))}},{key:"configureTransmuxer",value:function(e){for(var t,i=this.config,n=this.observer,r=this.typeSupported,a=0,s=br.length;a<s;a++){var o;if(null!=(o=br[a].demux)&&o.probe(e,this.logger)){t=br[a];break}}if(!t)return new Error("Failed to find demuxer by probing fragment data");var l=this.demuxer,u=this.remuxer,c=t.remux,h=t.demux;u&&u instanceof c||(this.remuxer=new c(n,i,r,this.logger)),l&&l instanceof h||(this.demuxer=new h(n,i,r,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 Rt(this.config)),e}}]),e}(),Rr=function(e){return{remuxResult:{},chunkMeta:e}};function Lr(e){return"then"in e&&e.then instanceof Function}var Ir=ey((function e(t,i,n,r,a){Zm(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=i,this.initSegmentData=n,this.duration=r,this.defaultInitPts=a||null})),Cr=ey((function e(t,i,n,r,a,s){Zm(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=i,this.accurateTimeOffset=n,this.trackSwitch=r,this.timeOffset=a,this.initSegmentChange=s})),wr=0,Dr=function(){function e(t,i,n,r){var a=this;Zm(this,e),this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=wr++,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,i=a.hls;if(i&&null!=t&&t.event&&t.instanceNo===a.instanceNo)switch(t.event){case"init":var n,r=null==(n=a.workerContext)?void 0:n.objectURL;r&&tI.revokeObjectURL(r);break;case"transmuxComplete":a.handleTransmuxComplete(t.data);break;case"flush":a.onFlush(t.data);break;case"workerLog":i.logger[t.data.logType]&&i.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=a.frag,t.data.part=a.part,t.data.id=a.id,i.trigger(t.event,t.data)}},this.onWorkerError=function(e){var t,i;if(a.hls){var n=new Error(Hy(t=Hy(i="".concat(e.message," (")).call(i,e.filename,":")).call(t,e.lineno,")"));a.hls.config.enableWorker=!1,a.hls.logger.warn('Error in "'.concat(a.id,'" Web Worker, fallback to inline')),a.hls.trigger(c.ERROR,{type:l.OTHER_ERROR,details:u.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:n})}};var s=t.config;this.hls=t,this.id=i,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=r;var o=function(e,t){(t=t||{}).frag=a.frag||void 0,e===c.ERROR&&(t.parent=a.id,t.part=a.part,a.error=t.error),a.hls.trigger(e,t)};this.observer=new sn,this.observer.on(c.FRAG_DECRYPTED,o),this.observer.on(c.ERROR,o);var h=V(s.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){var d=this.hls.logger;if(s.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{var f;s.workerPath?(d.log(Hy(f="loading Web Worker ".concat(s.workerPath,' for "')).call(f,i,'"')),this.workerContext=function(e){var t=ln[e];if(t)return t.clientCount++,t;var i=new tI(e,self.location.href).href,n={worker:new self.Worker(i),scriptURL:i,clientCount:1};return ln[e]=n,n}(s.workerPath)):(d.log('injecting Web Worker for "'.concat(i,'"')),this.workerContext=function(){var e=ln[on];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"}),i=tI.createObjectURL(t),n={worker:new self.Worker(i),objectURL:i,clientCount:1};return ln[on]=n,n}());var v=this.workerContext.worker;v.addEventListener("message",this.onWorkerMessage),v.addEventListener("error",this.onWorkerError),v.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:h,id:i,config:bI(s)})}catch(Eo){d.warn('Error setting up "'.concat(i,'" Web Worker, fallback to inline'),Eo),this.terminateWorker(),this.error=null,this.transmuxer=new Ar(this.observer,h,s,"",i,t.logger)}return}}this.transmuxer=new Ar(this.observer,h,s,"",i,t.logger)}return ey(e,[{key:"reset",value:function(){if(this.frag=null,this.part=null,this.workerContext){var e=this.instanceNo;this.instanceNo=wr++;var t=this.hls.config,i=V(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:bI(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=ln[e||on];if(t&&1==t.clientCount--){var i=t.worker,n=t.objectURL;delete ln[e||on],n&&tI.revokeObjectURL(n),i.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,i,n,r,a,s,o,l,u){var c,h,d=this;l.transmuxing.start=self.performance.now();var f=this.instanceNo,v=this.transmuxer,p=a?a.start:r.start,m=r.decryptdata,y=this.frag,k=!(y&&r.cc===y.cc),T=!(y&&l.level===y.level),E=y?l.sn-y.sn:-1,S=this.part?l.part-this.part.index:-1,_=0===E&&l.id>1&&l.id===(null==y?void 0:y.stats.chunkCount),b=!T&&(1===E||0===E&&(1===S||_&&S<=0)),A=self.performance.now();(T||E||0===r.stats.parsing.start)&&(r.stats.parsing.start=A),!a||!S&&b||(a.stats.parsing.start=A);var R=!(y&&(null==(c=r.initSegment)?void 0:c.url)===(null==(h=y.initSegment)?void 0:h.url)),L=new Cr(k,b,o,T,p,R);if(!b||k||R){var I,C,w,D,x,P,O,M,N,F,U;this.hls.logger.log(Hy(I=Hy(C=Hy(w=Hy(D=Hy(x=Hy(P=Hy(O=Hy(M=Hy(N=Hy(F=Hy(U="[transmuxer-interface]: Starting new transmux session for ".concat(r.type," sn: ")).call(U,l.sn)).call(F,l.part>-1?" part: "+l.part:""," ")).call(N,this.id===g.MAIN?"level":"track",": ")).call(M,l.level," id: ")).call(O,l.id,"\n discontinuity: ")).call(P,k,"\n trackSwitch: ")).call(x,T,"\n contiguous: ")).call(D,b,"\n accurateTimeOffset: ")).call(w,o,"\n timeOffset: ")).call(C,p,"\n initSegmentChange: ")).call(I,R));var B=new Ir(i,n,t,s,u);this.configureTransmuxer(B)}if(this.frag=r,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:m,chunkMeta:l,state:L},e instanceof ArrayBuffer?[e]:[]);else if(v){var H=v.push(e,m,l,L);Lr(H)?H.then((function(e){d.handleTransmuxComplete(e)})).catch((function(e){d.transmuxerError(e,l,"transmuxer-interface push error")})):this.handleTransmuxComplete(H)}}},{key:"flush",value:function(e){var t=this;e.transmuxing.start=self.performance.now();var i=this.instanceNo,n=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:i,cmd:"flush",chunkMeta:e});else if(n){var r=n.flush(e);Lr(r)?r.then((function(i){t.handleFlushResult(i,e)})).catch((function(i){t.transmuxerError(i,e,"transmuxer-interface flush error")})):this.handleFlushResult(r,e)}}},{key:"transmuxerError",value:function(e,t,i){this.hls&&(this.error=e,this.hls.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}},{key:"handleFlushResult",value:function(e,t){var i=this;Py(e).call(e,(function(e){i.handleTransmuxComplete(e)})),this.onFlush(t)}},{key:"configureTransmuxer",value:function(e){var t=this.instanceNo,i=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}},{key:"handleTransmuxComplete",value:function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}]),e}();function xr(e,t){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!Pr(e[i].attrs,t[i].attrs))return!1;return!0}function Pr(e,t,i){var n,r=e["STABLE-RENDITION-ID"];return r&&!i?r===t["STABLE-RENDITION-ID"]:!Yy(n=i||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).call(n,(function(i){return e[i]!==t[i]}))}function Or(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}var Mr=function(e){Qm(i,e);var t=$m(i);function i(e,n,r){var a;return Zm(this,i),(a=t.call(this,e,n,r,"audio-stream-controller",g.AUDIO)).mainAnchor=null,a.mainFragLoading=null,a.audioOnly=!1,a.bufferedTrack=null,a.switchingTrack=null,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.flushing=!1,a.bufferFlushed=!1,a.cachedTrackLoadedData=null,a.registerListeners(),a}return ey(i,[{key:"onHandlerDestroying",value:function(){this.unregisterListeners(),ev(Jf(i.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(){ev(Jf(i.prototype),"registerListeners",this).call(this);var e=this.hls;e.on(c.LEVEL_LOADED,this.onLevelLoaded,this),e.on(c.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(c.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(c.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(c.BUFFER_RESET,this.onBufferReset,this),e.on(c.BUFFER_CREATED,this.onBufferCreated,this),e.on(c.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(c.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(c.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(c.FRAG_LOADING,this.onFragLoading,this),e.on(c.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(ev(Jf(i.prototype),"unregisterListeners",this).call(this),e.off(c.LEVEL_LOADED,this.onLevelLoaded,this),e.off(c.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(c.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(c.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(c.BUFFER_RESET,this.onBufferReset,this),e.off(c.BUFFER_CREATED,this.onBufferCreated,this),e.off(c.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(c.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(c.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(c.FRAG_LOADING,this.onFragLoading,this),e.off(c.FRAG_BUFFERED,this.onFragBuffered,this))}},{key:"onInitPtsFound",value:function(e,t){var i=t.frag,n=t.id,r=t.initPTS,a=t.timescale;if(n===g.MAIN){var s,o,l=i.cc,u=this.fragCurrent;if(this.initPTS[l]={baseTime:r,timescale:a},this.log(Hy(s=Hy(o="InitPTS for cc: ".concat(l," found from main: ")).call(o,r,"/")).call(s,a)),this.mainAnchor=i,this.state===en){var c=this.waitingData;(!c&&!this.loadingParts||c&&c.frag.cc!==l)&&(this.nextLoadPosition=this.findSyncFrag(i).start),this.tick()}else!this.hls.hasEnoughToStart&&u&&u.cc!==l?(this.startFragRequested=!1,this.nextLoadPosition=this.findSyncFrag(i).start,u.abortRequests(),this.resetLoadingState()):this.state===ji&&this.tick()}}},{key:"findSyncFrag",value:function(e){var t=this.getLevelDetails(),i=e.cc;return function(e,t,i){if(e&&e.startCC<=t&&e.endCC>=t){var n=i.start,r=i.end,a=e.fragments;if(!i.relurl){var s=e.fragmentHint;s&&(a=Hy(a).call(a,s))}return ce(a,(function(e){return e.cc<t||e.end<=n?1:e.cc>t||e.start>=r?-1:0}))}return null}(t,i,e)||t&&ve(t.fragments,i)||e}},{key:"startLoad",value:function(e){if(!this.levels)return this.startPosition=e,void(this.state=Wi);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=ji):this.state=Xi,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}},{key:"doTick",value:function(){switch(this.state){case ji:this.doTickIdle();break;case Xi:var e=this.levels,t=this.trackId,n=null==e?void 0:e[t],r=null==n?void 0:n.details;if(r&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(r))break;this.state=en}break;case qi:var a,s=performance.now(),o=this.retryDate;if(!o||s>=o||null!=(a=this.media)&&a.seeking){var l=this.levels,u=this.trackId;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==l?void 0:l[u])||null),this.state=ji}break;case en:var c=this.waitingData;if(c){var h,d=c.frag,f=c.part,v=c.cache,g=c.complete,p=this.mainAnchor;if(void 0!==this.initPTS[d.cc]){this.waitingData=null,this.state=zi;var m={frag:d,part:f,payload:v.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(m),g&&ev(Jf(i.prototype),"_handleFragmentLoadComplete",this).call(this,m)}else p&&p.cc!==c.frag.cc&&(this.log(Hy(h="Waiting fragment cc (".concat(d.cc,") cancelled because video is at cc ")).call(h,p.cc)),this.nextLoadPosition=this.findSyncFrag(p).start,this.clearWaitingFragment())}else this.state=ji}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!==Wi&&(this.state=ji))}},{key:"resetLoadingState",value:function(){this.clearWaitingFragment(),ev(Jf(i.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,i=this.levels,n=this.media,r=this.trackId,a=t.config;if(this.buffering&&(n||!this.startFragRequested&&a.startFragPrefetch)&&null!=i&&i[r]){var s=i[r],o=s.details;if(!o||this.waitForLive(s)||this.waitForCdnTuneIn(o))return this.state=Xi,void(this.startFragRequested=!1);var l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,qe,g.AUDIO));var u=this.getFwdBufferInfo(l,g.AUDIO);if(null!==u){var h=this.bufferedTrack,d=this.switchingTrack;if(!d&&this._streamEnded(u,o))return t.trigger(c.BUFFER_EOS,{type:"audio"}),void(this.state=Zi);var f=u.len,v=t.maxBufferLength,p=o.fragments,m=p[0].start,y=this.getLoadPosition(),k=this.flushing?y:u.end;if(d&&n){var T=y;h&&!Pr(d.attrs,h.attrs)&&(k=T),o.PTSKnown&&T<m&&(u.end>m||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=m+.05)}if(!(f>=v&&!d&&k<p[p.length-1].start)){var E=this.getNextFragment(k,o);if(E&&this.isLoopLoading(E,k)&&(E=this.getNextFragmentLoopLoading(E,o,u,g.MAIN,v)),E){var S=null==(e=this.mainFragLoading)?void 0:e.frag;if(!this.audioOnly&&this.startFragRequested&&S&&Ze(S)&&Ze(E)&&!E.endList&&(!o.live||!this.loadingParts&&k<this.hls.liveSyncPosition)){var _=S;if(E.start>_.end){var b=this.fragmentTracker.getFragAtPos(k,g.MAIN);b&&b.end>S.end&&(_=b,this.mainFragLoading={frag:b,targetBufferTime:null})}if(E.start>_.end)return}this.loadFragment(E,s,k)}else this.bufferFlushed=!0}}}}},{key:"onMediaDetaching",value:function(e,t){this.bufferFlushed=this.flushing=!1,ev(Jf(i.prototype),"onMediaDetaching",this).call(this,e,t)}},{key:"onAudioTracksUpdated",value:function(e,t){var i=t.audioTracks;this.resetTransmuxer(),this.levels=ub(i).call(i,(function(e){return new Z(e)}))}},{key:"onAudioTrackSwitching",value:function(e,t){var i=!!t.url;this.trackId=t.id;var n=this.fragCurrent;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==Wi&&(this.setInterval(100),this.state=ji,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}},{key:"onManifestLoading",value:function(){ev(Jf(i.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 i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.hls.trigger(c.AUDIO_TRACK_LOADED,i))}},{key:"onAudioTrackLoaded",value:function(e,t){var i,n,r,a,s,o,l=this.levels,u=t.details,h=t.id,d=this.mainDetails;if(!d||d.expired||u.endCC>d.endCC)return this.cachedTrackLoadedData=t,void(this.state!==Wi&&(this.state=Xi));if(l){this.log(Hy(i=Hy(n=Hy(r=Hy(a="Audio track ".concat(h," loaded [")).call(a,u.startSN,",")).call(r,u.endSN,"]")).call(n,u.lastPartSn?Hy(s="[part-".concat(u.lastPartSn,"-")).call(s,u.lastPartIndex,"]"):"",",duration:")).call(i,u.totalduration));var f=l[h],v=0;if(u.live||null!=(o=f.details)&&o.live){if(this.checkLiveUpdate(u),u.deltaUpdateFailed)return;var g;f.details&&(v=this.alignPlaylists(u,f.details,null==(g=this.levelLastLoaded)?void 0:g.details)),u.alignedSliding||(Gi(u,d),u.alignedSliding||Vi(u,d),v=u.fragmentStart)}f.details=u,this.levelLastLoaded=f,this.startFragRequested||this.setStartPosition(d,v),this.hls.trigger(c.AUDIO_TRACK_UPDATED,{details:u,id:h,groupId:t.groupId}),this.state!==Xi||this.waitForCdnTuneIn(u)||(this.state=ji),this.tick()}else this.warn("Audio tracks were reset while loading level ".concat(h))}},{key:"_handleFragmentLoadProgress",value:function(e){var t,i,n,r,a=e.frag,s=e.part,o=e.payload,l=this.config,u=this.trackId,c=this.levels;if(c){var h=c[u];if(h){var d=h.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(a.start);var f=l.defaultAudioCodec||h.audioCodec||"mp4a.40.2",v=this.transmuxer;v||(v=this.transmuxer=new Dr(this.hls,g.AUDIO,Iy(i=this._handleTransmuxComplete).call(i,this),Iy(n=this._handleTransmuxerFlush).call(n,this)));var p=this.initPTS[a.cc],m=null==(r=a.initSegment)?void 0:r.data;if(void 0!==p){var y=!1,k=s?s.index:-1,T=-1!==k,E=new Pt(a.level,a.sn,a.stats.chunkCount,o.byteLength,k,T);v.push(o,m,f,"",a,s,d.totalduration,y,E,p)}else{var S,_,b,A;this.log(Hy(S=Hy(_=Hy(b=Hy(A="Unknown video PTS for cc ".concat(a.cc,", waiting for video PTS before demuxing audio frag ")).call(A,a.sn," of [")).call(b,d.startSN," ,")).call(_,d.endSN,"],track ")).call(S,u)),(this.waitingData=this.waitingData||{frag:a,part:s,cache:new rn,complete:!1}).cache.push(new Uint8Array(o)),this.state!==Wi&&(this.state=en)}}else this.warn("Audio track is undefined on fragment load progress")}else this.warn(Hy(t="Audio tracks were reset while fragment load was in progress. Fragment ".concat(a.sn," of level ")).call(t,a.level," will not be buffered"))}},{key:"_handleFragmentLoadComplete",value:function(e){this.waitingData?this.waitingData.complete=!0:ev(Jf(i.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 i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}},{key:"onFragLoading",value:function(e,t){!this.audioOnly&&t.frag.type===g.MAIN&&Ze(t.frag)&&(this.mainFragLoading=t,this.state===ji&&this.tick())}},{key:"onFragBuffered",value:function(e,t){var i,n,r,a,s=t.frag,o=t.part;if(s.type===g.AUDIO)if(this.fragContextChanged(s))this.warn(Hy(i=Hy(n=Hy(r=Hy(a="Fragment ".concat(s.sn)).call(a,o?" p: "+o.index:""," of level ")).call(r,s.level," finished buffering, but was aborted. state: ")).call(n,this.state,", audioSwitch: ")).call(i,this.switchingTrack?this.switchingTrack.name:"false"));else{if(Ze(s)){this.fragPrevious=s;var l=this.switchingTrack;l&&(this.bufferedTrack=l,this.switchingTrack=null,this.hls.trigger(c.AUDIO_TRACK_SWITCHED,E({},l)))}this.fragBufferedComplete(s,o),this.media&&this.tick()}else this.audioOnly||s.type!==g.MAIN||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=Ji;else switch(t.details){case u.FRAG_GAP:case u.FRAG_PARSING_ERROR:case u.FRAG_DECRYPT_ERROR:case u.FRAG_LOAD_ERROR:case u.FRAG_LOAD_TIMEOUT:case u.KEY_LOAD_ERROR:case u.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(g.AUDIO,t);break;case u.AUDIO_TRACK_LOAD_ERROR:case u.AUDIO_TRACK_LOAD_TIMEOUT:case u.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Xi||(null==(n=t.context)?void 0:n.type)!==f||(this.state=ji);break;case u.BUFFER_APPEND_ERROR:case u.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===u.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,ev(Jf(i.prototype),"flushMainBuffer",this).call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case u.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}},{key:"onBufferFlushing",value:function(e,t){t.type!==Xe&&(this.flushing=!0)}},{key:"onBufferFlushed",value:function(e,t){var i=t.type;if(i!==Xe){this.flushing=!1,this.bufferFlushed=!0,this.state===Zi&&(this.state=ji);var n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,i,g.AUDIO),this.tick())}}},{key:"_handleTransmuxComplete",value:function(e){var t,i="audio",n=this.hls,r=e.remuxResult,a=e.chunkMeta,s=this.getCurrentContext(a);if(s){var o=s.frag,l=s.part,u=s.level,h=u.details,d=r.audio,f=r.text,v=r.id3,g=r.initSegment;if(!this.fragContextChanged(o)&&h){if(this.state=Qi,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),null!=g&&g.tracks){var p=o.initSegment||o;this._bufferInitSegment(u,g.tracks,p,a),n.trigger(c.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:i,tracks:g.tracks})}if(d){var m=d.startPTS,y=d.endPTS,T=d.startDTS,E=d.endDTS;l&&(l.elementaryStreams[qe]={startPTS:m,endPTS:y,startDTS:T,endDTS:E}),o.setElementaryStreamInfo(qe,m,y,T,E),this.bufferFragmentData(d,o,l,a)}if(null!=v&&null!=(t=v.samples)&&t.length){var S=k({id:i,frag:o,details:h},v);n.trigger(c.FRAG_PARSING_METADATA,S)}if(f){var _=k({id:i,frag:o,details:h},f);n.trigger(c.FRAG_PARSING_USERDATA,_)}}else this.fragmentTracker.removeFragment(o)}else this.resetWhenMissingContext(a)}},{key:"_bufferInitSegment",value:function(e,t,i,n){var r,a;if(this.state===Qi&&(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(Hy(r=Hy(a="Init audio buffer, container:".concat(s.container,", codecs[level/parsed]=[")).call(a,o,"/")).call(r,s.codec,"]")),o&&1===o.split(",").length&&(s.levelCodec=o),this.hls.trigger(c.BUFFER_CODECS,t);var l=s.initSegment;if(null!=l&&l.byteLength){var u={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:l};this.hls.trigger(c.BUFFER_APPENDING,u)}this.tickImmediate()}}},{key:"loadFragment",value:function(e,t,n){var r,a=this.fragmentTracker.getState(e);if(this.switchingTrack||a===be||a===Re)if(Ze(e))if(null!=(r=t.details)&&r.live&&!this.initPTS[e.cc]){var s,o;this.log(Hy(s=Hy(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=en;var l=this.mainDetails;l&&l.fragmentStart!==t.details.fragmentStart&&Vi(t.details,l)}else ev(Jf(i.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,r=null==n?void 0:n.attrs,a=e.attrs;t&&r&&(r.CHANNELS!==a.CHANNELS||n.name!==e.name||n.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),ev(Jf(i.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(c.AUDIO_TRACK_SWITCHED,E({},e))}}]),i}(nn),Nr=function(e){Qm(i,e);var t=$m(i);function i(e,n){var r;return Zm(this,i),(r=t.call(this,n,e.logger)).hls=void 0,r.canLoad=!1,r.timer=-1,r.hls=e,r}return ey(i,[{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,i){var n=null==t?void 0:t.renditionReports;if(n){for(var r=-1,a=0;a<n.length;a++){var s=n[a],o=void 0;try{o=new tI(s.URI,t.url).href}catch(f){this.warn("Could not construct new URL for Rendition Report: ".concat(f)),o=s.URI||""}if(o===e){r=a;break}o===e.substring(0,o.length)&&(r=a)}if(-1!==r){var l=n[r],u=Zk(l["LAST-MSN"])||(null==t?void 0:t.lastPartSn),c=Zk(l["LAST-PART"])||(null==t?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){var h=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&h>t.partTarget&&(c+=1)}var d=i&&Q(i);return new $(u,c>=0?c: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(i){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(i))}return e}},{key:"playlistLoaded",value:function(e,t,i){var n=t.details,r=t.stats,a=self.performance.now(),s=r.loading.first?Math.max(0,a-r.loading.first):0;n.advancedDateTime=JC()-s;var o=this.hls.config.timelineOffset;if(o!==n.appliedTimelineOffset){var l,u=Math.max(o||0,0);n.appliedTimelineOffset=u,Py(l=n.fragments).call(l,(function(e){e.start=e.playlistOffset+u}))}if(n.live||null!=i&&i.live){var c,h="levelInfo"in t?t.levelInfo:t.track;n.reloaded(i),i&&n.fragments.length>0&&Di(i,n),-1===n.requestScheduled&&(n.requestScheduled=r.loading.start);var d,f,v,g=this.hls.mainForwardBufferInfo,p=g?g.end-g.len:0,m=Oi(n,1e3*(n.edge-p));if(n.requestScheduled+m<a?n.requestScheduled=a:n.requestScheduled+=m,this.log(Hy(c="live playlist ".concat(e," ")).call(c,n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED")),!this.canLoad||!n.live)return;if(n.canBlockReload&&n.endSN&&n.advanced){var y=this.hls.config.lowLatencyMode,k=n.lastPartSn,T=n.endSN,E=n.lastPartIndex,S=k===T;-1!==E?S?(f=T+1,v=y?0:E):(f=k,v=y?E+1:n.maxPartIndex):f=T+1;var _=n.age,b=_+n.ageHeader,A=Math.min(b-n.partTarget,1.5*n.targetduration);if(A>0){var R,L;if(b>3*n.targetduration)this.log("Playlist last advanced ".concat(_.toFixed(2),"s ago. Omitting segment and part directives.")),f=void 0,v=void 0;else if(null!=i&&i.tuneInGoal&&b-n.partTarget>i.tuneInGoal)this.warn(Hy(R=Hy(L="CDN Tune-in goal increased from: ".concat(i.tuneInGoal," to: ")).call(L,A," with playlist age: ")).call(R,n.age)),A=0;else{var I,C,w,D,x=Math.floor(A/n.targetduration);f+=x,void 0!==v&&(v+=Math.round(A%n.targetduration/n.partTarget)),this.log(Hy(I=Hy(C=Hy(w=Hy(D="CDN Tune-in age: ".concat(n.ageHeader,"s last advanced ")).call(D,_.toFixed(2),"s goal: ")).call(w,A," skip sn ")).call(C,x," to part ")).call(I,v))}n.tuneInGoal=A}if(d=this.getDeliveryDirectives(n,t.deliveryDirectives,f,v),y||!S)return n.requestScheduled=a,void this.loadingPlaylist(h,d)}else(n.canBlockReload||n.canSkipUntil)&&(d=this.getDeliveryDirectives(n,t.deliveryDirectives,f,v));d&&void 0!==f&&n.canBlockReload&&(n.requestScheduled=r.loading.first+Math.max(m-2*s,m/2)),this.scheduleLoading(h,d,n)}else this.clearTimer()}},{key:"scheduleLoading",value:function(e,t,i){var n,r=this,a=i||e.details;if(a){var s=self.performance.now(),o=a.requestScheduled;if(s>=o)this.loadingPlaylist(e,t);else{var l=o-s;this.log(Hy(n="reload live playlist ".concat(e.name||e.bitrate+"bps"," in ")).call(n,Math.round(l)," ms")),this.clearTimer(),this.timer=gC((function(){return r.loadingPlaylist(e,t)}),l)}}else this.loadingPlaylist(e,t)}},{key:"getDeliveryDirectives",value:function(e,t,i,n){var r=Q(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,r=X.No),new $(i,n,r)}},{key:"checkRetry",value:function(e){var t=this,i=e.details,n=ge(e),r=e.errorAction,a=r||{},s=a.action,o=a.retryCount,l=void 0===o?0:o,u=a.retryConfig,c=!!r&&!!u&&(s===Te.RetryRequest||!r.resolved&&s===Te.SendAlternateToPenaltyBox);if(c){var h,d,f;if(l>=u.maxNumRetry)return!1;if(n&&null!=(f=e.context)&&f.deliveryDirectives)this.warn(Hy(h=Hy(d="Retrying playlist loading ".concat(l+1,"/")).call(d,u.maxNumRetry,' after "')).call(h,i,'" without delivery-directives')),this.loadPlaylist();else{var v,g,p,m=me(u,l);this.clearTimer(),this.timer=gC((function(){return t.loadPlaylist()}),m),this.warn(Hy(v=Hy(g=Hy(p="Retrying playlist loading ".concat(l+1,"/")).call(p,u.maxNumRetry,' after "')).call(g,i,'" in ')).call(v,m,"ms"))}e.levelRetry=!0,r.resolved=!0}return c}}]),i}(S),Fr=function(e){Qm(i,e);var t=$m(i);function i(e){var n;return Zm(this,i),(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 ey(i,[{key:"registerListeners",value:function(){var e=this.hls;e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.MANIFEST_PARSED,this.onManifestParsed,this),e.on(c.LEVEL_LOADING,this.onLevelLoading,this),e.on(c.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(c.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(c.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.MANIFEST_PARSED,this.onManifestParsed,this),e.off(c.LEVEL_LOADING,this.onLevelLoading,this),e.off(c.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(c.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(c.ERROR,this.onError,this)}},{key:"destroy",value:function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,ev(Jf(i.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 i,n,r,a,s,o,l,u=t.id,c=t.groupId,h=t.details,d=this.tracksInGroup[u];if(d&&d.groupId===c){var f=d.details;d.details=t.details,this.log(Hy(r=Hy(a=Hy(s=Hy(o=Hy(l="Audio track ".concat(u,' "')).call(l,d.name,'" lang:')).call(o,d.lang," group:")).call(s,c," loaded [")).call(a,h.startSN,"-")).call(r,h.endSN,"]")),u===this.trackId&&this.playlistLoaded(u,t,f)}else this.warn(Hy(i=Hy(n="Audio track with id:".concat(u," and group:")).call(n,c," not found in active group ")).call(i,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 i=t.audioGroups||null,n=this.groupIds,r=this.currentTrack;if(!i||(null==n?void 0:n.length)!==(null==i?void 0:i.length)||null!=i&&Yy(i).call(i,(function(e){return-1===(null==n?void 0:zy(n).call(n,e))}))){var a,s;this.groupIds=i,this.trackId=-1,this.currentTrack=null;var o=Dy(a=this.tracks).call(a,(function(e){return!i||-1!==zy(i).call(i,e.groupId)}));if(o.length)this.selectDefaultTrack&&!Yy(o).call(o,(function(e){return e.default}))&&(this.selectDefaultTrack=!1),Py(o).call(o,(function(e,t){e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=o;var h=this.hls.config.audioPreference;if(!r&&h){var d=re(h,o,se);if(d>-1)r=o[d];else{var f=re(h,this.tracks);r=this.tracks[f]}}var v=this.findTrackId(r);-1===v&&r&&(v=this.findTrackId(null));var g={audioTracks:o};this.log(Hy(s="Updating audio tracks, ".concat(o.length," track(s) found in group(s): ")).call(s,null==i?void 0:i.join(","))),this.hls.trigger(c.AUDIO_TRACKS_UPDATED,g);var p=this.trackId;if(-1!==v&&-1===p)this.setAudioTrack(v);else if(o.length&&-1===p){var m,y,k=new Error(Hy(m="No audio track selected for current audio group-ID(s): ".concat(null==(y=this.groupIds)?void 0:y.join(",")," track count: ")).call(m,o.length));this.warn(k.message),this.hls.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:k})}}}}},{key:"onError",value:function(e,t){var i;!t.fatal&&t.context&&(t.context.type!==f||t.context.id!==this.trackId||this.groupIds&&-1===zy(i=this.groupIds).call(i,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 i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){var n=this.currentTrack;if(n&&ae(e,n,se))return n;var r=re(e,this.tracksInGroup,se);if(r>-1){var a=this.tracksInGroup[r];return this.setAudioTrack(r),a}if(n){var s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);var o=function(e,t,i,n,r){var a=t[n],s=ok(t).call(t,(function(e,t,i){var n=t.uri;return(e[n]||(e[n]=[])).push(i),e}),{})[a.uri];s.length>1&&(n=Math.max.apply(Math,s));var o=a.videoRange,l=a.frameRate,u=a.codecSet.substring(0,4),c=oe(t,n,(function(t){if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==u)return!1;var n=t.audioGroups,a=Dy(i).call(i,(function(e){return!n||-1!==zy(n).call(n,e.groupId)}));return re(e,a,r)>-1}));return c>-1?c:oe(t,n,(function(t){var n=t.audioGroups,a=Dy(i).call(i,(function(e){return!n||-1!==zy(n).call(n,e.groupId)}));return re(e,a,r)>-1}))}(e,t.levels,i,s,se);if(-1===o)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){var l=re(e,i);if(l>-1)return i[l]}}}return null}},{key:"setAudioTrack",value:function(e){var t,i,n,r,a=this.tracksInGroup;if(e<0||e>=a.length)this.warn("Invalid audio track id: ".concat(e));else{this.selectDefaultTrack=!1;var s=this.currentTrack,o=a[e],l=o.details&&!o.details.live;if(!(e===this.trackId&&o===s&&l||(this.log(Hy(t=Hy(i=Hy(n=Hy(r="Switching to audio-track ".concat(e,' "')).call(r,o.name,'" lang:')).call(n,o.lang," group:")).call(i,o.groupId," channels:")).call(t,o.channels)),this.trackId=e,this.currentTrack=o,this.hls.trigger(c.AUDIO_TRACK_SWITCHING,E({},o)),l))){var u=this.switchParams(o.url,null==s?void 0:s.details,o.details);this.loadPlaylist(u)}}}},{key:"findTrackId",value:function(e){for(var t=this.tracksInGroup,i=0;i<t.length;i++){var n=t[i];if((!this.selectDefaultTrack||n.default)&&(!e||ae(e,n,se)))return i}if(e){for(var r=e.name,a=e.lang,s=e.assocLang,o=e.characteristics,l=e.audioCodec,u=e.channels,c=0;c<t.length;c++)if(ae({name:r,lang:a,assocLang:s,characteristics:o,audioCodec:l,channels:u},t[c],se))return c;for(var h=0;h<t.length;h++){var d=t[h];if(Pr(e.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return h}for(var f=0;f<t.length;f++){var v=t[f];if(Pr(e.attrs,v.attrs,["LANGUAGE"]))return f}}return-1}},{key:"loadPlaylist",value:function(e){ev(Jf(i.prototype),"loadPlaylist",this).call(this);var t=this.currentTrack;this.shouldLoadPlaylist(t)&&le(t.url,this.hls)&&this.scheduleLoading(t,e)}},{key:"loadingPlaylist",value:function(e,t){var n,r,a,s,o,l;ev(Jf(i.prototype),"loadingPlaylist",this).call(this,e,t);var u=e.id,h=e.groupId,d=this.getUrlWithDirectives(e.url,t),f=e.details,v=null==f?void 0:f.age;this.log(Hy(n=Hy(r=Hy(a=Hy(s=Hy(o=Hy(l="Loading audio-track ".concat(u,' "')).call(l,e.name,'" lang:')).call(o,e.lang," group:")).call(s,h)).call(a,void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")).call(r,v&&f.live?" age "+v.toFixed(1)+(f.type&&" "+f.type||""):""," ")).call(n,d)),this.hls.trigger(c.AUDIO_TRACK_LOADING,{url:d,id:u,groupId:h,deliveryDirectives:t||null,track:e})}}]),i}(Nr),Ur=function(){function e(t){Zm(this,e),this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=t}return ey(e,[{key:"destroy",value:function(){this.tracks=this.queues=null}},{key:"append",value:function(e,t,i){if(null!==this.queues&&null!==this.tracks){var n=this.queues[t];n.push(e),1!==n.length||i||this.executeNext(t)}}},{key:"appendBlocker",value:function(e){var t=this;return new nb((function(i){var n={label:"async-blocker",execute:i,onStart:function(){},onComplete:function(){},onError:function(){}};t.append(n,e)}))}},{key:"prependBlocker",value:function(e){var t=this;return new nb((function(i){if(t.queues){var n={label:"async-blocker-prepend",execute:i,onStart:function(){},onComplete:function(){},onError:function(){}};t.queues[e].unshift(n)}}))}},{key:"removeBlockers",value:function(){var e;null!==this.queues&&Py(e=[this.queues.video,this.queues.audio,this.queues.audiovideo]).call(e,(function(e){var t,i=null==(t=e[0])?void 0:t.label;"async-blocker"!==i&&"async-blocker-prepend"!==i||(e[0].execute(),mw(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 i=t[0];try{i.execute()}catch(a){var n;if(i.onError(a),null===this.queues||null===this.tracks)return;var r=null==(n=this.tracks[e])?void 0:n.buffer;null!=r&&r.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,i=this.queues,n=this.tracks;return null===i||null===n?"<destroyed>":Hy(e=Hy(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,i,n,r;return null!=(n=this.queues)&&n[e]||null!=(r=this.tracks)&&r[e]?Hy(t=Hy(i="".concat(e,": (")).call(i,this.listSbInfo(e),") ")).call(t,this.listOps(e)):""}},{key:"listSbInfo",value:function(e){var t,i,n,r=null==(n=this.tracks)?void 0:n[e],a=null==r?void 0:r.buffer;return a?Hy(t=Hy(i="SourceBuffer".concat(a.updating?" updating":"")).call(i,r.ended?" ended":"")).call(t,r.ending?" ending":""):"none"}},{key:"listOps",value:function(e){var t,i;return(null==(i=this.queues)?void 0:ub(t=i[e]).call(t,(function(e){return e.label})).join(", "))||""}}]),e}(),Br=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Hr="HlsJsTrackRemovedError",Gr=function(e){Qm(i,e);var t=$m(i);function i(e){var n;return Zm(this,i),(n=t.call(this,e)).name=Hr,n}return ey(i)}(qm(Error)),Vr=function(e){Qm(i,e);var t=$m(i);function i(e,n){var r,a;return Zm(this,i),(r=t.call(this,"buffer-controller",e.logger)).hls=void 0,r.fragmentTracker=void 0,r.details=null,r._objectUrl=null,r.operationQueue=null,r.bufferCodecEventsTotal=0,r.media=null,r.mediaSource=null,r.lastMpegAudioChunk=null,r.blockedAudioAppend=null,r.lastVideoAppendEnd=0,r.appendSource=void 0,r.transferData=void 0,r.overrides=void 0,r.appendErrors={audio:0,video:0,audiovideo:0},r.tracks={},r.sourceBuffers=[[null,null],[null,null]],r._onEndStreaming=function(e){var t;r.hls&&"open"===(null==(t=r.mediaSource)?void 0:t.readyState)&&r.hls.pauseBuffering()},r._onStartStreaming=function(e){r.hls&&r.hls.resumeBuffering()},r._onMediaSourceOpen=function(e){var t=Xm(r),i=t.media,n=t.mediaSource;e&&r.log("Media source opened"),i&&n&&(i.removeEventListener("emptied",r._onMediaEmptied),r.updateDuration(),r.hls.trigger(c.MEDIA_ATTACHED,{media:i,mediaSource:n}),n.removeEventListener("sourceopen",r._onMediaSourceOpen),null!==r.mediaSource&&r.checkPendingTracks())},r._onMediaSourceClose=function(){r.log("Media source closed")},r._onMediaSourceEnded=function(){r.log("Media source ended")},r._onMediaEmptied=function(){var e,t=Xm(r),i=t.mediaSrc,n=t._objectUrl;i!==n&&r.error(Hy(e="Media element src was set while attaching MediaSource (".concat(n," > ")).call(e,i,")"))},r.hls=e,r.fragmentTracker=n,r.appendSource=(a=C(e.config.preferManagedMediaSource),"undefined"!=typeof self&&a===self.ManagedMediaSource),r.initTracks(),r.registerListeners(),r}return ey(i,[{key:"hasSourceTypes",value:function(){return Cy(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(c.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.MANIFEST_PARSED,this.onManifestParsed,this),e.on(c.BUFFER_RESET,this.onBufferReset,this),e.on(c.BUFFER_APPENDING,this.onBufferAppending,this),e.on(c.BUFFER_CODECS,this.onBufferCodecs,this),e.on(c.BUFFER_EOS,this.onBufferEos,this),e.on(c.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(c.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(c.FRAG_PARSED,this.onFragParsed,this),e.on(c.FRAG_CHANGED,this.onFragChanged,this),e.on(c.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(c.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.MANIFEST_PARSED,this.onManifestParsed,this),e.off(c.BUFFER_RESET,this.onBufferReset,this),e.off(c.BUFFER_APPENDING,this.onBufferAppending,this),e.off(c.BUFFER_CODECS,this.onBufferCodecs,this),e.off(c.BUFFER_EOS,this.onBufferEos,this),e.off(c.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(c.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(c.FRAG_PARSED,this.onFragParsed,this),e.off(c.FRAG_CHANGED,this.onFragChanged,this),e.off(c.ERROR,this.onError,this)}},{key:"transferMedia",value:function(){var e,t=this,i=this.media,n=this.mediaSource;if(!i)return null;var r={};if(this.operationQueue){var a,s,o=this.isUpdating();o||this.operationQueue.removeBlockers();var l=this.isQueued();(o||l)&&this.warn(Hy(a=Hy(s="Transfering MediaSource with".concat(l?" operations in queue":"")).call(s,o?" updating SourceBuffer(s)":""," ")).call(a,this.operationQueue)),this.operationQueue.destroy()}var u=this.transferData;return!this.sourceBufferCount&&u&&u.mediaSource===n?k(r,u.tracks):Py(e=this.sourceBuffers).call(e,(function(e){var i=yf(e,1)[0];i&&(r[i]=k({},t.tracks[i]),t.removeBuffer(i)),e[0]=e[1]=null})),{media:i,mediaSource:n,tracks:r}}},{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 i,n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log("".concat(n," bufferCodec event(s) expected.")),null!=(i=this.transferData)&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}},{key:"onMediaAttaching",value:function(e,t){var i,n,r,a=this.media=t.media,s=C(this.appendSource);if(this.transferData=this.overrides=void 0,a&&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=a.src,this.attachTransferred();else{var u=this._objectUrl=tI.createObjectURL(l);if(this.appendSource)try{a.removeAttribute("src");var c=self.ManagedMediaSource;a.disableRemotePlayback=a.disableRemotePlayback||c&&l instanceof c,Kr(a),i=a,n=u,(r=self.document.createElement("source")).type="video/mp4",r.src=n,i.appendChild(r),a.load()}catch(h){a.src=u}else a.src=u}a.addEventListener("emptied",this._onMediaEmptied)}}},{key:"assignMediaSource",value:function(e){var t,i,n;this.log(Hy(t="".concat((null==(i=this.transferData)?void 0:i.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,i=this.transferData;if(i&&t){var n=this.tracks,r=i.tracks,a=r?Cy(r):null,s=a?a.length:0,o=function(){e.media&&e.mediaSourceOpenOrEnded&&e._onMediaSourceOpen()};if(r&&a&&s){var l,u;if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log(Hy(l=Hy(u="attachTransferred: (bufferCodecEventsTotal ".concat(this.bufferCodecEventsTotal,")\nrequired tracks: ")).call(u,bI(n,(function(e,t){return"initSegment"===e?void 0:t})),";\ntransfer tracks: ")).call(l,bI(r,(function(e,t){return"initSegment"===e?void 0:t})),"}")),!w(r,n)){var h,d,f,v;i.mediaSource=null,i.tracks=void 0;var g=t.currentTime,p=this.details,m=Math.max(g,(null==p?void 0:p.fragments[0].start)||0);return m-g>1?void this.log(Hy(h="attachTransferred: waiting for playback to reach new tracks start time ".concat(g," -> ")).call(h,m)):(this.warn(Hy(d=Hy(f=Hy(v='attachTransferred: resetting MediaSource for incompatible tracks ("'.concat(Cy(r),'"->"')).call(v,Cy(n),'") start time: ')).call(f,m," currentTime: ")).call(d,g)),this.onMediaDetaching(c.MEDIA_DETACHING,{}),this.onMediaAttaching(c.MEDIA_ATTACHING,i),void(t.currentTime=m))}this.transferData=void 0,Py(a).call(a,(function(t){var i=t,n=r[i];if(n){var a=n.buffer;if(a){var s=e.fragmentTracker,o=n.id;if(s.hasFragments(o)||s.hasParts(o)){var l=Mt.getBuffered(a);s.detectEvictedFragments(i,l,o,null,!0)}var u=Wr(i),c=[i,a];e.sourceBuffers[u]=c,a.updating&&e.operationQueue&&e.operationQueue.prependBlocker(i),e.trackSourceBuffer(i,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 i=this,n=!!t.transferMedia;this.transferData=this.overrides=void 0;var r=this.media,a=this.mediaSource,s=this._objectUrl;if(a){var o;if(this.log("media source "+(n?"transferring":"detaching")),n)Py(o=this.sourceBuffers).call(o,(function(e){var t=yf(e,1)[0];t&&i.removeBuffer(t)})),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){var l="open"===a.readyState;try{for(var u=a.sourceBuffers,h=u.length;h--;)l&&u[h].abort(),a.removeSourceBuffer(u[h]);l&&a.endOfStream()}catch(Eo){this.warn("onMediaDetaching: ".concat(Eo.message," while calling endOfStream"))}}this.sourceBufferCount&&this.onBufferReset()}a.removeEventListener("sourceopen",this._onMediaSourceOpen),a.removeEventListener("sourceended",this._onMediaSourceEnded),a.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(a.removeEventListener("startstreaming",this._onStartStreaming),a.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),n||(s&&tI.revokeObjectURL(s),this.mediaSrc===s?(r.removeAttribute("src"),this.appendSource&&Kr(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(c.MEDIA_DETACHED,t)}},{key:"onBufferReset",value:function(){var e,t=this;Py(e=this.sourceBuffers).call(e,(function(e){var i=yf(e,1)[0];i&&t.resetBuffer(i)})),this.initTracks()}},{key:"resetBuffer",value:function(e){var t,i=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;null!=(n=this.mediaSource)&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(Eo){this.warn("onBufferReset ".concat(e),Eo)}delete this.tracks[e]}},{key:"removeBuffer",value:function(e){this.removeBufferListeners(e),this.sourceBuffers[Wr(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 Ur(this.tracks)}},{key:"onBufferCodecs",value:function(e,t){var i,n,r=this,a=this.tracks,s=Cy(t);this.log(Hy(i='BUFFER_CODECS: "'.concat(s,'" (current SB count ')).call(i,this.sourceBufferCount,")"));var o="audiovideo"in t&&(a.audio||a.video)||a.audiovideo&&("audio"in t||"video"in t),l=!o&&this.sourceBufferCount&&this.media&&Yy(s).call(s,(function(e){return!a[e]}));o||l?this.warn(Hy(n='Unsupported transition between "'.concat(Cy(a),'" and "')).call(n,s,'" SourceBuffers')):(Py(s).call(s,(function(e){var i,n,s,o,l=t[e],u=l.id,c=l.codec,h=l.levelCodec,d=l.container,f=l.metadata,v=a[e],g=null==(n=r.transferData)||null==(s=n.tracks)?void 0:s[e],p=null!=g&&g.buffer?g:v,m=(null==p?void 0:p.pendingCodec)||(null==p?void 0:p.codec),y=null==p?void 0:p.levelCodec,k=!p||!!r.hls.config.assetPlayerId;v||(v=a[e]={buffer:void 0,listeners:[],codec:c,container:d,levelCodec:h,metadata:f,id:u});var T=H(m,y),E=null==T?void 0:T.replace(Br,"$1"),S=H(c,h),_=null==(o=S)?void 0:o.replace(Br,"$1");S&&(E!==_||k)&&("audio"===iI(e).call(e,0,5)&&(S=B(S,r.appendSource)),r.log(Hy(i="switching codec ".concat(m," to ")).call(i,S)),S!==(v.pendingCodec||v.codec)&&(v.pendingCodec=S),v.container=d,r.appendChangeType(e,d,S))})),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}},{key:"sourceBufferTracks",get:function(){var e,t=this;return ok(e=Cy(this.tracks)).call(e,(function(e,i){var n=t.tracks[i];return e[i]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e}),{})}},{key:"appendChangeType",value:function(e,t,i){var n,r=this,a=Hy(n="".concat(t,";codecs=")).call(n,i),s={label:"change-type=".concat(a),execute:function(){var n=r.tracks[e];if(n){var s,o=n.buffer;null!=o&&o.changeType&&(r.log(Hy(s="changing ".concat(e," sourceBuffer type to ")).call(s,a)),o.changeType(a),n.codec=i,n.container=t)}r.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){r.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,i=this,n=e.start,r=n+.05*e.duration;if(!0!==(null==(t=this.fragmentTracker.getAppendedFrag(n,g.MAIN))?void 0:t.gap)){var a={label:"block-audio",execute:function(){var e,t=i.tracks.video;(i.lastVideoAppendEnd>r||null!=t&&t.buffer&&Mt.isBuffered(t.buffer,r)||!0===(null==(e=i.fragmentTracker.getAppendedFrag(r,g.MAIN))?void 0:e.gap))&&(i.blockedAudioAppend=null,i.shiftAndExecuteNext("audio"))},onStart:function(){},onComplete:function(){},onError:function(e){i.warn("Error executing block-audio operation",e)}};this.blockedAudioAppend={op:a,frag:e},this.append(a,"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 i=this,n=this.tracks,r=t.data,a=t.type,s=t.parent,o=t.frag,h=t.part,d=t.chunkMeta,f=d.buffering[a],v=o.sn,g=self.performance.now();f.start=g;var p=o.stats.buffering,m=h?h.stats.buffering:null;0===p.start&&(p.start=g),m&&0===m.start&&(m.start=g);var y=n.audio,k=!1;"audio"===a&&"audio/mpeg"===(null==y?void 0:y.container)&&(k=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);var T=this.tracks.video,E=null==T?void 0:T.buffer;if(E&&"initSegment"!==v){var S=h||o,_=this.blockedAudioAppend;if("audio"!==a||"main"===s||this.blockedAudioAppend){if("video"===a){var b=S.end;if(_){var A=_.frag.start;(b>A||b<this.lastVideoAppendEnd||Mt.isBuffered(E,A))&&this.unblockAudio()}this.lastVideoAppendEnd=b}}else{var R=S.start+.05*S.duration,L=E.buffered,I=this.currentOp("video");L.length||I?!I&&!Mt.isBuffered(E,R)&&this.lastVideoAppendEnd<R&&this.blockAudio(S):this.blockAudio(S)}}var C=(h||o).start,w={label:"append-".concat(a),execute:function(){if(f.executeStart=self.performance.now(),k){var e=i.tracks[a];if(e){var t=e.buffer;if(t){var n,s,o=C-t.timestampOffset;Math.abs(o)>=.1&&(i.log(Hy(n=Hy(s="Updating audio SourceBuffer timestampOffset to ".concat(C," (delta: ")).call(s,o,") sn: ")).call(n,v,")")),t.timestampOffset=C)}}}i.appendExecutor(r,a)},onStart:function(){},onComplete:function(){var e,t=self.performance.now();f.executeEnd=f.end=t,0===p.first&&(p.first=t),m&&0===m.first&&(m.first=t);var n={};Py(e=i.sourceBuffers).call(e,(function(e){var t=yf(e,2),i=t[0],r=t[1];i&&(n[i]=Mt.getBuffered(r))})),i.appendErrors[a]=0,"audio"===a||"video"===a?i.appendErrors.audiovideo=0:(i.appendErrors.audio=0,i.appendErrors.video=0),i.hls.trigger(c.BUFFER_APPENDED,{type:a,frag:o,part:h,chunkMeta:d,parent:o.type,timeRanges:n})},onError:function(e){var t,n={type:l.MEDIA_ERROR,parent:o.type,details:u.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:o,part:h,chunkMeta:d,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)n.details=u.BUFFER_FULL_ERROR;else if(e.code!==DOMException.INVALID_STATE_ERR||!i.mediaSourceOpenOrEnded||null!=(t=i.media)&&t.error)if(e.name===Hr)0===i.sourceBufferCount?n.errorAction=_e(!0):++i.appendErrors[a];else{var r,s,f=++i.appendErrors[a];i.warn(Hy(r=Hy(s="Failed ".concat(f,"/")).call(s,i.hls.config.appendErrorMaxRetry,' times to append segment in "')).call(r,a,'" sourceBuffer')),f>=i.hls.config.appendErrorMaxRetry&&(n.fatal=!0)}else n.errorAction=_e(!0);i.hls.trigger(c.ERROR,n)}};this.append(w,a,this.isPending(this.tracks[a]))}},{key:"getFlushOp",value:function(e,t,i){var n,r,a=this;return this.log(Hy(n=Hy(r='queuing "'.concat(e,'" remove ')).call(r,t,"-")).call(n,i)),{label:"remove",execute:function(){a.removeExecutor(e,t,i)},onStart:function(){},onComplete:function(){a.hls.trigger(c.BUFFER_FLUSHED,{type:e})},onError:function(n){var r,s;a.warn(Hy(r=Hy(s="Failed to remove ".concat(t,"-")).call(s,i,' from "')).call(r,e,'" SourceBuffer'),n)}}}},{key:"onBufferFlushing",value:function(e,t){var i,n=this,r=t.type,a=t.startOffset,s=t.endOffset;r?this.append(this.getFlushOp(r,a,s),r):Py(i=this.sourceBuffers).call(i,(function(e){var t=yf(e,1)[0];t&&n.append(n.getFlushOp(t,a,s),t)}))}},{key:"onFragParsed",value:function(e,t){var i,n,r=this,a=t.frag,s=t.part,o=[],l=s?s.elementaryStreams:a.elementaryStreams;l[Qe]?o.push("audiovideo"):(l[qe]&&o.push("audio"),l[Xe]&&o.push("video")),0===o.length&&this.warn(Hy(i=Hy(n="Fragments must have at least one ElementaryStreamType set. type: ".concat(a.type," level: ")).call(n,a.level," sn: ")).call(i,a.sn)),this.blockBuffers((function(){var e=self.performance.now();a.stats.buffering.end=e,s&&(s.stats.buffering.end=e);var t=s?s.stats:a.stats;r.hls.trigger(c.FRAG_BUFFERED,{frag:a,part:s,stats:t,id:a.type})}),o)}},{key:"onFragChanged",value:function(e,t){this.trimBuffers()}},{key:"bufferedToEnd",get:function(){var e,t=this;return this.sourceBufferCount>0&&!Yy(e=this.sourceBuffers).call(e,(function(e){var i,n,r=yf(e,1)[0];return r&&(!(null!=(i=t.tracks[r])&&i.ended)||(null==(n=t.tracks[r])?void 0:n.ending))}))}},{key:"onBufferEos",value:function(e,t){var i,n,r,a=this;Py(i=this.sourceBuffers).call(i,(function(e){var i=yf(e,1)[0];if(i){var n=a.tracks[i];t.type&&t.type!==i||(n.ending=!0,n.ended||(n.ended=!0,a.log("".concat(i," buffer reached EOS"))))}}));var s=!1!==(null==(r=this.overrides)?void 0:r.endOfStream);this.sourceBufferCount>0&&!Yy(n=this.sourceBuffers).call(n,(function(e){var t,i=yf(e,1)[0];return i&&!(null!=(t=a.tracks[i])&&t.ended)}))&&(this.log("Queueing EOS"),this.blockUntilOpen((function(){var e;if(Py(e=a.sourceBuffers).call(e,(function(e){var t=yf(e,1)[0];if(null!==t){var i=a.tracks[t];i&&(i.ending=!1)}})),s){var t=a.mediaSource;if(!t||"open"!==t.readyState)return void(t&&a.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: ".concat(t.readyState)));a.log("Calling mediaSource.endOfStream()"),t.endOfStream()}a.hls.trigger(c.BUFFERED_TO_END,void 0)})))}},{key:"onLevelUpdated",value:function(e,t){var i=t.details;i.fragments.length&&(this.details=i,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===u.BUFFER_APPEND_ERROR&&t.frag){var i,n=null==(i=t.errorAction)?void 0:i.nextAutoLevel;a(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,i=this.media;if(i&&null!==t&&this.sourceBufferCount){var n=e.config,r=i.currentTime,s=t.levelTargetDuration,o=t.live&&null!==n.liveBackBufferLength?n.liveBackBufferLength:n.backBufferLength;if(a(o)&&o>=0){var l=Math.max(o,s),u=Math.floor(r/s)*s-l;this.flushBackBuffer(r,s,u)}if(a(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){var c=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),h=Math.max(c,s),d=Math.floor(r/s)*s+h;this.flushFrontBuffer(r,s,d)}}}},{key:"flushBackBuffer",value:function(e,t,i){var n,r=this;Py(n=this.sourceBuffers).call(n,(function(n){var a=yf(n,2),s=a[0],o=a[1];if(o){var l=Mt.getBuffered(o);if(l.length>0&&i>l.start(0)){var u;r.hls.trigger(c.BACK_BUFFER_REACHED,{bufferEnd:i});var h=r.tracks[s];if(null!=(u=r.details)&&u.live)r.hls.trigger(c.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(null!=h&&h.ended&&l.end(l.length-1)-e<2*t)return void r.log("Cannot flush ".concat(s," back buffer while SourceBuffer is in ended state"));r.hls.trigger(c.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:s})}}}))}},{key:"flushFrontBuffer",value:function(e,t,i){var n,r=this;Py(n=this.sourceBuffers).call(n,(function(n){var a=yf(n,2),s=a[0],o=a[1];if(o){var l=Mt.getBuffered(o),u=l.length;if(u<2)return;var h=l.start(u-1),d=l.end(u-1),f=r.tracks[s];if(i>h||e>=h&&e<=d)return;if(null!=f&&f.ended&&e-d<2*t)return void r.log("Cannot flush ".concat(s," front buffer while SourceBuffer is in ended state"));r.hls.trigger(c.BUFFER_FLUSHING,{startOffset:h,endOffset:1/0,type:s})}}))}},{key:"getDurationAndRange",value:function(){var e,t=this.details,i=this.mediaSource;if(!t||!this.media||"open"!==(null==i?void 0:i.readyState))return null;var n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(i.duration=1/0,t.fragments.length&&t.live&&i.setLiveSeekableRange){var r=Math.max(0,t.fragmentStart);return{duration:1/0,start:r,end:Math.max(r,n)}}return{duration:1/0}}var s=null==(e=this.overrides)?void 0:e.duration;if(s)return{duration:s};var o=this.media.duration;return n>(a(i.duration)?i.duration:0)&&n>o||!a(o)?{duration:n}:null}},{key:"updateMediaSource",value:function(e){var t,i,n=e.duration,r=e.start,s=e.end,o=this.mediaSource;this.media&&o&&"open"===o.readyState&&(o.duration!==n&&(a(n)&&this.log("Updating MediaSource duration to ".concat(n.toFixed(3))),o.duration=n),void 0!==r&&void 0!==s&&(this.log(Hy(t=Hy(i="MediaSource duration is set to ".concat(o.duration,". Setting seekable range to ")).call(i,r,"-")).call(t,s,".")),o.setLiveSeekableRange(r,s)))}},{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,i=this.bufferCodecEventsTotal,n=this.pendingTrackCount,r=this.tracks;if(this.log(Hy(e=Hy(t="checkPendingTracks (pending: ".concat(n," codec events expected: ")).call(t,i,") ")).call(e,bI(r))),this.tracksReady){var a,s=null==(a=this.transferData)?void 0:a.tracks;s&&Cy(s).length?this.attachTransferred():(this.createSourceBuffers(),this.bufferCreated())}}},{key:"bufferCreated",value:function(){var e=this;if(this.sourceBufferCount){var t,i,n={};Py(t=this.sourceBuffers).call(t,(function(t){var i=yf(t,2),r=i[0],a=i[1];if(r){var s=e.tracks[r];n[r]={buffer:a,container:s.container,codec:s.codec,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}})),this.hls.trigger(c.BUFFER_CREATED,{tracks:n}),this.log("SourceBuffers created. Running queue: ".concat(this.operationQueue)),Py(i=this.sourceBuffers).call(i,(function(t){var i=yf(t,1)[0];e.executeNext(i)}))}else{var r=new Error("could not create source buffer for media codec(s)");this.hls.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:r,reason:r.message})}}},{key:"createSourceBuffers",value:function(){var e=this.tracks,t=this.sourceBuffers,i=this.mediaSource;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(var n in e){var r=n,a=e[r];if(this.isPending(a)){var s,o,h,d=this.getTrackCodec(a,r),f=Hy(s="".concat(a.container,";codecs=")).call(s,d);a.codec=d,this.log(Hy(o=Hy(h="creating sourceBuffer(".concat(f,")")).call(h,this.currentOp(r)?" Queued":""," ")).call(o,bI(a)));try{var v=i.addSourceBuffer(f),g=Wr(r),p=[r,v];t[g]=p,a.buffer=v}catch(m){this.error("error while trying to add sourceBuffer: ".concat(m.message)),this.hls.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:m,sourceBufferName:r,mimeType:f});break}this.trackSourceBuffer(r,a)}}}},{key:"getTrackCodec",value:function(e,t){var i=H(e.codec,e.levelCodec);return i?"audio"===iI(t).call(t,0,5)?B(i,this.appendSource):i:""}},{key:"trackSourceBuffer",value:function(e,t){var i=this,n=t.buffer;if(n){var r=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:r,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&&i.hls.trigger(c.BUFFER_FLUSHED,{type:e})}))}}},{key:"mediaSrc",get:function(){var e,t,i=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==i?void 0:i.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 i=this.currentOp(e);i&&(i.onComplete(),this.shiftAndExecuteNext(e))}else this.resetBuffer(e)}},{key:"onSBUpdateError",value:function(e,t){var i,n,r=new Error(Hy(i="".concat(e," SourceBuffer error. MediaSource readyState: ")).call(i,null==(n=this.mediaSource)?void 0:n.readyState));this.error("".concat(r),t),this.hls.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});var a=this.currentOp(e);a&&a.onError(r)}},{key:"removeExecutor",value:function(e,t,i){var n,r,s=this.media,o=this.mediaSource,l=this.tracks[e],u=null==l?void 0:l.buffer;if(!s||!o||!u)return this.warn("Attempting to remove from the ".concat(e," SourceBuffer, but it does not exist")),void this.shiftAndExecuteNext(e);var c=a(s.duration)?s.duration:1/0,h=a(o.duration)?o.duration:1/0,d=Math.max(0,t),f=Math.min(i,c,h);f>d&&(!l.ending||l.ended)?(l.ended=!1,this.log(Hy(n=Hy(r="Removing [".concat(d,",")).call(r,f,"] from the ")).call(n,e," SourceBuffer")),u.remove(d,f)):this.shiftAndExecuteNext(e)}},{key:"appendExecutor",value:function(e,t){var i=this.tracks[t],n=null==i?void 0:i.buffer;if(!n)throw new Gr("Attempting to append to the ".concat(t," SourceBuffer, but it does not exist"));i.ending=!1,i.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 Yy(e=this.sourceBuffers).call(e,(function(e){var t=yf(e,2),i=t[0],n=t[1];return i&&n.updating}))}},{key:"isQueued",value:function(){var e,t=this;return Yy(e=this.sourceBuffers).call(e,(function(e){var i=yf(e,1)[0];return i&&!!t.currentOp(i)}))}},{key:"isPending",value:function(e){return!!e&&!e.buffer}},{key:"blockBuffers",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.sourceBufferTypes;if(!i.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void nb.resolve().then(e);var n=this.operationQueue,r=ub(i).call(i,(function(e){return t.appendBlocker(e)}));i.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),nb.all(r).then((function(r){n===t.operationQueue&&(e(),t.stepOperationQueue(i))}))}},{key:"stepOperationQueue",value:function(e){var t=this;Py(e).call(e,(function(e){var i,n=null==(i=t.tracks[e])?void 0:i.buffer;n&&!n.updating&&t.shiftAndExecuteNext(e)}))}},{key:"append",value:function(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}},{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 ok(e=Cy(this.tracks)).call(e,(function(e,i){return e+(t.isPending(t.tracks[i])?1:0)}),0)}},{key:"sourceBufferCount",get:function(){var e;return ok(e=this.sourceBuffers).call(e,(function(e,t){return e+(yf(t,1)[0]?1:0)}),0)}},{key:"sourceBufferTypes",get:function(){var e,t;return Dy(e=ub(t=this.sourceBuffers).call(t,(function(e){return yf(e,1)[0]}))).call(e,(function(e){return!!e}))}},{key:"addBufferListener",value:function(e,t,i){var n=this.tracks[e];if(n){var r=n.buffer;if(r){var a=Iy(i).call(i,this,e);n.listeners.push({event:t,listener:a}),r.addEventListener(t,a)}}}},{key:"removeBufferListeners",value:function(e){var t,i=this.tracks[e];if(i){var n=i.buffer;n&&(Py(t=i.listeners).call(t,(function(e){n.removeEventListener(e.event,e.listener)})),i.listeners.length=0)}}}]),i}(S);function Kr(e){var t,i=e.querySelectorAll("source");Py(t=iI([]).call(i)).call(t,(function(t){e.removeChild(t)}))}function Wr(e){return"audio"===e?1:0}var jr=function(){function e(t){Zm(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 ey(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(c.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(c.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(c.MANIFEST_PARSED,this.onManifestParsed,this),e.on(c.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(c.BUFFER_CODECS,this.onBufferCodecs,this),e.on(c.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"unregisterListener",value:function(){var e=this.hls;e.off(c.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(c.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(c.MANIFEST_PARSED,this.onManifestParsed,this),e.off(c.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(c.BUFFER_CODECS,this.onBufferCodecs,this),e.off(c.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"onFpsDropLevelCapping",value:function(e,t){var i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.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 i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}},{key:"onLevelsUpdated",value:function(e,t){this.timer&&a(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,i,n,r,a=this.hls,s=this.getMaxLevel(e.length-1);s!==this.autoLevelCapping&&a.logger.log(Hy(t=Hy(i=Hy(n=Hy(r="Setting autoLevelCapping to ".concat(s,": ")).call(r,e[s].height,"p@")).call(n,e[s].bitrate," for media ")).call(i,this.mediaWidth,"x")).call(t,this.mediaHeight)),a.autoLevelCapping=s,a.autoLevelEnabled&&a.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=a.autoLevelCapping}}}},{key:"getMaxLevel",value:function(t){var i=this,n=this.hls.levels;if(!n.length)return-1;var r=Dy(n).call(n,(function(e,n){return i.isLevelAllowed(e)&&n<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}},{key:"startCapping",value:function(){var e;this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=TI(Iy(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 i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}},{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(t){}return Math.min(e,this.hls.config.maxDevicePixelRatio)}},{key:"isLevelAllowed",value:function(e){var t;return!Yy(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,i){if(null==e||!e.length)return-1;for(var n,r,a=e.length-1,s=Math.max(t,i),o=0;o<e.length;o+=1){var l=e[o];if((l.width>=s||l.height>=s)&&(n=l,!(r=e[o+1])||n.width!==r.width||n.height!==r.height)){a=o;break}}return a}}]),e}(),Yr={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},zr={DASH:"d",HLS:"h",SMOOTH:"s",OTHER:"o"},qr="CMCD-Request",Xr="CMCD-Session",Qr="CMCD-Status",$r=(Zh(n={},"CMCD-Object",["br","d","ot","tb"]),Zh(n,qr,["bl","dl","mtp","nor","nrr","su"]),Zh(n,Xr,["cid","pr","sf","sid","st","v"]),Zh(n,Qr,["bs","rtp"]),n),Zr=ey((function e(t,i){Zm(this,e),kw(t)&&(t=ub(t).call(t,(function(t){return t instanceof e?t:new e(t)}))),this.value=t,this.params=i}));function Jr(e,t,i,n){var r,a,s;return new Error(Hy(r=Hy(a="failed to ".concat(e,' "')).call(a,(s=t,kw(s)?bI(s):s instanceof Ew?"Map{}":s instanceof uP?"Set{}":"object"==qh(s)?bI(s):String(s)),'" as ')).call(r,i),{cause:n})}function ea(e,t,i){return Jr("serialize",e,t,i)}var ta=ey((function e(t){Zm(this,e),this.description=t})),ia="Bare Item";function na(e){if(!1===ArrayBuffer.isView(e))throw ea(e,"Byte Sequence");return":".concat((t=e,btoa(String.fromCharCode.apply(String,mf(t)))),":");var t}function ra(e){if((t=e)<-999999999999999||999999999999999<t)throw ea(e,"Integer");var t;return e.toString()}function aa(e){var t=_n(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw ea(e,"Decimal");var i=t.toString();return bP(i).call(i,".")?i:"".concat(i,".0")}var sa=/[\x00-\x1f\x7f]+/;function oa(e){var t,i,n=(i=e).description||iI(t=i.toString()).call(t,7,-1);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(n))throw ea(n,"Token");return n}function la(e){switch(qh(e)){case"number":if(!a(e))throw ea(e,ia);return AP(e)?ra(e):aa(e);case"string":return function(e){if(sa.test(e))throw ea(e,"String");return'"'.concat(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),'"')}(e);case"symbol":return oa(e);case"boolean":return function(e){if("boolean"!=typeof e)throw ea(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return"@".concat(ra(e.getTime()/1e3));if(e instanceof Uint8Array)return na(e);if(e instanceof ta)return oa(e);default:throw ea(e,ia)}}function ua(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw ea(e,"Key");return e}function ca(e){var t;return null==e?"":ub(t=OP(e)).call(t,(function(e){var t,i=yf(e,2),n=i[0],r=i[1];return!0===r?";".concat(ua(n)):Hy(t=";".concat(ua(n),"=")).call(t,la(r))})).join("")}function ha(e){var t;return e instanceof Zr?Hy(t="".concat(la(e.value))).call(t,ca(e.params)):la(e)}function da(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{whitespace:!0};if("object"!=qh(e))throw ea(e,"Dict");var n=e instanceof Ew?VP(e).call(e):OP(e),r=(null==i?void 0:i.whitespace)?" ":"";return ub(t=yw(n)).call(t,(function(e){var t,i,n=yf(e,2),r=n[0],a=n[1];a instanceof Zr==0&&(a=new Zr(a));var s,o=ua(r);return!0===a.value?o+=ca(a.params):(o+="=",kw(a.value)?o+=Hy(t="(".concat(ub(i=(s=a).value).call(i,ha).join(" "),")")).call(t,ca(s.params)):o+=ha(a)),o})).join(",".concat(r))}var fa=function(e){return Math.round(e)},va=function(e){return 100*fa(e/100)},ga={br:fa,d:fa,bl:va,dl:va,mtp:va,nor:function(e,t){return(null==t?void 0:t.baseUrl)&&(e=function(e,t,i,n){var r=new tI(e),a=new tI(t);if(r.origin!==a.origin)return e;for(var s=iI(i=r.pathname.split("/")).call(i,1),o=iI(n=a.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:va,tb:fa};function pa(e,t){var i,n={};if(null==e||"object"!=qh(e))return n;var r=XC(i=Cy(e)).call(i),s=k({},ga,null==t?void 0:t.formatters),o=null==t?void 0:Dy(t);return Py(r).call(r,(function(i){if(!(null==o?void 0:o(i))){var r,l=e[i],u=s[i];u&&(l=u(l,t)),"v"===i&&1===l||"pr"==i&&1===l||("number"==typeof(r=l)?a(r):null!=r&&""!==r&&!1!==r)&&(function(e){return"ot"===e||"sf"===e||"st"===e}(i)&&"string"==typeof l&&(l=new ta(l)),n[i]=l)}})),n}function ma(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?(t=pa(e,n),i=k({whitespace:!1},n),da(t,i)):""}function ya(e,t,i){return k(e,function(e){var t,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={};if(!e)return r;var a=OP(e),s=Hy(t=OP($r)).call(t,OP((null==n?void 0:n.customHeaderMap)||{})),o=ok(a).call(a,(function(e,t){var i,n,r=yf(t,2),a=r[0],o=r[1],l=(null===(i=$P(s).call(s,(function(e){var t;return bP(t=e[1]).call(t,a)})))||void 0===i?void 0:i[0])||qr;return null!==(n=e[l])&&void 0!==n||(e[l]={}),e[l][a]=o,e}),{});return ok(i=OP(o)).call(i,(function(e,t){var i=yf(t,2),r=i[0],a=i[1];return e[r]=ma(a,n),e}),r)}(t,i))}var ka=/CMCD=[^&#]+/;function Ta(e,t,i){var n,r,a=function(e){if(!e)return"";var t=ma(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});return"CMCD=".concat(encodeURIComponent(t))}(t,i);if(!a)return e;if(ka.test(e))return e.replace(ka,a);var s=bP(e).call(e,"?")?"&":"?";return Hy(n=Hy(r="".concat(e)).call(r,s)).call(n,a)}var Ea=function(){function e(t){var i=this;Zm(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(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(e){try{i.apply(e,{ot:Yr.MANIFEST,su:!i.initialized})}catch(t){i.hls.logger.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=function(e){try{var t=e.frag,n=e.part,r=i.hls.levels[t.level],a=i.getObjectType(t),s={d:1e3*(n||t).duration,ot:a};a!==Yr.VIDEO&&a!==Yr.AUDIO&&a!=Yr.MUXED||(s.br=r.bitrate/1e3,s.tb=i.getTopBandwidth(a)/1e3,s.bl=i.getBufferLength(a));var o=n?i.getNextPart(n):i.getNextFrag(t);null!=o&&o.url&&o.url!==t.url&&(s.nor=o.url),i.apply(e,s)}catch(l){i.hls.logger.warn("Could not generate segment CMCD data.",l)}},this.hls=t;var n=this.config=t.config,r=n.cmcd;null!=r&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||t.sessionId,this.cid=r.contentId,this.useHeaders=!0===r.useHeaders,this.includeKeys=r.includeKeys,this.registerListeners())}return ey(e,[{key:"registerListeners",value:function(){var e=this.hls;e.on(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(c.MEDIA_DETACHED,this.onMediaDetached,this),e.on(c.BUFFER_CREATED,this.onBufferCreated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(c.MEDIA_DETACHED,this.onMediaDetached,this),e.off(c.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 i,n;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(n=t.tracks.video)?void 0:n.buffer}},{key:"createData",value:function(){var e;return{v:1,sf:zr.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,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};k(i,this.createData());var n=i.ot===Yr.INIT||i.ot===Yr.VIDEO||i.ot===Yr.MUXED;this.starved&&n&&(i.bs=!0,i.su=!0,this.starved=!1),null==i.su&&(i.su=this.buffering);var r=this.includeKeys;r&&(i=ok(t=Cy(i)).call(t,(function(e,t){return bP(r).call(r,t)&&(e[t]=i[t]),e}),{}));var a={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),ya(e.headers,i,a)):e.url=Ta(e.url,i,a)}},{key:"getNextFrag",value:function(e){var t,i=null==(t=this.hls.levels[e.level])?void 0:t.details;if(i){var n=e.sn-i.startSN;return i.fragments[n+1]}}},{key:"getNextPart",value:function(e){var t,i,n=e.index,r=e.fragment,a=null==(t=this.hls.levels[r.level])||null==(i=t.details)?void 0:i.partList;if(a)for(var s=r.sn,o=a.length-1;o>=0;o--){var l=a[o];if(l.index===n&&l.fragment.sn===s)return a[o+1]}}},{key:"getObjectType",value:function(e){var t=e.type;return"subtitle"===t?Yr.TIMED_TEXT:"initSegment"===e.sn?Yr.INIT:"audio"===t?Yr.AUDIO:"main"===t?this.hls.audioTracks.length?Yr.VIDEO:Yr.MUXED:void 0}},{key:"getTopBandwidth",value:function(e){var t,i=0,n=this.hls;if(e===Yr.AUDIO)t=n.audioTracks;else{var r,a=n.maxAutoLevel,s=a>-1?a+1:n.levels.length;t=iI(r=n.levels).call(r,0,s)}var o,l=function(e,t){var i=void 0!==Ih&&ld(e)||e["@@iterator"];if(!i){if(cd(e)||(i=pf(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==i.return||i.return()}finally{if(o)throw a}}}}(t);try{for(l.s();!(o=l.n()).done;){var u=o.value;u.bitrate>i&&(i=u.bitrate)}}catch(c){l.e(c)}finally{l.f()}return i>0?i:NaN}},{key:"getBufferLength",value:function(e){var t=this.media,i=e===Yr.AUDIO?this.audioBuffer:this.videoBuffer;return i&&t?1e3*Mt.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN}},{key:"createPlaylistLoader",value:function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function e(t){Zm(this,e),this.loader=void 0,this.loader=new i(t)}return ey(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,i,n){t(e),this.loader.load(e,i,n)}}]),e}()}},{key:"createFragmentLoader",value:function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function e(t){Zm(this,e),this.loader=void 0,this.loader=new i(t)}return ey(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,i,n){t(e),this.loader.load(e,i,n)}}]),e}()}}]),e}(),Sa=function(e){Qm(i,e);var t=$m(i);function i(e){var n;return Zm(this,i),(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 ey(i,[{key:"registerListeners",value:function(){var e=this.hls;e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(c.MANIFEST_PARSED,this.onManifestParsed,this),e.on(c.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(c.MANIFEST_PARSED,this.onManifestParsed,this),e.off(c.ERROR,this.onError,this))}},{key:"pathways",value:function(){var e;return ok(e=this.levels||[]).call(e,(function(e,t){return-1===zy(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=Dy(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 i=t.contentSteering;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.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 i=t.errorAction;if((null==i?void 0:i.action)===Te.SendAlternateToPenaltyBox&&OI(i)===Ee.MoveAllAlternatesMatchingHost){var n,r,a,s,o,l=this.levels,u=this._pathwayPriority,c=this.pathwayId;if(t.context){var h=t.context,d=h.groupId,f=h.pathwayId,v=h.type;d&&l?c=this.getPathwayForGroupId(d,v,c):f&&(c=f)}c in this.penalizedPathways||(this.penalizedPathways[c]=performance.now()),!u&&l&&(u=this.pathways()),u&&u.length>1&&(this.updatePathwayPriority(u),i.resolved=this.pathwayId!==c),i.resolved||this.warn(Hy(n=Hy(r=Hy(a=Hy(s=Hy(o="Could not resolve ".concat(t.details,' ("')).call(o,t.error.message,'") with content-steering for Pathway: ')).call(s,c," levels: ")).call(a,l?l.length:l," priorities: ")).call(r,bI(u)," penalized: ")).call(n,bI(this.penalizedPathways)))}}},{key:"filterParsedLevels",value:function(e){var t,i;this.levels=e;var n=this.getLevelsForPathway(this.pathwayId);if(0===n.length){var r,a=e[0].pathwayId;this.log(Hy(r="No levels found in Pathway ".concat(this.pathwayId,'. Setting initial Pathway to "')).call(r,a,'"')),n=this.getLevelsForPathway(a),this.pathwayId=a}return n.length!==e.length&&this.log(Hy(t=Hy(i="Found ".concat(n.length,"/")).call(i,e.length,' levels in Pathway "')).call(t,this.pathwayId,'"')),n}},{key:"getLevelsForPathway",value:function(e){var t;return null===this.levels?[]:Dy(t=this.levels).call(t,(function(t){return e===t.pathwayId}))}},{key:"updatePathwayPriority",value:function(e){var t,i;this._pathwayPriority=e;var n=this.penalizedPathways,r=performance.now();Py(t=Cy(n)).call(t,(function(e){r-n[e]>3e5&&delete n[e]}));for(var a=0;a<e.length;a++){var s=e[a];if(!(s in n)){if(s===this.pathwayId)return;var o=this.hls.nextLoadLevel,l=this.hls.levels[o];if((i=this.getLevelsForPathway(s)).length>0){var u;this.log('Setting Pathway to "'.concat(s,'"')),this.pathwayId=s,Fi(i),this.hls.trigger(c.LEVELS_UPDATED,{levels:i});var h=this.hls.levels[o];l&&h&&this.levels&&(h.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&h.bitrate!==l.bitrate&&this.log(Hy(u="Unstable Pathways change from bitrate ".concat(l.bitrate," to ")).call(u,h.bitrate)),this.hls.nextLoadLevel=o);break}}}}},{key:"getPathwayForGroupId",value:function(e,t,i){for(var n,r=Hy(n=this.getLevelsForPathway(i)).call(n,this.levels||[]),a=0;a<r.length;a++)if(t===f&&r[a].hasAudioGroup(e)||t===v&&r[a].hasSubtitleGroup(e))return r[a].pathwayId;return i}},{key:"clonePathways",value:function(e){var t=this,i=this.levels;if(i){var n={},r={};Py(e).call(e,(function(e){var a,s=e.ID,o=e["BASE-ID"],l=e["URI-REPLACEMENT"];if(!Yy(i).call(i,(function(e){return e.pathwayId===s}))){var u=ub(a=t.getLevelsForPathway(o)).call(a,(function(e){var t,i,a=new Kt(e.attrs);a["PATHWAY-ID"]=s;var o=a.AUDIO&&Hy(t="".concat(a.AUDIO,"_clone_")).call(t,s),u=a.SUBTITLES&&Hy(i="".concat(a.SUBTITLES,"_clone_")).call(i,s);o&&(n[a.AUDIO]=o,a.AUDIO=o),u&&(r[a.SUBTITLES]=u,a.SUBTITLES=u);var c=ba(e.uri,a["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),h=new Z({attrs:a,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:c,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(var d=1;d<e.audioGroups.length;d++){var f;h.addGroupId("audio",Hy(f="".concat(e.audioGroups[d],"_clone_")).call(f,s))}if(e.subtitleGroups)for(var v=1;v<e.subtitleGroups.length;v++){var g;h.addGroupId("text",Hy(g="".concat(e.subtitleGroups[v],"_clone_")).call(g,s))}return h}));i.push.apply(i,mf(u)),_a(t.audioTracks,n,l,s),_a(t.subtitleTracks,r,l,s)}}))}}},{key:"loadSteeringManifest",value:function(e){var t,i=this,n=this.hls.config,r=n.loader;this.loader&&this.loader.destroy(),this.loader=new r(n);try{t=new tI(e)}catch(d){return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: ".concat(e))}if("data:"!==t.protocol){var a=0|(this.hls.bandwidthEstimate||n.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+a)}var s={responseType:"json",url:t.href},o=n.steeringManifestLoadPolicy.default,l=o.errorRetry||o.timeoutRetry||{},u={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},h={onSuccess:function(e,n,r,a){i.log('Loaded steering manifest: "'.concat(t,'"'));var s=e.data;if(1===(null==s?void 0:s.VERSION)){i.updated=performance.now(),i.timeToLoad=s.TTL;var o=s["RELOAD-URI"],l=s["PATHWAY-CLONES"],u=s["PATHWAY-PRIORITY"];if(o)try{i.uri=new tI(o,t).href}catch(d){return i.enabled=!1,void i.log("Failed to parse Steering Manifest RELOAD-URI: ".concat(o))}i.scheduleRefresh(i.uri||r.url),l&&i.clonePathways(l);var h={steeringManifest:s,url:t.toString()};i.hls.trigger(c.STEERING_MANIFEST_LOADED,h),u&&i.updatePathwayPriority(u)}else i.log("Steering VERSION ".concat(s.VERSION," not supported!"))},onError:function(e,t,n,r){var a,s;if(i.log(Hy(a=Hy(s="Error loading steering manifest: ".concat(e.code," ")).call(s,e.text," (")).call(a,t.url,")")),i.stopLoad(),410===e.code)return i.enabled=!1,void i.log("Steering manifest ".concat(t.url," no longer available"));var o=1e3*i.timeToLoad;if(429!==e.code)i.scheduleRefresh(i.uri||t.url,o);else{var l=i.loader;if("function"==typeof(null==l?void 0:l.getResponseHeader)){var u=l.getResponseHeader("Retry-After");u&&(o=1e3*Tb(u))}i.log("Steering manifest ".concat(t.url," rate limited"))}},onTimeout:function(e,t,n){i.log("Timeout loading steering manifest (".concat(t.url,")")),i.scheduleRefresh(i.uri||t.url)}};this.log("Requesting steering manifest: ".concat(t)),this.loader.load(s,u,h)}},{key:"scheduleRefresh",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*this.timeToLoad;this.clearTimeout(),this.reloadTimer=gC((function(){var i,n=null==(i=t.hls)?void 0:i.media;!n||n.ended?t.scheduleRefresh(e,1e3*t.timeToLoad):t.loadSteeringManifest(e)}),i)}}]),i}(S);function _a(e,t,i,n){var r;e&&Py(r=Cy(t)).call(r,(function(r){var a,s=ub(a=Dy(e).call(e,(function(e){return e.groupId===r}))).call(a,(function(e){var a=k({},e);return a.details=void 0,a.attrs=new Kt(a.attrs),a.url=a.attrs.URI=ba(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),a.groupId=a.attrs["GROUP-ID"]=t[r],a.attrs["PATHWAY-ID"]=n,a}));e.push.apply(e,mf(s))}))}function ba(e,t,i,n){var r,a,s,o=n.HOST,l=n.PARAMS,u=n[i];t&&(s=null==u?void 0:u[t])&&(e=s);var c=new tI(e);return o&&!s&&(c.host=o),l&&Py(r=XC(a=Cy(l)).call(a)).call(r,(function(e){e&&c.searchParams.set(e,l[e])})),c.href}var Aa=function(e){Qm(i,e);var t=$m(i);function i(e){var n;return Zm(this,i),(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=i.CDMCleanupPromise?[i.CDMCleanupPromise]:[],n.onMediaEncrypted=function(e){var t,i=e.initDataType,r=e.initData,a=Hy(t='"'.concat(e.type,'" event: init data type: "')).call(t,i,'"');if(n.debug(a),null!==r){var s,o;if("sinf"===i&&n.getLicenseServerUrl(Jt.FAIRPLAY)){var l=rt(new Uint8Array(r));try{var u=mt(Xt(JSON.parse(l).sinf));if(!u)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=u.subarray(8,24),o=Jt.FAIRPLAY}catch(b){var c;return void n.warn(Hy(c="".concat(a," Failed to parse sinf: ")).call(c,b))}}else if(n.getLicenseServerUrl(Jt.WIDEVINE)){var h,d=function(e){var t=[];if(e instanceof ArrayBuffer)for(var i=e.byteLength,n=0;n+32<i;){var r=At(new DataView(e,n));t.push(r),n+=r.size}return t}(r),f=Cy(n.keySystemAccessPromises);f.length||(f=li(n.config));var v=Dy(d).call(d,(function(e){var t=e.systemId?si(e.systemId):null;return!!t&&zy(f).call(f,t)>-1}))[0];if(!v)return void(0===d.length||Yy(d).call(d,(function(e){return!e.systemId}))?n.warn("".concat(a," contains incomplete or invalid pssh data")):n.log(Hy(h="ignoring ".concat(a," for ")).call(h,ub(d).call(d,(function(e){return si(e.systemId)})).join(",")," pssh data in favor of playlist keys")));if(o=si(v.systemId),0===v.version&&v.data)if(o===Jt.WIDEVINE){var g=v.data.length-22;s=v.data.subarray(g,g+16)}else o===Jt.PLAYREADY&&(s=hi(v.data))}if(o&&s){for(var p=Ue(s),m=Xm(n),y=m.keyIdToKeySessionPromise,k=m.mediaKeySessions,T=y[p],E=function(){var e,t=k[S],a=t.decryptdata;if(!a.keyId)return"continue";var o=Ue(a.keyId);return p===o||-1!==zy(e=a.uri.replace(/-/g,"")).call(e,p)?(T=y[o],a.pssh||(delete y[o],a.pssh=new Uint8Array(r),a.keyId=s,(T=y[p]=T.then((function(){return n.generateRequestWithPreferredKeySession(t,i,r,"encrypted-event-key-match")}))).catch((function(e){return n.handleError(e)}))),"break"):void 0},S=0;S<k.length;S++){var _=E();if("continue"!==_&&"break"===_)break}T||(T=y[p]=n.getKeySystemSelectionPromise([o]).then((function(e){var t,a=e.keySystem,o=e.mediaKeys;n.throwIfDestroyed();var l=new fi("ISO-23001-7",p,null!=(t=oi(a))?t:"");return l.pssh=new Uint8Array(r),l.keyId=s,n.attemptSetMediaKeys(a,o).then((function(){n.throwIfDestroyed();var e=n.createMediaKeySessionContext({decryptdata:l,keySystem:a,mediaKeys:o});return n.generateRequestWithPreferredKeySession(e,i,r,"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 ey(i,[{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(c.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(c.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(c.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(c.MANIFEST_LOADED,this.onManifestLoaded,this)}},{key:"unregisterListeners",value:function(){this.hls.off(c.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(c.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(c.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(c.MANIFEST_LOADED,this.onManifestLoaded,this)}},{key:"getLicenseServerUrl",value:function(e){var t=this.config,i=t.drmSystems,n=t.widevineLicenseUrl,r=i[e];return r?r.licenseUrl:e===Jt.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,i,n=this,r=this.hls.levels,a=function(e,t,i){return!!e&&zy(i).call(i,e)===t},s=Dy(t=ub(r).call(r,(function(e){return e.audioCodec}))).call(t,a),o=Dy(i=ub(r).call(r,(function(e){return e.videoCodec}))).call(i,a);return s.length+o.length===0&&o.push("avc1.42e01e"),new nb((function(t,i){!function e(r){var a=r.shift();n.getMediaKeysPromise(a,s,o).then((function(e){return t({keySystem:a,mediaKeys:e})})).catch((function(t){r.length?e(r):i(t instanceof Ra?t:new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))}(e)}))}},{key:"requestMediaKeySystemAccess",value:function(e,t){var i=this.config.requestMediaKeySystemAccessFunc;if("function"!=typeof i){var n="Configured requestMediaKeySystemAccess is not a function ".concat(i);return null===ci&&"http:"===self.location.protocol&&(n="navigator.requestMediaKeySystemAccess is not available over insecure protocol ".concat(location.protocol)),nb.reject(new Error(n))}return i(e,t)}},{key:"getMediaKeysPromise",value:function(e,t,i){var n=this,r=function(e,t,i,n){var r,a,s,o;switch(e){case Jt.FAIRPLAY:r=["cenc","sinf"];break;case Jt.WIDEVINE:case Jt.PLAYREADY:r=["cenc"];break;case Jt.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error("Unknown key-system: ".concat(e))}return a=t,s=i,[{initDataTypes:r,persistentState:(o=n).persistentState||"optional",distinctiveIdentifier:o.distinctiveIdentifier||"optional",sessionTypes:o.sessionTypes||[o.sessionType||"temporary"],audioCapabilities:ub(a).call(a,(function(e){return{contentType:"audio/mp4; codecs=".concat(e),robustness:o.audioRobustness||"",encryptionScheme:o.audioEncryptionScheme||null}})),videoCapabilities:ub(s).call(s,(function(e){return{contentType:"video/mp4; codecs=".concat(e),robustness:o.videoRobustness||"",encryptionScheme:o.videoEncryptionScheme||null}}))}]}(e,t,i,this.config.drmSystemOptions),a=this.keySystemAccessPromises[e],s=null==a?void 0:a.keySystemAccess;if(!s){var o;this.log(Hy(o='Requesting encrypted media "'.concat(e,'" key-system access with config: ')).call(o,bI(r))),s=this.requestMediaKeySystemAccess(e,r);var l=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch((function(t){var i;n.log(Hy(i='Failed to obtain access to key-system "'.concat(e,'": ')).call(i,t))})),s.then((function(t){n.log('Access for key-system "'.concat(t.keySystem,'" obtained'));var i=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,'"')),i.then((function(i){return i?n.setMediaKeysServerCertificate(t,e,i):t}))})),l.mediaKeys.catch((function(t){var i;n.error(Hy(i='Failed to create media-keys for "'.concat(e,'"}: ')).call(i,t))})),l.mediaKeys}))}return s.then((function(){return a.mediaKeys}))}},{key:"createMediaKeySessionContext",value:function(e){var t,i=e.decryptdata,n=e.keySystem,r=e.mediaKeys;this.log(Hy(t='Creating key-system session "'.concat(n,'" keyId: ')).call(t,Ue(i.keyId||[])));var a=r.createSession(),s={decryptdata:i,keySystem:n,mediaKeys:r,mediaKeysSession:a,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}},{key:"renewKeySession",value:function(e){var t=e.decryptdata;if(t.pssh){var i=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,r,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 Ue(e.keyId)}},{key:"updateKeySession",value:function(e,t){var i,n,r,a=e.mediaKeysSession;return this.log(Hy(i=Hy(n='Updating key-session "'.concat(a.sessionId,'" for keyID ')).call(n,Ue((null==(r=e.decryptdata)?void 0:r.keyId)||[]),"\n } (data length: ")).call(i,t?t.byteLength:t,")")),a.update(t)}},{key:"selectKeySystemFormat",value:function(e){var t,i,n,r=Cy(e.levelkeys||{});return this.keyFormatPromise||(this.log(Hy(t=Hy(i=Hy(n="Selecting key-system from fragment (sn: ".concat(e.sn," ")).call(n,e.type,": ")).call(i,e.level,") key formats ")).call(t,r.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(r)),this.keyFormatPromise}},{key:"getKeyFormatPromise",value:function(e){var t=this;return new nb((function(i,n){var r,a=li(t.config),s=Dy(r=ub(e).call(e,ti)).call(r,(function(e){return!!e&&-1!==zy(a).call(a,e)}));return t.getKeySystemSelectionPromise(s).then((function(e){var t=e.keySystem,r=oi(t);r?i(r):n(new Error('Unable to find format for key-system "'.concat(t,'"')))})).catch(n)}))}},{key:"loadKey",value:function(e){var t,i,n,r=this,a=e.keyInfo.decryptdata,s=this.getKeyIdString(a),o=Hy(t=Hy(i=Hy(n="(keyId: ".concat(s,' format: "')).call(n,a.keyFormat,'" method: ')).call(i,a.method," uri: ")).call(t,a.uri,")");this.log("Starting session for key ".concat(o));var l=this.keyIdToKeySessionPromise[s];return l||(l=this.getKeySystemForKeyPromise(a).then((function(t){var i,n,s,l=t.keySystem,u=t.mediaKeys;return r.throwIfDestroyed(),r.log(Hy(i=Hy(n=Hy(s="Handle encrypted media sn: ".concat(e.frag.sn," ")).call(s,e.frag.type,": ")).call(n,e.frag.level," using key ")).call(i,o)),r.attemptSetMediaKeys(l,u).then((function(){return r.throwIfDestroyed(),r.createMediaKeySessionContext({keySystem:l,mediaKeys:u,decryptdata:a})}))})),(this.keyIdToKeySessionPromise[s]=l.then((function(e){var t=a.pssh?a.pssh.buffer:null;return r.generateRequestWithPreferredKeySession(e,"cenc",t,"playlist-key")}))).catch((function(e){return r.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 Ra?this.hls.trigger(c.ERROR,e.data):this.hls.trigger(c.ERROR,{type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}},{key:"getKeySystemForKeyPromise",value:function(e){var t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){var n=ti(e.keyFormat),r=n?[n]:li(this.config);return this.attemptKeySystemAccess(r)}return i}},{key:"getKeySystemSelectionPromise",value:function(e){if(e.length||(e=li(this.config)),0===e.length)throw new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options ".concat(bI({drmSystems:this.config.drmSystems})));return this.attemptKeySystemAccess(e)}},{key:"attemptSetMediaKeys",value:function(e,t){var i,n=this,r=iI(i=this.setMediaKeysQueue).call(i);this.log('Setting media-keys for "'.concat(e,'"'));var a=nb.all(r).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(a),a.then((function(){var t;n.log('Media-keys set for "'.concat(e,'"')),r.push(a),n.setMediaKeysQueue=Dy(t=n.setMediaKeysQueue).call(t,(function(e){return-1===zy(r).call(r,e)}))}))}},{key:"generateRequestWithPreferredKeySession",value:function(e,t,i,n){var r,a,s,o,c,h=this,d=null==(o=this.config.drmSystems)||null==(c=o[e.keySystem])?void 0:c.generateRequest;if(d)try{var f=d.call(this.hls,t,i,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");t=f.initDataType,i=f.initData?f.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(T){var v;if(this.warn(T.message),null!=(v=this.hls)&&v.config.debug)throw T}if(null===i)return this.log('Skipping key-session request for "'.concat(n,'" (no initData)')),nb.resolve(e);var g=this.getKeyIdString(e.decryptdata);this.log(Hy(r=Hy(a=Hy(s='Generating key-session request for "'.concat(n,'": ')).call(s,g," (init data type: ")).call(a,t," length: ")).call(r,i?i.byteLength:null,")"));var p=new sn,m=e._onmessage=function(t){var i,n,r=e.mediaKeysSession;if(r){var a=t.messageType,s=t.message;h.log(Hy(i=Hy(n='"'.concat(a,'" message event for session "')).call(n,r.sessionId,'" message size: ')).call(i,s.byteLength)),"license-request"===a||"license-renewal"===a?h.renewLicense(e,s).catch((function(e){p.eventNames().length?p.emit("error",e):h.handleError(e)})):"license-release"===a?e.keySystem===Jt.FAIRPLAY&&(h.updateKeySession(e,Qt("acknowledged")),h.removeSession(e)):h.warn('unhandled media key message type "'.concat(a,'"'))}else p.emit("error",new Error("invalid state"))},y=e._onkeystatuseschange=function(t){var i;if(e.mediaKeysSession){h.onKeyStatusChange(e);var n=e.keyStatus;p.emit("keyStatus",n),"expired"===n&&(h.warn(Hy(i="".concat(e.keySystem," expired for key ")).call(i,g)),h.renewKeySession(e))}else p.emit("error",new Error("invalid state"))};e.mediaKeysSession.addEventListener("message",m),e.mediaKeysSession.addEventListener("keystatuseschange",y);var k=new nb((function(e,t){p.on("error",t),p.on("keyStatus",(function(i){wk(i).call(i,"usable")?e():"output-restricted"===i?t(new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'.concat(i,'"'))):"expired"===i?t(new Error("key expired while generating request")):h.warn('unhandled key status change "'.concat(i,'"'))}))}));return e.mediaKeysSession.generateRequest(t,i).then((function(){var t,i;h.log(Hy(t='Request generated for key-session "'.concat(null==(i=e.mediaKeysSession)?void 0:i.sessionId,'" keyId: ')).call(t,g))})).catch((function(e){throw new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},"Error generating key-session request: ".concat(e))})).then((function(){return k})).catch((function(t){throw p.removeAllListeners(),h.removeSession(e),t})).then((function(){return p.removeAllListeners(),e}))}},{key:"onKeyStatusChange",value:function(e){var t,i=this;Py(t=e.mediaKeysSession.keyStatuses).call(t,(function(t,n){var r,a,s;i.log(Hy(r=Hy(a=Hy(s='key status change "'.concat(t,'" for keyStatuses keyId: ')).call(s,Ue("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))," session keyId: ")).call(a,Ue(new Uint8Array(e.decryptdata.keyId||[]))," uri: ")).call(r,e.decryptdata.uri)),e.keyStatus=t}))}},{key:"fetchServerCertificate",value:function(e){var t=this.config,i=new t.loader(t),n=this.getServerCertificateUrl(e);return n?(this.log('Fetching server certificate for "'.concat(e,'"')),new nb((function(r,a){var s={responseType:"arraybuffer",url:n},o=t.certLoadPolicy.default,c={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:function(e,t,i,n){r(e.data)},onError:function(t,i,r,o){var c,h,d;a(new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:E({url:s.url,data:void 0},t)},Hy(c=Hy(h=Hy(d='"'.concat(e,'" certificate request failed (')).call(d,n,"). Status: ")).call(h,t.code," (")).call(c,t.text,")")))},onTimeout:function(t,i,r){var o;a(new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:s.url,data:void 0}},Hy(o='"'.concat(e,'" certificate request timed out (')).call(o,n,")")))},onAbort:function(e,t,i){a(new Error("aborted"))}};i.load(s,c,h)}))):nb.resolve()}},{key:"setMediaKeysServerCertificate",value:function(e,t,i){var n=this;return new nb((function(r,a){e.setServerCertificate(i).then((function(a){var s,o;n.log(Hy(s=Hy(o="setServerCertificate ".concat(a?"success":"not supported by CDM"," (")).call(o,null==i?void 0:i.byteLength,') on "')).call(s,t,'"')),r(e)})).catch((function(e){a(new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}},{key:"renewLicense",value:function(e,t){var i=this;return this.requestLicense(e,new Uint8Array(t)).then((function(t){return i.updateKeySession(e,new Uint8Array(t)).catch((function(e){throw new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))}))}},{key:"unpackPlayReadyKeyMessage",value:function(e,t){var i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!bP(i).call(i,"PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;var n=(new DOMParser).parseFromString(i,"application/xml"),r=n.querySelectorAll("HttpHeader");if(r.length>0)for(var a,s=0,o=r.length;s<o;s++){var l,u,c=null==(l=(a=r[s]).querySelector("name"))?void 0:l.textContent,h=null==(u=a.querySelector("value"))?void 0:u.textContent;c&&h&&e.setRequestHeader(c,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 Qt(atob(f))}},{key:"setupLicenseXHR",value:function(e,t,i,n){var r=this,a=this.config.licenseXhrSetup;return a?nb.resolve().then((function(){if(!i.decryptdata)throw new Error("Key removed");return a.call(r.hls,e,t,i,n)})).catch((function(s){if(!i.decryptdata)throw s;return e.open("POST",t,!0),a.call(r.hls,e,t,i,n)})).then((function(i){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:i||n}})):(e.open("POST",t,!0),nb.resolve({xhr:e,licenseChallenge:n}))}},{key:"requestLicense",value:function(e,t){var i=this,n=this.config.keyLoadPolicy.default;return new nb((function(r,a){var s=i.getLicenseServerUrlOrThrow(e.keySystem);i.log("Sending license request to URL: ".concat(s));var o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return a(new Error("invalid state"));if(4===o.readyState)if(200===o.status){i._requestLicenseFailureCount=0;var c=o.response;i.log("License received ".concat(c instanceof ArrayBuffer?c.byteLength:c));var h=i.config.licenseResponseCallback;if(h)try{c=h.call(i.hls,o,s,e)}catch(m){i.error(m)}r(c)}else{var d,f,v=n.errorRetry,g=v?v.maxNumRetry:0;if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>g||o.status>=400&&o.status<500)a(new Ra({type:l.KEY_SYSTEM_ERROR,details:u.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:s,data:void 0,code:o.status,text:o.statusText}},Hy(d=Hy(f="License Request XHR failed (".concat(s,"). Status: ")).call(f,o.status," (")).call(d,o.statusText,")")));else{var p=g-i._requestLicenseFailureCount+1;i.warn("Retrying license request, ".concat(p," attempts left")),i.requestLicense(e,t).then(r,a)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,i.setupLicenseXHR(o,s,e,t).then((function(t){var n=t.xhr,r=t.licenseChallenge;e.keySystem==Jt.PLAYREADY&&(r=i.unpackPlayReadyKeyMessage(n,r)),n.send(r)}))}))}},{key:"onMediaAttached",value:function(e,t){if(this.config.emeEnabled){var i=t.media;this.media=i,i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}}},{key:"onMediaDetached",value:function(){var e,t,n=this,r=this.media,a=this.mediaKeySessions;r&&(r.removeEventListener("encrypted",this.onMediaEncrypted),r.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},fi.clearKeyUriToKeyIdMap();var s=a.length;i.CDMCleanupPromise=nb.all(Hy(e=ub(a).call(a,(function(e){return n.removeSession(e)}))).call(e,null==r||null==(t=r.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(c.ERROR,{type:l.OTHER_ERROR,details:u.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"),a.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(c.ERROR,{type:l.OTHER_ERROR,details:u.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 i=t.sessionKeys;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){var n=ok(i).call(i,(function(e,t){return-1===zy(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,i=e.mediaKeysSession,n=e.licenseXhr;if(i){var r,a;this.log("Remove licenses and keys and close session ".concat(i.sessionId)),e._onmessage&&(i.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(i.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=zy(r=this.mediaKeySessions).call(r,e);return s>-1&&mw(a=this.mediaKeySessions).call(a,s,1),i.remove().catch((function(e){var i;t.log("Could not remove session: ".concat(e)),null==(i=t.hls)||i.trigger(c.ERROR,{type:l.OTHER_ERROR,details:u.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error("Could not remove session: ".concat(e))})})).then((function(){return i.close()})).catch((function(e){var i;t.log("Could not close session: ".concat(e)),null==(i=t.hls)||i.trigger(c.ERROR,{type:l.OTHER_ERROR,details:u.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error("Could not close session: ".concat(e))})}))}}}]),i}(S);Aa.CDMCleanupPromise=void 0;var Ra=function(e){Qm(i,e);var t=$m(i);function i(e,n){var r;return Zm(this,i),(r=t.call(this,n)).data=void 0,e.error||(e.error=new Error(n)),r.data=e,e.err=e.error,r}return ey(i)}(qm(Error)),La=function(){function e(t){Zm(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 ey(e,[{key:"setStreamController",value:function(e){this.streamController=e}},{key:"registerListeners",value:function(){this.hls.on(c.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(c.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"unregisterListeners",value:function(){this.hls.off(c.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(c.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 i=this.hls.config;if(i.capLevelOnFPSDrop){var n,r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&"function"==typeof r.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=TI(Iy(n=this.checkFPSInterval).call(n,this),i.fpsDroppedMonitoringPeriod)}}},{key:"onMediaDetaching",value:function(){this.media=null}},{key:"checkFPS",value:function(e,t,i){var n=performance.now();if(t){if(this.lastTime){var r=n-this.lastTime,a=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*a/r,l=this.hls;if(l.trigger(c.FPS_DROP,{currentDropped:a,currentDecoded:s,totalDroppedFrames:i}),o>0&&a>l.config.fpsDroppedMonitoringThreshold*s){var u=l.currentLevel;l.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=u)&&(u-=1,l.trigger(c.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,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}();function Ia(e,t){var i;try{i=new Event("addtrack")}catch(Eo){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function Ca(e,t){var i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: ".concat(t))}catch(Eo){I.debug("[texttrack-utils]: ".concat(Eo));try{var n=new self.TextTrackCue(t.startTime,t.endTime,t.text);n.id=t.id,e.addCue(n)}catch(r){I.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: ".concat(r))}}"disabled"===i&&(e.mode=i)}function wa(e,t){var i=e.mode;if("disabled"===i&&(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"===i&&(e.mode=i)}function Da(e,t,i,n){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var a=function(e,t,i){var n=[],r=function(e,t){if(t<e[0].startTime)return 0;var i=e.length-1;if(t>e[i].endTime)return-1;for(var n=0,r=i;n<=r;){var a=Math.floor((r+n)/2);if(t<e[a].startTime)r=a-1;else{if(!(t>e[a].startTime&&n<i))return a;n=a+1}}return e[n].startTime-t<t-e[r].startTime?n:r}(e,t);if(r>-1)for(var a=r,s=e.length;a<s;a++){var o=e[a];if(o.startTime>=t&&o.endTime<=i)n.push(o);else if(o.startTime>i)return n}return n}(e.cues,t,i),s=0;s<a.length;s++)n&&!n(a[s])||e.removeCue(a[s]);"disabled"===r&&(e.mode=r)}function xa(e){for(var t=[],i=0;i<e.length;i++){var n=e[i];"subtitles"!==n.kind&&"captions"!==n.kind||!n.label||t.push(e[i])}return t}var Pa=function(e){Qm(i,e);var t=$m(i);function i(e){var n;return Zm(this,i),(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=xa(n.media.textTracks),i=0;i<t.length;i++)if("hidden"===t[i].mode)e=t[i];else if("showing"===t[i].mode){e=t[i];break}var r=n.findTrackForTextTrack(e);n.subtitleTrack!==r&&n.setSubtitleTrack(r)}},n.registerListeners(),n}return ey(i,[{key:"destroy",value:function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,ev(Jf(i.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(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.MANIFEST_PARSED,this.onManifestParsed,this),e.on(c.LEVEL_LOADING,this.onLevelLoading,this),e.on(c.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(c.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(c.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.MANIFEST_PARSED,this.onManifestParsed,this),e.off(c.LEVEL_LOADING,this.onLevelLoading,this),e.off(c.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(c.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(c.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=TI(this.onTextTracksChanged,e)}},{key:"onMediaDetaching",value:function(e,t){var i,n=this.media;if(n){var r=!!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,r||Py(i=xa(n.textTracks)).call(i,(function(e){wa(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 i,n,r,a,s,o,l,u=t.id,c=t.groupId,h=t.details,d=this.tracksInGroup[u];if(d&&d.groupId===c){var f=d.details;d.details=t.details,this.log(Hy(r=Hy(a=Hy(s=Hy(o=Hy(l="Subtitle track ".concat(u,' "')).call(l,d.name,'" lang:')).call(o,d.lang," group:")).call(s,c," loaded [")).call(a,h.startSN,"-")).call(r,h.endSN,"]")),u===this.trackId&&this.playlistLoaded(u,t,f)}else this.warn(Hy(i=Hy(n="Subtitle track with id:".concat(u," and group:")).call(n,c," not found in active group ")).call(i,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 i=t.subtitleGroups||null,n=this.groupIds,r=this.currentTrack;if(!i||(null==n?void 0:n.length)!==(null==i?void 0:i.length)||null!=i&&Yy(i).call(i,(function(e){return-1===(null==n?void 0:zy(n).call(n,e))}))){var a,s;this.groupIds=i,this.trackId=-1,this.currentTrack=null;var o=Dy(a=this.tracks).call(a,(function(e){return!i||-1!==zy(i).call(i,e.groupId)}));if(o.length)this.selectDefaultTrack&&!Yy(o).call(o,(function(e){return e.default}))&&(this.selectDefaultTrack=!1),Py(o).call(o,(function(e,t){e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=o;var l=this.hls.config.subtitlePreference;if(!r&&l){this.selectDefaultTrack=!1;var u=re(l,o);if(u>-1)r=o[u];else{var h=re(l,this.tracks);r=this.tracks[h]}}var d=this.findTrackId(r);-1===d&&r&&(d=this.findTrackId(null));var f={subtitleTracks:o};this.log(Hy(s="Updating subtitle tracks, ".concat(o.length,' track(s) found in "')).call(s,null==i?void 0:i.join(","),'" group-id')),this.hls.trigger(c.SUBTITLE_TRACKS_UPDATED,f),-1!==d&&-1===this.trackId&&this.setSubtitleTrack(d)}}}},{key:"findTrackId",value:function(e){for(var t=this.tracksInGroup,i=this.selectDefaultTrack,n=0;n<t.length;n++){var r=t[n];if((!i||r.default)&&(i||e)&&(!e||ae(r,e)))return n}if(e){for(var a=0;a<t.length;a++){var s=t[a];if(Pr(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return a}for(var o=0;o<t.length;o++){var l=t[o];if(Pr(e.attrs,l.attrs,["LANGUAGE"]))return o}}return-1}},{key:"findTrackForTextTrack",value:function(e){if(e)for(var t=this.tracksInGroup,i=0;i<t.length;i++)if(Or(t[i],e))return i;return-1}},{key:"onError",value:function(e,t){var i;!t.fatal&&t.context&&(t.context.type!==v||t.context.id!==this.trackId||this.groupIds&&-1===zy(i=this.groupIds).call(i,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 i=this.currentTrack;if(i&&ae(e,i))return i;var n=re(e,this.tracksInGroup);if(n>-1){var r=this.tracksInGroup[n];return this.setSubtitleTrack(n),r}if(i)return null;var a=re(e,t);if(a>-1)return t[a]}}return null}},{key:"loadPlaylist",value:function(e){ev(Jf(i.prototype),"loadPlaylist",this).call(this),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}},{key:"loadingPlaylist",value:function(e,t){var n,r,a,s,o,l;ev(Jf(i.prototype),"loadingPlaylist",this).call(this,e,t);var u=e.id,h=e.groupId,d=this.getUrlWithDirectives(e.url,t),f=e.details,v=null==f?void 0:f.age;this.log(Hy(n=Hy(r=Hy(a=Hy(s=Hy(o=Hy(l="Loading subtitle ".concat(u,' "')).call(l,e.name,'" lang:')).call(o,e.lang," group:")).call(s,h)).call(a,void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")).call(r,v&&f.live?" age "+v.toFixed(1)+(f.type&&" "+f.type||""):""," ")).call(n,d)),this.hls.trigger(c.SUBTITLE_TRACK_LOADING,{url:d,id:u,groupId:h,deliveryDirectives:t||null,track:e})}},{key:"toggleTrackModes",value:function(){var e,t,i=this.media;if(i){var n,r=xa(i.textTracks),a=this.currentTrack;if(a&&((n=Dy(r).call(r,(function(e){return Or(a,e)}))[0])||this.warn(Hy(e='Unable to find subtitle TextTrack with name "'.concat(a.name,'" and language "')).call(e,a.lang,'"'))),Py(t=iI([]).call(r)).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,i,n=this.tracksInGroup;if(this.media)if(e<-1||e>=n.length||!a(e))this.warn("Invalid subtitle track id: ".concat(e));else{this.selectDefaultTrack=!1;var r=this.currentTrack,s=n[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),s){var o=!!s.details&&!s.details.live;if(e!==this.trackId||s!==r||!o){this.log("Switching to subtitle-track ".concat(e)+(s?Hy(t=Hy(i=' "'.concat(s.name,'" lang:')).call(i,s.lang," group:")).call(t,s.groupId):""));var l=s.id,u=s.groupId,h=void 0===u?"":u,d=s.name,f=s.type,v=s.url;this.hls.trigger(c.SUBTITLE_TRACK_SWITCH,{id:l,groupId:h,name:d,type:f,url:v});var g=this.switchParams(s.url,null==r?void 0:r.details,s.details);this.loadPlaylist(g)}}else this.hls.trigger(c.SUBTITLE_TRACK_SWITCH,{id:e})}else this.queuedDefaultTrack=e}}]),i}(Nr);function Oa(e){for(var t=5381,i=e.length;i;)t=33*t^e.charCodeAt(--i);return(t>>>0).toString()}var Ma=.02,Na=function(e){return e[e.Point=0]="Point",e[e.Range=1]="Range",e}({});function Fa(e,t,i){var n,r;return Hy(n=Hy(r="".concat(e.identifier,"-")).call(r,i+1,"-")).call(n,Oa(t))}var Ua=function(){function e(t,i){Zm(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=i,this.dateRange=t,this.setDateRange(t)}return ey(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 zy(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 Ba(e,t)}return e}},{key:"startOffset",get:function(){return this.cue.pre?0:this.startTime}},{key:"resumptionOffset",get:function(){var e=this.resumeOffset,t=a(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 Ba(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)<Ma))},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"]?Na.Range:Na.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,i,n;return Hy(e=Hy(t=Hy(i='["'.concat((n=this).identifier,'" ')).call(i,n.cue.pre?"<pre>":n.cue.post?"<post>":"")).call(t,n.timelineStart.toFixed(2),"-")).call(e,n.resumeTime.toFixed(2),"]")}}]),e}();function Ba(e,t){return e-t.start<t.duration/2&&!(Math.abs(e-(t.start+t.duration))<Ma)?t.start:t.start+t.duration}function Ha(e,t,i){var n=new tI(e,i);return"data:"!==n.protocol&&n.searchParams.set("_HLS_primary_id",t),n}function Ga(e){var t,i,n=e.timelineStart,r=e.duration||0;return Hy(t=Hy(i='["'.concat(e.identifier,'" ')).call(i,n.toFixed(2),"-")).call(t,(n+r).toFixed(2),"]")}var Va=function(){function e(t,i,n,r){var a=this;Zm(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=a.interstitial.playoutLimit;a.playoutOffset+a.currentTime>=e&&a.hls.trigger(c.PLAYOUT_LIMIT_REACHED,{})};var s=this.hls=new t(i);this.interstitial=n,this.assetItem=r;var o=r.uri;try{o=Ha(o,s.sessionId).href}catch(u){}s.loadSource(o);var l=function(){a.hasDetails=!0};s.once(c.LEVEL_LOADED,l),s.once(c.AUDIO_TRACK_LOADED,l),s.once(c.SUBTITLE_TRACK_LOADED,l),s.on(c.MEDIA_ATTACHING,(function(e,t){var i,n=t.media;a.removeMediaListeners(),a.mediaAttached=n;var s,o=a.interstitial;o.playoutLimit&&(a.playoutOffset=(null==(s=o.assetList[zy(i=o.assetList).call(i,r)])?void 0:s.startOffset)||0,n.addEventListener("timeupdate",a.checkPlayout))}))}return ey(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=Mt.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 i=e-t;if(Math.abs(i)>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,i=this.duration;return Math.min(Math.max(0,e-t),i)}},{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,i){this.hls.on(e,t)}},{key:"once",value:function(e,t,i){this.hls.once(e,t)}},{key:"off",value:function(e,t,i){this.hls.off(e,t)}},{key:"toString",value:function(){var e,t;return Hy(e=Hy(t="HlsAssetPlayer: ".concat(Ga(this.assetItem)," ")).call(t,this.hls.sessionId," ")).call(e,this.interstitial.appendInPlace?"append-in-place":"")}}]),e}(),Ka=function(e){Qm(i,e);var t=$m(i);function i(e,n){var r;return Zm(this,i),(r=t.call(this,"interstitials-sched",n)).onScheduleUpdate=void 0,r.eventMap={},r.events=null,r.items=null,r.durations={primary:0,playout:0,integrated:0},r.onScheduleUpdate=e,r}return ey(i,[{key:"destroy",value:function(){this.reset(),this.onScheduleUpdate=null}},{key:"reset",value:function(){var e;this.eventMap={},this.setDurations(0,0,0),this.events&&Py(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 i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);var n=this.items;if(n)for(n[i]||(void 0===t&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&null!=(r=n[i])&&r.event;){var r;i--}return i}},{key:"findItemIndexAtTime",value:function(e,t){var i=this.items;if(i)for(var n=0;n<i.length;n++){var r=i[n];if(t&&"primary"!==t&&(r=r[t]),e===r.start||e>r.start&&e<r.end)return n}return-1}},{key:"findJumpRestrictedIndex",value:function(e,t){var i=this.items;if(i)for(var n=e;n<=t&&i[n];n++){var r=i[n].event;if(null!=r&&r.restrictions.jump&&!r.appendInPlace)return n}return-1}},{key:"findEventIndex",value:function(e){var t=this.items;if(t)for(var i=t.length;i--;){var n;if((null==(n=t[i].event)?void 0:n.identifier)===e)return i}return-1}},{key:"findAssetIndex",value:function(e,t){var i=e.assetList,n=i.length;if(n>1)for(var r=0;r<n;r++){var a=i[r];if(!a.error){var s=a.timelineStart;if(t===s||t>s&&t<s+(a.duration||0))return r}}return 0}},{key:"assetIdAtEnd",get:function(){var e,t,i=null==(e=this.items)||null==(t=e[this.length-1])?void 0:t.event;if(i){var n=i.assetList,r=n[n.length-1];if(r)return r.identifier}return null}},{key:"parseInterstitialDateRanges",value:function(e){var t=this,i=e.main.details,n=i.dateRanges,r=this.events,a=this.parseDateRanges(n,{url:i.url}),s=Cy(n),o=r?Dy(r).call(r,(function(e){return!bP(s).call(s,e.identifier)})):[];a.length&&XC(a).call(a,(function(e,t){var i=e.cue.pre,n=e.cue.post,r=t.cue.pre,a=t.cue.post;if(i&&!r)return-1;if(r&&!i)return 1;if(n&&!a)return 1;if(a&&!n)return-1;if(!(i||r||n||a)){var s=e.startTime,o=t.startTime;if(s!==o)return s-o}return e.dateRange.tagOrder-t.dateRange.tagOrder})),this.events=a,Py(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]:[],i=this.events||[];if(i.length||t.length||this.length<2){var n=this.items,r=this.parseSchedule(i,e);(t.length||(null==n?void 0:n.length)!==r.length||Yy(r).call(r,(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=r,this.onScheduleUpdate(t,n))}}},{key:"parseDateRanges",value:function(e,t){for(var i=[],n=Cy(e),r=0;r<n.length;r++){var a=n[r],s=e[a];if(s.isInterstitial){var o=this.eventMap[a];o?o.setDateRange(s):(o=new Ua(s,t),this.eventMap[a]=o),i.push(o)}}return i}},{key:"parseSchedule",value:function(e,t){var i=[],n=t.main.details,r=n.live?1/0:n.edge,a=0;if((e=Dy(e).call(e,(function(e){return!(e.error||e.cue.once&&e.hasPlayed)}))).length){this.resolveOffsets(e,t);var s=0,o=0;if(Py(e).call(e,(function(t,n){var l=t.cue.pre,u=t.cue.post,c=e[n-1]||null,h=t.appendInPlace,d=u?r:t.startOffset,f=t.duration,v=t.timelineOccupancy===Na.Range?f:0,g=t.resumptionOffset,p=(null==c?void 0:c.startTime)===d,m=d+t.cumulativeDuration,y=h?m+f:d+g;if(l||!u&&d<=0){var k=o;o+=v,t.timelineStart=m;var T=a;a+=f,i.push({event:t,start:m,end:y,playout:{start:T,end:a},integrated:{start:k,end:o}})}else{if(!(d<=r))return;if(!p){var E=d-s;if(E>.033){var S=s,_=o;o+=E;var b=a;a+=E;var A={previousEvent:e[n-1]||null,nextEvent:t,start:S,end:S+E,playout:{start:b,end:a},integrated:{start:_,end:o}};i.push(A)}else E>0&&c&&(c.cumulativeDuration+=E,i[i.length-1].end=d)}u&&(y=m),t.timelineStart=m;var R=o;o+=v;var L=a;a+=f,i.push({event:t,start:m,end:y,playout:{start:L,end:a},integrated:{start:R,end:o}})}var I=t.resumeTime;s=u||I>r?r:I})),s<r){var l,u=s,c=o,h=r-s;o+=h;var d=a;a+=h,i.push({previousEvent:(null==(l=i[i.length-1])?void 0:l.event)||null,nextEvent:null,start:s,end:u+h,playout:{start:d,end:a},integrated:{start:c,end:o}})}this.setDurations(r,a,o)}else{var f=0;i.push({previousEvent:null,nextEvent:null,start:f,end:r,playout:{start:f,end:r},integrated:{start:f,end:r}}),this.setDurations(r,r,r)}return i}},{key:"setDurations",value:function(e,t,i){this.durations={primary:e,playout:t,integrated:i}}},{key:"resolveOffsets",value:function(e,t){var i=this,n=t.main.details,r=n.live?1/0:n.edge,s=0,o=-1;Py(e).call(e,(function(l,u){var c=l.cue.pre,h=l.cue.post,d=c?0:h?r:l.startTime;if(i.updateAssetDurations(l),o===d?l.cumulativeDuration=s:(s=0,o=d),!h&&l.snapOptions.in&&(l.resumeAnchor=he(null,n.fragments,l.startOffset+l.resumptionOffset,0,0)||void 0),l.appendInPlace&&!l.appendInPlaceStarted&&(i.primaryCanResumeInPlaceAt(l,t)||(l.appendInPlace=!1)),!l.appendInPlace)for(var f=u-1;u--;)e[f+1].startTime-e[f].resumeTime<.033&&(e[f].appendInPlace=!1);var v=a(l.resumeOffset)?l.resumeOffset:l.duration;s+=v}))}},{key:"primaryCanResumeInPlaceAt",value:function(e,t){var i,n,r,a,s=this,o=e.resumeTime,l=e.startTime+e.resumptionOffset;return Math.abs(o-l)>Ma?(this.log(Hy(i=Hy(n='"'.concat(e.identifier,'" resumption ')).call(n,o," not aligned with estimated timeline end ")).call(i,l)),!1):t?!Yy(r=Cy(t)).call(r,(function(i){var n,r,a,l,u,c,h,d,f,v,g,p=t[i].details,m=p.edge;if(o>m)return s.log(Hy(n=Hy(r=Hy(a='"'.concat(e.identifier,'" resumption ')).call(a,o," past ")).call(r,i," playlist end ")).call(n,m)),!0;var y=he(null,p.fragments,o);if(!y)return s.log(Hy(l=Hy(u='"'.concat(e.identifier,'" resumption ')).call(u,o," does not align with any fragments in ")).call(l,i," playlist")),!0;var k="audio"===i?.175:0;return!(Math.abs(y.start-o)<Ma||Math.abs(y.end-o)<Ma+k||(s.log(Hy(c=Hy(h=Hy(d=Hy(f=Hy(v=Hy(g='"'.concat(e.identifier,'" resumption ')).call(g,o," not aligned with ")).call(v,i," fragment bounds (")).call(f,y.start,"-")).call(d,y.end," sn: ")).call(h,y.sn," cc: ")).call(c,y.cc,")")),0))})):(this.log(Hy(a='"'.concat(e.identifier,'" resumption ')).call(a,o," can not be aligned with media (none selected)")),!1)}},{key:"updateAssetDurations",value:function(e){var t,i=e.timelineStart,n=0,r=!1,a=!1;Py(t=e.assetList).call(t,(function(e,t){var s=i+n;e.startOffset=n,e.timelineStart=s,r||(r=null===e.duration),a||(a=!!e.error);var o=e.error?0:e.duration||0;n+=o})),e.duration=r&&!a?Math.max(n,e.duration):n}},{key:"removeEvent",value:function(e){e.reset(),delete this.eventMap[e.identifier]}}]),i}(S);function Wa(e){var t,i;return Hy(t=Hy(i="[".concat(e.event?'"'+e.event.identifier+'"':"primary",": ")).call(i,e.start.toFixed(2),"-")).call(t,e.end.toFixed(2),"]")}var ja=function(){function e(t){Zm(this,e),this.hls=void 0,this.hls=t}return ey(e,[{key:"destroy",value:function(){this.hls=null}},{key:"loadAssetList",value:function(e,t){var i,n=this,r=e.assetListUrl;try{i=Ha(r,this.hls.sessionId,e.baseUrl)}catch(g){var a=this.assignAssetListError(e,u.ASSET_LIST_LOAD_ERROR,g,r);return void this.hls.trigger(c.ERROR,a)}if(t&&!e.cue.pre&&!e.cue.post&&"data:"!==i.protocol){var s=t-e.startTime;s>0&&i.searchParams.set("_HLS_start_offset",""+Math.round(1e3*s)/1e3)}var o=this.hls.config,l=new o.loader(o),h={responseType:"json",url:i.href},d=o.interstitialAssetListLoadPolicy.default,f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},v={onSuccess:function(t,i,r,a){var s=t.data,o=null==s?void 0:s.ASSETS;if(kw(o))e.assetListResponse=s,n.hls.trigger(c.ASSET_LIST_LOADED,{event:e,assetListResponse:s,networkDetails:a});else{var l=n.assignAssetListError(e,u.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),r.url,i,a);n.hls.trigger(c.ERROR,l)}},onError:function(t,i,r,a){var s,o,l=n.assignAssetListError(e,u.ASSET_LIST_LOAD_ERROR,new Error(Hy(s=Hy(o="Error loading X-ASSET-LIST: HTTP status ".concat(t.code," ")).call(o,t.text," (")).call(s,i.url,")")),i.url,a,r);n.hls.trigger(c.ERROR,l)},onTimeout:function(t,i,r){var a=n.assignAssetListError(e,u.ASSET_LIST_LOAD_TIMEOUT,new Error("Timeout loading X-ASSET-LIST (".concat(i.url,")")),i.url,t,r);n.hls.trigger(c.ERROR,a)}};return l.load(h,f,v),this.hls.trigger(c.ASSET_LIST_LOADING,{event:e}),l}},{key:"assignAssetListError",value:function(e,t,i,n,r,a){return e.error=i,{type:l.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:a,stats:r}}}]),e}();function Ya(e){null==e||e.play().catch()}var za=function(e){Qm(i,e);var t=$m(i);function i(e,n,r){var a;return Zm(this,i),(a=t.call(this,e,n,r,"subtitle-stream-controller",g.SUBTITLE)).currentTrackId=-1,a.tracksBuffered=[],a.mainDetails=null,a.registerListeners(),a}return ey(i,[{key:"onHandlerDestroying",value:function(){this.unregisterListeners(),ev(Jf(i.prototype),"onHandlerDestroying",this).call(this),this.mainDetails=null}},{key:"registerListeners",value:function(){ev(Jf(i.prototype),"registerListeners",this).call(this);var e=this.hls;e.on(c.LEVEL_LOADED,this.onLevelLoaded,this),e.on(c.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(c.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(c.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(c.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(c.BUFFER_FLUSHING,this.onBufferFlushing,this)}},{key:"unregisterListeners",value:function(){ev(Jf(i.prototype),"unregisterListeners",this).call(this);var e=this.hls;e.off(c.LEVEL_LOADED,this.onLevelLoaded,this),e.off(c.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(c.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(c.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(c.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(c.BUFFER_FLUSHING,this.onBufferFlushing,this)}},{key:"startLoad",value:function(e){this.stopLoad(),this.state=ji,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}},{key:"onManifestLoading",value:function(){ev(Jf(i.prototype),"onManifestLoading",this).call(this),this.mainDetails=null}},{key:"onMediaDetaching",value:function(e,t){this.tracksBuffered=[],ev(Jf(i.prototype),"onMediaDetaching",this).call(this,e,t)}},{key:"onLevelLoaded",value:function(e,t){this.mainDetails=t.details}},{key:"onSubtitleFragProcessed",value:function(e,t){var i=t.frag,n=t.success;if(Ze(i)&&(this.fragPrevious=i),this.state=ji,n){var r=this.tracksBuffered[this.currentTrackId];if(r){for(var a,s=i.start,o=0;o<r.length;o++)if(s>=r[o].start&&s<=r[o].end){a=r[o];break}var l=i.start+i.duration;a?a.end=l:(a={start:s,end:l},r.push(a)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}}}},{key:"onBufferFlushing",value:function(e,t){var i=t.startOffset,n=t.endOffset;if(0===i&&n!==Number.POSITIVE_INFINITY){var r,a=n-1;if(a<=0)return;t.endOffsetSubtitles=Math.max(0,a),Py(r=this.tracksBuffered).call(r,(function(e){for(var t=0;t<e.length;)if(e[t].end<=a)e.shift();else{if(!(e[t].start<a))break;e[t].start=a,t++}})),this.fragmentTracker.removeFragmentsInRange(i,a,g.SUBTITLE)}}},{key:"onError",value:function(e,t){var i=t.frag;(null==i?void 0:i.type)===g.SUBTITLE&&(t.details===u.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Wi&&(this.state=ji))}},{key:"onSubtitleTracksUpdated",value:function(e,t){var i=this,n=t.subtitleTracks;this.levels&&xr(this.levels,n)?this.levels=ub(n).call(n,(function(e){return new Z(e)})):(this.tracksBuffered=[],this.levels=ub(n).call(n,(function(e){var t=new Z(e);return i.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,g.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null)}},{key:"onSubtitleTrackSwitch",value:function(e,t){var i;if(this.currentTrackId=t.id,null!=(i=this.levels)&&i.length&&-1!==this.currentTrackId){var n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.state!==Wi&&this.setInterval(500)}else this.clearInterval()}},{key:"onSubtitleTrackLoaded",value:function(e,t){var i,n,r,a,s,o,l=this.currentTrackId,u=this.levels,h=t.details,d=t.id;if(u){var f=u[d];if(!(d>=u.length)&&f){if(this.log(Hy(i=Hy(n=Hy(r=Hy(a="Subtitle track ".concat(d," loaded [")).call(a,h.startSN,",")).call(r,h.endSN,"]")).call(n,h.lastPartSn?Hy(s="[part-".concat(h.lastPartSn,"-")).call(s,h.lastPartIndex,"]"):"",",duration:")).call(i,h.totalduration)),this.mediaBuffer=this.mediaBufferTimeRanges,h.live||null!=(o=f.details)&&o.live){var v=this.mainDetails;if(h.deltaUpdateFailed||!v)return;var g,p=v.fragments[0];f.details?0===this.alignPlaylists(h,f.details,null==(g=this.levelLastLoaded)?void 0:g.details)&&p&&Pi(h,p.start):h.hasProgramDateTime&&v.hasProgramDateTime?(Vi(h,v),h.fragmentStart):p&&Pi(h,p.start)}f.details=h,this.levelLastLoaded=f,d===l&&(this.hls.trigger(c.SUBTITLE_TRACK_UPDATED,{details:h,id:d,groupId:t.groupId}),this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===ji)&&(he(null,h.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),f.details=void 0))}}else this.warn("Subtitle tracks were reset while loading level ".concat(d))}},{key:"_handleFragmentLoadComplete",value:function(e){var t=this,i=e.frag,n=e.payload,r=i.decryptdata,a=this.hls;if(!this.fragContextChanged(i)&&n&&n.byteLength>0&&null!=r&&r.key&&r.iv&&zt(r.method)){var s=performance.now();this.decrypter.decrypt(new Uint8Array(n),r.key.buffer,r.iv.buffer,qt(r.method)).catch((function(e){throw a.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:i}),e})).then((function(e){var t=performance.now();a.trigger(c.FRAG_DECRYPTED,{frag:i,payload:e,stats:{tstart:s,tdecrypt:t}})})).catch((function(e){var i;t.warn(Hy(i="".concat(e.name,": ")).call(i,e.message)),t.state=ji}))}}},{key:"doTick",value:function(){if(this.media){if(this.state===ji){var e=this.currentTrackId,t=this.levels,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;if(this.waitForLive(i))return;var n=this.config,r=this.getLoadPosition(),a=Mt.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,n.maxBufferHole),s=a.end,o=a.len,l=i.details;if(o>this.hls.maxBufferLength+l.levelTargetDuration)return;var u=l.fragments,c=u.length,h=l.edge,d=null,f=this.fragPrevious;if(s<h){var v=n.maxFragLookUpTolerance,g=s>h-v?0:v;!(d=he(f,u,Math.max(u[0].start,s),g))&&f&&f.start<u[0].start&&(d=u[0])}else d=u[c-1];if(!d)return;if(Ze(d=this.mapToInitFragWhenRequired(d))){var p=u[d.sn-l.startSN-1];p&&p.cc===d.cc&&this.fragmentTracker.getState(p)===be&&(d=p)}this.fragmentTracker.getState(d)===be&&this.loadFragment(d,i,s)}}else this.state=ji}},{key:"loadFragment",value:function(e,t,n){Ze(e)?ev(Jf(i.prototype),"loadFragment",this).call(this,e,t,n):this._loadInitSegment(e,t)}},{key:"mediaBufferTimeRanges",get:function(){return new qa(this.tracksBuffered[this.currentTrackId]||[])}}]),i}(nn),qa=ey((function e(t){Zm(this,e),this.buffered=void 0;var i=function(e,i,n){var r,a;if((i>>>=0)>n-1)throw new DOMException(Hy(r=Hy(a="Failed to execute '".concat(e,"' on 'TimeRanges': The index provided (")).call(a,i,") is greater than the maximum bound (")).call(r,n,")"));return t[i][e]};this.buffered={get length(){return t.length},end:function(e){return i("end",e,t.length)},start:function(e){return i("start",e,t.length)}}})),Xa={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},Qa=function(e){return String.fromCharCode(Xa[e]||e)},$a=15,Za=100,Ja={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},es={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ts={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},is={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ns=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],rs=function(){function e(){Zm(this,e),this.time=null,this.verboseLevel=0}return ey(e,[{key:"log",value:function(e,t){if(this.verboseLevel>=e){var i,n,r="function"==typeof t?t():t;I.log(Hy(i=Hy(n="".concat(this.time," [")).call(n,e,"] ")).call(i,r))}}}]),e}(),as=function(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i].toString(16));return t},ss=function(){function e(){Zm(this,e),this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}return ey(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"],i=0;i<t.length;i++){var n=t[i];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}(),os=function(){function e(){Zm(this,e),this.uchar=" ",this.penState=new ss}return ey(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}(),ls=function(){function e(t){Zm(this,e),this.chars=[],this.pos=0,this.currPenState=new ss,this.cueStartTime=null,this.logger=void 0;for(var i=0;i<Za;i++)this.chars.push(new os);this.logger=t}return ey(e,[{key:"equals",value:function(e){for(var t=0;t<Za;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}},{key:"copy",value:function(e){for(var t=0;t<Za;t++)this.chars[t].copy(e.chars[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<Za;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>Za&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Za)}},{key:"moveCursor",value:function(e){var t=this.pos+e;if(e>1)for(var i=this.pos+1;i<t+1;i++)this.chars[i].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 i=Qa(e);this.pos>=Za?this.logger.log(0,(function(){return"Cannot insert "+e.toString(16)+" ("+i+") at position "+t.pos+". Skipping it!"})):(this.chars[this.pos].setChar(i,this.currPenState),this.moveCursor(1))}},{key:"clearFromPos",value:function(e){var t;for(t=e;t<Za;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,i=0;i<Za;i++){var n=this.chars[i].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}(),us=function(){function e(t){Zm(this,e),this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var i=0;i<$a;i++)this.rows.push(new ls(t));this.logger=t}return ey(e,[{key:"reset",value:function(){for(var e=0;e<$a;e++)this.rows[e].clear();this.currRow=14}},{key:"equals",value:function(e){for(var t=!0,i=0;i<$a;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}},{key:"copy",value:function(e){for(var t=0;t<$a;t++)this.rows[t].copy(e.rows[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<$a;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 = "+bI(e)}));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var i=0;i<$a;i++)this.rows[i].clear();var n=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){var a=r.rows[n].cueStartTime,s=this.logger.time;if(null!==a&&null!==s&&a<s)for(var o=0;o<this.nrRollUpRows;o++)this.rows[t-this.nrRollUpRows+o+1].copy(r.rows[n+o])}}this.currRow=t;var l=this.rows[this.currRow];if(null!==e.indent){var u=e.indent,c=Math.max(u-1,0);l.setCursor(e.indent),e.color=l.chars[c].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 = "+bI(e)})),this.backSpace(),this.setPen(e),this.insertChar(32)}},{key:"setRollUpRows",value:function(e){this.nrRollUpRows=e}},{key:"rollUp",value:function(){var e,t,i=this;if(null!==this.nrRollUpRows){this.logger.log(1,(function(){return i.getDisplayText()}));var n=this.currRow+1-this.nrRollUpRows,r=mw(e=this.rows).call(e,n,1)[0];r.clear(),mw(t=this.rows).call(t,this.currRow,0,r),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=[],i="",n=-1,r=0;r<$a;r++){var a=this.rows[r].getTextString();a&&(n=r+1,e?t.push("Row "+n+": '"+a+"'"):t.push(WI(a).call(a)))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}},{key:"getTextAndFormat",value:function(){return this.rows}}]),e}(),cs=function(){function e(t,i,n){Zm(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=i,this.mode=null,this.verbose=0,this.displayedMemory=new us(n),this.nonDisplayedMemory=new us(n),this.lastOutputScreen=new us(n),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}return ey(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,i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);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 i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+bI(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}(),hs=function(){function e(t,i,n){Zm(this,e),this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;var r=this.logger=new rs;this.channels=[null,new cs(t,i,r),new cs(t+1,n,r)]}return ey(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 i=this;this.logger.time=e;for(var n=function(e){var n=127&t[e],r=127&t[e+1],a=!1,s=null;if(0===n&&0===r)return"continue";i.logger.log(3,(function(){return"["+as([t[e],t[e+1]])+"] -> ("+as([n,r])+")"}));var o=i.cmdHistory;if(n>=16&&n<=31){if(fs(n,r,o))return ds(null,null,o),i.logger.log(3,(function(){return"Repeated command ("+as([n,r])+") is dropped"})),"continue";ds(n,r,i.cmdHistory),(a=i.parseCmd(n,r))||(a=i.parseMidrow(n,r)),a||(a=i.parsePAC(n,r)),a||(a=i.parseBackgroundAttributes(n,r))}else ds(null,null,o);if(!a&&(s=i.parseChars(n,r))){var l=i.currentChannel;l&&l>0?i.channels[l].insertChars(s):i.logger.log(2,"No channel found yet. TEXT-MODE?")}a||s||i.logger.log(2,(function(){return"Couldn't parse cleaned data "+as([n,r])+" orig: "+as([t[e],t[e+1]])}))},r=0;r<t.length;r+=2)n(r)}},{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 i=20===e||21===e||23===e?1:2,n=this.channels[i];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=i,!0}},{key:"parseMidrow",value:function(e,t){var i=0;if((17===e||25===e)&&t>=32&&t<=47){if((i=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var n=this.channels[i];return!!n&&(n.ccMIDROW(t),this.logger.log(3,(function(){return"MIDROW ("+as([e,t])+")"})),!0)}return!1}},{key:"parsePAC",value:function(e,t){var i;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;i=t>=64&&t<=95?1===n?Ja[e]:ts[e]:1===n?es[e]:is[e];var r=this.channels[n];return!!r&&(r.setPAC(this.interpretPAC(i,t)),this.currentChannel=n,!0)}},{key:"interpretPAC",value:function(e,t){var i,n={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,n.underline=!(1&~i),i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((i-16)/2),n}},{key:"parseChars",value:function(e,t){var i,n,r=null,a=null;return e>=25?(i=2,a=e-8):(i=1,a=e),a>=17&&a<=19?(n=17===a?t+80:18===a?t+112:t+144,this.logger.log(2,(function(){return"Special char '"+Qa(n)+"' in channel "+i})),r=[n]):e>=32&&e<=127&&(r=0===t?[e]:[e,t]),r&&this.logger.log(3,(function(){return"Char codes = "+as(r).join(",")})),r}},{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 i,n={};16===e||24===e?(i=Math.floor((t-32)/2),n.background=ns[i],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0));var r=e<=23?1:2;return this.channels[r].setBkgData(n),!0}},{key:"reset",value:function(){for(var e=0;e<Cy(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}ds(null,null,this.cmdHistory)}},{key:"cueSplitAtTime",value:function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}}}]),e}();function ds(e,t,i){i.a=e,i.b=t}function fs(e,t,i){return i.a===e&&i.b===t}var vs=function(){if(null!=Zt&&Zt.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t)return!1;if(!kw(e))return!1;var i=t.toLowerCase();return!!~zy(e).call(e,i)&&i}function n(e){return i(t,e)}function r(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r=1;r<arguments.length;r++){var a=arguments[r];for(var s in a)e[s]=a[s]}return e}function a(t,a,s){var o=this,l={enumerable:!0};o.hasBeenReset=!1;var u="",c=!1,h=t,d=a,f=s,v=null,g="",p=!0,m="auto",y="start",k=50,T="middle",E=50,S="middle";dy(o,"id",r({},l,{get:function(){return u},set:function(e){u=""+e}})),dy(o,"pauseOnExit",r({},l,{get:function(){return c},set:function(e){c=!!e}})),dy(o,"startTime",r({},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}})),dy(o,"endTime",r({},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}})),dy(o,"text",r({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),dy(o,"region",r({},l,{get:function(){return v},set:function(e){v=e,this.hasBeenReset=!0}})),dy(o,"vertical",r({},l,{get:function(){return g},set:function(t){var n=i(e,t);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");g=n,this.hasBeenReset=!0}})),dy(o,"snapToLines",r({},l,{get:function(){return p},set:function(e){p=!!e,this.hasBeenReset=!0}})),dy(o,"line",r({},l,{get:function(){return m},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");m=e,this.hasBeenReset=!0}})),dy(o,"lineAlign",r({},l,{get:function(){return y},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),dy(o,"position",r({},l,{get:function(){return k},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");k=e,this.hasBeenReset=!0}})),dy(o,"positionAlign",r({},l,{get:function(){return T},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");T=t,this.hasBeenReset=!0}})),dy(o,"size",r({},l,{get:function(){return E},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),dy(o,"align",r({},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}})),o.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}(),gs=function(){function e(){Zm(this,e)}return ey(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 ps(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+Tb(n||0)}var i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?Tb(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}var ms=function(){function e(){Zm(this,e),this.values=MI(null)}return ey(e,[{key:"set",value:function(e,t){this.get(e)||""===t||(aO(this)[e]=t)}},{key:"get",value:function(e,t,i){return i?this.has(e)?aO(this)[e]:t[i]:this.has(e)?aO(this)[e]:t}},{key:"has",value:function(e){return e in aO(this)}},{key:"alt",value:function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}}},{key:"integer",value:function(e,t){/^-?\d+$/.test(t)&&this.set(e,Zk(t,10))}},{key:"percent",value:function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var i=Tb(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}]),e}();function ys(e,t,i,n){var r=n?e.split(n):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(i);2===s.length&&t(s[0],s[1])}}var ks=new vs(0,0,""),Ts="middle"===ks.align?"middle":"center";function Es(e,t,i){var n=e;function r(){var t=ps(e);if(null===t)throw new Error("Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==iI(e).call(e,0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=iI(e).call(e,3),a(),t.endTime=r(),a(),function(e,t){var n=new ms;ys(e,(function(e,t){var r;switch(e){case"region":for(var a=i.length-1;a>=0;a--)if(i[a].id===t){n.set(e,i[a].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),n.integer(e,r[0]),n.percent(e,r[0])&&n.set("snapToLines",!1),n.alt(e,r[0],["auto"]),2===r.length&&n.alt("lineAlign",r[1],["start",Ts,"end"]);break;case"position":r=t.split(","),n.percent(e,r[0]),2===r.length&&n.alt("positionAlign",r[1],["start",Ts,"end","line-left","line-right","auto"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start",Ts,"end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");var r=n.get("line","auto");"auto"===r&&-1===ks.line&&(r=-1),t.line=r,t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align",Ts);var a=n.get("position","auto");"auto"===a&&50===ks.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function Ss(e){return e.replace(/<br(?: \/)?>/gi,"\n")}var _s=function(){function e(){Zm(this,e),this.state="INITIAL",this.buffer="",this.decoder=new gs,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}return ey(e,[{key:"parse",value:function(e){var t=this;function i(){var e=t.buffer,i=0;for(e=Ss(e);i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var n=iI(e).call(e,0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=iI(e).call(e,i),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 r=(n=i()).match(/^()?WEBVTT([ \t].*)?$/);if(null==r||!r[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var a=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:n=i(),t.state){case"HEADER":/:/.test(n)?ys(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 vs(0,0,""),t.state="CUE",-1===zy(n).call(n,"--\x3e")){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{Es(n,t.cue,t.regionList)}catch(o){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var s=-1!==zy(n).call(n,"--\x3e");if(!n||s&&(a=!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(o){"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}(),bs=/\r\n|\n\r|\n|\r/g,As=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return iI(e).call(e,i,i+t.length)===t};function Rs(e,t,i){return Oa(e.toString())+Oa(t.toString())+Oa(i)}function Ls(e,t,i,n,r,s,o){var l,u,c=new _s,h=WI(l=Fe(new Uint8Array(e))).call(l).replace(bs,"\n").split("\n"),d=[],f=t?function(e){return dr(e,9e4,1/(arguments.length>1&&void 0!==arguments[1]?arguments[1]:1))}(t.baseTime,t.timescale):0,v="00:00.000",g=0,p=0,m=!0;c.oncue=function(e){var a,s=i[n],o=i.ccOffset,l=(g-f)/9e4;if(null!=s&&s.new&&(void 0!==p?o=i.ccOffset=s.start:function(e,t,i){var n=e[t],r=e[n.prevCC];if(!r||!r.new&&n.new)return e.ccOffset=e.presentationOffset=n.start,void(n.new=!1);for(;null!=(a=r)&&a.new;){var a;e.ccOffset+=n.start-r.start,n.new=!1,r=e[(n=r).prevCC]}e.presentationOffset=i}(i,n,l)),l){if(!t)return void(u=new Error("Missing initPTS for VTT MPEGTS"));o=l-i.presentationOffset}var c=e.endTime-e.startTime,h=yr(9e4*(e.startTime+o-p),9e4*r)/9e4;e.startTime=Math.max(h,0),e.endTime=Math.max(h+c,0);var v=WI(a=e.text).call(a);e.text=decodeURIComponent(encodeURIComponent(v)),e.id||(e.id=Rs(e.startTime,e.endTime,v)),e.endTime>0&&d.push(e)},c.onparsingerror=function(e){u=e},c.onflush=function(){u?o(u):s(d)},Py(h).call(h,(function(e){if(m){if(As(e,"X-TIMESTAMP-MAP=")){var t;m=!1,Py(t=iI(e).call(e,16).split(",")).call(t,(function(e){As(e,"LOCAL:")?v=iI(e).call(e,6):As(e,"MPEGTS:")&&(g=Zk(iI(e).call(e,7)))}));try{p=function(e){var t=Zk(iI(e).call(e,-3)),i=Zk(iI(e).call(e,-6,-4)),n=Zk(iI(e).call(e,-9,-7)),r=e.length>9?Zk(e.substring(0,zy(e).call(e,":"))):0;if(!(a(t)&&a(i)&&a(n)&&a(r)))throw Error("Malformed X-TIMESTAMP-MAP: Local:".concat(e));return t+=1e3*i,t+=6e4*n,t+=36e5*r}(v)/1e3}catch(i){u=i}return}""===e&&(m=!1)}c.parse(e+"\n")})),c.flush()}var Is="stpp.ttml.im1t",Cs=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,ws=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Ds={left:"start",center:"center",right:"end",start:"start",end:"end"};function xs(e,t,i,n){var r=ct(new Uint8Array(e),["mdat"]);if(0!==r.length){var a=ub(r).call(r,(function(e){return Fe(e)})),s=function(e,t){return dr(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{Py(a).call(a,(function(e){return i(function(e,t,i,n){var r=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");var a={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=ok(i=Cy(a)).call(i,(function(e,t){return e[t]=r.getAttribute("ttp:".concat(t))||a[t],e}),{}),o="preserve"!==r.getAttribute("xml:space"),l=Os(Ps(r,"styling","style")),u=Os(Ps(r,"layout","region")),c=Ps(r,"body","[begin]");return Dy(n=ub([]).call(c,(function(e){var i=Ms(e,o);if(!i||!e.hasAttribute("begin"))return null;var n=Us(e.getAttribute("begin"),s),r=Us(e.getAttribute("dur"),s),a=Us(e.getAttribute("end"),s);if(null===n)throw Fs(e);if(null===a){if(null===r)throw Fs(e);a=n+r}var c=new vs(n-t,a-t,i);c.id=Rs(c.startTime,c.endTime,c.text);var h,d,f,v,g,p,m,y=(h=u[e.getAttribute("region")],d=l[e.getAttribute("style")],f=l,v="http://www.w3.org/ns/ttml#styling",g=null,p=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],(m=null!=h&&h.hasAttribute("style")?h.getAttribute("style"):null)&&f.hasOwnProperty(m)&&(g=f[m]),ok(p).call(p,(function(e,t){var i=Ns(d,v,t)||Ns(h,v,t)||Ns(g,v,t);return i&&(e[t]=i),e}),{})),T=y.textAlign;if(T){var E=Ds[T];E&&(c.lineAlign=E),c.align=T}return k(c,y),c}))).call(n,(function(e){return null!==e}))}(e,s))}))}catch(o){n(o)}}else n(new Error("Could not parse IMSC1 mdat"))}function Ps(e,t,i){var n=e.getElementsByTagName(t)[0];return n?iI([]).call(n.querySelectorAll(i)):[]}function Os(e){return ok(e).call(e,(function(e,t){var i=t.getAttribute("xml:id");return i&&(e[i]=t),e}),{})}function Ms(e,t){var i;return ok(i=iI([]).call(e.childNodes)).call(i,(function(e,i,n){var r,a;return"br"===i.nodeName&&n?e+"\n":null!=(a=i.childNodes)&&a.length?Ms(i,t):t?e+WI(r=i.textContent).call(r).replace(/\s+/g," "):e+i.textContent}),"")}function Ns(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function Fs(e){return new Error("Could not parse ttml timestamp ".concat(e))}function Us(e,t){if(!e)return null;var i,n,r,a,s=ps(e);return null===s&&(Cs.test(e)?(i=e,n=t,r=Cs.exec(i),a=(0|r[4])+(0|r[5])/n.subFrameRate,s=3600*(0|r[1])+60*(0|r[2])+(0|r[3])+a/n.frameRate):ws.test(e)&&(s=function(e,t){var i=ws.exec(e),n=Number(i[1]);switch(i[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 Bs=function(){function e(t,i){Zm(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=i}return ey(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,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}},{key:"reset",value:function(){this.cueRanges=[],this.startTime=null}}]),e}(),Hs=function(){function e(t){Zm(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(c.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(c.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(c.MANIFEST_LOADING,this.onManifestLoading,this),t.on(c.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(c.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(c.FRAG_LOADING,this.onFragLoading,this),t.on(c.FRAG_LOADED,this.onFragLoaded,this),t.on(c.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(c.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(c.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(c.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(c.BUFFER_FLUSHING,this.onBufferFlushing,this)}return ey(e,[{key:"destroy",value:function(){var e=this.hls;e.off(c.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(c.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(c.FRAG_LOADING,this.onFragLoading,this),e.off(c.FRAG_LOADED,this.onFragLoaded,this),e.off(c.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(c.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(c.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(c.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(c.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 Bs(this,"textTrack1"),t=new Bs(this,"textTrack2"),i=new Bs(this,"textTrack3"),n=new Bs(this,"textTrack4");this.cea608Parser1=new hs(1,e,t),this.cea608Parser2=new hs(3,i,n)}},{key:"addCues",value:function(e,t,i,n,r){for(var a,s,o,l,u=!1,h=r.length;h--;){var d=r[h],f=(a=d[0],s=d[1],o=t,l=i,Math.min(s,l)-Math.max(a,o));if(f>=0&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],i),u=!0,f/(i-t)>.5))return}if(u||r.push([t,i]),this.config.renderTextTracksNatively){var v=this.captionsTracks[e];this.Cues.newCue(v,t,i,n)}else{var g=this.Cues.newCue(null,t,i,n);this.hls.trigger(c.CUES_PARSED,{type:"captions",cues:g,track:e})}}},{key:"onInitPtsFound",value:function(e,t){var i=this,n=t.frag,r=t.id,a=t.initPTS,s=t.timescale,o=this.unparsedVttFrags;r===g.MAIN&&(this.initPTS[n.cc]={baseTime:a,timescale:s}),o.length&&(this.unparsedVttFrags=[],Py(o).call(o,(function(e){i.onFragLoaded(c.FRAG_LOADED,e)})))}},{key:"getExistingTrack",value:function(e,t){var i=this.media;if(i)for(var n=0;n<i.textTracks.length;n++){var r=i.textTracks[n];if(Vs(r,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound",attrs:{}}))return r}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,i=this.captionsTracks,n=this.media,r=t[e],a=r.label,s=r.languageCode,o=this.getExistingTrack(a,s);if(o)i[e]=o,wa(i[e]),Ia(i[e],n);else{var l=this.createTextTrack("captions",a,s);l&&(l[e]=!0,i[e]=l)}}}},{key:"createNonNativeTrack",value:function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var i={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(c.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}}}},{key:"createTextTrack",value:function(e,t,i){var n=this.media;if(n)return n.addTextTrack(e,t,i)}},{key:"onMediaAttaching",value:function(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}},{key:"onMediaDetaching",value:function(e,t){var i,n=!!t.transferMedia;if(this.media=null,!n){var r=this.captionsTracks;Py(i=Cy(r)).call(i,(function(e){wa(r[e]),delete r[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 i=0;i<t.length;i++)wa(t[i])}}},{key:"onSubtitleTracksUpdated",value:function(e,t){var i=this,n=t.subtitleTracks||[],r=Yy(n).call(n,(function(e){return e.textCodec===Is}));if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(xr(this.tracks,n))return void(this.tracks=n);if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){var a,s=this.media,o=s?xa(s.textTracks):null;if(Py(a=this.tracks).call(a,(function(e,t){var n;if(o){for(var r=null,a=0;a<o.length;a++)if(o[a]&&Vs(o[a],e)){r=o[a],o[a]=null;break}r&&(n=r)}if(n)wa(n);else{var s=Gs(e);(n=i.createTextTrack(s,e.name,e.lang))&&(n.mode="disabled")}n&&i.textTracks.push(n)})),null!=o&&o.length){var l,u=ub(l=Dy(o).call(o,(function(e){return null!==e}))).call(l,(function(e){return e.label}));u.length&&this.hls.logger.warn("Media element contains unused subtitle tracks: ".concat(u.join(", "),". Replace media element for each source to clear TextTracks and captions menu."))}}else if(this.tracks.length){var h,d=ub(h=this.tracks).call(h,(function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}));this.hls.trigger(c.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:d})}}}},{key:"onManifestLoaded",value:function(e,t){var i,n=this;this.config.enableCEA708Captions&&t.captions&&Py(i=t.captions).call(i,(function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(t){var i="textTrack".concat(t[1]),r=n.captionsProperties[i];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.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===g.MAIN){var i,n,r=this.cea608Parser1,a=this.cea608Parser2,s=this.lastSn,o=t.frag,l=o.cc,u=o.sn,c=null!=(i=null==(n=t.part)?void 0:n.index)?i:-1;r&&a&&(u!==s+1||u===s&&c!==this.lastPartIndex+1||l!==this.lastCc)&&(r.reset(),a.reset()),this.lastCc=l,this.lastSn=u,this.lastPartIndex=c}}},{key:"onFragLoaded",value:function(e,t){var i=t.frag,n=t.payload;if(i.type===g.SUBTITLE)if(n.byteLength){var r=i.decryptdata,a="stats"in t;if(null==r||!r.encrypted||a){var s=this.tracks[i.level],o=this.vttCCs;o[i.cc]||(o[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),s&&s.textCodec===Is?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger(c.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}},{key:"_parseIMSC1",value:function(e,t){var i=this,n=this.hls;xs(t,this.initPTS[e.cc],(function(t){i._appendCues(t,e.level),n.trigger(c.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){n.logger.log("Failed to parse IMSC1: ".concat(t)),n.trigger(c.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}},{key:"_parseVTTs",value:function(e){var t,i=this,n=e.frag,r=e.payload,a=this.initPTS,s=this.unparsedVttFrags,o=a.length-1;if(a[n.cc]||-1!==o){var l=this.hls;Ls(null!=(t=n.initSegment)&&t.data?kt(n.initSegment.data,new Uint8Array(r)).buffer:r,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,(function(e){i._appendCues(e,n.level),l.trigger(c.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})}),(function(t){var a="Missing initPTS for VTT MPEGTS"===t.message;a?s.push(e):i._fallbackToIMSC1(n,r),l.logger.log("Failed to parse VTT cue: ".concat(t)),a&&o>n.cc||l.trigger(c.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:t})}))}else s.push(e)}},{key:"_fallbackToIMSC1",value:function(e,t){var i=this,n=this.tracks[e.level];n.textCodec||xs(t,this.initPTS[e.cc],(function(){n.textCodec=Is,i._parseIMSC1(e,t)}),(function(){n.textCodec="wvtt"}))}},{key:"_appendCues",value:function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var n=this.textTracks[t];if(!n||"disabled"===n.mode)return;Py(e).call(e,(function(e){return Ca(n,e)}))}else{var r=this.tracks[t];if(!r)return;var a=r.default?"default":"subtitles"+t;i.trigger(c.CUES_PARSED,{type:"subtitles",cues:e,track:a})}}},{key:"onFragDecrypted",value:function(e,t){t.frag.type===g.SUBTITLE&&this.onFragLoaded(c.FRAG_LOADED,t)}},{key:"onSubtitleTracksCleared",value:function(){this.tracks=[],this.captionsTracks={}}},{key:"onFragParsingUserdata",value:function(e,t){if(this.enabled&&this.config.enableCEA708Captions){var i=t.frag,n=t.samples;if(i.type!==g.MAIN||"NONE"!==this.closedCaptionsForLevel(i))for(var r=0;r<n.length;r++){var a=n[r].bytes;if(a){this.cea608Parser1||this.initCea608Parsers();var s=this.extractCea608Data(a);this.cea608Parser1.addData(n[r].pts,s[0]),this.cea608Parser2.addData(n[r].pts,s[1])}}}}},{key:"onBufferFlushing",value:function(e,t){var i=t.startOffset,n=t.endOffset,r=t.endOffsetSubtitles,a=t.type,s=this.media;if(s&&!(s.currentTime<n)){if(!a||"video"===a){var o,l=this.captionsTracks;Py(o=Cy(l)).call(o,(function(e){return Da(l[e],i,n)}))}if(this.config.renderTextTracksNatively&&0===i&&void 0!==r){var u,c=this.textTracks;Py(u=Cy(c)).call(u,(function(e){return Da(c[e],i,r)}))}}}},{key:"extractCea608Data",value:function(e){for(var t=[[],[]],i=31&e[0],n=2,r=0;r<i;r++){var a=e[n++],s=127&e[n++],o=127&e[n++];if((0!==s||0!==o)&&4&a){var l=3&a;0!==l&&1!==l||(t[l].push(s),t[l].push(o))}}return t}}]),e}();function Gs(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function Vs(e,t){return!!e&&e.kind===Gs(t)&&Or(t,e)}var Ks=/\s/,Ws={newCue:function(e,t,i,n){for(var r,a,s,o,l,u=[],c=self.VTTCue||self.TextTrackCue,h=0;h<n.rows.length;h++)if(s=!0,o=0,l="",!(r=n.rows[h]).isEmpty()){for(var d,f=0;f<r.chars.length;f++)Ks.test(r.chars[f].uchar)&&s?o++:(l+=r.chars[f].uchar,s=!1);r.cueStartTime=t,t===i&&(i+=1e-4),o>=16?o--:o++;var v=Ss(WI(l).call(l)),g=Rs(t,i,v);null!=e&&null!=(d=e.cues)&&d.getCueById(g)||((a=new c(t,i,v)).id=g,a.line=h+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*o/32)),u.push(a))}return e&&u.length&&(XC(u).call(u,(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})),Py(u).call(u,(function(t){return Ca(e,t)}))),u}};function js(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(r){}return!1}var Ys=/(\d+)-(\d+)\/(\d+)/,zs=function(){function e(t){Zm(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||qs,this.controller=new self.AbortController,this.stats=new ze}return ey(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,i){var n=this,r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();var s,o,l,u=(s=e,o=this.controller.signal,l={method:"GET",mode:"cors",credentials:"same-origin",signal:o,headers:new self.Headers(k({},s.headers))},s.rangeEnd&&l.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),l),c=i.onProgress,h="arraybuffer"===e.responseType,d=h?"byteLength":"length",f=t.loadPolicy,v=f.maxTimeToFirstByteMs,g=f.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,u),self.clearTimeout(this.requestTimeout),t.timeout=v&&a(v)?v:g,this.requestTimeout=gC((function(){n.abortInternal(),i.onTimeout(r,e,n.response)}),t.timeout),(Lr(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then((function(s){n.response=n.loader=s;var o=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(n.requestTimeout),t.timeout=g,n.requestTimeout=gC((function(){n.abortInternal(),i.onTimeout(r,e,n.response)}),g-(o-r.loading.start)),!s.ok){var l=s.status,u=s.statusText;throw new Xs(u||"fetch, bad network response",l,s)}return r.loading.first=o,r.total=function(e){var t=e.get("Content-Range");if(t){var i=function(e){var t=Ys.exec(e);if(t)return Zk(t[2])-Zk(t[1])+1}(t);if(a(i))return i}var n=e.get("Content-Length");if(n)return Zk(n)}(s.headers)||r.total,c&&a(t.highWaterMark)?n.loadProgressively(s,r,e,t.highWaterMark,c):h?s.arrayBuffer():"json"===e.responseType?s.json():s.text()})).then((function(s){var o=n.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(n.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);var l=s[d];l&&(r.loaded=r.total=l);var u={url:o.url,data:s,code:o.status};c&&!a(t.highWaterMark)&&c(r,e,s,o),i.onSuccess(u,r,e,o)})).catch((function(t){if(self.clearTimeout(n.requestTimeout),!r.aborted){var a=t&&t.code||0,s=t?t.message:null;i.onError({code:a,text:s},e,t?t.details:null,r)}}))}},{key:"getCacheAge",value:function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?Tb(t):null}return e}},{key:"getResponseHeader",value:function(e){return this.response?this.response.headers.get(e):null}},{key:"loadProgressively",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4?arguments[4]:void 0,a=new rn,s=e.body.getReader();return function o(){return s.read().then((function(s){if(s.done)return a.dataLength&&r(t,i,a.flush().buffer,e),nb.resolve(new ArrayBuffer(0));var l=s.value,u=l.length;return t.loaded+=u,u<n||a.dataLength?(a.push(l),a.dataLength>=n&&r(t,i,a.flush().buffer,e)):r(t,i,l.buffer,e),o()})).catch((function(){return nb.reject()}))}()}}]),e}();function qs(e,t){return new self.Request(e.url,t)}var Xs=function(e){Qm(i,e);var t=$m(i);function i(e,n,r){var a;return Zm(this,i),(a=t.call(this,e)).code=void 0,a.details=void 0,a.code=n,a.details=r,a}return ey(i)}(qm(Error)),Qs=/^age:\s*[\d.]+\s*$/im,$s=function(){function e(t){Zm(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 ze,this.retryDelay=0}return ey(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,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}},{key:"loadInternal",value:function(){var e=this,t=this.config,i=this.context;if(t&&i){var n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;var a=this.xhrSetup;a?nb.resolve().then((function(){if(e.loader===n&&!e.stats.aborted)return a(n,i.url)})).catch((function(t){if(e.loader===n&&!e.stats.aborted)return n.open("GET",i.url,!0),a(n,i.url)})).then((function(){e.loader!==n||e.stats.aborted||e.openAndSendXhr(n,i,t)})).catch((function(t){e.callbacks.onError({code:n.status,text:t.message},i,n,r)})):this.openAndSendXhr(n,i,t)}}},{key:"openAndSendXhr",value:function(e,t,i){var n,r,s;e.readyState||e.open("GET",t.url,!0);var o=t.headers,l=i.loadPolicy,u=l.maxTimeToFirstByteMs,c=l.maxLoadTimeMs;if(o)for(var h in o)e.setRequestHeader(h,o[h]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=Iy(n=this.readystatechange).call(n,this),e.onprogress=Iy(r=this.loadprogress).call(r,this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=u&&a(u)?u:c,this.requestTimeout=gC(Iy(s=this.loadtimeout).call(s,this),i.timeout),e.send()}},{key:"readystatechange",value:function(){var e,t=this.context,i=this.loader,n=this.stats;if(t&&i){var r=i.readyState,a=this.config;if(!n.aborted&&r>=2&&(0===n.loading.first&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),a.timeout!==a.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),a.timeout=a.loadPolicy.maxLoadTimeMs,this.requestTimeout=gC(Iy(e=this.loadtimeout).call(e,this),a.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),4===r)){var s;self.clearTimeout(this.requestTimeout),i.onreadystatechange=null,i.onprogress=null;var o=i.status,l="text"===i.responseType?i.responseText:null;if(o>=200&&o<300){var u=null!=l?l:i.response;if(null!=u){n.loading.end=Math.max(self.performance.now(),n.loading.first);var c="arraybuffer"===i.responseType?u.byteLength:u.length;if(n.loaded=n.total=c,n.bwEstimate=8e3*n.total/(n.loading.end-n.loading.first),!this.callbacks)return;var h=this.callbacks.onProgress;if(h&&h(n,t,u,i),!this.callbacks)return;var d={url:i.responseURL,data:u,code:o};return void this.callbacks.onSuccess(d,n,t,i)}}var f=a.loadPolicy.errorRetry;ke(f,n.retry,!1,{url:t.url,data:void 0,code:o})?this.retry(f):(I.error(Hy(s="".concat(o," while loading ")).call(s,t.url)),this.callbacks.onError({code:o,text:i.statusText},t,i,n))}}}},{key:"loadtimeout",value:function(){if(this.config){var e=this.config.loadPolicy.timeoutRetry;if(ke(e,this.stats.retry,!0))this.retry(e);else{var t;I.warn("timeout while loading ".concat(null==(t=this.context)?void 0:t.url));var i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}}},{key:"retry",value:function(e){var t,i,n,r,a,s=this.context,o=this.stats;this.retryDelay=me(e,o.retry),o.retry++,I.warn(Hy(t=Hy(i=Hy(n=Hy(r="".concat(status?"HTTP Status "+status:"Timeout"," while loading ")).call(r,null==s?void 0:s.url,", retrying ")).call(n,o.retry,"/")).call(i,e.maxNumRetry," in ")).call(t,this.retryDelay,"ms")),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=gC(Iy(a=this.loadInternal).call(a,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&&Qs.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?Tb(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}(),Zs=E(E({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:$s,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:ue,bufferController:Vr,capLevelController:jr,errorController:Se,fpsController:La,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:ci,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:Ws,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:za,subtitleTrackController:Pa,timelineController:Hs,audioStreamController:Mr,audioTrackController:Fr,emeController:Aa,cmcdController:Ea,contentSteeringController:Sa,interstitialsController:function(e){Qm(i,e);var t=$m(i);function i(e,n){var r;return Zm(this,i),(r=t.call(this,"interstitials",e.logger)).HlsPlayerClass=void 0,r.hls=void 0,r.assetListLoader=void 0,r.mediaSelection=null,r.altSelection=null,r.media=null,r.detachedData=null,r.requiredTracks=null,r.manager=null,r.playerQueue=[],r.bufferedPos=-1,r.timelinePos=-1,r.schedule=void 0,r.playingItem=null,r.bufferingItem=null,r.waitingItem=null,r.playingAsset=null,r.bufferingAsset=null,r.shouldPlay=!1,r.onPlay=function(){r.shouldPlay=!0},r.onPause=function(){r.shouldPlay=!1},r.onSeeking=function(){var e=r.currentTime;if(void 0!==e&&!r.playbackDisabled){var t=e-r.timelinePos;if(!(Math.abs(t)<1/7056e5)){var i=t<=-.01;r.timelinePos=e,r.bufferedPos=e,r.checkBuffer();var n=r.playingItem;if(n)if(i&&e<n.start||e>=n.end){var a,s=r.schedule.findItemIndexAtTime(r.timelinePos);if(!r.isInterstitial(n)&&null!=(a=r.media)&&a.paused&&(r.shouldPlay=!1),!i){var o=r.findItemIndex(n);if(s>o){var l=r.schedule.findJumpRestrictedIndex(o+1,s);if(l>o)return void r.setSchedulePosition(l)}}r.setSchedulePosition(s)}else{var u=r.playingAsset;if(u){var c=u.timelineStart,h=u.duration||0;(i&&e<c||e>=c+h)&&r.setScheduleToAssetAtTime(e,u)}else if(r.playingLastItem&&r.isInterstitial(n)){var d=n.event.assetList[0];d&&(r.playingItem=null,r.setScheduleToAssetAtTime(e,d))}}}}},r.onTimeupdate=function(){var e=r.currentTime;if(void 0!==e&&!r.playbackDisabled&&e>r.timelinePos){e>r.bufferedPos&&r.checkBuffer(),r.timelinePos=e;var t=r.playingItem;if(t&&!r.playingLastItem){if(e>=t.end){r.timelinePos=t.end;var i=r.findItemIndex(t);r.setSchedulePosition(i+1)}var n=r.playingAsset;n&&e>=n.timelineStart+(n.duration||0)&&r.setScheduleToAssetAtTime(e,n)}}},r.onScheduleUpdate=function(e,t){var i,n,a,s=r.schedule,o=r.playingItem,l=s.events||[],u=s.items||[],h=s.durations,d=ub(e).call(e,(function(e){return e.identifier})),f=!(!l.length&&!d.length);f&&(!1===r.hls.config.interstitialAppendInPlace&&Py(l).call(l,(function(e){return e.appendInPlace=!1})),r.log(Hy(i=Hy(n="INTERSTITIALS_UPDATED (".concat(l.length,"): ")).call(n,l,"\nSchedule: ")).call(i,ub(u).call(u,(function(e){return Wa(e)}))))),d.length&&r.log("Removed events ".concat(d)),Py(a=r.playerQueue).call(a,(function(e){if(e.interstitial.appendInPlace){var t=e.assetItem.timelineStart,i=e.timelineOffset-t;if(i)try{e.timelineOffset=t}catch(o){var n,a,s;Math.abs(i)>Ma&&r.warn(Hy(n=Hy(a=Hy(s="".concat(o,' ("')).call(s,e.assetId,'" ')).call(a,e.timelineOffset,"->")).call(n,t,")"))}}})),o&&!o.event&&(r.playingItem=r.updateItem(o,r.timelinePos));var v=r.bufferingItem;if(v&&(v.event?r.updateItem(v)||(r.bufferingItem=null,r.clearInterstitial(v.event,null)):r.bufferingItem=r.updateItem(v,r.bufferedPos)),r.waitingItem=r.updateItem(r.waitingItem),Py(e).call(e,(function(e){var t;Py(t=e.assetList).call(t,(function(e){r.clearAssetPlayer(e.identifier,null)}))})),f||t){if(r.hls.trigger(c.INTERSTITIALS_UPDATED,{events:iI(l).call(l,0),schedule:iI(u).call(u,0),durations:h,removedIds:d}),r.isInterstitial(o)&&bP(d).call(d,o.event.identifier))return r.warn('Interstitial "'.concat(o.event.identifier,'" removed while playing')),void r.primaryFallback(o.event);r.checkBuffer()}},r.hls=e,r.HlsPlayerClass=n,r.assetListLoader=new ja(e),r.schedule=new Ka(r.onScheduleUpdate,e.logger),r.registerListeners(),r}return ey(i,[{key:"registerListeners",value:function(){var e=this.hls;e.on(c.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(c.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(c.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(c.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(c.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(c.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(c.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(c.BUFFER_APPENDED,this.onBufferAppended,this),e.on(c.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(c.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(c.MEDIA_ENDED,this.onMediaEnded,this),e.on(c.ERROR,this.onError,this),e.on(c.DESTROYING,this.onDestroying,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(c.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(c.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(c.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(c.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(c.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(c.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(c.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(c.BUFFER_CODECS,this.onBufferCodecs,this),e.off(c.BUFFER_APPENDED,this.onBufferAppended,this),e.off(c.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(c.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(c.MEDIA_ENDED,this.onMediaEnded,this),e.off(c.ERROR,this.onError,this),e.off(c.DESTROYING,this.onDestroying,this))}},{key:"startLoad",value:function(){this.resumeBuffering()}},{key:"stopLoad",value:function(){this.pauseBuffering()}},{key:"resumeBuffering",value:function(){var e;Py(e=this.playerQueue).call(e,(function(e){return e.resumeBuffering()}))}},{key:"pauseBuffering",value:function(){var e;Py(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 i=this.media=t.media;this.removeMediaListeners(i),i.addEventListener("seeking",this.onSeeking),i.addEventListener("timeupdate",this.onTimeupdate),i.addEventListener("play",this.onPlay),i.addEventListener("pause",this.onPause)}},{key:"onMediaAttached",value:function(e,t){var i=this.playingItem,n=this.detachedData;if(this.detachedData=null,null===i)this.checkStart();else if(!n){this.clearScheduleState();var r=this.findItemIndex(i);this.setSchedulePosition(r)}}},{key:"clearScheduleState",value:function(){this.playingItem=this.bufferingItem=this.waitingItem=this.playingAsset=this.bufferingAsset=null}},{key:"onMediaDetaching",value:function(e,t){var i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){var r=this.getBufferingPlayer();r&&(this.playingAsset=null,this.bufferingAsset=null,this.bufferingItem=null,this.waitingItem=null,this.detachedData=null,r.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},i=function(){return e.playingItem||e.waitingItem},n=function(t){return t?e.getAssetPlayer(t.identifier):t},r=function(t,i,r,a,o){if(t){var l=t[i].start,u=t.event;if(u){if("playout"===i||u.timelineOccupancy!==Na.Point){var c=n(r);(null==c?void 0:c.interstitial)===u&&(l+=c.assetItem.startOffset+c[o])}}else l+=("bufferedPos"===a?s():e[a])-t.start;return l}return 0},a=function(t,i){if(0!==t&&"primary"!==i&&e.schedule.length){var n,r=e.schedule.findItemIndexAtTime(t),a=null==(n=e.schedule.items)?void 0:n[r];if(a)return t+(a[i].start-a.start)}return t},s=function(){var t=e.bufferedPos;return t===Number.MAX_VALUE?o("primary"):t},o=function(t){var i;return null!=(i=e.primaryDetails)&&i.live?e.primaryDetails.edge:e.schedule.durations[t]},l=function(t,a){var s,o,l,u=i();if(null==u||null==(o=u.event)||!o.restrictions.skip){e.log(Hy(s="seek to ".concat(t,' "')).call(s,a,'"'));var c=i(),h=e.schedule.findItemIndexAtTime(t,a),d=null==(l=e.schedule.items)?void 0:l[h],f=null==c?void 0:c.event,v=null==f?void 0:f.appendInPlace,g=c&&e.itemsMatch(c,d);if(c&&(v||g)){var p=n(e.playingAsset),m=(null==p?void 0:p.media)||e.hls.media;if(m){var y=t-("primary"===a?m.currentTime:r(c,a,e.playingAsset,"timelinePos","currentTime")),k=m.currentTime+y;if(k>=0&&(!p||v||k<=p.duration))return void(m.currentTime=k)}}if(d){var T=t;if("primary"!==a){var E=t-d[a].start;T=d.start+E}var S=!e.isInterstitial(d);if(e.isInterstitial(c)||!S&&!d.event.appendInPlace){if(c){var _=e.findItemIndex(c);if(h>_){var b=e.schedule.findJumpRestrictedIndex(_+1,h);if(b>_)return void e.setSchedulePosition(b)}var A=0;if(S)e.timelinePos=T;else{var R,L=null==d||null==(R=d.event)?void 0:R.assetList;if(L)for(var I=t-(d[a]||d).start,C=L.length;C--;){var w=L[C];if(w.duration&&I>=w.startOffset&&I<w.startOffset+w.duration){A=C;break}}}e.setSchedulePosition(h,A)}}else{var D=e.hls.media;D&&(D.currentTime=T)}}}};this.manager={get events(){var t,i;return(null==(t=e.schedule)||null==(i=t.events)?void 0:iI(i).call(i,0))||[]},get schedule(){var t,i;return(null==(t=e.schedule)||null==(i=t.items)?void 0:iI(i).call(i,0))||[]},get playerQueue(){var t;return iI(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 i=t();return e.findItemIndex(i)},get playingIndex(){var t=i();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 r(t(),"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(i(),"playout",e.playingAsset,"timelinePos","currentTime")},get duration(){return o("playout")},get seekableStart(){var t;return a((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"playout")},seekTo:function(e){return l(e,"playout")}},integrated:{get bufferedEnd(){return r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(i(),"integrated",e.playingAsset,"timelinePos","currentTime")},get duration(){return o("integrated")},get seekableStart(){var t;return a((null==(t=e.primaryDetails)?void 0:t.fragmentStart)||0,"integrated")},seekTo:function(e){return l(e,"integrated")}},skip:function(){var t=i(),n=null==t?void 0:t.event;if(n&&!n.restrictions.skip){var r=e.findItemIndex(t);if(n.appendInPlace){var a=t.playout.start+t.event.duration;l(a+.001,"playout")}else e.advanceAfterAssetEnded(n,r,1/0)}}}}return this.manager}},{key:"playingLastItem",get:function(){var e,t=this.playingItem;if(!this.playbackStarted||!t)return!1;var i=null==(e=this.schedule)?void 0:e.items;return this.itemsMatch(t,i?i[i.length-1]:null)}},{key:"playbackStarted",get:function(){return null!==this.playingItem}},{key:"currentTime",get:function(){var e,t,i;if(null!==this.mediaSelection){var n=this.waitingItem||this.playingItem;if(!this.isInterstitial(n)||n.event.appendInPlace){var r=this.media;!r&&null!=(e=this.bufferingItem)&&null!=(t=e.event)&&t.appendInPlace&&(r=this.primaryMedia);var s=null==(i=r)?void 0:i.currentTime;return void 0!==s&&a(s)?s: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 i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}},{key:"transferMediaFromPlayer",value:function(e,t){var i=e.interstitial.appendInPlace,n=e.media;if(i&&n===this.primaryMedia){var r;if(!t||this.isInterstitial(t)&&!t.event.appendInPlace)return void(t&&n&&(this.detachedData={media:n}));var a=e.transferMedia();this.log(Hy(r="transfer MediaSource from ".concat(e," ")).call(r,bI(a))),this.bufferingAsset=null,this.detachedData=a}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}},{key:"transferMediaTo",value:function(e,t){var i,n,r,a,s,o,l=null,u=this.hls,c=e!==u,h=c&&e.interstitial.appendInPlace,d=null==(a=this.detachedData)?void 0:a.mediaSource;if(u.media&&h)l=u.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(Hy(i=Hy(n="transferring to ".concat(c?e:"Primary","\nMediaSource ")).call(n,bI(l)," from ")).call(i,o)),l||(d?(l=this.detachedData,this.log("using detachedData: MediaSource ".concat(bI(l)))):this.detachedData&&this.hls.media!==t||(this.hls.detachMedia(),this.detachedData={media:t}));var v=l&&"mediaSource"in l&&"closed"!==(null==(s=l.mediaSource)?void 0:s.readyState),g=v&&l?l:t;if(this.log(Hy(r="".concat(v?"transfering MediaSource":"attaching media"," to ")).call(r,c?e:"Primary")),g===l){var p=c&&e.assetId===this.schedule.assetIdAtEnd;g.overrides={duration:this.schedule.duration,endOfStream:!c||p,cueRemoval:!1}}e.attachMedia(g)}},{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 i=this.timelinePos,n=this.waitingItem;if(-1===i){var r=this.hls.startPosition;if(this.timelinePos=r,t.length&&t[0].cue.pre){var a=e.findEventIndex(t[0].identifier);this.setSchedulePosition(a)}else if(r>=0||!this.primaryLive){var s=this.timelinePos=r>0?r: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,i){var n=i+1;if(e.isAssetPastPlayoutLimit(n)||e.assetList[n].error){var r=this.schedule.items;if(r){var a=t+1;if(a>=r.length)return void this.setSchedulePosition(-1);this.setSchedulePosition(a)}}else this.setSchedulePosition(t,n)}},{key:"setScheduleToAssetAtTime",value:function(e,t){var i=this.schedule,n=t.parentIdentifier,r=i.getEvent(n);if(r){var a=i.findEventIndex(n),s=i.findAssetIndex(r,e);this.setSchedulePosition(a,s)}}},{key:"setSchedulePosition",value:function(e,t){var i,n=this,r=this.schedule.items;if(r&&!this.playbackDisabled){this.log(Hy(i="setSchedulePosition ".concat(e,", ")).call(i,t));var a=e>=0?r[e]:null,s=this.primaryMedia,o=this.playingItem,l=this.playingLastItem;if(this.isInterstitial(o)){var u,h,d=o.event,f=this.playingAsset,v=null==f?void 0:f.identifier,g=v?this.getAssetPlayer(v):null;if(g&&v&&(!this.eventItemsMatch(o,a)||void 0!==t&&v!==(null==(h=d.assetList)?void 0:h[t].identifier))){var p,m;this.playingAsset=null;var y=d.findAssetIndex(f);this.log(Hy(p=Hy(m="INTERSTITIAL_ASSET_ENDED ".concat(y+1,"/")).call(m,d.assetList.length," ")).call(p,Ga(f))),this.hls.trigger(c.INTERSTITIAL_ASSET_ENDED,{asset:f,assetListIndex:y,event:d,schedule:iI(r).call(r,0),scheduleIndex:e,player:g}),this.retreiveMediaSource(v,a),g.media&&!this.detachedData&&g.detachMedia(),this.clearAssetPlayer(v,a)}if(!this.eventItemsMatch(o,a)&&(this.playingItem=null,this.log(Hy(u="INTERSTITIAL_ENDED ".concat(d," ")).call(u,Wa(o))),d.hasPlayed=!0,this.hls.trigger(c.INTERSTITIAL_ENDED,{event:d,schedule:iI(r).call(r,0),scheduleIndex:e}),this.clearInterstitial(d,a),d.cue.once)){if(this.updateSchedule(),a){var k=this.schedule.findItemIndex(a);this.setSchedulePosition(k,t)}return}}var T=this.playerQueue;if(T.length&&Py(T).call(T,(function(t){var i=t.interstitial,r=n.schedule.findEventIndex(i.identifier);(r<e||r>e+1)&&n.clearInterstitial(i,a)})),this.isInterstitial(a)){var E,S,_;this.timelinePos=Math.min(Math.max(this.timelinePos,a.start),a.end);var b=a.event;void 0===t&&(t=this.schedule.findAssetIndex(b,this.timelinePos));var A=this.waitingItem,R=this.preloadAssets(b,t);R||this.setBufferingItem(a),this.eventItemsMatch(a,o||A)||(this.waitingItem=a,this.log(Hy(E="INTERSTITIAL_STARTED ".concat(Wa(a)," ")).call(E,b.appendInPlace?"append in place":"")),this.hls.trigger(c.INTERSTITIAL_STARTED,{event:b,schedule:iI(r).call(r,0),scheduleIndex:e}));var L=b.assetList.length;if(0===L&&!b.assetListResponse)return void this.log("Waiting for ASSET-LIST to complete loading ".concat(b));if(b.assetListLoader&&(b.assetListLoader.destroy(),b.assetListLoader=void 0),!s)return void this.log("Waiting for attachMedia to start Interstitial ".concat(b));this.waitingItem=null,this.playingItem=a;var I=b.assetList[t];if(!I){var C=r[e+1],w=this.media;return C&&w&&!this.isInterstitial(C)&&w.currentTime<C.start&&(w.currentTime=this.timelinePos=C.start),void this.advanceAfterAssetEnded(b,e,t||0)}if(R||(R=this.getAssetPlayer(I.identifier)),(null===R||R.destroyed)&&(this.warn(Hy(S=Hy(_="asset ".concat(t+1,"/")).call(_,L," player destroyed ")).call(S,b)),R=this.createAssetPlayer(b,I,t)),!this.eventItemsMatch(a,this.bufferingItem)&&b.appendInPlace&&this.isAssetBuffered(I))return;this.startAssetPlayer(R,t,r,e,s),this.shouldPlay&&Ya(R.media)}else null!==a?(this.resumePrimary(a,e,o),this.shouldPlay&&Ya(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,i){var n;if(this.playingItem=e,this.playingAsset=null,this.waitingItem=null,this.bufferedToItem(e),this.log("resuming ".concat(Wa(e))),null==(n=this.detachedData)||!n.mediaSource){var r=this.timelinePos;(r<e.start||r>=e.end)&&(r=this.getPrimaryResumption(e,t),this.timelinePos=r),this.attachPrimary(r,e)}if(i){var a=this.schedule.items;a&&(this.log("resumed ".concat(Wa(e))),this.hls.trigger(c.INTERSTITIALS_PRIMARY_RESUMED,{schedule:iI(a).call(a,0),scheduleIndex:t}),this.checkBuffer())}}},{key:"getPrimaryResumption",value:function(e,t){var i=e.start;if(this.primaryLive){var n=this.primaryDetails;if(0===t)return this.hls.startPosition;if(n&&(i<n.fragmentStart||i>n.edge))return this.hls.liveSyncPosition||-1}return i}},{key:"isAssetBuffered",value:function(e){var t=this.getAssetPlayer(e.identifier);return null!=t&&t.hls?t.hls.bufferedToEnd:Mt.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}},{key:"attachPrimary",value:function(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=null,this.bufferingAsset=null;var n=this.primaryMedia;if(n){var r=this.hls;r.media?this.checkBuffer():(this.transferMediaTo(r,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}}},{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(c.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(c.BUFFER_CODECS,this.onBufferCodecs,this)}},{key:"onLevelUpdated",value:function(e,t){if(-1!==t.level){var i=this.hls.levels[t.level],n=E(E({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n),!this.playingItem&&this.schedule.items&&this.checkStart()}}},{key:"onAudioTrackUpdated",value:function(e,t){var i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(n){var r=E(E({},n),{},{audio:i});this.mediaSelection=r}else this.altSelection=E(E({},this.altSelection),{},{audio:i})}},{key:"onSubtitleTrackUpdated",value:function(e,t){var i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(n){var r=E(E({},n),{},{subtitles:i});this.mediaSelection=r}else this.altSelection=E(E({},this.altSelection),{},{subtitles:i})}},{key:"onAudioTrackSwitching",value:function(e,t){var i,n=ne(t);Py(i=this.playerQueue).call(i,(function(e){return e.hls.setAudioOption(t)||e.hls.setAudioOption(n)}))}},{key:"onSubtitleTrackSwitch",value:function(e,t){var i,n=ne(t);Py(i=this.playerQueue).call(i,(function(e){return e.hls.setSubtitleOption(t)||-1!==t.id&&e.hls.setSubtitleOption(n)}))}},{key:"onBufferCodecs",value:function(e,t){var i=t.tracks;i&&(this.requiredTracks=i)}},{key:"onBufferAppended",value:function(e,t){this.checkBuffer()}},{key:"onBufferFlushed",value:function(e,t){var i=this.playingItem;if(i&&i!==this.bufferingItem&&!this.isInterstitial(i)){var n=this.timelinePos;this.bufferedPos=n,this.setBufferingItem(i)}}},{key:"onBufferedToEnd",value:function(e){var t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(var i=0;i<t.length;i++){var n=t[i];if(n.cue.post){var r,a=this.schedule.findEventIndex(n.identifier),s=null==(r=this.schedule.items)?void 0:r[a];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 i=this.findItemIndex(t);this.setSchedulePosition(i+1)}}},{key:"updateItem",value:function(e,t){var i=this.schedule.items;return e&&i&&i[this.findItemIndex(e,t)]||null}},{key:"itemsMatch",value:function(e,t){var i,n;return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&(null==(i=e.nextEvent)?void 0:i.identifier)===(null==(n=t.nextEvent)?void 0:n.identifier))}},{key:"eventItemsMatch",value:function(e,t){var i;return!!t&&(e===t||e.event.identifier===(null==(i=t.event)?void 0:i.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=Mt.bufferInfo(this.primaryMedia,this.timelinePos,0);this.updateBufferedPos(t.end,e,0===t.len)}}},{key:"updateBufferedPos",value:function(e,t,i){var n=this.schedule,r=this.bufferingItem;if(!(this.bufferedPos>e))if(1===t.length&&this.itemsMatch(t[0],r))this.bufferedPos=e;else{var a=this.playingItem,s=this.findItemIndex(a),o=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var l,u=this.findItemIndex(r),c=Math.min(u+1,t.length-1),h=t[c];if(-1===o&&r&&e>=r.end&&(o=c),c-s>1&&!1===(null==r||null==(l=r.event)?void 0:l.appendInPlace))return;if(this.bufferedPos=e,o>u&&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 i&&a&&r!==a&&o===s&&this.bufferedToItem(a)}}},{key:"setBufferingItem",value:function(e){var t=this.bufferingItem,i=this.schedule,n=i.items,r=i.events;if(n&&r&&(!t||i.findItemIndex(t)!==i.findItemIndex(e))){var a,s,o=this.isInterstitial(e),l=this.getBufferingPlayer(),u=l?l.remaining:t?t.end-this.timelinePos:0;this.log("buffered to boundary ".concat(Wa(e))+(t?" (".concat(u.toFixed(2)," remaining)"):"")),this.bufferingItem=e,this.bufferedPos=e.start,this.playbackDisabled||(o?Py(a=this.playerQueue).call(a,(function(e){return e.resumeBuffering()})):(this.hls.resumeBuffering(),Py(s=this.playerQueue).call(s,(function(e){return e.pauseBuffering()})))),this.hls.trigger(c.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:iI(r).call(r,0),schedule:iI(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,i=this.setBufferingItem(e);if(!this.playbackDisabled)if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==i){this.bufferingAsset=null;var n=this.detachedData;if(n)if(n.mediaSource){var r=!0;this.attachPrimary(e.start,e,r)}else this.preloadPrimary(e);else this.preloadPrimary(e)}}},{key:"preloadPrimary",value:function(e){var t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}},{key:"bufferedToEvent",value:function(e,t){var i=e.event,n=0===i.assetList.length&&!i.assetListLoader,r=i.cue.once;if(n||!r){var a=this.preloadAssets(i,t);if(null!=a&&a.interstitial.appendInPlace){var s=i.assetList[t],o=this.primaryMedia;s&&o&&this.bufferAssetPlayer(a,o)}}}},{key:"preloadAssets",value:function(e,t){var i=e.assetList.length,n=0===i&&!e.assetListLoader,r=e.cue.once;if(n){var a,s;this.log(Hy(a=Hy(s="Load interstitial asset ".concat(t+1,"/")).call(s,i," ")).call(a,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 u=0;!this.playingItem&&this.primaryLive&&-1===(u=this.hls.startPosition)&&(u=this.hls.liveSyncPosition||0);var c=this.assetListLoader.loadAssetList(e,u);c&&(e.assetListLoader=c)}else if(!r&&i){for(var h=t;h<i;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,i=this,n=this.requiredTracks;n&&Py(t=Cy(n)).call(t,(function(t){i.hls.trigger(c.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})}))}},{key:"getAssetPlayerQueueIndex",value:function(e){for(var t=this.playerQueue,i=0;i<t.length;i++)if(e===t[i].assetId)return i;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 i=0;i<e.length;i++)if(e[i].media===t)return e[i];return null}},{key:"createAsset",value:function(e,t,i,n,r,a){var s={parentIdentifier:e.identifier,identifier:Fa(e,a,t),duration:r,startOffset:i,timelineStart:n,uri:a};return this.createAssetPlayer(e,s,t)}},{key:"createAssetPlayer",value:function(e,t,i){var n=this;this.log("create HLSAssetPlayer for ".concat(Ga(t)));var r=this.hls,a=r.userConfig,s=a.videoPreference,o=r.levels[r.loadLevel]||r.levels[r.currentLevel];(s||o)&&(s=k({},s),o.videoCodec&&(s.videoCodec=o.videoCodec),o.videoRange&&(s.allowedVideoRanges=[o.videoRange]));var h=r.audioTracks[r.audioTrack],d=r.subtitleTracks[r.subtitleTrack],f=0;if(this.primaryLive){var v=this.timelinePos-t.timelineStart;if(v>1){var g=t.duration;g&&v<g&&(f=v)}}var p=E(E({},a),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:t.identifier,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:f,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:h||a.audioPreference,subtitlePreference:d||a.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(p.timelineOffset=t.timelineStart));var m=p.cmcd;null!=m&&m.sessionId&&m.contentId&&(p.cmcd=k({},m,{contentId:Oa(t.uri)}));var y=new Va(this.HlsPlayerClass,p,e,t);this.playerQueue.push(y),e.assetList[i]=t;var T=t.identifier,S=function(r){var a,s;if(r.live){var o=new Error("Interstitials MUST be VOD assets ".concat(e)),c={fatal:!0,type:l.OTHER_ERROR,details:u.INTERSTITIAL_ASSET_ITEM_ERROR,error:o};n.handleAssetItemError(c,e,n.schedule.findEventIndex(e.identifier),i,o.message)}else{var h=r.edge-r.fragmentStart,d=t.duration;(null===d||h>d)&&(n.log(Hy(a=Hy(s='Interstitial asset "'.concat(T,'" duration change ')).call(s,d," > ")).call(a,h)),t.duration=h,n.updateSchedule())}};y.on(c.LEVEL_UPDATED,(function(e,t){var i=t.details;return S(i)})),y.on(c.LEVEL_PTS_UPDATED,(function(e,t){var i=t.details;return S(i)}));var _=function e(t,i){var r=n.getAssetPlayer(T);if(r&&i.tracks){r.off(c.BUFFER_CODECS,e),r.tracks=i.tracks;var a=n.primaryMedia;n.bufferingAsset===r.assetItem&&a&&!r.media&&n.bufferAssetPlayer(r,a)}};y.on(c.BUFFER_CODECS,_);var b=function i(r){var a,s=n.getAssetPlayer(T);if(n.log("buffered to end of asset ".concat(s)),s){s.off(c.BUFFERED_TO_END,i);var o=n.schedule.findEventIndex(e.identifier),l=e.findAssetIndex(t),u=l+1,h=null==(a=n.schedule.items)?void 0:a[o];if(n.isInterstitial(h))if(-1===l||e.isAssetPastPlayoutLimit(u)||e.assetList[u].error){var d,f=null==(d=n.schedule.items)?void 0:d[o+1];f&&n.bufferedToItem(f)}else n.bufferedToItem(h,l+1)}};y.on(c.BUFFERED_TO_END,b);var A=function(t){return function(){if(n.getAssetPlayer(T)){n.shouldPlay=!0;var i=n.schedule.findEventIndex(e.identifier);n.advanceAfterAssetEnded(e,i,t)}}};return y.once(c.MEDIA_ENDED,A(i)),y.once(c.PLAYOUT_LIMIT_REACHED,A(1/0)),y.on(c.ERROR,(function(t,r){var a;n.handleAssetItemError(r,e,n.schedule.findEventIndex(e.identifier),i,Hy(a="Asset player error ".concat(r.error," ")).call(a,e))})),y.on(c.DESTROYING,(function(){if(n.getAssetPlayer(T)){var t=new Error("Asset player destroyed unexpectedly ".concat(T)),r={fatal:!0,type:l.OTHER_ERROR,details:u.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};n.handleAssetItemError(r,e,n.schedule.findEventIndex(e.identifier),i,t.message)}})),this.hls.trigger(c.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:y}),y}},{key:"clearInterstitial",value:function(e,t){var i,n=this;Py(i=e.assetList).call(i,(function(e){n.clearAssetPlayer(e.identifier,t)})),e.appendInPlaceStarted=!1}},{key:"clearAssetPlayer",value:function(e,t){if(null!==t){var i=this.getAssetPlayerQueueIndex(e);if(-1!==i){var n,r;this.log(Hy(n='clearAssetPlayer "'.concat(e,'" toSegment: ')).call(n,t?Wa(t):t));var a=this.playerQueue[i];this.transferMediaFromPlayer(a,t),mw(r=this.playerQueue).call(r,i,1),a.destroy()}}}},{key:"emptyPlayerQueue",value:function(){for(var e;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}},{key:"startAssetPlayer",value:function(e,t,i,n,r){var a,s,o=e.interstitial,l=e.assetItem,u=e.assetId,h=o.assetList.length,d=this.playingAsset;this.playingAsset=l,d&&d.identifier===u||(d&&(this.clearAssetPlayer(d.identifier,i[n]),delete d.error),this.log(Hy(a=Hy(s="INTERSTITIAL_ASSET_STARTED ".concat(t+1,"/")).call(s,h," ")).call(a,e)),this.hls.trigger(c.INTERSTITIAL_ASSET_STARTED,{asset:l,assetListIndex:t,event:o,schedule:iI(i).call(i,0),scheduleIndex:n,player:e})),e.media||this.bufferAssetPlayer(e,r)}},{key:"bufferAssetPlayer",value:function(e,t){var i,n,r=e.interstitial,a=e.assetItem,s=e.assetId,o=this.schedule.findEventIndex(r.identifier),c=null==(i=this.schedule.items)?void 0:i[o];if(c){this.setBufferingItem(c),this.bufferingAsset=a;var h=this.getBufferingPlayer();if(h!==e){var d=(null==h?void 0:h.tracks)||(null==(n=this.detachedData)?void 0:n.tracks)||this.requiredTracks;if(r.appendInPlace&&a!==this.playingAsset){if(!e.tracks)return;if(d&&!w(d,e.tracks)){var f,v,g=new Error(Hy(f=Hy(v='Asset "'.concat(s,"\" SourceBuffer tracks ('")).call(v,Cy(e.tracks),"') are not compatible with primary content tracks ('")).call(f,Cy(d),"')")),p={fatal:!0,type:l.OTHER_ERROR,details:u.INTERSTITIAL_ASSET_ITEM_ERROR,error:g},m=r.findAssetIndex(a);return void this.handleAssetItemError(p,r,o,m,g.message)}}this.transferMediaTo(e,t)}}}},{key:"handleAssetItemError",value:function(e,t,i,n,r){var a;if(e.details!==u.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 h=this.schedule.items,d=k({},e,{fatal:!1,errorAction:_e(!0),asset:s,assetListIndex:n,event:t,schedule:h,scheduleIndex:i,player:o});if(this.warn("Asset item error: ".concat(e.error)),this.hls.trigger(c.INTERSTITIAL_ASSET_ERROR,d),e.fatal){var f=new Error(r);s&&(this.playingAsset!==s&&this.clearAssetPlayer(s.identifier,null),s.error=f),Yy(a=t.assetList).call(a,(function(e){return!e.error}))?t.appendInPlace&&(t.error=f):t.error=f,this.primaryFallback(t)}}}},{key:"primaryFallback",value:function(e){var t=e.timelineStart,i=this.playingItem||this.waitingItem;if(this.updateSchedule(),i){var n,r,a,s;this.log(Hy(n=Hy(r=Hy(a=Hy(s='Fallback to primary from event "'.concat(e.identifier,'" start: ')).call(s,t," pos: ")).call(a,this.timelinePos," playing: ")).call(r,i?Wa(i):"<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(i,o);if(!this.itemsMatch(i,l)){var u=this.schedule.findItemIndexAtTime(o);this.setSchedulePosition(u)}}else this.checkStart()}},{key:"onAssetListLoaded",value:function(e,t){var i,n=this,r=t.event,a=r.identifier,s=t.assetListResponse.ASSETS;if(this.schedule.hasEvent(a)){var o=r.timelineStart,l=0;Py(s).call(s,(function(e,t){var i=Tb(e.DURATION);n.createAsset(r,t,l,o+l,i,e.URI),l+=i})),r.duration=l;var u=this.waitingItem,c=(null==u?void 0:u.event.identifier)===a;this.updateSchedule();var h=null==(i=this.bufferingItem)?void 0:i.event;if(c){var d,f=this.schedule.findEventIndex(a),v=null==(d=this.schedule.items)?void 0:d[f];v&&this.setBufferingItem(v),this.setSchedulePosition(f)}else if((null==h?void 0:h.identifier)===a&&h.appendInPlace){var g=r.assetList[0],p=this.getAssetPlayer(g.identifier),m=this.primaryMedia;g&&p&&m&&this.bufferAssetPlayer(p,m)}}}},{key:"onError",value:function(e,t){switch(t.details){case u.ASSET_LIST_PARSING_ERROR:case u.ASSET_LIST_LOAD_ERROR:case u.ASSET_LIST_LOAD_TIMEOUT:var i=t.interstitial;i&&this.primaryFallback(i)}}}]),i}(S)});function Js(e){var t;return e&&"object"==qh(e)?kw(e)?ub(e).call(e,Js):ok(t=Cy(e)).call(t,(function(t,i){return t[i]=Js(e[i]),t}),{}):e}function eo(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function to(e,t,i,n,r){var a=new e(t,i,"");try{a.value=n,r&&(a.type=r)}catch(s){a=new e(t,i,bI(r?E({type:r},n):n))}return a}var io=function(){var e=eo();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}(),no=function(){function e(t){var i=this;Zm(this,e),this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=function(){i.hls&&i.hls.trigger(c.EVENT_CUE_ENTER,{})},this.hls=t,this._registerListeners()}return ey(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(c.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(c.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(c.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(c.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(c.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(c.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(c.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(c.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(c.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(c.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}},{key:"onMediaAttaching",value:function(e,t){var i;this.media=t.media,!1===(null==(i=t.overrides)?void 0:i.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&&wa(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 i=e[t];if("metadata"===i.kind&&"id3"===i.label)return Ia(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}},{key:"onFragParsingMetadata",value:function(e,t){if(this.media){var i=this.hls.config,n=i.enableEmsgMetadataCues,r=i.enableID3MetadataCues;if(n||r){var a=t.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));var s=eo();if(s)for(var o=0;o<a.length;o++){var l=a[o].type;if((l!==Dn.emsg||n)&&r){var u=Ln(a[o].data);if(u){var c=a[o].pts,h=c+a[o].duration;h>io&&(h=io),h-c<=0&&(h=c+.25);for(var d=0;d<u.length;d++){var f=u[d];if(!In(f)){this.updateId3CueEnds(c,l);var v=to(s,c,h,f,l);v&&this.id3Track.addCue(v)}}}}}}}}},{key:"updateId3CueEnds",value:function(e,t){var i,n=null==(i=this.id3Track)?void 0:i.cues;if(n)for(var r=n.length;r--;){var a=n[r];a.type===t&&a.startTime<e&&a.endTime===io&&(a.endTime=e)}}},{key:"onBufferFlushing",value:function(e,t){var i=t.startOffset,n=t.endOffset,r=t.type,a=this.id3Track,s=this.hls;if(s){var o=s.config,l=o.enableEmsgMetadataCues,u=o.enableID3MetadataCues;a&&(l||u)&&Da(a,i,n,"audio"===r?function(e){return e.type===Dn.audioId3&&u}:"video"===r?function(e){return e.type===Dn.emsg&&l}:function(e){return e.type===Dn.audioId3&&u||e.type===Dn.emsg&&l})}}},{key:"onLevelUpdated",value:function(e,t){var i=t.details;this.updateDateRangeCues(i,!0)}},{key:"onLevelPtsUpdated",value:function(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}},{key:"updateDateRangeCues",value:function(e,t){var i=this;if(this.media&&e.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var n,r=this.id3Track,s=e.dateRanges,o=Cy(s),l=this.dateRangeCuesAppended;if(r&&t)if(null!=(n=r.cues)&&n.length)for(var u,c=Dy(u=Cy(l)).call(u,(function(e){return!bP(o).call(o,e)})),h=function(){var e,t=c[d],n=l[t].cues;delete l[t],Py(e=Cy(n)).call(e,(function(e){try{var t=n[e];t.removeEventListener("enter",i.onEventCueEnter),r.removeCue(t)}catch(a){}}))},d=c.length;d--;)h();else l=this.dateRangeCuesAppended={};var f=e.fragments[e.fragments.length-1];if(0!==o.length&&a(null==f?void 0:f.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var v,g,p=eo(),m=function(){var e=o[y],t=s[e],n=t.startTime,r=l[e],a=(null==r?void 0:r.cues)||{},u=(null==r?void 0:r.durationKnown)||!1,c=io,h=t.duration;if(t.endDate&&null!==h)c=n+h,u=!0;else if(t.endOnNext&&!u){var d=ok(o).call(o,(function(e,i){if(i!==t.id){var n=s[i];if(n.class===t.class&&n.startDate>t.startDate&&(!e||t.startDate<e.startDate))return n}return e}),null);d&&(c=d.startTime,u=!0)}for(var f=Cy(t.attr),m=0;m<f.length;m++){var k=f[m];if("ID"!==(g=k)&&"CLASS"!==g&&"CUE"!==g&&"START-DATE"!==g&&"DURATION"!==g&&"END-DATE"!==g&&"END-ON-NEXT"!==g){var T=a[k];if(T)u&&!r.durationKnown?T.endTime=c:Math.abs(T.startTime-n)>.01&&(T.startTime=n,T.endTime=c);else if(p){var E=t.attr[k];Wt(k)&&(v=E,E=Uint8Array.from(v.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer);var S=to(p,n,c,{key:k,data:E},Dn.dateRange);S&&(S.id=e,i.id3Track.addCue(S),a[k]=S,i.hls.config.interstitialsController&&("X-ASSET-LIST"!==k&&"X-ASSET-URL"!==k||S.addEventListener("enter",i.onEventCueEnter)))}}}l[e]={cues:a,dateRange:t,durationKnown:u}},y=0;y<o.length;y++)m()}}}}]),e}(),ro=function(){function e(t){var i=this;Zm(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=i.media,t=i.hls.latestLevelDetails;if(e&&t){i.currentTime=e.currentTime;var n=i.computeLatency();if(null!==n){i._latency=n;var r=i.config,a=r.lowLatencyMode,s=r.maxLiveSyncPlaybackRate;if(a&&1!==s&&t.live){var o=i.targetLatency;if(null!==o){var l=n-o;if(l<Math.min(i.maxLatency,o+t.targetduration)&&l>.05&&i.forwardBufferLength>1){var u=Math.min(2,Math.max(1,s)),c=Math.round(2/(1+Math.exp(-.75*l-i.edgeStalled))*20)/20;e.playbackRate=Math.min(u,Math.max(1,c))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}}}}},this.hls=t,this.config=t.config,this.registerListeners()}return ey(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 i=null==(e=this.hls)?void 0:e.latestLevelDetails;return i?t.liveMaxLatencyDurationCount*i.targetduration:0}},{key:"targetLatency",get:function(){var e=this.hls.latestLevelDetails;if(null===e)return null;var t=e.holdBack,i=e.partHoldBack,n=e.targetduration,r=this.config,a=r.liveSyncDuration,s=r.liveSyncDurationCount,o=r.lowLatencyMode,l=this.hls.userConfig,u=o&&i||t;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||0===u)&&(u=void 0!==a?a:s*n);var c=n;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,c)},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 i=this.hls.latestLevelDetails;if(null===i)return null;var n=i.edge,r=e-t-this.edgeStalled,a=n-i.totalduration,s=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,r),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 i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}},{key:"destroy",value:function(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}},{key:"registerListeners",value:function(){this.hls.on(c.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(c.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(c.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(c.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(c.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){this.hls.off(c.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(c.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(c.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(c.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(c.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 i=t.details;i.advanced&&this.onTimeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}},{key:"onError",value:function(e,t){var i;t.details===u.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(i=this.hls.latestLevelDetails)&&i.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}(),ao=function(e){Qm(i,e);var t=$m(i);function i(e,n){var r;return Zm(this,i),(r=t.call(this,e,"level-controller"))._levels=[],r._firstLevel=-1,r._maxAutoLevel=-1,r._startLevel=void 0,r.currentLevel=null,r.currentLevelIndex=-1,r.manualLevelIndex=-1,r.steering=void 0,r.onParsedComplete=void 0,r.steering=n,r._registerListeners(),r}return ey(i,[{key:"_registerListeners",value:function(){var e=this.hls;e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(c.LEVEL_LOADED,this.onLevelLoaded,this),e.on(c.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(c.FRAG_BUFFERED,this.onFragBuffered,this),e.on(c.ERROR,this.onError,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(c.LEVEL_LOADED,this.onLevelLoaded,this),e.off(c.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(c.FRAG_BUFFERED,this.onFragBuffered,this),e.off(c.ERROR,this.onError,this)}},{key:"destroy",value:function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),ev(Jf(i.prototype),"destroy",this).call(this)}},{key:"stopLoad",value:function(){var e;Py(e=this._levels).call(e,(function(e){e.loadError=0,e.fragmentError=0})),ev(Jf(i.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 i,n=this,r=this.hls.config.preferManagedMediaSource,a=[],s={},o={},l=!1,u=!1,c=!1;Py(i=t.levels).call(i,(function(e){var t,i,h,d,f,v,g=e.attrs,p=e.audioCodec,m=e.videoCodec;p&&(e.audioCodec=p=B(p,r)||void 0),0===(null==(v=m)?void 0:zy(v).call(v,"avc1"))&&(m=e.videoCodec=function(e){for(var t=e.split(","),i=0;i<t.length;i++){var n=t[i].split(".");if(n.length>2){var r,a=n.shift()+".";a+=Zk(n.shift()).toString(16),a+=iI(r="000"+Zk(n.shift()).toString(16)).call(r,-4),t[i]=a}}return t.join(",")}(m));var y=e.width,k=e.height,T=e.unknownCodecs,E=T?T.length:0;if(T)for(var S=E;S--;){var _,b,A=T[S];n.isAudioSupported(A)?(e.audioCodec=p=p?Hy(_="".concat(p,",")).call(_,A):A,E--,D.audio[p.substring(0,4)]=2):n.isVideoSupported(A)&&(e.videoCodec=m=m?Hy(b="".concat(m,",")).call(b,A):A,E--,D.video[m.substring(0,4)]=2)}if(l||(l=!(!y||!k)),u||(u=!!m),c||(c=!!p),!(E||p&&!n.isAudioSupported(p)||m&&!n.isVideoSupported(m))){var R=g.CODECS,L=g["FRAME-RATE"],I=g["HDCP-LEVEL"],C=g["PATHWAY-ID"],w=g.RESOLUTION,x=g["VIDEO-RANGE"],P=Hy(t=Hy(i=Hy(h=Hy(d=Hy(f="".concat("".concat(C||".","-"),e.bitrate,"-")).call(f,w,"-")).call(d,L,"-")).call(h,R,"-")).call(i,x,"-")).call(t,I);if(s[P])if(s[P].uri===e.url||e.attrs["PATHWAY-ID"])s[P].addGroupId("audio",g.AUDIO),s[P].addGroupId("text",g.SUBTITLES);else{var O=o[P]+=1;e.attrs["PATHWAY-ID"]=new Array(O+1).join(".");var M=new Z(e);s[P]=M,a.push(M)}else{var N=new Z(e);s[P]=N,o[P]=1,a.push(N)}}})),this.filterAndSortMediaOptions(a,t,l,u,c)}},{key:"isAudioSupported",value:function(e){return x(e,"audio",this.hls.config.preferManagedMediaSource)}},{key:"isVideoSupported",value:function(e){return x(e,"video",this.hls.config.preferManagedMediaSource)}},{key:"filterAndSortMediaOptions",value:function(e,t,i,n,r){var a,s=this,o=[],h=[],d=e;if((i||n)&&r&&(d=Dy(d).call(d,(function(e){var t,i=e.videoCodec,n=e.videoRange,r=e.width,a=e.height;return(!!i||!(!r||!a))&&!!(t=n)&&zy(q).call(q,t)>-1}))),0!==d.length){t.audioTracks&&so(o=Dy(a=t.audioTracks).call(a,(function(e){return!e.audioCodec||s.isAudioSupported(e.audioCodec)}))),t.subtitles&&so(h=t.subtitles);var f=iI(d).call(d,0);XC(d).call(d,(function(e,t){if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return zy(q).call(q,e.videoRange)-zy(q).call(q,t.videoRange);if(e.videoCodec!==t.videoCodec){var n=M(e.videoCodec),r=M(t.videoCodec);if(n!==r)return r-n}if(e.uri===t.uri&&e.codecSet!==t.codecSet){var a=N(e.codecSet),s=N(t.codecSet);if(a!==s)return s-a}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));var v=f[0];if(this.steering&&(d=this.steering.filterParsedLevels(d)).length!==f.length)for(var g=0;g<f.length;g++)if(f[g].pathwayId===d[0].pathwayId){v=f[g];break}this._levels=d;for(var p=0;p<d.length;p++)if(d[p]===v){var m,y;this._firstLevel=p;var k=v.bitrate,T=this.hls.bandwidthEstimate;if(this.log(Hy(m="manifest loaded, ".concat(d.length," level(s) found, first bitrate: ")).call(m,k)),void 0===(null==(y=this.hls.userConfig)?void 0:y.abrEwmaDefaultEstimate)){var E=Math.min(k,this.hls.config.abrEwmaDefaultEstimateMax);E>T&&T===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=E)}break}var S=r&&!n,_={levels:d,audioTracks:o,subtitleTracks:h,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:n,altAudio:!S&&Yy(o).call(o,(function(e){return!!e.url}))};this.hls.trigger(c.MANIFEST_PARSED,_)}else nb.resolve().then((function(){if(s.hls){t.levels.length&&s.warn("One or more CODECS in variant not supported: ".concat(bI(t.levels[0].attrs)));var e=new Error("no level with compatible codecs found in manifest");s.hls.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.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,i,n,r,a,s,o,h=this._levels;if(0!==h.length){if(e<0||e>=h.length){var d=new Error("invalid level idx"),f=e<0;if(this.hls.trigger(c.ERROR,{type:l.OTHER_ERROR,details:u.LEVEL_SWITCH_ERROR,level:e,fatal:f,error:d,reason:d.message}),f)return;e=Math.min(e,h.length-1)}var v=this.currentLevelIndex,g=this.currentLevel,p=g?g.attrs["PATHWAY-ID"]:void 0,m=h[e],y=m.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=m,v!==e||!g||p!==y){this.log(Hy(t=Hy(i=Hy(n=Hy(r=Hy(a=Hy(s=Hy(o="Switching to level ".concat(e," (")).call(o,m.height?m.height+"p ":"")).call(s,m.videoRange?m.videoRange+" ":"")).call(a,m.codecSet?m.codecSet+" ":"","@")).call(r,m.bitrate,")")).call(n,y?" with Pathway "+y:""," from level ")).call(i,v)).call(t,p?" with Pathway "+p:""));var k={level:e,attrs:m.attrs,details:m.details,bitrate:m.bitrate,averageBitrate:m.averageBitrate,maxBitrate:m.maxBitrate,realBitrate:m.realBitrate,width:m.width,height:m.height,codecSet:m.codecSet,audioCodec:m.audioCodec,videoCodec:m.videoCodec,audioGroups:m.audioGroups,subtitleGroups:m.subtitleGroups,loaded:m.loaded,loadError:m.loadError,fragmentError:m.fragmentError,name:m.name,id:m.id,uri:m.uri,url:m.url,urlId:0,audioGroupIds:m.audioGroupIds,textGroupIds:m.textGroupIds};this.hls.trigger(c.LEVEL_SWITCHING,k);var T=m.details;if(!T||T.live){var E=this.switchParams(m.uri,null==g?void 0:g.details,T);this.loadPlaylist(E)}}}}},{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,i=this.steering.pathways(),n=Dy(e).call(e,(function(e){return-1!==zy(i).call(i,e)}));if(e.length<1)return void this.warn(Hy(t="pathwayPriority ".concat(e," should contain at least one pathway from list: ")).call(t,i));this.steering.pathwayPriority=n}}},{key:"onError",value:function(e,t){!t.fatal&&t.context&&t.context.type===d&&t.context.level===this.level&&this.checkRetry(t)}},{key:"onFragBuffered",value:function(e,t){var i=t.frag;if(void 0!==i&&i.type===g.MAIN){var n,r=i.elementaryStreams;if(!Yy(n=Cy(r)).call(n,(function(e){return!!r[e]})))return;var a=this._levels[i.level];null!=a&&a.loadError&&(this.log("Resetting level error count of ".concat(a.loadError," on frag buffered")),a.loadError=0)}}},{key:"onLevelLoaded",value:function(e,t){var i,n,r=t.level,a=t.details,s=t.levelInfo;if(!s)return this.warn("Invalid level index ".concat(r)),void(null!=(n=t.deliveryDirectives)&&n.skip&&(a.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(r,t,o)}else null!=(i=t.deliveryDirectives)&&i.skip&&(a.deltaUpdateFailed=!0)}},{key:"loadPlaylist",value:function(e){ev(Jf(i.prototype),"loadPlaylist",this).call(this),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}},{key:"loadingPlaylist",value:function(e,t){var n,r,a,s;ev(Jf(i.prototype),"loadingPlaylist",this).call(this,e,t);var o=this.getUrlWithDirectives(e.uri,t),l=this.currentLevelIndex,u=e.attrs["PATHWAY-ID"],h=e.details,d=null==h?void 0:h.age;this.log(Hy(n=Hy(r=Hy(a=Hy(s="Loading level index ".concat(l)).call(s,void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")).call(a,u?" Pathway "+u:"")).call(r,d&&h.live?" age "+d.toFixed(1)+(h.type&&" "+h.type||""):""," ")).call(n,o)),this.hls.trigger(c.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,i,n=this;if(1!==this._levels.length){var r=Dy(t=this._levels).call(t,(function(t,i){var r;return i!==e||(n.steering&&n.steering.removeLevel(t),t===n.currentLevel&&(n.currentLevel=null,n.currentLevelIndex=-1,t.details&&Py(r=t.details.fragments).call(r,(function(e){return e.level=-1}))),!1)}));Fi(r),this._levels=r,this.currentLevelIndex>-1&&null!=(i=this.currentLevel)&&i.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);var a=r.length-1;this._firstLevel=Math.min(this._firstLevel,a),this._startLevel&&(this._startLevel=Math.min(this._startLevel,a)),this.hls.trigger(c.LEVELS_UPDATED,{levels:r})}}},{key:"onLevelsUpdated",value:function(e,t){var i=t.levels;this._levels=i}},{key:"checkMaxAutoUpdated",value:function(){var e=this.hls,t=e.autoLevelCapping,i=e.maxAutoLevel,n=e.maxHdcpLevel;this._maxAutoLevel!==i&&(this._maxAutoLevel=i,this.hls.trigger(c.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:i,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}]),i}(Nr);function so(e){var t={};Py(e).call(e,(function(e){var i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}var oo=function(e){Qm(i,e);var t=$m(i);function i(e,n,r,a){var s;return Zm(this,i),(s=t.call(this,"gap-controller",a.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=r,s.hls=a,s}return ey(i,[{key:"destroy",value:function(){this.media=null,this.hls=this.fragmentTracker=null}},{key:"poll",value:function(e,t,i,n){var r=this.config,a=this.media,s=this.stalled;if(null!==a){var o=a.currentTime,l=a.seeking,u=this.seeking&&!l,h=!this.seeking&&l;if(this.seeking=l,o===e)if(h||u)this.stalled=null;else{if(a.paused&&!l||a.ended||0===a.playbackRate||!Mt.getBuffered(a).length)return!this.ended&&a.ended&&(this.ended=o||1,this.hls.trigger(c.MEDIA_ENDED,{stalled:!1})),void(this.nudgeRetry=0);var d=Mt.bufferInfo(a,o,0),f=d.nextStart||0;if(l){var v=d.len>2,g=!f||t&&t.start<=o||f-o>2&&!this.fragmentTracker.getPartialFragment(o);if(v||g)return;this.moved=!1}if(!this.moved&&null!==this.stalled){if(!(d.len>0||f))return;var p=Math.max(f,d.start||0)-o,m=null!=i&&i.live?2*i.targetduration:2,y=this.fragmentTracker.getPartialFragment(o);if(p>0&&(p<=m||y))return void(a.paused||this._trySkipBufferHole(y))}var k=self.performance.now();if(null!==s){var T=k-s;if(!l&&T>=250){if(n===Zi&&(null==i||!i.live)&&Math.abs(o-((null==i?void 0:i.edge)||0))<1){if(T<1e3||this.ended)return;return this.ended=o||1,void this.hls.trigger(c.MEDIA_ENDED,{stalled:!0})}if(this._reportStall(d),!this.media)return}var E=Mt.bufferInfo(a,o,r.maxBufferHole);this._tryFixBufferStall(E,T)}else this.stalled=k}else if(e&&(this.ended=0),this.moved=!0,l||(this.nudgeRetry=0),null!==s){if(this.stallReported){var S,_=self.performance.now()-s;this.warn(Hy(S="playback not stuck anymore @".concat(o,", after ")).call(S,Math.round(_),"ms")),this.stallReported=!1}this.stalled=null}}}},{key:"_tryFixBufferStall",value:function(e,t){var i=this.config,n=this.fragmentTracker,r=this.media;if(null!==r){var a=r.currentTime,s=n.getPartialFragment(a);(!s||!this._trySkipBufferHole(s)&&this.media)&&(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-a<i.maxBufferHole)&&t>1e3*i.highBufferWatchdogPeriod&&(this.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}}},{key:"_reportStall",value:function(e){var t=this.hls,i=this.media;if(!this.stallReported&&i){var n;this.stallReported=!0;var r=new Error(Hy(n="Playback stalling at @".concat(i.currentTime," due to low buffer (")).call(n,bI(e),")"));this.warn(r.message),t.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}}},{key:"_trySkipBufferHole",value:function(e){var t=this.config,i=this.hls,n=this.media;if(null===n)return 0;var r=n.currentTime,a=Mt.bufferInfo(n,r,0),s=r<a.start?a.start:a.nextStart;if(s){var o=a.len<=t.maxBufferHole,h=a.len>0&&a.len<1&&n.readyState<3,d=s-r;if(d>0&&(o||h)){var f;if(d>t.maxBufferHole){var v=this.fragmentTracker,p=!1;if(0===r){var m=v.getAppendedFrag(0,g.MAIN);m&&s<m.end&&(p=!0)}if(!p){var y=e||v.getAppendedFrag(r,g.MAIN);if(y){for(var k=!1,T=y.end;T<s;){var E=v.getPartialFragment(T);if(!E){k=!0;break}T+=E.duration}if(k)return 0}}}var S=Math.max(s+.05,r+.1);if(this.warn(Hy(f="skipping hole, adjusting currentTime from ".concat(r," to ")).call(f,S)),this.moved=!0,this.stalled=null,n.currentTime=S,e&&!e.gap){var _,b=new Error(Hy(_="fragment loaded with buffer holes, seeking from ".concat(r," to ")).call(_,S));i.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:b,reason:b.message,frag:e})}return S}}return 0}},{key:"_tryNudgeBuffer",value:function(){var e=this.config,t=this.hls,i=this.media,n=this.nudgeRetry;if(null!==i){var r=i.currentTime;if(this.nudgeRetry++,n<e.nudgeMaxRetry){var a,s=r+(n+1)*e.nudgeOffset,o=new Error(Hy(a="Nudging 'currentTime' from ".concat(r," to ")).call(a,s));this.warn(o.message),i.currentTime=s,t.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{var h,d=new Error(Hy(h="Playhead still not moving while enough data buffered @".concat(r," after ")).call(h,e.nudgeMaxRetry," nudges"));this.error(d.message),t.trigger(c.ERROR,{type:l.MEDIA_ERROR,details:u.BUFFER_STALLED_ERROR,error:d,fatal:!0})}}}}]),i}(S);function lo(){return self.SourceBuffer||self.WebKitSourceBuffer}function uo(){if(!C())return!1;var e=lo();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}function co(){var e,t;if(!uo())return!1;var i=C();return"function"==typeof(null==i?void 0:i.isTypeSupported)&&(Yy(e=["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"]).call(e,(function(e){return i.isTypeSupported(O(e,"video"))}))||Yy(t=["mp4a.40.2","fLaC"]).call(t,(function(e){return i.isTypeSupported(O(e,"audio"))})))}var ho=function(e){Qm(i,e);var t=$m(i);function i(e,n,r){var s;return Zm(this,i),(s=t.call(this,e,n,r,"stream-controller",g.MAIN)).audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s._hasEnoughToStart=!1,s.altAudio=0,s.audioOnly=!1,s.fragPlaying=null,s.fragLastKbps=0,s.couldBacktrack=!1,s.backtrackFragment=null,s.audioCodecSwitch=!1,s.videoBuffer=null,s.onMediaPlaying=function(){var e=s.gapController;e&&(e.ended=0),s.tick()},s.onMediaSeeked=function(){var e=s.media,t=e?e.currentTime:null;a(t)&&s.log("Media seeked to ".concat(t.toFixed(3)));var i=s.getMainFwdBufferInfo();null!==i&&0!==i.len?s.tick():s.warn('Main forward buffer length on "seeked" event '.concat(i?i.len:"empty",")"))},s.registerListeners(),s}return ey(i,[{key:"registerListeners",value:function(){ev(Jf(i.prototype),"registerListeners",this).call(this);var e=this.hls;e.on(c.MANIFEST_PARSED,this.onManifestParsed,this),e.on(c.LEVEL_LOADING,this.onLevelLoading,this),e.on(c.LEVEL_LOADED,this.onLevelLoaded,this),e.on(c.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(c.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(c.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(c.BUFFER_CREATED,this.onBufferCreated,this),e.on(c.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(c.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(c.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"unregisterListeners",value:function(){ev(Jf(i.prototype),"unregisterListeners",this).call(this);var e=this.hls;e.off(c.MANIFEST_PARSED,this.onManifestParsed,this),e.off(c.LEVEL_LOADED,this.onLevelLoaded,this),e.off(c.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(c.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(c.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(c.BUFFER_CREATED,this.onBufferCreated,this),e.off(c.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(c.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(c.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"onHandlerDestroying",value:function(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),ev(Jf(i.prototype),"onHandlerDestroying",this).call(this)}},{key:"startLoad",value:function(e,t){if(this.levels){var i=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var r=n.startLevel;-1===r&&(n.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=n.firstAutoLevel),n.nextLoadLevel=r,this.level=n.loadLevel,this._hasEnoughToStart=!1}i>0&&-1===e&&!t&&(this.log("Override startPosition with lastCurrentTime @".concat(i.toFixed(3))),e=i),this.state=ji,this.nextLoadPosition=this.lastCurrentTime=e,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Wi}},{key:"stopLoad",value:function(){this._forceStartLoad=!1,ev(Jf(i.prototype),"stopLoad",this).call(this)}},{key:"doTick",value:function(){switch(this.state){case tn:var e=this.levels,t=this.level,i=null==e?void 0:e[t],n=null==i?void 0:i.details;if(n&&(!n.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(n))break;this.state=ji;break}if(this.hls.nextLoadLevel!==this.level){this.state=ji;break}break;case qi:var r,a=self.performance.now(),s=this.retryDate;if(!s||a>=s||null!=(r=this.media)&&r.seeking){var o=this.levels,l=this.level,u=null==o?void 0:o[l];this.resetStartWhenNotLoaded(u||null),this.state=ji}}this.state===ji&&this.doTickIdle(),this.onTickEnd()}},{key:"onTickEnd",value:function(){ev(Jf(i.prototype),"onTickEnd",this).call(this),this.checkBuffer(),this.checkFragmentChanged()}},{key:"doTickIdle",value:function(){var e,t=this.hls,i=this.levelLastLoaded,n=this.levels,r=this.media;if(null!==i&&(r||!this.startFragRequested&&t.config.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)){var a=this.buffering?t.nextLoadLevel:t.loadLevel;if(null!=n&&n[a]){var s=n[a],o=this.getMainFwdBufferInfo();if(null!==o){var l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){var u={};return 2===this.altAudio&&(u.type="video"),this.hls.trigger(c.BUFFER_EOS,u),void(this.state=Zi)}if(this.buffering){t.loadLevel!==a&&-1===t.manualLevel&&this.log(Hy(e="Adapting to level ".concat(a," from level ")).call(e,this.level)),this.level=t.nextLoadLevel=a;var h=s.details;if(!h||this.state===tn||this.waitForLive(s))return this.level=a,this.state=tn,void(this.startFragRequested=!1);var d=o.len,f=this.getMaxBufferLength(s.maxBitrate);if(!(d>=f)){this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);var v=this.backtrackFragment?this.backtrackFragment.start:o.end,p=this.getNextFragment(v,h);if(this.couldBacktrack&&!this.fragPrevious&&p&&Ze(p)&&this.fragmentTracker.getState(p)!==Le){var m,y=(null!=(m=this.backtrackFragment)?m:p).sn-h.startSN,k=h.fragments[y-1];k&&p.cc===k.cc&&(p=k,this.fragmentTracker.removeFragment(k))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,v)){if(!p.gap){var T=this.audioOnly&&!this.altAudio?qe:Xe,E=(T===Xe?this.videoBuffer:this.mediaBuffer)||this.media;E&&this.afterBufferFlushed(E,T,g.MAIN)}p=this.getNextFragmentLoopLoading(p,h,o,g.MAIN,f)}p&&(!p.initSegment||p.initSegment.data||this.bitrateTest||(p=p.initSegment),this.loadFragment(p,s,v))}}}}}}},{key:"loadFragment",value:function(e,t,n){var r,a=this.fragmentTracker.getState(e);a===be||a===Re?Ze(e)?this.bitrateTest?(this.log(Hy(r="Fragment ".concat(e.sn," of level ")).call(r,e.level," is being downloaded to test bitrate and will not be buffered")),this._loadBitrateTestFrag(e,t)):ev(Jf(i.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,g.MAIN)}},{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 i,n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);var r=this.getLevelDetails();if(null!=r&&r.live){var a=this.getMainFwdBufferInfo();if(!a||a.len<2*r.targetduration)return}if(!t.paused&&e){var s=e[this.hls.nextLoadLevel],o=this.fragLastKbps;i=o&&this.fragCurrent?this.fragCurrent.duration*s.maxBitrate/(1e3*o)+1:0}else i=0;var l=this.getBufferedFrag(t.currentTime+i);if(l){var u=this.followingBufferedFrag(l);if(u){this.abortCurrentFrag();var c=u.maxStartPTS?u.maxStartPTS:u.start,h=u.duration,d=Math.max(l.end,c+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 Yi:case zi:case qi:case Qi:case $i:this.state=ji}this.nextLoadPosition=this.getLoadPosition()}},{key:"flushMainBuffer",value:function(e,t){ev(Jf(i.prototype),"flushMainBuffer",this).call(this,e,t,2===this.altAudio?"video":null)}},{key:"onMediaAttached",value:function(e,t){ev(Jf(i.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 oo(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),ev(Jf(i.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(c.MEDIA_ENDED,{stalled:!1})}},{key:"onManifestLoading",value:function(){ev(Jf(i.prototype),"onManifestLoading",this).call(this),this.log("Trigger BUFFER_RESET"),this.hls.trigger(c.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 i,n,r,a=!1,s=!1;Py(i=t.levels).call(i,(function(e){var t=e.audioCodec;t&&(a=a||-1!==zy(t).call(t,"mp4a.40.2"),s=s||-1!==zy(t).call(t,"mp4a.40.5"))})),this.audioCodecSwitch=a&&s&&!("function"==typeof(null==(r=lo())||null==(n=r.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===ji){var i=t.levelInfo;(!i.details||i.details.live&&(this.levelLastLoaded!==i||i.details.expired)||this.waitForCdnTuneIn(i.details))&&(this.state=tn)}}},{key:"onLevelLoaded",value:function(e,t){var i,n,r,a,s,o,l,u,h=this.levels,d=this.startFragRequested,f=t.level,v=t.details,g=v.totalduration;if(h){this.log(Hy(i=Hy(n=Hy(r=Hy(a=Hy(s=Hy(o="Level ".concat(f," loaded [")).call(o,v.startSN,",")).call(s,v.endSN,"]")).call(a,v.lastPartSn?Hy(l="[part-".concat(v.lastPartSn,"-")).call(l,v.lastPartIndex,"]"):"",", cc [")).call(r,v.startCC,", ")).call(n,v.endCC,"] duration:")).call(i,g));var p=t.levelInfo,m=this.fragCurrent;!m||this.state!==zi&&this.state!==qi||m.level!==t.level&&m.loader&&this.abortCurrentFrag();var y=0;if(v.live||null!=(u=p.details)&&u.live){var k;if(this.checkLiveUpdate(v),v.deltaUpdateFailed)return;y=this.alignPlaylists(v,p.details,null==(k=this.levelLastLoaded)?void 0:k.details)}if(p.details=v,this.levelLastLoaded=p,d||this.setStartPosition(v,y),this.hls.trigger(c.LEVEL_UPDATED,{details:v,level:f}),this.state===tn){if(this.waitForCdnTuneIn(v))return;this.state=ji}d&&v.live&&this.synchronizeToLiveEdge(v),this.tick()}else this.warn("Levels were reset while loading level ".concat(f))}},{key:"synchronizeToLiveEdge",value:function(e){var t=this.config,i=this.media;if(i){var n=this.hls.liveSyncPosition,r=i.currentTime,a=e.fragmentStart,s=e.edge,o=r>=a-t.maxFragLookUpTolerance&&r<=s;if(null!==n&&i.duration>n&&(r<n||!o)){var l,u,c=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&i.readyState<4||r<s-c)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState&&(this.warn(Hy(l=Hy(u="Playback: ".concat(r.toFixed(3)," is located too far from the end of live sliding playlist: ")).call(u,s,", reset currentTime to : ")).call(l,n.toFixed(3))),i.currentTime=n))}}}},{key:"_handleFragmentLoadProgress",value:function(e){var t,i,n,r,a,s=e.frag,o=e.part,l=e.payload,u=this.levels;if(u){var c=u[s.level];if(c){var h=c.details;if(!h)return this.warn(Hy(i="Dropping fragment ".concat(s.sn," of level ")).call(i,s.level," after level details were reset")),void this.fragmentTracker.removeFragment(s);var d=c.videoCodec,f=h.PTSKnown||!h.live,v=null==(a=s.initSegment)?void 0:a.data,p=this._getAudioCodec(c),m=this.transmuxer=this.transmuxer||new Dr(this.hls,g.MAIN,Iy(n=this._handleTransmuxComplete).call(n,this),Iy(r=this._handleTransmuxerFlush).call(r,this)),y=o?o.index:-1,k=-1!==y,T=new Pt(s.level,s.sn,s.stats.chunkCount,l.byteLength,y,k),E=this.initPTS[s.cc];m.push(l,v,p,d,s,o,h.totalduration,f,T,E)}else this.warn("Level ".concat(s.level," not found on progress"))}else this.warn(Hy(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 i=this.hls,n=2===this.altAudio;if(le(t.url,i))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 r=this.fragCurrent;r&&(this.log("Switching to main audio track, cancel main fragment load"),r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();n&&(i.trigger(c.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),i.trigger(c.AUDIO_TRACK_SWITCHED,t)}}},{key:"onAudioTrackSwitched",value:function(e,t){var i=le(t.url,this.hls);if(i){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=i?2:0,this.tick()}},{key:"onBufferCreated",value:function(e,t){var i,n,r=t.tracks,a=!1;for(var s in r){var o=r[s];if("main"===o.id){if(n=s,i=o,"video"===s){var l=r[s];l&&(this.videoBuffer=l.buffer)}}else a=!0}a&&i?(this.log("Alternate track found, use ".concat(n,".buffered to schedule main fragment loading")),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}},{key:"onFragBuffered",value:function(e,t){var i=t.frag,n=t.part,r=i.type===g.MAIN;if(r){var a,s,o;if(this.fragContextChanged(i))return this.warn(Hy(a=Hy(s=Hy(o="Fragment ".concat(i.sn)).call(o,n?" p: "+n.index:""," of level ")).call(s,i.level," finished buffering, but was aborted. state: ")).call(a,this.state)),void(this.state===$i&&(this.state=ji));var l=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),Ze(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}var u=this.media;u&&(!this._hasEnoughToStart&&u.buffered.length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),r&&this.tick())}},{key:"hasEnoughToStart",get:function(){return this._hasEnoughToStart}},{key:"onError",value:function(e,t){var i;if(t.fatal)this.state=Ji;else switch(t.details){case u.FRAG_GAP:case u.FRAG_PARSING_ERROR:case u.FRAG_DECRYPT_ERROR:case u.FRAG_LOAD_ERROR:case u.FRAG_LOAD_TIMEOUT:case u.KEY_LOAD_ERROR:case u.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(g.MAIN,t);break;case u.LEVEL_LOAD_ERROR:case u.LEVEL_LOAD_TIMEOUT:case u.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==tn||(null==(i=t.context)?void 0:i.type)!==d||(this.state=ji);break;case u.BUFFER_APPEND_ERROR:case u.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===u.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case u.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}},{key:"checkBuffer",value:function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){if(this._hasEnoughToStart||!Mt.getBuffered(e).length){var i=this.state,n=i!==ji?this.fragCurrent:null,r=this.getLevelDetails();t.poll(this.lastCurrentTime,n,r,i)}this.lastCurrentTime=e.currentTime}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=ji,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}},{key:"onBufferFlushed",value:function(e,t){var i=t.type;if(i!==qe||this.audioOnly&&!this.altAudio){var n=(i===Xe?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,i,g.MAIN),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,i=this.startPosition;if(i>=0){var n,r,a;if(e.seeking)return void this.log(Hy(n="could not seek to ".concat(i,", already seeking at ")).call(n,t));var s=this.getLevelDetails(),o=this.config.timelineOffset;o&&i&&(i+=(null==s?void 0:s.appliedTimelineOffset)||o);var l=Mt.getBuffered(e),u=l.length?l.start(0):0,c=u-i,h=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);c>0&&(c<h||this.loadingParts&&c<2*((null==s?void 0:s.partTarget)||0))&&(this.log("adjusting start position by ".concat(c," to match buffer start")),i+=c,this.startPosition=i),t<i&&(this.log(Hy(r=Hy(a="seek to target start position ".concat(i," from current time ")).call(a,t," buffer start ")).call(r,u)),e.currentTime=i)}}}},{key:"_getAudioCodec",value:function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==zy(t).call(t,"mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}},{key:"_loadBitrateTestFrag",value:function(e,t){var i=this;e.bitrateTest=!0,this._doFragLoad(e,t).then((function(e){var n=i.hls,r=null==e?void 0:e.frag;if(r&&!i.fragContextChanged(r)){t.fragmentError=0,i.state=ji,i.startFragRequested=!1,i.bitrateTest=!1;var a=r.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),n.trigger(c.FRAG_LOADED,e),r.bitrateTest=!1}}))}},{key:"_handleTransmuxComplete",value:function(e){var t,i=this.playlistType,n=this.hls,r=e.remuxResult,s=e.chunkMeta,o=this.getCurrentContext(s);if(o){var l=o.frag,u=o.part,h=o.level,d=r.video,f=r.text,v=r.id3,g=r.initSegment,p=h.details,m=this.altAudio?void 0:r.audio;if(this.fragContextChanged(l))this.fragmentTracker.removeFragment(l);else{if(this.state=Qi,g){if(null!=g&&g.tracks){var y=l.initSegment||l;this._bufferInitSegment(h,g.tracks,y,s),n.trigger(c.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:i,tracks:g.tracks})}var k=g.initPTS,T=g.timescale;a(k)&&(this.initPTS[l.cc]={baseTime:k,timescale:T},n.trigger(c.INIT_PTS_FOUND,{frag:l,id:i,initPTS:k,timescale:T}))}if(d&&p){var E=p.fragments[l.sn-1-p.startSN],S=l.sn===p.startSN,_=!E||l.cc>E.cc;if(!1!==r.independent){var b=d.startPTS,A=d.endPTS,R=d.startDTS,L=d.endDTS;if(u)u.elementaryStreams[d.type]={startPTS:b,endPTS:A,startDTS:R,endDTS:L};else if(d.firstKeyFrame&&d.independent&&1===s.id&&!_&&(this.couldBacktrack=!0),d.dropped&&d.independent){var I=this.getMainFwdBufferInfo(),C=(I?I.end:this.getLoadPosition())+this.config.maxBufferHole,w=d.firstKeyFramePTS?d.firstKeyFramePTS:b;if(!S&&C<w-this.config.maxBufferHole&&!_)return void this.backtrack(l);_&&(l.gap=!0),l.setElementaryStreamInfo(d.type,l.start,A,l.start,L,!0)}else S&&b-(p.appliedTimelineOffset||0)>2&&(l.gap=!0);l.setElementaryStreamInfo(d.type,b,A,R,L),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(d,l,u,s,S||_)}else{if(!S&&!_)return void this.backtrack(l);l.gap=!0}}if(m){var D=m.startPTS,x=m.endPTS,P=m.startDTS,O=m.endDTS;u&&(u.elementaryStreams[qe]={startPTS:D,endPTS:x,startDTS:P,endDTS:O}),l.setElementaryStreamInfo(qe,D,x,P,O),this.bufferFragmentData(m,l,u,s)}if(p&&null!=v&&null!=(t=v.samples)&&t.length){var M={id:i,frag:l,details:p,samples:v.samples};n.trigger(c.FRAG_PARSING_METADATA,M)}if(p&&f){var N={id:i,frag:l,details:p,samples:f.samples};n.trigger(c.FRAG_PARSING_USERDATA,N)}}}else this.resetWhenMissingContext(s)}},{key:"_bufferInitSegment",value:function(e,t,i,n){var r,a,s=this;if(this.state===Qi){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var o=t.audio,l=t.video,u=t.audiovideo;if(o){var h,d,f,v,g=H(o.codec,e.audioCodec);"mp4a"===g&&(g="mp4a.40.5");var p=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){g&&(g=-1!==zy(g).call(g,"mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");var m=o.metadata;m&&"channelCount"in m&&1!==(m.channelCount||1)&&-1===zy(p).call(p,"firefox")&&(g="mp4a.40.5")}g&&-1!==zy(g).call(g,"mp4a.40.5")&&-1!==zy(p).call(p,"android")&&"audio/mpeg"!==o.container&&(g="mp4a.40.2",this.log("Android: force audio codec to ".concat(g))),e.audioCodec&&e.audioCodec!==g&&this.log(Hy(h='Swapping manifest audio codec "'.concat(e.audioCodec,'" for "')).call(h,g,'"')),o.levelCodec=g,o.id="main",this.log(Hy(d=Hy(f=Hy(v="Init audio buffer, container:".concat(o.container,", codecs[selected/level/parsed]=[")).call(v,g||"","/")).call(f,e.audioCodec||"","/")).call(d,o.codec,"]")),delete t.audiovideo}if(l){var y,k,T;l.levelCodec=e.videoCodec,l.id="main";var E=l.codec;if(4===(null==E?void 0:E.length))switch(E){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(Hy(y=Hy(k=Hy(T="Init video buffer, container:".concat(l.container,", codecs[level/parsed]=[")).call(T,e.videoCodec||"","/")).call(k,E)).call(y,l.codec!==E?" parsed-corrected="+l.codec:"","}]")),delete t.audiovideo}u&&(this.log(Hy(r=Hy(a="Init audiovideo buffer, container:".concat(u.container,", codecs[level/parsed]=[")).call(a,e.codecs,"/")).call(r,u.codec,"]")),delete t.video,delete t.audio);var S=Cy(t);if(S.length){if(this.hls.trigger(c.BUFFER_CODECS,t),!this.hls)return;Py(S).call(S,(function(e){var r=t[e].initSegment;null!=r&&r.byteLength&&s.hls.trigger(c.BUFFER_APPENDING,{type:e,data:r,frag:i,part:null,chunkMeta:n,parent:i.type})}))}this.tickImmediate()}}},{key:"getMainFwdBufferInfo",value:function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,g.MAIN)}},{key:"maxBufferLength",get:function(){var e=this.levels,t=this.level,i=null==e?void 0:e[t];return i?this.getMaxBufferLength(i.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=ji}},{key:"checkFragmentChanged",value:function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var i=e.currentTime;if(Mt.isBuffered(e,i)?t=this.getAppendedFrag(i):Mt.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;var n=this.fragPlaying,r=t.level;n&&t.sn===n.sn&&n.level===r||(this.fragPlaying=t,this.hls.trigger(c.FRAG_CHANGED,{frag:t}),n&&n.level===r||this.hls.trigger(c.LEVEL_SWITCHED,{level:r}))}}}},{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 a(t)?this.getAppendedFrag(t):null}},{key:"currentProgramDateTime",get:function(){var e,t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(a(t)){var i=this.getLevelDetails(),n=this.currentFrag||(i?he(null,i.fragments,t):null);if(n){var r=n.programDateTime;if(null!==r){var s=r+1e3*(t-n.start);return new Date(s)}}}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}}]),i}(nn),fo=function(){function e(t){Zm(this,e),this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}return ey(e,[{key:"abort",value:function(e){for(var t in this.keyUriToKeyInfo){var i=this.keyUriToKeyInfo[t].loader;if(i){var n;if(e&&e!==(null==(n=i.context)?void 0:n.frag.type))return;i.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]:u.KEY_LOAD_ERROR,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;return new Dt({type:l.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:n})}},{key:"loadClear",value:function(e,t){var i=this;if(this.emeController&&this.config.emeEnabled)for(var n=e.sn,r=e.cc,a=function(){var e=t[s];if(r<=e.cc&&("initSegment"===n||"initSegment"===e.sn||n<e.sn))return i.emeController.selectKeySystemFormat(e).then((function(t){e.setKeyFormat(t)})),"break"},s=0;s<t.length&&"break"!==a();s++);}},{key:"load",value:function(e){var t=this;return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then((function(i){return t.loadInternal(e,i)})):this.loadInternal(e)}},{key:"loadInternal",value:function(e,t){var i,n;t&&e.setKeyFormat(t);var r=e.decryptdata;if(!r){var a=new Error(t?"Expected frag.decryptdata to be defined after setting format ".concat(t):"Missing decryption data on fragment in onKeyLoading");return nb.reject(this.createKeyLoadError(e,u.KEY_LOAD_ERROR,a))}var s=r.uri;if(!s)return nb.reject(this.createKeyLoadError(e,u.KEY_LOAD_ERROR,new Error('Invalid key URI: "'.concat(s,'"'))));var o,l=this.keyUriToKeyInfo[s];if(null!=(i=l)&&i.decryptdata.key)return r.key=l.decryptdata.key,nb.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 r.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:l}}))}switch(l=this.keyUriToKeyInfo[s]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return nb.reject(this.createKeyLoadError(e,u.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'.concat(r.method,'"'))))}}},{key:"loadKeyEME",value:function(e,t){var i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var n=this.emeController.loadKey(i);if(n)return(e.keyLoadPromise=n.then((function(t){return e.mediaKeySessionContext=t,i}))).catch((function(t){throw e.keyLoadPromise=null,t}))}return nb.resolve(i)}},{key:"loadKeyHTTP",value:function(e,t){var i=this,n=this.config,r=new n.loader(n);return t.keyLoader=e.loader=r,e.keyLoadPromise=new nb((function(a,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},h={onSuccess:function(e,t,n,r){var o=n.frag,l=n.keyInfo,c=n.url;if(!o.decryptdata||l!==i.keyUriToKeyInfo[c])return s(i.createKeyLoadError(o,u.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),r));l.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,l.loader=null,a({frag:o,keyInfo:l})},onError:function(e,n,r,a){var l;i.resetLoader(n),s(i.createKeyLoadError(t,u.KEY_LOAD_ERROR,new Error(Hy(l="HTTP Error ".concat(e.code," loading key ")).call(l,e.text)),r,E({url:o.url,data:void 0},e)))},onTimeout:function(e,n,r){i.resetLoader(n),s(i.createKeyLoadError(t,u.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),r))},onAbort:function(e,n,r){i.resetLoader(n),s(i.createKeyLoadError(t,u.INTERNAL_ABORTED,new Error("key loading aborted"),r))}};r.load(o,c,h)}))}},{key:"resetLoader",value:function(e){var t=e.frag,i=e.keyInfo,n=e.url,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[n],r&&r.destroy()}}]),e}();function vo(e){switch(e.type){case f:return g.AUDIO;case v:return g.SUBTITLE;default:return g.MAIN}}function go(e,t){var i=e.url;return void 0!==i&&0!==zy(i).call(i,"data:")||(i=t.url),i}var po=function(){function e(t){Zm(this,e),this.hls=void 0,this.loaders=MI(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=t,this.registerListeners()}return ey(e,[{key:"startLoad",value:function(e){}},{key:"stopLoad",value:function(){this.destroyInternalLoaders()}},{key:"registerListeners",value:function(){var e=this.hls;e.on(c.MANIFEST_LOADING,this.onManifestLoading,this),e.on(c.LEVEL_LOADING,this.onLevelLoading,this),e.on(c.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(c.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(c.LEVELS_UPDATED,this.onLevelsUpdated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(c.MANIFEST_LOADING,this.onManifestLoading,this),e.off(c.LEVEL_LOADING,this.onLevelLoading,this),e.off(c.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(c.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(c.LEVELS_UPDATED,this.onLevelsUpdated,this)}},{key:"createInternalLoader",value:function(e){var t=this.hls.config,i=t.pLoader,n=t.loader,r=new(i||n)(t);return this.loaders[e.type]=r,r}},{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 i=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:h,url:i,deliveryDirectives:null,levelOrTrack:null})}},{key:"onLevelLoading",value:function(e,t){var i=t.id,n=t.level,r=t.pathwayId,a=t.url,s=t.deliveryDirectives,o=t.levelInfo;this.load({id:i,level:n,pathwayId:r,responseType:"text",type:d,url:a,deliveryDirectives:s,levelOrTrack:o})}},{key:"onAudioTrackLoading",value:function(e,t){var i=t.id,n=t.groupId,r=t.url,a=t.deliveryDirectives,s=t.track;this.load({id:i,groupId:n,level:null,responseType:"text",type:f,url:r,deliveryDirectives:a,levelOrTrack:s})}},{key:"onSubtitleTrackLoading",value:function(e,t){var i=t.id,n=t.groupId,r=t.url,a=t.deliveryDirectives,s=t.track;this.load({id:i,groupId:n,level:null,responseType:"text",type:v,url:r,deliveryDirectives:a,levelOrTrack:s})}},{key:"onLevelsUpdated",value:function(e,t){var i=this.loaders[d];if(i){var n,r=i.context;r&&!Yy(n=t.levels).call(n,(function(e){return e===r.levelOrTrack}))&&(i.abort(),delete this.loaders[d])}}},{key:"load",value:function(e){var t,i,n,r=this,s=this.hls.config,o=this.getInternalLoader(e);if(o){var l,u=this.hls.logger,c=o.context;if(c&&c.levelOrTrack===e.levelOrTrack&&(c.url===e.url||c.deliveryDirectives&&!e.deliveryDirectives))return void(c.url===e.url?u.log("[playlist-loader]: ignore ".concat(e.url," ongoing request")):u.log(Hy(l="[playlist-loader]: ignore ".concat(e.url," in favor of ")).call(l,c.url)));u.log("[playlist-loader]: aborting previous loader for type: ".concat(e.type)),o.abort()}if(i=e.type===h?s.manifestLoadPolicy.default:k({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),o=this.createInternalLoader(e),a(null==(t=e.deliveryDirectives)?void 0:t.part)&&(e.type===d&&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===v&&null!==e.id&&(n=this.hls.subtitleTracks[e.id].details),n)){var g=n.partTarget,p=n.targetduration;if(g&&p){var m=1e3*Math.max(3*g,.8*p);i=k({},i,{maxTimeToFirstByteMs:Math.min(m,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(m,i.maxTimeToFirstByteMs)})}}var y=i.errorRetry||i.timeoutRetry||{},T={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:y.maxNumRetry||0,retryDelay:y.retryDelayMs||0,maxRetryDelay:y.maxRetryDelayMs||0},E={onSuccess:function(e,t,i,n){var a=r.getInternalLoader(i);r.resetInternalLoader(i.type);var s=e.data;0===zy(s).call(s,"#EXTM3U")?(t.parsing.start=performance.now(),ki.isMediaPlaylist(s)||i.type!==h?r.handleTrackOrLevelPlaylist(e,t,i,n||null,a):r.handleMasterPlaylist(e,t,i,n)):r.handleManifestParsingError(e,i,new Error("no EXTM3U delimiter"),n||null,t)},onError:function(e,t,i,n){r.handleNetworkError(t,i,!1,e,n)},onTimeout:function(e,t,i){r.handleNetworkError(t,i,!0,void 0,e)}};o.load(e,T,E)}},{key:"checkAutostartLoad",value:function(){var e;if(this.hls){var t=this.hls,i=t.config,n=i.autoStartLoad,r=i.startPosition,a=t.forceStartLoad;(n||a)&&(this.hls.logger.log(Hy(e="".concat(n?"auto":"force"," startLoad with configured startPosition ")).call(e,r)),this.hls.startLoad(r))}}},{key:"handleMasterPlaylist",value:function(e,t,i,n){var r=this.hls,a=e.data,s=go(e,i),o=ki.parseMasterPlaylist(a,s);if(o.playlistParsingError)this.handleManifestParsingError(e,i,o.playlistParsingError,n,t);else{var l=o.contentSteering,u=o.levels,h=o.sessionData,d=o.sessionKeys,f=o.startTimeOffset,v=o.variableList;this.variableList=v;var g=ki.parseMasterPlaylistMedia(a,s,o),p=g.AUDIO,m=void 0===p?[]:p,y=g.SUBTITLES,k=g["CLOSED-CAPTIONS"];m.length&&(Yy(m).call(m,(function(e){return!e.url}))||!u[0].audioCodec||u[0].attrs.AUDIO||(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Kt({}),bitrate:0,url:""}))),r.trigger(c.MANIFEST_LOADED,{levels:u,audioTracks:m,subtitles:y,captions:k,contentSteering:l,url:s,stats:t,networkDetails:n,sessionData:h,sessionKeys:d,startTimeOffset:f,variableList:v})}}},{key:"handleTrackOrLevelPlaylist",value:function(e,t,i,n,r){var s=this.hls,o=i.id,l=i.level,u=i.type,d=go(e,i),f=a(l)?l:a(o)?o:0,v=vo(i),g=ki.parseLevelPlaylist(e.data,d,f,v,0,this.variableList);if(u===h){var p={attrs:new Kt({}),bitrate:0,details:g,name:"",url:d};g.requestScheduled=t.loading.start+Oi(g,0),s.trigger(c.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:d,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,n,r)}},{key:"handleManifestParsingError",value:function(e,t,i,n,r){this.hls.trigger(c.ERROR,{type:l.NETWORK_ERROR,details:u.MANIFEST_PARSING_ERROR,fatal:t.type===h,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:r})}},{key:"handleNetworkError",value:function(e,t){var i,n,r,a=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,g=Hy(i="A network ".concat(a?"timeout":"error"+(s?" (status "+s.code+")":"")," occurred while loading ")).call(i,e.type);e.type===d?g+=Hy(n=": ".concat(e.level," id: ")).call(n,e.id):e.type!==f&&e.type!==v||(g+=Hy(r=" id: ".concat(e.id,' group-id: "')).call(r,e.groupId,'"'));var p=new Error(g);this.hls.logger.warn("[playlist-loader]: ".concat(g));var m=u.UNKNOWN,y=!1,k=this.getInternalLoader(e);switch(e.type){case h:m=a?u.MANIFEST_LOAD_TIMEOUT:u.MANIFEST_LOAD_ERROR,y=!0;break;case d:m=a?u.LEVEL_LOAD_TIMEOUT:u.LEVEL_LOAD_ERROR,y=!1;break;case f:m=a?u.AUDIO_TRACK_LOAD_TIMEOUT:u.AUDIO_TRACK_LOAD_ERROR,y=!1;break;case v:m=a?u.SUBTITLE_TRACK_LOAD_TIMEOUT:u.SUBTITLE_LOAD_ERROR,y=!1}k&&this.resetInternalLoader(e.type);var T={type:l.NETWORK_ERROR,details:m,fatal:y,url:e.url,loader:k,context:e,error:p,networkDetails:t,stats:o};if(s){var S=(null==t?void 0:t.url)||e.url;T.response=E({url:S,data:void 0},s)}this.hls.trigger(c.ERROR,T)}},{key:"handlePlaylistLoaded",value:function(e,t,i,n,r,a){var s=this.hls,o=n.type,p=n.level,m=n.id,y=n.groupId,k=n.deliveryDirectives,T=go(t,n),E=vo(n),S="number"==typeof n.level&&E===g.MAIN?p:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var _=e.playlistParsingError;if(_)s.trigger(c.ERROR,{type:l.NETWORK_ERROR,details:u.LEVEL_PARSING_ERROR,fatal:!1,url:T,error:_,reason:_.message,response:t,context:n,level:S,parent:E,networkDetails:r,stats:i});else switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),a.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),o){case h:case d:s.trigger(c.LEVEL_LOADED,{details:e,levelInfo:n.levelOrTrack||s.levels[0],level:S||0,id:m||0,stats:i,networkDetails:r,deliveryDirectives:k,withoutMultiVariant:o===h});break;case f:s.trigger(c.AUDIO_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:m||0,groupId:y||"",stats:i,networkDetails:r,deliveryDirectives:k});break;case v:s.trigger(c.SUBTITLE_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:m||0,groupId:y||"",stats:i,networkDetails:r,deliveryDirectives:k})}}else{var b=e.playlistParsingError=new Error("No Segments found in Playlist");s.trigger(c.ERROR,{type:l.NETWORK_ERROR,details:u.LEVEL_EMPTY_ERROR,fatal:!1,url:T,error:b,reason:b.message,response:t,context:n,level:S,parent:E,networkDetails:r,stats:i})}}}]),e}(),mo=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Zm(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 sn,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 i,n,r,a=this.logger=function(e,t,i){var n=A();if("object"==("undefined"==typeof console?"undefined":qh(console))&&!0===e||"object"==qh(e)){var r=["debug","log","info","warn","error"];Py(r).call(r,(function(t){n[t]=R(t,e,i)}));try{n.log('Debug logs enabled for "'.concat(t,'" in hls.js version 1.6.0-beta.2'))}catch(a){return A()}Py(r).call(r,(function(t){L[t]=R(t,e)}))}else k(L,n);return n}(t.debug||!1,"Hls instance",t.assetPlayerId),s=this.config=function(e,t,i,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 r=Js(e),a=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return Py(n=["manifest","level","frag"]).call(n,(function(e){var n,s,o="".concat("level"===e?"playlist":e,"LoadPolicy"),l=void 0===t[o],u=[];Py(a).call(a,(function(i){var n,a=Hy(n="".concat(e,"Loading")).call(n,i),s=t[a];if(void 0!==s&&l){u.push(a);var c=r[o].default;switch(t[o]={default:c},i){case"TimeOut":c.maxLoadTimeMs=s,c.maxTimeToFirstByteMs=s;break;case"MaxRetry":c.errorRetry.maxNumRetry=s,c.timeoutRetry.maxNumRetry=s;break;case"RetryDelay":c.errorRetry.retryDelayMs=s,c.timeoutRetry.retryDelayMs=s;break;case"MaxRetryTimeout":c.errorRetry.maxRetryDelayMs=s,c.timeoutRetry.maxRetryDelayMs=s}}})),u.length&&i.warn(Hy(n=Hy(s='hls.js config: "'.concat(u.join('", "'),'" setting(s) are deprecated, use "')).call(s,o,'": ')).call(n,bI(t[o])))})),E(E({},r),t)}(e.DefaultConfig,t,a);this.userConfig=t,s.progressive&&(n=a,(r=(i=s).loader)!==zs&&r!==$s?(n.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):js()&&(i.loader=zs,i.progressive=!0,i.enableSoftwareAES=!0,n.log("[config]: Progressive streaming enabled, using FetchLoader")));var o=s.abrController,l=s.bufferController,u=s.capLevelController,h=s.errorController,d=s.fpsController,f=new h(this),v=this.abrController=new o(this),g=new Ie(this),p=s.interstitialsController,m=p?this.interstitialsController=new p(this,e):null,y=this.bufferController=new l(this,g),T=this.capLevelController=new u(this),S=new d(this),_=new po(this),b=s.contentSteeringController,I=b?new b(this):null,C=this.levelController=new ao(this,I),w=new no(this),D=new fo(this.config),x=this.streamController=new ho(this,g,D);T.setStreamController(x),S.setStreamController(x);var P=[_,C,x];m&&mw(P).call(P,1,0,m),I&&mw(P).call(P,1,0,I),this.networkControllers=P;var O=[v,y,T,S,w,g];this.audioTrackController=this.createController(s.audioTrackController,P);var M=s.audioStreamController;M&&P.push(new M(this,g,D)),this.subtitleTrackController=this.createController(s.subtitleTrackController,P);var N=s.subtitleStreamController;N&&P.push(new N(this,g,D)),this.createController(s.timelineController,O),D.emeController=this.emeController=this.createController(s.emeController,O),this.cmcdController=this.createController(s.cmcdController,O),this.latencyController=this.createController(ro,O),this.coreComponents=O,P.push(f);var F=f.onErrorOut;"function"==typeof F&&this.on(c.ERROR,F,f),this.on(c.MANIFEST_LOADED,_.onManifestLoaded,_)}return ey(e,[{key:"createController",value:function(e,t){if(e){var i=new e(this);return t&&t.push(i),i}return null}},{key:"on",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.on(e,t,i)}},{key:"once",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.once(e,t,i)}},{key:"removeAllListeners",value:function(e){this._emitter.removeAllListeners(e)}},{key:"off",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this,n=arguments.length>3?arguments[3]:void 0;this._emitter.off(e,t,i,n)}},{key:"listeners",value:function(e){return this._emitter.listeners(e)}},{key:"emit",value:function(e,t,i){return this._emitter.emit(e,t,i)}},{key:"trigger",value:function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;var i=e===c.ERROR;this.trigger(c.ERROR,{type:l.OTHER_ERROR,details:u.INTERNAL_EXCEPTION,fatal:i,event:e,error:n}),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(c.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,Py(e=this.networkControllers).call(e,(function(e){return e.destroy()})),this.networkControllers.length=0,Py(t=this.coreComponents).call(t,(function(e){return e.destroy()})),this.coreComponents.length=0;var i=this.config;i.xhrSetup=i.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(c.ERROR,{type:l.OTHER_ERROR,details:u.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 i="media"in e,n=i?e.media:e,r=i?e:{media:n};this._media=n,this.trigger(c.MEDIA_ATTACHING,r)}}},{key:"detachMedia",value:function(){this.logger.log("detachMedia"),this.trigger(c.MEDIA_DETACHING,{}),this._media=null}},{key:"transferMedia",value:function(){this._media=null;var e=this.bufferController.transferMedia();return this.trigger(c.MEDIA_DETACHING,{transferMedia:e}),e}},{key:"loadSource",value:function(e){this.stopLoad();var t=this.media,i=this._url,n=this._url=Ye.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:".concat(n)),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(c.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 i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),this.started&&this.networkControllers);i++);}},{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"),Py(e=this.networkControllers).call(e,(function(e){e.resumeBuffering&&e.resumeBuffering()})))}},{key:"pauseBuffering",value:function(){var e;this.bufferingEnabled&&(this.logger.log("pause buffering"),Py(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=tI.createObjectURL(new Blob),t=e.toString();return tI.revokeObjectURL(e),iI(t).call(t,aC(t).call(t,"/")+1)}catch(r){var i=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(i+16*Math.random())%16|0;return i=Math.floor(i/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,zy(z).call(z,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 i=e.length,n=0;n<i;n++)if(e[n].maxBitrate>=t)return n;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,i=this.autoLevelCapping,n=this.maxHdcpLevel;if(e=-1===i&&null!=t&&t.length?t.length-1:i,n)for(var r=e;r--;){var a=t[r].attrs["HDCP-LEVEL"];if(a&&a<=n)return r}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 Y(e,ie(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.allAudioTracks),navigator.mediaCapabilities)}}],[{key:"version",get:function(){return on}},{key:"isMSESupported",value:function(){return uo()}},{key:"isSupported",value:function(){return co()}},{key:"getMediaSource",value:function(){return C()}},{key:"Events",get:function(){return c}},{key:"MetadataSchema",get:function(){return Dn}},{key:"ErrorTypes",get:function(){return l}},{key:"ErrorDetails",get:function(){return u}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:Zs},set:function(t){e.defaultConfig=t}}]),e}();mo.defaultConfig=void 0;var yo=dO({__proto__:null,AbrController:ue,AttrList:Kt,AudioStreamController:Mr,AudioTrackController:Fr,BasePlaylistController:Nr,BaseSegment:$e,BaseStreamController:nn,BufferController:Vr,CMCDController:Ea,CapLevelController:jr,ChunkMetadata:Pt,ContentSteeringController:Sa,Cues:Ws,DateRange:jt,EMEController:Aa,ErrorActionFlags:Ee,ErrorController:Se,ErrorDetails:u,ErrorTypes:l,Events:c,FPSController:La,FetchLoader:zs,Fragment:Je,Hls:mo,HlsSkip:X,HlsUrlParameters:$,KeySystemFormats:ei,KeySystems:Jt,Level:Z,LevelDetails:Yt,LevelKey:fi,LoadStats:ze,MetadataSchema:Dn,NetworkErrorAction:Te,Part:et,PlaylistLevelType:g,SubtitleStreamController:za,SubtitleTrackController:Pa,TimelineController:Hs,XhrLoader:$s,default:mo,fetchSupported:js,getMediaSource:C,isMSESupported:uo,isSupported:co,requestMediaKeySystemAccess:ci}),ko={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}},To=function(e){Qm(n,e);var i=$m(n);function n(e){var t;Zm(this,n),(t=i.call(this,e))._tickInterval=500,t._onPlay=function(){t.hls.startLoad()},t.onUrlChange=function(e){/^blob/.test(e)||(t.playerConfig.url=e,t.register(e))},t._getBufferend=function(e){var t=e.buffered;return t&&t.length?t.end(t.length-1):0},t._tick=function(){clearTimeout(t._tickTimer);var e=t.player.media;if(e){t._tickTimer=gC(t._tick,t._tickInterval);var i=t._getBufferend(e);i<.1||!e.readyState||t.player.config.isLive&&4===e.readyState&&e.paused&&i-e.currentTime>t.config.disconnectTime&&t.hls.stopLoad()}},t.on=function(e,i){var n;null==(n=t.hls)||n.on(e,i)};var r=e.config||{};return t.config=r,t.player.handleSource=!1,t}return ey(n,[{key:"beforePlayerInit",value:function(){this.register(this.player.config.url)}},{key:"initEvt",value:function(){var e=this;this.hls.on(mo.Events.SUBTITLE_FRAG_PROCESSED,(function(t,i){var n=i.frag;e.player.emit("core_event",{eventName:"core.subtitlesegments",list:n})})),this.hls.on(mo.Events.MANIFEST_PARSED,(function(t,i){var n=i.levels;e.player.emit("core_event",{eventName:"core.subtitleplaylist",list:n})})),this.hls.on(mo.Events.MANIFEST_LOADING,(function(t,i){var n=i.url;e.player.emit("core_event",{eventName:"core.loadstart",url:n})})),this.hls.on(mo.Events.LEVEL_LOADING,(function(t,i){var n=i.url;e.player.emit("core_event",{eventName:"core.loadstart",url:n})})),this.hls.on(mo.Events.FRAG_LOADING,(function(t,i){var n=i.frag;e.player.emit("core_event",{eventName:"core.loadstart",url:n.url})})),this.hls.on(mo.Events.MANIFEST_LOADED,(function(t,i){var n=i.url;e.player.emit("core_event",{eventName:"core.loadcomplete",url:n})})),this.hls.on(mo.Events.LEVEL_LOADED,(function(t,i){var n=i.details,r=i.stats;e.player.emit("core_event",ed(ed({eventName:"core.loadcomplete"},r),{},{url:null==n?void 0:n.url}))})),this.hls.on(mo.Events.FRAG_LOADED,(function(t,i){var n=i.frag;e.player.emit("core_event",{eventName:"core.loadcomplete",url:n.url})})),this.hls.on(mo.Events.FRAG_PARSING_USERDATA,(function(t,i){var n=i.samples;e.player.emit("core_event",{eventName:"core.sei",sei:n})})),this.hls.on(mo.Events.MANIFEST_LOADED,(function(t,i){var n=i.levels,r=i.networkDetails;e.player.emit("core_event",{eventName:"core.hlsmanifestloaded",playlist:n}),e.player.emit("core_event",{eventName:"core.loadresponseheaders",headers:r.headers})})),this.hls.on(mo.Events.LEVEL_LOADED,(function(t,i){var n,r=i.details,a={};Py(n=Cy(r.dateRanges)).call(n,(function(e){a[e]=r.dateRanges[e].attr["START-DATE"]})),e.player.emit("core_event",{eventName:"core.hlslevelloaded",playlist:ed(ed({},r),{},{segments:r.fragments,dateRanges:a})})})),this.hls.on(mo.Events.ERROR,(function(t,i){var n=i.details,r=i.fatal,a=i.type,s=i.response,o=i.reason;if(r){var l,u;switch(a){case mo.ErrorTypes.NETWORK_ERROR:l=2100,bP(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:i});break;case mo.ErrorTypes.MEDIA_ERROR:u="media",n===mo.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR?l=5104:n===mo.ErrorDetails.FRAG_DECRYPT_ERROR?l=5105:n===mo.ErrorDetails.FRAG_PARSING_ERROR?(l=1100,u="manifest"):n===mo.ErrorDetails.FRAG_GAP?l=5104:n===mo.ErrorDetails.BUFFER_ADD_CODEC_ERROR?l=5200:n===mo.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR?l=5104:n===mo.ErrorDetails.BUFFER_APPEND_ERROR||n===mo.ErrorDetails.BUFFER_APPENDING_ERROR?l=5201:n===mo.ErrorDetails.BUFFER_STALLED_ERROR||n===mo.ErrorDetails.BUFFER_FULL_ERROR?l=5203:(n===mo.ErrorDetails.BUFFER_SEEK_OVER_HOLE||n===mo.ErrorDetails.BUFFER_NUDGE_ON_STALL)&&(l=5202),e.player.emit("error",{errorType:u||a,errorCode:l,errorMessage:n,originError:i});break;case mo.ErrorTypes.MUX_ERROR:l=4100,e.player.emit("error",{errorType:"remux",errorCode:l,errorMessage:n,originError:i});break;case mo.ErrorTypes.KEY_SYSTEM_ERROR:l=7111,n===mo.ErrorDetails.KEY_SYSTEM_NO_KEYS?l=7103:n===mo.ErrorDetails.KEY_SYSTEM_NO_ACCESS?l=7101:n===mo.ErrorDetails.KEY_SYSTEM_NO_SESSION?l=7104:n===mo.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE?l=7107:n===mo.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED?l=7108:n===mo.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED||n===mo.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED?l=7110:n===mo.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED?l=7104:n===mo.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR&&(l=7111),e.player.emit("error",{errorType:"drm",errorCode:l,errorMessage:o||n,originError:i});break;default:n===mo.ErrorDetails.LEVEL_SWITCH_ERROR&&(l=2100,u="network"),e.player.emit("error",{errorType:u||"other",errorCode:l,errorMessage:o||n,originError:i})}try{e.hls.stopLoad(),e.player.pause()}catch(c){}}})),this.hls.on(mo.Events.MEDIA_ATTACHED,(function(){e.player.emit("sourceopen")})),this.hls.on(mo.Events.BUFFER_APPENDED,(function(){e.player.emit("bufferappend")}))}},{key:"afterCreate",value:function(){var e=this.player.media;this.player.on(t.Events.URL_CHANGE,this.onUrlChange);try{t.BasePlugin.defineGetterOrSetter(this.player,{url:{get:function(){try{return e.src}catch(t){return null}},configurable:!0}})}catch(i){}}},{key:"register",value:function(e){var t=this.player;this.hls&&this.hls.destroy();var i=function(e){var t,i={};Py(t=Cy(ko)).call(t,(function(t){var n=ko[t];i[t]=e[n.key]||n.val}));var n="number"==typeof e.retryCount?e.retryCount:3,r="number"==typeof e.retryDelay?e.retryDelay:1e3,a=e.loadTimeout||1e4,s="number"==typeof e.manifestLoadTimeout?e.manifestLoadTimeout:1e4,o={maxNumRetry:n,retryDelayMs:r,maxRetryDelayMs:r,shouldRetry:function(e,t){return t<e.maxNumRetry}},l={maxNumRetry:n,retryDelayMs:r,maxRetryDelayMs:r,shouldRetry:function(e,t){return t<e.maxNumRetry}};return i.manifestLoadPolicy={default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:s,timeoutRetry:o,errorRetry:l}},i.playlistLoadPolicy={default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:a,timeoutRetry:o,errorRetry:l}},i.fragLoadPolicy={default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:a,timeoutRetry:o,errorRetry:l}},ed(ed({},i),e)}(this.config,t.config);this.hls=new mo(i),this.initEvt(),t.config.preProcessUrl&&(e=t.config.preProcessUrl(e).url),this.hls.loadSource(e);var n=this.player.media;this.hls.attachMedia(n),clearTimeout(this._tickTimer),this._tickTimer=gC(this._tick,this._tickInterval),n.removeEventListener("play",this._onPlay),n.addEventListener("play",this._onPlay)}},{key:"destroy",value:function(){clearTimeout(this._tickTimer),this.player.off(t.Events.URL_CHANGE,this.onUrlChange),this.hls.destroy()}}],[{key:"pluginName",get:function(){return"hls"}}]),n}(t.BasePlugin);e.HLS=yo,e.Hls=mo,e.default=To,dy(e,"__esModule",{value:!0})})(fO.exports,n(Object.freeze({__proto__:null,BasePlugin:nF,CssFullscreenIcon:WB,Danmu:LH,DanmuIcon:RH,DanmuPanel:bH,DefaultPreset:pH,DefaultPresetEn:yH,Errors:GM,Events:UN,FullscreenIcon:cB,HeatMap:UG,I18N:IF,InstManager:PF,LivePreset:kH,Loading:WU,MobilePreset:TH,PlayIcon:aB,Plugin:pF,Progress:nB,STATES:CF,STATE_CLASS:TF,SimplePlayer:UF,Sniffer:FM,Start:tU,TextTrack:IG,TimeIcon:hB,Util:DM,VolumeIcon:pB,default:mH,langBr:{LANG:"br",TEXT:{ERROR_TYPES:{network:{code:1,msg:"erro de download de vídeo"},mse:{code:2,msg:"erro de anexação de fluxo"},parse:{code:3,msg:"erro de análise"},format:{code:4,msg:"formato incorreto"},decoder:{code:5,msg:"erro de decodificação"},runtime:{code:6,msg:"erros gramaticais"},timeout:{code:7,msg:"tempo limite de reprodução"},other:{code:8,msg:"outros erros"}},HAVE_NOTHING:"Não há informações sobre se o áudio/vídeo está pronto",HAVE_METADATA:"Os metadados de áudio/vídeo estão prontos ",HAVE_CURRENT_DATA:"Os dados sobre a localização de reprodução atual estão disponíveis, mas não há dados suficientes para reproduzir o próximo quadro/milissegundo",HAVE_FUTURE_DATA:"Atual e pelo menos um quadro de dados está disponível",HAVE_ENOUGH_DATA:"Os dados disponíveis são suficientes para começar a jogar",NETWORK_EMPTY:"O áudio/vídeo não foi inicializado",NETWORK_IDLE:"O áudio/vídeo está ativo e foi selecionado para recursos, mas nenhuma rede está sendo usada",NETWORK_LOADING:"O navegador está baixando os dados",NETWORK_NO_SOURCE:"Nenhuma fonte de áudio/vídeo foi encontrada",MEDIA_ERR_ABORTED:"O processo de busca é abortado pelo usuário",MEDIA_ERR_NETWORK:"Ocorreu um erro durante o download",MEDIA_ERR_DECODE:"Ocorreu um erro durante a decodificação",MEDIA_ERR_SRC_NOT_SUPPORTED:"Não há suporte para áudio/vídeo",REPLAY:"Repetir",ERROR:"A rede está offline",PLAY_TIPS:"Reproduzir",PAUSE_TIPS:"Pausar",PLAYNEXT_TIPS:"Reproduzir próximo",DOWNLOAD_TIPS:"Baixar",ROTATE_TIPS:"Girar",RELOAD_TIPS:"Recarregar",FULLSCREEN_TIPS:"Tela cheia",EXITFULLSCREEN_TIPS:"Sair da tela cheia",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Sair da cssfullscreen",TEXTTRACK:"Legenda",PIP:"PIP",SCREENSHOT:"Captura de tela",LIVE:"AO VIVO",OFF:"Desligado",OPEN:"Abrir",MINI_DRAG:"Clique e segure para arrastar",MINISCREEN:"Minitela",REFRESH_TIPS:"Tente",REFRESH:"Atualizar",FORWARD:"encaminhar",LIVE_TIP:"Ao vivo"}},langDe:{LANG:"de",TEXT:{ERROR_TYPES:{network:{code:1,msg:"Fehler beim Herunterladen des Videos"},mse:{code:2,msg:"Fehler beim Anhängen des Streams"},parse:{code:3,msg:"Fehler beim Parsen"},format:{code:4,msg:"falsches Format"},decoder:{code:5,msg:"Dekodierungsfehler"},runtime:{code:6,msg:"grammatikalische Fehler"},timeout:{code:7,msg:"Wiedergabeunterbrechung"},other:{code:8,msg:"andere Fehler"}},HAVE_NOTHING:"Es sind keine Informationen darüber vorhanden, ob Audio/Video wiedergabebereit ist",HAVE_METADATA:"Audio-/Video-Metadaten können genutzt werden ",HAVE_CURRENT_DATA:"Es sind Daten über die aktuelle Wiedergabeposition verfügbar, jedoch reichen diese nicht aus, um den nächsten Frame / die nächste Millisekunde wiederzugeben",HAVE_FUTURE_DATA:"Das aktuelle und mindestens ein Datenframe ist verfügbar",HAVE_ENOUGH_DATA:"Die verfügbaren Daten reichen aus, um die Wiedergabe zu starten",NETWORK_EMPTY:"Audio/Video wurde nicht initialisiert",NETWORK_IDLE:"Audio/Video ist aktiv und wurde für die Ressourcen ausgewählt, aber es wird kein Netzwerk verwendet",NETWORK_LOADING:"Der Browser lädt die Daten herunter",NETWORK_NO_SOURCE:"Keine Audio-/Videoquelle gefunden",MEDIA_ERR_ABORTED:"Der Abrufvorgang wurde vom Benutzer abgebrochen",MEDIA_ERR_NETWORK:"Beim Herunterladen ist ein Fehler aufgetreten",MEDIA_ERR_DECODE:"Bei der Entschlüsselung ist ein Fehler aufgetreten",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/Video wird nicht unterstützt",REPLAY:"Erneute Wiedergabe",ERROR:"Das Netzwerk ist offline",PLAY_TIPS:"Wiedergabe",PAUSE_TIPS:"Anhalten",PLAYNEXT_TIPS:"Nächstes wiedergeben",DOWNLOAD_TIPS:"Herunterladen",ROTATE_TIPS:"Drehen",RELOAD_TIPS:"Neu laden",FULLSCREEN_TIPS:"Vollbildschirm",EXITFULLSCREEN_TIPS:"Vollbildschirm beenden",CSSFULLSCREEN_TIPS:"CSS-Vollbildschirm",EXITCSSFULLSCREEN_TIPS:"CSS-Vollbildschirm beenden",TEXTTRACK:"Beschriftung",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LIVE",OFF:"Aus",OPEN:"Öffnen",MINI_DRAG:"Klicken und zum Ziehen halten",MINISCREEN:"Miniaturbildschirm",REFRESH_TIPS:"Bitte versuchen",REFRESH:"Aktualisieren",FORWARD:"weiterleiten",LIVE_TIP:"Live"}},langEn:_F,langEs:{LANG:"es",TEXT:{ERROR_TYPES:{network:{code:1,msg:"error de descarga de vídeo"},mse:{code:2,msg:"error al añadir emisión"},parse:{code:3,msg:"error de análisis"},format:{code:4,msg:"formato incorrecto"},decoder:{code:5,msg:"error de descodificación"},runtime:{code:6,msg:"errores gramaticales"},timeout:{code:7,msg:"tiempo de espera de reproducción agotado"},other:{code:8,msg:"otros errores"}},HAVE_NOTHING:"No hay información sobre si el audio o el vídeo están listos",HAVE_METADATA:"Los metadatos de audio o vídeo están listos ",HAVE_CURRENT_DATA:"Los datos sobre la ubicación de reproducción actual están disponibles, pero no hay suficientes datos para reproducir el siguiente marco/milisegundo",HAVE_FUTURE_DATA:"El marco de datos actual y al menos uno más están disponibles",HAVE_ENOUGH_DATA:"Los datos disponibles son suficientes para iniciar la reproducción",NETWORK_EMPTY:"El audio o el vídeo no se han iniciado",NETWORK_IDLE:"El audio o el vídeo están activos y se han seleccionado para los recursos, pero no se utiliza ninguna red",NETWORK_LOADING:"El navegador está descargando los datos",NETWORK_NO_SOURCE:"No se ha encontrado ninguna fuente de audio o vídeo",MEDIA_ERR_ABORTED:"El usuario ha cancelado el proceso de recuperación",MEDIA_ERR_NETWORK:"Se ha producido un error al descargar",MEDIA_ERR_DECODE:"Se ha producido un error al descodificar",MEDIA_ERR_SRC_NOT_SUPPORTED:"El audio o el vídeo no son compatibles",REPLAY:"Volver a reproducir",ERROR:"La red está fuera de línea",PLAY_TIPS:"Reproducir",PAUSE_TIPS:"Pausar",PLAYNEXT_TIPS:"Reproducir siguiente",DOWNLOAD_TIPS:"Descargar",ROTATE_TIPS:"Girar",RELOAD_TIPS:"Cargar de nuevo",FULLSCREEN_TIPS:"Pantalla completa",EXITFULLSCREEN_TIPS:"Salir de la pantalla completa",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Salir de cssfullscreen",TEXTTRACK:"Subtítulo",PIP:"PIP",SCREENSHOT:"Captura de pantalla",LIVE:"EN DIRECTO",OFF:"Desactivado",OPEN:"Abrir",MINI_DRAG:"Haz clic y mantén pulsado para arrastrar",MINISCREEN:"Minipantalla",REFRESH_TIPS:"Inténtalo",REFRESH:"Volver a cargar",FORWARD:"reenviar",LIVE_TIP:"En directo"}},langFr:{LANG:"fr",TEXT:{ERROR_TYPES:{network:{code:1,msg:"erreur de téléchargement vidéo"},mse:{code:2,msg:"erreur d'ajout du stream"},parse:{code:3,msg:"erreur d'analyse"},format:{code:4,msg:"format erroné"},decoder:{code:5,msg:"erreur de décodage"},runtime:{code:6,msg:"erreurs grammaticales"},timeout:{code:7,msg:"lecture expirée"},other:{code:8,msg:"autres erreurs"}},HAVE_NOTHING:"Il n'y a pas d'information sur la disponibilité de l'audio/vidéo",HAVE_METADATA:"Les métadonnées audio/vidéo sont prêtes ",HAVE_CURRENT_DATA:"Les données relatives à l'emplacement de lecture actuel sont disponibles, mais les données ne sont pas suffisantes pour lire l'image/la milliseconde suivante",HAVE_FUTURE_DATA:"Trame de données actuelles (au moins une) disponible",HAVE_ENOUGH_DATA:"Les données disponibles sont suffisantes pour démarrer la lecture",NETWORK_EMPTY:"L'audio/vidéo n'a pas été initialisé",NETWORK_IDLE:"L'audio/vidéo est actif et a été sélectionné comme ressource, mais aucun réseau n'est utilisé",NETWORK_LOADING:"Le navigateur télécharge les données",NETWORK_NO_SOURCE:"Aucune source audio/vidéo n'a été trouvée",MEDIA_ERR_ABORTED:"Le processus de recherche est interrompu par l'utilisateur",MEDIA_ERR_NETWORK:"Une erreur s'est produite lors du téléchargement",MEDIA_ERR_DECODE:"Une erreur s'est produite lors du décodage",MEDIA_ERR_SRC_NOT_SUPPORTED:"L'audio/vidéo n'est pas pris en charge",REPLAY:"Relancer",ERROR:"Le réseau est hors ligne",PLAY_TIPS:"Lire",PAUSE_TIPS:"Mettre en pause",PLAYNEXT_TIPS:"Lire l'élément suivant",DOWNLOAD_TIPS:"Télécharger",ROTATE_TIPS:"Pivoter",RELOAD_TIPS:"Actualiser",FULLSCREEN_TIPS:"Plein écran",EXITFULLSCREEN_TIPS:"Quitter le plein écran",CSSFULLSCREEN_TIPS:"Plein écran css",EXITCSSFULLSCREEN_TIPS:"Quitter le plein écran css",TEXTTRACK:"Légende",PIP:"PIP",SCREENSHOT:"Capture d'écran",LIVE:"EN DIRECT",OFF:"Désactivé",OPEN:"Ouvrir",MINI_DRAG:"Cliquer et maintenir pour faire glisser",MINISCREEN:"Mini écran",REFRESH_TIPS:"Essayez",REFRESH:"Actualiser",FORWARD:"transférer",LIVE_TIP:"En direct"}},langId:{LANG:"id",TEXT:{ERROR_TYPES:{network:{code:1,msg:"kesalahan unduh video"},mse:{code:2,msg:"kesalahan penambahan stream"},parse:{code:3,msg:"kesalahan penguraian"},format:{code:4,msg:"format salah"},decoder:{code:5,msg:"kesalahan dekode"},runtime:{code:6,msg:"kesalahan tata bahasa"},timeout:{code:7,msg:"waktu pemutaran habis"},other:{code:8,msg:"kesalahan lainnya"}},HAVE_NOTHING:"Tidak ada informasi mengenai apakah audio/video sudah siap",HAVE_METADATA:"Metadata audio/video siap ",HAVE_CURRENT_DATA:"Data mengenai lokasi pemutaran saat ini tersedia, tetapi data tidak cukup untuk memutar bingkai berikutnya/milidetik",HAVE_FUTURE_DATA:"Data saat ini dan setidaknya satu bingkai data tersedia",HAVE_ENOUGH_DATA:"Data yang tersedia cukup untuk mulai memutar",NETWORK_EMPTY:"Audio/video belum diinisialisasi",NETWORK_IDLE:"Audio/video sedang aktif dan telah dipilih untuk sumber daya, tetapi tidak ada jaringan yang digunakan",NETWORK_LOADING:"Peramban sedang mengunduh data",NETWORK_NO_SOURCE:"Tidak ada sumber audio/video yang ditemukan",MEDIA_ERR_ABORTED:"Proses pengambilan dihentikan oleh pengguna",MEDIA_ERR_NETWORK:"Terjadi kesalahan ketika mengunduh",MEDIA_ERR_DECODE:"Terjadi kesalahan ketika mendekode",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video tidak didukung",REPLAY:"Putar ulang",ERROR:"Jaringan offline",PLAY_TIPS:"Putar",PAUSE_TIPS:"Jeda",PLAYNEXT_TIPS:"Putar berikutnya",DOWNLOAD_TIPS:"Unduh",ROTATE_TIPS:"Putar",RELOAD_TIPS:"Muat ulang",FULLSCREEN_TIPS:"Layar penuh",EXITFULLSCREEN_TIPS:"Keluar dari layar penuh",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Keluar dari cssfullscreen",TEXTTRACK:"Keterangan",PIP:"PIP",SCREENSHOT:"Screenshot",LIVE:"LANGSUNG",OFF:"Tidak Aktif",OPEN:"Buka",MINI_DRAG:"Klik dan tahan untuk menarik",MINISCREEN:"Layar mini",REFRESH_TIPS:"Silakan Coba",REFRESH:"Segarkan",FORWARD:"teruskan",LIVE_TIP:"Langsung"}},langIt:{LANG:"it",TEXT:{ERROR_TYPES:{network:{code:1,msg:"errore di download del video"},mse:{code:2,msg:"errore di accodamento del flusso"},parse:{code:3,msg:"errore di analisi"},format:{code:4,msg:"formato errato"},decoder:{code:5,msg:"errore di decodifica"},runtime:{code:6,msg:"errori grammaticali"},timeout:{code:7,msg:"timeout della riproduzione"},other:{code:8,msg:"altri errori"}},HAVE_NOTHING:"Non ci sono informazioni che indichino se l'audio/il video è pronto",HAVE_METADATA:"I metadati audio/video sono pronti ",HAVE_CURRENT_DATA:"I dati sulla posizione corrente di riproduzione sono disponibili, ma non ci sono dati sufficienti per riprodurre il prossimo frame/millisecondo",HAVE_FUTURE_DATA:"Corrente e almeno un frame di dati è disponibile",HAVE_ENOUGH_DATA:"I dati disponibili sono sufficienti per avviare la riproduzione",NETWORK_EMPTY:"L'audio/Il video non è stato inizializzato",NETWORK_IDLE:"L'audio/Il video è attivo ed è stato selezionato per le risorse, ma non viene utilizzata alcuna rete",NETWORK_LOADING:"Il browser sta scaricando i dati",NETWORK_NO_SOURCE:"Nessuna origine audio/video trovata",MEDIA_ERR_ABORTED:"Il processo di recupero è stato interrotto dall'utente",MEDIA_ERR_NETWORK:"Si è verificato un errore durante il download",MEDIA_ERR_DECODE:"Si è verificato un errore durante la decodificazione",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/Video non supportato",REPLAY:"Riproduci di nuovo",ERROR:"Rete offline",PLAY_TIPS:"Riproduci",PAUSE_TIPS:"Sospendi",PLAYNEXT_TIPS:"Riproduci successivo",DOWNLOAD_TIPS:"Scarica",ROTATE_TIPS:"Ruota",RELOAD_TIPS:"Ricarica",FULLSCREEN_TIPS:"Schermo intero",EXITFULLSCREEN_TIPS:"Esci dallo schermo intero",CSSFULLSCREEN_TIPS:"Schermo intero CSS",EXITCSSFULLSCREEN_TIPS:"Esci dallo schermo intero CSS",TEXTTRACK:"Didascalia",PIP:"Immagine nell'immagine",SCREENSHOT:"Screenshot",LIVE:"IN DIRETTA",OFF:"Inattivo",OPEN:"Apri",MINI_DRAG:"Fai clic e tieni premuto per trascinare",MINISCREEN:"Minischermo",REFRESH_TIPS:"Prova",REFRESH:"Aggiorna",FORWARD:"inoltra",LIVE_TIP:"In diretta"}},langJp:{LANG:"jp",TEXT:{ERROR_TYPES:{network:{code:1,msg:"ビデオダウンロードエラー"},mse:{code:2,msg:"ストリーム追加エラー"},parse:{code:3,msg:"解析エラー"},format:{code:4,msg:"間違ったフォーマット"},decoder:{code:5,msg:"デコードエラー"},runtime:{code:6,msg:"文法エラー"},timeout:{code:7,msg:"再生タイムアウト"},other:{code:8,msg:"その他のエラー"}},HAVE_NOTHING:"オーディオ/ビデオが準備できているか情報がありません",HAVE_METADATA:"オーディオ/ビデオのメタデータは準備できています",HAVE_CURRENT_DATA:"現在の再生位置に関するデータは利用可能ですが、次のフレーム/ミリ秒を再生するのに十分なデータがありません",HAVE_FUTURE_DATA:"現在、少なくとも次のフレームのデータが利用可能です",HAVE_ENOUGH_DATA:"利用可能なデータは再生を開始するのに十分です",NETWORK_EMPTY:"オーディオ/ビデオが初期化されていません",NETWORK_IDLE:"オーディオ/ビデオはアクティブでリソースが選択されていますが、ネットワークが使用されていません",NETWORK_LOADING:"ブラウザーはデータをダウンロードしています",NETWORK_NO_SOURCE:"オーディオ/ビデオ のソースが見つかりません",MEDIA_ERR_ABORTED:"ユーザーによってフェッチプロセスが中止されました",MEDIA_ERR_NETWORK:"ダウンロード中にエラーが発生しました",MEDIA_ERR_DECODE:"デコード中にエラーが発生しました",MEDIA_ERR_SRC_NOT_SUPPORTED:"オーディオ/ビデオ の形式がサポートされていません",REPLAY:"リプレイ",ERROR:"ネットワークの接続に問題が発生しました",PLAY_TIPS:"プレイ",PAUSE_TIPS:"一時停止",PLAYNEXT_TIPS:"次をプレイ",DOWNLOAD_TIPS:"ダウンロード",ROTATE_TIPS:"回転",RELOAD_TIPS:"再読み込み",FULLSCREEN_TIPS:"フルスクリーン",EXITFULLSCREEN_TIPS:"フルスクリーンを終了",CSSFULLSCREEN_TIPS:"シアターモード",EXITCSSFULLSCREEN_TIPS:"シアターモードを終了",TEXTTRACK:"字幕",PIP:"ミニプレーヤー",SCREENSHOT:"スクリーンショット",LIVE:"生放送",OFF:"オフ",OPEN:"開いた",MINI_DRAG:"ボタンを押して働画をドラッグする",MINISCREEN:"小さな画面",REFRESH:"リフレッシュ",REFRESH_TIPS:"してみてください",FORWARD:"早送り",LIVE_TIP:"生放送"}},langKr:{LANG:"kr",TEXT:{ERROR_TYPES:{network:{code:1,msg:"동영상 다운로드 오류"},mse:{code:2,msg:"스트림 추가 오류"},parse:{code:3,msg:"구문 분석 오류"},format:{code:4,msg:"잘못된 형식"},decoder:{code:5,msg:"디코딩 오류"},runtime:{code:6,msg:"문법 오류"},timeout:{code:7,msg:"재생 시간 초과"},other:{code:8,msg:"기타 오류"}},HAVE_NOTHING:"오디오/동영상 준비 여부에 대한 정보가 없습니다",HAVE_METADATA:"오디오/동영상 메타데이터가 준비되었습니다 ",HAVE_CURRENT_DATA:"현재 재생 위치에 대한 데이터를 사용할 수 있지만 다음 프레임/밀리초를 재생하기에는 데이터가 충분하지 않습니다",HAVE_FUTURE_DATA:"현재 및 하나 이상의 데이터 프레임을 사용할 수 있습니다",HAVE_ENOUGH_DATA:"사용 가능한 데이터가 재생을 시작하기에 충분합니다",NETWORK_EMPTY:"오디오/동영상이 초기화되지 않았습니다",NETWORK_IDLE:"오디오/동영상이 활성 상태이고 리소스에 대해 선택되었지만 네트워크가 사용되지 않습니다",NETWORK_LOADING:"브라우저에서 데이터를 다운로드하고 있습니다",NETWORK_NO_SOURCE:"오디오/동영상 소스를 찾을 수 없습니다",MEDIA_ERR_ABORTED:"사용자가 가져오기 처리 과정을 중단했습니다",MEDIA_ERR_NETWORK:"다운로드하는 동안 오류가 발생했습니다",MEDIA_ERR_DECODE:"디코딩하는 동안 오류가 발생했습니다",MEDIA_ERR_SRC_NOT_SUPPORTED:"오디오/동영상이 지원되지 않습니다",REPLAY:"재생",ERROR:"네트워크가 오프라인 상태입니다",PLAY_TIPS:"재생",PAUSE_TIPS:"일시 정지",PLAYNEXT_TIPS:"다음 재생",DOWNLOAD_TIPS:"다운로드",ROTATE_TIPS:"회전",RELOAD_TIPS:"다시 로드",FULLSCREEN_TIPS:"전체 화면",EXITFULLSCREEN_TIPS:"전체 화면 종료",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"cssfullscreen 종료",TEXTTRACK:"캡션",PIP:"PIP",SCREENSHOT:"스크린샷",LIVE:"라이브",OFF:"끄기",OPEN:"열기",MINI_DRAG:"클릭하고 길게 눌러 드래그",MINISCREEN:"미니스크린",REFRESH_TIPS:"시도해 보세요",REFRESH:"새로 고침",FORWARD:"전달",LIVE_TIP:"라이브"}},langMsMy:{LANG:"ms-my",TEXT:{ERROR_TYPES:{network:{code:1,msg:"ralat muat turun video"},mse:{code:2,msg:"ralat menambahkan aliran"},parse:{code:3,msg:"ralat penghuraian"},format:{code:4,msg:"format salah"},decoder:{code:5,msg:"ralat mendekod"},runtime:{code:6,msg:"kesalahan tatabahasa"},timeout:{code:7,msg:"masa putar habis"},other:{code:8,msg:"kesalahan lain"}},HAVE_NOTHING:"Tiada maklumat sama ada audio/video sedia",HAVE_METADATA:"Metadata audio/video sedia ",HAVE_CURRENT_DATA:"Data tentang lokasi putar semasa tersedia, tetapi tidak cukup data untuk memainkan bingkai/milidetik seterusnya",HAVE_FUTURE_DATA:"Data semasa dan sekurang-kurangnya satu bingkai tersedia",HAVE_ENOUGH_DATA:"Data yang tersedia mencukupi untuk memulakan permainan",NETWORK_EMPTY:"Audio/video belum diinisialisasi",NETWORK_IDLE:"Audio/video aktif dan telah dipilih untuk sumber, tetapi tiada rangkaian digunakan",NETWORK_LOADING:"Pelayar sedang memuat turun data",NETWORK_NO_SOURCE:"Tiada sumber audio/video ditemui",MEDIA_ERR_ABORTED:"Proses pengambilan dibatalkan oleh pengguna",MEDIA_ERR_NETWORK:"Ralat berlaku semasa muat turun",MEDIA_ERR_DECODE:"Ralat berlaku semasa mendekod",MEDIA_ERR_SRC_NOT_SUPPORTED:"Audio/video tidak disokong",REPLAY:"Main semula",ERROR:"Rangkaian offline",PLAY_TIPS:"Putar",PAUSE_TIPS:"Jeda",PLAYNEXT_TIPS:"Putar seterusnya",DOWNLOAD_TIPS:"Muat turun",ROTATE_TIPS:"Putar",RELOAD_TIPS:"Muat semula",FULLSCREEN_TIPS:"Skrin penuh",EXITFULLSCREEN_TIPS:"Keluar skrin penuh",CSSFULLSCREEN_TIPS:"Cssskrin penuh",EXITCSSFULLSCREEN_TIPS:"Keluar cssskrin penuh",TEXTTRACK:"Kapsyen",PIP:"PIP",SCREENSHOT:"Tangkapan skrin",LIVE:"LIVE",OFF:"Matikan",OPEN:"Buka",MINI_DRAG:"Klik dan tahan untuk seret",MINISCREEN:"Miniscreen",REFRESH_TIPS:"Sila Cuba",REFRESH:"Segarkan",FORWARD:"ke hadapan",LIVE_TIP:"Langsung"}},langRu:{LANG:"ru",TEXT:{ERROR_TYPES:{network:{code:1,msg:"ошибка загрузки видео"},mse:{code:2,msg:"ошибка добавления потока"},parse:{code:3,msg:"ошибка синтаксического разбора"},format:{code:4,msg:"неверный формат"},decoder:{code:5,msg:"ошибка декодирования"},runtime:{code:6,msg:"грамматические ошибки"},timeout:{code:7,msg:"тайм-аут воспроизведения"},other:{code:8,msg:"прочие ошибки"}},HAVE_NOTHING:"Нет информации о готовности аудио/видео",HAVE_METADATA:"Метаданные аудио/видео готовы ",HAVE_CURRENT_DATA:"Данные о текущем месте воспроизведения доступны, но недостаточно данных для воспроизведения следующего кадра/миллисекунды",HAVE_FUTURE_DATA:"Доступен текущий и как минимум один кадр данных",HAVE_ENOUGH_DATA:"Доступных данных достаточно для начала воспроизведения",NETWORK_EMPTY:"Аудио/видео не инициализировано",NETWORK_IDLE:"Аудио/видео активны и выбраны для ресурсов, но сеть не используется",NETWORK_LOADING:"Браузер загружает данные",NETWORK_NO_SOURCE:"Источник аудио/видео не найден",MEDIA_ERR_ABORTED:"Процесс выборки прерван пользователем",MEDIA_ERR_NETWORK:"Произошла ошибка при загрузке",MEDIA_ERR_DECODE:"Произошла ошибка при декодировании",MEDIA_ERR_SRC_NOT_SUPPORTED:"Аудио/видео не поддерживается",REPLAY:"Повторить воспроизведение",ERROR:"Сеть не подключена",PLAY_TIPS:"Воспроизвести",PAUSE_TIPS:"Пауза",PLAYNEXT_TIPS:"Воспроизвести ​следующее",DOWNLOAD_TIPS:"Загрузить",ROTATE_TIPS:"Повернуть",RELOAD_TIPS:"Перезагрузить",FULLSCREEN_TIPS:"Полный экран",EXITFULLSCREEN_TIPS:"Выйти из полноэкранного режима",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Выход из cssfullscreen",TEXTTRACK:"Субтитры",PIP:"Картинка в картинке",SCREENSHOT:"Снимок экрана",LIVE:"В ЭФИРЕ",OFF:"Выкл",OPEN:"Открыть",MINI_DRAG:"Щелкните и удерживайте, чтобы переместить",MINISCREEN:"Мини-экран",REFRESH_TIPS:"Попробуйте",REFRESH:"Обновить",FORWARD:"переслать",LIVE_TIP:"В эфире"}},langTh:{LANG:"th",TEXT:{ERROR_TYPES:{network:{code:1,msg:"เกิดข้อผิดพลาดในการดาวน์โหลดวิดีโอ"},mse:{code:2,msg:"เกิดข้อผิดพลาดในการผนวกสตรีม"},parse:{code:3,msg:"เกิดข้อผิดพลาดในการแยกวิเคราะห์"},format:{code:4,msg:"รูปแบบไม่ถูกต้อง"},decoder:{code:5,msg:"เกิดข้อผิดพลาดในการถอดรหัส"},runtime:{code:6,msg:"เกิดข้อผิดพลาดทางไวยากรณ์"},timeout:{code:7,msg:"หมดเวลาเล่น"},other:{code:8,msg:"ข้อผิดพลาดอื่น ๆ"}},HAVE_NOTHING:"ไม่มีข้อมูลความพร้อมของเสียง/วิดีโอ",HAVE_METADATA:"ข้อมูลของข้อมูลเสียง/วิดีโอพร้อมแล้ว ",HAVE_CURRENT_DATA:"มีข้อมูลตำแหน่งการเล่นปัจจุบัน แต่มีข้อมูลไม่พอที่จะเล่นเฟรม/มิลลิวินาทีถัดไป",HAVE_FUTURE_DATA:"มีเฟรมข้อมูลปัจจุบันอย่างน้อยหนึ่งเฟรม",HAVE_ENOUGH_DATA:"ข้อมูลที่มีอยู่เพียงพอที่จะเริ่มเล่น",NETWORK_EMPTY:"ยังไม่ได้เริ่มต้นเสียง/วิดีโอ",NETWORK_IDLE:"เสียง/วิดีโอใช้งานอยู่และเลือกไว้ใช้กับทรัพยากร แต่ไม่มีการใช้เครือข่าย",NETWORK_LOADING:"เบราว์เซอร์กำลังดาวน์โหลดข้อมูล",NETWORK_NO_SOURCE:"ไม่พบแหล่งเสียง/วิดีโอ",MEDIA_ERR_ABORTED:"ผู้ใช้ยกเลิกกระบวนการดึงแล้ว",MEDIA_ERR_NETWORK:"เกิดข้อผิดพลาดขณะดาวน์โหลด",MEDIA_ERR_DECODE:"เกิดข้อผิดพลาดขณะถอดรหัส",MEDIA_ERR_SRC_NOT_SUPPORTED:"ไม่รองรับเสียง/วิดีโอ",REPLAY:"เล่นซ้ำ",ERROR:"เครือข่ายออฟไลน์อยู่",PLAY_TIPS:"เล่น",PAUSE_TIPS:"หยุดชั่วคราว",PLAYNEXT_TIPS:"เล่นรายการถัดไป",DOWNLOAD_TIPS:"ดาวน์โหลด",ROTATE_TIPS:"หมุน",RELOAD_TIPS:"โหลดใหม่",FULLSCREEN_TIPS:"เต็มหน้าจอ",EXITFULLSCREEN_TIPS:"ออกจากโหมดเต็มหน้าจอ",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"ออกจาก cssfullscreen",TEXTTRACK:"คำบรรยาย",PIP:"PIP",SCREENSHOT:"ภาพหน้าจอ",LIVE:"สด",OFF:"ปิด",OPEN:"เปิด",MINI_DRAG:"คลิกค้างไว้เพื่อลาก",MINISCREEN:"จอเล็ก",REFRESH_TIPS:"โปรดลอง",REFRESH:"รีเฟรช",FORWARD:"ส่งต่อ",LIVE_TIP:"สด"}},langVn:{LANG:"vn",TEXT:{ERROR_TYPES:{network:{code:1,msg:"lỗi tải video về"},mse:{code:2,msg:"lỗi nối luồng"},parse:{code:3,msg:"lỗi phân tích cú pháp"},format:{code:4,msg:"sai định dạng"},decoder:{code:5,msg:"lỗi giải mã"},runtime:{code:6,msg:"lỗi ngữ pháp"},timeout:{code:7,msg:"hết thời gian phát"},other:{code:8,msg:"lỗi khác"}},HAVE_NOTHING:"Không có thông tin về việc âm thanh/video đã sẵn sàng hay chưa",HAVE_METADATA:"Siêu dữ liệu về âm thanh/video đã sẵn sàng ",HAVE_CURRENT_DATA:"Đã có dữ liệu về vị trí phát hiện tại, nhưng không có đủ dữ liệu để phát khung hình/mili giây tiếp theo",HAVE_FUTURE_DATA:"Hiện tại và có ít nhất một khung dữ liệu khả dụng",HAVE_ENOUGH_DATA:"Dữ liệu khả dụng đã đủ để bắt đầu phát",NETWORK_EMPTY:"Chưa khởi tạo âm thanh/video",NETWORK_IDLE:"Âm thanh/video đang hoạt động và đã được chọn làm tài nguyên nhưng không có mạng nào được sử dụng",NETWORK_LOADING:"Trình duyệt đang tải dữ liệu về",NETWORK_NO_SOURCE:"Không tìm thấy nguồn âm thanh/video",MEDIA_ERR_ABORTED:"Người dùng đã hủy bỏ quy trình tìm nạp",MEDIA_ERR_NETWORK:"Đã xảy ra lỗi khi tải về",MEDIA_ERR_DECODE:"Đã xảy ra lỗi khi giải mã",MEDIA_ERR_SRC_NOT_SUPPORTED:"Âm thanh/video không được hỗ trợ",REPLAY:"Phát lại",ERROR:"Mạng đang ngoại tuyến",PLAY_TIPS:"Phát",PAUSE_TIPS:"Tạm dừng",PLAYNEXT_TIPS:"Phát tiếp",DOWNLOAD_TIPS:"Tải về",ROTATE_TIPS:"Xoay",RELOAD_TIPS:"Tải lại",FULLSCREEN_TIPS:"Toàn màn hình",EXITFULLSCREEN_TIPS:"Thoát chế độ toàn màn hình",CSSFULLSCREEN_TIPS:"Cssfullscreen",EXITCSSFULLSCREEN_TIPS:"Thoát chế độ cssfullscreen",TEXTTRACK:"Chú thích",PIP:"PIP",SCREENSHOT:"Ảnh chụp màn hình",LIVE:"TRỰC TIẾP",OFF:"Tắt",OPEN:"Mở",MINI_DRAG:"Nhấp giữ để kéo",MINISCREEN:"Màn hình nhỏ",REFRESH_TIPS:"Vui lòng thử",REFRESH:"Làm mới",FORWARD:"chuyển tiếp",LIVE_TIP:"Phát trực tiếp"}},langZhCn:sH,langZhHk:{LANG:"zh-hk",TEXT:{ERROR_TYPES:{network:{code:1,msg:"視頻下載錯誤"},mse:{code:2,msg:"劉追加錯誤"},parse:{code:3,msg:"解析錯誤"},format:{code:4,msg:"格式錯誤"},decoder:{code:5,msg:"解碼錯誤"},runtime:{code:6,msg:"語法錯誤"},timeout:{code:7,msg:"播放超時"},other:{code:8,msg:"其他錯誤"}},HAVE_NOTHING:"沒有關於音頻/視頻是否就緒的信息",HAVE_METADATA:"音頻/視頻的元數據已就緒",HAVE_CURRENT_DATA:"關於當前播放位置的數據是可用的,但沒有足夠的數據來播放下壹幀/毫秒",HAVE_FUTURE_DATA:"當前及至少下壹幀的數據是可用的",HAVE_ENOUGH_DATA:"可用數據足以開始播放",NETWORK_EMPTY:"音頻/視頻尚未初始化",NETWORK_IDLE:"音頻/視頻是活動的且已選取資源,但並未使用網絡",NETWORK_LOADING:"瀏覽器正在下載數據",NETWORK_NO_SOURCE:"未找到音頻/視頻來源",MEDIA_ERR_ABORTED:"取回過程被用戶中止",MEDIA_ERR_NETWORK:"下載錯誤",MEDIA_ERR_DECODE:"解碼錯誤",MEDIA_ERR_SRC_NOT_SUPPORTED:"不支持的音頻/視頻格式",REPLAY:"重播",ERROR:"網絡連接似乎出現了問題",PLAY_TIPS:"播放",PAUSE_TIPS:"暫停",PLAYNEXT_TIPS:"下壹集",DOWNLOAD_TIPS:"下載",ROTATE_TIPS:"旋轉",RELOAD_TIPS:"重新載入",FULLSCREEN_TIPS:"進入全屏",EXITFULLSCREEN_TIPS:"退出全屏",CSSFULLSCREEN_TIPS:"進入樣式全屏",EXITCSSFULLSCREEN_TIPS:"退出樣式全屏",TEXTTRACK:"字幕",PIP:"畫中畫",SCREENSHOT:"截圖",LIVE:"正在直播",OFF:"關閉",OPEN:"開啟",MINI_DRAG:"點擊按住可拖動視頻",MINISCREEN:"小屏幕",REFRESH_TIPS:"請試試",REFRESH:"刷新",FORWARD:"快进中",LIVE_TIP:"直播"}}})));var BG=i(fO.exports),HG=window.VePlayer.DynamicModule;VePlayer.registerPlugin(HG.PluginHlsJs,{HlsPlugin:BG}),e.HlsPlugin=BG}));