-
Notifications
You must be signed in to change notification settings - Fork 1
/
p2p-chimee-kernel-hls@latest
8 lines (8 loc) · 293 KB
/
p2p-chimee-kernel-hls@latest
1
2
3
4
5
6
7
8
/**
* Minified by jsDelivr using UglifyJS v3.4.4.
* Original file: /npm/p2p-chimee-kernel-hls@0.1.0/lib/index.browser.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ChimeeKernelHls=e()}(this,function(){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function r(t,e){return t(e={exports:{}},e.exports),e.exports}var i={}.toString,n=function(t){return i.call(t).slice(8,-1)},b=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)},s=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},l=function(t){return b(s(t))},f={f:{}.propertyIsEnumerable},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},S=function(t){return"object"==typeof t?null!==t:"function"==typeof t},a=function(t,e){if(!S(t))return t;var r,i;if(e&&"function"==typeof(r=t.toString)&&!S(i=r.call(t)))return i;if("function"==typeof(r=t.valueOf)&&!S(i=r.call(t)))return i;if(!e&&"function"==typeof(r=t.toString)&&!S(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")},o={}.hasOwnProperty,v=function(t,e){return o.call(t,e)},_=function(t){try{return!!t()}catch(t){return!0}},A=!_(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),R=r(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),u=R.document,c=S(u)&&S(u.createElement),d=function(t){return c?u.createElement(t):{}},h=!A&&!_(function(){return 7!=Object.defineProperty(d("div"),"a",{get:function(){return 7}}).a}),p=Object.getOwnPropertyDescriptor,g={f:A?p:function(t,e){if(t=l(t),e=a(e,!0),h)try{return p(t,e)}catch(t){}if(v(t,e))return w(!f.f.call(t,e),t[e])}},y=r(function(t){var e=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=e)}),m=(y.version,function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}),E=function(i,n,t){if(m(i),void 0===n)return i;switch(t){case 1:return function(t){return i.call(n,t)};case 2:return function(t,e){return i.call(n,t,e)};case 3:return function(t,e,r){return i.call(n,t,e,r)}}return function(){return i.apply(n,arguments)}},T=function(t){if(!S(t))throw TypeError(t+" is not an object!");return t},k=Object.defineProperty,L={f:A?Object.defineProperty:function(t,e,r){if(T(t),e=a(e,!0),T(r),h)try{return k(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},O=A?function(t,e,r){return L.f(t,e,w(1,r))}:function(t,e,r){return t[e]=r,t},D="prototype",C=function(t,e,r){var i,n,a,o=t&C.F,s=t&C.G,u=t&C.S,l=t&C.P,c=t&C.B,d=t&C.W,f=s?y:y[e]||(y[e]={}),h=f[D],p=s?R:u?R[e]:(R[e]||{})[D];for(i in s&&(r=e),r)(n=!o&&p&&void 0!==p[i])&&v(f,i)||(a=n?p[i]:r[i],f[i]=s&&"function"!=typeof p[i]?r[i]:c&&n?E(a,R):d&&p[i]==a?function(i){var t=function(t,e,r){if(this instanceof i){switch(arguments.length){case 0:return new i;case 1:return new i(t);case 2:return new i(t,e)}return new i(t,e,r)}return i.apply(this,arguments)};return t[D]=i[D],t}(a):l&&"function"==typeof a?E(Function.call,a):a,l&&((f.virtual||(f.virtual={}))[i]=a,t&C.R&&h&&!h[i]&&O(h,i,a)))};C.F=1,C.G=2,C.S=4,C.P=8,C.B=16,C.W=32,C.U=64,C.R=128;var I=C,x=function(t,e){var r=(y.Object||{})[t]||Object[t],i={};i[t]=e(r),I(I.S+I.F*_(function(){r(1)}),"Object",i)},P=g.f;x("getOwnPropertyDescriptor",function(){return function(t,e){return P(l(t),e)}});var M,F=y.Object,N=function(t,e){return F.getOwnPropertyDescriptor(t,e)},U=e(r(function(t){t.exports={default:N,__esModule:!0}})),B=Math.ceil,G=Math.floor,j=function(t){return isNaN(t=+t)?0:(0<t?G:B)(t)},K=O,H={},V=Math.min,W=function(t){return 0<t?V(j(t),9007199254740991):0},Y=Math.max,q=Math.min,z=r(function(t){var e="__core-js_shared__",r=R[e]||(R[e]={});(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:y.version,mode:"pure",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})}),X=0,Q=Math.random(),$=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++X+Q).toString(36))},J=z("keys"),Z=function(t){return J[t]||(J[t]=$(t))},tt=(M=!1,function(t,e,r){var i,n,a,o=l(t),s=W(o.length),u=(n=s,(i=j(i=r))<0?Y(i+n,0):q(i,n));if(M&&e!=e){for(;u<s;)if((a=o[u++])!=a)return!0}else for(;u<s;u++)if((M||u in o)&&o[u]===e)return M||u||0;return!M&&-1}),et=Z("IE_PROTO"),rt=function(t,e){var r,i=l(t),n=0,a=[];for(r in i)r!=et&&v(i,r)&&a.push(r);for(;e.length>n;)v(i,r=e[n++])&&(~tt(a,r)||a.push(r));return a},it="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),nt=Object.keys||function(t){return rt(t,it)},at=A?Object.defineProperties:function(t,e){T(t);for(var r,i=nt(e),n=i.length,a=0;a<n;)L.f(t,r=i[a++],e[r]);return t},ot=R.document,st=ot&&ot.documentElement,ut=Z("IE_PROTO"),lt=function(){},ct="prototype",dt=function(){var t,e=d("iframe"),r=it.length;for(e.style.display="none",st.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),dt=t.F;r--;)delete dt[ct][it[r]];return dt()},ft=Object.create||function(t,e){var r;return null!==t?(lt[ct]=T(t),r=new lt,lt[ct]=null,r[ut]=t):r=dt(),void 0===e?r:at(r,e)},ht=r(function(t){var e=z("wks"),r=R.Symbol,i="function"==typeof r;(t.exports=function(t){return e[t]||(e[t]=i&&r[t]||(i?r:$)("Symbol."+t))}).store=e}),pt=L.f,vt=ht("toStringTag"),gt=function(t,e,r){t&&!v(t=r?t:t.prototype,vt)&&pt(t,vt,{configurable:!0,value:e})},yt={};O(yt,ht("iterator"),function(){return this});var mt,bt=function(t){return Object(s(t))},Et=Z("IE_PROTO"),Tt=Object.prototype,wt=Object.getPrototypeOf||function(t){return t=bt(t),v(t,Et)?t[Et]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Tt:null},St=ht("iterator"),_t=!([].keys&&"next"in[].keys()),At="values",Rt=function(){return this},kt=function(t,e,r,i,n,a,o){var s,u,l;u=e,l=i,(s=r).prototype=ft(yt,{next:w(1,l)}),gt(s,u+" Iterator");var c,d,f,h=function(t){if(!_t&&t in y)return y[t];switch(t){case"keys":case At:return function(){return new r(this,t)}}return function(){return new r(this,t)}},p=e+" Iterator",v=n==At,g=!1,y=t.prototype,m=y[St]||y["@@iterator"]||n&&y[n],b=m||h(n),E=n?v?h("entries"):b:void 0,T="Array"==e&&y.entries||m;if(T&&(f=wt(T.call(new t)))!==Object.prototype&&f.next&>(f,p,!0),v&&m&&m.name!==At&&(g=!0,b=function(){return m.call(this)}),o&&(_t||g||!y[St])&&O(y,St,b),H[e]=b,H[p]=Rt,n)if(c={values:v?b:h(At),keys:a?b:h("keys"),entries:E},o)for(d in c)d in y||K(y,d,c[d]);else I(I.P+I.F*(_t||g),e,c);return c},Lt=(mt=!0,function(t,e){var r,i,n=String(s(t)),a=j(e),o=n.length;return a<0||o<=a?mt?"":void 0:(r=n.charCodeAt(a))<55296||56319<r||a+1===o||(i=n.charCodeAt(a+1))<56320||57343<i?mt?n.charAt(a):r:mt?n.slice(a,a+2):i-56320+(r-55296<<10)+65536});kt(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,r=this._i;return r>=e.length?{value:void 0,done:!0}:(t=Lt(e,r),this._i+=t.length,{value:t,done:!1})});var Ot=function(t,e){return{value:e,done:!!t}};kt(Array,"Array",function(t,e){this._t=l(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,Ot(1)):Ot(0,"keys"==e?r:"values"==e?t[r]:[r,t[r]])},"values");H.Arguments=H.Array;for(var Dt=ht("toStringTag"),Ct="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),It=0;It<Ct.length;It++){var xt=Ct[It],Pt=R[xt],Mt=Pt&&Pt.prototype;Mt&&!Mt[Dt]&&O(Mt,Dt,xt),H[xt]=H.Array}var Ft={f:ht},Nt=Ft.f("iterator"),Ut=r(function(t){t.exports={default:Nt,__esModule:!0}});e(Ut);var Bt=r(function(t){var r=$("meta"),e=L.f,i=0,n=Object.isExtensible||function(){return!0},a=!_(function(){return n(Object.preventExtensions({}))}),o=function(t){e(t,r,{value:{i:"O"+ ++i,w:{}}})},s=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!S(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!v(t,r)){if(!n(t))return"F";if(!e)return"E";o(t)}return t[r].i},getWeak:function(t,e){if(!v(t,r)){if(!n(t))return!0;if(!e)return!1;o(t)}return t[r].w},onFreeze:function(t){return a&&s.NEED&&n(t)&&!v(t,r)&&o(t),t}}}),Gt=(Bt.KEY,Bt.NEED,Bt.fastKey,Bt.getWeak,Bt.onFreeze,L.f),jt=function(t){var e=y.Symbol||(y.Symbol={});"_"==t.charAt(0)||t in e||Gt(e,t,{value:Ft.f(t)})},Kt={f:Object.getOwnPropertySymbols},Ht=Array.isArray||function(t){return"Array"==n(t)},Vt=it.concat("length","prototype"),Wt={f:Object.getOwnPropertyNames||function(t){return rt(t,Vt)}},Yt=Wt.f,qt={}.toString,zt="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Xt={f:function(t){return zt&&"[object Window]"==qt.call(t)?function(t){try{return Yt(t)}catch(t){return zt.slice()}}(t):Yt(l(t))}},Qt=Bt.KEY,$t=g.f,Jt=L.f,Zt=Xt.f,te=R.Symbol,ee=R.JSON,re=ee&&ee.stringify,ie="prototype",ne=ht("_hidden"),ae=ht("toPrimitive"),oe={}.propertyIsEnumerable,se=z("symbol-registry"),ue=z("symbols"),le=z("op-symbols"),ce=Object[ie],de="function"==typeof te,fe=R.QObject,he=!fe||!fe[ie]||!fe[ie].findChild,pe=A&&_(function(){return 7!=ft(Jt({},"a",{get:function(){return Jt(this,"a",{value:7}).a}})).a})?function(t,e,r){var i=$t(ce,e);i&&delete ce[e],Jt(t,e,r),i&&t!==ce&&Jt(ce,e,i)}:Jt,ve=function(t){var e=ue[t]=ft(te[ie]);return e._k=t,e},ge=de&&"symbol"==typeof te.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof te},ye=function(t,e,r){return t===ce&&ye(le,e,r),T(t),e=a(e,!0),T(r),v(ue,e)?(r.enumerable?(v(t,ne)&&t[ne][e]&&(t[ne][e]=!1),r=ft(r,{enumerable:w(0,!1)})):(v(t,ne)||Jt(t,ne,w(1,{})),t[ne][e]=!0),pe(t,e,r)):Jt(t,e,r)},me=function(t,e){T(t);for(var r,i=function(t){var e=nt(t),r=Kt.f;if(r)for(var i,n=r(t),a=f.f,o=0;n.length>o;)a.call(t,i=n[o++])&&e.push(i);return e}(e=l(e)),n=0,a=i.length;n<a;)ye(t,r=i[n++],e[r]);return t},be=function(t){var e=oe.call(this,t=a(t,!0));return!(this===ce&&v(ue,t)&&!v(le,t))&&(!(e||!v(this,t)||!v(ue,t)||v(this,ne)&&this[ne][t])||e)},Ee=function(t,e){if(t=l(t),e=a(e,!0),t!==ce||!v(ue,e)||v(le,e)){var r=$t(t,e);return!r||!v(ue,e)||v(t,ne)&&t[ne][e]||(r.enumerable=!0),r}},Te=function(t){for(var e,r=Zt(l(t)),i=[],n=0;r.length>n;)v(ue,e=r[n++])||e==ne||e==Qt||i.push(e);return i},we=function(t){for(var e,r=t===ce,i=Zt(r?le:l(t)),n=[],a=0;i.length>a;)!v(ue,e=i[a++])||r&&!v(ce,e)||n.push(ue[e]);return n};de||(K((te=function(){if(this instanceof te)throw TypeError("Symbol is not a constructor!");var e=$(0<arguments.length?arguments[0]:void 0),r=function(t){this===ce&&r.call(le,t),v(this,ne)&&v(this[ne],e)&&(this[ne][e]=!1),pe(this,e,w(1,t))};return A&&he&&pe(ce,e,{configurable:!0,set:r}),ve(e)})[ie],"toString",function(){return this._k}),g.f=Ee,L.f=ye,Wt.f=Xt.f=Te,f.f=be,Kt.f=we,Ft.f=function(t){return ve(ht(t))}),I(I.G+I.W+I.F*!de,{Symbol:te});for(var Se="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),_e=0;Se.length>_e;)ht(Se[_e++]);for(var Ae=nt(ht.store),Re=0;Ae.length>Re;)jt(Ae[Re++]);I(I.S+I.F*!de,"Symbol",{for:function(t){return v(se,t+="")?se[t]:se[t]=te(t)},keyFor:function(t){if(!ge(t))throw TypeError(t+" is not a symbol!");for(var e in se)if(se[e]===t)return e},useSetter:function(){he=!0},useSimple:function(){he=!1}}),I(I.S+I.F*!de,"Object",{create:function(t,e){return void 0===e?ft(t):me(ft(t),e)},defineProperty:ye,defineProperties:me,getOwnPropertyDescriptor:Ee,getOwnPropertyNames:Te,getOwnPropertySymbols:we}),ee&&I(I.S+I.F*(!de||_(function(){var t=te();return"[null]"!=re([t])||"{}"!=re({a:t})||"{}"!=re(Object(t))})),"JSON",{stringify:function(t){for(var e,r,i=[t],n=1;arguments.length>n;)i.push(arguments[n++]);if(r=e=i[1],(S(e)||void 0!==t)&&!ge(t))return Ht(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!ge(e))return e}),i[1]=e,re.apply(ee,i)}}),te[ie][ae]||O(te[ie],ae,te[ie].valueOf),gt(te,"Symbol"),gt(Math,"Math",!0),gt(R.JSON,"JSON",!0),jt("asyncIterator"),jt("observable");var ke=y.Symbol,Le=r(function(t){t.exports={default:ke,__esModule:!0}});e(Le);var Oe=r(function(t,e){e.__esModule=!0;var r=a(Ut),i=a(Le),n="function"==typeof i.default&&"symbol"==typeof r.default?function(t){return typeof t}:function(t){return t&&"function"==typeof i.default&&t.constructor===i.default&&t!==i.default.prototype?"symbol":typeof t};function a(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof i.default&&"symbol"===n(r.default)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof i.default&&t.constructor===i.default&&t!==i.default.prototype?"symbol":void 0===t?"undefined":n(t)}}),De=e(Oe);x("getPrototypeOf",function(){return function(t){return wt(bt(t))}});var Ce=y.Object.getPrototypeOf,Ie=e(r(function(t){t.exports={default:Ce,__esModule:!0}})),xe=e(r(function(t,e){e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}})),Pe=e(r(function(t,e){e.__esModule=!0;var r,i=(r=Oe)&&r.__esModule?r:{default:r};e.default=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==(void 0===e?"undefined":(0,i.default)(e))&&"function"!=typeof e?t:e}}));I(I.S+I.F*!A,"Object",{defineProperty:L.f});var Me=y.Object,Fe=function(t,e,r){return Me.defineProperty(t,e,r)},Ne=r(function(t){t.exports={default:Fe,__esModule:!0}}),Ue=e(Ne),Be=e(r(function(t,e){e.__esModule=!0;var r,n=(r=Ne)&&r.__esModule?r:{default:r};e.default=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),(0,n.default)(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}()})),Ge=function(t,e){if(T(t),!S(e)&&null!==e)throw TypeError(e+": can't set as prototype!")},je={set:Object.setPrototypeOf||("__proto__"in{}?function(t,r,i){try{(i=E(Function.call,g.f(Object.prototype,"__proto__").set,2))(t,[]),r=!(t instanceof Array)}catch(t){r=!0}return function(t,e){return Ge(t,e),r?t.__proto__=e:i(t,e),t}}({},!1):void 0),check:Ge};I(I.S,"Object",{setPrototypeOf:je.set});var Ke=y.Object.setPrototypeOf,He=r(function(t){t.exports={default:Ke,__esModule:!0}});e(He),I(I.S,"Object",{create:ft});var Ve=y.Object,We=function(t,e){return Ve.create(t,e)},Ye=r(function(t){t.exports={default:We,__esModule:!0}}),qe=e(Ye),ze=e(r(function(t,e){e.__esModule=!0;var r=a(He),i=a(Ye),n=a(Oe);function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":(0,n.default)(e)));t.prototype=(0,i.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(r.default?(0,r.default)(t,e):t.__proto__=e)}})),Xe=e(r(function(t,e){var r;"undefined"!=typeof window&&(r=function(){return function(r){var i={};function n(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,n),e.l=!0,e.exports}return n.m=r,n.c=i,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=11)}([function(t,e,r){r.d(e,"a",function(){return c}),r.d(e,"b",function(){return d});var i=r(4),n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function s(){}var a={trace:s,debug:s,log:s,warn:s,info:s,error:s},u=a;var l=Object(i.a)();function o(e){for(var t=arguments.length,r=Array(1<t?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];r.forEach(function(t){var a,o;u[t]=e[t]?e[t].bind(e):(a=t,(o=l.console[a])?function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];var i,n;e[0]&&(e[0]=(i=a,n=e[0],n="["+i+"] > "+n)),o.apply(l.console,e)}:s)})}var c=function(t){if(!0===t||"object"===(void 0===t?"undefined":n(t))){o(t,"debug","log","info","warn","error");try{u.log()}catch(t){u=a}}else u=a},d=u},function(t,e,r){e.a={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},function(t,e,r){r.d(e,"b",function(){return i}),r.d(e,"a",function(){return n});var i={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",KEY_SYSTEM_ERROR:"keySystemError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"},n={KEY_SYSTEM_NO_KEYS:"keySystemNoKeys",KEY_SYSTEM_NO_ACCESS:"keySystemNoAccess",KEY_SYSTEM_NO_SESSION:"keySystemNoSession",KEY_SYSTEM_LICENSE_REQUEST_FAILED:"keySystemLicenseRequestFailed",MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",REMUX_ALLOC_ERROR:"remuxAllocError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",BUFFER_NUDGE_ON_STALL:"bufferNudgeOnStall",INTERNAL_EXCEPTION:"internalException"}},function(t,e,r){r.d(e,"a",function(){return i});var i=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)}},function(t,e,r){e.a=function(){return"undefined"==typeof window?self:window}},function(t,e,r){var i,c,n,a,d;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,c=/^([^\/;?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,d={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=this.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");return i.path=d.normalizePath(i.path),d.buildURLFromParts(i)}var n=this.parseURL(e);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=d.normalizePath(n.path),d.buildURLFromParts(n)):e;var a=this.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var o=c.exec(a.path);a.netLoc=o[1],a.path=o[2]}a.netLoc&&!a.path&&(a.path="/");var s={scheme:a.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(s.netLoc=a.netLoc,"/"!==n.path[0]))if(n.path){var u=a.path,l=u.substring(0,u.lastIndexOf("/")+1)+n.path;s.path=d.normalizePath(l)}else s.path=a.path,n.params||(s.params=a.params,n.query||(s.query=a.query));return null===s.path&&(s.path=r.alwaysNormalize?d.normalizePath(n.path):n.path),d.buildURLFromParts(s)},parseURL:function(t){var e=i.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(n,"");t.length!==(t=t.replace(a,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=d},function(t,e,r){r.d(e,"b",function(){return n});var i=function(){function s(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s)}return s.isHeader=function(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},s.isFooter=function(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},s.getID3Data=function(t,e){for(var r=e,i=0;s.isHeader(t,e);){i+=10,i+=s._readSize(t,e+6),s.isFooter(t,e+10)&&(i+=10),e+=i}if(0<i)return t.subarray(r,r+i)},s._readSize=function(t,e){var r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,r|=(127&t[e+2])<<7,r|=127&t[e+3]},s.getTimeStamp=function(t){for(var e=s.getID3Frames(t),r=0;r<e.length;r++){var i=e[r];if(s.isTimeStampFrame(i))return s._readTimeStamp(i)}},s.isTimeStampFrame=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},s._getFrameData=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=s._readSize(t,4);return{type:e,size:r,data:t.subarray(10,10+r)}},s.getID3Frames=function(t){for(var e=0,r=[];s.isHeader(t,e);){for(var i=s._readSize(t,e+6),n=(e+=10)+i;e+8<n;){var a=s._getFrameData(t.subarray(e)),o=s._decodeFrame(a);o&&r.push(o),e+=a.size+10}s.isFooter(t,e)&&(e+=10)}return r},s._decodeFrame=function(t){return"PRIV"===t.type?s._decodePrivFrame(t):"T"===t.type[0]?s._decodeTextFrame(t):"W"===t.type[0]?s._decodeURLFrame(t):void 0},s._readTimeStamp=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),r=1&e[3],i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},s._decodePrivFrame=function(t){if(!(t.size<2)){var e=s._utf8ArrayToStr(t.data,!0),r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}}},s._decodeTextFrame=function(t){if(!(t.size<2)){if("TXXX"===t.type){var e=1,r=s._utf8ArrayToStr(t.data.subarray(e));e+=r.length+1;var i=s._utf8ArrayToStr(t.data.subarray(e));return{key:t.type,info:r,data:i}}var n=s._utf8ArrayToStr(t.data.subarray(1));return{key:t.type,data:n}}},s._decodeURLFrame=function(t){if("WXXX"===t.type){if(t.size<2)return;var e=1,r=s._utf8ArrayToStr(t.data.subarray(e));e+=r.length+1;var i=s._utf8ArrayToStr(t.data.subarray(e));return{key:t.type,info:r,data:i}}var n=s._utf8ArrayToStr(t.data);return{key:t.type,data:n}},s._utf8ArrayToStr=function(t){for(var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],r=t.length,i=void 0,n=void 0,a=void 0,o="",s=0;s<r;){if(0===(i=t[s++])&&e)return o;if(0!==i&&3!==i)switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(i);break;case 12:case 13:n=t[s++],o+=String.fromCharCode((31&i)<<6|63&n);break;case 14:n=t[s++],a=t[s++],o+=String.fromCharCode((15&i)<<12|(63&n)<<6|(63&a)<<0)}}return o},s}(),n=i._utf8ArrayToStr;e.a=i},function(t,e){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function u(t){return"function"==typeof t}function l(t){return"object"==typeof t&&null!==t}function c(t){return void 0===t}((t.exports=i).EventEmitter=i).prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,r,i,n,a,o;if(this._events||(this._events={}),"error"===t&&(!this._events.error||l(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var s=new Error('Uncaught, unspecified "error" event. ('+e+")");throw s.context=e,s}if(c(r=this._events[t]))return!1;if(u(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),r.apply(this,n)}else if(l(r))for(n=Array.prototype.slice.call(arguments,1),i=(o=r.slice()).length,a=0;a<i;a++)o[a].apply(this,n);return!0},i.prototype.on=i.prototype.addListener=function(t,e){var r;if(!u(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,u(e.listener)?e.listener:e),this._events[t]?l(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,l(this._events[t])&&!this._events[t].warned&&(r=c(this._maxListeners)?i.defaultMaxListeners:this._maxListeners)&&0<r&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.once=function(t,e){if(!u(e))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(t,i),r||(r=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},i.prototype.removeListener=function(t,e){var r,i,n,a;if(!u(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=(r=this._events[t]).length,i=-1,r===e||u(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(l(r)){for(a=n;0<a--;)if(r[a]===e||r[a].listener&&r[a].listener===e){i=a;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(u(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){return this._events&&this._events[t]?u(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(u(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){var s=function(){function r(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),this.subtle=t,this.aesIV=e}return r.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},r}();var u=function(){function r(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),this.subtle=t,this.key=e}return r.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},r}();var l=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),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.initTable()}return t.prototype.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),r=new Uint32Array(4),i=0;i<4;i++)r[i]=e.getUint32(4*i);return r},t.prototype.initTable=function(){var t=this.sBox,e=this.invSBox,r=this.subMix,i=r[0],n=r[1],a=r[2],o=r[3],s=this.invSubMix,u=s[0],l=s[1],c=s[2],d=s[3],f=new Uint32Array(256),h=0,p=0,v=0;for(v=0;v<256;v++)f[v]=v<128?v<<1:v<<1^283;for(v=0;v<256;v++){var g=p^p<<1^p<<2^p<<3^p<<4;g=g>>>8^255&g^99;var y=f[e[t[h]=g]=h],m=f[y],b=f[m],E=257*f[g]^16843008*g;i[h]=E<<24|E>>>8,n[h]=E<<16|E>>>16,a[h]=E<<8|E>>>24,o[h]=E,E=16843009*b^65537*m^257*y^16843008*h,u[g]=E<<24|E>>>8,l[g]=E<<16|E>>>16,c[g]=E<<8|E>>>24,d[g]=E,h?(h=y^f[f[f[b^y]]],p^=f[f[p]]):h=p=1}},t.prototype.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,i=0;i<e.length&&r;)r=e[i]===this.key[i],i++;if(!r){this.key=e;var n=this.keySize=e.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);var a=this.ksRows=4*(n+6+1),o=void 0,s=void 0,u=this.keySchedule=new Uint32Array(a),l=this.invKeySchedule=new Uint32Array(a),c=this.sBox,d=this.rcon,f=this.invSubMix,h=f[0],p=f[1],v=f[2],g=f[3],y=void 0,m=void 0;for(o=0;o<a;o++)o<n?y=u[o]=e[o]:(m=y,o%n==0?(m=c[(m=m<<8|m>>>24)>>>24]<<24|c[m>>>16&255]<<16|c[m>>>8&255]<<8|c[255&m],m^=d[o/n|0]<<24):6<n&&o%n==4&&(m=c[m>>>24]<<24|c[m>>>16&255]<<16|c[m>>>8&255]<<8|c[255&m]),u[o]=y=(u[o-n]^m)>>>0);for(s=0;s<a;s++)o=a-s,m=3&s?u[o]:u[o-4],l[s]=s<4||o<=4?m:h[c[m>>>24]]^p[c[m>>>16&255]]^v[c[m>>>8&255]]^g[c[255&m]],l[s]=l[s]>>>0}},t.prototype.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},t.prototype.decrypt=function(t,e,r,i){for(var n,a,o,s=this.keySize+6,u=this.invKeySchedule,l=this.invSBox,c=this.invSubMix,d=c[0],f=c[1],h=c[2],p=c[3],v=this.uint8ArrayToUint32Array_(r),g=v[0],y=v[1],m=v[2],b=v[3],E=new Int32Array(t),T=new Int32Array(E.length),w=void 0,S=void 0,_=void 0,A=void 0,R=void 0,k=void 0,L=void 0,O=void 0,D=void 0,C=void 0,I=void 0,x=void 0,P=void 0,M=void 0,F=this.networkToHostOrderSwap;e<E.length;){for(D=F(E[e]),C=F(E[e+1]),I=F(E[e+2]),x=F(E[e+3]),R=D^u[0],k=x^u[1],L=I^u[2],O=C^u[3],P=4,M=1;M<s;M++)w=d[R>>>24]^f[k>>16&255]^h[L>>8&255]^p[255&O]^u[P],S=d[k>>>24]^f[L>>16&255]^h[O>>8&255]^p[255&R]^u[P+1],_=d[L>>>24]^f[O>>16&255]^h[R>>8&255]^p[255&k]^u[P+2],A=d[O>>>24]^f[R>>16&255]^h[k>>8&255]^p[255&L]^u[P+3],R=w,k=S,L=_,O=A,P+=4;w=l[R>>>24]<<24^l[k>>16&255]<<16^l[L>>8&255]<<8^l[255&O]^u[P],S=l[k>>>24]<<24^l[L>>16&255]<<16^l[O>>8&255]<<8^l[255&R]^u[P+1],_=l[L>>>24]<<24^l[O>>16&255]<<16^l[R>>8&255]<<8^l[255&k]^u[P+2],A=l[O>>>24]<<24^l[R>>16&255]<<16^l[k>>8&255]<<8^l[255&L]^u[P+3],P+=3,T[e]=F(w^g),T[e+1]=F(A^y),T[e+2]=F(_^m),T[e+3]=F(S^b),g=D,y=C,m=I,b=x,e+=4}return i?(n=T.buffer,a=n.byteLength,(o=a&&new DataView(n).getUint8(a-1))?n.slice(0,a-o):n):T.buffer},t.prototype.destroy=function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0},t}(),o=r(2),c=r(0),d=r(1),i=r(4);var f=Object(i.a)(),n=function(){function a(t,e){var r=(2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).removePKCS7Padding,i=void 0===r||r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),this.logEnabled=!0,this.observer=t,this.config=e,this.removePKCS7Padding=i)try{var n=f.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(t){}this.disableWebCrypto=!this.subtle}return a.prototype.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},a.prototype.decrypt=function(e,r,i,n){var a=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(c.b.log("JS AES decrypt"),this.logEnabled=!1);var t=this.decryptor;t||(this.decryptor=t=new l),t.expandKey(r),n(t.decrypt(e,0,i,this.removePKCS7Padding))}else{this.logEnabled&&(c.b.log("WebCrypto AES decrypt"),this.logEnabled=!1);var o=this.subtle;this.key!==r&&(this.key=r,this.fastAesKey=new u(o,r)),this.fastAesKey.expandKey().then(function(t){new s(o,i).decrypt(e,t).catch(function(t){a.onWebCryptoError(t,e,r,i,n)}).then(function(t){n(t)})}).catch(function(t){a.onWebCryptoError(t,e,r,i,n)})}},a.prototype.onWebCryptoError=function(t,e,r,i,n){this.config.enableSoftwareAES?(c.b.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(e,r,i,n)):(c.b.error("decrypting error : "+t.message),this.observer.trigger(d.a.ERROR,{type:o.b.MEDIA_ERROR,details:o.a.FRAG_DECRYPT_ERROR,fatal:!0,reason:t.message}))},a.prototype.destroy=function(){var t=this.decryptor;t&&(t.destroy(),this.decryptor=void 0)},a}();e.a=n},function(t,e,r){var f=r(0),u=r(1);var s=Math.pow(2,32)-1,i=function(){function v(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,v),this.observer=t,this.remuxer=e}return v.prototype.resetTimeStamp=function(t){this.initPTS=t},v.prototype.resetInitSegment=function(t,e,r,i){if(t&&t.byteLength){var n=this.initData=v.parseInitSegment(t);null==e&&(e="mp4a.40.5"),null==r&&(r="avc1.42e01e");var a={};n.audio&&n.video?a.audiovideo={container:"video/mp4",codec:e+","+r,initSegment:i?t:null}:(n.audio&&(a.audio={container:"audio/mp4",codec:e,initSegment:i?t:null}),n.video&&(a.video={container:"video/mp4",codec:r,initSegment:i?t:null})),this.observer.trigger(u.a.FRAG_PARSING_INIT_SEGMENT,{tracks:a})}else e&&(this.audioCodec=e),r&&(this.videoCodec=r)},v.probe=function(t){return 0<v.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length},v.bin2str=function(t){return String.fromCharCode.apply(null,t)},v.readUint16=function(t,e){t.data&&(e+=t.start,t=t.data);var r=t[e]<<8|t[e+1];return r<0?65536+r:r},v.readUint32=function(t,e){t.data&&(e+=t.start,t=t.data);var r=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return r<0?4294967296+r:r},v.writeUint32=function(t,e,r){t.data&&(e+=t.start,t=t.data),t[e]=r>>24,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r},v.findBox=function(t,e){var r=[],i=void 0,n=void 0,a=void 0,o=void 0,s=void 0,u=void 0;if(t.data?(s=t.start,a=t.end,t=t.data):(s=0,a=t.byteLength),!e.length)return null;for(i=s;i<a;)u=1<(n=v.readUint32(t,i))?i+n:a,v.bin2str(t.subarray(i+4,i+8))===e[0]&&(1===e.length?r.push({data:t,start:i+8,end:u}):(o=v.findBox({data:t,start:i+8,end:u},e.slice(1))).length&&(r=r.concat(o))),i=u;return r},v.parseSegmentIndex=function(t){var e=v.findBox(t,["moov"])[0],r=e?e.end:null,i=0,n=v.findBox(t,["sidx"]),a=void 0;if(!n||!n[0])return null;a=[];var o=(n=n[0]).data[0],s=v.readUint32(n,i=0===o?8:16);i+=4;i+=0===o?8:16,i+=2;var u=n.end+0,l=v.readUint16(n,i);i+=2;for(var c=0;c<l;c++){var d=i,f=v.readUint32(n,d);d+=4;var h=2147483647&f;if(1===(2147483648&f)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var p=v.readUint32(n,d);d+=4,a.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/s,start:u,end:u+h-1}}),u+=h,i=d+=4}return{earliestPresentationTime:0,timescale:s,version:o,referencesCount:l,references:a,moovEndOffset:r}},v.parseInitSegment=function(t){var d=[];return v.findBox(t,["moov","trak"]).forEach(function(t){var e=v.findBox(t,["tkhd"])[0];if(e){var r=e.data[e.start],i=0===r?12:20,n=v.readUint32(e,i),a=v.findBox(t,["mdia","mdhd"])[0];if(a){r=a.data[a.start];var o=v.readUint32(a,i=0===r?12:20),s=v.findBox(t,["mdia","hdlr"])[0];if(s){var u={soun:"audio",vide:"video"}[v.bin2str(s.data.subarray(s.start+8,s.start+12))];if(u){var l=v.findBox(t,["mdia","minf","stbl","stsd"]);if(l.length){l=l[0];var c=v.bin2str(l.data.subarray(l.start+12,l.start+16));f.b.log("MP4Demuxer:"+u+":"+c+" found")}d[n]={timescale:o,type:u},d[u]={timescale:o,id:n}}}}}}),d},v.getStartDTS=function(n,t){var e,r,i=void 0;return i=v.findBox(t,["moof","traf"]),e=[].concat.apply([],i.map(function(i){return v.findBox(i,["tfhd"]).map(function(t){var e,r;return e=v.readUint32(t,4),r=n[e].timescale||9e4,v.findBox(i,["tfdt"]).map(function(t){var e,r=void 0;return e=t.data[t.start],r=v.readUint32(t,4),1===e&&(r*=Math.pow(2,32),r+=v.readUint32(t,8)),r})[0]/r})})),r=Math.min.apply(null,e),isFinite(r)?r:0},v.offsetStartDTS=function(i,t,o){v.findBox(t,["moof","traf"]).map(function(r){return v.findBox(r,["tfhd"]).map(function(t){var e=v.readUint32(t,4),a=i[e].timescale||9e4;v.findBox(r,["tfdt"]).map(function(t){var e=t.data[t.start],r=v.readUint32(t,4);if(0===e)v.writeUint32(t,4,r-o*a);else{r*=Math.pow(2,32),r+=v.readUint32(t,8),r-=o*a,r=Math.max(r,0);var i=Math.floor(r/(s+1)),n=Math.floor(r%(s+1));v.writeUint32(t,4,i),v.writeUint32(t,8,n)}})})})},v.prototype.append=function(t,e,r,i){var n=this.initData;n||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),n=this.initData);var a,o=this.initPTS;if(void 0===o){var s=v.getStartDTS(n,t);this.initPTS=o=s-e,this.observer.trigger(u.a.INIT_PTS_FOUND,{initPTS:o})}v.offsetStartDTS(n,t,o),a=v.getStartDTS(n,t),this.remuxer.remux(n.audio,n.video,null,null,a,r,i,t)},v.prototype.destroy=function(){},v}();e.a=i},function(t,e,r){var Z=r(1),tt=r(2),v=r(8),p=r(3),et=r(0),i=r(4);function n(t,e){return 255===t[e]&&240==(246&t[e+1])}function c(t,e){return 1&t[e+1]?7:9}function d(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function g(t,e){return!!(e+1<t.length&&n(t,e))}function a(t,e){if(e+1<t.length&&n(t,e)){var r=c(t,e);e+5<t.length&&(r=d(t,e));var i=e+r;if(i===t.length||i+1<t.length&&n(t,i))return!0}return!1}function y(t,e,r,i,n){if(!t.samplerate){var a=function(t,e,r,i){var n,a=void 0,o=void 0,s=void 0,u=void 0,l=navigator.userAgent.toLowerCase(),c=i,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];if(a=1+((192&e[r+2])>>>6),n=(60&e[r+2])>>>2,!(d.length-1<n))return s=(1&e[r+2])<<2,s|=(192&e[r+3])>>>6,et.b.log("manifest codec:"+i+",ADTS data:type:"+a+",sampleingIndex:"+n+"["+d[n]+"Hz],channelConfig:"+s),/firefox/i.test(l)?6<=n?(a=5,u=new Array(4),o=n-3):(a=2,u=new Array(2),o=n):-1!==l.indexOf("android")?(a=2,u=new Array(2),o=n):(a=5,u=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&6<=n?o=n-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(6<=n&&1===s||/vivaldi/i.test(l))||!i&&1===s)&&(a=2,u=new Array(2)),o=n)),u[0]=a<<3,u[0]|=(14&n)>>1,u[1]|=(1&n)<<7,u[1]|=s<<3,5===a&&(u[1]|=(14&o)>>1,u[2]=(1&o)<<7,u[2]|=8,u[3]=0),{config:u,samplerate:d[n],channelCount:s,codec:"mp4a.40."+a,manifestCodec:c};t.trigger(Z.a.ERROR,{type:tt.b.MEDIA_ERROR,details:tt.a.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+n})}(e,r,i,n);t.config=a.config,t.samplerate=a.samplerate,t.channelCount=a.channelCount,t.codec=a.codec,t.manifestCodec=a.manifestCodec,et.b.log("parsed codec:"+t.codec+",rate:"+a.samplerate+",nb channel:"+a.channelCount)}}function m(t){return 9216e4/t}function b(t,e,r,i,n){var a=function(t,e,r,i,n){var a,o=void 0,s=t.length;if(a=c(t,e),o=d(t,e),0<(o-=a)&&e+a+o<=s)return{headerLength:a,frameLength:o,stamp:r+i*n}}(e,r,i,n,m(t.samplerate));if(a){var o=a.stamp,s=a.headerLength,u=a.frameLength,l={unit:e.subarray(r+s,r+s+u),pts:o,dts:o};return t.samples.push(l),t.len+=u,{sample:l,length:u+s}}}var E=r(6);var S=function(){function i(t,e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),this.observer=t,this.config=r,this.remuxer=e}return i.prototype.resetInitSegment=function(t,e,r,i){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:e,duration:i,inputTimeScale:9e4}},i.prototype.resetTimeStamp=function(){},i.probe=function(t){if(!t)return!1;for(var e=(E.a.getID3Data(t,0)||[]).length,r=t.length;e<r;e++)if(a(t,e))return et.b.log("ADTS sync word found !"),!0;return!1},i.prototype.append=function(t,e,r,i){for(var n=this._audioTrack,a=E.a.getID3Data(t,0)||[],o=E.a.getTimeStamp(a),s=Object(p.a)(o)?90*o:9e4*e,u=0,l=s,c=t.length,d=a.length,f=[{pts:l,dts:l,data:a}];d<c-1;)if(g(t,d)&&d+5<c){y(n,this.observer,t,d,n.manifestCodec);var h=b(n,t,d,s,u);if(!h){et.b.log("Unable to parse AAC frame");break}d+=h.length,l=h.sample.pts,u++}else E.a.isHeader(t,d)?(a=E.a.getID3Data(t,d),f.push({pts:l,dts:l,data:a}),d+=a.length):d++;this.remuxer.remux(n,{samples:[]},{samples:f,inputTimeScale:9e4},{samples:[]},e,r,i)},i.prototype.destroy=function(){},i}(),_=r(9),T={BitratesMap:[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],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],SamplesCoefficients:[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],BytesInSlot:[0,1,1,4],appendFrame:function(t,e,r,i,n){if(!(r+24>e.length)){var a=this.parseHeader(e,r);if(a&&r+a.frameLength<=e.length){var o=i+n*(9e4*a.samplesPerFrame/a.sampleRate),s={unit:e.subarray(r,r+a.frameLength),pts:o,dts:o};return t.config=[],t.channelCount=a.channelCount,t.samplerate=a.sampleRate,t.samples.push(s),t.len+=a.frameLength,{sample:s,length:a.frameLength}}}},parseHeader:function(t,e){var r=t[e+1]>>3&3,i=t[e+1]>>1&3,n=t[e+2]>>4&15,a=t[e+2]>>2&3,o=t[e+2]>>1&1;if(1!==r&&0!==n&&15!==n&&3!==a){var s=3===r?3-i:3===i?3:4,u=1e3*T.BitratesMap[14*s+n-1],l=3===r?0:2===r?1:2,c=T.SamplingRateMap[3*l+a],d=t[e+3]>>6==3?1:2,f=T.SamplesCoefficients[r][i],h=T.BytesInSlot[i],p=8*f*h;return{sampleRate:c,channelCount:d,frameLength:parseInt(f*u/c+o,10)*h,samplesPerFrame:p}}},isHeaderPattern:function(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])},isHeader:function(t,e){return!!(e+1<t.length&&this.isHeaderPattern(t,e))},probe:function(t,e){if(e+1<t.length&&this.isHeaderPattern(t,e)){var r=this.parseHeader(t,e),i=4;r&&r.frameLength&&(i=r.frameLength);var n=e+i;if(n===t.length||n+1<t.length&&this.isHeaderPattern(t,n))return!0}return!1}},w=T;var A=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}return e.prototype.loadWord=function(){var t=this.data,e=this.bytesAvailable,r=t.byteLength-e,i=new Uint8Array(4),n=Math.min(4,e);if(0===n)throw new Error("no bytes available");i.set(t.subarray(r,r+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n},e.prototype.skipBits=function(t){var e=void 0;this.bitsAvailable>t||(t-=this.bitsAvailable,t-=(e=t>>3)>>3,this.bytesAvailable-=e,this.loadWord()),this.word<<=t,this.bitsAvailable-=t},e.prototype.readBits=function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return 32<t&&et.b.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,0<this.bitsAvailable?this.word<<=e:0<this.bytesAvailable&&this.loadWord(),0<(e=t-e)&&this.bitsAvailable?r<<e|this.readBits(e):r},e.prototype.skipLZ=function(){var t=void 0;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},e.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},e.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},e.prototype.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},e.prototype.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},e.prototype.readBoolean=function(){return 1===this.readBits(1)},e.prototype.readUByte=function(){return this.readBits(8)},e.prototype.readUShort=function(){return this.readBits(16)},e.prototype.readUInt=function(){return this.readBits(32)},e.prototype.skipScalingList=function(t){var e=8,r=8,i=void 0;for(i=0;i<t;i++)0!==r&&(r=(e+this.readEG()+256)%256),e=0===r?e:r},e.prototype.readSPS=function(){var t,e,r,i,n=0,a=0,o=0,s=0,u=void 0,l=void 0,c=void 0,d=this.readUByte.bind(this),f=this.readBits.bind(this),h=this.readUEG.bind(this),p=this.readBoolean.bind(this),v=this.skipBits.bind(this),g=this.skipEG.bind(this),y=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);if(d(),t=d(),f(5),v(3),d(),y(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){var b=h();if(3===b&&v(1),y(),y(),v(1),p())for(l=3!==b?8:12,c=0;c<l;c++)p()&&m(c<6?16:64)}y();var E=h();if(0===E)h();else if(1===E)for(v(1),g(),g(),u=h(),c=0;c<u;c++)g();y(),v(1),e=h(),r=h(),0===(i=f(1))&&v(1),v(1),p()&&(n=h(),a=h(),o=h(),s=h());var T=[1,1];if(p()&&p())switch(d()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:T=[d()<<8|d(),d()<<8|d()]}return{width:Math.ceil(16*(e+1)-2*n-2*a),height:(2-i)*(r+1)*16-(i?2:4)*(o+s),pixelRatio:T}},e.prototype.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}();var o=function(){function n(t,e,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this.decryptdata=r,this.discardEPB=i,this.decrypter=new v.a(t,e,{removePKCS7Padding:!1})}return n.prototype.decryptBuffer=function(t,e){this.decrypter.decrypt(t,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,e)},n.prototype.decryptAacSample=function(e,r,i,n){var a=e[r].unit,t=a.subarray(16,a.length-a.length%16),o=t.buffer.slice(t.byteOffset,t.byteOffset+t.length),s=this;this.decryptBuffer(o,function(t){t=new Uint8Array(t),a.set(t,16),n||s.decryptAacSamples(e,r+1,i)})},n.prototype.decryptAacSamples=function(t,e,r){for(;;e++){if(e>=t.length)return void r();if(!(t[e].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(t,e,r,i),!i)return}}},n.prototype.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e),i=0,n=32;n<=t.length-16;n+=160,i+=16)r.set(t.subarray(n,n+16),i);return r},n.prototype.getAvcDecryptedUnit=function(t,e){e=new Uint8Array(e);for(var r=0,i=32;i<=t.length-16;i+=160,r+=16)t.set(e.subarray(r,r+16),i);return t},n.prototype.decryptAvcSample=function(e,r,i,n,a,o){var s=this.discardEPB(a.data),t=this.getAvcEncryptedData(s),u=this;this.decryptBuffer(t.buffer,function(t){a.data=u.getAvcDecryptedUnit(s,t),o||u.decryptAvcSamples(e,r,i+1,n)})},n.prototype.decryptAvcSamples=function(t,e,r,i){for(;;e++,r=0){if(e>=t.length)return void i();for(var n=t[e].units;!(r>=n.length);r++){var a=n[r];if(!(a.length<=48||1!==a.type&&5!==a.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(t,e,r,i,a,o),!o)return}}}},n}();var s={video:1,audio:2,id3:3,text:4},R=function(){function C(t,e,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,C),this.observer=t,this.config=r,this.typeSupported=i,this.remuxer=e,this.sampleAes=null}return C.prototype.setDecryptData=function(t){null!=t&&null!=t.key&&"SAMPLE-AES"===t.method?this.sampleAes=new o(this.observer,this.config,t,this.discardEPB):this.sampleAes=null},C.probe=function(t){var e=C._syncOffset(t);return!(e<0)&&(e&&et.b.warn("MPEG2-TS detected but first sync word found @ offset "+e+", junk ahead ?"),!0)},C._syncOffset=function(t){for(var e=Math.min(1e3,t.length-564),r=0;r<e;){if(71===t[r]&&71===t[r+188]&&71===t[r+376])return r;r++}return-1},C.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:s[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0,dropped:"video"===t?0:void 0,isAAC:"audio"===t||void 0,duration:"audio"===t?e:void 0}},C.prototype.resetInitSegment=function(t,e,r,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=C.createTrack("video",i),this._audioTrack=C.createTrack("audio",i),this._id3Track=C.createTrack("id3",i),this._txtTrack=C.createTrack("text",i),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=r,this._duration=i},C.prototype.resetTimeStamp=function(){},C.prototype.append=function(t,e,r,i){var n=void 0,a=t.length,o=void 0,s=void 0,u=void 0,l=void 0,c=!1;this.contiguous=r;var d=this.pmtParsed,f=this._avcTrack,h=this._audioTrack,p=this._id3Track,v=f.pid,g=h.pid,y=p.pid,m=this._pmtId,b=f.pesData,E=h.pesData,T=p.pesData,w=this._parsePAT,S=this._parsePMT,_=this._parsePES,A=this._parseAVCPES.bind(this),R=this._parseAACPES.bind(this),k=this._parseMPEGPES.bind(this),L=this._parseID3PES.bind(this),O=C._syncOffset(t);for(a-=(a+O)%188,n=O;n<a;n+=188)if(71===t[n]){if(o=!!(64&t[n+1]),s=((31&t[n+1])<<8)+t[n+2],1<(48&t[n+3])>>4){if((u=n+5+t[n+4])===n+188)continue}else u=n+4;switch(s){case v:o&&(b&&(l=_(b))&&void 0!==l.pts&&A(l,!1),b={data:[],size:0}),b&&(b.data.push(t.subarray(u,n+188)),b.size+=n+188-u);break;case g:o&&(E&&(l=_(E))&&void 0!==l.pts&&(h.isAAC?R(l):k(l)),E={data:[],size:0}),E&&(E.data.push(t.subarray(u,n+188)),E.size+=n+188-u);break;case y:o&&(T&&(l=_(T))&&void 0!==l.pts&&L(l),T={data:[],size:0}),T&&(T.data.push(t.subarray(u,n+188)),T.size+=n+188-u);break;case 0:o&&(u+=t[u]+1),m=this._pmtId=w(t,u);break;case m:o&&(u+=t[u]+1);var D=S(t,u,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);0<(v=D.avc)&&(f.pid=v),0<(g=D.audio)&&(h.pid=g,h.isAAC=D.isAAC),0<(y=D.id3)&&(p.pid=y),c&&!d&&(et.b.log("reparse from beginning"),c=!1,n=O-188),d=this.pmtParsed=!0;break;case 17:case 8191:break;default:c=!0}}else this.observer.trigger(Z.a.ERROR,{type:tt.b.MEDIA_ERROR,details:tt.a.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b&&(l=_(b))&&void 0!==l.pts?(A(l,!0),f.pesData=null):f.pesData=b,E&&(l=_(E))&&void 0!==l.pts?(h.isAAC?R(l):k(l),h.pesData=null):(E&&E.size&&et.b.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=E),T&&(l=_(T))&&void 0!==l.pts?(L(l),p.pesData=null):p.pesData=T,null==this.sampleAes?this.remuxer.remux(h,f,p,this._txtTrack,e,r,i):this.decryptAndRemux(h,f,p,this._txtTrack,e,r,i)},C.prototype.decryptAndRemux=function(t,e,r,i,n,a,o){if(t.samples&&t.isAAC){var s=this;this.sampleAes.decryptAacSamples(t.samples,0,function(){s.decryptAndRemuxAvc(t,e,r,i,n,a,o)})}else this.decryptAndRemuxAvc(t,e,r,i,n,a,o)},C.prototype.decryptAndRemuxAvc=function(t,e,r,i,n,a,o){if(e.samples){var s=this;this.sampleAes.decryptAvcSamples(e.samples,0,0,function(){s.remuxer.remux(t,e,r,i,n,a,o)})}else this.remuxer.remux(t,e,r,i,n,a,o)},C.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},C.prototype._parsePAT=function(t,e){return(31&t[e+10])<<8|t[e+11]},C.prototype._parsePMT=function(t,e,r,i){var n,a=void 0,o={audio:-1,avc:-1,id3:-1,isAAC:!0};for(n=e+3+((15&t[e+1])<<8|t[e+2])-4,e+=12+((15&t[e+10])<<8|t[e+11]);e<n;){switch(a=(31&t[e+1])<<8|t[e+2],t[e]){case 207:if(!i){et.b.log("unkown stream type:"+t[e]);break}case 15:-1===o.audio&&(o.audio=a);break;case 21:-1===o.id3&&(o.id3=a);break;case 219:if(!i){et.b.log("unkown stream type:"+t[e]);break}case 27:-1===o.avc&&(o.avc=a);break;case 3:case 4:r?-1===o.audio&&(o.audio=a,o.isAAC=!1):et.b.log("MPEG audio found, not supported in this browser for now");break;case 36:et.b.warn("HEVC stream type found, not supported for now");break;default:et.b.log("unkown stream type:"+t[e])}e+=5+((15&t[e+3])<<8|t[e+4])}return o},C.prototype._parsePES=function(t){var e=0,r=void 0,i=void 0,n=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,c=t.data;if(!t||0===t.size)return null;for(;c[0].length<19&&1<c.length;){var d=new Uint8Array(c[0].length+c[1].length);d.set(c[0]),d.set(c[1],c[0].length),c[0]=d,c.splice(1,1)}if(1===((r=c[0])[0]<<16)+(r[1]<<8)+r[2]){if((n=(r[4]<<8)+r[5])&&n>t.size-6)return null;192&(i=r[7])&&(4294967295<(s=536870912*(14&r[9])+4194304*(255&r[10])+16384*(254&r[11])+128*(255&r[12])+(254&r[13])/2)&&(s-=8589934592),64&i?(4294967295<(u=536870912*(14&r[14])+4194304*(255&r[15])+16384*(254&r[16])+128*(255&r[17])+(254&r[18])/2)&&(u-=8589934592),54e5<s-u&&(et.b.warn(Math.round((s-u)/9e4)+"s delta between PTS and DTS, align them"),s=u)):u=s),l=(a=r[8])+9,t.size-=l,o=new Uint8Array(t.size);for(var f=0,h=c.length;f<h;f++){var p=(r=c[f]).byteLength;if(l){if(p<l){l-=p;continue}r=r.subarray(l),p-=l,l=0}o.set(r,e),e+=p}return n&&(n-=a+3),{data:o,pts:s,dts:u,len:n}}return null},C.prototype.pushAccesUnit=function(t,e){if(t.units.length&&t.frame){var r=e.samples,i=r.length;!this.config.forceKeyFrameOnDiscontinuity||!0===t.key||e.sps&&(i||this.contiguous)?(t.id=i,r.push(t)):e.dropped++}t.debug.length&&et.b.log(t.pts+"/"+t.dts+":"+t.debug)},C.prototype._parseAVCPES=function(p,t){var v=this,g=this._avcTrack,e=this._parseAVCNALu(p.data),y=void 0,m=this.avcSample,b=void 0,E=!1,T=void 0,w=this.pushAccesUnit.bind(this),S=function(t,e,r,i){return{key:t,pts:e,dts:r,units:[],debug:i}};p.data=null,m&&e.length&&!g.audFound&&(w(m,g),m=this.avcSample=S(!1,p.pts,p.dts,"")),e.forEach(function(t){switch(t.type){case 1:b=!0,m||(m=v.avcSample=S(!0,p.pts,p.dts,"")),m.frame=!0;var e=t.data;if(E&&4<e.length){var r=new A(e).readSliceType();2!==r&&4!==r&&7!==r&&9!==r||(m.key=!0)}break;case 5:b=!0,m||(m=v.avcSample=S(!0,p.pts,p.dts,"")),m.key=!0,m.frame=!0;break;case 6:b=!0,(y=new A(v.discardEPB(t.data))).readUByte();for(var i=0,n=0,a=!1,o=0;!a&&1<y.bytesAvailable;){for(i=0;i+=o=y.readUByte(),255===o;);for(n=0;n+=o=y.readUByte(),255===o;);if(4===i&&0!==y.bytesAvailable){if(a=!0,181===y.readUByte())if(49===y.readUShort())if(1195456820===y.readUInt())if(3===y.readUByte()){var s=y.readUByte(),u=31&s,l=[s,y.readUByte()];for(T=0;T<u;T++)l.push(y.readUByte()),l.push(y.readUByte()),l.push(y.readUByte());v._insertSampleInOrder(v._txtTrack.samples,{type:3,pts:p.pts,bytes:l})}}else if(n<y.bytesAvailable)for(T=0;T<n;T++)y.readUByte()}break;case 7:if(E=b=!0,!g.sps){var c=(y=new A(t.data)).readSPS();g.width=c.width,g.height=c.height,g.pixelRatio=c.pixelRatio,g.sps=[t.data],g.duration=v._duration;var d=t.data.subarray(1,4),f="avc1.";for(T=0;T<3;T++){var h=d[T].toString(16);h.length<2&&(h="0"+h),f+=h}g.codec=f}break;case 8:b=!0,g.pps||(g.pps=[t.data]);break;case 9:b=!1,g.audFound=!0,m&&w(m,g),m=v.avcSample=S(!1,p.pts,p.dts,"");break;case 12:b=!1;break;default:b=!1,m&&(m.debug+="unknown NAL "+t.type+" ")}m&&b&&m.units.push(t)}),t&&m&&(w(m,g),this.avcSample=null)},C.prototype._insertSampleInOrder=function(t,e){var r=t.length;if(0<r){if(e.pts>=t[r-1].pts)t.push(e);else for(var i=r-1;0<=i;i--)if(e.pts<t[i].pts){t.splice(i,0,e);break}}else t.push(e)},C.prototype._getLastNalUnit=function(){var t=this.avcSample,e=void 0;if(!t||0===t.units.length){var r=this._avcTrack.samples;t=r[r.length-1]}if(t){var i=t.units;e=i[i.length-1]}return e},C.prototype._parseAVCNALu=function(t){var e=0,r=t.byteLength,i=void 0,n=void 0,a=this._avcTrack,o=a.naluState||0,s=o,u=[],l=void 0,c=-1,d=void 0;for(-1===o&&(d=31&t[c=0],o=0,e=1);e<r;)if(i=t[e++],o)if(1!==o)if(i)if(1===i){if(0<=c)l={data:t.subarray(c,e-o-1),type:d},u.push(l);else{var f=this._getLastNalUnit();if(f&&(s&&e<=4-s&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-s)),0<(n=e-o-1))){var h=new Uint8Array(f.data.byteLength+n);h.set(f.data,0),h.set(t.subarray(0,n),f.data.byteLength),f.data=h}}e<r?(d=31&t[c=e],o=0):o=-1}else o=0;else o=3;else o=i?0:2;else o=i?0:1;if(0<=c&&0<=o&&(l={data:t.subarray(c,r),type:d,state:o},u.push(l)),0===u.length){var p=this._getLastNalUnit();if(p){var v=new Uint8Array(p.data.byteLength+t.byteLength);v.set(p.data,0),v.set(t,p.data.byteLength),p.data=v}}return a.naluState=o,u},C.prototype.discardEPB=function(t){for(var e,r=t.byteLength,i=[],n=1,a=void 0;n<r-2;)0===t[n]&&0===t[n+1]&&3===t[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return t;e=r-i.length,a=new Uint8Array(e);var o=0;for(n=0;n<e;o++,n++)o===i[0]&&(o++,i.shift()),a[n]=t[o];return a},C.prototype._parseAACPES=function(t){var e,r,i=this._audioTrack,n=t.data,a=t.pts,o=this.aacOverFlow,s=this.aacLastPTS,u=void 0,l=void 0,c=void 0;if(o){var d=new Uint8Array(o.byteLength+n.byteLength);d.set(o,0),d.set(n,o.byteLength),n=d}for(l=0,r=n.length;l<r-1&&!g(n,l);l++);if(l){var f=void 0,h=void 0;if(l<r-1?(f="AAC PES did not start with ADTS header,offset:"+l,h=!1):(f="no ADTS header found in AAC PES",h=!0),et.b.warn("parsing error:"+f),this.observer.trigger(Z.a.ERROR,{type:tt.b.MEDIA_ERROR,details:tt.a.FRAG_PARSING_ERROR,fatal:h,reason:f}),h)return}if(y(i,this.observer,n,l,this.audioCodec),u=0,e=m(i.samplerate),o&&s){var p=s+e;1<Math.abs(p-a)&&(et.b.log("AAC: align PTS for overlapping frames by "+Math.round((p-a)/90)),a=p)}for(;l<r;)if(g(n,l)&&l+5<r){var v=b(i,n,l,a,u);if(!v)break;l+=v.length,c=v.sample.pts,u++}else l++;o=l<r?n.subarray(l,r):null,this.aacOverFlow=o,this.aacLastPTS=c},C.prototype._parseMPEGPES=function(t){for(var e=t.data,r=e.length,i=0,n=0,a=t.pts;n<r;)if(w.isHeader(e,n)){var o=w.appendFrame(this._audioTrack,e,n,a,i);if(!o)break;n+=o.length,i++}else n++},C.prototype._parseID3PES=function(t){this._id3Track.samples.push(t)},C}();var k=function(){function i(t,e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),this.observer=t,this.config=r,this.remuxer=e}return i.prototype.resetInitSegment=function(t,e,r,i){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:e,duration:i,inputTimeScale:9e4}},i.prototype.resetTimeStamp=function(){},i.probe=function(t){var e=void 0,r=void 0,i=E.a.getID3Data(t,0);if(i&&void 0!==E.a.getTimeStamp(i))for(e=i.length,r=Math.min(t.length-1,e+100);e<r;e++)if(w.probe(t,e))return et.b.log("MPEG Audio sync word found !"),!0;return!1},i.prototype.append=function(t,e,r,i){for(var n=E.a.getID3Data(t,0),a=E.a.getTimeStamp(n),o=a?90*a:9e4*e,s=n.length,u=t.length,l=0,c=0,d=this._audioTrack,f=[{pts:o,dts:o,data:n}];s<u;)if(w.isHeader(t,s)){var h=w.appendFrame(d,t,s,o,l);if(!h)break;s+=h.length,c=h.sample.pts,l++}else E.a.isHeader(t,s)?(n=E.a.getID3Data(t,s),f.push({pts:c,dts:c,data:n}),s+=n.length):s++;this.remuxer.remux(d,{samples:[]},{samples:f,inputTimeScale:9e4},{samples:[]},e,r,i)},i.prototype.destroy=function(){},i}();var W=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.getSilentFrame=function(t,e){switch(t){case"mp4a.40.2":if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)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===e)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]);break;default:if(1===e)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===e)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===e)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])}return null},t}();var u=Math.pow(2,32)-1,rt=function(){function f(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f)}return f.init=function(){f.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var t=void 0;for(t in f.types)f.types.hasOwnProperty(t)&&(f.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var e=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]),r=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]);f.HDLR_TYPES={video:e,audio:r};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);f.STTS=f.STSC=f.STCO=n,f.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),f.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),f.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),f.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);f.FTYP=f.box(f.types.ftyp,a,s,a,o),f.DINF=f.box(f.types.dinf,f.box(f.types.dref,i))},f.box=function(t){for(var e=Array.prototype.slice.call(arguments,1),r=8,i=e.length,n=i,a=void 0;i--;)r+=e[i].byteLength;for((a=new Uint8Array(r))[0]=r>>24&255,a[1]=r>>16&255,a[2]=r>>8&255,a[3]=255&r,a.set(t,4),i=0,r=8;i<n;i++)a.set(e[i],r),r+=e[i].byteLength;return a},f.hdlr=function(t){return f.box(f.types.hdlr,f.HDLR_TYPES[t])},f.mdat=function(t){return f.box(f.types.mdat,t)},f.mdhd=function(t,e){e*=t;var r=Math.floor(e/(u+1)),i=Math.floor(e%(u+1));return f.box(f.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,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},f.mdia=function(t){return f.box(f.types.mdia,f.mdhd(t.timescale,t.duration),f.hdlr(t.type),f.minf(t))},f.mfhd=function(t){return f.box(f.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},f.minf=function(t){return"audio"===t.type?f.box(f.types.minf,f.box(f.types.smhd,f.SMHD),f.DINF,f.stbl(t)):f.box(f.types.minf,f.box(f.types.vmhd,f.VMHD),f.DINF,f.stbl(t))},f.moof=function(t,e,r){return f.box(f.types.moof,f.mfhd(t),f.traf(r,e))},f.moov=function(t){for(var e=t.length,r=[];e--;)r[e]=f.trak(t[e]);return f.box.apply(null,[f.types.moov,f.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(f.mvex(t)))},f.mvex=function(t){for(var e=t.length,r=[];e--;)r[e]=f.trex(t[e]);return f.box.apply(null,[f.types.mvex].concat(r))},f.mvhd=function(t,e){e*=t;var r=Math.floor(e/(u+1)),i=Math.floor(e%(u+1)),n=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,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,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 f.box(f.types.mvhd,n)},f.sdtp=function(t){var e=t.samples||[],r=new Uint8Array(4+e.length),i=void 0,n=void 0;for(n=0;n<e.length;n++)i=e[n].flags,r[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return f.box(f.types.sdtp,r)},f.stbl=function(t){return f.box(f.types.stbl,f.stsd(t),f.box(f.types.stts,f.STTS),f.box(f.types.stsc,f.STSC),f.box(f.types.stsz,f.STSZ),f.box(f.types.stco,f.STCO))},f.avc1=function(t){var e=[],r=[],i=void 0,n=void 0,a=void 0;for(i=0;i<t.sps.length;i++)a=(n=t.sps[i]).byteLength,e.push(a>>>8&255),e.push(255&a),e=e.concat(Array.prototype.slice.call(n));for(i=0;i<t.pps.length;i++)a=(n=t.pps[i]).byteLength,r.push(a>>>8&255),r.push(255&a),r=r.concat(Array.prototype.slice.call(n));var o=f.box(f.types.avcC,new Uint8Array([1,e[3],e[4],e[5],255,224|t.sps.length].concat(e).concat([t.pps.length]).concat(r))),s=t.width,u=t.height,l=t.pixelRatio[0],c=t.pixelRatio[1];return f.box(f.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,s>>8&255,255&s,u>>8&255,255&u,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]),o,f.box(f.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),f.box(f.types.pasp,new Uint8Array([l>>24,l>>16&255,l>>8&255,255&l,c>>24,c>>16&255,c>>8&255,255&c])))},f.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},f.mp4a=function(t){var e=t.samplerate;return f.box(f.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]),f.box(f.types.esds,f.esds(t)))},f.mp3=function(t){var e=t.samplerate;return f.box(f.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]))},f.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?f.box(f.types.stsd,f.STSD,f.mp4a(t)):f.box(f.types.stsd,f.STSD,f.mp3(t)):f.box(f.types.stsd,f.STSD,f.avc1(t))},f.tkhd=function(t){var e=t.id,r=t.duration*t.timescale,i=t.width,n=t.height,a=Math.floor(r/(u+1)),o=Math.floor(r%(u+1));return f.box(f.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,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,i>>8&255,255&i,0,0,n>>8&255,255&n,0,0]))},f.traf=function(t,e){var r=f.sdtp(t),i=t.id,n=Math.floor(e/(u+1)),a=Math.floor(e%(u+1));return f.box(f.types.traf,f.box(f.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),f.box(f.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a])),f.trun(t,r.length+16+20+8+16+8+8),r)},f.trak=function(t){return t.duration=t.duration||4294967295,f.box(f.types.trak,f.tkhd(t),f.mdia(t))},f.trex=function(t){var e=t.id;return f.box(f.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},f.trun=function(t,e){var r=t.samples||[],i=r.length,n=12+16*i,a=new Uint8Array(n),o=void 0,s=void 0,u=void 0,l=void 0,c=void 0,d=void 0;for(e+=8+n,a.set([0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),o=0;o<i;o++)u=(s=r[o]).duration,l=s.size,c=s.flags,d=s.cts,a.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,l>>>24&255,l>>>16&255,l>>>8&255,255&l,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,61440&c.degradPrio,15&c.degradPrio,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*o);return f.box(f.types.trun,a)},f.initSegment=function(t){f.types||f.init();var e=f.moov(t),r=void 0;return(r=new Uint8Array(f.FTYP.byteLength+e.byteLength)).set(f.FTYP),r.set(e,f.FTYP.byteLength),r},f}();var L=function(){function a(t,e,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),this.observer=t,this.config=e,this.typeSupported=r;var n=navigator.userAgent;this.isSafari=i&&-1<i.indexOf("Apple")&&n&&!n.match("CriOS"),this.ISGenerated=!1}return a.prototype.destroy=function(){},a.prototype.resetTimeStamp=function(t){this._initPTS=this._initDTS=t},a.prototype.resetInitSegment=function(){this.ISGenerated=!1},a.prototype.remux=function(t,e,r,i,n,a,o){if(this.ISGenerated||this.generateIS(t,e,n),this.ISGenerated){var s=t.samples.length,u=e.samples.length,l=n,c=n;if(s&&u){var d=(t.samples[0].dts-e.samples[0].dts)/e.inputTimeScale;l+=Math.max(0,d),c+=Math.max(0,-d)}if(s){t.timescale||(et.b.warn("regenerate InitSegment as audio detected"),this.generateIS(t,e,n));var f=this.remuxAudio(t,l,a,o);if(u){var h=void 0;f&&(h=f.endPTS-f.startPTS),e.timescale||(et.b.warn("regenerate InitSegment as video detected"),this.generateIS(t,e,n)),this.remuxVideo(e,c,a,h,o)}}else if(u){var p=this.remuxVideo(e,c,a,0,o);p&&t.codec&&this.remuxEmptyAudio(t,l,a,p)}}r.samples.length&&this.remuxID3(r,n),i.samples.length&&this.remuxText(i,n),this.observer.trigger(Z.a.FRAG_PARSED)},a.prototype.generateIS=function(t,e,r){var i=this.observer,n=t.samples,a=e.samples,o=this.typeSupported,s="audio/mp4",u={},l={tracks:u},c=void 0===this._initPTS,d=void 0,f=void 0;if(c&&(d=f=1/0),t.config&&n.length&&(t.timescale=t.samplerate,et.b.log("audio sampling rate : "+t.samplerate),t.isAAC||(o.mpeg?(s="audio/mpeg",t.codec=""):o.mp3&&(t.codec="mp3")),u.audio={container:s,codec:t.codec,initSegment:!t.isAAC&&o.mpeg?new Uint8Array:rt.initSegment([t]),metadata:{channelCount:t.channelCount}},c&&(d=f=n[0].pts-t.inputTimeScale*r)),e.sps&&e.pps&&a.length){var h=e.inputTimeScale;e.timescale=h,u.video={container:"video/mp4",codec:e.codec,initSegment:rt.initSegment([e]),metadata:{width:e.width,height:e.height}},c&&(d=Math.min(d,a[0].pts-h*r),f=Math.min(f,a[0].dts-h*r),this.observer.trigger(Z.a.INIT_PTS_FOUND,{initPTS:d}))}Object.keys(u).length?(i.trigger(Z.a.FRAG_PARSING_INIT_SEGMENT,l),this.ISGenerated=!0,c&&(this._initPTS=d,this._initDTS=f)):i.trigger(Z.a.ERROR,{type:tt.b.MEDIA_ERROR,details:tt.a.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},a.prototype.remuxVideo=function(t,e,r,i,n){var a,o,s,u=8,l=t.timescale,c=void 0,d=void 0,f=void 0,h=void 0,p=t.samples,v=[],g=p.length,y=this._PTSNormalize,m=this._initDTS,b=this.nextAvcDts,E=this.isSafari;if(0!==g){E&&(r|=p.length&&b&&(n&&Math.abs(e-b/l)<.1||Math.abs(p[0].pts-b-m)<l/5)),r||(b=e*l),p.forEach(function(t){t.pts=y(t.pts-m,b),t.dts=y(t.dts-m,b)}),p.sort(function(t,e){var r=t.dts-e.dts,i=t.pts-e.pts;return r||i||t.id-e.id});var T=p.reduce(function(t,e){return Math.max(Math.min(t,e.pts-e.dts),-18e3)},0);if(T<0){et.b.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(T/90)+" ms to overcome this issue");for(var w=0;w<p.length;w++)p[w].dts+=T}var S=p[0];h=Math.max(S.dts,0),f=Math.max(S.pts,0);var _=Math.round((h-b)/90);r&&_&&(1<_?et.b.log("AVC:"+_+" ms hole between fragments detected,filling it"):_<-1&&et.b.log("AVC:"+-_+" ms overlapping between fragments detected"),h=b,p[0].dts=h,f=Math.max(f-_,b),p[0].pts=f,et.b.log("Video/PTS/DTS adjusted: "+Math.round(f/90)+"/"+Math.round(h/90)+",delta:"+_+" ms")),S=p[p.length-1],s=Math.max(S.dts,0),o=Math.max(S.pts,0,s),E&&(c=Math.round((s-h)/(p.length-1)));for(var A=0,R=0,k=0;k<g;k++){for(var L=p[k],O=L.units,D=O.length,C=0,I=0;I<D;I++)C+=O[I].data.length;R+=C,A+=D,L.length=C,L.dts=E?h+k*c:Math.max(L.dts,h),L.pts=Math.max(L.pts,L.dts)}var x=R+4*A+8;try{d=new Uint8Array(x)}catch(t){return void this.observer.trigger(Z.a.ERROR,{type:tt.b.MUX_ERROR,details:tt.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:x,reason:"fail allocating video mdat "+x})}var P=new DataView(d.buffer);P.setUint32(0,x),d.set(rt.types.mdat,4);for(var M=0;M<g;M++){for(var F=p[M],N=F.units,U=0,B=void 0,G=0,j=N.length;G<j;G++){var K=N[G],H=K.data,V=K.data.byteLength;P.setUint32(u,V),u+=4,d.set(H,u),u+=V,U+=4+V}if(E)B=Math.max(0,c*Math.round((F.pts-F.dts)/c));else{if(M<g-1)c=p[M+1].dts-F.dts;else{var W=this.config,Y=F.dts-p[0<M?M-1:M].dts;if(W.stretchShortVideoTrack){var q=W.maxBufferHole,z=Math.floor(q*l),X=(i?f+i*l:this.nextAudioPts)-F.pts;z<X?((c=X-Y)<0&&(c=Y),et.b.log("It is approximately "+X/90+" ms to the next segment; using duration "+c/90+" ms for the last video frame.")):c=Y}else c=Y}B=Math.round(F.pts-F.dts)}v.push({size:U,duration:c,cts:B,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:F.key?2:1,isNonSync:F.key?0:1}})}this.nextAvcDts=s+c;var Q=t.dropped;if(t.len=0,t.nbNalu=0,t.dropped=0,v.length&&-1<navigator.userAgent.toLowerCase().indexOf("chrome")){var $=v[0].flags;$.dependsOn=2,$.isNonSync=0}t.samples=v,a=rt.moof(t.sequenceNumber++,h,t),t.samples=[];var J={data1:a,data2:d,startPTS:f/l,endPTS:(o+c)/l,startDTS:h/l,endDTS:this.nextAvcDts/l,type:"video",hasAudio:!1,hasVideo:!0,nb:v.length,dropped:Q};return this.observer.trigger(Z.a.FRAG_PARSING_DATA,J),J}},a.prototype.remuxAudio=function(t,e,r,i){var n=t.inputTimeScale,a=t.timescale,o=n/a,s=(t.isAAC?1024:1152)*o,u=this._PTSNormalize,l=this._initDTS,c=!t.isAAC&&this.typeSupported.mpeg,d=void 0,f=void 0,h=void 0,p=void 0,v=void 0,g=void 0,y=void 0,m=t.samples,b=[],E=this.nextAudioPts;if(r|=m.length&&E&&(i&&Math.abs(e-E/n)<.1||Math.abs(m[0].pts-E-l)<20*s),m.forEach(function(t){t.pts=t.dts=u(t.pts-l,e*n)}),0!==(m=m.filter(function(t){return 0<=t.pts})).length){if(r||(E=i?e*n:m[0].pts),t.isAAC)for(var T=this.config.maxAudioFramesDrift,w=0,S=E;w<m.length;){var _,A=m[w];_=A.pts-S;var R=Math.abs(1e3*_/n);if(_<=-T*s)et.b.warn("Dropping 1 audio frame @ "+(S/n).toFixed(3)+"s due to "+Math.round(R)+" ms overlap."),m.splice(w,1),t.len-=A.unit.length;else if(T*s<=_&&R<1e4&&S){var k=Math.round(_/s);et.b.warn("Injecting "+k+" audio frame @ "+(S/n).toFixed(3)+"s due to "+Math.round(1e3*_/n)+" ms gap.");for(var L=0;L<k;L++){var O=Math.max(S,0);(h=W.getSilentFrame(t.manifestCodec||t.codec,t.channelCount))||(et.b.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),h=A.unit.subarray()),m.splice(w,0,{unit:h,pts:O,dts:O}),t.len+=h.length,S+=s,w++}A.pts=A.dts=S,S+=s,w++}else A.pts=A.dts=S,S+=s,w++}for(var D=0,C=m.length;D<C;D++){var I=m[D],x=I.unit,P=I.pts;if(void 0!==y)f.duration=Math.round((P-y)/o);else{var M=Math.round(1e3*(P-E)/n),F=0;if(r&&t.isAAC&&M){if(0<M&&M<1e4)F=Math.round((P-E)/s),et.b.log(M+" ms hole between AAC samples detected,filling it"),0<F&&((h=W.getSilentFrame(t.manifestCodec||t.codec,t.channelCount))||(h=x.subarray()),t.len+=F*h.length);else if(M<-12){et.b.log("drop overlapping AAC sample, expected/parsed/delta:"+(E/n).toFixed(3)+"s/"+(P/n).toFixed(3)+"s/"+-M+"ms"),t.len-=x.byteLength;continue}P=E}if(g=P,!(0<t.len))return;var N=c?t.len:t.len+8;d=c?0:8;try{p=new Uint8Array(N)}catch(t){return void this.observer.trigger(Z.a.ERROR,{type:tt.b.MUX_ERROR,details:tt.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:N,reason:"fail allocating audio mdat "+N})}c||(new DataView(p.buffer).setUint32(0,N),p.set(rt.types.mdat,4));for(var U=0;U<F;U++)(h=W.getSilentFrame(t.manifestCodec||t.codec,t.channelCount))||(et.b.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),h=x.subarray()),p.set(h,d),d+=h.byteLength,f={size:h.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},b.push(f)}p.set(x,d);var B=x.byteLength;d+=B,f={size:B,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},b.push(f),y=P}var G=0,j=b.length;if(2<=j&&(G=b[j-2].duration,f.duration=G),j){this.nextAudioPts=E=y+o*G,t.len=0,t.samples=b,v=c?new Uint8Array:rt.moof(t.sequenceNumber++,g/o,t),t.samples=[];var K=g/n,H=E/n,V={data1:v,data2:p,startPTS:K,endPTS:H,startDTS:K,endDTS:H,type:"audio",hasAudio:!0,hasVideo:!1,nb:j};return this.observer.trigger(Z.a.FRAG_PARSING_DATA,V),V}return null}},a.prototype.remuxEmptyAudio=function(t,e,r,i){var n=t.inputTimeScale,a=n/(t.samplerate?t.samplerate:n),o=this.nextAudioPts,s=(void 0!==o?o:i.startDTS*n)+this._initDTS,u=i.endDTS*n+this._initDTS,l=1024*a,c=Math.ceil((u-s)/l),d=W.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(et.b.warn("remux empty Audio"),d){for(var f=[],h=0;h<c;h++){var p=s+h*l;f.push({unit:d,pts:p,dts:p}),t.len+=d.length}t.samples=f,this.remuxAudio(t,e,r)}else et.b.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},a.prototype.remuxID3=function(t,e){var r=t.samples.length,i=void 0,n=t.inputTimeScale,a=this._initPTS,o=this._initDTS;if(r){for(var s=0;s<r;s++)(i=t.samples[s]).pts=(i.pts-a)/n,i.dts=(i.dts-o)/n;this.observer.trigger(Z.a.FRAG_PARSING_METADATA,{samples:t.samples})}t.samples=[],e=e},a.prototype.remuxText=function(t,e){t.samples.sort(function(t,e){return t.pts-e.pts});var r=t.samples.length,i=void 0,n=t.inputTimeScale,a=this._initPTS;if(r){for(var o=0;o<r;o++)(i=t.samples[o]).pts=(i.pts-a)/n;this.observer.trigger(Z.a.FRAG_PARSING_USERDATA,{samples:t.samples})}t.samples=[],e=e},a.prototype._PTSNormalize=function(t,e){var r=void 0;if(void 0===e)return t;for(r=e<t?-8589934592:8589934592;4294967296<Math.abs(t-e);)t+=r;return t},a}();var O=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.observer=t}return e.prototype.destroy=function(){},e.prototype.resetTimeStamp=function(){},e.prototype.resetInitSegment=function(){},e.prototype.remux=function(t,e,r,i,n,a,o,s){var u=this.observer,l="";t&&(l+="audio"),e&&(l+="video"),u.trigger(Z.a.FRAG_PARSING_DATA,{data1:s,startPTS:n,startDTS:n,type:l,hasAudio:!!t,hasVideo:!!e,nb:1,dropped:0}),u.trigger(Z.a.FRAG_PARSED)},e}();var D=Object(i.a)().performance,l=function(){function n(t,e,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this.observer=t,this.typeSupported=e,this.config=r,this.vendor=i}return n.prototype.destroy=function(){var t=this.demuxer;t&&t.destroy()},n.prototype.push=function(t,r,i,n,a,o,s,u,l,c,d,f){if(0<t.byteLength&&null!=r&&null!=r.key&&"AES-128"===r.method){var e=this.decrypter;null==e&&(e=this.decrypter=new v.a(this.observer,this.config));var h=this,p=void 0;try{p=D.now()}catch(t){p=Date.now()}e.decrypt(t,r.key.buffer,r.iv.buffer,function(t){var e=void 0;try{e=D.now()}catch(t){e=Date.now()}h.observer.trigger(Z.a.FRAG_DECRYPTED,{stats:{tstart:p,tdecrypt:e}}),h.pushDecrypted(new Uint8Array(t),r,new Uint8Array(i),n,a,o,s,u,l,c,d,f)})}else this.pushDecrypted(new Uint8Array(t),r,new Uint8Array(i),n,a,o,s,u,l,c,d,f)},n.prototype.pushDecrypted=function(t,e,r,i,n,a,o,s,u,l,c,d){var f=this.demuxer;if(!f||(o||s)&&!this.probe(t)){for(var h=this.observer,p=this.typeSupported,v=this.config,g=[{demux:R,remux:L},{demux:_.a,remux:O},{demux:S,remux:L},{demux:k,remux:L}],y=0,m=g.length;y<m;y++){var b=g[y],E=b.demux.probe;if(E(t)){var T=this.remuxer=new b.remux(h,v,p,this.vendor);f=new b.demux(h,T,v,p),this.probe=E;break}}if(!f)return void h.trigger(Z.a.ERROR,{type:tt.b.MEDIA_ERROR,details:tt.a.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=f}var w=this.remuxer;(o||s)&&(f.resetInitSegment(r,i,n,l),w.resetInitSegment()),o&&(f.resetTimeStamp(d),w.resetTimeStamp(d)),"function"==typeof f.setDecryptData&&f.setDecryptData(e),f.append(t,a,u,c)},n}();e.a=l},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});var i={};r.d(i,"newCue",function(){return Se});var n=r(5),a=r.n(n),f=r(2),M=r(3),F=r(1),N=r(0),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};var s=new Set(["hlsEventGeneric","hlsHandlerDestroying","hlsHandlerDestroyed"]),u=function(){function n(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this.hls=t,this.onEvent=this.onEvent.bind(this);for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];this.handledEvents=r,this.useGenericHandler=!0,this.registerListeners()}return n.prototype.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},n.prototype.onHandlerDestroying=function(){},n.prototype.onHandlerDestroyed=function(){},n.prototype.isEventHandler=function(){return"object"===o(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent},n.prototype.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){if(s.has(t))throw new Error("Forbidden event-name: "+t);this.hls.on(t,this.onEvent)},this)},n.prototype.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){this.hls.off(t,this.onEvent)},this)},n.prototype.onEvent=function(t,e){this.onEventGeneric(t,e)},n.prototype.onEventGeneric=function(e,t){try{(function(t,e){var r="on"+t.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,e)}).call(this,e,t).call()}catch(t){N.b.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.hls.trigger(F.a.ERROR,{type:f.b.OTHER_ERROR,details:f.a.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}},n}(),l=r(9),c=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var k=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.method=null,this.key=null,this.iv=null,this._uri=null}return c(t,[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=a.a.buildAbsoluteURL(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}]),t}(),d=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var L=function(){function e(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this._url=null,this._byteRange=null,this._decryptdata=null,this.tagList=[],this.programDateTime=null,this.rawProgramDateTime=null,this._elementaryStreams=((t={})[e.ElementaryStreamTypes.AUDIO]=!1,t[e.ElementaryStreamTypes.VIDEO]=!1,t)}return e.prototype.addElementaryStream=function(t){this._elementaryStreams[t]=!0},e.prototype.hasElementaryStream=function(t){return!0===this._elementaryStreams[t]},e.prototype.createInitializationVector=function(t){for(var e=new Uint8Array(16),r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e},e.prototype.fragmentDecryptdataFromLevelkey=function(t,e){var r=t;return t&&t.method&&t.uri&&!t.iv&&((r=new k).method=t.method,r.baseuri=t.baseuri,r.reluri=t.reluri,r.iv=this.createInitializationVector(e)),r},d(e,[{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=a.a.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(t){this._url=t}},{key:"byteRange",get:function(){if(!this._byteRange&&!this.rawByteRange)return[];if(this._byteRange)return this._byteRange;var t=[];if(this.rawByteRange){var e=this.rawByteRange.split("@",2);if(1===e.length){var r=this.lastByteRangeEndOffset;t[0]=r||0}else t[0]=parseInt(e[1]);t[1]=parseInt(e[0])+t[0],this._byteRange=t}return t}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){return this._decryptdata||(this._decryptdata=this.fragmentDecryptdataFromLevelkey(this.levelkey,this.sn)),this._decryptdata}},{key:"endProgramDateTime",get:function(){if(!Object(M.a)(this.programDateTime))return null;var t=Object(M.a)(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){return!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)}}],[{key:"ElementaryStreamTypes",get:function(){return{AUDIO:"audio",VIDEO:"video"}}}]),e}(),h=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var O=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.endCC=0,this.endSN=0,this.fragments=[],this.initSegment=null,this.live=!0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=t,this.version=null}return h(e,[{key:"hasProgramDateTime",get:function(){return!(!this.fragments[0]||!Object(M.a)(this.fragments[0].programDateTime))}}]),e}();var p=/^(\d+)x(\d+)$/,v=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,D=function(){function r(t){for(var e in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),"string"==typeof t&&(t=r.parseAttrList(t)),t)t.hasOwnProperty(e)&&(this[e]=t[e])}return r.prototype.decimalInteger=function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},r.prototype.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var r=new Uint8Array(e.length/2),i=0;i<e.length/2;i++)r[i]=parseInt(e.slice(2*i,2*i+2),16);return r}return null},r.prototype.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},r.prototype.decimalFloatingPoint=function(t){return parseFloat(this[t])},r.prototype.enumeratedString=function(t){return this[t]},r.prototype.decimalResolution=function(t){var e=p.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},r.parseAttrList=function(t){var e=void 0,r={};for(v.lastIndex=0;null!==(e=v.exec(t));){var i=e[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[e[1]]=i}return r},r}(),g={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0}};function y(t,e){return window.MediaSource.isTypeSupported((e||"video")+'/mp4;codecs="'+t+'"')}var m=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,b=/#EXT-X-MEDIA:(.*)/g,C=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)(\S+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),I=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)([^:]*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/,x=/\.(mp4|m4s|m4v|m4a)$/i,E=function(){function c(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c)}return c.findGroup=function(t,e){if(!t)return null;for(var r=null,i=0;i<t.length;i++){var n=t[i];n.id===e&&(r=n)}return r},c.convertAVC1ToAVCOTI=function(t){var e=void 0,r=t.split(".");return 2<r.length?(e=r.shift()+".",e+=parseInt(r.shift()).toString(16),e+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):e=t,e},c.resolve=function(t,e){return a.a.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},c.parseMasterPlaylist=function(t,e){var r=[],i=void 0;function n(r,n){["video","audio"].forEach(function(i){var e=r.filter(function(t){return e=t,!!(r=g[i])&&!0===r[e.slice(0,4)];var e,r});if(e.length){var t=e.filter(function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)});n[i+"Codec"]=0<t.length?t[0]:e[0],r=r.filter(function(t){return-1===e.indexOf(t)})}}),n.unknownCodecs=r}for(m.lastIndex=0;null!=(i=m.exec(t));){var a={},o=a.attrs=new D(i[1]);a.url=c.resolve(i[2],e);var s=o.decimalResolution("RESOLUTION");s&&(a.width=s.width,a.height=s.height),a.bitrate=o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),a.name=o.NAME,n([].concat((o.CODECS||"").split(/[ ,]+/)),a),a.videoCodec&&-1!==a.videoCodec.indexOf("avc1")&&(a.videoCodec=c.convertAVC1ToAVCOTI(a.videoCodec)),r.push(a)}return r},c.parseMasterPlaylistMedia=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:[],n=void 0,a=[],o=0;for(b.lastIndex=0;null!==(n=b.exec(t));){var s={},u=new D(n[1]);if(u.TYPE===r){if(s.groupId=u["GROUP-ID"],s.name=u.NAME,s.type=r,s.default="YES"===u.DEFAULT,s.autoselect="YES"===u.AUTOSELECT,s.forced="YES"===u.FORCED,u.URI&&(s.url=c.resolve(u.URI,e)),s.lang=u.LANGUAGE,s.name||(s.name=s.lang),i.length){var l=c.findGroup(i,s.groupId);s.audioCodec=l?l.codec:i[0].codec}s.id=o++,a.push(s)}}return a},c.parseLevelPlaylist=function(t,e,r,i,n){var a=0,o=0,s=new O(e),u=new k,l=0,c=null,d=new L,f=void 0,h=void 0,p=null;for(C.lastIndex=0;null!==(f=C.exec(t));){var v=f[1];if(v){d.duration=parseFloat(v);var g=(" "+f[2]).slice(1);d.title=g||null,d.tagList.push(g?["INF",v,g]:["INF",v])}else if(f[3]){if(Object(M.a)(d.duration)){var y=a++;d.type=i,d.start=o,d.levelkey=u,d.sn=y,d.level=r,d.cc=l,d.urlId=n,d.baseurl=e,d.relurl=(" "+f[3]).slice(1),P(d,c),s.fragments.push(d),o+=(c=d).duration,d=new L}}else if(f[4]){if(d.rawByteRange=(" "+f[4]).slice(1),c){var m=c.byteRangeEndOffset;m&&(d.lastByteRangeEndOffset=m)}}else if(f[5])d.rawProgramDateTime=(" "+f[5]).slice(1),d.tagList.push(["PROGRAM-DATE-TIME",d.rawProgramDateTime]),null===p&&(p=s.fragments.length);else{for(f=f[0].match(I),h=1;h<f.length&&void 0===f[h];h++);var b=(" "+f[h+1]).slice(1),E=(" "+f[h+2]).slice(1);switch(f[h]){case"#":d.tagList.push(E?[b,E]:[b]);break;case"PLAYLIST-TYPE":s.type=b.toUpperCase();break;case"MEDIA-SEQUENCE":a=s.startSN=parseInt(b);break;case"TARGETDURATION":s.targetduration=parseFloat(b);break;case"VERSION":s.version=parseInt(b);break;case"EXTM3U":break;case"ENDLIST":s.live=!1;break;case"DIS":l++,d.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":l=parseInt(b);break;case"KEY":var T=new D(b),w=T.enumeratedString("METHOD"),S=T.URI,_=T.hexadecimalInteger("IV");w&&(u=new k,S&&0<=["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(w)&&(u.method=w,u.baseuri=e,u.reluri=S,u.key=null,u.iv=_));break;case"START":var A=new D(b).decimalFloatingPoint("TIME-OFFSET");Object(M.a)(A)&&(s.startTimeOffset=A);break;case"MAP":var R=new D(b);d.relurl=R.URI,d.rawByteRange=R.BYTERANGE,d.baseurl=e,d.level=r,d.type=i,d.sn="initSegment",s.initSegment=d,(d=new L).rawProgramDateTime=s.initSegment.rawProgramDateTime;break;default:N.b.warn("line parsed but not handled: "+f)}}}return(d=c)&&!d.relurl&&(s.fragments.pop(),o-=d.duration),s.totalduration=o,s.averagetargetduration=o/s.fragments.length,s.endSN=a-1,s.startCC=s.fragments[0]?s.fragments[0].cc:0,s.endCC=l,!s.initSegment&&s.fragments.length&&s.fragments.every(function(t){return x.test(t.relurl)})&&(N.b.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(d=new L).relurl=s.fragments[0].relurl,d.baseurl=e,d.level=r,d.type=i,d.sn="initSegment",s.initSegment=d,s.needSidxRanges=!0),p&&function(t,e){for(var r=t[e],i=e-1;0<=i;i--){var n=t[i];n.programDateTime=r.programDateTime-1e3*n.duration,r=n}}(s.fragments,p),s},c}();function P(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),Object(M.a)(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}var T=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var w=window.performance,S={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},_={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},A=function(r){function v(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,v);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.MANIFEST_LOADING,F.a.LEVEL_LOADING,F.a.AUDIO_TRACK_LOADING,F.a.SUBTITLE_TRACK_LOADING));return e.loaders={},e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(v,r),v.canHaveQualityLevels=function(t){return t!==S.AUDIO_TRACK&&t!==S.SUBTITLE_TRACK},v.mapContextToLevelType=function(t){switch(t.type){case S.AUDIO_TRACK:return _.AUDIO;case S.SUBTITLE_TRACK:return _.SUBTITLE;default:return _.MAIN}},v.getResponseUrl=function(t,e){var r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r},v.prototype.createInternalLoader=function(t){var e=this.hls.config,r=e.pLoader,i=e.loader,n=new(r||i)(e);return t.loader=n,this.loaders[t.type]=n},v.prototype.getInternalLoader=function(t){return this.loaders[t.type]},v.prototype.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},v.prototype.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},v.prototype.destroy=function(){this.destroyInternalLoaders(),r.prototype.destroy.call(this)},v.prototype.onManifestLoading=function(t){this.load(t.url,{type:S.MANIFEST,level:0,id:null})},v.prototype.onLevelLoading=function(t){this.load(t.url,{type:S.LEVEL,level:t.level,id:t.id})},v.prototype.onAudioTrackLoading=function(t){this.load(t.url,{type:S.AUDIO_TRACK,level:null,id:t.id})},v.prototype.onSubtitleTrackLoading=function(t){this.load(t.url,{type:S.SUBTITLE_TRACK,level:null,id:t.id})},v.prototype.load=function(t,e){var r=this.hls.config;N.b.debug("Loading playlist of type "+e.type+", level: "+e.level+", id: "+e.id);var i=this.getInternalLoader(e);if(i){var n=i.context;if(n&&n.url===t)return N.b.trace("playlist request ongoing"),!1;N.b.warn("aborting previous loader for type: "+e.type),i.abort()}var a=void 0,o=void 0,s=void 0,u=void 0;switch(e.type){case S.MANIFEST:a=r.manifestLoadingMaxRetry,o=r.manifestLoadingTimeOut,s=r.manifestLoadingRetryDelay,u=r.manifestLoadingMaxRetryTimeout;break;case S.LEVEL:a=0,o=r.levelLoadingTimeOut;break;default:a=r.levelLoadingMaxRetry,o=r.levelLoadingTimeOut,s=r.levelLoadingRetryDelay,u=r.levelLoadingMaxRetryTimeout}i=this.createInternalLoader(e),e.url=t,e.responseType=e.responseType||"";var l={timeout:o,maxRetry:a,retryDelay:s,maxRetryDelay:u},c={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return N.b.debug("Calling internal loader delegate for URL: "+t),i.load(e,l,c),!0},v.prototype.loadsuccess=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;if(r.isSidxRequest)return this._handleSidxRequest(t,r),void this._handlePlaylistLoaded(t,e,r,i);this.resetInternalLoader(r.type);var n=t.data;e.tload=w.now(),0===n.indexOf("#EXTM3U")?0<n.indexOf("#EXTINF:")||0<n.indexOf("#EXT-X-TARGETDURATION:")?this._handleTrackOrLevelPlaylist(t,e,r,i):this._handleMasterPlaylist(t,e,r,i):this._handleManifestParsingError(t,r,"no EXTM3U delimiter",i)},v.prototype.loaderror=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(e,r)},v.prototype.loadtimeout=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(e,r,!0)},v.prototype._handleMasterPlaylist=function(t,e,r,i){var n=this.hls,a=t.data,o=v.getResponseUrl(t,r),s=E.parseMasterPlaylist(a,o);if(s.length){var u=s.map(function(t){return{id:t.attrs.AUDIO,codec:t.audioCodec}}),l=E.parseMasterPlaylistMedia(a,o,"AUDIO",u),c=E.parseMasterPlaylistMedia(a,o,"SUBTITLES");if(l.length){var d=!1;l.forEach(function(t){t.url||(d=!0)}),!1===d&&s[0].audioCodec&&!s[0].attrs.AUDIO&&(N.b.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),l.unshift({type:"main",name:"main"}))}n.trigger(F.a.MANIFEST_LOADED,{levels:s,audioTracks:l,subtitles:c,url:o,stats:e,networkDetails:i})}else this._handleManifestParsingError(t,r,"no level found in manifest",i)},v.prototype._handleTrackOrLevelPlaylist=function(t,e,r,i){var n=this.hls,a=r.id,o=r.level,s=r.type,u=v.getResponseUrl(t,r),l=Object(M.a)(a)?a:0,c=Object(M.a)(o)?o:l,d=v.mapContextToLevelType(r),f=E.parseLevelPlaylist(t.data,u,c,d,l);if(f.tload=e.tload,s===S.MANIFEST){var h={url:u,details:f};n.trigger(F.a.MANIFEST_LOADED,{levels:[h],audioTracks:[],url:u,stats:e,networkDetails:i})}if(e.tparsed=w.now(),f.needSidxRanges){var p=f.initSegment.url;this.load(p,{isSidxRequest:!0,type:s,level:o,levelDetails:f,id:a,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}else r.levelDetails=f,this._handlePlaylistLoaded(t,e,r,i)},v.prototype._handleSidxRequest=function(t,n){var e=l.a.parseSegmentIndex(new Uint8Array(t.data));e.references.forEach(function(t,e){var r=t.info,i=n.levelDetails.fragments[e];0===i.byteRange.length&&(i.rawByteRange=String(1+r.end-r.start)+"@"+String(r.start))}),n.levelDetails.initSegment.rawByteRange=String(e.moovEndOffset)+"@0"},v.prototype._handleManifestParsingError=function(t,e,r,i){this.hls.trigger(F.a.ERROR,{type:f.b.NETWORK_ERROR,details:f.a.MANIFEST_PARSING_ERROR,fatal:!0,url:t.url,reason:r,networkDetails:i})},v.prototype._handleNetworkError=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];N.b.info("A network error occured while loading a "+t.type+"-type playlist");var i=void 0,n=void 0,a=this.getInternalLoader(t);switch(t.type){case S.MANIFEST:i=r?f.a.MANIFEST_LOAD_TIMEOUT:f.a.MANIFEST_LOAD_ERROR,n=!0;break;case S.LEVEL:i=r?f.a.LEVEL_LOAD_TIMEOUT:f.a.LEVEL_LOAD_ERROR,n=!1;break;case S.AUDIO_TRACK:i=r?f.a.AUDIO_TRACK_LOAD_TIMEOUT:f.a.AUDIO_TRACK_LOAD_ERROR,n=!1;break;default:n=!1}a&&(a.abort(),this.resetInternalLoader(t.type)),this.hls.trigger(F.a.ERROR,{type:f.b.NETWORK_ERROR,details:i,fatal:n,url:a.url,loader:a,context:t,networkDetails:e})},v.prototype._handlePlaylistLoaded=function(t,e,r,i){var n=r.type,a=r.level,o=r.id,s=r.levelDetails;if(s.targetduration)if(v.canHaveQualityLevels(r.type))this.hls.trigger(F.a.LEVEL_LOADED,{details:s,level:a||0,id:o||0,stats:e,networkDetails:i});else switch(n){case S.AUDIO_TRACK:this.hls.trigger(F.a.AUDIO_TRACK_LOADED,{details:s,id:o,stats:e,networkDetails:i});break;case S.SUBTITLE_TRACK:this.hls.trigger(F.a.SUBTITLE_TRACK_LOADED,{details:s,id:o,stats:e,networkDetails:i})}else this._handleManifestParsingError(t,r,"invalid target duration",i)},T(v,null,[{key:"ContextType",get:function(){return S}},{key:"LevelType",get:function(){return _}}]),v}(u);var R=function(i){function r(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,F.a.FRAG_LOADING));return e.loaders={},e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(r,i),r.prototype.destroy=function(){var t=this.loaders;for(var e in t){var r=t[e];r&&r.destroy()}this.loaders={},i.prototype.destroy.call(this)},r.prototype.onFragLoading=function(t){var e=t.frag,r=e.type,i=this.loaders,n=this.hls.config,a=n.fLoader,o=n.loader;e.loaded=0;var s=i[r];s&&(N.b.warn("abort previous fragment loader for type: "+r),s.abort()),s=i[r]=e.loader=n.fLoader?new a(n):new o(n);var u,l,c=void 0;c={url:e.url,frag:e,responseType:"arraybuffer",progressData:!1};var d=e.byteRangeStartOffset,f=e.byteRangeEndOffset;Object(M.a)(d)&&Object(M.a)(f)&&(c.rangeStart=d,c.rangeEnd=f),u={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:n.fragLoadingMaxRetryTimeout},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},s.load(c,u,l)},r.prototype.loadsuccess=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,n=t.data,a=r.frag;a.loader=void 0,this.loaders[a.type]=void 0,this.hls.trigger(F.a.FRAG_LOADED,{payload:n,frag:a,stats:e,networkDetails:i})},r.prototype.loaderror=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=e.frag,n=i.loader;n&&n.abort(),this.loaders[i.type]=void 0,this.hls.trigger(F.a.ERROR,{type:f.b.NETWORK_ERROR,details:f.a.FRAG_LOAD_ERROR,fatal:!1,frag:e.frag,response:t,networkDetails:r})},r.prototype.loadtimeout=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=e.frag,n=i.loader;n&&n.abort(),this.loaders[i.type]=void 0,this.hls.trigger(F.a.ERROR,{type:f.b.NETWORK_ERROR,details:f.a.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e.frag,networkDetails:r})},r.prototype.loadprogress=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,n=e.frag;n.loaded=t.loaded,this.hls.trigger(F.a.FRAG_LOAD_PROGRESS,{frag:n,stats:t,networkDetails:i})},r}(u);var U=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.KEY_LOADING));return e.loaders={},e.decryptkey=null,e.decrypturl=null,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype.destroy=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={},u.prototype.destroy.call(this)},i.prototype.onKeyLoading=function(t){var e=t.frag,r=e.type,i=this.loaders[r],n=e.decryptdata,a=n.uri;if(a!==this.decrypturl||null===this.decryptkey){var o=this.hls.config;i&&(N.b.warn("abort previous key loader for type:"+r),i.abort()),e.loader=this.loaders[r]=new o.loader(o),this.decrypturl=a,this.decryptkey=null;var s,u,l;s={url:a,frag:e,responseType:"arraybuffer"},u={timeout:o.fragLoadingTimeOut,maxRetry:o.fragLoadingMaxRetry,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},e.loader.load(s,u,l)}else this.decryptkey&&(n.key=this.decryptkey,this.hls.trigger(F.a.KEY_LOADED,{frag:e}))},i.prototype.loadsuccess=function(t,e,r){var i=r.frag;this.decryptkey=i.decryptdata.key=new Uint8Array(t.data),i.loader=void 0,this.loaders[i.type]=void 0,this.hls.trigger(F.a.KEY_LOADED,{frag:i})},i.prototype.loaderror=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(F.a.ERROR,{type:f.b.NETWORK_ERROR,details:f.a.KEY_LOAD_ERROR,fatal:!1,frag:r,response:t})},i.prototype.loadtimeout=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(F.a.ERROR,{type:f.b.NETWORK_ERROR,details:f.a.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},i}(u);var B="NOT_LOADED",G="APPENDING",j="PARTIAL",K="OK",H=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.BUFFER_APPENDED,F.a.FRAG_BUFFERED,F.a.FRAG_LOADED));return e.bufferPadding=.2,e.fragments=Object.create(null),e.timeRanges=Object.create(null),e.config=t.config,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype.destroy=function(){this.fragments=null,this.timeRanges=null,this.config=null,u.prototype.destroy.call(this),r.prototype.destroy.call(this)},i.prototype.getBufferedFrag=function(i,n){var a=this.fragments,t=Object.keys(a).filter(function(t){var e=a[t];if(e.body.type!==n)return!1;if(!e.buffered)return!1;var r=e.body;return r.startPTS<=i&&i<=r.endPTS});if(0===t.length)return null;var e=t.pop();return a[e].body},i.prototype.detectEvictedFragments=function(n,a){var o=this,s=void 0,u=void 0;Object.keys(this.fragments).forEach(function(t){var e=o.fragments[t];if(!0===e.buffered){var r=e.range[n];if(r){s=r.time;for(var i=0;i<s.length;i++)if(u=s[i],!1===o.isTimeBuffered(u.startPTS,u.endPTS,a)){o.removeFragment(e.body);break}}}})},i.prototype.detectPartialFragments=function(r){var i=this,t=this.getFragmentKey(r),n=this.fragments[t];n&&(n.buffered=!0,Object.keys(this.timeRanges).forEach(function(t){if(r.hasElementaryStream(t)){var e=i.timeRanges[t];n.range[t]=i.getBufferedTimes(r.startPTS,r.endPTS,e)}}))},i.prototype.getBufferedTimes=function(t,e,r){for(var i=[],n=void 0,a=void 0,o=!1,s=0;s<r.length;s++){if(n=r.start(s)-this.bufferPadding,a=r.end(s)+this.bufferPadding,n<=t&&e<=a){i.push({startPTS:Math.max(t,r.start(s)),endPTS:Math.min(e,r.end(s))});break}if(t<a&&n<e)i.push({startPTS:Math.max(t,r.start(s)),endPTS:Math.min(e,r.end(s))}),o=!0;else if(e<=n)break}return{time:i,partial:o}},i.prototype.getFragmentKey=function(t){return t.type+"_"+t.level+"_"+t.urlId+"_"+t.sn},i.prototype.getPartialFragment=function(r){var i=this,n=void 0,a=void 0,o=void 0,s=null,u=0;return Object.keys(this.fragments).forEach(function(t){var e=i.fragments[t];i.isPartial(e)&&(a=e.body.startPTS-i.bufferPadding,o=e.body.endPTS+i.bufferPadding,a<=r&&r<=o&&(n=Math.min(r-a,o-r),u<=n&&(s=e.body,u=n)))}),s},i.prototype.getState=function(t){var e=this.getFragmentKey(t),r=this.fragments[e],i=B;return void 0!==r&&(i=r.buffered?!0===this.isPartial(r)?j:K:G),i},i.prototype.isPartial=function(t){return!0===t.buffered&&(void 0!==t.range.video&&!0===t.range.video.partial||void 0!==t.range.audio&&!0===t.range.audio.partial)},i.prototype.isTimeBuffered=function(t,e,r){for(var i=void 0,n=void 0,a=0;a<r.length;a++){if(i=r.start(a)-this.bufferPadding,n=r.end(a)+this.bufferPadding,i<=t&&e<=n)return!0;if(e<=i)return!1}return!1},i.prototype.onFragLoaded=function(t){var e=t.frag;Object(M.a)(e.sn)&&!e.bitrateTest&&(this.fragments[this.getFragmentKey(e)]={body:e,range:Object.create(null),buffered:!1})},i.prototype.onBufferAppended=function(t){var r=this;this.timeRanges=t.timeRanges,Object.keys(this.timeRanges).forEach(function(t){var e=r.timeRanges[t];r.detectEvictedFragments(t,e)})},i.prototype.onFragBuffered=function(t){this.detectPartialFragments(t.frag)},i.prototype.hasFragment=function(t){var e=this.getFragmentKey(t);return void 0!==this.fragments[e]},i.prototype.removeFragment=function(t){var e=this.getFragmentKey(t);delete this.fragments[e]},i.prototype.removeAllFragments=function(){this.fragments=Object.create(null)},i}(u),V={search:function(t,e){for(var r=0,i=t.length-1,n=null,a=null;r<=i;){var o=e(a=t[n=(r+i)/2|0]);if(0<o)r=n+1;else{if(!(o<0))return a;i=n-1}}return null}};var W=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.isBuffered=function(t,e){try{if(t)for(var r=t.buffered,i=0;i<r.length;i++)if(e>=r.start(i)&&e<=r.end(i))return!0}catch(t){}return!1},t.bufferInfo=function(t,e,r){try{if(t){var i=t.buffered,n=[],a=void 0;for(a=0;a<i.length;a++)n.push({start:i.start(a),end:i.end(a)});return this.bufferedInfo(n,e,r)}}catch(t){}return{len:0,start:e,end:e,nextStart:void 0}},t.bufferedInfo=function(t,e,r){var i=[],n=void 0,a=void 0,o=void 0,s=void 0,u=void 0;for(t.sort(function(t,e){var r=t.start-e.start;return r||e.end-t.end}),u=0;u<t.length;u++){var l=i.length;if(l){var c=i[l-1].end;t[u].start-c<r?t[u].end>c&&(i[l-1].end=t[u].end):i.push(t[u])}else i.push(t[u])}for(n=u=0,a=o=e;u<i.length;u++){var d=i[u].start,f=i[u].end;if(d<=e+r&&e<f)a=d,n=(o=f)-e;else if(e+r<d){s=d;break}}return{len:n,start:a,end:o,nextStart:s}},t}(),Y=r(7),q=r.n(Y),z=r(12),X=r.n(z),Q=r(10);function $(){if("undefined"!=typeof window)return window.MediaSource||window.WebKitMediaSource}var J=r(4);var Z=Object(J.a)(),tt=$(),et=function(){function u(r,t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),this.hls=r,this.id=t;var n=this.observer=new q.a,e=r.config;n.trigger=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];n.emit.apply(n,[t,t].concat(r))},n.off=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];n.removeListener.apply(n,[t].concat(r))};var i=function(t,e){(e=e||{}).frag=this.frag,e.id=this.id,r.trigger(t,e)}.bind(this);n.on(F.a.FRAG_DECRYPTED,i),n.on(F.a.FRAG_PARSING_INIT_SEGMENT,i),n.on(F.a.FRAG_PARSING_DATA,i),n.on(F.a.FRAG_PARSED,i),n.on(F.a.ERROR,i),n.on(F.a.FRAG_PARSING_METADATA,i),n.on(F.a.FRAG_PARSING_USERDATA,i),n.on(F.a.INIT_PTS_FOUND,i);var a={mp4:tt.isTypeSupported("video/mp4"),mpeg:tt.isTypeSupported("audio/mpeg"),mp3:tt.isTypeSupported('audio/mp4; codecs="mp3"')},o=navigator.vendor;if(e.enableWorker&&"undefined"!=typeof Worker){N.b.log("demuxing in webworker");var s=void 0;try{s=this.w=X()(13),this.onwmsg=this.onWorkerMessage.bind(this),s.addEventListener("message",this.onwmsg),s.onerror=function(t){r.trigger(F.a.ERROR,{type:f.b.OTHER_ERROR,details:f.a.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},s.postMessage({cmd:"init",typeSupported:a,vendor:o,id:t,config:JSON.stringify(e)})}catch(t){N.b.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),s&&Z.URL.revokeObjectURL(s.objectURL),this.demuxer=new Q.a(n,a,e,o),this.w=void 0}}else this.demuxer=new Q.a(n,a,e,o)}return u.prototype.destroy=function(){var t=this.w;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.w=null;else{var e=this.demuxer;e&&(e.destroy(),this.demuxer=null)}var r=this.observer;r&&(r.removeAllListeners(),this.observer=null)},u.prototype.push=function(t,e,r,i,n,a,o,s){var u=this.w,l=Object(M.a)(n.startDTS)?n.startDTS:n.start,c=n.decryptdata,d=this.frag,f=!(d&&n.cc===d.cc),h=!(d&&n.level===d.level),p=d&&n.sn===d.sn+1,v=!h&&p;if(f&&N.b.log(this.id+":discontinuity detected"),h&&N.b.log(this.id+":switch detected"),this.frag=n,u)u.postMessage({cmd:"demux",data:t,decryptdata:c,initSegment:e,audioCodec:r,videoCodec:i,timeOffset:l,discontinuity:f,trackSwitch:h,contiguous:v,duration:a,accurateTimeOffset:o,defaultInitPTS:s},t instanceof ArrayBuffer?[t]:[]);else{var g=this.demuxer;g&&g.push(t,c,e,r,i,l,f,h,v,a,o,s)}},u.prototype.onWorkerMessage=function(t){var e=t.data,r=this.hls;switch(e.event){case"init":Z.URL.revokeObjectURL(this.w.objectURL);break;case F.a.FRAG_PARSING_DATA:e.data.data1=new Uint8Array(e.data1),e.data2&&(e.data.data2=new Uint8Array(e.data2));default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,r.trigger(e.event,e.data)}},u}();function rt(t,e,r){switch(e){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(r);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(r)}}function it(t,e,r){var i=t[e],n=t[r],a=n.startPTS;Object(M.a)(a)?e<r?(i.duration=a-i.start,i.duration<0&&N.b.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(n.duration=i.start-a,n.duration<0&&N.b.warn("negative duration computed for frag "+n.sn+",level "+n.level+", there should be some duration drift between playlist and fragment!")):n.start=e<r?i.start+i.duration:Math.max(i.start-n.duration,0)}function nt(t,e,r,i,n,a){var o=r;if(Object(M.a)(e.startPTS)){var s=Math.abs(e.startPTS-r);Object(M.a)(e.deltaPTS)?e.deltaPTS=Math.max(s,e.deltaPTS):e.deltaPTS=s,o=Math.max(r,e.startPTS),r=Math.min(r,e.startPTS),i=Math.max(i,e.endPTS),n=Math.min(n,e.startDTS),a=Math.max(a,e.endDTS)}var u=r-e.start;e.start=e.startPTS=r,e.maxStartPTS=o,e.endPTS=i,e.startDTS=n,e.endDTS=a,e.duration=i-r;var l=e.sn;if(!t||l<t.startSN||l>t.endSN)return 0;var c,d=void 0,f=void 0;for(c=l-t.startSN,(d=t.fragments)[c]=e,f=c;0<f;f--)it(d,f,f-1);for(f=c;f<d.length-1;f++)it(d,f,f+1);return t.PTSKnown=!0,u}function at(t,e){var r=Math.max(t.startSN,e.startSN)-e.startSN,i=Math.min(t.endSN,e.endSN)-e.startSN,n=e.startSN-t.startSN,a=t.fragments,o=e.fragments,s=0,u=void 0;if(e.initSegment&&t.initSegment&&(e.initSegment=t.initSegment),i<r)e.PTSKnown=!1;else{for(var l=r;l<=i;l++){var c=a[n+l],d=o[l];d&&c&&(s=c.cc-d.cc,Object(M.a)(c.startPTS)&&(d.start=d.startPTS=c.startPTS,d.endPTS=c.endPTS,d.duration=c.duration,d.backtracked=c.backtracked,d.dropped=c.dropped,u=d))}if(s)for(N.b.log("discontinuity sliding from playlist, take drift into account"),l=0;l<o.length;l++)o[l].cc+=s;if(u)nt(e,u,u.startPTS,u.endPTS,u.startDTS,u.endDTS);else if(0<=n&&n<a.length){var f=a[n].start;for(l=0;l<o.length;l++)o[l].start+=f}e.PTSKnown=t.PTSKnown}}var ot={toString:function(t){for(var e="",r=t.length,i=0;i<r;i++)e+="["+t.start(i).toFixed(3)+","+t.end(i).toFixed(3)+"]";return e}};function st(r,t){t.fragments.forEach(function(t){if(t){var e=t.start+r;t.start=t.startPTS=e,t.endPTS=e+t.duration}}),t.PTSKnown=!0}function ut(t,e,r){!function(t,e,r){if(n=t,a=r,o=e,s=!1,a&&a.details&&o&&(o.endCC>o.startCC||n&&n.cc<o.startCC)&&(s=!0),s){var i=function(t,e){var r=t.fragments,i=e.fragments;if(i.length&&r.length){var n=function(t,e){for(var r=null,i=0;i<t.length;i+=1){var n=t[i];if(n&&n.cc===e){r=n;break}}return r}(r,i[0].cc);if(n&&(!n||n.startPTS))return n;N.b.log("No frag in previous level to align on")}else N.b.log("No fragments to align")}(r.details,e);i&&(N.b.log("Adjusting PTS using last level due to CC increase within current level"),st(i.start,e))}var n,a,o,s}(t,r,e),!r.PTSKnown&&e&&function(t,e){if(e&&e.fragments.length){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;var r=e.fragments[0].programDateTime,i=t.fragments[0].programDateTime,n=(i-r)/1e3+e.fragments[0].start;Object(M.a)(n)&&(N.b.log("adjusting PTS using programDateTime delta, sliding:"+n.toFixed(3)),st(n,t))}}(r,e.details)}var lt=function(a){function o(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,a.call.apply(a,[this,t].concat(r)));return n._tickInterval=null,n._tickTimer=null,n._tickCallCount=0,n._boundTick=n.tick.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,a),o.prototype.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},o.prototype.hasInterval=function(){return!!this._tickInterval},o.prototype.hasNextTick=function(){return!!this._tickTimer},o.prototype.setInterval=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(t){return!this._tickInterval&&(this._tickInterval=setInterval(this._boundTick,t),!0)}),o.prototype.clearInterval=function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(){return!!this._tickInterval&&(clearInterval(this._tickInterval),!(this._tickInterval=null))}),o.prototype.clearNextTick=function(){return!!this._tickTimer&&(clearTimeout(this._tickTimer),!(this._tickTimer=null))},o.prototype.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),1<this._tickCallCount&&(this.clearNextTick(),this._tickTimer=setTimeout(this._boundTick,0)),this._tickCallCount=0)},o.prototype.doTick=function(){},o}(u);function ct(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=arguments[2],i=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=t?1:r.start-i>t&&r.start?-1:0}var dt=function(){function n(t,e,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this.config=t,this.media=e,this.fragmentTracker=r,this.hls=i,this.stallReported=!1}return n.prototype.poll=function(t,e){var r=this.config,i=this.media,n=i.currentTime,a=window.performance.now();if(n!==t)return this.stallReported&&(N.b.warn("playback not stuck anymore @"+n+", after "+Math.round(a-this.stalled)+"ms"),this.stallReported=!1),this.stalled=null,void(this.nudgeRetry=0);if(!(i.ended||!i.buffered.length||2<i.readyState||i.seeking&&W.isBuffered(i,n))){var o=a-this.stalled,s=W.bufferInfo(i,n,r.maxBufferHole);this.stalled?(1e3<=o&&this._reportStall(s.len),this._tryFixBufferStall(s,o)):this.stalled=a}},n.prototype._tryFixBufferStall=function(t,e){var r=this.config,i=this.fragmentTracker,n=this.media.currentTime,a=i.getPartialFragment(n);a&&this._trySkipBufferHole(a),.5<t.len&&e>1e3*r.highBufferWatchdogPeriod&&(this.stalled=null,this._tryNudgeBuffer())},n.prototype._reportStall=function(t){var e=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,N.b.warn("Playback stalling at @"+r.currentTime+" due to low buffer"),e.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:f.a.BUFFER_STALLED_ERROR,fatal:!1,buffer:t}))},n.prototype._trySkipBufferHole=function(t){for(var e=this.hls,r=this.media,i=r.currentTime,n=0,a=0;a<r.buffered.length;a++){var o=r.buffered.start(a);if(n<=i&&i<o)return r.currentTime=Math.max(o,r.currentTime+.1),N.b.warn("skipping hole, adjusting currentTime from "+i+" to "+r.currentTime),this.stalled=null,void e.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:f.a.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+i+" to "+r.currentTime,frag:t});n=r.buffered.end(a)}},n.prototype._tryNudgeBuffer=function(){var t=this.config,e=this.hls,r=this.media,i=r.currentTime,n=(this.nudgeRetry||0)+1;if((this.nudgeRetry=n)<t.nudgeMaxRetry){var a=i+n*t.nudgeOffset;N.b.log("adjust currentTime from "+i+" to "+a),r.currentTime=a,e.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:f.a.BUFFER_NUDGE_ON_STALL,fatal:!1})}else N.b.error("still stuck in high buffer @"+i+" after "+t.nudgeMaxRetry+", raise fatal error"),e.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:f.a.BUFFER_STALLED_ERROR,fatal:!0})},n}(),ft=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var ht="STOPPED",pt="IDLE",vt="KEY_LOADING",gt="FRAG_LOADING",yt="FRAG_LOADING_WAITING_RETRY",mt="WAITING_LEVEL",bt="PARSING",Et="PARSED",Tt="BUFFER_FLUSHING",wt="ENDED",St="ERROR",_t=function(i){function n(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,F.a.MEDIA_ATTACHED,F.a.MEDIA_DETACHING,F.a.MANIFEST_LOADING,F.a.MANIFEST_PARSED,F.a.LEVEL_LOADED,F.a.KEY_LOADED,F.a.FRAG_LOADED,F.a.FRAG_LOAD_EMERGENCY_ABORTED,F.a.FRAG_PARSING_INIT_SEGMENT,F.a.FRAG_PARSING_DATA,F.a.FRAG_PARSED,F.a.ERROR,F.a.AUDIO_TRACK_SWITCHING,F.a.AUDIO_TRACK_SWITCHED,F.a.BUFFER_CREATED,F.a.BUFFER_APPENDED,F.a.BUFFER_FLUSHED));return r.fragmentTracker=e,r.config=t.config,r.audioCodecSwap=!1,r._state=ht,r.stallReported=!1,r.gapController=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(n,i),n.prototype.onHandlerDestroying=function(){this.stopLoad(),i.prototype.onHandlerDestroying.call(this)},n.prototype.onHandlerDestroyed=function(){this.state=ht,this.fragmentTracker=null,i.prototype.onHandlerDestroyed.call(this)},n.prototype.startLoad=function(t){if(this.levels){var e=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var i=r.startLevel;-1===i&&(i=0,this.bitrateTest=!0),this.level=r.nextLoadLevel=i,this.loadedmetadata=!1}0<e&&-1===t&&(N.b.log("override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=pt,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this.forceStartLoad=!0,this.state=ht},n.prototype.stopLoad=function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragmentTracker.removeFragment(t),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.clearInterval(),this.state=ht,this.forceStartLoad=!1},n.prototype.doTick=function(){switch(this.state){case Tt:this.fragLoadError=0;break;case pt:this._doTickIdle();break;case mt:var t=this.levels[this.level];t&&t.details&&(this.state=pt);break;case yt:var e=window.performance.now(),r=this.retryDate;(!r||r<=e||this.media&&this.media.seeking)&&(N.b.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=pt)}this._checkBuffer(),this._checkFragmentChanged()},n.prototype._doTickIdle=function(){var t=this.hls,e=t.config,r=this.media;if(void 0!==this.levelLastLoaded&&(r||!this.startFragRequested&&e.startFragPrefetch)){var i=void 0;i=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var n=t.nextLoadLevel,a=this.levels[n];if(a){var o=a.bitrate,s=void 0;s=o?Math.max(8*e.maxBufferSize/o,e.maxBufferLength):e.maxBufferLength,s=Math.min(s,e.maxMaxBufferLength);var u=W.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,i,e.maxBufferHole),l=u.len;if(!(s<=l)){N.b.trace("buffer length of "+l.toFixed(3)+" is below max of "+s.toFixed(3)+". checking for more payload ..."),this.level=t.nextLoadLevel=n;var c=a.details;if(!c||c.live&&this.levelLastLoaded!==n)this.state=mt;else{var d=this.fragPrevious;if(!c.live&&d&&!d.backtracked&&d.sn===c.endSN&&!u.nextStart)if(Math.min(r.duration,d.start+d.duration)-Math.max(u.end,d.start)<=Math.max(.2,d.duration)){var f={};return this.altAudio&&(f.type="video"),this.hls.trigger(F.a.BUFFER_EOS,f),void(this.state=wt)}this._fetchPayloadOrEos(i,u,c)}}}}},n.prototype._fetchPayloadOrEos=function(t,e,r){var i=this.fragPrevious,n=this.level,a=r.fragments,o=a.length;if(0!==o){var s=a[0].start,u=a[o-1].start+a[o-1].duration,l=e.end,c=void 0;if(r.initSegment&&!r.initSegment.data)c=r.initSegment;else if(r.live){var d=this.config.initialLiveManifestSize;if(o<d)return void N.b.warn("Can not start playback of a level, reason: not enough fragments "+o+" < "+d);if(null===(c=this._ensureFragmentAtLivePoint(r,l,s,u,i,a,o)))return}else l<s&&(c=a[0]);c||(c=this._findFragment(s,i,o,a,l,u,r)),c&&(c.encrypted?(N.b.log("Loading key for "+c.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+n),this._loadKey(c)):(N.b.log("Loading "+c.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+n+", currentTime:"+t.toFixed(3)+",bufferEnd:"+l.toFixed(3)),this._loadFragment(c)))}},n.prototype._ensureFragmentAtLivePoint=function(t,e,r,i,n,a,o){var s=this.hls.config,u=this.media,l=void 0,c=void 0!==s.liveMaxLatencyDuration?s.liveMaxLatencyDuration:s.liveMaxLatencyDurationCount*t.targetduration;if(e<Math.max(r-s.maxFragLookUpTolerance,i-c)){var d=this.liveSyncPosition=this.computeLivePosition(r,t);N.b.log("buffer end: "+e.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+d.toFixed(3)),e=d,u&&u.readyState&&u.duration>d&&(u.currentTime=d),this.nextLoadPosition=d}if(t.PTSKnown&&i<e&&u&&u.readyState)return null;if(this.startFragRequested&&!t.PTSKnown){if(n)if(t.hasProgramDateTime)N.b.log("live playlist, switching playlist, load frag with same PDT: "+n.programDateTime),l=function(t,e,r){if(!Array.isArray(t)||!t.length||!Object(M.a)(e))return null;if(e<t[0].programDateTime)return null;if(e>=t[t.length-1].endProgramDateTime)return null;r=r||0;for(var i=0;i<t.length;++i){var n=t[i];if(a=e,o=r,s=n,u=1e3*Math.min(o,s.duration+(s.deltaPTS?s.deltaPTS:0)),s.endProgramDateTime-u>a)return n}var a,o,s,u;return null}(a,n.endProgramDateTime,s.maxFragLookUpTolerance);else{var f=n.sn+1;if(f>=t.startSN&&f<=t.endSN){var h=a[f-t.startSN];n.cc===h.cc&&(l=h,N.b.log("live playlist, switching playlist, load frag with next SN: "+l.sn))}l||(l=V.search(a,function(t){return n.cc-t.cc}))&&N.b.log("live playlist, switching playlist, load frag with same CC: "+l.sn)}l||(l=a[Math.min(o-1,Math.round(o/2))],N.b.log("live playlist, switching playlist, unknown, load middle frag : "+l.sn))}return l},n.prototype._findFragment=function(t,e,r,i,n,a,o){var s=this.hls.config,u=void 0;n<a?u=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,n=t?e[t.sn-e[0].sn+1]:null;return n&&!ct(r,i,n)?n:V.search(e,ct.bind(null,r,i))}(e,i,n,n>a-s.maxFragLookUpTolerance?0:s.maxFragLookUpTolerance):u=i[r-1];if(u){var l=u.sn-o.startSN,c=e&&u.level===e.level,d=i[l-1],f=i[l+1];if(e&&u.sn===e.sn)if(c&&!u.backtracked)if(u.sn<o.endSN){var h=e.deltaPTS;h&&h>s.maxBufferHole&&e.dropped&&l?(u=d,N.b.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this")):(u=f,N.b.log("SN just loaded, load next one: "+u.sn,u))}else u=null;else u.backtracked&&(f&&f.backtracked?(N.b.warn("Already backtracked from fragment "+f.sn+", will not backtrack to fragment "+u.sn+". Loading fragment "+f.sn),u=f):(N.b.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),u.dropped=0,d?(u=d).backtracked=!0:l&&(u=null)))}return u},n.prototype._loadKey=function(t){this.state=vt,this.hls.trigger(F.a.KEY_LOADING,{frag:t})},n.prototype._loadFragment=function(t){var e=this.fragmentTracker.getState(t);this.fragCurrent=t,this.startFragRequested=!0,Object(M.a)(t.sn)&&!t.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),t.backtracked||e===B||e===j?(t.autoLevel=this.hls.autoLevelEnabled,t.bitrateTest=this.bitrateTest,this.hls.trigger(F.a.FRAG_LOADING,{frag:t}),this.demuxer||(this.demuxer=new et(this.hls,"main")),this.state=gt):e===G&&this._reduceMaxBufferLength(t.duration)&&this.fragmentTracker.removeFragment(t)},n.prototype.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,A.LevelType.MAIN)},n.prototype.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.endPTS+.5):null},n.prototype._checkFragmentChanged=function(){var t=void 0,e=void 0,r=this.media;if(r&&r.readyState&&!1===r.seeking&&((e=r.currentTime)>this.lastCurrentTime&&(this.lastCurrentTime=e),W.isBuffered(r,e)?t=this.getBufferedFrag(e):W.isBuffered(r,e+.1)&&(t=this.getBufferedFrag(e+.1)),t)){var i=t;if(i!==this.fragPlaying){this.hls.trigger(F.a.FRAG_CHANGED,{frag:i});var n=i.level;this.fragPlaying&&this.fragPlaying.level===n||this.hls.trigger(F.a.LEVEL_SWITCHED,{level:n}),this.fragPlaying=i}}},n.prototype.immediateLevelSwitch=function(){if(N.b.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var t=this.media,e=void 0;t?(e=t.paused,t.pause()):e=!0,this.previouslyPaused=e}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},n.prototype.immediateLevelSwitchEnd=function(){var t=this.media;t&&t.buffered.length&&(this.immediateSwitch=!1,W.isBuffered(t,t.currentTime)&&(t.currentTime-=1e-4),this.previouslyPaused||t.play())},n.prototype.nextLevelSwitch=function(){var t=this.media;if(t&&t.readyState){var e,r=void 0,i=void 0;if((e=this.getBufferedFrag(t.currentTime))&&1<e.startPTS&&this.flushMainBuffer(0,e.startPTS-1),t.paused)r=0;else{var n=this.hls.nextLoadLevel,a=this.levels[n],o=this.fragLastKbps;r=o&&this.fragCurrent?this.fragCurrent.duration*a.bitrate/(1e3*o)+1:0}if((i=this.getBufferedFrag(t.currentTime+r))&&(i=this.followingBufferedFrag(i))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(i.maxStartPTS,Number.POSITIVE_INFINITY)}}},n.prototype.flushMainBuffer=function(t,e){this.state=Tt;var r={startOffset:t,endOffset:e};this.altAudio&&(r.type="video"),this.hls.trigger(F.a.BUFFER_FLUSHING,r)},n.prototype.onMediaAttached=function(t){var e=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("seeked",this.onvseeked),e.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition),this.gapController=new dt(r,e,this.fragmentTracker,this.hls)},n.prototype.onMediaDetaching=function(){var t=this.media;t&&t.ended&&(N.b.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var e=this.levels;e&&e.forEach(function(t){t.details&&t.details.fragments.forEach(function(t){t.backtracked=void 0})}),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("seeked",this.onvseeked),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},n.prototype.onMediaSeeking=function(){var t=this.media,e=t?t.currentTime:void 0,r=this.config;Object(M.a)(e)&&N.b.log("media seeking to "+e.toFixed(3));var i=this.mediaBuffer?this.mediaBuffer:t,n=W.bufferInfo(i,e,this.config.maxBufferHole);if(this.state===gt){var a=this.fragCurrent;if(0===n.len&&a){var o=r.maxFragLookUpTolerance,s=a.start-o,u=a.start+a.duration+o;e<s||u<e?(a.loader&&(N.b.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),a.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=pt):N.b.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===wt&&(0===n.len&&(this.fragPrevious=0),this.state=pt);t&&(this.lastCurrentTime=e),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=e),this.tick()},n.prototype.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:void 0;Object(M.a)(e)&&N.b.log("media seeked to "+e.toFixed(3)),this.tick()},n.prototype.onMediaEnded=function(){N.b.log("media ended"),this.startPosition=this.lastCurrentTime=0},n.prototype.onManifestLoading=function(){N.b.log("trigger BUFFER_RESET"),this.hls.trigger(F.a.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},n.prototype.onManifestParsed=function(t){var e=!1,r=!1,i=void 0;t.levels.forEach(function(t){(i=t.audioCodec)&&(-1!==i.indexOf("mp4a.40.2")&&(e=!0),-1!==i.indexOf("mp4a.40.5")&&(r=!0))}),this.audioCodecSwitch=e&&r,this.audioCodecSwitch&&N.b.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1;var n=this.config;(n.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(n.startPosition)},n.prototype.onLevelLoaded=function(t){var e=t.details,r=t.level,i=this.levels[this.levelLastLoaded],n=this.levels[r],a=e.totalduration,o=0;if(N.b.log("level "+r+" loaded ["+e.startSN+","+e.endSN+"],duration:"+a),e.live){var s=n.details;s&&0<e.fragments.length?(at(s,e),o=e.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),e.PTSKnown&&Object(M.a)(o)?N.b.log("live playlist sliding:"+o.toFixed(3)):(N.b.log("live playlist - outdated PTS, unknown sliding"),ut(this.fragPrevious,i,e))):(N.b.log("live playlist - first load, unknown sliding"),e.PTSKnown=!1,ut(this.fragPrevious,i,e))}else e.PTSKnown=!1;if(n.details=e,this.levelLastLoaded=r,this.hls.trigger(F.a.LEVEL_UPDATED,{details:e,level:r}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var u=e.startTimeOffset;Object(M.a)(u)?(u<0&&(N.b.log("negative start time offset "+u+", count from end of last fragment"),u=o+a+u),N.b.log("start time offset found in playlist, adjust startPosition to "+u),this.startPosition=u):e.live?(this.startPosition=this.computeLivePosition(o,e),N.b.log("configure startPosition to "+this.startPosition)):this.startPosition=0,this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===mt&&(this.state=pt),this.tick()},n.prototype.onKeyLoaded=function(){this.state===vt&&(this.state=pt,this.tick())},n.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=this.hls,i=this.levels,n=this.media,a=t.frag;if(this.state===gt&&e&&"main"===a.type&&a.level===e.level&&a.sn===e.sn){var o=t.stats,s=i[e.level],u=s.details;if(this.bitrateTest=!1,this.stats=o,N.b.log("Loaded "+e.sn+" of ["+u.startSN+" ,"+u.endSN+"],level "+e.level),a.bitrateTest&&r.nextLoadLevel)this.state=pt,this.startFragRequested=!1,o.tparsed=o.tbuffered=window.performance.now(),r.trigger(F.a.FRAG_BUFFERED,{stats:o,frag:e,id:"main"}),this.tick();else if("initSegment"===a.sn)this.state=pt,o.tparsed=o.tbuffered=window.performance.now(),u.initSegment.data=t.payload,r.trigger(F.a.FRAG_BUFFERED,{stats:o,frag:e,id:"main"}),this.tick();else{N.b.log("Parsing "+e.sn+" of ["+u.startSN+" ,"+u.endSN+"],level "+e.level+", cc "+e.cc),this.state=bt,this.pendingBuffering=!0,this.appended=!1,a.bitrateTest&&(a.bitrateTest=!1,this.fragmentTracker.onFragLoaded({frag:a}));var l=!(n&&n.seeking)&&(u.PTSKnown||!u.live),c=u.initSegment?u.initSegment.data:[],d=this._getAudioCodec(s);(this.demuxer=this.demuxer||new et(this.hls,"main")).push(t.payload,c,d,s.videoCodec,e,u.totalduration,l)}}this.fragLoadError=0},n.prototype.onFragParsingInitSegment=function(t){var e=this.fragCurrent,r=t.frag;if(e&&"main"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===bt){var i=t.tracks,n=void 0,a=void 0;if(i.audio&&this.altAudio&&delete i.audio,a=i.audio){var o=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(N.b.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==a.metadata.channelCount&&-1===s.indexOf("firefox")&&(o="mp4a.40.5"),-1!==s.indexOf("android")&&"audio/mpeg"!==a.container&&(o="mp4a.40.2",N.b.log("Android: force audio codec to "+o)),a.levelCodec=o,a.id=t.id}for(n in(a=i.video)&&(a.levelCodec=this.levels[this.level].videoCodec,a.id=t.id),this.hls.trigger(F.a.BUFFER_CODECS,i),i){a=i[n],N.b.log("main track:"+n+",container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var u=a.initSegment;u&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(F.a.BUFFER_APPENDING,{type:n,data:u,parent:"main",content:"initSegment"}))}this.tick()}},n.prototype.onFragParsingData=function(e){var r=this,t=this.fragCurrent,i=e.frag;if(t&&"main"===e.id&&i.sn===t.sn&&i.level===t.level&&("audio"!==e.type||!this.altAudio)&&this.state===bt){var n=this.levels[this.level],a=t;if(Object(M.a)(e.endPTS)||(e.endPTS=e.startPTS+t.duration,e.endDTS=e.startDTS+t.duration),!0===e.hasAudio&&a.addElementaryStream(L.ElementaryStreamTypes.AUDIO),!0===e.hasVideo&&a.addElementaryStream(L.ElementaryStreamTypes.VIDEO),N.b.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0)),"video"===e.type)if(a.dropped=e.dropped,a.dropped)if(a.backtracked)N.b.warn("Already backtracked on this fragment, appending with the gap",a.sn);else{var o=n.details;if(!o||a.sn!==o.startSN)return N.b.warn("missing video frame(s), backtracking fragment",a.sn),this.fragmentTracker.removeFragment(a),a.backtracked=!0,this.nextLoadPosition=e.startPTS,this.state=pt,this.fragPrevious=a,void this.tick();N.b.warn("missing video frame(s) on first frag, appending with gap",a.sn)}else a.backtracked=!1;var s=nt(n.details,a,e.startPTS,e.endPTS,e.startDTS,e.endDTS),u=this.hls;u.trigger(F.a.LEVEL_PTS_UPDATED,{details:n.details,level:this.level,drift:s,type:e.type,start:e.startPTS,end:e.endPTS}),[e.data1,e.data2].forEach(function(t){t&&t.length&&r.state===bt&&(r.appended=!0,r.pendingBuffering=!0,u.trigger(F.a.BUFFER_APPENDING,{type:e.type,data:t,parent:"main",content:"data"}))}),this.tick()}},n.prototype.onFragParsed=function(t){var e=this.fragCurrent,r=t.frag;e&&"main"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===bt&&(this.stats.tparsed=window.performance.now(),this.state=Et,this._checkAppendedParsed())},n.prototype.onAudioTrackSwitching=function(t){var e=!!t.url,r=t.id;if(!e){if(this.mediaBuffer!==this.media){N.b.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i.loader&&(N.b.log("switching to main audio track, cancel main fragment load"),i.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=pt}var n=this.hls;n.trigger(F.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),n.trigger(F.a.AUDIO_TRACK_SWITCHED,{id:r}),this.altAudio=!1}},n.prototype.onAudioTrackSwitched=function(t){var e=t.id,r=!!this.hls.audioTracks[e].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(N.b.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()},n.prototype.onBufferCreated=function(t){var e=t.tracks,r=void 0,i=void 0,n=!1;for(var a in e){var o=e[a];"main"===o.id?(r=o,"video"===(i=a)&&(this.videoBuffer=e[a].buffer)):n=!0}n&&r?(N.b.log("alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},n.prototype.onBufferAppended=function(t){if("main"===t.parent){var e=this.state;e!==bt&&e!==Et||(this.pendingBuffering=0<t.pending,this._checkAppendedParsed())}},n.prototype._checkAppendedParsed=function(){if(!(this.state!==Et||this.appended&&this.pendingBuffering)){var t=this.fragCurrent;if(t){var e=this.mediaBuffer?this.mediaBuffer:this.media;N.b.log("main buffered : "+ot.toString(e.buffered)),this.fragPrevious=t;var r=this.stats;r.tbuffered=window.performance.now(),this.fragLastKbps=Math.round(8*r.total/(r.tbuffered-r.tfirst)),this.hls.trigger(F.a.FRAG_BUFFERED,{stats:r,frag:t,id:"main"}),this.state=pt}this.tick()}},n.prototype.onError=function(t){var e=t.frag||this.fragCurrent;if(!e||"main"===e.type){var r=!!this.media&&W.isBuffered(this.media,this.media.currentTime)&&W.isBuffered(this.media,this.media.currentTime+.5);switch(t.details){case f.a.FRAG_LOAD_ERROR:case f.a.FRAG_LOAD_TIMEOUT:case f.a.KEY_LOAD_ERROR:case f.a.KEY_LOAD_TIMEOUT:if(!t.fatal)if(this.fragLoadError+1<=this.config.fragLoadingMaxRetry){var i=Math.min(Math.pow(2,this.fragLoadError)*this.config.fragLoadingRetryDelay,this.config.fragLoadingMaxRetryTimeout);N.b.warn("mediaController: frag loading failed, retry in "+i+" ms"),this.retryDate=window.performance.now()+i,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.fragLoadError++,this.state=yt}else N.b.error("mediaController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=St;break;case f.a.LEVEL_LOAD_ERROR:case f.a.LEVEL_LOAD_TIMEOUT:this.state!==St&&(t.fatal?(this.state=St,N.b.warn("streamController: "+t.details+",switch to "+this.state+" state ...")):t.levelRetry||this.state!==mt||(this.state=pt));break;case f.a.BUFFER_FULL_ERROR:"main"!==t.parent||this.state!==bt&&this.state!==Et||(r?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=pt):(N.b.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},n.prototype._reduceMaxBufferLength=function(t){var e=this.config;return e.maxMaxBufferLength>=t&&(e.maxMaxBufferLength/=2,N.b.warn("main:reduce max buffer length to "+e.maxMaxBufferLength+"s"),!0)},n.prototype._checkBuffer=function(){var t=this.media;if(t&&0!==t.readyState){var e=(this.mediaBuffer?this.mediaBuffer:t).buffered;!this.loadedmetadata&&e.length?(this.loadedmetadata=!0,this._seekToStartPos()):this.immediateSwitch?this.immediateLevelSwitchEnd():this.gapController.poll(this.lastCurrentTime,e)}},n.prototype.onFragLoadEmergencyAborted=function(){this.state=pt,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},n.prototype.onBufferFlushed=function(){var t=this.mediaBuffer?this.mediaBuffer:this.media;t&&this.fragmentTracker.detectEvictedFragments(L.ElementaryStreamTypes.VIDEO,t.buffered),this.state=pt,this.fragPrevious=null},n.prototype.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},n.prototype.computeLivePosition=function(t,e){var r=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*e.targetduration;return t+Math.max(0,e.totalduration-r)},n.prototype._seekToStartPos=function(){var t=this.media,e=t.currentTime,r=t.seeking?e:this.startPosition;e!==r&&(N.b.log("target start position not buffered, seek to buffered.start(0) "+r+" from current time "+e+" "),t.currentTime=r)},n.prototype._getAudioCodec=function(t){var e=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&(N.b.log("swapping playlist audio codec"),e&&(e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),e},ft(n,[{key:"state",set:function(t){if(this.state!==t){var e=this.state;this._state=t,N.b.log("main stream:"+e+"->"+t),this.hls.trigger(F.a.STREAM_STATE_TRANSITION,{previousState:e,nextState:t})}},get:function(){return this._state}},{key:"currentLevel",get:function(){var t=this.media;if(t){var e=this.getBufferedFrag(t.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var t=this.media;return t?this.followingBufferedFrag(this.getBufferedFrag(t.currentTime)):null}},{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(t){this._liveSyncPosition=t}}]),n}(lt),At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var kt=window.performance,Lt=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.MANIFEST_LOADED,F.a.LEVEL_LOADED,F.a.AUDIO_TRACK_SWITCHED,F.a.FRAG_LOADED,F.a.ERROR));return e.canload=!1,e.currentLevelIndex=null,e.manualLevelIndex=-1,e.timer=null,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},i.prototype.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},i.prototype.startLoad=function(){var t=this._levels;this.canload=!0,this.levelRetryCount=0,t&&t.forEach(function(t){t.loadError=0;var e=t.details;e&&e.live&&(t.details=void 0)}),null!==this.timer&&this.loadLevel()},i.prototype.stopLoad=function(){this.canload=!1},i.prototype.onManifestLoaded=function(t){var e=[],r=void 0,i={},n=null,a=!1,o=!1,s=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=[];if(t.levels.forEach(function(t){t.loadError=0,t.fragmentError=!1,a=a||!!t.videoCodec,o=o||!!t.audioCodec||!(!t.attrs||!t.attrs.AUDIO),s&&t.audioCodec&&-1!==t.audioCodec.indexOf("mp4a.40.34")&&(t.audioCodec=void 0),(n=i[t.bitrate])?n.url.push(t.url):(t.url=[t.url],t.urlId=0,i[t.bitrate]=t,e.push(t)),t.attrs&&t.attrs.AUDIO&&rt(n||t,"audio",t.attrs.AUDIO),t.attrs&&t.attrs.SUBTITLES&&rt(n||t,"text",t.attrs.SUBTITLES)}),a&&o&&(e=e.filter(function(t){return!!t.videoCodec})),e=e.filter(function(t){var e=t.audioCodec,r=t.videoCodec;return(!e||y(e))&&(!r||y(r))}),t.audioTracks&&(u=t.audioTracks.filter(function(t){return!t.audioCodec||y(t.audioCodec,"audio")})).forEach(function(t,e){t.id=e}),0<e.length){r=e[0].bitrate,e.sort(function(t,e){return t.bitrate-e.bitrate}),this._levels=e;for(var l=0;l<e.length;l++)if(e[l].bitrate===r){this._firstLevel=l,N.b.log("manifest loaded,"+e.length+" level(s) found, first bitrate:"+r);break}this.hls.trigger(F.a.MANIFEST_PARSED,{levels:e,audioTracks:u,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:a,altAudio:0<u.length&&a})}else this.hls.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:f.a.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},i.prototype.setLevelInternal=function(t){var e=this._levels,r=this.hls;if(0<=t&&t<e.length){if(this.clearTimer(),this.currentLevelIndex!==t){N.b.log("switching to level "+t);var i=e[this.currentLevelIndex=t];i.level=t,r.trigger(F.a.LEVEL_SWITCHING,i)}var n=e[t],a=n.details;if(!a||a.live){var o=n.urlId;r.trigger(F.a.LEVEL_LOADING,{url:n.url[o],level:t,id:o})}}else r.trigger(F.a.ERROR,{type:f.b.OTHER_ERROR,details:f.a.LEVEL_SWITCH_ERROR,level:t,fatal:!1,reason:"invalid level idx"})},i.prototype.onError=function(t){if(t.fatal)t.type===f.b.NETWORK_ERROR&&this.clearTimer();else{var e=!1,r=!1,i=void 0;switch(t.details){case f.a.FRAG_LOAD_ERROR:case f.a.FRAG_LOAD_TIMEOUT:case f.a.KEY_LOAD_ERROR:case f.a.KEY_LOAD_TIMEOUT:i=t.frag.level,r=!0;break;case f.a.LEVEL_LOAD_ERROR:case f.a.LEVEL_LOAD_TIMEOUT:i=t.context.level,e=!0;break;case f.a.REMUX_ALLOC_ERROR:i=t.level,e=!0}void 0!==i&&this.recoverLevel(t,i,e,r)}},i.prototype.recoverLevel=function(t,e,r,i){var n=this,a=this.hls.config,o=t.details,s=this._levels[e],u=void 0,l=void 0,c=void 0;if(s.loadError++,s.fragmentError=i,r){if(!(this.levelRetryCount+1<=a.levelLoadingMaxRetry))return N.b.error("level controller, cannot recover from "+o+" error"),this.currentLevelIndex=null,this.clearTimer(),void(t.fatal=!0);l=Math.min(Math.pow(2,this.levelRetryCount)*a.levelLoadingRetryDelay,a.levelLoadingMaxRetryTimeout),this.timer=setTimeout(function(){return n.loadLevel()},l),t.levelRetry=!0,this.levelRetryCount++,N.b.warn("level controller, "+o+", retry in "+l+" ms, current retry count is "+this.levelRetryCount)}(r||i)&&(1<(u=s.url.length)&&s.loadError<u?(s.urlId=(s.urlId+1)%u,s.details=void 0,N.b.warn("level controller, "+o+" for level "+e+": switching to redundant URL-id "+s.urlId)):-1===this.manualLevelIndex?(c=0===e?this._levels.length-1:e-1,N.b.warn("level controller, "+o+": switch to "+c),this.hls.nextAutoLevel=this.currentLevelIndex=c):i&&(N.b.warn("level controller, "+o+": reload a fragment"),this.currentLevelIndex=null))},i.prototype.onFragLoaded=function(t){var e=t.frag;if(void 0!==e&&"main"===e.type){var r=this._levels[e.level];void 0!==r&&(r.fragmentError=!1,r.loadError=0,this.levelRetryCount=0)}},i.prototype.onLevelLoaded=function(t){var e=this,r=t.level;if(r===this.currentLevelIndex){var i=this._levels[r];i.fragmentError||(i.loadError=0,this.levelRetryCount=0);var n=t.details;if(n.live){var a=1e3*(n.averagetargetduration?n.averagetargetduration:n.targetduration),o=a,s=i.details;s&&n.endSN===s.endSN&&(o/=2,N.b.log("same live playlist, reload twice faster")),o-=kt.now()-t.stats.trequest,o=Math.max(a/2,Math.round(o)),N.b.log("live playlist, reload in "+Math.round(o)+" ms"),this.timer=setTimeout(function(){return e.loadLevel()},o)}else this.clearTimer()}},i.prototype.onAudioTrackSwitched=function(t){var e=this.hls.audioTracks[t.id].groupId,r=this.hls.levels[this.currentLevelIndex];if(r&&r.audioGroupIds){var i=r.audioGroupIds.findIndex(function(t){return t===e});i!==r.urlId&&(r.urlId=i,this.startLoad())}},i.prototype.loadLevel=function(){if(N.b.debug("call to loadLevel"),null!==this.currentLevelIndex&&this.canload){var t=this._levels[this.currentLevelIndex];if("object"===(void 0===t?"undefined":At(t))&&0<t.url.length){var e=this.currentLevelIndex,r=t.urlId,i=t.url[r];N.b.log("Attempt loading level index "+e+" with URL-id "+r),this.hls.trigger(F.a.LEVEL_LOADING,{url:i,level:e,id:r})}}},Rt(i,[{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var e=this._levels;e&&(t=Math.min(t,e.length-1),this.currentLevelIndex===t&&e[t].details||this.setLevelInternal(t))}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}}]),i}(u),Ot=r(6);function Dt(t,e){var r=null;try{r=new window.Event("addtrack")}catch(t){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)}function Ct(t){if(t&&t.cues)for(;0<t.cues.length;)t.removeCue(t.cues[0])}var It=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.MEDIA_ATTACHED,F.a.MEDIA_DETACHING,F.a.FRAG_PARSING_METADATA));return e.id3Track=void 0,e.media=void 0,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype.destroy=function(){u.prototype.destroy.call(this)},i.prototype.onMediaAttached=function(t){this.media=t.media,this.media},i.prototype.onMediaDetaching=function(){Ct(this.id3Track),this.id3Track=void 0,this.media=void 0},i.prototype.getID3Track=function(t){for(var e=0;e<t.length;e++){var r=t[e];if("metadata"===r.kind&&"id3"===r.label)return Dt(r,this.media),r}return this.media.addTextTrack("metadata","id3")},i.prototype.onFragParsingMetadata=function(t){var e=t.frag,r=t.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,n=0;n<r.length;n++){var a=Ot.a.getID3Frames(r[n].data);if(a){var o=r[n].pts,s=n<r.length-1?r[n+1].pts:e.endPTS;o===s&&(s+=1e-4);for(var u=0;u<a.length;u++){var l=a[u];if(!Ot.a.isTimeStampFrame(l)){var c=new i(o,s,"");c.value=l,this.id3Track.addCue(c)}}}}},i}(u);var xt=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=0,this.totalWeight_=0}return e.prototype.sample=function(t,e){var r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t},e.prototype.getTotalWeight=function(){return this.totalWeight_},e.prototype.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/t}return this.estimate_},e}();var Pt=function(){function n(t,e,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this.hls=t,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new xt(e),this.fast_=new xt(r)}return n.prototype.sample=function(t,e){var r=8e3*e/(t=Math.max(t,this.minDelayMs_)),i=t/1e3;this.fast_.sample(i,r),this.slow_.sample(i,r)},n.prototype.canEstimate=function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_},n.prototype.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},n.prototype.destroy=function(){},n}(),Mt=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var Ft=window.performance,Nt=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.FRAG_LOADING,F.a.FRAG_LOADED,F.a.FRAG_BUFFERED,F.a.ERROR));return e.lastLoadedFragLevel=0,e._nextAutoLevel=-1,e.hls=t,e.timer=null,e._bwEstimator=null,e.onCheck=e._abandonRulesCheck.bind(e),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype.destroy=function(){this.clearTimer(),u.prototype.destroy.call(this)},i.prototype.onFragLoading=function(t){var e=t.frag;if("main"===e.type&&(this.timer||(this.fragCurrent=e,this.timer=setInterval(this.onCheck,100)),!this._bwEstimator)){var r=this.hls,i=r.config,n=e.level,a=void 0,o=void 0;r.levels[n].details.live?(a=i.abrEwmaFastLive,o=i.abrEwmaSlowLive):(a=i.abrEwmaFastVoD,o=i.abrEwmaSlowVoD),this._bwEstimator=new Pt(r,o,a,i.abrEwmaDefaultEstimate)}},i.prototype._abandonRulesCheck=function(){var t=this.hls,e=t.media,r=this.fragCurrent;if(r){var i=r.loader,n=t.minAutoLevel;if(!i||i.stats&&i.stats.aborted)return N.b.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var a=i.stats;if(e&&a&&(!e.paused&&0!==e.playbackRate||!e.readyState)&&r.autoLevel&&r.level){var o=Ft.now()-a.trequest,s=Math.abs(e.playbackRate);if(o>500*r.duration/s){var u=t.levels,l=Math.max(1,a.bw?a.bw/8:1e3*a.loaded/o),c=u[r.level],d=c.realBitrate?Math.max(c.realBitrate,c.bitrate):c.bitrate,f=a.total?a.total:Math.max(a.loaded,Math.round(r.duration*d/8)),h=e.currentTime,p=(f-a.loaded)/l,v=(W.bufferInfo(e,h,t.config.maxBufferHole).end-h)/s;if(v<2*r.duration/s&&v<p){var g=void 0,y=void 0;for(y=r.level-1;n<y;y--){var m=u[y].realBitrate?Math.max(u[y].realBitrate,u[y].bitrate):u[y].bitrate;if((g=r.duration*m/(6.4*l))<v)break}g<p&&(N.b.warn("loading too slow, abort fragment loading and switch to level "+y+":fragLoadedDelay["+y+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+g.toFixed(1)+"<"+p.toFixed(1)+":"+v.toFixed(1)),t.nextLoadLevel=y,this._bwEstimator.sample(o,a.loaded),i.abort(),this.clearTimer(),t.trigger(F.a.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:a}))}}}}},i.prototype.onFragLoaded=function(t){var e=t.frag;if("main"===e.type&&Object(M.a)(e.sn)){if(this.clearTimer(),this.lastLoadedFragLevel=e.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var r=this.hls.levels[e.level],i=(r.loaded?r.loaded.bytes:0)+t.stats.loaded,n=(r.loaded?r.loaded.duration:0)+t.frag.duration;r.loaded={bytes:i,duration:n},r.realBitrate=Math.round(8*i/n)}if(t.frag.bitrateTest){var a=t.stats;a.tparsed=a.tbuffered=a.tload,this.onFragBuffered(t)}}},i.prototype.onFragBuffered=function(t){var e=t.stats,r=t.frag;if(!0!==e.aborted&&"main"===r.type&&Object(M.a)(r.sn)&&(!r.bitrateTest||e.tload===e.tbuffered)){var i=e.tparsed-e.trequest;N.b.log("latency/loading/parsing/append/kbps:"+Math.round(e.tfirst-e.trequest)+"/"+Math.round(e.tload-e.tfirst)+"/"+Math.round(e.tparsed-e.tload)+"/"+Math.round(e.tbuffered-e.tparsed)+"/"+Math.round(8*e.loaded/(e.tbuffered-e.trequest))),this._bwEstimator.sample(i,e.loaded),e.bwEstimate=this._bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0}},i.prototype.onError=function(t){switch(t.details){case f.a.FRAG_LOAD_ERROR:case f.a.FRAG_LOAD_TIMEOUT:this.clearTimer()}},i.prototype.clearTimer=function(){clearInterval(this.timer),this.timer=null},i.prototype._findBestLevel=function(t,e,r,i,n,a,o,s,u){for(var l=n;i<=l;l--){var c=u[l];if(c){var d=c.details,f=d?d.totalduration/d.fragments.length:e,h=!!d&&d.live,p=void 0;p=l<=t?o*r:s*r;var v=u[l].realBitrate?Math.max(u[l].realBitrate,u[l].bitrate):u[l].bitrate,g=v*f/p;if(N.b.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+l+"/"+Math.round(p)+"/"+v+"/"+f+"/"+a+"/"+g),v<p&&(!g||h&&!this.bitrateTestDelay||g<a))return l}}return-1},Mt(i,[{key:"nextAutoLevel",get:function(){var t=this._nextAutoLevel,e=this._bwEstimator;if(!(-1===t||e&&e.canEstimate()))return t;var r=this._nextABRAutoLevel;return-1!==t&&(r=Math.min(t,r)),r},set:function(t){this._nextAutoLevel=t}},{key:"_nextABRAutoLevel",get:function(){var t=this.hls,e=t.maxAutoLevel,r=t.levels,i=t.config,n=t.minAutoLevel,a=t.media,o=this.lastLoadedFragLevel,s=this.fragCurrent?this.fragCurrent.duration:0,u=a?a.currentTime:0,l=a&&0!==a.playbackRate?Math.abs(a.playbackRate):1,c=this._bwEstimator?this._bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,d=(W.bufferInfo(a,u,i.maxBufferHole).end-u)/l,f=this._findBestLevel(o,s,c,n,e,d,i.abrBandWidthFactor,i.abrBandWidthUpFactor,r);if(0<=f)return f;N.b.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var h=s?Math.min(s,i.maxStarvationDelay):i.maxStarvationDelay,p=i.abrBandWidthFactor,v=i.abrBandWidthUpFactor;if(0===d){var g=this.bitrateTestDelay;if(g)h=(s?Math.min(s,i.maxLoadingDelay):i.maxLoadingDelay)-g,N.b.trace("bitrate test took "+Math.round(1e3*g)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*h)+" ms"),p=v=1}return f=this._findBestLevel(o,s,c,n,e,d+h,p,v,r),Math.max(f,0)}}]),i}(u);var Ut=$(),Bt=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.MEDIA_ATTACHING,F.a.MEDIA_DETACHING,F.a.MANIFEST_PARSED,F.a.BUFFER_RESET,F.a.BUFFER_APPENDING,F.a.BUFFER_CODECS,F.a.BUFFER_EOS,F.a.BUFFER_FLUSHING,F.a.LEVEL_PTS_UPDATED,F.a.LEVEL_UPDATED));return e._msDuration=null,e._levelDuration=null,e._live=null,e._objectUrl=null,e.onsbue=e.onSBUpdateEnd.bind(e),e.onsbe=e.onSBUpdateError.bind(e),e.pendingTracks={},e.tracks={},e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype.destroy=function(){u.prototype.destroy.call(this)},i.prototype.onLevelPtsUpdated=function(t){var e=t.type,r=this.tracks.audio;if("audio"===e&&r&&"audio/mpeg"===r.container){var i=this.sourceBuffer.audio;if(.1<Math.abs(i.timestampOffset-t.start)){var n=i.updating;try{i.abort()}catch(t){n=!0,N.b.warn("can not abort audio buffer: "+t)}n?this.audioTimestampOffset=t.start:(N.b.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+t.start),i.timestampOffset=t.start)}}},i.prototype.onManifestParsed=function(t){var e=t.audio,r=t.video||t.levels.length&&t.altAudio,i=0;t.altAudio&&(e||r)&&(i=(e?1:0)+(r?1:0),N.b.log(i+" sourceBuffer(s) expected")),this.sourceBufferNb=i},i.prototype.onMediaAttaching=function(t){var e=this.media=t.media;if(e){var r=this.mediaSource=new Ut;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),r.addEventListener("sourceopen",this.onmso),r.addEventListener("sourceended",this.onmse),r.addEventListener("sourceclose",this.onmsc),e.src=window.URL.createObjectURL(r),this._objectUrl=e.src}},i.prototype.onMediaDetaching=function(){N.b.log("media source detaching");var t=this.mediaSource;if(t){if("open"===t.readyState)try{t.endOfStream()}catch(t){N.b.warn("onMediaDetaching:"+t.message+" while calling endOfStream")}t.removeEventListener("sourceopen",this.onmso),t.removeEventListener("sourceended",this.onmse),t.removeEventListener("sourceclose",this.onmsc),this.media&&(window.URL.revokeObjectURL(this._objectUrl),this.media.src===this._objectUrl?(this.media.removeAttribute("src"),this.media.load()):N.b.warn("media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(F.a.MEDIA_DETACHED)},i.prototype.onMediaSourceOpen=function(){N.b.log("media source opened"),this.hls.trigger(F.a.MEDIA_ATTACHED,{media:this.media});var t=this.mediaSource;t&&t.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()},i.prototype.checkPendingTracks=function(){var t=this.pendingTracks,e=Object.keys(t).length;e&&(this.sourceBufferNb<=e||0===this.sourceBufferNb)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},i.prototype.onMediaSourceClose=function(){N.b.log("media source closed")},i.prototype.onMediaSourceEnded=function(){N.b.log("media source ended")},i.prototype.onSBUpdateEnd=function(){if(this.audioTimestampOffset){var t=this.sourceBuffer.audio;N.b.warn("change mpeg audio timestamp offset from "+t.timestampOffset+" to "+this.audioTimestampOffset),t.timestampOffset=this.audioTimestampOffset,delete this.audioTimestampOffset}this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1;var r=this.parent,e=this.segments.reduce(function(t,e){return e.parent===r?t+1:t},0),i={},n=this.sourceBuffer;for(var a in n)i[a]=n[a].buffered;this.hls.trigger(F.a.BUFFER_APPENDED,{parent:r,pending:e,timeRanges:i}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()},i.prototype.onSBUpdateError=function(t){N.b.error("sourceBuffer error:",t),this.hls.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:f.a.BUFFER_APPENDING_ERROR,fatal:!1})},i.prototype.onBufferReset=function(){var t=this.sourceBuffer;for(var e in t){var r=t[e];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(t){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},i.prototype.onBufferCodecs=function(t){if(0===Object.keys(this.sourceBuffer).length){for(var e in t)this.pendingTracks[e]=t[e];var r=this.mediaSource;r&&"open"===r.readyState&&this.checkPendingTracks()}},i.prototype.createSourceBuffers=function(t){var e=this.sourceBuffer,r=this.mediaSource;for(var i in t)if(!e[i]){var n=t[i],a=n.levelCodec||n.codec,o=n.container+";codecs="+a;N.b.log("creating sourceBuffer("+o+")");try{var s=e[i]=r.addSourceBuffer(o);s.addEventListener("updateend",this.onsbue),s.addEventListener("error",this.onsbe),this.tracks[i]={codec:a,container:n.container},n.buffer=s}catch(t){N.b.error("error while trying to add sourceBuffer:"+t.message),this.hls.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:f.a.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:t,mimeType:o})}}this.hls.trigger(F.a.BUFFER_CREATED,{tracks:t})},i.prototype.onBufferAppending=function(t){this._needsFlush||(this.segments?this.segments.push(t):this.segments=[t],this.doAppending())},i.prototype.onBufferAppendFail=function(t){N.b.error("sourceBuffer error:",t.event),this.hls.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:f.a.BUFFER_APPENDING_ERROR,fatal:!1})},i.prototype.onBufferEos=function(t){var e=this.sourceBuffer,r=t.type;for(var i in e)r&&i!==r||e[i].ended||(e[i].ended=!0,N.b.log(i+" sourceBuffer now EOS"));this.checkEos()},i.prototype.checkEos=function(){var t=this.sourceBuffer,e=this.mediaSource;if(e&&"open"===e.readyState){for(var r in t){var i=t[r];if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}N.b.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment");try{e.endOfStream()}catch(t){N.b.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1}else this._needsEos=!1},i.prototype.onBufferFlushing=function(t){this.flushRange.push({start:t.startOffset,end:t.endOffset,type:t.type}),this.flushBufferCounter=0,this.doFlush()},i.prototype.onLevelUpdated=function(t){var e=t.details;0<e.fragments.length&&(this._levelDuration=e.totalduration+e.fragments[0].start,this._live=e.live,this.updateMediaElementDuration())},i.prototype.updateMediaElementDuration=function(){var t,e=this.hls.config;if(null!==this._levelDuration&&this.media&&this.mediaSource&&this.sourceBuffer&&0!==this.media.readyState&&"open"===this.mediaSource.readyState){for(var r in this.sourceBuffer)if(!0===this.sourceBuffer[r].updating)return;t=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===e.liveDurationInfinity?(N.b.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>t||!Object(M.a)(t))&&(N.b.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},i.prototype.doFlush=function(){for(;this.flushRange.length;){var t=this.flushRange[0];if(!this.flushBuffer(t.start,t.end,t.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var e=0,r=this.sourceBuffer;try{for(var i in r)e+=r[i].buffered.length}catch(t){N.b.error("error while accessing sourceBuffer.buffered")}this.appended=e,this.hls.trigger(F.a.BUFFER_FLUSHED)}},i.prototype.doAppending=function(){var e=this.hls,t=this.sourceBuffer,r=this.segments;if(Object.keys(t).length){if(this.media.error)return this.segments=[],void N.b.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(r&&r.length){var i=r.shift();try{var n=t[i.type];n?n.updating?r.unshift(i):(n.ended=!1,this.parent=i.parent,n.appendBuffer(i.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(t){N.b.error("error while trying to append buffer:"+t.message),r.unshift(i);var a={type:f.b.MEDIA_ERROR,parent:i.parent};22!==t.code?(this.appendError?this.appendError++:this.appendError=1,a.details=f.a.BUFFER_APPEND_ERROR,this.appendError>e.config.appendErrorMaxRetry?(N.b.log("fail "+e.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],a.fatal=!0):a.fatal=!1):(this.segments=[],a.details=f.a.BUFFER_FULL_ERROR,a.fatal=!1),e.trigger(F.a.ERROR,a)}}}},i.prototype.flushBuffer=function(t,e,r){var i=void 0,n=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=this.sourceBuffer;if(Object.keys(l).length){if(N.b.log("flushBuffer,pos/start/end: "+this.media.currentTime.toFixed(3)+"/"+t+"/"+e),this.flushBufferCounter<this.appended){for(var c in l)if(!r||c===r){if((i=l[c]).ended=!1,i.updating)return N.b.warn("cannot flush, sb updating in progress"),!1;try{for(n=0;n<i.buffered.length;n++)if(a=i.buffered.start(n),o=i.buffered.end(n),-1!==navigator.userAgent.toLowerCase().indexOf("firefox")&&e===Number.POSITIVE_INFINITY?(s=t,u=e):(s=Math.max(a,t),u=Math.min(o,e)),.5<Math.min(u,o)-s)return this.flushBufferCounter++,N.b.log("flush "+c+" ["+s+","+u+"], of ["+a+","+o+"], pos:"+this.media.currentTime),i.remove(s,u),!1}catch(t){N.b.warn("exception while accessing sourcebuffer, it might have been removed from MediaSource")}}}else N.b.warn("abort flushing too many retries");N.b.log("buffer flushed")}return!0},i}(u),Gt=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var jt=function(r){function n(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.FPS_DROP_LEVEL_CAPPING,F.a.MEDIA_ATTACHING,F.a.MANIFEST_PARSED,F.a.BUFFER_CODECS,F.a.MEDIA_DETACHING));return e.autoLevelCapping=Number.POSITIVE_INFINITY,e.firstLevel=null,e.levels=[],e.media=null,e.restrictedLevels=[],e.timer=null,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(n,r),n.prototype.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this._stopCapping())},n.prototype.onFpsDropLevelCapping=function(t){n.isLevelAllowed(t.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(t.droppedLevel)},n.prototype.onMediaAttaching=function(t){this.media=t.media instanceof window.HTMLVideoElement?t.media:null},n.prototype.onManifestParsed=function(t){var e=this.hls;this.restrictedLevels=[],this.levels=t.levels,this.firstLevel=t.firstLevel,e.config.capLevelToPlayerSize&&(t.video||t.levels.length&&t.altAudio)&&this._startCapping()},n.prototype.onBufferCodecs=function(t){this.hls.config.capLevelToPlayerSize&&t.video&&this._startCapping()},n.prototype.onLevelsUpdated=function(t){this.levels=t.levels},n.prototype.onMediaDetaching=function(){this._stopCapping()},n.prototype.detectPlayerSize=function(){if(this.media){var t=this.levels?this.levels.length:0;if(t){var e=this.hls;e.autoLevelCapping=this.getMaxLevel(t-1),e.autoLevelCapping>this.autoLevelCapping&&e.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},n.prototype.getMaxLevel=function(r){var i=this;if(!this.levels)return-1;var t=this.levels.filter(function(t,e){return n.isLevelAllowed(e,i.restrictedLevels)&&e<=r});return n.getMaxLevelByMediaSize(t,this.mediaWidth,this.mediaHeight)},n.prototype._startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},n.prototype._stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},n.isLevelAllowed=function(t){return-1===(1<arguments.length&&void 0!==arguments[1]?arguments[1]:[]).indexOf(t)},n.getMaxLevelByMediaSize=function(t,e,r){if(!t||t&&!t.length)return-1;for(var i,n,a=t.length-1,o=0;o<t.length;o+=1){var s=t[o];if((s.width>=e||s.height>=r)&&(i=s,!(n=t[o+1])||i.width!==n.width||i.height!==n.height)){a=o;break}}return a},Gt(n,[{key:"mediaWidth",get:function(){var t=void 0,e=this.media;return e&&(t=e.width||e.clientWidth||e.offsetWidth,t*=n.contentScaleFactor),t}},{key:"mediaHeight",get:function(){var t=void 0,e=this.media;return e&&(t=e.height||e.clientHeight||e.offsetHeight,t*=n.contentScaleFactor),t}}],[{key:"contentScaleFactor",get:function(){var t=1;try{t=window.devicePixelRatio}catch(t){}return t}}]),n}(u);var Kt=window.performance,Ht=function(e){function r(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,e.call(this,t,F.a.MEDIA_ATTACHING))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(r,e),r.prototype.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},r.prototype.onMediaAttaching=function(t){var e=this.hls.config;e.capLevelOnFPSDrop&&("function"==typeof(this.video=t.media instanceof window.HTMLVideoElement?t.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),e.fpsDroppedMonitoringPeriod))},r.prototype.checkFPS=function(t,e,r){var i=Kt.now();if(e){if(this.lastTime){var n=i-this.lastTime,a=r-this.lastDroppedFrames,o=e-this.lastDecodedFrames,s=1e3*a/n,u=this.hls;if(u.trigger(F.a.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:r}),0<s&&a>u.config.fpsDroppedMonitoringThreshold*o){var l=u.currentLevel;N.b.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),0<l&&(-1===u.autoLevelCapping||u.autoLevelCapping>=l)&&(l-=1,u.trigger(F.a.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:u.currentLevel}),u.autoLevelCapping=l,u.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=e}},r.prototype.checkFPSInterval=function(){var t=this.video;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)},r}(u);var Vt=window,Wt=Vt.performance,Yt=Vt.XMLHttpRequest,qt=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t&&t.xhrSetup&&(this.xhrSetup=t.xhrSetup)}return e.prototype.destroy=function(){this.abort(),this.loader=null},e.prototype.abort=function(){var t=this.loader;t&&4!==t.readyState&&(this.stats.aborted=!0,t.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},e.prototype.load=function(t,e,r){this.context=t,this.config=e,this.callbacks=r,this.stats={trequest:Wt.now(),retry:0},this.retryDelay=e.retryDelay,this.loadInternal()},e.prototype.loadInternal=function(){var e=void 0,r=this.context;e=this.loader=new Yt;var t=this.stats;t.tfirst=0,t.loaded=0;var i=this.xhrSetup;try{if(i)try{i(e,r.url)}catch(t){e.open("GET",r.url,!0),i(e,r.url)}e.readyState||e.open("GET",r.url,!0)}catch(t){return void this.callbacks.onError({code:e.status,text:t.message},r,e)}r.rangeEnd&&e.setRequestHeader("Range","bytes="+r.rangeStart+"-"+(r.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=r.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()},e.prototype.readystatechange=function(t){var e=t.currentTarget,r=e.readyState,i=this.stats,n=this.context,a=this.config;if(!i.aborted&&2<=r)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(Wt.now(),i.trequest)),4===r){var o=e.status;if(200<=o&&o<300){i.tload=Math.max(i.tfirst,Wt.now());var s=void 0,u=void 0;u="arraybuffer"===n.responseType?(s=e.response).byteLength:(s=e.responseText).length,i.loaded=i.total=u;var l={url:e.responseURL,data:s};this.callbacks.onSuccess(l,i,n,e)}else i.retry>=a.maxRetry||400<=o&&o<499?(N.b.error(o+" while loading "+n.url),this.callbacks.onError({code:o,text:e.statusText},n,e)):(N.b.warn(o+" while loading "+n.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),i.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),a.timeout)},e.prototype.loadtimeout=function(){N.b.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},e.prototype.loadprogress=function(t){var e=t.currentTarget,r=this.stats;r.loaded=t.loaded,t.lengthComputable&&(r.total=t.total);var i=this.callbacks.onProgress;i&&i(r,this.context,null,e)},e}(),zt=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var Xt=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.MANIFEST_LOADING,F.a.MANIFEST_PARSED,F.a.AUDIO_TRACK_LOADED,F.a.AUDIO_TRACK_SWITCHED,F.a.LEVEL_LOADED,F.a.ERROR));return e._trackId=-1,e._selectDefaultTrack=!0,e.tracks=[],e.trackIdBlacklist=Object.create(null),e.audioGroupId=null,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype.onManifestLoading=function(){this.tracks=[],this._trackId=-1,this._selectDefaultTrack=!0},i.prototype.onManifestParsed=function(t){var e=this.tracks=t.audioTracks||[];this.hls.trigger(F.a.AUDIO_TRACKS_UPDATED,{audioTracks:e})},i.prototype.onAudioTrackLoaded=function(t){if(t.id>=this.tracks.length)N.b.warn("Invalid audio track id:",t.id);else{if(N.b.log("audioTrack "+t.id+" loaded"),this.tracks[t.id].details=t.details,t.details.live&&!this.hasInterval()){var e=1e3*t.details.targetduration;this.setInterval(e)}!t.details.live&&this.hasInterval()&&this.clearInterval()}},i.prototype.onAudioTrackSwitched=function(t){var e=this.tracks[t.id].groupId;e&&this.audioGroupId!==e&&(this.audioGroupId=e)},i.prototype.onLevelLoaded=function(t){var e=this.hls.levels[t.level];if(e.audioGroupIds){var r=e.audioGroupIds[e.urlId];this.audioGroupId!==r&&(this.audioGroupId=r,this._selectInitialAudioTrack())}},i.prototype.onError=function(t){t.type===f.b.NETWORK_ERROR&&(t.fatal&&this.clearInterval(),t.details===f.a.AUDIO_TRACK_LOAD_ERROR&&(N.b.warn("Network failure on audio-track id:",t.context.id),this._handleLoadError()))},i.prototype._setAudioTrack=function(t){if(this._trackId===t&&this.tracks[this._trackId].details)N.b.debug("Same id as current audio-track passed, and track details available -> no-op");else if(t<0||t>=this.tracks.length)N.b.warn("Invalid id passed to audio-track controller");else{var e=this.tracks[t];N.b.log("Now switching to audio-track index "+t),this.clearInterval(),this._trackId=t;var r=e.url,i=e.type,n=e.id;this.hls.trigger(F.a.AUDIO_TRACK_SWITCHING,{id:n,type:i,url:r}),this._loadTrackDetailsIfNeeded(e)}},i.prototype.doTick=function(){this._updateTrack(this._trackId)},i.prototype._selectInitialAudioTrack=function(){var e=this,t=this.tracks;if(t.length){var r=this.tracks[this._trackId],i=null;if(r&&(i=r.name),this._selectDefaultTrack){var n=t.filter(function(t){return t.default});n.length?t=n:N.b.warn("No default audio tracks defined")}var a=!1,o=function(){t.forEach(function(t){a||e.audioGroupId&&t.groupId!==e.audioGroupId||i&&i!==t.name||(e._setAudioTrack(t.id),a=!0)})};o(),a||(i=null,o()),a||(N.b.error("No track found for running audio group-ID: "+this.audioGroupId),this.hls.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:f.a.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))}},i.prototype._needsTrackLoading=function(t){var e=t.details;return!e||(!!e.live||void 0)},i.prototype._loadTrackDetailsIfNeeded=function(t){if(this._needsTrackLoading(t)){var e=t.url,r=t.id;N.b.log("loading audio-track playlist for id: "+r),this.hls.trigger(F.a.AUDIO_TRACK_LOADING,{url:e,id:r})}},i.prototype._updateTrack=function(t){if(!(t<0||t>=this.tracks.length)){this.clearInterval(),this._trackId=t,N.b.log("trying to update audio-track "+t);var e=this.tracks[t];this._loadTrackDetailsIfNeeded(e)}},i.prototype._handleLoadError=function(){this.trackIdBlacklist[this._trackId]=!0;var t=this._trackId,e=this.tracks[t],r=e.name,i=e.language,n=e.groupId;N.b.warn("Loading failed on audio track id: "+t+", group-id: "+n+', name/language: "'+r+'" / "'+i+'"');for(var a=t,o=0;o<this.tracks.length;o++){if(!this.trackIdBlacklist[o])if(this.tracks[o].name===r){a=o;break}}a!==t?(N.b.log("Attempting audio-track fallback id:",a,"group-id:",this.tracks[a].groupId),this._setAudioTrack(a)):N.b.warn('No fallback audio-track found for name/language: "'+r+'" / "'+i+'"')},zt(i,[{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this._trackId},set:function(t){this._setAudioTrack(t),this._selectDefaultTrack=!1}}]),i}(lt),Qt=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var $t=window.performance,Jt="STOPPED",Zt="STARTING",te="IDLE",ee="PAUSED",re="KEY_LOADING",ie="FRAG_LOADING",ne="FRAG_LOADING_WAITING_RETRY",ae="WAITING_TRACK",oe="PARSING",se="PARSED",ue="BUFFER_FLUSHING",le="ENDED",ce="ERROR",de="WAITING_INIT_PTS",fe=function(i){function n(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,F.a.MEDIA_ATTACHED,F.a.MEDIA_DETACHING,F.a.AUDIO_TRACKS_UPDATED,F.a.AUDIO_TRACK_SWITCHING,F.a.AUDIO_TRACK_LOADED,F.a.KEY_LOADED,F.a.FRAG_LOADED,F.a.FRAG_PARSING_INIT_SEGMENT,F.a.FRAG_PARSING_DATA,F.a.FRAG_PARSED,F.a.ERROR,F.a.BUFFER_RESET,F.a.BUFFER_CREATED,F.a.BUFFER_APPENDED,F.a.BUFFER_FLUSHED,F.a.INIT_PTS_FOUND));return r.fragmentTracker=e,r.config=t.config,r.audioCodecSwap=!1,r._state=Jt,r.initPTS=[],r.waitingFragment=null,r.videoTrackCC=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(n,i),n.prototype.onHandlerDestroying=function(){this.stopLoad(),i.prototype.onHandlerDestroying.call(this)},n.prototype.onHandlerDestroyed=function(){this.state=Jt,this.fragmentTracker=null,i.prototype.onHandlerDestroyed.call(this)},n.prototype.onInitPtsFound=function(t){var e=t.id,r=t.frag.cc,i=t.initPTS;"main"===e&&(this.initPTS[r]=i,this.videoTrackCC=r,N.b.log("InitPTS for cc: "+r+" found from video track: "+i),this.state===de&&this.tick())},n.prototype.startLoad=function(t){if(this.tracks){var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),(this.fragLoadError=0)<e&&-1===t?(N.b.log("audio:override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=te):(this.lastCurrentTime=this.startPosition?this.startPosition:t,this.state=Zt),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=t,this.state=Jt},n.prototype.stopLoad=function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragmentTracker.removeFragment(t),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=Jt},n.prototype.doTick=function(){var t,e,r=void 0,i=void 0,n=void 0,a=this.hls,o=a.config;switch(this.state){case ce:case ee:case ue:break;case Zt:this.state=ae,this.loadedmetadata=!1;break;case te:var s=this.tracks;if(!s)break;if(!this.media&&(this.startFragRequested||!o.startFragPrefetch))break;if(this.loadedmetadata)r=this.media.currentTime;else if(void 0===(r=this.nextLoadPosition))break;var u=this.mediaBuffer?this.mediaBuffer:this.media,l=this.videoBuffer?this.videoBuffer:this.media,c=W.bufferInfo(u,r,o.maxBufferHole),d=W.bufferInfo(l,r,o.maxBufferHole),f=c.len,h=c.end,p=this.fragPrevious,v=Math.min(o.maxBufferLength,o.maxMaxBufferLength),g=Math.max(v,d.len),y=this.audioSwitch,m=this.trackId;if((f<g||y)&&m<s.length){if(void 0===(n=s[m].details)){this.state=ae;break}if(!y&&!n.live&&p&&p.sn===n.endSN&&!c.nextStart&&(!this.media.seeking||this.media.duration-h<p.duration/2)){this.hls.trigger(F.a.BUFFER_EOS,{type:"audio"}),this.state=le;break}var b=n.fragments,E=b.length,T=b[0].start,w=b[E-1].start+b[E-1].duration,S=void 0;if(y)if(n.live&&!n.PTSKnown)N.b.log("switching audiotrack, live stream, unknown PTS,load first fragment"),h=0;else if(h=r,n.PTSKnown&&r<T){if(!(c.end>T||c.nextStart))return;N.b.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=T+.05}if(n.initSegment&&!n.initSegment.data)S=n.initSegment;else if(h<=T){if(S=b[0],null!==this.videoTrackCC&&S.cc!==this.videoTrackCC&&(t=b,e=this.videoTrackCC,S=V.search(t,function(t){return t.cc<e?1:t.cc>e?-1:0})),n.live&&S.loadIdx&&S.loadIdx===this.fragLoadIdx){var _=c.nextStart?c.nextStart:T;return N.b.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(_+.05)),void(this.media.currentTime=_+.05)}}else{var A=void 0,R=o.maxFragLookUpTolerance,k=p?b[p.sn-b[0].sn+1]:void 0,L=function(t){var e=Math.min(R,t.duration);return t.start+t.duration-e<=h?1:t.start-e>h&&t.start?-1:0};h<w?(w-R<h&&(R=0),A=k&&!L(k)?k:V.search(b,L)):A=b[E-1],A&&(T=(S=A).start,p&&S.level===p.level&&S.sn===p.sn&&(S.sn<n.endSN?(S=b[S.sn+1-n.startSN],N.b.log("SN just loaded, load next one: "+S.sn)):S=null))}S&&(S.encrypted?(N.b.log("Loading key for "+S.sn+" of ["+n.startSN+" ,"+n.endSN+"],track "+m),this.state=re,a.trigger(F.a.KEY_LOADING,{frag:S})):(N.b.log("Loading "+S.sn+", cc: "+S.cc+" of ["+n.startSN+" ,"+n.endSN+"],track "+m+", currentTime:"+r+",bufferEnd:"+h.toFixed(3)),(y||this.fragmentTracker.getState(S)===B)&&(this.fragCurrent=S,this.startFragRequested=!0,Object(M.a)(S.sn)&&(this.nextLoadPosition=S.start+S.duration),a.trigger(F.a.FRAG_LOADING,{frag:S}),this.state=ie)))}break;case ae:(i=this.tracks[this.trackId])&&i.details&&(this.state=te);break;case ne:var O=$t.now(),D=this.retryDate,C=(u=this.media)&&u.seeking;(!D||D<=O||C)&&(N.b.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=te);break;case de:var I=this.videoTrackCC;if(void 0===this.initPTS[I])break;var x=this.waitingFragment;if(x){var P=x.frag.cc;I!==P?(i=this.tracks[this.trackId]).details&&i.details.live&&(N.b.warn("Waiting fragment CC ("+P+") does not match video track CC ("+I+")"),this.waitingFragment=null,this.state=te):(this.state=ie,this.onFragLoaded(this.waitingFragment),this.waitingFragment=null)}else this.state=te}},n.prototype.onMediaAttached=function(t){var e=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("ended",this.onvended);var r=this.config;this.tracks&&r.autoStartLoad&&this.startLoad(r.startPosition)},n.prototype.onMediaDetaching=function(){var t=this.media;t&&t.ended&&(N.b.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1,this.stopLoad()},n.prototype.onMediaSeeking=function(){this.state===le&&(this.state=te),this.media&&(this.lastCurrentTime=this.media.currentTime),this.tick()},n.prototype.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},n.prototype.onAudioTracksUpdated=function(t){N.b.log("audio tracks updated"),this.tracks=t.audioTracks},n.prototype.onAudioTrackSwitching=function(t){var e=!!t.url;this.trackId=t.id,this.fragCurrent=null,this.state=ee,this.waitingFragment=null,e?this.setInterval(100):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),e&&(this.audioSwitch=!0,this.state=te),this.tick()},n.prototype.onAudioTrackLoaded=function(t){var e=t.details,r=t.id,i=this.tracks[r],n=e.totalduration,a=0;if(N.b.log("track "+r+" loaded ["+e.startSN+","+e.endSN+"],duration:"+n),e.live){var o=i.details;o&&0<e.fragments.length?(at(o,e),a=e.fragments[0].start,e.PTSKnown?N.b.log("live audio playlist sliding:"+a.toFixed(3)):N.b.log("live audio playlist - outdated PTS, unknown sliding")):(e.PTSKnown=!1,N.b.log("live audio playlist - first load, unknown sliding"))}else e.PTSKnown=!1;if(i.details=e,!this.startFragRequested){if(-1===this.startPosition){var s=e.startTimeOffset;Object(M.a)(s)?(N.b.log("start time offset found in playlist, adjust startPosition to "+s),this.startPosition=s):this.startPosition=0}this.nextLoadPosition=this.startPosition}this.state===ae&&(this.state=te),this.tick()},n.prototype.onKeyLoaded=function(){this.state===re&&(this.state=te,this.tick())},n.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag;if(this.state===ie&&e&&"audio"===r.type&&r.level===e.level&&r.sn===e.sn){var i=this.tracks[this.trackId],n=i.details,a=n.totalduration,o=e.level,s=e.sn,u=e.cc,l=this.config.defaultAudioCodec||i.audioCodec||"mp4a.40.2",c=this.stats=t.stats;if("initSegment"===s)this.state=te,c.tparsed=c.tbuffered=$t.now(),n.initSegment.data=t.payload,this.hls.trigger(F.a.FRAG_BUFFERED,{stats:c,frag:e,id:"audio"}),this.tick();else{this.state=oe,this.appended=!1,this.demuxer||(this.demuxer=new et(this.hls,"audio"));var d=this.initPTS[u],f=n.initSegment?n.initSegment.data:[];if(n.initSegment||void 0!==d){this.pendingBuffering=!0,N.b.log("Demuxing "+s+" of ["+n.startSN+" ,"+n.endSN+"],track "+o);this.demuxer.push(t.payload,f,l,null,e,a,!1,d)}else N.b.log("unknown video PTS for continuity counter "+u+", waiting for video PTS before demuxing audio frag "+s+" of ["+n.startSN+" ,"+n.endSN+"],track "+o),this.waitingFragment=t,this.state=de}}this.fragLoadError=0},n.prototype.onFragParsingInitSegment=function(t){var e=this.fragCurrent,r=t.frag;if(e&&"audio"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===oe){var i=t.tracks,n=void 0;if(i.video&&delete i.video,n=i.audio){n.levelCodec=n.codec,n.id=t.id,this.hls.trigger(F.a.BUFFER_CODECS,i),N.b.log("audio track:audio,container:"+n.container+",codecs[level/parsed]=["+n.levelCodec+"/"+n.codec+"]");var a=n.initSegment;if(a){var o={type:"audio",data:a,parent:"audio",content:"initSegment"};this.audioSwitch?this.pendingData=[o]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(F.a.BUFFER_APPENDING,o))}this.tick()}}},n.prototype.onFragParsingData=function(e){var r=this,t=this.fragCurrent,i=e.frag;if(t&&"audio"===e.id&&"audio"===e.type&&i.sn===t.sn&&i.level===t.level&&this.state===oe){var n=this.trackId,a=this.tracks[n],o=this.hls;Object(M.a)(e.endPTS)||(e.endPTS=e.startPTS+t.duration,e.endDTS=e.startDTS+t.duration),t.addElementaryStream(L.ElementaryStreamTypes.AUDIO),N.b.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),nt(a.details,t,e.startPTS,e.endPTS);var s=this.audioSwitch,u=this.media,l=!1;if(s&&u)if(u.readyState){var c=u.currentTime;N.b.log("switching audio track : currentTime:"+c),c>=e.startPTS&&(N.b.log("switching audio track : flushing all audio"),this.state=ue,o.trigger(F.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),l=!0,this.audioSwitch=!1,o.trigger(F.a.AUDIO_TRACK_SWITCHED,{id:n}))}else this.audioSwitch=!1,o.trigger(F.a.AUDIO_TRACK_SWITCHED,{id:n});var d=this.pendingData;if(!d)return N.b.warn("Apparently attempt to enqueue media payload without codec initialization data upfront"),void o.trigger(F.a.ERROR,{type:f.b.MEDIA_ERROR,details:null,fatal:!0});this.audioSwitch||([e.data1,e.data2].forEach(function(t){t&&t.length&&d.push({type:e.type,data:t,parent:"audio",content:"data"})}),!l&&d.length&&(d.forEach(function(t){r.state===oe&&(r.pendingBuffering=!0,r.hls.trigger(F.a.BUFFER_APPENDING,t))}),this.pendingData=[],this.appended=!0)),this.tick()}},n.prototype.onFragParsed=function(t){var e=this.fragCurrent,r=t.frag;e&&"audio"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===oe&&(this.stats.tparsed=$t.now(),this.state=se,this._checkAppendedParsed())},n.prototype.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},n.prototype.onBufferCreated=function(t){var e=t.tracks.audio;e&&(this.mediaBuffer=e.buffer,this.loadedmetadata=!0),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},n.prototype.onBufferAppended=function(t){if("audio"===t.parent){var e=this.state;e!==oe&&e!==se||(this.pendingBuffering=0<t.pending,this._checkAppendedParsed())}},n.prototype._checkAppendedParsed=function(){if(!(this.state!==se||this.appended&&this.pendingBuffering)){var t=this.fragCurrent,e=this.stats,r=this.hls;if(t){this.fragPrevious=t,e.tbuffered=$t.now(),r.trigger(F.a.FRAG_BUFFERED,{stats:e,frag:t,id:"audio"});var i=this.mediaBuffer?this.mediaBuffer:this.media;N.b.log("audio buffered : "+ot.toString(i.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,r.trigger(F.a.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=te}this.tick()}},n.prototype.onError=function(t){var e=t.frag;if(!e||"audio"===e.type)switch(t.details){case f.a.FRAG_LOAD_ERROR:case f.a.FRAG_LOAD_TIMEOUT:var r=t.frag;if(r&&"audio"!==r.type)break;if(!t.fatal){var i=this.fragLoadError;i?i++:i=1;var n=this.config;if(i<=n.fragLoadingMaxRetry){this.fragLoadError=i;var a=Math.min(Math.pow(2,i-1)*n.fragLoadingRetryDelay,n.fragLoadingMaxRetryTimeout);N.b.warn("AudioStreamController: frag loading failed, retry in "+a+" ms"),this.retryDate=$t.now()+a,this.state=ne}else N.b.error("AudioStreamController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=ce}break;case f.a.AUDIO_TRACK_LOAD_ERROR:case f.a.AUDIO_TRACK_LOAD_TIMEOUT:case f.a.KEY_LOAD_ERROR:case f.a.KEY_LOAD_TIMEOUT:this.state!==ce&&(this.state=t.fatal?ce:te,N.b.warn("AudioStreamController: "+t.details+" while loading frag, now switching to "+this.state+" state ..."));break;case f.a.BUFFER_FULL_ERROR:if("audio"===t.parent&&(this.state===oe||this.state===se)){var o=this.mediaBuffer,s=this.media.currentTime;if(o&&W.isBuffered(o,s)&&W.isBuffered(o,s+.5)){var u=this.config;u.maxMaxBufferLength>=u.maxBufferLength&&(u.maxMaxBufferLength/=2,N.b.warn("AudioStreamController: reduce max buffer length to "+u.maxMaxBufferLength+"s")),this.state=te}else N.b.warn("AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=ue,this.hls.trigger(F.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}},n.prototype.onBufferFlushed=function(){var e=this,t=this.pendingData;t&&t.length?(N.b.log("AudioStreamController: appending pending audio data after buffer flushed"),t.forEach(function(t){e.hls.trigger(F.a.BUFFER_APPENDING,t)}),this.appended=!0,this.pendingData=[],this.state=se):(this.state=te,this.fragPrevious=null,this.tick())},Qt(n,[{key:"state",set:function(t){if(this.state!==t){var e=this.state;this._state=t,N.b.log("audio stream:"+e+"->"+t)}},get:function(){return this._state}}]),n}(lt),he=function(){if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var E={"":!0,lr:!0,rl:!0},e={start:!0,middle:!0,end:!0,left:!0,right:!0};function T(t){return"string"==typeof t&&(!!e[t.toLowerCase()]&&t.toLowerCase())}function w(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)t[i]=r[i]}return t}function t(t,e,r){var i=this,n=function(){if("undefined"!=typeof navigator)return/MSIE\s8\.0/.test(navigator.userAgent)}(),a={};n?i=document.createElement("custom"):a.enumerable=!0,i.hasBeenReset=!1;var o="",s=!1,u=t,l=e,c=r,d=null,f="",h=!0,p="auto",v="start",g=50,y="middle",m=50,b="middle";if(Object.defineProperty(i,"id",w({},a,{get:function(){return o},set:function(t){o=""+t}})),Object.defineProperty(i,"pauseOnExit",w({},a,{get:function(){return s},set:function(t){s=!!t}})),Object.defineProperty(i,"startTime",w({},a,{get:function(){return u},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");u=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"endTime",w({},a,{get:function(){return l},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");l=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"text",w({},a,{get:function(){return c},set:function(t){c=""+t,this.hasBeenReset=!0}})),Object.defineProperty(i,"region",w({},a,{get:function(){return d},set:function(t){d=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"vertical",w({},a,{get:function(){return f},set:function(t){var e,r="string"==typeof(e=t)&&!!E[e.toLowerCase()]&&e.toLowerCase();if(!1===r)throw new SyntaxError("An invalid or illegal string was specified.");f=r,this.hasBeenReset=!0}})),Object.defineProperty(i,"snapToLines",w({},a,{get:function(){return h},set:function(t){h=!!t,this.hasBeenReset=!0}})),Object.defineProperty(i,"line",w({},a,{get:function(){return p},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");p=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"lineAlign",w({},a,{get:function(){return v},set:function(t){var e=T(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(i,"position",w({},a,{get:function(){return g},set:function(t){if(t<0||100<t)throw new Error("Position must be between 0 and 100.");g=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"positionAlign",w({},a,{get:function(){return y},set:function(t){var e=T(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(i,"size",w({},a,{get:function(){return m},set:function(t){if(t<0||100<t)throw new Error("Size must be between 0 and 100.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"align",w({},a,{get:function(){return b},set:function(t){var e=T(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");b=e,this.hasBeenReset=!0}})),i.displayState=void 0,n)return i}return t.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},t}(),pe=function(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}};function ve(){this.window=window,this.state="INITIAL",this.buffer="",this.decoder=new pe,this.regionList=[]}function ge(){this.values=Object.create(null)}function ye(t,e,r,i){var n=i?t.split(i):[t];for(var a in n)if("string"==typeof n[a]){var o=n[a].split(r);if(2===o.length)e(o[0],o[1])}}ge.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,r){for(var i=0;i<r.length;++i)if(e===r[i]){this.set(t,e);break}},integer:function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},percent:function(t,e){return!!(e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&0<=(e=parseFloat(e))&&e<=100)&&(this.set(t,e),!0)}};var me=new he(0,0,0),be="middle"===me.align?"middle":"center";function Ee(e,t,o){var r=e;function i(){var t=function(t){function e(t,e,r,i){return 3600*(0|t)+60*(0|e)+(0|r)+(0|i)/1e3}var r=t.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return r?r[3]?e(r[1],r[2],r[3].replace(":",""),r[4]):59<r[1]?e(r[1],r[2],0,r[4]):e(0,r[1],r[2],r[4]):null}(e);if(null===t)throw new Error("Malformed timestamp: "+r);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function n(){e=e.replace(/^\s+/,"")}if(n(),t.startTime=i(),n(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);e=e.substr(3),n(),t.endTime=i(),n(),function(t,e){var a=new ge;ye(t,function(t,e){switch(t){case"region":for(var r=o.length-1;0<=r;r--)if(o[r].id===e){a.set(t,o[r].region);break}break;case"vertical":a.alt(t,e,["rl","lr"]);break;case"line":var i=e.split(","),n=i[0];a.integer(t,n),a.percent(t,n)&&a.set("snapToLines",!1),a.alt(t,n,["auto"]),2===i.length&&a.alt("lineAlign",i[1],["start",be,"end"]);break;case"position":i=e.split(","),a.percent(t,i[0]),2===i.length&&a.alt("positionAlign",i[1],["start",be,"end","line-left","line-right","auto"]);break;case"size":a.percent(t,e);break;case"align":a.alt(t,e,["start",be,"end","left","right"])}},/:/,/\s/),e.region=a.get("region",null),e.vertical=a.get("vertical","");var r=a.get("line","auto");"auto"===r&&-1===me.line&&(r=-1),e.line=r,e.lineAlign=a.get("lineAlign","start"),e.snapToLines=a.get("snapToLines",!0),e.size=a.get("size",100),e.align=a.get("align",be);var i=a.get("position","auto");"auto"===i&&50===me.position&&(i="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=i}(e,t)}function Te(t){return t.replace(/<br(?: \/)?>/gi,"\n")}ve.prototype={parse:function(t){var i=this;function e(){var t=i.buffer,e=0;for(t=Te(t);e<t.length&&"\r"!==t[e]&&"\n"!==t[e];)++e;var r=t.substr(0,e);return"\r"===t[e]&&++e,"\n"===t[e]&&++e,i.buffer=t.substr(e),r}t&&(i.buffer+=i.decoder.decode(t,{stream:!0}));try{var r=void 0;if("INITIAL"===i.state){if(!/\r\n|\n/.test(i.buffer))return this;var n=(r=e()).match(/^()?WEBVTT([ \t].*)?$/);if(!n||!n[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var a=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;switch(a?a=!1:r=e(),i.state){case"HEADER":/:/.test(r)?ye(r,function(t,e){},/:/):r||(i.state="ID");continue;case"NOTE":r||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){i.state="NOTE";break}if(!r)continue;if(i.cue=new he(0,0,""),i.state="CUE",-1===r.indexOf("--\x3e")){i.cue.id=r;continue}case"CUE":try{Ee(r,i.cue,i.regionList)}catch(t){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(a=!0)){i.oncue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}i.cue.text&&(i.cue.text+="\n"),i.cue.text+=r;continue;case"BADCUE":r||(i.state="ID");continue}}}catch(t){"CUETEXT"===i.state&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state="INITIAL"===i.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){try{if(this.buffer+=this.decoder.decode(),(this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state)throw new Error("Malformed WebVTT signature.")}catch(t){throw t}return this.onflush&&this.onflush(),this}};var we=ve;function Se(t,e,r,i){for(var n=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=window.VTTCue||window.TextTrackCue,c=0;c<i.rows.length;c++)if(o=!0,s=0,u="",!(n=i.rows[c]).isEmpty()){for(var d=0;d<n.chars.length;d++)n.chars[d].uchar.match(/\s/)&&o?s++:(u+=n.chars[d].uchar,o=!1);(n.cueStartTime=e)===r&&(r+=1e-4),a=new l(e,r,Te(u.trim())),16<=s?s--:s++,navigator.userAgent.match(/Firefox\//)?a.line=c+1:a.line=7<c?c-2:c+1,a.align="left",a.position=Math.max(0,Math.min(100,s/32*100+(navigator.userAgent.match(/Firefox\//)?50:0))),t.addCue(a)}}function _e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Ae={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},Re=function(t){var e=t;return Ae.hasOwnProperty(t)&&(e=Ae[t]),String.fromCharCode(e)},ke=100,Le={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Oe={17:2,18:4,21:6,22:8,23:10,19:13,20:15},De={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Ce={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Ie=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],xe={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(t){this.time=t},log:function(t,e){this.verboseFilter[t];this.verboseLevel}},Pe=function(t){for(var e=[],r=0;r<t.length;r++)e.push(t[r].toString(16));return e},Me=function(){function a(t,e,r,i,n){_e(this,a),this.foreground=t||"white",this.underline=e||!1,this.italics=r||!1,this.background=i||"black",this.flash=n||!1}return a.prototype.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},a.prototype.setStyles=function(t){for(var e=["foreground","underline","italics","background","flash"],r=0;r<e.length;r++){var i=e[r];t.hasOwnProperty(i)&&(this[i]=t[i])}},a.prototype.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},a.prototype.equals=function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash},a.prototype.copy=function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash},a.prototype.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},a}(),Fe=function(){function o(t,e,r,i,n,a){_e(this,o),this.uchar=t||" ",this.penState=new Me(e,r,i,n,a)}return o.prototype.reset=function(){this.uchar=" ",this.penState.reset()},o.prototype.setChar=function(t,e){this.uchar=t,this.penState.copy(e)},o.prototype.setPenState=function(t){this.penState.copy(t)},o.prototype.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)},o.prototype.copy=function(t){this.uchar=t.uchar,this.penState.copy(t.penState)},o.prototype.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},o}(),Ne=function(){function e(){_e(this,e),this.chars=[];for(var t=0;t<ke;t++)this.chars.push(new Fe);this.pos=0,this.currPenState=new Me}return e.prototype.equals=function(t){for(var e=!0,r=0;r<ke;r++)if(!this.chars[r].equals(t.chars[r])){e=!1;break}return e},e.prototype.copy=function(t){for(var e=0;e<ke;e++)this.chars[e].copy(t.chars[e])},e.prototype.isEmpty=function(){for(var t=!0,e=0;e<ke;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t},e.prototype.setCursor=function(t){this.pos!==t&&(this.pos=t),this.pos<0?(xe.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>ke&&(xe.log("ERROR","Too large cursor position "+this.pos),this.pos=ke)},e.prototype.moveCursor=function(t){var e=this.pos+t;if(1<t)for(var r=this.pos+1;r<e+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(e)},e.prototype.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},e.prototype.insertChar=function(t){144<=t&&this.backSpace();var e=Re(t);this.pos>=ke?xe.log("ERROR","Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))},e.prototype.clearFromPos=function(t){var e=void 0;for(e=t;e<ke;e++)this.chars[e].reset()},e.prototype.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},e.prototype.clearToEndOfRow=function(){this.clearFromPos(this.pos)},e.prototype.getTextString=function(){for(var t=[],e=!0,r=0;r<ke;r++){var i=this.chars[r].uchar;" "!==i&&(e=!1),t.push(i)}return e?"":t.join("")},e.prototype.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},e}(),Ue=function(){function e(){_e(this,e),this.rows=[];for(var t=0;t<15;t++)this.rows.push(new Ne);this.currRow=14,this.nrRollUpRows=null,this.reset()}return e.prototype.reset=function(){for(var t=0;t<15;t++)this.rows[t].clear();this.currRow=14},e.prototype.equals=function(t){for(var e=!0,r=0;r<15;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e},e.prototype.copy=function(t){for(var e=0;e<15;e++)this.rows[e].copy(t.rows[e])},e.prototype.isEmpty=function(){for(var t=!0,e=0;e<15;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t},e.prototype.backSpace=function(){this.rows[this.currRow].backSpace()},e.prototype.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},e.prototype.insertChar=function(t){this.rows[this.currRow].insertChar(t)},e.prototype.setPen=function(t){this.rows[this.currRow].setPenStyles(t)},e.prototype.moveCursor=function(t){this.rows[this.currRow].moveCursor(t)},e.prototype.setCursor=function(t){xe.log("INFO","setCursor: "+t),this.rows[this.currRow].setCursor(t)},e.prototype.setPAC=function(t){xe.log("INFO","pacData = "+JSON.stringify(t));var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var r=0;r<15;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){var a=n.rows[i].cueStartTime;if(a&&a<xe.time)for(var o=0;o<this.nrRollUpRows;o++)this.rows[e-this.nrRollUpRows+o+1].copy(n.rows[i+o])}}this.currRow=e;var s=this.rows[this.currRow];if(null!==t.indent){var u=t.indent,l=Math.max(u-1,0);s.setCursor(t.indent),t.color=s.chars[l].penState.foreground}var c={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(c)},e.prototype.setBkgData=function(t){xe.log("INFO","bkgData = "+JSON.stringify(t)),this.backSpace(),this.setPen(t),this.insertChar(32)},e.prototype.setRollUpRows=function(t){this.nrRollUpRows=t},e.prototype.rollUp=function(){if(null!==this.nrRollUpRows){xe.log("TEXT",this.getDisplayText());var t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),xe.log("INFO","Rolling up")}else xe.log("DEBUG","roll_up but nrRollUpRows not set yet")},e.prototype.getDisplayText=function(t){t=t||!1;for(var e=[],r="",i=-1,n=0;n<15;n++){var a=this.rows[n].getTextString();a&&(i=n+1,t?e.push("Row "+i+": '"+a+"'"):e.push(a.trim()))}return 0<e.length&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r},e.prototype.getTextAndFormat=function(){return this.rows},e}(),Be=function(){function r(t,e){_e(this,r),this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new Ue,this.nonDisplayedMemory=new Ue,this.lastOutputScreen=new Ue,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}return r.prototype.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},r.prototype.getHandler=function(){return this.outputFilter},r.prototype.setHandler=function(t){this.outputFilter=t},r.prototype.setPAC=function(t){this.writeScreen.setPAC(t)},r.prototype.setBkgData=function(t){this.writeScreen.setBkgData(t)},r.prototype.setMode=function(t){t!==this.mode&&(this.mode=t,xe.log("INFO","MODE="+t),"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=t)},r.prototype.insertChars=function(t){for(var e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";xe.log("INFO",r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(xe.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},r.prototype.ccRCL=function(){xe.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},r.prototype.ccBS=function(){xe.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},r.prototype.ccAOF=function(){},r.prototype.ccAON=function(){},r.prototype.ccDER=function(){xe.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},r.prototype.ccRU=function(t){xe.log("INFO","RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)},r.prototype.ccFON=function(){xe.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},r.prototype.ccRDC=function(){xe.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},r.prototype.ccTR=function(){xe.log("INFO","TR"),this.setMode("MODE_TEXT")},r.prototype.ccRTD=function(){xe.log("INFO","RTD"),this.setMode("MODE_TEXT")},r.prototype.ccEDM=function(){xe.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},r.prototype.ccCR=function(){xe.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},r.prototype.ccENM=function(){xe.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},r.prototype.ccEOC=function(){if(xe.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,xe.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},r.prototype.ccTO=function(t){xe.log("INFO","TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)},r.prototype.ccMIDROW=function(t){var e={flash:!1};if(e.underline=t%2==1,e.italics=46<=t,e.italics)e.foreground="white";else{var r=Math.floor(t/2)-16;e.foreground=["white","green","blue","cyan","red","yellow","magenta"][r]}xe.log("INFO","MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},r.prototype.outputDataUpdate=function(){0<arguments.length&&void 0!==arguments[0]&&arguments[0],xe.time},r.prototype.cueSplitAtTime=function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))},r}(),Ge=function(){function i(t,e,r){_e(this,i),this.field=t||1,this.outputs=[e,r],this.channels=[new Be(1,e),new Be(2,r)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}}return i.prototype.getHandler=function(t){return this.channels[t].getHandler()},i.prototype.setHandler=function(t,e){this.channels[t].setHandler(e)},i.prototype.addData=function(t,e){var r=void 0,i=void 0,n=void 0,a=!1;this.lastTime=t,xe.setTime(t);for(var o=0;o<e.length;o+=2)if(i=127&e[o],n=127&e[o+1],0!==i||0!==n){if(xe.log("DATA","["+Pe([e[o],e[o+1]])+"] -> ("+Pe([i,n])+")"),(r=this.parseCmd(i,n))||(r=this.parseMidrow(i,n)),r||(r=this.parsePAC(i,n)),r||(r=this.parseBackgroundAttributes(i,n)),!r)if(a=this.parseChars(i,n))if(this.currChNr&&0<=this.currChNr)this.channels[this.currChNr-1].insertChars(a);else xe.log("WARNING","No channel found yet. TEXT-MODE?");r?this.dataCounters.cmd+=2:a?this.dataCounters.char+=2:(this.dataCounters.other+=2,xe.log("WARNING","Couldn't parse cleaned data "+Pe([i,n])+" orig: "+Pe([e[o],e[o+1]])))}else this.dataCounters.padding+=2},i.prototype.parseCmd=function(t,e){var r=null;if(!((20===t||28===t)&&32<=e&&e<=47)&&!((23===t||31===t)&&33<=e&&e<=35))return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,xe.log("DEBUG","Repeated command ("+Pe([t,e])+") is dropped"),!0;r=20===t||23===t?1:2;var i=this.channels[r-1];return 20===t||28===t?32===e?i.ccRCL():33===e?i.ccBS():34===e?i.ccAOF():35===e?i.ccAON():36===e?i.ccDER():37===e?i.ccRU(2):38===e?i.ccRU(3):39===e?i.ccRU(4):40===e?i.ccFON():41===e?i.ccRDC():42===e?i.ccTR():43===e?i.ccRTD():44===e?i.ccEDM():45===e?i.ccCR():46===e?i.ccENM():47===e&&i.ccEOC():i.ccTO(e-32),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=r,!0},i.prototype.parseMidrow=function(t,e){var r=null;return(17===t||25===t)&&32<=e&&e<=47&&((r=17===t?1:2)!==this.currChNr?(xe.log("ERROR","Mismatch channel in midrow parsing"),!1):(this.channels[r-1].ccMIDROW(e),xe.log("DEBUG","MIDROW ("+Pe([t,e])+")"),!0))},i.prototype.parsePAC=function(t,e){var r,i=null;if(!((17<=t&&t<=23||25<=t&&t<=31)&&64<=e&&e<=127)&&!((16===t||24===t)&&64<=e&&e<=95))return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,!(this.lastCmdB=null);r=t<=23?1:2,i=64<=e&&e<=95?1===r?Le[t]:De[t]:1===r?Oe[t]:Ce[t];var n=this.interpretPAC(i,e);return this.channels[r-1].setPAC(n),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=r,!0},i.prototype.interpretPAC=function(t,e){var r=e,i={color:null,italics:!1,indent:null,underline:!1,row:t};return r=95<e?e-96:e-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},i.prototype.parseChars=function(t,e){var r=null,i=null,n=null;if(25<=t?(r=2,n=t-8):(r=1,n=t),17<=n&&n<=19){var a=e;a=17===n?e+80:18===n?e+112:e+144,xe.log("INFO","Special char '"+Re(a)+"' in channel "+r),i=[a]}else 32<=t&&t<=127&&(i=0===e?[t]:[t,e]);if(i){var o=Pe(i);xe.log("DEBUG","Char codes = "+o.join(",")),this.lastCmdA=null,this.lastCmdB=null}return i},i.prototype.parseBackgroundAttributes=function(t,e){var r,i=void 0,n=void 0;return((16===t||24===t)&&32<=e&&e<=47||(23===t||31===t)&&45<=e&&e<=47)&&(i={},16===t||24===t?(n=Math.floor((e-32)/2),i.background=Ie[n],e%2==1&&(i.background=i.background+"_semi")):45===e?i.background="transparent":(i.foreground="black",47===e&&(i.underline=!0)),r=t<24?1:2,this.channels[r-1].setBkgData(i),this.lastCmdA=null,!(this.lastCmdB=null))},i.prototype.reset=function(){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].reset();this.lastCmdA=null,this.lastCmdB=null},i.prototype.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].cueSplitAtTime(t)},i}();var je=function(){function r(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),this.timelineController=t,this.trackName=e,this.startTime=null,this.endTime=null,this.screen=null}return r.prototype.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen),this.startTime=null)},r.prototype.newCue=function(t,e,r){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)},r}(),Ke=function(t,e,r){return t.substr(r||0,e.length)===e},He=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()},Ve={parse:function(t,o,i,n,e,r){var a=Object(Ot.b)(new Uint8Array(t)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),s="00:00.000",u=0,l=0,c=0,d=[],f=void 0,h=!0,p=new we;p.oncue=function(t){var e=i[n],r=i.ccOffset;e&&e.new&&(void 0!==l?r=i.ccOffset=e.start:function(t,e,r){var i=t[e],n=t[i.prevCC];if(!n||!n.new&&i.new)return t.ccOffset=t.presentationOffset=i.start,i.new=!1;for(;n&&n.new;)t.ccOffset+=i.start-n.start,i.new=!1,n=t[(i=n).prevCC];t.presentationOffset=r}(i,n,c)),c&&(r=c+i.ccOffset-i.presentationOffset),t.startTime+=r-l,t.endTime+=r-l,t.id=He(t.startTime.toString())+He(t.endTime.toString())+He(t.text),t.text=decodeURIComponent(encodeURIComponent(t.text)),0<t.endTime&&d.push(t)},p.onparsingerror=function(t){f=t},p.onflush=function(){f&&r?r(f):e(d)},a.forEach(function(e){if(h){if(Ke(e,"X-TIMESTAMP-MAP=")){h=!1,e.substr(16).split(",").forEach(function(t){Ke(t,"LOCAL:")?s=t.substr(6):Ke(t,"MPEGTS:")&&(u=parseInt(t.substr(7)))});try{u-=o=o<0?o+8589934592:o,t=s,r=parseInt(t.substr(-3)),i=parseInt(t.substr(-6,2)),n=parseInt(t.substr(-9,2)),a=9<t.length?parseInt(t.substr(0,t.indexOf(":"))):0,l=(Object(M.a)(r)&&Object(M.a)(i)&&Object(M.a)(n)&&Object(M.a)(a)?(r+=1e3*i,r+=6e4*n,r+=36e5*a):-1)/1e3,c=u/9e4,-1===l&&(f=new Error("Malformed X-TIMESTAMP-MAP: "+e))}catch(t){f=new Error("Malformed X-TIMESTAMP-MAP: "+e)}return}""===e&&(h=!1)}var t,r,i,n,a;p.parse(e+"\n")}),p.flush()}};var We=function(n){function a(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,n.call(this,t,F.a.MEDIA_ATTACHING,F.a.MEDIA_DETACHING,F.a.FRAG_PARSING_USERDATA,F.a.FRAG_DECRYPTED,F.a.MANIFEST_LOADING,F.a.MANIFEST_LOADED,F.a.FRAG_LOADED,F.a.LEVEL_SWITCHING,F.a.INIT_PTS_FOUND));if(e.hls=t,e.config=t.config,e.enabled=!0,e.Cues=t.config.cueHandler,e.textTracks=[],e.tracks=[],e.unparsedVttFrags=[],e.initPTS=void 0,e.cueRanges=[],e.captionsTracks={},e.captionsProperties={textTrack1:{label:e.config.captionsTextTrack1Label,languageCode:e.config.captionsTextTrack1LanguageCode},textTrack2:{label:e.config.captionsTextTrack2Label,languageCode:e.config.captionsTextTrack2LanguageCode}},e.config.enableCEA708Captions){var r=new je(e,"textTrack1"),i=new je(e,"textTrack2");e.cea608Parser=new Ge(0,r,i)}return e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(a,n),a.prototype.addCues=function(t,e,r,i){for(var n,a,o,s,u=this.cueRanges,l=!1,c=u.length;c--;){var d=u[c],f=(n=d[0],a=d[1],o=e,s=r,Math.min(a,s)-Math.max(n,o));if(0<=f&&(d[0]=Math.min(d[0],e),d[1]=Math.max(d[1],r),l=!0,.5<f/(r-e)))return}l||u.push([e,r]),this.Cues.newCue(this.captionsTracks[t],e,r,i)},a.prototype.onInitPtsFound=function(t){var e=this;void 0===this.initPTS&&(this.initPTS=t.initPTS),this.unparsedVttFrags.length&&(this.unparsedVttFrags.forEach(function(t){e.onFragLoaded(t)}),this.unparsedVttFrags=[])},a.prototype.getExistingTrack=function(t){var e=this.media;if(e)for(var r=0;r<e.textTracks.length;r++){var i=e.textTracks[r];if(i[t])return i}return null},a.prototype.createCaptionsTrack=function(t){var e=this.captionsProperties[t],r=e.label,i=e.languageCode,n=this.captionsTracks;if(!n[t]){var a=this.getExistingTrack(t);if(a)n[t]=a,Ct(n[t]),Dt(n[t],this.media);else{var o=this.createTextTrack("captions",r,i);o&&(o[t]=!0,n[t]=o)}}},a.prototype.createTextTrack=function(t,e,r){var i=this.media;if(i)return i.addTextTrack(t,e,r)},a.prototype.destroy=function(){u.prototype.destroy.call(this)},a.prototype.onMediaAttaching=function(t){this.media=t.media,this._cleanTracks()},a.prototype.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(t){Ct(e[t]),delete e[t]})},a.prototype.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0},this._cleanTracks()},a.prototype._cleanTracks=function(){var t=this.media;if(t){var e=t.textTracks;if(e)for(var r=0;r<e.length;r++)Ct(e[r])}},a.prototype.onManifestLoaded=function(t){var o=this;if(this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=void 0,this.cueRanges=[],this.config.enableWebVTT){this.tracks=t.subtitles||[];var s=this.media?this.media.textTracks:[];this.tracks.forEach(function(t,e){var r,i,n=void 0;if(e<s.length){var a=s[e];i=t,!(r=a)||r.label!==i.name||r.textTrack1||r.textTrack2||(n=a)}n||(n=o.createTextTrack("subtitles",t.name,t.lang)),t.default?n.mode=o.hls.subtitleDisplay?"showing":"hidden":n.mode="disabled",o.textTracks.push(n)})}},a.prototype.onLevelSwitching=function(){this.enabled="NONE"!==this.hls.currentLevel.closedCaptions},a.prototype.onFragLoaded=function(t){var e=t.frag,r=t.payload;if("main"===e.type){var i=e.sn;if(i!==this.lastSn+1){var n=this.cea608Parser;n&&n.reset()}this.lastSn=i}else if("subtitle"===e.type)if(r.byteLength){if(void 0===this.initPTS)return void this.unparsedVttFrags.push(t);var a=e.decryptdata;null!=a&&null!=a.key&&"AES-128"===a.method||this._parseVTTs(e,r)}else this.hls.trigger(F.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})},a.prototype._parseVTTs=function(e,t){var r=this.vttCCs;r[e.cc]||(r[e.cc]={start:e.start,prevCC:this.prevCC,new:!0},this.prevCC=e.cc);var n=this.textTracks,a=this.hls;Ve.parse(t,this.initPTS,r,e.cc,function(t){var i=n[e.trackId];"disabled"!==i.mode?(t.forEach(function(e){if(!i.cues.getCueById(e.id))try{i.addCue(e)}catch(t){var r=new window.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,i.addCue(r)}}),a.trigger(F.a.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})):a.trigger(F.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})},function(t){N.b.log("Failed to parse VTT cue: "+t),a.trigger(F.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})})},a.prototype.onFragDecrypted=function(t){var e=t.payload,r=t.frag;if("subtitle"===r.type){if(void 0===this.initPTS)return void this.unparsedVttFrags.push(t);this._parseVTTs(r,e)}},a.prototype.onFragParsingUserdata=function(t){if(this.enabled&&this.config.enableCEA708Captions)for(var e=0;e<t.samples.length;e++){var r=this.extractCea608Data(t.samples[e].bytes);this.cea608Parser.addData(t.samples[e].pts,r)}},a.prototype.extractCea608Data=function(t){for(var e=31&t[0],r=2,i=void 0,n=void 0,a=void 0,o=[],s=0;s<e;s++)i=t[r++],n=127&t[r++],a=127&t[r++],0===n&&0===a||0!=(4&i)&&0===(3&i)&&(o.push(n),o.push(a));return o},a}(u),Ye=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();function qe(t){for(var e=[],r=0;r<t.length;r++)"subtitles"===t[r].kind&&e.push(t[r]);return e}var ze=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.MEDIA_ATTACHED,F.a.MEDIA_DETACHING,F.a.MANIFEST_LOADING,F.a.MANIFEST_LOADED,F.a.SUBTITLE_TRACK_LOADED));return e.tracks=[],e.trackId=-1,e.media=null,e.subtitleDisplay=!0,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype._onTextTracksChanged=function(){if(this.media){for(var t=-1,e=qe(this.media.textTracks),r=0;r<e.length;r++)if("hidden"===e[r].mode)t=r;else if("showing"===e[r].mode){t=r;break}this.subtitleTrack=t}},i.prototype.destroy=function(){u.prototype.destroy.call(this)},i.prototype.onMediaAttached=function(t){var e=this;this.media=t.media,this.media&&(this.queuedDefaultTrack&&(this.subtitleTrack=this.queuedDefaultTrack,delete this.queuedDefaultTrack),this.trackChangeListener=this._onTextTracksChanged.bind(this),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.subtitlePollingInterval=setInterval(function(){e.trackChangeListener()},500):this.media.textTracks.addEventListener("change",this.trackChangeListener))},i.prototype.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),this.media=null)},i.prototype.onManifestLoading=function(){this.tracks=[],this.trackId=-1},i.prototype.onManifestLoaded=function(t){var e=this,r=t.subtitles||[];this.tracks=r,this.trackId=-1,this.hls.trigger(F.a.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:r}),r.forEach(function(t){t.default&&(e.media?e.subtitleTrack=t.id:e.queuedDefaultTrack=t.id)})},i.prototype.onTick=function(){var t=this.trackId,e=this.tracks[t];if(e){var r=e.details;r&&!r.live||(N.b.log("(re)loading playlist for subtitle track "+t),this.hls.trigger(F.a.SUBTITLE_TRACK_LOADING,{url:e.url,id:t}))}},i.prototype.onSubtitleTrackLoaded=function(t){var e=this;t.id<this.tracks.length&&(N.b.log("subtitle track "+t.id+" loaded"),this.tracks[t.id].details=t.details,t.details.live&&!this.timer&&(this.timer=setInterval(function(){e.onTick()},1e3*t.details.targetduration,this)),!t.details.live&&this.timer&&this._stopTimer())},i.prototype.setSubtitleTrackInternal=function(t){var e=this.hls,r=this.tracks;if(!("number"!=typeof t||t<-1||t>=r.length)&&(this._stopTimer(),this.trackId=t,N.b.log("switching to subtitle track "+t),e.trigger(F.a.SUBTITLE_TRACK_SWITCH,{id:t}),-1!==t)){var i=r[t],n=i.details;n&&!n.live||(N.b.log("(re)loading playlist for subtitle track "+t),e.trigger(F.a.SUBTITLE_TRACK_LOADING,{url:i.url,id:t}))}},i.prototype._stopTimer=function(){this.timer&&(clearInterval(this.timer),this.timer=null)},i.prototype._toggleTrackModes=function(t){var e=this.media,r=this.subtitleDisplay,i=this.trackId;if(e){var n=qe(e.textTracks);if(-1===t)[].slice.call(n).forEach(function(t){t.mode="disabled"});else{var a=n[i];a&&(a.mode="disabled")}var o=n[t];o&&(o.mode=r?"showing":"hidden")}},Ye(i,[{key:"subtitleTracks",get:function(){return this.tracks}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.trackId!==t&&(this._toggleTrackModes(t),this.setSubtitleTrackInternal(t))}}]),i}(u),Xe=r(8);var Qe=window.performance,$e="STOPPED",Je="IDLE",Ze="KEY_LOADING",tr="FRAG_LOADING",er=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.MEDIA_ATTACHED,F.a.ERROR,F.a.KEY_LOADED,F.a.FRAG_LOADED,F.a.SUBTITLE_TRACKS_UPDATED,F.a.SUBTITLE_TRACK_SWITCH,F.a.SUBTITLE_TRACK_LOADED,F.a.SUBTITLE_FRAG_PROCESSED));return e.config=t.config,e.vttFragSNsProcessed={},e.vttFragQueues=void 0,e.currentlyProcessing=null,e.state=$e,e.currentTrackId=-1,e.decrypter=new Xe.a(t.observer,t.config),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype.onHandlerDestroyed=function(){this.state=$e},i.prototype.clearVttFragQueues=function(){var e=this;this.vttFragQueues={},this.tracks.forEach(function(t){e.vttFragQueues[t.id]=[]})},i.prototype.nextFrag=function(){if(null===this.currentlyProcessing&&-1<this.currentTrackId&&this.vttFragQueues[this.currentTrackId].length){var t=this.currentlyProcessing=this.vttFragQueues[this.currentTrackId].shift();this.fragCurrent=t,this.hls.trigger(F.a.FRAG_LOADING,{frag:t}),this.state=tr}},i.prototype.onSubtitleFragProcessed=function(t){t.success&&this.vttFragSNsProcessed[t.frag.trackId].push(t.frag.sn),this.currentlyProcessing=null,this.state=Je,this.nextFrag()},i.prototype.onMediaAttached=function(){this.state=Je},i.prototype.onError=function(t){var e=t.frag;e&&"subtitle"!==e.type||this.currentlyProcessing&&(this.currentlyProcessing=null,this.nextFrag())},i.prototype.doTick=function(){var i=this;switch(this.state){case Je:var t,e=this.tracks,n=this.currentTrackId,a=this.vttFragSNsProcessed[n],o=this.vttFragQueues[n],s=this.currentlyProcessing?this.currentlyProcessing.sn:-1;if(!e)break;if(n<e.length&&(t=e[n].details),void 0===t)break;t.fragments.forEach(function(t){var e,r;r=t,-1<a.indexOf(r.sn)||t.sn===s||(e=t,o.some(function(t){return t.sn===e.sn}))||(t.encrypted?(N.b.log("Loading key for "+t.sn),i.state=Ze,i.hls.trigger(F.a.KEY_LOADING,{frag:t})):(t.trackId=n,o.push(t),i.nextFrag()))})}},i.prototype.onSubtitleTracksUpdated=function(t){var e=this;N.b.log("subtitle tracks updated"),this.tracks=t.subtitleTracks,this.clearVttFragQueues(),this.vttFragSNsProcessed={},this.tracks.forEach(function(t){e.vttFragSNsProcessed[t.id]=[]})},i.prototype.onSubtitleTrackSwitch=function(t){if(this.currentTrackId=t.id,this.tracks&&-1!==this.currentTrackId){var e=this.tracks[this.currentTrackId];e&&e.details&&this.tick()}},i.prototype.onSubtitleTrackLoaded=function(){this.tick()},i.prototype.onKeyLoaded=function(){this.state===Ze&&(this.state=Je,this.tick())},i.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag.decryptdata,i=t.frag,n=this.hls;if(this.state===tr&&e&&"subtitle"===t.frag.type&&e.sn===t.frag.sn&&0<t.payload.byteLength&&null!=r&&null!=r.key&&"AES-128"===r.method){var a=void 0;try{a=Qe.now()}catch(t){a=Date.now()}this.decrypter.decrypt(t.payload,r.key.buffer,r.iv.buffer,function(t){var e=void 0;try{e=Qe.now()}catch(t){e=Date.now()}n.trigger(F.a.FRAG_DECRYPTED,{frag:i,payload:t,stats:{tstart:a,tdecrypt:e}})})}},i}(lt),rr=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();var ir=window.XMLHttpRequest,nr="com.widevine.alpha",ar="com.microsoft.playready",or=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t,F.a.MEDIA_ATTACHED,F.a.MANIFEST_PARSED));return e._widevineLicenseUrl=t.config.widevineLicenseUrl,e._licenseXhrSetup=t.config.licenseXhrSetup,e._emeEnabled=t.config.emeEnabled,e._requestMediaKeySystemAccess=t.config.requestMediaKeySystemAccessFunc,e._mediaKeysList=[],e._media=null,e._hasSetMediaKeys=!1,e._isMediaEncrypted=!1,e._requestLicenseFailureCount=0,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,r),i.prototype.getLicenseServerUrl=function(t){var e=void 0;switch(t){case nr:e=this._widevineLicenseUrl;break;default:e=null}return e||(N.b.error('No license server URL configured for key-system "'+t+'"'),this.hls.trigger(F.a.ERROR,{type:f.b.KEY_SYSTEM_ERROR,details:f.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})),e},i.prototype._attemptKeySystemAccess=function(e,t,r){var i=this,n=function(t,e,r){switch(t){case nr:return i={videoCapabilities:[]},r.forEach(function(t){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"'})}),[i];default:throw Error("Unknown key-system: "+t)}var i}(e,0,r);n?(N.b.log("Requesting encrypted media key-system access"),this.requestMediaKeySystemAccess(e,n).then(function(t){i._onMediaKeySystemAccessObtained(e,t)}).catch(function(t){N.b.error('Failed to obtain key-system "'+e+'" access:',t)})):N.b.warn("Can not create config for key-system (maybe because platform is not supported):",e)},i.prototype._onMediaKeySystemAccessObtained=function(e,t){var r=this;N.b.log('Access for key-system "'+e+'" obtained');var i={mediaKeys:null,mediaKeysSession:null,mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(i),t.createMediaKeys().then(function(t){i.mediaKeys=t,N.b.log('Media-keys created for key-system "'+e+'"'),r._onMediaKeysCreated()}).catch(function(t){N.b.error("Failed to create media-keys:",t)})},i.prototype._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach(function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))})},i.prototype._onNewMediaKeySession=function(e){var r=this;N.b.log("New key-system session "+e.sessionId),e.addEventListener("message",function(t){r._onKeySessionMessage(e,t.message)},!1)},i.prototype._onKeySessionMessage=function(e,t){N.b.log("Got EME message event, creating license request"),this._requestLicense(t,function(t){N.b.log("Received license data, updating key-session"),e.update(t)})},i.prototype._onMediaEncrypted=function(t,e){N.b.log('Media is encrypted using "'+t+'" init data type'),this._isMediaEncrypted=!0,this._mediaEncryptionInitDataType=t,this._mediaEncryptionInitData=e,this._attemptSetMediaKeys(),this._generateRequestWithPreferredKeySession()},i.prototype._attemptSetMediaKeys=function(){if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys)return N.b.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(F.a.ERROR,{type:f.b.KEY_SYSTEM_ERROR,details:f.a.KEY_SYSTEM_NO_KEYS,fatal:!0});N.b.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},i.prototype._generateRequestWithPreferredKeySession=function(){var e=this,t=this._mediaKeysList[0];if(!t)return N.b.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(F.a.ERROR,{type:f.b.KEY_SYSTEM_ERROR,details:f.a.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(t.mediaKeysSessionInitialized)N.b.warn("Key-Session already initialized but requested again");else{var r=t.mediaKeysSession;r||(N.b.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(F.a.ERROR,{type:f.b.KEY_SYSTEM_ERROR,details:f.a.KEY_SYSTEM_NO_SESSION,fatal:!0}));var i=this._mediaEncryptionInitDataType,n=this._mediaEncryptionInitData;N.b.log('Generating key-session request for "'+i+'" init data type'),t.mediaKeysSessionInitialized=!0,r.generateRequest(i,n).then(function(){N.b.debug("Key-session generation succeeded")}).catch(function(t){N.b.error("Error generating key-session request:",t),e.hls.trigger(F.a.ERROR,{type:f.b.KEY_SYSTEM_ERROR,details:f.a.KEY_SYSTEM_NO_SESSION,fatal:!1})})}},i.prototype._createLicenseXhr=function(e,t,r){var i=new ir,n=this._licenseXhrSetup;try{if(n)try{n(i,e)}catch(t){i.open("POST",e,!0),n(i,e)}i.readyState||i.open("POST",e,!0)}catch(t){return N.b.error("Error setting up key-system license XHR",t),void this.hls.trigger(F.a.ERROR,{type:f.b.KEY_SYSTEM_ERROR,details:f.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}return i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,e,t,r),i},i.prototype._onLicenseRequestReadyStageChange=function(t,e,r,i){switch(t.readyState){case 4:if(200===t.status)this._requestLicenseFailureCount=0,N.b.log("License request succeeded"),i(t.response);else{if(N.b.error("License Request XHR failed ("+e+"). Status: "+t.status+" ("+t.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount<=3){var n=3-this._requestLicenseFailureCount+1;return N.b.warn("Retrying license request, "+n+" attempts left"),void this._requestLicense(r,i)}this.hls.trigger(F.a.ERROR,{type:f.b.KEY_SYSTEM_ERROR,details:f.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}}},i.prototype._generateLicenseRequestChallenge=function(t,e){var r=void 0;return t.mediaKeySystemDomain===ar?N.b.error("PlayReady is not supported (yet)"):t.mediaKeySystemDomain===nr?r=e:N.b.error("Unsupported key-system:",t.mediaKeySystemDomain),r},i.prototype._requestLicense=function(t,e){N.b.log("Requesting content license for key-system");var r=this._mediaKeysList[0];if(!r)return N.b.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(F.a.ERROR,{type:f.b.KEY_SYSTEM_ERROR,details:f.a.KEY_SYSTEM_NO_ACCESS,fatal:!0});var i=this.getLicenseServerUrl(r.mediaKeySystemDomain),n=this._createLicenseXhr(i,t,e);N.b.log("Sending license request to URL: "+i),n.send(this._generateLicenseRequestChallenge(r,t))},i.prototype.onMediaAttached=function(t){var e=this;if(this._emeEnabled){var r=t.media;(this._media=r).addEventListener("encrypted",function(t){e._onMediaEncrypted(t.initDataType,t.initData)})}},i.prototype.onManifestParsed=function(t){if(this._emeEnabled){var e=t.levels.map(function(t){return t.audioCodec}),r=t.levels.map(function(t){return t.videoCodec});this._attemptKeySystemAccess(nr,e,r)}},rr(i,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),i}(u),sr={autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,liveDurationInfinity:!1,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:qt,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,abrController:Nt,bufferController:Bt,capLevelController:jt,fpsController:Ht,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,requestMediaKeySystemAccessFunc:"undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null};sr.subtitleStreamController=er,sr.subtitleTrackController=ze,sr.timelineController=We,sr.cueHandler=i,sr.enableCEA708Captions=!0,sr.enableWebVTT=!0,sr.captionsTextTrack1Label="English",sr.captionsTextTrack1LanguageCode="en",sr.captionsTextTrack2Label="Spanish",sr.captionsTextTrack2LanguageCode="es",sr.audioStreamController=fe,sr.audioTrackController=Xt,sr.emeController=or;var ur=function(){function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),t}}();r(14);var lr=function(){function T(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,T);var r=T.DefaultConfig;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");for(var i in r)i in t||(t[i]=r[i]);if(void 0!==t.liveMaxLatencyDurationCount&&t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(t.liveMaxLatencyDuration<=t.liveSyncDuration||void 0===t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(N.a)(t.debug),this.config=t,this._autoLevelCapping=-1;var n=this.observer=new q.a;n.trigger=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];n.emit.apply(n,[t,t].concat(r))},n.off=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];n.removeListener.apply(n,[t].concat(r))},this.on=n.on.bind(n),this.off=n.off.bind(n),this.once=n.once.bind(n),this.trigger=n.trigger.bind(n);var a=this.abrController=new t.abrController(this),o=new t.bufferController(this),s=new t.capLevelController(this),u=new t.fpsController(this),l=new A(this),c=new R(this),d=new U(this),f=new It(this),h=this.levelController=new Lt(this),p=new H(this),v=[h,this.streamController=new _t(this,p)],g=t.audioStreamController;g&&v.push(new g(this,p)),this.networkControllers=v;var y=[l,c,d,a,o,s,u,f,p];if(g=t.audioTrackController){var m=new g(this);this.audioTrackController=m,y.push(m)}if(g=t.subtitleTrackController){var b=new g(this);this.subtitleTrackController=b,y.push(b)}if(g=t.emeController){var E=new g(this);this.emeController=E,y.push(E)}[t.subtitleStreamController,t.timelineController].forEach(function(t){t&&y.push(new t(e))}),this.coreComponents=y}return T.isSupported=function(){return t=$(),e=window.SourceBuffer||window.WebKitSourceBuffer,r=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove,!!r&&!!i;var t,e,r,i},ur(T,null,[{key:"version",get:function(){return"0.11.0"}},{key:"Events",get:function(){return F.a}},{key:"ErrorTypes",get:function(){return f.b}},{key:"ErrorDetails",get:function(){return f.a}},{key:"DefaultConfig",get:function(){return T.defaultConfig?T.defaultConfig:sr},set:function(t){T.defaultConfig=t}}]),T.prototype.destroy=function(){N.b.log("destroy"),this.trigger(F.a.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach(function(t){t.destroy()}),this.url=null,this.observer.removeAllListeners(),this._autoLevelCapping=-1},T.prototype.attachMedia=function(t){N.b.log("attachMedia"),this.media=t,this.trigger(F.a.MEDIA_ATTACHING,{media:t})},T.prototype.detachMedia=function(){N.b.log("detachMedia"),this.trigger(F.a.MEDIA_DETACHING),this.media=null},T.prototype.loadSource=function(t){t=a.a.buildAbsoluteURL(window.location.href,t,{alwaysNormalize:!0}),N.b.log("loadSource:"+t),this.url=t,this.trigger(F.a.MANIFEST_LOADING,{url:t})},T.prototype.startLoad=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:-1;N.b.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},T.prototype.stopLoad=function(){N.b.log("stopLoad"),this.networkControllers.forEach(function(t){t.stopLoad()})},T.prototype.swapAudioCodec=function(){N.b.log("swapAudioCodec"),this.streamController.swapAudioCodec()},T.prototype.recoverMediaError=function(){N.b.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)},ur(T,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){N.b.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){N.b.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){N.b.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){N.b.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){N.b.log("set startLevel:"+t);-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){N.b.log("set autoLevelCapping:"+t),this._autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var t=this.levels,e=this.config.minAutoBitrate,r=t?t.length:0,i=0;i<r;i++){if(e<(t[i].realBitrate?Math.max(t[i].realBitrate,t[i].bitrate):t[i].bitrate))return i}return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,e=this.autoLevelCapping;return-1===e&&t&&t.length?t.length-1:e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}}]),T}();e.default=lr},function(t,e,l){function u(r){var i={};function n(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,n),e.l=!0,e.exports}n.m=r,n.c=i,n.i=function(t){return t},n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n.oe=function(t){throw console.error(t),t};var t=n(n.s=ENTRY_MODULE);return t.default||t}var c="[\\.|\\-|\\+|\\w|/|@]+",d="\\((/\\*.*?\\*/)?s?.*?("+c+").*?\\)";function f(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function h(t,e,r){var i={};i[r]=[];var n=e.toString(),a=n.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return i;for(var o,s=a[1],u=new RegExp("(\\\\n|\\W)"+f(s)+d,"g");o=u.exec(n);)"dll-reference"!==o[3]&&i[r].push(o[3]);for(u=new RegExp("\\("+f(s)+'\\("(dll-reference\\s('+c+'))"\\)\\)'+d,"g");o=u.exec(n);)t[o[2]]||(i[r].push(o[1]),t[o[2]]=l(o[1]).m),i[o[2]]=i[o[2]]||[],i[o[2]].push(o[4]);return i}function p(r){return Object.keys(r).reduce(function(t,e){return t||0<r[e].length},!1)}t.exports=function(t,e){e=e||{};var r={main:l.m},i=e.all?{main:Object.keys(r)}:function(t,e){for(var r={main:[e]},i={main:[]},n={main:{}};p(r);)for(var a=Object.keys(r),o=0;o<a.length;o++){var s=a[o],u=r[s].pop();if(n[s]=n[s]||{},!n[s][u]&&t[s][u]){n[s][u]=!0,i[s]=i[s]||[],i[s].push(u);for(var l=h(t,t[s][u],s),c=Object.keys(l),d=0;d<c.length;d++)r[c[d]]=r[c[d]]||[],r[c[d]]=r[c[d]].concat(l[c[d]])}}return i}(r,t),n="";Object.keys(i).filter(function(t){return"main"!==t}).forEach(function(e){for(var t=0;i[e][t];)t++;i[e].push(t),r[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",n=n+"var "+e+" = ("+u.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+i[e].map(function(t){return JSON.stringify(t)+": "+r[e][t].toString()}).join(",")+"});\n"}),n=n+"("+u.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+i.main.map(function(t){return JSON.stringify(t)+": "+r.main[t].toString()}).join(",")+"})(self);";var a=new window.Blob([n],{type:"text/javascript"});if(e.bare)return a;var o=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(a),s=new window.Worker(o);return s.objectURL=o,s}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});var o=r(10),s=r(1),u=r(0),i=r(7),l=r.n(i);e.default=function(n){var a=new l.a;a.trigger=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];a.emit.apply(a,[t,t].concat(r))},a.off=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];a.removeListener.apply(a,[t].concat(r))};var i=function(t,e){n.postMessage({event:t,data:e})};n.addEventListener("message",function(t){var e=t.data;switch(e.cmd){case"init":var r=JSON.parse(e.config);n.demuxer=new o.a(a,e.typeSupported,r,e.vendor);try{Object(u.a)(!0===r.debug)}catch(t){console.warn("demuxerWorker: unable to enable logs")}i("init",null);break;case"demux":n.demuxer.push(e.data,e.decryptdata,e.initSegment,e.audioCodec,e.videoCodec,e.timeOffset,e.discontinuity,e.trackSwitch,e.contiguous,e.duration,e.accurateTimeOffset,e.defaultInitPTS)}}),a.on(s.a.FRAG_DECRYPTED,i),a.on(s.a.FRAG_PARSING_INIT_SEGMENT,i),a.on(s.a.FRAG_PARSED,i),a.on(s.a.ERROR,i),a.on(s.a.FRAG_PARSING_METADATA,i),a.on(s.a.FRAG_PARSING_USERDATA,i),a.on(s.a.INIT_PTS_FOUND,i),a.on(s.a.FRAG_PARSING_DATA,function(t,e){var r=[],i={event:t,data:e};e.data1&&(i.data1=e.data1.buffer,r.push(e.data1.buffer),delete e.data1),e.data2&&(i.data2=e.data2.buffer,r.push(e.data2.buffer),delete e.data2),n.postMessage(i,r)})}},function(t,e){var r,l,i;String.prototype.endsWith||(r=function(){try{var t={},e=Object.defineProperty,r=e(t,t,t)&&e}catch(t){}return r}(),l={}.toString,i=function(t){if(null==this)throw TypeError();var e=String(this);if(t&&"[object RegExp]"==l.call(t))throw TypeError();var r=e.length,i=String(t),n=i.length,a=r;if(1<arguments.length){var o=arguments[1];void 0!==o&&(a=o?Number(o):0)!=a&&(a=0)}var s=Math.min(Math.max(a,0),r)-n;if(s<0)return!1;for(var u=-1;++u<n;)if(e.charCodeAt(s+u)!=i.charCodeAt(u))return!1;return!0},r?r(String.prototype,"endsWith",{value:i,configurable:!0,writable:!0}):String.prototype.endsWith=i)}]).default},t.exports=r())}));x("keys",function(){return function(t){return nt(bt(t))}});var Qe=y.Object.keys;e(r(function(t){t.exports={default:Qe,__esModule:!0}}));var $e=Math.floor;I(I.S,"Number",{isInteger:function(t){return!S(t)&&isFinite(t)&&$e(t)===t}});var Je=y.Number.isInteger;e(r(function(t){t.exports={default:Je,__esModule:!0}}));var Ze="\t\n\v\f\r \u2028\u2029\ufeff",tr="["+Ze+"]",er=RegExp("^"+tr+tr+"*"),rr=RegExp(tr+tr+"*$"),ir=function(t,e,r){var i={},n=_(function(){return!!Ze[t]()||"
"!="
"[t]()}),a=i[t]=n?e(nr):Ze[t];r&&(i[r]=a),I(I.P+I.F*n,"String",i)},nr=ir.trim=function(t,e){return t=String(s(t)),1&e&&(t=t.replace(er,"")),2&e&&(t=t.replace(rr,"")),t},ar=ir,or=R.parseFloat,sr=ar.trim,ur=1/or(Ze+"-0")!=-1/0?function(t){var e=sr(String(t),3),r=or(e);return 0===r&&"-"==e.charAt(0)?-0:r}:or;I(I.S+I.F*(Number.parseFloat!=ur),"Number",{parseFloat:ur});var lr=y.Number.parseFloat;function cr(t){return null==t}function dr(t){return Array.isArray(t)}function fr(t){return"function"==typeof t}function hr(t){return Object(t)===t&&"[object Object]"===String(t)&&!fr(t)&&!dr(t)}function pr(t){return"string"==typeof t||t instanceof String}function vr(t){return"boolean"==typeof t}function gr(t){return cr(t)||vr(t)||pr(t)||"number"==typeof t}function yr(t,e){if(!pr(t))throw new TypeError("Log's method only acccept string as argument, but not "+t+" in "+(void 0===t?"undefined":De(t)));return pr(e)?"["+(t=mr.FORCE_GLOBAL_TAG?mr.GLOBAL_TAG:t||mr.GLOBAL_TAG)+"] > "+e:"["+mr.GLOBAL_TAG+"] > "+t}e(r(function(t){t.exports={default:lr,__esModule:!0}}));var mr=function(){function r(){xe(this,r)}return Be(r,null,[{key:"error",value:function(t,e){r.ENABLE_ERROR&&(console.error||console.warn||console.log).call(console,yr(t,e))}},{key:"info",value:function(t,e){r.ENABLE_INFO&&(console.info||console.log).call(console,yr(t,e))}},{key:"warn",value:function(t,e){r.ENABLE_WARN&&(console.warn||console.log).call(console,yr(t,e))}},{key:"debug",value:function(t,e){r.ENABLE_DEBUG&&(console.debug||console.log).call(console,yr(t,e))}},{key:"verbose",value:function(t,e){r.ENABLE_VERBOSE&&console.log(yr(t,e))}}]),r}();mr.GLOBAL_TAG="chimee",mr.FORCE_GLOBAL_TAG=!1,mr.ENABLE_ERROR=!0,mr.ENABLE_INFO=!0,mr.ENABLE_WARN=!0,mr.ENABLE_DEBUG=!0,mr.ENABLE_VERBOSE=!0;r(function(E,T){!function(n,d){var t="model",e="name",r="type",i="vendor",a="version",o="architecture",s="console",u="mobile",l="tablet",c="smarttv",f="wearable",h={extend:function(t,e){var r={};for(var i in t)e[i]&&e[i].length%2==0?r[i]=e[i].concat(t[i]):r[i]=t[i];return r},has:function(t,e){return"string"==typeof t&&-1!==e.toLowerCase().indexOf(t.toLowerCase())},lowerize:function(t){return t.toLowerCase()},major:function(t){return"string"==typeof t?t.replace(/[^\d\.]/g,"").split(".")[0]:d},trim:function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},p={rgx:function(t,e){for(var r,i,n,a,o,s,u=0;u<e.length&&!o;){var l=e[u],c=e[u+1];for(r=i=0;r<l.length&&!o;)if(o=l[r++].exec(t))for(n=0;n<c.length;n++)s=o[++i],"object"==typeof(a=c[n])&&0<a.length?2==a.length?"function"==typeof a[1]?this[a[0]]=a[1].call(this,s):this[a[0]]=a[1]:3==a.length?"function"!=typeof a[1]||a[1].exec&&a[1].test?this[a[0]]=s?s.replace(a[1],a[2]):d:this[a[0]]=s?a[1].call(this,s,a[2]):d:4==a.length&&(this[a[0]]=s?a[3].call(this,s.replace(a[1],a[2])):d):this[a]=s||d;u+=2}},str:function(t,e){for(var r in e)if("object"==typeof e[r]&&0<e[r].length){for(var i=0;i<e[r].length;i++)if(h.has(e[r][i],t))return"?"===r?d:r}else if(h.has(e[r],t))return"?"===r?d:r;return t}},v={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},g={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[e,a],[/(opios)[\/\s]+([\w\.]+)/i],[[e,"Opera Mini"],a],[/\s(opr)\/([\w\.]+)/i],[[e,"Opera"],a],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]*)/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i],[e,a],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[e,"IE"],a],[/(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i],[[e,"Edge"],a],[/(yabrowser)\/([\w\.]+)/i],[[e,"Yandex"],a],[/(puffin)\/([\w\.]+)/i],[[e,"Puffin"],a],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[e,"UCBrowser"],a],[/(comodo_dragon)\/([\w\.]+)/i],[[e,/_/g," "],a],[/(micromessenger)\/([\w\.]+)/i],[[e,"WeChat"],a],[/(qqbrowserlite)\/([\w\.]+)/i],[e,a],[/(QQ)\/([\d\.]+)/i],[e,a],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[e,a],[/(BIDUBrowser)[\/\s]?([\w\.]+)/i],[e,a],[/(2345Explorer)[\/\s]?([\w\.]+)/i],[e,a],[/(MetaSr)[\/\s]?([\w\.]+)/i],[e],[/(LBBROWSER)/i],[e],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[a,[e,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[a,[e,"Facebook"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[a,[e,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[e,/(.+)/,"$1 WebView"],a],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[e,/(.+(?:g|us))(.+)/,"$1 $2"],a],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[a,[e,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[e,a],[/(dolfin)\/([\w\.]+)/i],[[e,"Dolphin"],a],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[e,"Chrome"],a],[/(coast)\/([\w\.]+)/i],[[e,"Opera Coast"],a],[/fxios\/([\w\.-]+)/i],[a,[e,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[a,[e,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[a,e],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[e,"GSA"],a],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[e,[a,p.str,v.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[e,a],[/(navigator|netscape)\/([\w\.-]+)/i],[[e,"Netscape"],a],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[e,a]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[o,"amd64"]],[/(ia32(?=;))/i],[[o,h.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[o,"ia32"]],[/windows\s(ce|mobile);\sppc;/i],[[o,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[o,/ower/,"",h.lowerize]],[/(sun4\w)[;\)]/i],[[o,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[o,h.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[t,i,[r,l]],[/applecoremedia\/[\w\.]+ \((ipad)/],[t,[i,"Apple"],[r,l]],[/(apple\s{0,1}tv)/i],[[t,"Apple TV"],[i,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[i,t,[r,l]],[/(kf[A-z]+)\sbuild\/.+silk\//i],[t,[i,"Amazon"],[r,l]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],[[t,p.str,v.device.amazon.model],[i,"Amazon"],[r,u]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[t,i,[r,u]],[/\((ip[honed|\s\w*]+);/i],[t,[i,"Apple"],[r,u]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[i,t,[r,u]],[/\(bb10;\s(\w+)/i],[t,[i,"BlackBerry"],[r,u]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i],[t,[i,"Asus"],[r,l]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[i,"Sony"],[t,"Xperia Tablet"],[r,l]],[/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i],[t,[i,"Sony"],[r,u]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[i,t,[r,s]],[/android.+;\s(shield)\sbuild/i],[t,[i,"Nvidia"],[r,s]],[/(playstation\s[34portablevi]+)/i],[t,[i,"Sony"],[r,s]],[/(sprint\s(\w+))/i],[[i,p.str,v.device.sprint.vendor],[t,p.str,v.device.sprint.model],[r,u]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[i,t,[r,l]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[i,[t,/_/g," "],[r,u]],[/(nexus\s9)/i],[t,[i,"HTC"],[r,l]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[t,[i,"Huawei"],[r,u]],[/(microsoft);\s(lumia[\s\w]+)/i],[i,t,[r,u]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[t,[i,"Microsoft"],[r,s]],[/(kin\.[onetw]{3})/i],[[t,/\./g," "],[i,"Microsoft"],[r,u]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w*)/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[t,[i,"Motorola"],[r,u]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[t,[i,"Motorola"],[r,l]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[i,h.trim],[t,h.trim],[r,c]],[/hbbtv.+maple;(\d+)/i],[[t,/^/,"SmartTV"],[i,"Samsung"],[r,c]],[/\(dtv[\);].+(aquos)/i],[t,[i,"Sharp"],[r,c]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[i,"Samsung"],t,[r,l]],[/smart-tv.+(samsung)/i],[i,[r,c],t],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[[i,"Samsung"],t,[r,u]],[/sie-(\w*)/i],[t,[i,"Siemens"],[r,u]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]*)/i],[[i,"Nokia"],t,[r,u]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[t,[i,"Acer"],[r,l]],[/android.+([vl]k\-?\d{3})\s+build/i],[t,[i,"LG"],[r,l]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[i,"LG"],t,[r,l]],[/(lg) netcast\.tv/i],[i,t,[r,c]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],[t,[i,"LG"],[r,u]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[t,[i,"Lenovo"],[r,l]],[/linux;.+((jolla));/i],[i,t,[r,u]],[/((pebble))app\/[\d\.]+\s/i],[i,t,[r,f]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[i,t,[r,u]],[/crkey/i],[[t,"Chromecast"],[i,"Google"]],[/android.+;\s(glass)\s\d/i],[t,[i,"Google"],[r,f]],[/android.+;\s(pixel c)\s/i],[t,[i,"Google"],[r,l]],[/android.+;\s(pixel xl|pixel)\s/i],[t,[i,"Google"],[r,u]],[/android.+;\s(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[[t,/_/g," "],[i,"Xiaomi"],[r,u]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],[[t,/_/g," "],[i,"Xiaomi"],[r,l]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[t,[i,"Meizu"],[r,l]],[/android.+a000(1)\s+build/i,/android.+oneplus\s(a\d{4})\s+build/i],[t,[i,"OnePlus"],[r,u]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[t,[i,"RCA"],[r,l]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],[t,[i,"Dell"],[r,l]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[t,[i,"Verizon"],[r,l]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[i,"Barnes & Noble"],t,[r,l]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[t,[i,"NuVision"],[r,l]],[/android.+;\s(k88)\sbuild/i],[t,[i,"ZTE"],[r,l]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[t,[i,"Swiss"],[r,u]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[t,[i,"Swiss"],[r,l]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[t,[i,"Zeki"],[r,l]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[[i,"Dragon Touch"],t,[r,l]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],[t,[i,"Insignia"],[r,l]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],[t,[i,"NextBook"],[r,l]],[/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[i,"Voice"],t,[r,u]],[/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[[i,"LvTel"],t,[r,u]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[t,[i,"Envizen"],[r,l]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],[i,t,[r,l]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[t,[i,"MachSpeed"],[r,l]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[i,t,[r,l]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[t,[i,"Rotor"],[r,l]],[/android.+(KS(.+))\s+build/i],[t,[i,"Amazon"],[r,l]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],[i,t,[r,l]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[r,h.lowerize],i,t],[/(android[\w\.\s\-]{0,9});.+build/i],[t,[i,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[a,[e,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[e,a],[/rv\:([\w\.]{1,9}).+(gecko)/i],[a,e]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[e,a],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[e,[a,p.str,v.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[e,"Windows"],[a,p.str,v.os.windows.version]],[/\((bb)(10);/i],[[e,"BlackBerry"],a],[/(blackberry)\w*\/?([\w\.]*)/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]*)/i,/linux;.+(sailfish);/i],[e,a],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],[[e,"Symbian"],a],[/\((series40);/i],[e],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[e,"Firefox OS"],a],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i],[e,a],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[e,"Chromium OS"],a],[/(sunos)\s?([\w\.\d]*)/i],[[e,"Solaris"],a],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],[e,a],[/(haiku)\s(\w+)/i],[e,a],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[a,/_/g,"."],[e,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[[e,"Mac OS"],[a,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]*)/i],[e,a]]},y=function(t,e){if("object"==typeof t&&(e=t,t=d),!(this instanceof y))return new y(t,e).getResult();var r=t||(n&&n.navigator&&n.navigator.userAgent?n.navigator.userAgent:""),i=e?h.extend(g,e):g;return this.getBrowser=function(){var t={name:d,version:d};return p.rgx.call(t,r,i.browser),t.major=h.major(t.version),t},this.getCPU=function(){var t={architecture:d};return p.rgx.call(t,r,i.cpu),t},this.getDevice=function(){var t={vendor:d,model:d,type:d};return p.rgx.call(t,r,i.device),t},this.getEngine=function(){var t={name:d,version:d};return p.rgx.call(t,r,i.engine),t},this.getOS=function(){var t={name:d,version:d};return p.rgx.call(t,r,i.os),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(t){return r=t,this},this};y.VERSION="0.7.18",y.BROWSER={NAME:e,MAJOR:"major",VERSION:a},y.CPU={ARCHITECTURE:o},y.DEVICE={MODEL:t,VENDOR:i,TYPE:r,CONSOLE:s,MOBILE:u,SMARTTV:c,TABLET:l,WEARABLE:f,EMBEDDED:"embedded"},y.ENGINE={NAME:e,VERSION:a},y.OS={NAME:e,VERSION:a},E.exports&&(T=E.exports=y),T.UAParser=y;var m=n&&(n.jQuery||n.Zepto);if(void 0!==m){var b=new y;m.ua=b.getResult(),m.ua.get=function(){return b.getUA()},m.ua.set=function(t){b.setUA(t);var e=b.getResult();for(var r in e)m.ua[r]=e[r]}}}("object"==typeof window?window:t)}).UAParser;var br=function(e,t,r,i){try{return i?t(T(r)[0],r[1]):t(r)}catch(t){var n=e.return;throw void 0!==n&&T(n.call(e)),t}},Er=ht("iterator"),Tr=Array.prototype,wr=function(t){return void 0!==t&&(H.Array===t||Tr[Er]===t)},Sr=function(t,e,r){e in t?L.f(t,e,w(0,r)):t[e]=r},_r=ht("toStringTag"),Ar="Arguments"==n(function(){return arguments}()),Rr=function(t){var e,r,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),_r))?r:Ar?n(e):"Object"==(i=n(e))&&"function"==typeof e.callee?"Arguments":i},kr=ht("iterator"),Lr=y.getIteratorMethod=function(t){if(null!=t)return t[kr]||t["@@iterator"]||H[Rr(t)]},Or=ht("iterator"),Dr=!1;try{[7][Or]().return=function(){Dr=!0}}catch(t){}var Cr=function(t,e){if(!e&&!Dr)return!1;var r=!1;try{var i=[7],n=i[Or]();n.next=function(){return{done:r=!0}},i[Or]=function(){return n},t(i)}catch(t){}return r};I(I.S+I.F*!Cr(function(t){}),"Array",{from:function(t){var e,r,i,n,a=bt(t),o="function"==typeof this?this:Array,s=arguments.length,u=1<s?arguments[1]:void 0,l=void 0!==u,c=0,d=Lr(a);if(l&&(u=E(u,2<s?arguments[2]:void 0,2)),null==d||o==Array&&wr(d))for(r=new o(e=W(a.length));c<e;c++)Sr(r,c,l?u(a[c],c):a[c]);else for(n=d.call(a),r=new o;!(i=n.next()).done;c++)Sr(r,c,l?br(n,u,[i.value,c],!0):i.value);return r.length=c,r}});var Ir=y.Array.from,xr=r(function(t){t.exports={default:Ir,__esModule:!0}}),Pr=e(xr),Mr=e(r(function(t,e){e.__esModule=!0;var r,i=(r=xr)&&r.__esModule?r:{default:r};e.default=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return(0,i.default)(t)}}));var Fr=function(a){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:function(t,e,r){t[e]=r};return function t(e,r,i){if(dr(e)||hr(e)){for(var n in r=gr(r)?hr(e)?{}:[]:r,e)o(r,n,t(e[n],r[n],n));return r}return a(e,r,i)}}(function(t){return t});var Nr,Ur,Br,Gr=function(t,e,r,i){if(!(t instanceof e)||void 0!==i&&i in t)throw TypeError(r+": incorrect invocation!");return t},jr=r(function(t){var f={},h={},e=t.exports=function(t,e,r,i,n){var a,o,s,u,l=n?function(){return t}:Lr(t),c=E(r,i,e?2:1),d=0;if("function"!=typeof l)throw TypeError(t+" is not iterable!");if(wr(l)){for(a=W(t.length);d<a;d++)if((u=e?c(T(o=t[d])[0],o[1]):c(t[d]))===f||u===h)return u}else for(s=l.call(t);!(o=s.next()).done;)if((u=br(s,c,o.value,e))===f||u===h)return u};e.BREAK=f,e.RETURN=h}),Kr=ht("species"),Hr=function(t,e){var r,i=T(t).constructor;return void 0===i||null==(r=T(i)[Kr])?e:m(r)},Vr=R.process,Wr=R.setImmediate,Yr=R.clearImmediate,qr=R.MessageChannel,zr=R.Dispatch,Xr=0,Qr={},$r="onreadystatechange",Jr=function(){var t=+this;if(Qr.hasOwnProperty(t)){var e=Qr[t];delete Qr[t],e()}},Zr=function(t){Jr.call(t.data)};Wr&&Yr||(Wr=function(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return Qr[++Xr]=function(){!function(t,e,r){var i=void 0===r;switch(e.length){case 0:return i?t():t.call(r);case 1:return i?t(e[0]):t.call(r,e[0]);case 2:return i?t(e[0],e[1]):t.call(r,e[0],e[1]);case 3:return i?t(e[0],e[1],e[2]):t.call(r,e[0],e[1],e[2]);case 4:return i?t(e[0],e[1],e[2],e[3]):t.call(r,e[0],e[1],e[2],e[3])}t.apply(r,e)}("function"==typeof t?t:Function(t),e)},Nr(Xr),Xr},Yr=function(t){delete Qr[t]},"process"==n(Vr)?Nr=function(t){Vr.nextTick(E(Jr,t,1))}:zr&&zr.now?Nr=function(t){zr.now(E(Jr,t,1))}:qr?(Br=(Ur=new qr).port2,Ur.port1.onmessage=Zr,Nr=E(Br.postMessage,Br,1)):R.addEventListener&&"function"==typeof postMessage&&!R.importScripts?(Nr=function(t){R.postMessage(t+"","*")},R.addEventListener("message",Zr,!1)):Nr=$r in d("script")?function(t){st.appendChild(d("script"))[$r]=function(){st.removeChild(this),Jr.call(t)}}:function(t){setTimeout(E(Jr,t,1),0)});var ti={set:Wr,clear:Yr},ei=ti.set,ri=R.MutationObserver||R.WebKitMutationObserver,ii=R.process,ni=R.Promise,ai="process"==n(ii);function oi(t){var r,i;this.promise=new t(function(t,e){if(void 0!==r||void 0!==i)throw TypeError("Bad Promise constructor");r=t,i=e}),this.resolve=m(r),this.reject=m(i)}var si,ui,li,ci,di,fi,hi={f:function(t){return new oi(t)}},pi=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}},vi=R.navigator,gi=vi&&vi.userAgent||"",yi=function(t,e){if(T(t),S(e)&&e.constructor===t)return e;var r=hi.f(t);return(0,r.resolve)(e),r.promise},mi=function(t,e,r){for(var i in e)r&&t[i]?t[i]=e[i]:O(t,i,e[i]);return t},bi=ht("species"),Ei=ti.set,Ti=function(){var r,i,n,t=function(){var t,e;for(ai&&(t=ii.domain)&&t.exit();r;){e=r.fn,r=r.next;try{e()}catch(t){throw r?n():i=void 0,t}}i=void 0,t&&t.enter()};if(ai)n=function(){ii.nextTick(t)};else if(!ri||R.navigator&&R.navigator.standalone)if(ni&&ni.resolve){var e=ni.resolve(void 0);n=function(){e.then(t)}}else n=function(){ei.call(R,t)};else{var a=!0,o=document.createTextNode("");new ri(t).observe(o,{characterData:!0}),n=function(){o.data=a=!a}}return function(t){var e={fn:t,next:void 0};i&&(i.next=e),r||(r=e,n()),i=e}}(),wi="Promise",Si=R.TypeError,_i=R.process,Ai=_i&&_i.versions,Ri=Ai&&Ai.v8||"",ki=R[wi],Li="process"==Rr(_i),Oi=function(){},Di=ui=hi.f,Ci=!!function(){try{var t=ki.resolve(1),e=(t.constructor={})[ht("species")]=function(t){t(Oi,Oi)};return(Li||"function"==typeof PromiseRejectionEvent)&&t.then(Oi)instanceof e&&0!==Ri.indexOf("6.6")&&-1===gi.indexOf("Chrome/66")}catch(t){}}(),Ii=function(t){var e;return!(!S(t)||"function"!=typeof(e=t.then))&&e},xi=function(c,r){if(!c._n){c._n=!0;var i=c._c;Ti(function(){for(var u=c._v,l=1==c._s,t=0,e=function(t){var e,r,i,n=l?t.ok:t.fail,a=t.resolve,o=t.reject,s=t.domain;try{n?(l||(2==c._h&&Fi(c),c._h=1),!0===n?e=u:(s&&s.enter(),e=n(u),s&&(s.exit(),i=!0)),e===t.promise?o(Si("Promise-chain cycle")):(r=Ii(e))?r.call(e,a,o):a(e)):o(u)}catch(t){s&&!i&&s.exit(),o(t)}};i.length>t;)e(i[t++]);c._c=[],c._n=!1,r&&!c._h&&Pi(c)})}},Pi=function(a){Ei.call(R,function(){var t,e,r,i=a._v,n=Mi(a);if(n&&(t=pi(function(){Li?_i.emit("unhandledRejection",i,a):(e=R.onunhandledrejection)?e({promise:a,reason:i}):(r=R.console)&&r.error&&r.error("Unhandled promise rejection",i)}),a._h=Li||Mi(a)?2:1),a._a=void 0,n&&t.e)throw t.v})},Mi=function(t){return 1!==t._h&&0===(t._a||t._c).length},Fi=function(e){Ei.call(R,function(){var t;Li?_i.emit("rejectionHandled",e):(t=R.onrejectionhandled)&&t({promise:e,reason:e._v})})},Ni=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),xi(e,!0))},Ui=function(t){var r,i=this;if(!i._d){i._d=!0,i=i._w||i;try{if(i===t)throw Si("Promise can't be resolved itself");(r=Ii(t))?Ti(function(){var e={_w:i,_d:!1};try{r.call(t,E(Ui,e,1),E(Ni,e,1))}catch(t){Ni.call(e,t)}}):(i._v=t,i._s=1,xi(i,!1))}catch(t){Ni.call({_w:i,_d:!1},t)}}};Ci||(ki=function(t){Gr(this,ki,wi,"_h"),m(t),si.call(this);try{t(E(Ui,this,1),E(Ni,this,1))}catch(t){Ni.call(this,t)}},(si=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=mi(ki.prototype,{then:function(t,e){var r=Di(Hr(this,ki));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=Li?_i.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&xi(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),li=function(){var t=new si;this.promise=t,this.resolve=E(Ui,t,1),this.reject=E(Ni,t,1)},hi.f=Di=function(t){return t===ki||t===ci?new li(t):ui(t)}),I(I.G+I.W+I.F*!Ci,{Promise:ki}),gt(ki,wi),fi="function"==typeof y[di=wi]?y[di]:R[di],A&&fi&&!fi[bi]&&L.f(fi,bi,{configurable:!0,get:function(){return this}}),ci=y[wi],I(I.S+I.F*!Ci,wi,{reject:function(t){var e=Di(this);return(0,e.reject)(t),e.promise}}),I(I.S+!0*I.F,wi,{resolve:function(t){return yi(this===ci?ki:this,t)}}),I(I.S+I.F*!(Ci&&Cr(function(t){ki.all(t).catch(Oi)})),wi,{all:function(t){var o=this,e=Di(o),s=e.resolve,u=e.reject,r=pi(function(){var i=[],n=0,a=1;jr(t,!1,function(t){var e=n++,r=!1;i.push(void 0),a++,o.resolve(t).then(function(t){r||(r=!0,i[e]=t,--a||s(i))},u)}),--a||s(i)});return r.e&&u(r.v),e.promise},race:function(t){var e=this,r=Di(e),i=r.reject,n=pi(function(){jr(t,!1,function(t){e.resolve(t).then(r.resolve,i)})});return n.e&&i(n.v),r.promise}}),I(I.P+I.R,"Promise",{finally:function(e){var r=Hr(this,y.Promise||R.Promise),t="function"==typeof e;return this.then(t?function(t){return yi(r,e()).then(function(){return t})}:e,t?function(t){return yi(r,e()).then(function(){throw t})}:e)}}),I(I.S,"Promise",{try:function(t){var e=hi.f(this),r=pi(t);return(r.e?e.reject:e.resolve)(r.v),e.promise}});var Bi=y.Promise;e(r(function(t){t.exports={default:Bi,__esModule:!0}}));var Gi="undefined"!=typeof window&&"[object Object]"!==Object.prototype.toString.call(window);Gi&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),Gi&&(window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.oCancelAnimationFrame);var ji=Object.assign,Ki=!ji||_(function(){var t={},e={},r=Symbol(),i="abcdefghijklmnopqrst";return t[r]=7,i.split("").forEach(function(t){e[t]=t}),7!=ji({},t)[r]||Object.keys(ji({},e)).join("")!=i})?function(t,e){for(var r=bt(t),i=arguments.length,n=1,a=Kt.f,o=f.f;n<i;)for(var s,u=b(arguments[n++]),l=a?nt(u).concat(a(u)):nt(u),c=l.length,d=0;d<c;)o.call(u,s=l[d++])&&(r[s]=u[s]);return r}:ji;I(I.S+I.F,"Object",{assign:Ki});var Hi=y.Object.assign,Vi=e(r(function(t){t.exports={default:Hi,__esModule:!0}})),Wi=qe(null);function Yi(t,e){var r=t.__evt_id;r||(Object.defineProperty(t,"__evt_id",{writable:!0,enumerable:!1,configurable:!0}),r=t.__evt_id=++Wi.count);var i=r+"_"+e,n=Wi[i];return n||(n=Wi[i]=[]),n}function qi(i,n,a){var o=3<arguments.length&&void 0!==arguments[3]&&arguments[3],t=arguments[4];fr(o)&&!t&&(t=o,o=void 0);var e=[a,void 0,o];o&&!t&&(t=function(){zi(i,n,a,o);for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];a.apply(i,e)}),t&&(e[1]=t),Yi(i,n).push(e)}function zi(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]&&arguments[3],n=Yi(t,e);if(r||i){var a=-1,o=void 0;return n.find(function(t,e){if((!r||t[0]===r)&&(!i||t[2]))return a=e,o=t[1],!0}),-1!==a&&n.splice(a,1),o}n.length=0}Wi.count=0;var Xi=function(){function i(e,t){var r=this;if(xe(this,i),Object.defineProperty(this,"__target",{writable:!0,enumerable:!1,configurable:!0}),this.__target=this,e){if("object"!==(void 0===e?"undefined":De(e)))throw new Error("CusEvent target are not object");this.__target=e,t&&["on","once","off","emit"].forEach(function(t){e[t]=r[t]})}}return Be(i,[{key:"on",value:function(t,e){var r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return qi(this.__target,t,e,r),this}},{key:"once",value:function(t,e){return this.on(t,e,!0)}},{key:"off",value:function(t,e){var r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return zi(this.__target,t,e,r),this}},{key:"emit",value:function(t,e){var r,i,n,a;return r=this.__target,i=t,n={data:e},(a=qe(null)).type=i,a.target=r,n&&Vi(a,hr(n)?n:{data:n}),Yi(r,i).forEach(function(t){(t[1]||t[0]).apply(r,[a])}),this}}]),i}(),Qi=Gi?document.createElement("div"):{},$i="innerText";"textContent"in Qi&&($i="textContent");var Ji=Array.prototype;var Zi=!1;try{var tn=Object.defineProperty({},"passive",{get:function(){Zi=!0}});Gi&&window.addEventListener("test",null,tn)}catch(t){console.error(t)}function en(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]&&arguments[3],n=4<arguments.length&&void 0!==arguments[4]&&arguments[4];if(void 0!==n&&!vr(n)&&Zi&&(n={passive:!0}),i){var a=zi(t,e+"_once",r);a&&(r=a)}t.removeEventListener(e,r,n)}function rn(n,a,t,o){var e=4<arguments.length&&void 0!==arguments[4]&&arguments[4];void 0!==e&&!vr(e)&&Zi&&(e={passive:!0});var r=function(t){var r=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=arguments[2],i=arguments[3],n=[];r&&n.push(t);for(;t&&t.parentNode!==e;)(t=t.parentNode)&&n.push(t);i&&n.push(e);return n}(t.target||t.srcElement,n,!0),e=nn(a,n,!0),i=void 0;e.find?i=e.find(function(e){return r.find(function(t){return e===t})}):e.forEach(function(e){return!i&&r.forEach(function(t){i||e!==t||(i=t)})}),i&&o.apply(i,arguments)};qi(n,t+"_delegate_"+a,o,r),n.addEventListener(t,r,e)}function nn(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document,r=arguments[2],i=e.querySelectorAll(t);return r?Pr(i):i}var an=function(){function i(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document;xe(this,i);var r=void 0;(this.selector=t)&&t.constructor===NodeList?r=Pr(t):dr(t)?r=t:pr(t)?0===t.indexOf("<")?(Qi.innerHTML=t,r=nn("*",Qi,!0)):r=nn(t,e,!0):r=[t],Vi(this,r),this.length=r.length}return Be(i,[{key:"each",value:function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return Ji.forEach.apply(this,e),this}},{key:"push",value:function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return Ji.push.apply(this,e),this}},{key:"splice",value:function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return on(Ji.splice.apply(this,e))}},{key:"find",value:function(e){var r=[];this.each(function(t){r=r.concat(nn(e,t,!0))});var t=on(r);return t.parent=this,t.selector=e,t}},{key:"append",value:function(t){var e=on(t),r=this[0];return e.each(function(t){return r.appendChild(t)}),this}},{key:"appendTo",value:function(t){return on(t).append(this),this}},{key:"text",value:function(e){return 0===arguments.length?this[0][$i]:this.each(function(t){t[$i]=e})}},{key:"html",value:function(e){return 0===arguments.length?this[0].innerHTML:this.each(function(t){t.innerHTML=e})}},{key:"attr",value:function(n,a){return 1===arguments.length?(t=this[0],e=n,t.getAttribute(e)):this.each(function(t){return e=t,r=n,void(void 0===(i=a)?e.removeAttribute(r):e.setAttribute(r,i));var e,r,i});var t,e}},{key:"data",value:function(e,r){return 0===arguments.length?this[0].dataset||{}:1===arguments.length?(this[0].dataset||{})[e]:this.each(function(t){(t.dataset||(t.dataset={}))[e]=r})}},{key:"css",value:function(e,r){return 1!==arguments.length||hr(e)?this.each(function(t){return function t(e,r,i){if(hr(r))for(var n in r)t(e,n,r[n]);else e.style[r]=i}(t,e,r)}):(t=this[0],i=e,(t.currentStyle||document.defaultView.getComputedStyle(t,null))[i]||t.style[i]);var t,i}},{key:"addClass",value:function(e){return this.each(function(t){return function(e,t){if(t&&(t=t.trim())){var r=t.split(/\s+/);if(e.classList)r.forEach(function(t){return e.classList.add(t)});else{var i=" "+(e.className||"")+" ";r.forEach(function(t){-1===i.indexOf(" "+t+" ")&&(i+=" "+t)}),e.className=i.trim()}}}(t,e)})}},{key:"removeClass",value:function(e){return this.each(function(t){return function(e,t){if(t&&(t=t.trim())){var r=t.split(/\s+/);if(e.classList)r.forEach(function(t){return e.classList.remove(t)});else{var i=" "+e.className+" ";r.forEach(function(t){for(var e=" "+t+" ";-1!==i.indexOf(e);)i=i.replace(e," ")}),e.className=i.trim()}}}(t,e)})}},{key:"hasClass",value:function(t){return e=this[0],new RegExp("(?:^|\\s)"+t+"(?=\\s|$)").test(e.className);var e}},{key:"on",value:function(e,r){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=3<arguments.length&&void 0!==arguments[3]&&arguments[3];return this.each(function(t){return function(i,n,a){var o=3<arguments.length&&void 0!==arguments[3]&&arguments[3],s=4<arguments.length&&void 0!==arguments[4]&&arguments[4];if(void 0!==s&&!vr(s)&&Zi&&(s={passive:!0}),o){var u=a;qi(i,n+"_once",u,a=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];u.apply(this,e),en(i,n,a,o,s)})}i.addEventListener(n,a,s)}(t,e,r,i,n)})}},{key:"off",value:function(e,r){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=3<arguments.length&&void 0!==arguments[3]&&arguments[3];return this.each(function(t){return en(t,e,r,i,n)})}},{key:"delegate",value:function(e,r,i){var n=3<arguments.length&&void 0!==arguments[3]&&arguments[3];return this.each(function(t){return rn(t,e,r,i,n)})}},{key:"undelegate",value:function(e,r,i){var n=3<arguments.length&&void 0!==arguments[3]&&arguments[3];return this.each(function(t){return function(t,e,r,i){var n=4<arguments.length&&void 0!==arguments[4]&&arguments[4];void 0!==n&&!vr(n)&&Zi&&(n={passive:!0});var a=zi(t,r+"_delegate_"+e,i);a&&t.removeEventListener(r,a,n)}(t,e,r,i,n)})}},{key:"remove",value:function(){return this.each(function(t){var e;(e=t).parentNode.removeChild(e)})}}]),i}();function on(t,e){return t.constructor===an?t:new an(t,e)}var sn={debug:!1,enableWorker:!0},un=R.Reflect,ln=un&&un.ownKeys||function(t){var e=Wt.f(T(t)),r=Kt.f;return r?e.concat(r(t)):e};I(I.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,r,i=l(t),n=g.f,a=ln(i),o={},s=0;a.length>s;)void 0!==(r=n(i,e=a[s++]))&&Sr(o,e,r);return o}});var cn=y.Object.getOwnPropertyDescriptors,dn=e(r(function(t){t.exports={default:cn,__esModule:!0}})),fn=y.Object.getOwnPropertySymbols,hn=e(r(function(t){t.exports={default:fn,__esModule:!0}}));x("getOwnPropertyNames",function(){return Xt.f});var pn=y.Object,vn=function(t){return pn.getOwnPropertyNames(t)},gn=e(r(function(t){t.exports={default:vn,__esModule:!0}}));var yn=ht("iterator"),mn=y.isIterable=function(t){var e=Object(t);return void 0!==e[yn]||"@@iterator"in e||H.hasOwnProperty(Rr(e))},bn=r(function(t){t.exports={default:mn,__esModule:!0}});e(bn);var En=y.getIterator=function(t){var e=Lr(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return T(e.call(t))},Tn=r(function(t){t.exports={default:En,__esModule:!0}});e(Tn),e(r(function(t,e){e.__esModule=!0;var r=i(bn),u=i(Tn);function i(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if(Array.isArray(t))return t;if((0,r.default)(Object(t)))return function(t,e){var r=[],i=!0,n=!1,a=void 0;try{for(var o,s=(0,u.default)(t);!(i=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);i=!0);}catch(t){n=!0,a=t}finally{try{!i&&s.return&&s.return()}finally{if(n)throw a}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}));var wn=ht("species"),Sn=function(t,e){return Ht(r=t)&&("function"!=typeof(i=r.constructor)||i!==Array&&!Ht(i.prototype)||(i=void 0),S(i)&&null===(i=i[wn])&&(i=void 0)),new(void 0===i?Array:i)(e);var r,i},_n=function(d,t){var f=1==d,h=2==d,p=3==d,v=4==d,g=6==d,y=5==d||g,m=t||Sn;return function(t,e,r){for(var i,n,a=bt(t),o=b(a),s=E(e,r,3),u=W(o.length),l=0,c=f?m(t,u):h?m(t,0):void 0;l<u;l++)if((y||l in o)&&(n=s(i=o[l],l,a),d))if(f)c[l]=n;else if(n)switch(d){case 3:return!0;case 5:return i;case 6:return l;case 2:c.push(i)}else if(v)return!1;return g?-1:p||v?v:c}},An=function(t,e){if(!S(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t},Rn=Bt.getWeak,kn=_n(5),Ln=_n(6),On=0,Dn=function(t){return t._l||(t._l=new Cn)},Cn=function(){this.a=[]},In=function(t,e){return kn(t.a,function(t){return t[0]===e})};Cn.prototype={get:function(t){var e=In(this,t);if(e)return e[1]},has:function(t){return!!In(this,t)},set:function(t,e){var r=In(this,t);r?r[1]=e:this.a.push([t,e])},delete:function(e){var t=Ln(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}};var xn,Pn={getConstructor:function(t,r,i,n){var a=t(function(t,e){Gr(t,a,r,"_i"),t._t=r,t._i=On++,t._l=void 0,null!=e&&jr(e,i,t[n],t)});return mi(a.prototype,{delete:function(t){if(!S(t))return!1;var e=Rn(t);return!0===e?Dn(An(this,r)).delete(t):e&&v(e,this._i)&&delete e[this._i]},has:function(t){if(!S(t))return!1;var e=Rn(t);return!0===e?Dn(An(this,r)).has(t):e&&v(e,this._i)}}),a},def:function(t,e,r){var i=Rn(T(e),!0);return!0===i?Dn(t).set(e,r):i[t._i]=r,t},ufstore:Dn},Mn=L.f,Fn=_n(0);r(function(t){var a,r,e,i,n,o,s,u,l,c,d,f,h=_n(0),p="WeakMap",v=Bt.getWeak,g=Object.isExtensible,y=Pn.ufstore,m={},b=function(t){return function(){return t(this,0<arguments.length?arguments[0]:void 0)}},E={get:function(t){if(S(t)){var e=v(t);return!0===e?y(An(this,p)).get(t):e?e[this._i]:void 0}},set:function(t,e){return Pn.def(An(this,p),t,e)}},T=t.exports=(e=b,i=E,n=Pn,s=o=!0,u=R[r=p],c=o?"set":"add",d=(l=u)&&l.prototype,f={},A&&"function"==typeof l&&(s||d.forEach&&!_(function(){(new l).entries().next()}))?(l=e(function(t,e){Gr(t,l,r,"_c"),t._c=new u,null!=e&&jr(e,o,t[c],t)}),Fn("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(i){var n="add"==i||"set"==i;i in d&&(!s||"clear"!=i)&&O(l.prototype,i,function(t,e){if(Gr(this,l,i),!n&&s&&!S(t))return"get"==i&&void 0;var r=this._c[i](0===t?0:t,e);return n?this:r})}),s||Mn(l.prototype,"size",{get:function(){return this._c.size}})):(l=n.getConstructor(e,r,o,c),mi(l.prototype,i),Bt.NEED=!0),gt(l,r),f[r]=l,I(I.G+I.W+I.F,f),s||n.setStrong(l,r,o),l);_(function(){return 7!=(new T).set((Object.freeze||Object)(m),7).get(m)})&&(a=Pn.getConstructor(b,p),Ki(a.prototype,E),Bt.NEED=!0,h(["delete","has","get","set"],function(i){var t=T.prototype,n=t[i];K(t,i,function(t,e){if(S(t)&&!g(t)){this._f||(this._f=new a);var r=this._f[i](t,e);return"set"==i?this:r}return n.call(this,t,e)})}))});xn="WeakMap",I(I.S,xn,{of:function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)}});var Nn;Nn="WeakMap",I(I.S,Nn,{from:function(t){var e,r,i,n,a=arguments[1];return m(this),(e=void 0!==a)&&m(a),null==t?new this:(r=[],e?(i=0,n=E(a,arguments[2],2),jr(t,!1,function(t){r.push(n(t,i++))})):jr(t,!1,r.push,r),new this(r))}});var Un=y.WeakMap,Bn=e(r(function(t){t.exports={default:Un,__esModule:!0}}));e(r(function(t,e){e.__esModule=!0;var r,i=(r=Ne)&&r.__esModule?r:{default:r};e.default=function(t,e,r){return e in t?(0,i.default)(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}}));var Gn=Bt.onFreeze;x("preventExtensions",function(e){return function(t){return e&&S(t)?e(Gn(t)):t}});var jn=y.Object.preventExtensions;e(r(function(t){t.exports={default:jn,__esModule:!0}}));var Kn=U;var Hn,Vn,Wn=(Hn=gn,fr(Vn=hn)?function(t){return Pr(Hn(t).concat(Vn(t)))}:Hn);var Yn=fr(dn)?dn:function(r){return Wn(r).reduce(function(t,e){return t[e]=Kn(r,e),t},{})},qn=Ue;var zn,Xn=function(f){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},h=t.requirement,e=t.customArgs,p=void 0!==e&&e;return function(){for(var t=arguments.length,a=Array(1<t?t-1:0),e=1;e<t;e++)a[e-1]=arguments[e];var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=r.exclude,o=void 0===i?[]:i,n=r.include,s=void 0===n?[]:n,u=r.construct,l=void 0!==u&&u,c=r.self,d=void 0!==c&&c;if(!dr(o))throw new TypeError("options.exclude must be an array");if(!dr(s))throw new TypeError("options.include must be an array");return function(t){var r=fr(t);if(!d&&!r)throw new TypeError("@"+f.name+"Class can only be used on class");if(d&&gr(t))throw new TypeError("@"+f.name+"Class must be used on non-primitive type value in 'self' mode");var i=d?t:t.prototype;if(cr(i))throw new Error("The prototype of the "+t.name+" is empty, please check it");var n=Yn(i);Wn(i).concat(s).forEach(function(t){var e=n[t];"constructor"===t&&!l||d&&r&&-1<["name","length","prototype"].indexOf(t)||-1<o.indexOf(t)||fr(h)&&!1===h(i,t,e,{self:d})||qn(i,t,(p?f.apply(void 0,Mr(a)):f)(i,t,e))})}}}(Jn,{requirement:function(t,e,r){return!!(i=r)&&i.hasOwnProperty("value")&&vr(i.configurable)&&vr(i.enumerable)&&vr(i.writable)&&fr(r.value);var i}}),Qn=void 0;function $n(t,e){if(void 0===Bn)throw new Error("Using @autobind on "+e.name+"() requires WeakMap support due to its use of super."+e.name+"()");Qn||(Qn=new Bn),!1===Qn.has(t)&&Qn.set(t,new Bn);var i,n,r=Qn.get(t);return!1===r.has(e)&&r.set(e,(n=t,(i=e).bind?i.bind(n):i.apply?function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return i.apply(n,e)}:function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return i.call.apply(i,[n].concat(Mr(e)))})),r.get(e)}function Jn(e,r,t){if(1===arguments.length)return Xn()(e);var i=t||{},n=i.value,a=i.configurable;if(!fr(n))throw new TypeError('@autobind can only be used on functions, not "'+n+'" in '+(void 0===n?"undefined":De(n))+' on property "'+r+'"');var o,s=e.constructor;return{configurable:a,enumerable:!1,get:function(){var i=this,t=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];return n.call.apply(n,[i].concat(Mr(e)))};return this===e?n:this.constructor!==s&&Ie(this).constructor===s?n:this.constructor!==s&&r in this.constructor.prototype?$n(this,n):(Ue(this,r,{configurable:!0,writable:!0,enumerable:!1,value:t}),t)},set:(o=r,function(t){return Ue(this,o,{configurable:!0,writable:!0,enumerable:!0,value:t}),t})}}var Zn,ta,ea,ra,ia,na,aa="chimee-kernel-hls";return zn=function(t){function a(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};xe(this,a);var i,n=Pe(this,(a.__proto__||Ie(a)).call(this));if(n.version="1.3.2",i=t,!("object"===("undefined"==typeof HTMLElement?"undefined":De(HTMLElement))?i instanceof HTMLElement:i&&"object"===(void 0===i?"undefined":De(i))&&null!==i&&1===i.nodeType&&"string"==typeof i.nodeName))throw new Error("video element passed in "+aa+" must be a HTMLVideoElement, but not "+(void 0===t?"undefined":De(t)));if(!hr(e))throw new Error("config of "+aa+" must be an Object but not "+(void 0===e?"undefined":De(e)));return n.video=t,n.config=e,n.customConfig=function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];if(e.length<2)throw new Error("deepAssign accept two and more argument");for(var i=e.length-1;-1<i;i--)if(gr(e[i]))throw new TypeError("deepAssign only accept non primitive type");var n=e.shift();return e.forEach(function(t){return Fr(t,n)}),n}({},sn,r),n.p2pConfig={},n.customConfig&&n.customConfig.p2pConfig&&(n.p2pConfig=n.customConfig.p2pConfig),n.p2pConfig.tag||(n.p2pConfig.tag="chimee"),n.hlsKernel=new Xe(n.customConfig),window.P2PEngine&&window.P2PEngine.isSupported()&&(n.p2pEngine=new P2PEngine(n.hlsKernel,n.p2pConfig)),n.bindEvents(),n.attachMedia(),n}return ze(a,Xi),Be(a,null,[{key:"isSupport",value:function(){return Xe.isSupported()}}]),Be(a,[{key:"bindEvents",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.hlsKernel;e&&e[t?"off":"on"](Xe.Events.ERROR,this.hlsErrorHandler)}},{key:"load",value:function(){return this.hlsKernel.loadSource(this.config.src)}},{key:"startLoad",value:function(){return this.hlsKernel.startLoad()}},{key:"stopLoad",value:function(){return this.hlsKernel.stopLoad()}},{key:"attachMedia",value:function(){return this.hlsKernel.attachMedia(this.video)}},{key:"play",value:function(){return this.video.play()}},{key:"destroy",value:function(){return this.bindEvents(!0),this.hlsKernel.destroy()}},{key:"seek",value:function(t){this.video.currentTime=t}},{key:"pause",value:function(){return this.video.pause()}},{key:"refresh",value:function(){return this.hlsKernel.stopLoad(),this.hlsKernel.loadSource(this.config.src)}},{key:"hlsErrorHandler",value:function(t,e){this.emit("error",e),this.emit(t,e),mr.error(aa+(t?" "+t:""),e.details)}}]),a}(),Zn=zn.prototype,ta="hlsErrorHandler",ea=[Jn],ra=U(zn.prototype,"hlsErrorHandler"),ia=zn.prototype,na={},Object.keys(ra).forEach(function(t){na[t]=ra[t]}),na.enumerable=!!na.enumerable,na.configurable=!!na.configurable,("value"in na||na.initializer)&&(na.writable=!0),na=ea.slice().reverse().reduce(function(t,e){return e(Zn,ta,t)||t},na),ia&&void 0!==na.initializer&&(na.value=na.initializer?na.initializer.call(ia):void 0,na.initializer=void 0),void 0===na.initializer&&(Object.defineProperty(Zn,ta,na),na=null),zn});
//# sourceMappingURL=/sm/a99ef42d50b992f4f742cd32d9bd399f00604ad338aada42cf1b748ddcff7c0f.map