@sigmaott/base-next 1.4.57 → 1.4.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SigmaManager=e():t.SigmaManager=e()}(this,function(){return function(t){function e(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=36)}([function(t,e,r){"use strict";function i(){}function n(t,e){return e="["+t+"] > "+e}function a(t){var e=d.console[t];return e?function(){for(var r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];i[0]&&(i[0]=n(t,i[0])),e.apply(d.console,i)}:i}function o(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];r.forEach(function(e){c[e]=t[e]?t[e].bind(t):a(e)})}r.d(e,"a",function(){return f}),r.d(e,"b",function(){return h});var s=r(6),u="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},l={trace:i,debug:i,log:i,warn:i,info:i,error:i},c=l,d=Object(s.a)(),f=function(t){if(!0===t||"object"===(void 0===t?"undefined":u(t))){o(t,"debug","log","info","warn","error","track");try{c.log()}catch(t){c=l}}else c=l},h=c},function(t,e,r){"use strict";var i={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",SIGMA_LOADED:"hlsSigmaLoaded",SIGMA_FINGER_PRINT:"sigmaHlsFingerPrint",SIGMA_MULTISCREEN:"sigmaHlsMultiScreen"};e.a=i},function(t,e,r){"use strict";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){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(0),a=r(2),o=r(1),s="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},u=["hlsEventGeneric","hlsHandlerDestroying","hlsHandlerDestroyed"],l=function(){function t(e){i(this,t),this.hls=e,this.onEvent=this.onEvent.bind(this);for(var r=arguments.length,n=Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];this.handledEvents=n,this.useGenericHandler=!0,this.registerListeners()}return t.prototype.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},t.prototype.onHandlerDestroying=function(){},t.prototype.onHandlerDestroyed=function(){},t.prototype.isEventHandler=function(){return"object"===s(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent},t.prototype.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){if(-1!==u.indexOf(t))throw new Error("Forbidden event-name: "+t);this.hls.on(t,this.onEvent)},this)},t.prototype.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){this.hls.off(t,this.onEvent)},this)},t.prototype.onEvent=function(t,e){this.onEventGeneric(t,e)},t.prototype.onEventGeneric=function(t,e){var r=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)};try{r.call(this,t,e).call()}catch(e){n.b.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.hls.trigger(o.a.ERROR,{type:a.b.OTHER_ERROR,details:a.a.INTERNAL_EXCEPTION,fatal:!1,event:t,err:e})}},t}();e.a=l},function(t,e,r){"use strict";r.d(e,"a",function(){return i}),r.d(e,"b",function(){return n});var i={CLEAR:"clear",SIGMA:"sigma"},n={DRM_INFO:"drmInfo",NATIVE_INITED:"sigmaInited",DEMUX_COMPLETE:"sigmaDemuxComplete"}},function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function n(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!n(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,n,s,u,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(r=this._events[t],o(r))return!1;if(i(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:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(a(r))for(s=Array.prototype.slice.call(arguments,1),l=r.slice(),n=l.length,u=0;u<n;u++)l[u].apply(this,s);return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(n=o(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[t].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,n,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.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(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){"use strict";function i(){return"undefined"==typeof window?self:window}e.a=i},function(t,e,r){!function(e){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,i=/^([^\/;?#]*)(.*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,o={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var n=this.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");return n.path=o.normalizePath(n.path),o.buildURLFromParts(n)}var a=this.parseURL(e);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):e;var s=this.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var u=i.exec(s.path);s.netLoc=u[1],s.path=u[2]}s.netLoc&&!s.path&&(s.path="/");var l={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var c=s.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;l.path=o.normalizePath(d)}else l.path=s.path,a.params||(l.params=s.params,a.query||(l.query=s.query));return null===l.path&&(l.path=r.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(l)},parseURL:function(t){var e=r.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=o}()},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(5),s=(r.n(o),r(4)),u=r(41),l=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),c=null,d=function(t){function e(){i(this,e);var r=n(this,t.call(this));return r.keyStore=new u.a,r.keyStore.on(s.b.NATIVE_INITED,function(){r.emit(s.b.NATIVE_INITED)}),r}return a(e,t),e.getInstance=function(){return c||(c=new e),c},e.destroy=function(){c=null},e.prototype.configKey=function(t){this.keyStore.configKey(t)},e.prototype.accquireProvision=function(){return this.keyStore._accquireProvision()},e.prototype.provisionRequest=function(){return this.keyStore._provisionRequest()},e.prototype.initSession=function(t){return this.keyStore._initSession(t)},e.prototype.closeSession=function(){return this.keyStore._closeSession()},e.prototype.accquireLicense=function(t){return this.keyStore._accquireLicense(t)},e.prototype.licenseRequest=function(t){return this.keyStore.licenseRequest(t)},e.prototype.provideKeyResponse=function(t,e){this.keyStore._provideLicense(t,e)},e.prototype.sessionInfo=function(t,e){this.keyStore.sessionInfo(t,e)},l(e,[{key:"clientInfo",set:function(t){this.keyStore.clientInfo=t},get:function(){return this.keyStore.clientInfo}},{key:"token",set:function(t){this.keyStore.token=t},get:function(){return this.keyStore.token}},{key:"nativeInfo",set:function(t){this.keyStore.setNativeInfo(t),this.nativeConfig=t},get:function(){return this.nativeConfig}},{key:"isNativeInited",get:function(){return this.keyStore.isNativeInited}}]),e}(o.EventEmitter);e.a=d},function(t,e,r){"use strict";var i={search:function(t,e){for(var r=0,i=t.length-1,n=null,a=null;r<=i;){n=(r+i)/2|0,a=t[n];var o=e(a);if(o>0)r=n+1;else{if(!(o<0))return a;i=n-1}}return null}};e.a=i},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"b",function(){return a});var n=function(){function t(){i(this,t)}return t.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},t.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},t.getID3Data=function(e,r){for(var i=r,n=0;t.isHeader(e,r);){n+=10;n+=t._readSize(e,r+6),t.isFooter(e,r+10)&&(n+=10),r+=n}if(n>0)return e.subarray(i,i+n)},t._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]},t.getTimeStamp=function(e){for(var r=t.getID3Frames(e),i=0;i<r.length;i++){var n=r[i];if(t.isTimeStampFrame(n))return t._readTimeStamp(n)}},t.isTimeStampFrame=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},t._getFrameData=function(e){var r=String.fromCharCode(e[0],e[1],e[2],e[3]),i=t._readSize(e,4);return{type:r,size:i,data:e.subarray(10,10+i)}},t.getID3Frames=function(e){for(var r=0,i=[];t.isHeader(e,r);){var n=t._readSize(e,r+6);r+=10;for(var a=r+n;r+8<a;){var o=t._getFrameData(e.subarray(r)),s=t._decodeFrame(o);s&&i.push(s),r+=o.size+10}t.isFooter(e,r)&&(r+=10)}return i},t._decodeFrame=function(e){return"PRIV"===e.type?t._decodePrivFrame(e):"T"===e.type[0]?t._decodeTextFrame(e):"W"===e.type[0]?t._decodeURLFrame(e):void 0},t._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)}},t._decodePrivFrame=function(e){if(!(e.size<2)){var r=t._utf8ArrayToStr(e.data,!0),i=new Uint8Array(e.data.subarray(r.length+1));return{key:e.type,info:r,data:i.buffer}}},t._decodeTextFrame=function(e){if(!(e.size<2)){if("TXXX"===e.type){var r=1,i=t._utf8ArrayToStr(e.data.subarray(r));r+=i.length+1;var n=t._utf8ArrayToStr(e.data.subarray(r));return{key:e.type,info:i,data:n}}var a=t._utf8ArrayToStr(e.data.subarray(1));return{key:e.type,data:a}}},t._decodeURLFrame=function(e){if("WXXX"===e.type){if(e.size<2)return;var r=1,i=t._utf8ArrayToStr(e.data.subarray(r));r+=i.length+1;var n=t._utf8ArrayToStr(e.data.subarray(r));return{key:e.type,info:i,data:n}}var a=t._utf8ArrayToStr(e.data);return{key:e.type,data:a}},t._utf8ArrayToStr=function(t){for(var e=arguments.length>1&&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},t}(),a=n._utf8ArrayToStr;e.a=n},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(3),s=function(t){function e(r){i(this,e);for(var a=arguments.length,o=Array(a>1?a-1:0),s=1;s<a;s++)o[s-1]=arguments[s];var u=n(this,t.call.apply(t,[this,r].concat(o)));return u._tickInterval=null,u._tickTimer=null,u._tickCallCount=0,u._boundTick=u.tick.bind(u),u}return a(e,t),e.prototype.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},e.prototype.hasInterval=function(){return!!this._tickInterval},e.prototype.hasNextTick=function(){return!!this._tickTimer},e.prototype.setInterval=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return!this._tickInterval&&(this._tickInterval=setInterval(this._boundTick,t),!0)}),e.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,!0)}),e.prototype.clearNextTick=function(){return!!this._tickTimer&&(clearTimeout(this._tickTimer),this._tickTimer=null,!0)},e.prototype.tick=function(){1===++this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&(this.clearNextTick(),this._tickTimer=setTimeout(this._boundTick,0)),this._tickCallCount=0)},e.prototype.doTick=function(){},e}(o.a);e.a=s},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(7),a=r.n(n),o=r(23),s=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),u=function(){function t(){var e;i(this,t),this._url=null,this._byteRange=null,this._decryptdata=null,this.tagList=[],this._elementaryStreams=(e={},e[t.ElementaryStreamTypes.AUDIO]=!1,e[t.ElementaryStreamTypes.VIDEO]=!1,e)}return t.prototype.addElementaryStream=function(t){this._elementaryStreams[t]=!0},t.prototype.hasElementaryStream=function(t){return!0===this._elementaryStreams[t]},t.prototype.createInitializationVector=function(t){for(var e=new Uint8Array(16),r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e},t.prototype.fragmentDecryptdataFromLevelkey=function(t,e){var r=t;return t&&t.method&&t.uri&&!t.iv&&(r=new o.a,r.method=t.method,r.baseuri=t.baseuri,r.reluri=t.reluri,r.iv=this.createInitializationVector(e)),r},s(t,[{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:"programDateTime",get:function(){return!this._programDateTime&&this.rawProgramDateTime&&(this._programDateTime=new Date(Date.parse(this.rawProgramDateTime))),this._programDateTime}},{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:"encrypted",get:function(){return!(!this.decryptdata||null===this.decryptdata.uri||null!==this.decryptdata.key)}}],[{key:"ElementaryStreamTypes",get:function(){return{AUDIO:"audio",VIDEO:"video"}}}]),t}();e.a=u},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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.d(e,"a",function(){return u}),r.d(e,"b",function(){return l});var o=r(3),s=r(1),u={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},l=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,s.a.BUFFER_APPENDED,s.a.FRAG_BUFFERED,s.a.FRAG_LOADED));return a.bufferPadding=.2,a.fragments=Object.create(null),a.timeRanges=Object.create(null),a.config=r.config,a}return a(e,t),e.prototype.destroy=function(){this.fragments=null,this.timeRanges=null,this.config=null,o.a.prototype.destroy.call(this),t.prototype.destroy.call(this)},e.prototype.getBufferedFrag=function(t,e){var r=this.fragments,i=Object.keys(r).filter(function(i){var n=r[i];if(n.body.type!==e)return!1;if(!n.buffered)return!1;var a=n.body;return a.startPTS<=t&&t<=a.endPTS});if(0===i.length)return null;var n=i.pop();return r[n].body},e.prototype.detectEvictedFragments=function(t,e){var r=this,i=void 0,n=void 0;Object.keys(this.fragments).forEach(function(a){var o=r.fragments[a];if(!0===o.buffered){var s=o.range[t];if(s){i=s.time;for(var u=0;u<i.length;u++)if(n=i[u],!1===r.isTimeBuffered(n.startPTS,n.endPTS,e)){r.removeFragment(o.body);break}}}})},e.prototype.detectPartialFragments=function(t){var e=this,r=this.getFragmentKey(t),i=this.fragments[r];i&&(i.buffered=!0,Object.keys(this.timeRanges).forEach(function(r){if(!0===t.hasElementaryStream(r)){var n=e.timeRanges[r];i.range[r]=e.getBufferedTimes(t.startPTS,t.endPTS,n)}}))},e.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,t>=n&&e<=a){i.push({startPTS:Math.max(t,r.start(s)),endPTS:Math.min(e,r.end(s))});break}if(t<a&&e>n)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}},e.prototype.getFragmentKey=function(t){return t.type+"_"+t.level+"_"+t.urlId+"_"+t.sn},e.prototype.getPartialFragment=function(t){var e=this,r=void 0,i=void 0,n=void 0,a=null,o=0;return Object.keys(this.fragments).forEach(function(s){var u=e.fragments[s];e.isPartial(u)&&(i=u.body.startPTS-e.bufferPadding,n=u.body.endPTS+e.bufferPadding,t>=i&&t<=n&&(r=Math.min(t-i,n-t),o<=r&&(a=u.body,o=r)))}),a},e.prototype.getState=function(t){var e=this.getFragmentKey(t),r=this.fragments[e],i=u.NOT_LOADED;return void 0!==r&&(i=r.buffered?!0===this.isPartial(r)?u.PARTIAL:u.OK:u.APPENDING),i},e.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)},e.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,t>=i&&e<=n)return!0;if(e<=i)return!1}return!1},e.prototype.onFragLoaded=function(t){var e=t.frag;if(!isNaN(e.sn)&&!e.bitrateTest){var r=this.getFragmentKey(e),i={body:e,range:Object.create(null),buffered:!1};this.fragments[r]=i}},e.prototype.onBufferAppended=function(t){var e=this;this.timeRanges=t.timeRanges,Object.keys(this.timeRanges).forEach(function(t){var r=e.timeRanges[t];e.detectEvictedFragments(t,r)})},e.prototype.onFragBuffered=function(t){this.detectPartialFragments(t.frag)},e.prototype.hasFragment=function(t){var e=this.getFragmentKey(t);return void 0!==this.fragments[e]},e.prototype.removeFragment=function(t){var e=this.getFragmentKey(t);this.fragments[e]&&delete this.fragments[e]},e.prototype.removeAllFragments=function(){this.fragments=Object.create(null)},e}(o.a)},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"a",function(){return n});var n=function(){function t(){i(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(u=0,n=0,a=o=e;u<i.length;u++){var d=i[u].start,f=i[u].end;if(e+r>=d&&e<f)a=d,o=f,n=o-e;else if(e+r<d){s=d;break}}return{len:n,start:a,end:o,nextStart:s}},t}()},function(t,e,r){function i(t){function e(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var r={};e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,i){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:i})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e.oe=function(t){throw console.error(t),t};var i=e(e.s=ENTRY_MODULE);return i.default||i}function n(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(t){return!isNaN(1*t)}function o(t,e,i){var o={};o[i]=[];var s=e.toString(),u=s.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return o;for(var d,f=u[1],h=new RegExp("(\\\\n|\\W)"+n(f)+c,"g");d=h.exec(s);)"dll-reference"!==d[3]&&o[i].push(d[3]);for(h=new RegExp("\\("+n(f)+'\\("(dll-reference\\s('+l+'))"\\)\\)'+c,"g");d=h.exec(s);)t[d[2]]||(o[i].push(d[1]),t[d[2]]=r(d[1]).m),o[d[2]]=o[d[2]]||[],o[d[2]].push(d[4]);for(var p=Object.keys(o),g=0;g<p.length;g++)for(var v=0;v<o[p[g]].length;v++)a(o[p[g]][v])&&(o[p[g]][v]=1*o[p[g]][v]);return o}function s(t){return Object.keys(t).reduce(function(e,r){return e||t[r].length>0},!1)}function u(t,e){for(var r={main:[e]},i={main:[]},n={main:{}};s(r);)for(var a=Object.keys(r),u=0;u<a.length;u++){var l=a[u],c=r[l],d=c.pop();if(n[l]=n[l]||{},!n[l][d]&&t[l][d]){n[l][d]=!0,i[l]=i[l]||[],i[l].push(d);for(var f=o(t,t[l][d],l),h=Object.keys(f),p=0;p<h.length;p++)r[h[p]]=r[h[p]]||[],r[h[p]]=r[h[p]].concat(f[h[p]])}}return i}var l="[\\.|\\-|\\+|\\w|/|@]+",c="\\((/\\*.*?\\*/)?s?.*?("+l+").*?\\)";t.exports=function(t,e){e=e||{};var n={main:r.m},a=e.all?{main:Object.keys(n.main)}:u(n,t),o=e.globalVariable?e.globalVariable:"";Object.keys(a).filter(function(t){return"main"!==t}).forEach(function(t){for(var e=0;a[t][e];)e++;a[t].push(e),n[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+t+" = ("+i.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+a[t].map(function(e){return JSON.stringify(e)+": "+n[t][e].toString()}).join(",")+"});\n"}),o=o+"new (("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+a.main.map(function(t){return JSON.stringify(t)+": "+n.main[t].toString()}).join(",")+"}))(self);";var s=new window.Blob([o],{type:"text/javascript"});if(e.bare)return s;var l=window.URL||window.webkitURL||window.mozURL||window.msURL,c=l.createObjectURL(s),d=new window.Worker(c);return d.objectURL=c,d}},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(44),a=r(45),o=r(46),s=r(2),u=r(0),l=r(1),c=r(6),d=Object(c.a)(),f=function(){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.removePKCS7Padding,o=void 0===a||a;if(i(this,t),this.logEnabled=!0,this.observer=e,this.config=r,this.removePKCS7Padding=o,o)try{var s=d.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(t){}this.disableWebCrypto=!this.subtle}return t.prototype.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},t.prototype.decrypt=function(t,e,r,i){var s=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(u.b.log("JS AES decrypt"),this.logEnabled=!1);var l=this.decryptor;l||(this.decryptor=l=new o.a),l.expandKey(e),i(l.decrypt(t,0,r,this.removePKCS7Padding))}else{this.logEnabled&&(u.b.log("WebCrypto AES decrypt"),this.logEnabled=!1);var c=this.subtle;this.key!==e&&(this.key=e,this.fastAesKey=new a.a(c,e)),this.fastAesKey.expandKey().then(function(a){new n.a(c,r).decrypt(t,a).catch(function(n){s.onWebCryptoError(n,t,e,r,i)}).then(function(t){i(t)})}).catch(function(n){s.onWebCryptoError(n,t,e,r,i)})}},t.prototype.onWebCryptoError=function(t,e,r,i,n){this.config.enableSoftwareAES?(u.b.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(e,r,i,n)):(u.b.error("decrypting error : "+t.message),this.observer.trigger(l.a.ERROR,{type:s.b.MEDIA_ERROR,details:s.a.FRAG_DECRYPT_ERROR,fatal:!0,reason:t.message}))},t.prototype.destroy=function(){var t=this.decryptor;t&&(t.destroy(),this.decryptor=void 0)},t}();e.a=f},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(56),s=r(57),u=r(4),l=null,c=function(t){function e(){i(this,e);var r=n(this,t.call(this));return r.keyInfo={},r}return a(e,t),e.getInstance=function(){return l||(l=new e),l},e.destroy=function(){l&&(l=null)},e.prototype.init=function(t){var e=this;this.drm||(this.drm=new s.a,this.drm.on(u.b.NATIVE_INITED,function(){e.emit(u.b.NATIVE_INITED)}),this.drm.on(u.b.DEMUX_COMPLETE,function(){e.emit(u.b.DEMUX_COMPLETE)}),this.drm.initDRM(t))},e.prototype.decrypt=function(t,e,r){var i=this,n=e.key;this.drm.hasLicense(n)?this.drm.decrypt(t,e.iv,r):this._requestKeyStore(n,function(a){i.drm.setSessionInfo(n,a),i.drm.decrypt(t,e.iv,r)})},e.prototype._requestKeyStore=function(t,e){var r=this;this.keyInfoFromStore(t,function(i,n){r.keyInfo[t]=n,e(n)})},e.prototype._publicKey=function(){return this.drm.publicKey()},e}(o.a);e.a=c},function(t,e,r){"use strict";function i(){if("undefined"!=typeof window)return window.MediaSource||window.WebKitMediaSource}e.a=i},function(t,e,r){"use strict";function i(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 n(t,e,r){var i=t[e],n=t[r],a=n.startPTS;isNaN(a)?n.start=r>e?i.start+i.duration:Math.max(i.start-n.duration,0):r>e?(i.duration=a-i.start,i.duration<0&&s.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&&s.b.warn("negative duration computed for frag "+n.sn+",level "+n.level+", there should be some duration drift between playlist and fragment!"))}function a(t,e,r,i,a,o){var s=r;if(!isNaN(e.startPTS)){var u=Math.abs(e.startPTS-r);isNaN(e.deltaPTS)?e.deltaPTS=u:e.deltaPTS=Math.max(u,e.deltaPTS),s=Math.max(r,e.startPTS),r=Math.min(r,e.startPTS),i=Math.max(i,e.endPTS),a=Math.min(a,e.startDTS),o=Math.max(o,e.endDTS)}var l=r-e.start;e.start=e.startPTS=r,e.maxStartPTS=s,e.endPTS=i,e.startDTS=a,e.endDTS=o,e.duration=i-r;var c=e.sn;if(!t||c<t.startSN||c>t.endSN)return 0;var d=void 0,f=void 0,h=void 0;for(d=c-t.startSN,f=t.fragments,f[d]=e,h=d;h>0;h--)n(f,h,h-1);for(h=d;h<f.length-1;h++)n(f,h,h+1);return t.PTSKnown=!0,l}function o(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,o=t.fragments,u=e.fragments,l=0,c=void 0;if(e.initSegment&&t.initSegment&&(e.initSegment=t.initSegment),i<r)return void(e.PTSKnown=!1);for(var d=r;d<=i;d++){var f=o[n+d],h=u[d];h&&f&&(l=f.cc-h.cc,isNaN(f.startPTS)||(h.start=h.startPTS=f.startPTS,h.endPTS=f.endPTS,h.duration=f.duration,h.backtracked=f.backtracked,h.dropped=f.dropped,c=h))}if(l)for(s.b.log("discontinuity sliding from playlist, take drift into account"),d=0;d<u.length;d++)u[d].cc+=l;if(c)a(e,c,c.startPTS,c.endPTS,c.startDTS,c.endDTS);else if(n>=0&&n<o.length){var p=o[n].start;for(d=0;d<u.length;d++)u[d].start+=p}e.PTSKnown=t.PTSKnown}e.a=i,e.c=a,e.b=o;var s=r(0)},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(7),a=r.n(n),o=r(2),s=r(21),u=r(39),l=r(40),c=r(13),d=r(43),f=r(65),h=r(66),p=r(33),g=r(0),v=r(67),y=r(1),m=r(5),b=r.n(m),E=r(35),T=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}();r(87);var S=function(){function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t);var n=t.DefaultConfig;if((r.liveSyncDurationCount||r.liveMaxLatencyDurationCount)&&(r.liveSyncDuration||r.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var a in n)a in r||(r[a]=n[a]);if(void 0!==r.liveMaxLatencyDurationCount&&r.liveMaxLatencyDurationCount<=r.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==r.liveMaxLatencyDuration&&(r.liveMaxLatencyDuration<=r.liveSyncDuration||void 0===r.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(g.a)(r.debug),this.config=r,this._autoLevelCapping=-1;var o=this.observer=new b.a;o.trigger=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];o.emit.apply(o,[t,t].concat(r))},o.off=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];r&&r.length>0&&"function"==typeof r[0]&&o.removeListener.apply(o,[t].concat(r))},this.on=o.on.bind(o),this.off=o.off.bind(o),this.once=o.once.bind(o),this.trigger=o.trigger.bind(o);var p=this.abrController=new r.abrController(this),v=new r.bufferController(this),y=new r.capLevelController(this),m=new r.fpsController(this),T=new s.a(this),S=new u.a(this),_=new l.a(this),A=new h.a(this),R=this.levelController=new f.a(this),w=new c.b(this),I=this.streamController=new d.a(this,w),L=[R,I],k=r.audioStreamController;k&&L.push(new k(this,w)),this.networkControllers=L;var D=[T,S,_,p,v,y,m,A,w];if(k=r.audioTrackController){var O=new k(this);this.audioTrackController=O,D.push(O)}if(k=r.subtitleTrackController){var P=new k(this);this.subtitleTrackController=P,D.push(P)}if(k=r.emeController){var C=new k(this);this.emeController=C,D.push(C)}[r.subtitleStreamController,r.timelineController].forEach(function(t){t&&D.push(new t(e))}),this.coreComponents=D,E.c.getInstance(this).changeState(E.a.STATE_INIT)}return t.isSupported=function(){return Object(p.a)()},T(t,null,[{key:"version",get:function(){return"0.10.1"}},{key:"Events",get:function(){return y.a}},{key:"ErrorTypes",get:function(){return o.b}},{key:"ErrorDetails",get:function(){return o.a}},{key:"DefaultConfig",get:function(){return t.defaultConfig?t.defaultConfig:v.a},set:function(e){t.defaultConfig=e}}]),t.prototype.destroy=function(){g.b.log("destroy"),this.trigger(y.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){g.b.log("attachMedia"),this.media=t,this.trigger(y.a.MEDIA_ATTACHING,{media:t})},t.prototype.detachMedia=function(){this._stopEndPing(),g.b.log("detachMedia"),this.trigger(y.a.MEDIA_DETACHING),this.media=null,E.c.clear()},t.prototype.setJwtToken=function(t){this.jwtToken=t},t.prototype.loadSource=function(t,e){this._isLock=!1,t=a.a.buildAbsoluteURL(window.location.href,t,{alwaysNormalize:!0}),g.b.log("loadSource:"+t),this.url=t,this.trigger(y.a.MANIFEST_LOADING,{url:t}),this._usePing=!(!e||""===e),E.c.getInstance(this).setJwtToken(e||""),E.c.getInstance(this).setUsePing(this._usePing),E.c.getInstance(this).changeState(E.a.STATE_PLAY)},t.prototype.startLoad=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;g.b.log("startLoad("+t+")"),this.networkControllers.forEach(function(e){e.startLoad(t)})},t.prototype._stopEndPing=function(){this._usePing&&(E.c.getInstance(this).changeState(E.a.STATE_STOP),this._usePing=!1)},t.prototype.stopLoad=function(){g.b.log("stopLoad"),this.networkControllers.forEach(function(t){t.stopLoad()})},t.prototype.onDataPing=function(t){if(t&&t.status)switch(this.trigger(y.a.SIGMA_MULTISCREEN,{data:t}),t.status){case E.b.UNLOCK:this._isLock=!1;break;case E.b.LOCK:this._isLock=!0,this._stopEndPing()}},t.prototype.swapAudioCodec=function(){g.b.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.prototype.recoverMediaError=function(){g.b.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)},T(t,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){g.b.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){g.b.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){g.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){g.b.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){g.b.log("set startLevel:"+t);var e=this;-1!==t&&(t=Math.max(t,e.minAutoLevel)),e.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){g.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,e=t.levels,r=t.config.minAutoBitrate,i=e?e.length:0,n=0;n<i;n++){if((e[n].realBitrate?Math.max(e[n].realBitrate,e[n].bitrate):e[n].bitrate)>r)return n}return 0}},{key:"maxAutoLevel",get:function(){var t=this,e=t.levels,r=t.autoLevelCapping;return-1===r&&e&&e.length?e.length-1:r}},{key:"nextAutoLevel",get:function(){var t=this;return Math.min(Math.max(t.abrController.nextAutoLevel,t.minAutoLevel),t.maxAutoLevel)},set:function(t){var e=this;e.abrController.nextAutoLevel=Math.max(e.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.a=S},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(3),u=r(2),l=r(0),c=r(22),d=r(37),f=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),h=window,p=h.performance,g={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},v={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},y=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.MANIFEST_LOADING,o.a.LEVEL_LOADING,o.a.AUDIO_TRACK_LOADING,o.a.SUBTITLE_TRACK_LOADING));return a.loaders={},a}return a(e,t),e.canHaveQualityLevels=function(t){return t!==g.AUDIO_TRACK&&t!==g.SUBTITLE_TRACK},e.mapContextToLevelType=function(t){switch(t.type){case g.AUDIO_TRACK:return v.AUDIO;case g.SUBTITLE_TRACK:return v.SUBTITLE;default:return v.MAIN}},e.getResponseUrl=function(t,e){var r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r},e.prototype.createInternalLoader=function(t){var e=this.hls.config,r=e.pLoader,i=e.loader,n=r||i,a=new n(e);return t.loader=a,this.loaders[t.type]=a,a},e.prototype.getInternalLoader=function(t){return this.loaders[t.type]},e.prototype.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},e.prototype.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},e.prototype.destroy=function(){this.destroyInternalLoaders(),t.prototype.destroy.call(this)},e.prototype.onManifestLoading=function(t){this.load(t.url,{type:g.MANIFEST,level:0,id:null})},e.prototype.onLevelLoading=function(t){this.load(t.url,{type:g.LEVEL,level:t.level,id:t.id})},e.prototype.onAudioTrackLoading=function(t){this.load(t.url,{type:g.AUDIO_TRACK,level:0,id:t.id})},e.prototype.onSubtitleTrackLoading=function(t){this.load(t.url,{type:g.SUBTITLE_TRACK,level:0,id:t.id})},e.prototype.load=function(t,e){var r=this.hls.config;l.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 l.b.trace("playlist request ongoing"),!1;l.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 g.MANIFEST:a=r.manifestLoadingMaxRetry,o=r.manifestLoadingTimeOut,s=r.manifestLoadingRetryDelay,u=r.manifestLoadingMaxRetryTimeout;break;case g.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 c={timeout:o,maxRetry:a,retryDelay:s,maxRetryDelay:u},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return l.b.debug("Calling internal loader delegate for URL: "+t),i.load(e,c,d),!0},e.prototype.loadsuccess=function(t,e,r){var i=arguments.length>3&&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;if(e.tload=p.now(),0!==n.indexOf("#EXTM3U"))return void this._handleManifestParsingError(t,r,"no EXTM3U delimiter",i);n.indexOf("#EXTINF:")>0||n.indexOf("#EXT-X-TARGETDURATION:")>0?this._handleTrackOrLevelPlaylist(t,e,r,i):this._handleMasterPlaylist(t,e,r,i)},e.prototype.loaderror=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(e,r)},e.prototype.loadtimeout=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(e,r,!0)},e.prototype._handleMasterPlaylist=function(t,r,i,n){var a=this.hls,s=t.data,u=e.getResponseUrl(t,i),c=d.a.parseMasterPlaylist(s,u);if(!c.length)return void this._handleManifestParsingError(t,i,"no level found in manifest",n);var f=c.map(function(t){return{id:t.attrs.AUDIO,codec:t.audioCodec}}),h=d.a.parseMasterPlaylistMedia(s,u,"AUDIO",f),p=d.a.parseMasterPlaylistMedia(s,u,"SUBTITLES");if(h.length){var g=!1;h.forEach(function(t){t.url||(g=!0)}),!1===g&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(l.b.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),h.unshift({type:"main",name:"main"}))}a.trigger(o.a.MANIFEST_LOADED,{levels:c,audioTracks:h,subtitles:p,url:u,stats:r,networkDetails:n})},e.prototype._handleTrackOrLevelPlaylist=function(t,r,i,n){var a=this.hls,s=i.id,u=i.level,l=i.type,c=e.getResponseUrl(t,i),f=isNaN(s)?0:s,h=isNaN(u)?f:u,v=e.mapContextToLevelType(i),y=d.a.parseLevelPlaylist(t.data,c,h,v,f);if(y.tload=r.tload,l===g.MANIFEST){var m={url:c,details:y};a.trigger(o.a.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:c,stats:r,networkDetails:n})}if(r.tparsed=p.now(),y.needSidxRanges){var b=y.initSegment.url;return void this.load(b,{isSidxRequest:!0,type:l,level:u,levelDetails:y,id:s,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}i.levelDetails=y,this._handlePlaylistLoaded(t,r,i,n)},e.prototype._handleSidxRequest=function(t,e){var r=c.a.parseSegmentIndex(new Uint8Array(t.data));r.references.forEach(function(t,r){var i=t.info,n=e.levelDetails.fragments[r];0===n.byteRange.length&&(n.rawByteRange=String(1+i.end-i.start)+"@"+String(i.start))}),e.levelDetails.initSegment.rawByteRange=String(r.moovEndOffset)+"@0"},e.prototype._handleManifestParsingError=function(t,e,r,i){this.hls.trigger(o.a.ERROR,{type:u.b.NETWORK_ERROR,details:u.a.MANIFEST_PARSING_ERROR,fatal:!0,url:t.url,reason:r,networkDetails:i})},e.prototype._handleNetworkError=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];l.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 g.MANIFEST:i=r?u.a.MANIFEST_LOAD_TIMEOUT:u.a.MANIFEST_LOAD_ERROR,n=!0;break;case g.LEVEL:i=r?u.a.LEVEL_LOAD_TIMEOUT:u.a.LEVEL_LOAD_ERROR,n=!1;break;case g.AUDIO_TRACK:i=r?u.a.AUDIO_TRACK_LOAD_TIMEOUT:u.a.AUDIO_TRACK_LOAD_ERROR,n=!1;break;default:n=!1}a&&(a.abort(),this.resetInternalLoader(t.type)),this.hls.trigger(o.a.ERROR,{type:u.b.NETWORK_ERROR,details:i,fatal:n,url:a.url,loader:a,context:t,networkDetails:e})},e.prototype._handlePlaylistLoaded=function(t,r,i,n){var a=i.type,s=i.level,u=i.id,l=i.levelDetails;if(!l.targetduration)return void this._handleManifestParsingError(t,i,"invalid target duration",n);if(e.canHaveQualityLevels(i.type))this.hls.trigger(o.a.LEVEL_LOADED,{details:l,level:s||0,id:u||0,stats:r,networkDetails:n});else switch(a){case g.AUDIO_TRACK:this.hls.trigger(o.a.AUDIO_TRACK_LOADED,{details:l,id:u,stats:r,networkDetails:n});break;case g.SUBTITLE_TRACK:this.hls.trigger(o.a.SUBTITLE_TRACK_LOADED,{details:l,id:u,stats:r,networkDetails:n})}},f(e,null,[{key:"ContextType",get:function(){return g}},{key:"LevelType",get:function(){return v}}]),e}(s.a);e.a=y},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(0),a=r(1),o=Math.pow(2,32)-1,s=function(){function t(e,r){i(this,t),this.observer=e,this.remuxer=r}return t.prototype.resetTimeStamp=function(t){this.initPTS=t},t.prototype.resetInitSegment=function(e,r,i,n){if(e&&e.byteLength){var o=this.initData=t.parseInitSegment(e);null==r&&(r="mp4a.40.5"),null==i&&(i="avc1.42e01e");var s={};o.audio&&o.video?s.audiovideo={container:"video/mp4",codec:r+","+i,initSegment:n?e:null}:(o.audio&&(s.audio={container:"audio/mp4",codec:r,initSegment:n?e:null}),o.video&&(s.video={container:"video/mp4",codec:i,initSegment:n?e:null})),this.observer.trigger(a.a.FRAG_PARSING_INIT_SEGMENT,{tracks:s})}else r&&(this.audioCodec=r),i&&(this.videoCodec=i)},t.probe=function(e){return t.findBox({data:e,start:0,end:Math.min(e.length,16384)},["moof"]).length>0},t.bin2str=function(t){return String.fromCharCode.apply(null,t)},t.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},t.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},t.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},t.findBox=function(e,r){var i=[],n=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,c=void 0;if(e.data?(l=e.start,s=e.end,e=e.data):(l=0,s=e.byteLength),!r.length)return null;for(n=l;n<s;)a=t.readUint32(e,n),o=t.bin2str(e.subarray(n+4,n+8)),c=a>1?n+a:s,o===r[0]&&(1===r.length?i.push({data:e,start:n+8,end:c}):(u=t.findBox({data:e,start:n+8,end:c},r.slice(1)),u.length&&(i=i.concat(u)))),n=c;return i},t.parseSegmentIndex=function(e){var r=t.findBox(e,["moov"])[0],i=r?r.end:null,n=0,a=t.findBox(e,["sidx"]),o=void 0;if(!a||!a[0])return null;o=[],a=a[0];var s=a.data[0];n=0===s?8:16;var u=t.readUint32(a,n);n+=4;n+=0===s?8:16,n+=2;var l=a.end+0,c=t.readUint16(a,n);n+=2;for(var d=0;d<c;d++){var f=n,h=t.readUint32(a,f);f+=4;var p=2147483647&h;if(1===(2147483648&h)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var g=t.readUint32(a,f);f+=4,o.push({referenceSize:p,subsegmentDuration:g,info:{duration:g/u,start:l,end:l+p-1}}),l+=p,f+=4,n=f}return{earliestPresentationTime:0,timescale:u,version:s,referencesCount:c,references:o,moovEndOffset:i}},t.parseInitSegment=function(e){var r=[];return t.findBox(e,["moov","trak"]).forEach(function(e){var i=t.findBox(e,["tkhd"])[0];if(i){var a=i.data[i.start],o=0===a?12:20,s=t.readUint32(i,o),u=t.findBox(e,["mdia","mdhd"])[0];if(u){a=u.data[u.start],o=0===a?12:20;var l=t.readUint32(u,o),c=t.findBox(e,["mdia","hdlr"])[0];if(c){var d=t.bin2str(c.data.subarray(c.start+8,c.start+12)),f={soun:"audio",vide:"video"}[d];if(f){var h=t.findBox(e,["mdia","minf","stbl","stsd"]);if(h.length){h=h[0];var p=t.bin2str(h.data.subarray(h.start+12,h.start+16));n.b.log("MP4Demuxer:"+f+":"+p+" found")}r[s]={timescale:l,type:f},r[f]={timescale:l,id:s}}}}}}),r},t.getStartDTS=function(e,r){var i=void 0,n=void 0,a=void 0;return i=t.findBox(r,["moof","traf"]),n=[].concat.apply([],i.map(function(r){return t.findBox(r,["tfhd"]).map(function(i){var n=void 0,a=void 0;return n=t.readUint32(i,4),a=e[n].timescale||9e4,t.findBox(r,["tfdt"]).map(function(e){var r=void 0,i=void 0;return r=e.data[e.start],i=t.readUint32(e,4),1===r&&(i*=Math.pow(2,32),i+=t.readUint32(e,8)),i})[0]/a})})),a=Math.min.apply(null,n),isFinite(a)?a:0},t.offsetStartDTS=function(e,r,i){t.findBox(r,["moof","traf"]).map(function(r){return t.findBox(r,["tfhd"]).map(function(n){var a=t.readUint32(n,4),s=e[a].timescale||9e4;t.findBox(r,["tfdt"]).map(function(e){var r=e.data[e.start],n=t.readUint32(e,4);if(0===r)t.writeUint32(e,4,n-i*s);else{n*=Math.pow(2,32),n+=t.readUint32(e,8),n-=i*s,n=Math.max(n,0);var a=Math.floor(n/(o+1)),u=Math.floor(n%(o+1));t.writeUint32(e,4,a),t.writeUint32(e,8,u)}})})})},t.prototype.append=function(e,r,i,n){var o=this.initData;o||(this.resetInitSegment(e,this.audioCodec,this.videoCodec,!1),o=this.initData);var s=void 0,u=this.initPTS;if(void 0===u){var l=t.getStartDTS(o,e);this.initPTS=u=l-r,this.observer.trigger(a.a.INIT_PTS_FOUND,{initPTS:u})}t.offsetStartDTS(o,e,u),s=t.getStartDTS(o,e),this.remuxer.remux(o.audio,o.video,null,null,s,i,n,e)},t.prototype.destroy=function(){},t}();e.a=s},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(7),a=r.n(n),o=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),s=function(){function t(){i(this,t),this.method=null,this.key=null,this.iv=null,this._uri=null}return o(t,[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=a.a.buildAbsoluteURL(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}]),t}();e.a=s},function(t,e,r){"use strict";function i(t,e){var r=a[e];return!!r&&!0===r[t.slice(0,4)]}function n(t,e){return window.MediaSource.isTypeSupported((e||"video")+'/mp4;codecs="'+t+'"')}r.d(e,"b",function(){return i}),r.d(e,"a",function(){return n});var a={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(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(5),a=r.n(n),o=r(15),s=(r.n(o),r(1)),u=r(26),l=r(0),c=r(2),d=r(18),f=r(6),h=r(59),p=r(4),g=Object(f.a)(),v=Object(d.a)(),y=function(){function t(e,r){i(this,t),this.hls=e,this.id=r,this.demuxComplete=!0,this.demuxQueue=[];var n=this.observer=new a.a,o=e.config;n.trigger=function(t){for(var e=arguments.length,r=Array(e>1?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(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];n.removeListener.apply(n,[t].concat(r))};var d=function(t,r){r=r||{},r.frag=this.frag,r.id=this.id,e.trigger(t,r)}.bind(this);n.on(s.a.FRAG_DECRYPTED,d),n.on(s.a.FRAG_PARSING_INIT_SEGMENT,d),n.on(s.a.FRAG_PARSING_DATA,d),n.on(s.a.FRAG_PARSED,d),n.on(s.a.ERROR,d),n.on(s.a.FRAG_PARSING_METADATA,d),n.on(s.a.FRAG_PARSING_USERDATA,d),n.on(s.a.INIT_PTS_FOUND,d);var f={mp4:v.isTypeSupported("video/mp4"),mpeg:v.isTypeSupported("audio/mpeg"),mp3:v.isTypeSupported('audio/mp4; codecs="mp3"')},p=navigator.vendor;if(o.enableWorker&&"undefined"!=typeof Worker){l.b.log("demuxing in webworker");var y=void 0;try{y=this.w=new h.a(this.id),this.onwmsg=this.onWorkerMessage.bind(this),y.addEventListener("message",this.onwmsg),y.onerror=function(t){e.trigger(s.a.ERROR,{type:c.b.OTHER_ERROR,details:c.a.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},y.postMessage({cmd:"init",typeSupported:f,vendor:p,id:r,config:JSON.stringify(o)})}catch(t){l.b.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),y&&g.URL.revokeObjectURL(y.objectURL),this.demuxer=new u.a(n,f,o,p),this.w=void 0}}else this.demuxer=new u.a(n,f,o,p)}return t.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)},t.prototype.push=function(t,e,r,i,n,a,o,s,u){this.demuxQueue.push({data:t,initSegment:e,audioCodec:r,videoCodec:i,frag:n,duration:a,accurateTimeOffset:o,defaultInitPTS:s,lowLatency:u}),this._demuxFromQueue()},t.prototype._demuxFromQueue=function(){if(this.demuxComplete&&this.demuxQueue.length>0){var t=this.demuxQueue.shift();this.demuxComplete=!1,this._push(t.data,t.initSegment,t.audioCodec,t.videoCodec,t.frag,t.duration,t.accurateTimeOffset,t.defaultInitPTS,t.lowLatency)}},t.prototype._push=function(t,e,r,i,n,a,o,s,u){var c=this.w,d=isNaN(n.startDTS)?n.start:n.startDTS,f=n.decryptdata,h=this.frag,p=!(h&&n.cc===h.cc),g=!(h&&n.level===h.level),v=h&&n.sn===h.sn+1,y=!g&&v;if(p&&l.b.log(this.id+":discontinuity detected"),g&&l.b.log(this.id+":switch detected"),this.frag=n,c)c.postMessage({cmd:"demux",url:this.frag.url,data:t,decryptdata:f,initSegment:e,audioCodec:r,videoCodec:i,timeOffset:d,discontinuity:p,trackSwitch:g,contiguous:y,duration:a,accurateTimeOffset:o,defaultInitPTS:s,lowLatency:u},t instanceof ArrayBuffer?[t]:[]);else{var m=this.demuxer;m&&m.push(t,f,e,r,i,d,p,g,y,a,o,s,u)}},t.prototype.notifycomplete=function(){var t=this.w;if(t)t.postMessage({cmd:"complete"});else{var e=this.demuxer;e&&e.notifycomplete()}},t.prototype.onWorkerMessage=function(t){var e=t.data,r=this.hls;switch(e.event){case"init":g.URL.revokeObjectURL(this.w.objectURL);break;case p.b.DEMUX_COMPLETE:this.demuxComplete=!0,this._demuxFromQueue();break;case s.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,this.frag&&this.frag.url==t.data.url&&r.trigger(e.event,e.data)}},t}();e.a=y},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(1),a=r(2),o=r(16),s=r(47),u=r(22),l=r(48),c=r(51),d=r(52),f=r(55),h=r(6),p=r(17),g=Object(h.a)(),v=g,y=function(){function t(e,r,n,a){i(this,t),this.observer=e,this.typeSupported=r,this.config=n,this.vendor=a}return t.prototype.destroy=function(){var t=this.demuxer;t&&t.destroy()},t.prototype.push=function(t,e,r,i,a,s,u,l,c,d,f,h){if(t.byteLength>0&&null!=e&&null!=e.key&&"AES-128"===e.method){var g=this.decrypter;null==g&&(g=this.decrypter=new o.a(this.observer,this.config));var y=this,m=void 0;try{m=v.now()}catch(t){m=Date.now()}p.a.getInstance().decrypt(t,e,function(t){var o=void 0;try{o=v.now()}catch(t){o=Date.now()}y.observer.trigger(n.a.FRAG_DECRYPTED,{stats:{tstart:m,tdecrypt:o}}),y.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),i,a,s,u,l,c,d,f,h)})}else this.pushDecrypted(new Uint8Array(t),e,new Uint8Array(r),i,a,s,u,l,c,d,f,h)},t.prototype.pushDecrypted=function(t,e,r,i,o,h,p,g,v,y,m,b){var E=this.demuxer;if(!E||(p||g)&&!this.probe(t)){for(var T=this.observer,S=this.typeSupported,_=this.config,A=[{demux:l.a,remux:d.a},{demux:u.a,remux:f.a},{demux:s.a,remux:d.a},{demux:c.a,remux:d.a}],R=0,w=A.length;R<w;R++){var I=A[R],L=I.demux.probe;if(L(t)){var k=this.remuxer=new I.remux(T,_,S,this.vendor);E=new I.demux(T,k,_,S),this.probe=L;break}}if(!E)return void T.trigger(n.a.ERROR,{type:a.b.MEDIA_ERROR,details:a.a.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=E}var D=this.remuxer;(p||g)&&(E.resetInitSegment(r,i,o,y),D.resetInitSegment()),p&&(E.resetTimeStamp(b),D.resetTimeStamp(b)),"function"==typeof E.setDecryptData&&E.setDecryptData(e),E.append(t,h,v,m)},t}();e.a=y},function(t,e,r){"use strict";function i(t,e,r,i){var n=void 0,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];return n=1+((192&e[r+2])>>>6),(a=(60&e[r+2])>>>2)>d.length-1?void t.trigger(g.a.ERROR,{type:p.b.MEDIA_ERROR,details:p.a.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+a}):(s=(1&e[r+2])<<2,s|=(192&e[r+3])>>>6,h.b.log("manifest codec:"+i+",ADTS data:type:"+n+",sampleingIndex:"+a+"["+d[a]+"Hz],channelConfig:"+s),/firefox/i.test(l)?a>=6?(n=5,u=new Array(4),o=a-3):(n=2,u=new Array(2),o=a):-1!==l.indexOf("android")?(n=2,u=new Array(2),o=a):(n=5,u=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&a>=6?o=a-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(a>=6&&1===s||/vivaldi/i.test(l))||!i&&1===s)&&(n=2,u=new Array(2)),o=a)),u[0]=n<<3,u[0]|=(14&a)>>1,u[1]|=(1&a)<<7,u[1]|=s<<3,5===n&&(u[1]|=(14&o)>>1,u[2]=(1&o)<<7,u[2]|=8,u[3]=0),{config:u,samplerate:d[a],channelCount:s,codec:"mp4a.40."+n,manifestCodec:c})}function n(t,e){return 255===t[e]&&240==(246&t[e+1])}function a(t,e){return 1&t[e+1]?7:9}function o(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function s(t,e){return!!(e+1<t.length&&n(t,e))}function u(t,e){if(e+1<t.length&&n(t,e)){var r=a(t,e),i=r;e+5<t.length&&(i=o(t,e));var s=e+i;if(s===t.length||s+1<t.length&&n(t,s))return!0}return!1}function l(t,e,r,n,a){if(!t.samplerate){var o=i(e,r,n,a);t.config=o.config,t.samplerate=o.samplerate,t.channelCount=o.channelCount,t.codec=o.codec,t.manifestCodec=o.manifestCodec,h.b.log("parsed codec:"+t.codec+",rate:"+o.samplerate+",nb channel:"+o.channelCount)}}function c(t){return 9216e4/t}function d(t,e,r,i,n){var s=void 0,u=void 0,l=void 0,c=t.length;if(s=a(t,e),u=o(t,e),(u-=s)>0&&e+s+u<=c)return l=r+i*n,{headerLength:s,frameLength:u,stamp:l}}function f(t,e,r,i,n){var a=c(t.samplerate),o=d(e,r,i,n,a);if(o){var s=o.stamp,u=o.headerLength,l=o.frameLength,f={unit:e.subarray(r+u,r+u+l),pts:s,dts:s};return t.samples.push(f),t.len+=l,{sample:f,length:l+u}}}e.d=s,e.e=u,e.c=l,e.b=c,e.a=f;var h=r(0),p=r(2),g=r(1);r(6)},function(t,e,r){"use strict";var i={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=9e4*a.samplesPerFrame/a.sampleRate,s=i+n*o,u={unit:e.subarray(r,r+a.frameLength),pts:s,dts:s};return t.config=[],t.channelCount=a.channelCount,t.samplerate=a.sampleRate,t.samples.push(u),t.len+=a.frameLength,{sample:u,length:a.frameLength}}}},parseHeader:function(t,e){var r=t[e+1]>>3&3,n=t[e+1]>>1&3,a=t[e+2]>>4&15,o=t[e+2]>>2&3,s=t[e+2]>>1&1;if(1!==r&&0!==a&&15!==a&&3!==o){var u=3===r?3-n:3===n?3:4,l=1e3*i.BitratesMap[14*u+a-1],c=3===r?0:2===r?1:2,d=i.SamplingRateMap[3*c+o],f=t[e+3]>>6==3?1:2,h=i.SamplesCoefficients[r][n],p=i.BytesInSlot[n],g=8*h*p;return{sampleRate:d,channelCount:f,frameLength:parseInt(h*l/d+s,10)*p,samplesPerFrame:g}}},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}};e.a=i},function(t,e,r){"use strict";var i={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}};e.a=i},function(t,e,r){"use strict";function i(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}function n(t,e){return l.a.search(t,function(t){return t.cc<e?1:t.cc>e?-1:0})}function a(t,e,r){var i=!1;return e&&e.details&&r&&(r.endCC>r.startCC||t&&t.cc<r.startCC)&&(i=!0),i}function o(t,e){var r=t.fragments,n=e.fragments;if(!n.length||!r.length)return void c.b.log("No fragments to align");var a=i(r,n[0].cc);return!a||a&&!a.startPTS?void c.b.log("No frag in previous level to align on"):a}function s(t,e){e.fragments.forEach(function(e){if(e){var r=e.start+t;e.start=e.startPTS=r,e.endPTS=r+e.duration}}),e.PTSKnown=!0}function u(t,e,r){if(a(t,e,r)){var i=o(e.details,r);i&&(c.b.log("Adjusting PTS using last level due to CC increase within current level"),s(i.start,r))}if(!1===r.PTSKnown&&e&&e.details&&e.details.fragments&&e.details.fragments.length){var n=e.details.programDateTime,u=r.programDateTime,l=(u-n)/1e3+e.details.fragments[0].start;isNaN(l)||(c.b.log("adjusting PTS using programDateTime delta, sliding:"+l.toFixed(3)),s(l,r))}}e.b=n,e.a=u;var l=r(9),c=r(0)},function(t,e,r){var i;!function(n){"use strict";function a(t,e){var r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r}function o(t,e){return t<<e|t>>>32-e}function s(t,e,r,i,n,s){return a(o(a(a(e,t),a(i,s)),n),r)}function u(t,e,r,i,n,a,o){return s(e&r|~e&i,t,e,n,a,o)}function l(t,e,r,i,n,a,o){return s(e&i|r&~i,t,e,n,a,o)}function c(t,e,r,i,n,a,o){return s(e^r^i,t,e,n,a,o)}function d(t,e,r,i,n,a,o){return s(r^(e|~i),t,e,n,a,o)}function f(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var r,i,n,o,s,f=1732584193,h=-271733879,p=-1732584194,g=271733878;for(r=0;r<t.length;r+=16)i=f,n=h,o=p,s=g,f=u(f,h,p,g,t[r],7,-680876936),g=u(g,f,h,p,t[r+1],12,-389564586),p=u(p,g,f,h,t[r+2],17,606105819),h=u(h,p,g,f,t[r+3],22,-1044525330),f=u(f,h,p,g,t[r+4],7,-176418897),g=u(g,f,h,p,t[r+5],12,1200080426),p=u(p,g,f,h,t[r+6],17,-1473231341),h=u(h,p,g,f,t[r+7],22,-45705983),f=u(f,h,p,g,t[r+8],7,1770035416),g=u(g,f,h,p,t[r+9],12,-1958414417),p=u(p,g,f,h,t[r+10],17,-42063),h=u(h,p,g,f,t[r+11],22,-1990404162),f=u(f,h,p,g,t[r+12],7,1804603682),g=u(g,f,h,p,t[r+13],12,-40341101),p=u(p,g,f,h,t[r+14],17,-1502002290),h=u(h,p,g,f,t[r+15],22,1236535329),f=l(f,h,p,g,t[r+1],5,-165796510),g=l(g,f,h,p,t[r+6],9,-1069501632),p=l(p,g,f,h,t[r+11],14,643717713),h=l(h,p,g,f,t[r],20,-373897302),f=l(f,h,p,g,t[r+5],5,-701558691),g=l(g,f,h,p,t[r+10],9,38016083),p=l(p,g,f,h,t[r+15],14,-660478335),h=l(h,p,g,f,t[r+4],20,-405537848),f=l(f,h,p,g,t[r+9],5,568446438),g=l(g,f,h,p,t[r+14],9,-1019803690),p=l(p,g,f,h,t[r+3],14,-187363961),h=l(h,p,g,f,t[r+8],20,1163531501),f=l(f,h,p,g,t[r+13],5,-1444681467),g=l(g,f,h,p,t[r+2],9,-51403784),p=l(p,g,f,h,t[r+7],14,1735328473),h=l(h,p,g,f,t[r+12],20,-1926607734),f=c(f,h,p,g,t[r+5],4,-378558),g=c(g,f,h,p,t[r+8],11,-2022574463),p=c(p,g,f,h,t[r+11],16,1839030562),h=c(h,p,g,f,t[r+14],23,-35309556),f=c(f,h,p,g,t[r+1],4,-1530992060),g=c(g,f,h,p,t[r+4],11,1272893353),p=c(p,g,f,h,t[r+7],16,-155497632),h=c(h,p,g,f,t[r+10],23,-1094730640),f=c(f,h,p,g,t[r+13],4,681279174),g=c(g,f,h,p,t[r],11,-358537222),p=c(p,g,f,h,t[r+3],16,-722521979),h=c(h,p,g,f,t[r+6],23,76029189),f=c(f,h,p,g,t[r+9],4,-640364487),g=c(g,f,h,p,t[r+12],11,-421815835),p=c(p,g,f,h,t[r+15],16,530742520),h=c(h,p,g,f,t[r+2],23,-995338651),f=d(f,h,p,g,t[r],6,-198630844),g=d(g,f,h,p,t[r+7],10,1126891415),p=d(p,g,f,h,t[r+14],15,-1416354905),h=d(h,p,g,f,t[r+5],21,-57434055),f=d(f,h,p,g,t[r+12],6,1700485571),g=d(g,f,h,p,t[r+3],10,-1894986606),p=d(p,g,f,h,t[r+10],15,-1051523),h=d(h,p,g,f,t[r+1],21,-2054922799),f=d(f,h,p,g,t[r+8],6,1873313359),g=d(g,f,h,p,t[r+15],10,-30611744),p=d(p,g,f,h,t[r+6],15,-1560198380),h=d(h,p,g,f,t[r+13],21,1309151649),f=d(f,h,p,g,t[r+4],6,-145523070),g=d(g,f,h,p,t[r+11],10,-1120210379),p=d(p,g,f,h,t[r+2],15,718787259),h=d(h,p,g,f,t[r+9],21,-343485551),f=a(f,i),h=a(h,n),p=a(p,o),g=a(g,s);return[f,h,p,g]}function h(t){var e,r="",i=32*t.length;for(e=0;e<i;e+=8)r+=String.fromCharCode(t[e>>5]>>>e%32&255);return r}function p(t){var e,r=[];for(r[(t.length>>2)-1]=void 0,e=0;e<r.length;e+=1)r[e]=0;var i=8*t.length;for(e=0;e<i;e+=8)r[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return r}function g(t){return h(f(p(t),8*t.length))}function v(t,e){var r,i,n=p(t),a=[],o=[];for(a[15]=o[15]=void 0,n.length>16&&(n=f(n,8*t.length)),r=0;r<16;r+=1)a[r]=909522486^n[r],o[r]=1549556828^n[r];return i=f(a.concat(p(e)),512+8*e.length),h(f(o.concat(i),640))}function y(t){var e,r,i="0123456789abcdef",n="";for(r=0;r<t.length;r+=1)e=t.charCodeAt(r),n+=i.charAt(e>>>4&15)+i.charAt(15&e);return n}function m(t){return unescape(encodeURIComponent(t))}function b(t){return g(m(t))}function E(t){return y(b(t))}function T(t,e){return v(m(t),m(e))}function S(t,e){return y(T(t,e))}function _(t,e,r){return e?r?T(e,t):S(e,t):r?b(t):E(t)}void 0!==(i=function(){return _}.call(e,r,e,t))&&(t.exports=i)}()},function(t,e,r){"use strict";function i(t,e){var r=null;try{r=new window.Event("addtrack")}catch(t){r=document.createEvent("Event"),r.initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)}function n(t){if(t&&t.cues)for(;t.cues.length>0;)t.removeCue(t.cues[0])}e.b=i,e.a=n},function(t,e,r){"use strict";function i(){var t=Object(n.a)(),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;return!!r&&!!i}e.a=i;var n=r(18)},function(t,e,r){"use strict";function i(){this.window=window,this.state="INITIAL",this.buffer="",this.decoder=new c,this.regionList=[]}function n(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]):r[1]>59?e(r[1],r[2],0,r[4]):e(0,r[1],r[2],r[4]):null}function a(){this.values=Object.create(null)}function o(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){var s=o[0],u=o[1];e(s,u)}}}function s(t,e,r){function i(){var e=n(t);if(null===e)throw new Error("Malformed timestamp: "+u);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function s(){t=t.replace(/^\s+/,"")}var u=t;if(s(),e.startTime=i(),s(),"--\x3e"!==t.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+u);t=t.substr(3),s(),e.endTime=i(),s(),function(t,e){var i=new a;o(t,function(t,e){switch(t){case"region":for(var n=r.length-1;n>=0;n--)if(r[n].id===e){i.set(t,r[n].region);break}break;case"vertical":i.alt(t,e,["rl","lr"]);break;case"line":var a=e.split(","),o=a[0];i.integer(t,o),i.percent(t,o)&&i.set("snapToLines",!1),i.alt(t,o,["auto"]),2===a.length&&i.alt("lineAlign",a[1],["start",f,"end"]);break;case"position":a=e.split(","),i.percent(t,a[0]),2===a.length&&i.alt("positionAlign",a[1],["start",f,"end","line-left","line-right","auto"]);break;case"size":i.percent(t,e);break;case"align":i.alt(t,e,["start",f,"end","left","right"])}},/:/,/\s/),e.region=i.get("region",null),e.vertical=i.get("vertical","");var n=i.get("line","auto");"auto"===n&&-1===d.line&&(n=-1),e.line=n,e.lineAlign=i.get("lineAlign","start"),e.snapToLines=i.get("snapToLines",!0),e.size=i.get("size",100),e.align=i.get("align",f);var s=i.get("position","auto");"auto"===s&&50===d.position&&(s="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=s}(t,e)}function u(t){return t.replace(/<br(?: \/)?>/gi,"\n")}r.d(e,"b",function(){return u});var l=r(78),c=function(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}};a.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]*)?%$/)&&(e=parseFloat(e))>=0&&e<=100)&&(this.set(t,e),!0)}};var d=new l.a(0,0,0),f="middle"===d.align?"middle":"center";i.prototype={parse:function(t){function e(){var t=r.buffer,e=0;for(t=u(t);e<t.length&&"\r"!==t[e]&&"\n"!==t[e];)++e;var i=t.substr(0,e);return"\r"===t[e]&&++e,"\n"===t[e]&&++e,r.buffer=t.substr(e),i}var r=this;t&&(r.buffer+=r.decoder.decode(t,{stream:!0}));try{var i=void 0;if("INITIAL"===r.state){if(!/\r\n|\n/.test(r.buffer))return this;i=e();var n=i.match(/^()?WEBVTT([ \t].*)?$/);if(!n||!n[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var a=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;switch(a?a=!1:i=e(),r.state){case"HEADER":/:/.test(i)?function(t){o(t,function(t,e){},/:/)}(i):i||(r.state="ID");continue;case"NOTE":i||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){r.state="NOTE";break}if(!i)continue;if(r.cue=new l.a(0,0,""),r.state="CUE",-1===i.indexOf("--\x3e")){r.cue.id=i;continue}case"CUE":try{s(i,r.cue,r.regionList)}catch(t){r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":var c=-1!==i.indexOf("--\x3e");if(!i||c&&(a=!0)){r.oncue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}r.cue.text&&(r.cue.text+="\n"),r.cue.text+=i;continue;case"BADCUE":i||(r.state="ID");continue}}}catch(t){"CUETEXT"===r.state&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state="INITIAL"===r.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{if(t.buffer+=t.decoder.decode(),(t.cue||"HEADER"===t.state)&&(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state)throw new Error("Malformed WebVTT signature.")}catch(t){throw t}return t.onflush&&t.onflush(),this}},e.a=i},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"b",function(){return h}),r.d(e,"a",function(){return p});var n=r(31),a=r.n(n),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},s=function(t){var e=t.method,r=void 0===e?"get":e,i=t.url,n=t.params,a=t.headers,s=void 0===a?{}:a,u=t.timeout,l=void 0===u?1e4:u;return new Promise(function(t,e){var a=new XMLHttpRequest;a.timeout=l,a.ontimeout=function(t){e({message:"ontimeout",readyState:a.readyState})},a.open(r,i),a.onload=function(){this.status>=200&&this.status<400?t(a.response):e({status:this.status,statusText:a.statusText,readyState:a.readyState,message:"onload"})},a.onerror=function(t){e({status:this.status,statusText:a.statusText,message:"onerror",readyState:a.readyState})},s&&Object.keys(s).forEach(function(t){a.setRequestHeader(t,s[t])});var u=n;u&&"object"===(void 0===u?"undefined":o(u))&&(u=Object.keys(u).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(u[t])}).join("&")),a.send(n)})},u={tizen:"tizen",webOS:"webOS",browser:"browser"},l=window.hasOwnProperty("tizen")?u.tizen:window.hasOwnProperty("webOS")?u.webOS:u.browser,c={OS:l,tizen:window.hasOwnProperty("tizen"),webOS:!window.hasOwnProperty("tizen")&&window.hasOwnProperty("webOS"),DEFINE_PLATFORM_NAME:u},d="https://screen.gviet.vn:4443",f={SECRET_KEY_CLIENT:c.tizen?"3w3vAxNe3L4fCRc7DCZZGqQ5rmZanh":c.webOS?"UAf94gT92wErLDDbn3edP4f3asdbta":"3w3vAxNe3L4fCRc7DCZZGqQ5rmZanh",PLATFORM:c.tizen?4:c.webOS?5:4},h={NONE:4,LOCK:1,UNLOCK:0,START_PING:3,PING:2,END_PING:5,STOP_PING:6,RESET_PING:7,CHANGE_TIME:8},p={STATE_INIT:0,STATE_PLAY:1,STATE_STOP:2},g={timeInterval:0,lastTime:0,deltaTime:0,deltaTimeStart:0,count:0,usePing:!1,pingUrl:d,screenSession:null,message:null,isFirst:!0,isPing:!1,isLock:!1,requestId:null,signature:null,signatureVerify:null,clientId:"",jwtToken:""},v=function(){function t(e){i(this,t),this.hls=e||null,this.session=null,this.secretKey=f.SECRET_KEY_CLIENT,this.platform=f.PLATFORM,this._init(),this._resetState(),this.current=!0,this.timer=null}return t.getInstance=function(e){return this._instance||(this._instance=new t(e)),this._instance},t.clear=function(){this._instance&&(this._instance.destroy(),delete this._instance)},t.prototype._setCallbackIntervalMS=function(t){this._removeCallbackIntervalMS(),this.timer=setInterval(this.doPing.bind(this),1e3*t)},t.prototype._removeCallbackIntervalMS=function(t){null!==this.timer&&(clearInterval(this.timer),this.timer=null)},t.prototype._init=function(){var t=this;Object.keys(g).map(function(e,r){return t[e]=g[e],null})},t.prototype._resetState=function(){this.lastTime=Date.now(),this.isFirst=!0,this.isPing=!1,this.isLock=!1,this.screenSession=null,this.message=null,this.count=0,this.requestId=null,this.signature=null,this.signatureVerify=null},t.prototype.setClientId=function(t){return this.clientId=t,this},t.prototype.setJwtToken=function(t){return this.jwtToken=t,this},t.prototype.setUsePing=function(t){return this.usePing=t,this},t.prototype._checkVerify=function(){return!(null===this.hls||!this.usePing||null===this.jwtToken||null===this.clientId)},t.prototype.checkDoPing=function(){if(this._checkVerify()){this.deltaTime=Date.now()-this.lastTime;var t=this.timeInterval>0?this.timeInterval:5;this._removeCallbackIntervalMS(),this.doPing(),this._setCallbackIntervalMS(t)}},t.prototype.doPing=function(){var t=this;if(this._checkVerify()&&!this.isPing){this._sendData(this.isFirst?h.START_PING:h.PING);this.isFirst;this.requestId=""+Date.now();var e=this.isFirst?"":this.screenSession,r=[this.clientId,this.jwtToken,this.requestId,this.platform,e,this.secretKey].join("$");this.signature=a()(r);var i=this.isFirst?d+"/startWatching":d+"/watching",n={clientId:this.clientId,jwtToken:this.jwtToken,session:e,requestId:this.requestId,platform:this.platform,signature:this.signature};s({url:i,params:JSON.stringify(n),method:"POST",headers:{"Content-Type":"application/json"}}).then(function(e){t.isPing=!1,t.isFirst&&(t.isFirst=!1);var r="",i="",n=0,o=null;try{o=JSON.parse(e)}catch(t){}if(null!==o){t.message=o.message||"";var s=-1;if(t.screenSession=o.session,i=o.signature,r=o.requestId,s=Number(o.ec),(n=o.interval)>0&&n!==t.timeInterval){t.timeInterval=Number(n);var u=Date.now()-Number(t.lastTime);if(u>1e3*n)t.checkDoPing();else{var l=t.timeInterval>0?t.timeInterval:30;t._setCallbackIntervalMS(l)}}var c=[s,t.timeInterval,t.screenSession,r,t.secretKey].join("$");if(t.signatureVerify=a()(c),t.signatureVerify===i)switch(s){case 200:t.isPing=!1,t.isFirst=!1,t.count=0;break;default:t._lockPlayer()}else t.message="DM1",t._lockPlayer()}else t.message="DM2",t._lockPlayer()}).catch(function(e){t._removeCallbackIntervalMS(e),t.message="",t.isPing=!1})}},t.prototype.endPing=function(){this.requestId=""+Date.now();var t=this.screenSession,e=[this.clientId,this.jwtToken,this.requestId,this.platform,t,this.secretKey].join("$");this.signature=a()(e);var r={clientId:this.clientId,jwtToken:this.jwtToken,session:t,requestId:this.requestId,platform:this.platform,signature:this.signature};s({url:"https://screen.gviet.vn:4443/stopWatching",params:JSON.stringify(r),method:"POST",headers:{"Content-Type":"application/json"}})},t.prototype._lockPlayer=function(){this.usePing&&(this.isLock=!0,this.isFirst=!0,this.isPing=!1,this._sendData(h.LOCK),this._removeCallbackIntervalMS())},t.prototype._sendData=function(t){var e={status:t,message:this.message,interval:this.timeInterval,session:this.screenSession};switch(t){case h.NONE:e.statusName="None";break;case h.START_PING:e.statusName="StartPing";break;case h.PING:e.statusName="DoPing";break;case h.LOCK:e.statusName="Lock";break;case h.UNLOCK:e.statusName="UnLock";break;case h.END_PING:e.statusName="EndPing";break;case h.STOP_PING:e.statusName="StopPing";break;case h.RESET_PING:e.statusName="ResetPing";break;case h.CHANGE_TIME:e.statusName="ChangeTime"}null!==this.hls&&this.hls.onDataPing&&this.hls.onDataPing(e)},t.prototype.destroy=function(){this._removeCallbackIntervalMS(),this.current=!1,this._resetState()},t.prototype.startPing=function(){this.checkDoPing()},t.prototype.stopPing=function(){if(this._checkVerify())return void this.endPing();this.destroy()},t.prototype.resetMultiscreen=function(){this._checkVerify()&&this.stopPing(),this.destroy()},t}(),y=function(){function t(e){i(this,t),this.hls=e,this.sigmaMS||(this.sigmaMS=v.getInstance(this.hls))}return t.getInstance=function(e){return this._instance||(this._instance=new t(e)),this._instance},t.clear=function(){this._instance&&(v.clear(),this._instance.sigmaMS=null,this._instance.destroy(),delete this._instance)},t.prototype.destroy=function(){this.sigmaMS&&(this.sigmaMS.destroy(),delete this.sigmaMS)},t.prototype.setClientId=function(t){this.sigmaMS.setClientId(t)},t.prototype.setJwtToken=function(t){this.sigmaMS.setJwtToken(t)},t.prototype.setUsePing=function(t){this.sigmaMS.setUsePing(t)},t.prototype.changeState=function(t){switch(t){case p.STATE_INIT:this.sigmaMS.resetMultiscreen();break;case p.STATE_PLAY:this.sigmaMS.startPing();break;case p.STATE_STOP:this.sigmaMS.stopPing()}},t}();e.c=y},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}Object.defineProperty(e,"__esModule",{value:!0});var o=r(5),s=r.n(o),u=r(20),l=r(1),c=r(4),d=r(33),f=r(2),h=r(8),p=r(35),g=r(88),v=r(0),y=r(17);r.d(e,"LicenseMethod",function(){return c.a}),r.d(e,"SigmaEvent",function(){return c.b});var m=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),b=function(t){function e(r){i(this,e);var a=n(this,t.call(this));return a.nativeReady=!1,h.a.getInstance().on(c.b.NATIVE_INITED,function(){a.nativeReady=!0,a.hlsConfig.enableWorker||y.a.getInstance().init({}),a.url&&a._initHlsWithSource(a.url,a.drmInfo)}),a}return a(e,t),e.isSupported=function(){return Object(d.a)()},m(e,null,[{key:"version",get:function(){return"0.10.1"}},{key:"Events",get:function(){return l.a}},{key:"DrmMethod",get:function(){return c.a}},{key:"ErrorTypes",get:function(){return f.b}},{key:"ErrorDetails",get:function(){return f.a}}]),e.prototype.handleEvent=function(){var t=this;for(var e in l.a)!function(e){t.hls.on(l.a[e],function(r,i,n){v.b.track(e,r,i,n),t.emit(l.a[e],[r,i,n])})}(e)},e.prototype.setAudioTrack=function(t){this.audioTrack=t},e.prototype.setAuthenToken=function(t){h.a.getInstance().token=t},e.prototype.loadSource=function(t,e){if(Object(d.a)())t&&t.length>0&&this.url!=t&&(this._destroyHls(),this.url=t,this.drmInfo=e,h.a.getInstance().isNativeInited&&this._initHlsWithSource(t,e));else{this.video.childNodes.length>0&&this.video.removeChild(this.video.childNodes[0]);var r=document.createElement("source");r.src=t,this.video.appendChild(r)}},e.prototype._initHlsWithSource=function(t,e){var r=this;this.hls=new u.a(this.hlsConfig),this.hls.on(l.a.AUDIO_TRACKS_UPDATED,function(){null!=r.audioTrack&&(r.hls.audioTrack=r.audioTrack)}),h.a.getInstance().clientInfo.hasOwnProperty("client-id")&&p.c.getInstance(this.hls).setClientId(h.a.getInstance().clientInfo["client-id"]),this.handleEvent(),this.hls.setJwtToken(e.jwtToken),h.a.getInstance().configKey(e),this.hls.loadSource(t,e.jwtToken),this.hls.attachMedia(this.video),this.url=null},e.prototype._destroyHls=function(){this.url=null,this.hls&&(h.a.getInstance().closeSession(),this.removeAllListeners(),this.hls.destroy())},e.prototype.destroy=function(){this._destroyHls(),h.a.getInstance().removeAllListeners()},m(e,[{key:"mediaElm",set:function(t){this.video=t}},{key:"config",set:function(t){this.hlsConfig=t||{},this.hlsConfig.debug=g.a}},{key:"nativeClient",set:function(t){this.nativeConfig=t,h.a.getInstance().nativeInfo=this.nativeConfig}},{key:"appInfo",set:function(t){h.a.getInstance().clientInfo=t}}]),e}(s.a);e.default=b},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(7),a=r.n(n),o=r(12),s=r(23),u=r(38),l=r(0),c=r(24),d=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,f=/#EXT-X-MEDIA:(.*)/g,h=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)(\S+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),p=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(STREAM-DENIED):(.*))|(?:#EXT-X-(STREAM-MEDIA-ID):(\w+))|(?:#EXT-X-(STREAM-SIGNAL):(\w+))|(?:#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?/,g=/\.(mp4|m4s|m4v|m4a)$/i,v=function(){function t(){i(this,t)}return t.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},t.convertAVC1ToAVCOTI=function(t){var e=void 0,r=t.split(".");return r.length>2?(e=r.shift()+".",e+=parseInt(r.shift()).toString(16),e+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):e=t,e},t.resolve=function(t,e){return a.a.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(e,r){var i=[],n=void 0;for(d.lastIndex=0;null!=(n=d.exec(e));){var a={},o=a.attrs=new u.a(n[1]);a.url=t.resolve(n[2],r);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,function(t,e){["video","audio"].forEach(function(r){var i=t.filter(function(t){return Object(c.b)(t,r)});if(i.length){var n=i.filter(function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)});e[r+"Codec"]=n.length>0?n[0]:i[0],t=t.filter(function(t){return-1===i.indexOf(t)})}}),e.unknownCodecs=t}([].concat((o.CODECS||"").split(/[ ,]+/)),a),a.videoCodec&&-1!==a.videoCodec.indexOf("avc1")&&(a.videoCodec=t.convertAVC1ToAVCOTI(a.videoCodec)),i.push(a)}return i},t.parseMasterPlaylistMedia=function(e,r,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=void 0,o=[],s=0;for(f.lastIndex=0;null!==(a=f.exec(e));){var l={},c=new u.a(a[1]);if(c.TYPE===i){if(l.groupId=c["GROUP-ID"],l.name=c.NAME,l.type=i,l.default="YES"===c.DEFAULT,l.autoselect="YES"===c.AUTOSELECT,l.forced="YES"===c.FORCED,c.URI&&(l.url=t.resolve(c.URI,r)),l.lang=c.LANGUAGE,l.name||(l.name=l.lang),n.length){var d=t.findGroup(n,l.groupId);l.audioCodec=d?d.codec:n[0].codec}l.id=s++,o.push(l)}}return o},t.parseLevelPlaylist=function(t,e,r,i,n){var a=0,c=0,d={type:null,version:null,url:e,fragments:[],live:!0,startSN:0},f=new s.a,v=0,y=null,m=new o.a,b=void 0,E=void 0;for(h.lastIndex=0;null!==(b=h.exec(t));){var T=b[1];if(T){m.duration=parseFloat(T);var S=(" "+b[2]).slice(1);m.title=S||null,m.tagList.push(S?["INF",T,S]:["INF",T])}else if(b[3]){if(!isNaN(m.duration)){var _=a++;m.type=i,m.start=c,m.levelkey=f,m.sn=_,m.level=r,m.cc=v,m.urlId=n,m.baseurl=e,m.relurl=(" "+b[3]).slice(1),d.programDateTime&&(y?m.rawProgramDateTime?m.pdt=Date.parse(m.rawProgramDateTime):m.pdt=y.pdt+1e3*y.duration:m.pdt=Date.parse(d.programDateTime),m.endPdt=m.pdt+1e3*m.duration),d.fragments.push(m),y=m,c+=m.duration,m=new o.a}}else if(b[4]){if(m.rawByteRange=(" "+b[4]).slice(1),y){var A=y.byteRangeEndOffset;A&&(m.lastByteRangeEndOffset=A)}}else if(b[5])m.rawProgramDateTime=(" "+b[5]).slice(1),m.tagList.push(["PROGRAM-DATE-TIME",m.rawProgramDateTime]),void 0===d.programDateTime&&(d.programDateTime=new Date(new Date(Date.parse(b[5]))-1e3*c));else{for(b=b[0].match(p),E=1;E<b.length&&void 0===b[E];E++);var R=(" "+b[E+1]).slice(1),w=(" "+b[E+2]).slice(1);switch(b[E]){case"#":m.tagList.push(w?[R,w]:[R]);break;case"PLAYLIST-TYPE":d.type=R.toUpperCase();break;case"MEDIA-SEQUENCE":a=d.startSN=parseInt(R);break;case"TARGETDURATION":d.targetduration=parseFloat(R);break;case"VERSION":d.version=parseInt(R);break;case"EXTM3U":break;case"ENDLIST":d.live=!1;break;case"DIS":v++,m.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":v=parseInt(R);break;case"KEY":var I=R,L=new u.a(I),k=L.enumeratedString("METHOD"),D=L.URI,O=L.hexadecimalInteger("IV");k&&(f=new s.a,D&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(k)>=0&&(d.encryptionKeyUri=D,f.method=k,f.baseuri=e,f.reluri=D,f.key=null,f.iv=O));break;case"START":var P=R,C=new u.a(P),M=C.decimalFloatingPoint("TIME-OFFSET");isNaN(M)||(d.startTimeOffset=M);break;case"MAP":var N=new u.a(R);m.relurl=N.URI,m.rawByteRange=N.BYTERANGE,m.baseurl=e,m.level=r,m.type=i,m.sn="initSegment",d.initSegment=m,m=new o.a;break;case"STREAM-MEDIA-ID":""!==R&&(d.sigma=R);break;case"STREAM-DENIED":""!==R&&(d.sigmaDenied=R);break;case"STREAM-SIGNAL":""!==R&&(d.sigmaSignature=R);break;default:l.b.warn("line parsed but not handled: "+b)}}}return m=y,m&&!m.relurl&&(d.fragments.pop(),c-=m.duration),d.totalduration=c,d.averagetargetduration=c/d.fragments.length,d.endSN=a-1,d.startCC=d.fragments[0]?d.fragments[0].cc:0,d.endCC=v,!d.initSegment&&d.fragments.length&&d.fragments.every(function(t){return g.test(t.relurl)})&&(l.b.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),m=new o.a,m.relurl=d.fragments[0].relurl,m.baseurl=e,m.level=r,m.type=i,m.sn="initSegment",d.initSegment=m,d.needSidxRanges=!0),d},t}();e.a=v},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=/^(\d+)x(\d+)$/,a=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,o=function(){function t(e){i(this,t),"string"==typeof e&&(e=t.parseAttrList(e));for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r])}return t.prototype.decimalInteger=function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},t.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},t.prototype.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},t.prototype.decimalFloatingPoint=function(t){return parseFloat(this[t])},t.prototype.enumeratedString=function(t){return this[t]},t.prototype.decimalResolution=function(t){var e=n.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},t.parseAttrList=function(t){var e=void 0,r={};for(a.lastIndex=0;null!==(e=a.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},t}();e.a=o},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(3),u=r(2),l=r(0),c=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.FRAG_LOADING));return a.loaders={},a}return a(e,t),e.prototype.destroy=function(){var e=this.loaders;for(var r in e){var i=e[r];i&&i.destroy()}this.loaders={},t.prototype.destroy.call(this)},e.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&&(l.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=void 0,c=void 0,d=void 0;u={url:e.url,frag:e,responseType:"arraybuffer",progressData:!1};var f=e.byteRangeStartOffset,h=e.byteRangeEndOffset;isNaN(f)||isNaN(h)||(u.rangeStart=f,u.rangeEnd=h),c={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:n.fragLoadingMaxRetryTimeout},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},s.load(u,c,d)},e.prototype.loadsuccess=function(t,e,r){var i=arguments.length>3&&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(o.a.FRAG_LOADED,{payload:n,frag:a,stats:e,networkDetails:i})},e.prototype.loaderror=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(o.a.ERROR,{type:u.b.NETWORK_ERROR,details:u.a.FRAG_LOAD_ERROR,fatal:!1,frag:e.frag,response:t,networkDetails:r})},e.prototype.loadtimeout=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=e.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(o.a.ERROR,{type:u.b.NETWORK_ERROR,details:u.a.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e.frag,networkDetails:r})},e.prototype.loadprogress=function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=e.frag;n.loaded=t.loaded,this.hls.trigger(o.a.FRAG_LOAD_PROGRESS,{frag:n,stats:t,networkDetails:i})},e}(s.a);e.a=c},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(3),u=r(2),l=r(0),c=r(8),d=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.KEY_LOADING));return a.loaders={},a.decryptkey=null,a.decrypturl=null,a}return a(e,t),e.prototype.destroy=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={},s.a.prototype.destroy.call(this)},e.prototype.onKeyLoading=function(t){c.a.getInstance().accquireProvision()?this.loadProvision(t):this.loadLicense(t)},e.prototype.onProvisionDone=function(t,e){var r=t.byteLength,i=Module._malloc(r),n=new Uint8Array(t);Module.HEAP8.set(n,i),Module.ccall("provideProvision",null,["number","number"],[i,r]),Module._free(i),this.loadLicense(e)},e.prototype.loadProvision=function(t){var e=this,r=c.a.getInstance().provisionRequest(),i=this.hls.config,n=new i.loader(i),a=void 0,s=void 0,l=void 0;s={timeout:i.fragLoadingTimeOut,maxRetry:i.fragLoadingMaxRetry,retryDelay:i.fragLoadingRetryDelay,maxRetryDelay:i.fragLoadingMaxRetryTimeout},l={onSuccess:function(t,r,i){var n=new Uint8Array(t.data);e.onProvisionDone(n,i.keyData)},onError:function(r,i){var n=t.frag;e.hls.trigger(o.a.ERROR,{type:u.b.NETWORK_ERROR,details:u.a.KEY_LOAD_ERROR,fatal:!1,frag:n,response:r})},onTimeout:function(r,i){var n=t.frag;e.hls.trigger(o.a.ERROR,{type:u.b.NETWORK_ERROR,details:u.a.KEY_LOAD_TIMEOUT,fatal:!1,frag:n})}},a={keyData:t,url:r.uri,responseType:"arraybuffer",body:r.payload,requestHeader:{"Content-Type":"application/json"}},n.load(a,s,l)},e.prototype.loadLicense=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||c.a.getInstance().accquireLicense(a)){var s=this.hls.config;i&&(l.b.warn("abort previous key loader for type:"+r),i.abort()),e.loader=this.loaders[r]=new s.loader(s),this.decrypturl=a,this.decryptkey=null;var u=void 0,d=void 0,f=void 0;d={timeout:s.fragLoadingTimeOut,maxRetry:s.fragLoadingMaxRetry,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};var h=c.a.getInstance().initSession(a),p=c.a.getInstance().licenseRequest(a);u={url:a,frag:e,sessionId:h,responseType:"arraybuffer",body:p.body,requestHeader:p.header},e.loader.load(u,d,f)}else this.decryptkey&&(n.key=this.decryptkey,this.hls.trigger(o.a.KEY_LOADED,{frag:e}))},e.prototype.loadsuccess=function(t,e,r){var i=r.frag;this.decryptkey=i.decryptdata.key=r.sessionId,c.a.getInstance().provideKeyResponse(r.url,new Uint8Array(t.data)),i.loader=void 0,this.loaders[i.type]=void 0,this.hls.trigger(o.a.KEY_LOADED,{frag:i})},e.prototype.loaderror=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(o.a.ERROR,{type:u.b.NETWORK_ERROR,details:u.a.KEY_LOAD_ERROR,fatal:!1,frag:r,response:t})},e.prototype.loadtimeout=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(o.a.ERROR,{type:u.b.NETWORK_ERROR,details:u.a.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},e}(s.a);e.a=d},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(42),s=r(4),u=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),l=function(t){function e(){i(this,e);var r=n(this,t.call(this));return r._initNatived=!1,r}return a(e,t),e.prototype.setClientInfo=function(t){this.appInfo=t},e.prototype.getClientInfo=function(){return this.appInfo},e.prototype.setNativeInfo=function(t){if("function"==typeof importScripts)importScripts(t.wasmBaseUrl+t.module);else if("undefined"==typeof Module||!Module.locateFile){var e=document.createElement("script");e.type="text/javascript","undefined"==typeof Module?e.innerText='var Module = {"locateFile": function(file){return "__BASE_URL__" + file }};'.replace("__BASE_URL__",t.wasmBaseUrl):e.innerText='Module["locateFile"] = function(file){return "__BASE_URL__" + file };'.replace("__BASE_URL__",t.wasmBaseUrl),document.head.appendChild(e),e=document.createElement("script"),e.type="text/javascript",e.src=t.wasmBaseUrl+t.module,document.head.appendChild(e)}var r=this;Module&&!Module.onNativeLoaded&&(Module.onNativeLoaded=function(){r._initNative()})},e.prototype.sessionInfo=function(t,e){var r=null;this.sessionId&&(r=Module.ccall("sessionInfo","string",["string"],[t])),e(r)},e.prototype._accquireProvision=function(){return Module.ccall("accquireProvision","bool",null,null)},e.prototype._provisionRequest=function(){var t=Module._malloc(2048),e=Module.ccall("getProvision","number",["number"],[t]),r=new Uint8Array(e);r.set(Module.HEAPU8.subarray(t,t+e)),Module._free(t);var i=new TextDecoder("utf-8"),n=i.decode(r),a=JSON.parse(n);return{uri:a.uri,payload:atob(a.payload)}},e.prototype._licenseBody=function(t){var e=Module._malloc(4096),r=Module.ccall("getKeyRequest","number",["number"],[e]),i=new Uint8Array(r);return i.set(Module.HEAPU8.subarray(e,e+r)),Module._free(e),i},e.prototype._licenseHeader=function(){var t={merchantId:this.appInfo.merchantId,appId:this.appInfo.appId,sessionId:this.appInfo.sessionId,userId:this.appInfo.userId},e=JSON.stringify(t);return{"custom-data":btoa(e),"Content-Type":"application/octet-stream"}},e.prototype._initNative=function(){this.nativeObj=Module.ccall("allocDrm","number",null,null),this._initNatived=!0,this.emit(s.b.NATIVE_INITED)},e.prototype._isNativeInited=function(){return this._initNatived},e.prototype._initSession=function(t){return this.sessionId=Module.ccall("createSession","string",["string"],[t]),this.sessionId},e.prototype._closeSession=function(){return this.sessionId=Module.ccall("closeSession","string",["string"],null),this.sessionId},e.prototype._provideLicense=function(t,e){var r=e.byteLength,i=Module._malloc(r),n=new Uint8Array(e);Module.HEAP8.set(n,i),Module.ccall("provideKeyResponse",null,["number","number"],[i,r]),Module._free(i)},e.prototype._accquireLicense=function(t){return Module.ccall("accquireLicense","bool",["string"],[t])},u(e,[{key:"token",set:function(t){this.accessToken=t},get:function(){return this.accessToken}}]),e}(o.a);e.a=l},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(5),s=r.n(o),u=r(4),l=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),c=function(t){function e(){return i(this,e),n(this,t.call(this))}return a(e,t),e.prototype.setClientInfo=function(t){},e.prototype.getClientInfo=function(){return null},e.prototype.setToken=function(t){},e.prototype.getToken=function(){return null},e.prototype.setNativeInfo=function(t){},e.prototype.getNativeInfo=function(){return null},e.prototype.configKey=function(t){this.config=t},e.prototype.licenseRequest=function(t){var e=this.config||{},r=e.method||u.a.CLEAR;switch(r){case u.a.CLEAR:return{method:"GET"};case u.a.SIGMA:return{method:"POST",body:this._licenseBody(t),header:this._licenseHeader(r)}}return null},e.prototype.sessionInfo=function(t,e){},e.prototype._licenseBody=function(t){return null},e.prototype._licenseHeader=function(){return{}},e.prototype._isNativeInited=function(){return!0},e.prototype._accquireProvision=function(){return!1},e.prototype._accquireLicense=function(t){return!1},e.prototype._initSession=function(t){},e.prototype._closeSession=function(){},e.prototype._provideLicense=function(t,e){},l(e,[{key:"clientInfo",set:function(t){this.setClientInfo(t)},get:function(){return this.getClientInfo()}},{key:"token",set:function(t){this.setToken(t)},get:function(){return this.getToken()}},{key:"nativeInfo",set:function(t){this.setNativeInfo(t)},get:function(){return this.getNativeInfo()}},{key:"isNativeInited",get:function(){return this._isNativeInited()}}]),e}(s.a);e.a=c},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(9),s=r(14),u=r(25),l=r(1),c=r(13),d=r(12),f=r(21),h=r(19),p=r(29),g=r(2),v=r(0),y=r(30),m=r(11),b=r(62),E=r(31),T=r.n(E),S=r(63),_=(r.n(S),function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}()),A={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_LEVEL:"WAITING_LEVEL",PARSING:"PARSING",PARSED:"PARSED",BUFFER_FLUSHING:"BUFFER_FLUSHING",ENDED:"ENDED",ERROR:"ERROR"},R=function(t){function e(r,a){i(this,e);var o=n(this,t.call(this,r,l.a.MEDIA_ATTACHED,l.a.MEDIA_DETACHING,l.a.MANIFEST_LOADING,l.a.MANIFEST_PARSED,l.a.LEVEL_LOADED,l.a.KEY_LOADED,l.a.FRAG_LOADED,l.a.FRAG_LOAD_EMERGENCY_ABORTED,l.a.FRAG_PARSING_INIT_SEGMENT,l.a.FRAG_PARSING_DATA,l.a.FRAG_PARSED,l.a.ERROR,l.a.AUDIO_TRACK_SWITCHING,l.a.AUDIO_TRACK_SWITCHED,l.a.BUFFER_CREATED,l.a.BUFFER_APPENDED,l.a.BUFFER_FLUSHED,l.a.SIGMA_FINGER_PRINT));return o.fragmentTracker=a,o.config=r.config,o.audioCodecSwap=!1,o._state=A.STOPPED,o.stallReported=!1,o}return a(e,t),e.prototype.onHandlerDestroying=function(){this.stopLoad(),t.prototype.onHandlerDestroying.call(this)},e.prototype.onHandlerDestroyed=function(){this.state=A.STOPPED,this.fragmentTracker=null,t.prototype.onHandlerDestroyed.call(this)},e.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}e>0&&-1===t&&(v.b.log("override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=A.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this.forceStartLoad=!0,this.state=A.STOPPED},e.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=A.STOPPED,this.forceStartLoad=!1},e.prototype.doTick=function(){switch(this.state){case A.BUFFER_FLUSHING:this.fragLoadError=0;break;case A.IDLE:this._doTickIdle();break;case A.WAITING_LEVEL:var t=this.levels[this.level];t&&t.details&&(this.state=A.IDLE);break;case A.FRAG_LOADING_WAITING_RETRY:var e=window.performance.now(),r=this.retryDate;(!r||e>=r||this.media&&this.media.seeking)&&(v.b.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=A.IDLE);break;case A.ERROR:case A.STOPPED:case A.FRAG_LOADING:case A.PARSING:case A.PARSED:case A.ENDED:}this._checkBuffer(),this._checkFragmentChanged()},e.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,u=void 0;u=o?Math.max(8*e.maxBufferSize/o,e.maxBufferLength):e.maxBufferLength,u=Math.min(u,e.maxMaxBufferLength);var c=s.a.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,i,e.maxBufferHole),d=c.len;if(!(d>=u)){v.b.trace("buffer length of "+d.toFixed(3)+" is below max of "+u.toFixed(3)+". checking for more payload ..."),this.level=t.nextLoadLevel=n;var f=a.details;if(!f||f.live&&this.levelLastLoaded!==n)return void(this.state=A.WAITING_LEVEL);var h=this.fragPrevious;if(!f.live&&h&&!h.backtracked&&h.sn===f.endSN&&!c.nextStart){if(Math.min(r.duration,h.start+h.duration)-Math.max(c.end,h.start)<=Math.max(.2,h.duration)){var p={};return this.altAudio&&(p.type="video"),this.hls.trigger(l.a.BUFFER_EOS,p),void(this.state=A.ENDED)}}this._fetchPayloadOrEos(i,c,f)}}}},e.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 v.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?(v.b.log("Loading key for "+c.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+n),this._loadKey(c)):(v.b.log("Loading "+c.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+n+", currentTime:"+t.toFixed(3)+",bufferEnd:"+l.toFixed(3)),this._loadFragment(c)))}},e.prototype._ensureFragmentAtLivePoint=function(t,e,r,i,n,a,s){var u=this.hls.config,l=this.media,c=void 0,d=void 0!==u.liveMaxLatencyDuration?u.liveMaxLatencyDuration:u.liveMaxLatencyDurationCount*t.targetduration;if(e<Math.max(r-u.maxFragLookUpTolerance,i-d)){var f=this.liveSyncPosition=this.computeLivePosition(r,t);v.b.log("buffer end: "+e.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+f.toFixed(3)),e=f,l&&l.readyState&&l.duration>f&&(l.currentTime=f),this.nextLoadPosition=f}if(t.PTSKnown&&e>i&&l&&l.readyState)return null;if(this.startFragRequested&&!t.PTSKnown){if(n)if(t.programDateTime)c=Object(b.b)(a,n.endPdt+1);else{var h=n.sn+1;if(h>=t.startSN&&h<=t.endSN){var p=a[h-t.startSN];n.cc===p.cc&&(c=p,v.b.log("live playlist, switching playlist, load frag with next SN: "+c.sn))}c||(c=o.a.search(a,function(t){return n.cc-t.cc}))&&v.b.log("live playlist, switching playlist, load frag with same CC: "+c.sn)}c||(c=a[Math.min(s-1,Math.round(s/2))],v.b.log("live playlist, switching playlist, unknown, load middle frag : "+c.sn))}return c},e.prototype._findFragment=function(t,e,r,i,n,a,o){var s=this.hls.config,u=void 0,l=void 0;if(n<a?o.programDateTime?(l=Object(b.b)(i,Object(b.a)(t,n,o)))&&!Object(b.d)(n,s.maxFragLookUpTolerance,l)||(v.b.warn("Frag found by PDT search did not fit within tolerance; falling back to finding by SN"),l=function(){return Object(b.c)(e,i,n,a,s.maxFragLookUpTolerance)}()):l=Object(b.c)(e,i,n,a,s.maxFragLookUpTolerance):l=i[r-1],l){u=l;var c=u.sn-o.startSN,d=e&&u.level===e.level,f=i[c-1],h=i[c+1];if(e&&u.sn===e.sn)if(d&&!u.backtracked)if(u.sn<o.endSN){var p=e.deltaPTS;p&&p>s.maxBufferHole&&e.dropped&&c?(u=f,v.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=h,v.b.log("SN just loaded, load next one: "+u.sn))}else u=null;else u.backtracked&&(h&&h.backtracked?(v.b.warn("Already backtracked from fragment "+h.sn+", will not backtrack to fragment "+u.sn+". Loading fragment "+h.sn),u=h):(v.b.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),u.dropped=0,f?(u=f,u.backtracked=!0):c&&(u=null)))}return u},e.prototype._loadKey=function(t){this.state=A.KEY_LOADING,this.hls.trigger(l.a.KEY_LOADING,{frag:t})},e.prototype._loadFragment=function(t){var e=this.fragmentTracker.getState(t);this.fragCurrent=t,this.startFragRequested=!0,isNaN(t.sn)||t.bitrateTest||(this.nextLoadPosition=t.start+t.duration),t.backtracked||e===c.a.NOT_LOADED||e===c.a.PARTIAL?(t.autoLevel=this.hls.autoLevelEnabled,t.bitrateTest=this.bitrateTest,this.hls.trigger(l.a.FRAG_LOADING,{frag:t}),this.demuxer||(this.demuxer=new u.a(this.hls,"main")),this.state=A.FRAG_LOADING):e===c.a.APPENDING&&this._reduceMaxBufferLength(t.duration)&&this.fragmentTracker.removeFragment(t)},e.prototype.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,f.a.LevelType.MAIN)},e.prototype.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.endPTS+.5):null},e.prototype._checkFragmentChanged=function(){var t=void 0,e=void 0,r=this.media;if(r&&r.readyState&&!1===r.seeking&&(e=r.currentTime,e>this.lastCurrentTime&&(this.lastCurrentTime=e),s.a.isBuffered(r,e)?t=this.getBufferedFrag(e):s.a.isBuffered(r,e+.1)&&(t=this.getBufferedFrag(e+.1)),t)){var i=t;if(i!==this.fragPlaying){this.hls.trigger(l.a.FRAG_CHANGED,{frag:i});var n=i.level;this.fragPlaying&&this.fragPlaying.level===n||this.hls.trigger(l.a.LEVEL_SWITCHED,{level:n}),this.fragPlaying=i}}},e.prototype.immediateLevelSwitch=function(){if(v.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)},e.prototype.immediateLevelSwitchEnd=function(){var t=this.media;t&&t.buffered.length&&(this.immediateSwitch=!1,s.a.isBuffered(t,t.currentTime)&&(t.currentTime-=1e-4),this.previouslyPaused||t.play())},e.prototype.nextLevelSwitch=function(){var t=this.media;if(t&&t.readyState){var e=void 0,r=void 0,i=void 0;if(r=this.getBufferedFrag(t.currentTime),r&&r.startPTS>1&&this.flushMainBuffer(0,r.startPTS-1),t.paused)e=0;else{var n=this.hls.nextLoadLevel,a=this.levels[n],o=this.fragLastKbps;e=o&&this.fragCurrent?this.fragCurrent.duration*a.bitrate/(1e3*o)+1:0}if((i=this.getBufferedFrag(t.currentTime+e))&&(i=this.followingBufferedFrag(i))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(i.maxStartPTS,Number.POSITIVE_INFINITY)}}},e.prototype.flushMainBuffer=function(t,e){this.state=A.BUFFER_FLUSHING;var r={startOffset:t,endOffset:e};this.altAudio&&(r.type="video"),this.hls.trigger(l.a.BUFFER_FLUSHING,r)},e.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)},e.prototype.onMediaDetaching=function(){var t=this.media;t&&t.ended&&(v.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()},e.prototype.onMediaSeeking=function(){var t=this.media,e=t?t.currentTime:void 0,r=this.config;isNaN(e)||v.b.log("media seeking to "+e.toFixed(3));var i=this.mediaBuffer?this.mediaBuffer:t,n=s.a.bufferInfo(i,e,this.config.maxBufferHole);if(this.state===A.FRAG_LOADING){var a=this.fragCurrent;if(0===n.len&&a){var o=r.maxFragLookUpTolerance,u=a.start-o,l=a.start+a.duration+o;e<u||e>l?(a.loader&&(v.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=A.IDLE):v.b.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===A.ENDED&&(0===n.len&&(this.fragPrevious=0),this.state=A.IDLE);t&&(this.lastCurrentTime=e),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=e),this.tick()},e.prototype.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:void 0;isNaN(e)||v.b.log("media seeked to "+e.toFixed(3)),this.tick()},e.prototype.onMediaEnded=function(){v.b.log("media ended"),this.startPosition=this.lastCurrentTime=0},e.prototype.onManifestLoading=function(){v.b.log("trigger BUFFER_RESET"),this.hls.trigger(l.a.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},e.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&&v.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)},e.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(v.b.log("level "+r+" loaded ["+e.startSN+","+e.endSN+"],duration:"+a),e.live){var s=n.details;s&&e.fragments.length>0?(h.b(s,e),o=e.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),e.PTSKnown&&!isNaN(o)?v.b.log("live playlist sliding:"+o.toFixed(3)):(v.b.log("live playlist - outdated PTS, unknown sliding"),Object(y.a)(this.fragPrevious,i,e))):(v.b.log("live playlist - first load, unknown sliding"),e.PTSKnown=!1,Object(y.a)(this.fragPrevious,i,e))}else e.PTSKnown=!1;if(n.details=e,this.levelLastLoaded=r,this.hls.trigger(l.a.LEVEL_UPDATED,{details:e,level:r}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var u=e.startTimeOffset;isNaN(u)?e.live?(this.startPosition=this.computeLivePosition(o,e),v.b.log("configure startPosition to "+this.startPosition)):this.startPosition=0:(u<0&&(v.b.log("negative start time offset "+u+", count from end of last fragment"),u=o+a+u),v.b.log("start time offset found in playlist, adjust startPosition to "+u),this.startPosition=u),this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===A.WAITING_LEVEL&&(this.state=A.IDLE),this.tick()},e.prototype.onKeyLoaded=function(){this.state===A.KEY_LOADING&&(this.state=A.IDLE,this.tick())},e.prototype.onsigmaHlsFingerPrint=function(t){if(t.sigma&&t.sigmaDenied&&t.sigmaSignature&&t.encryptionKeyUri&&this.hls&&this.hls.config.sigmaDrmUrls&&this.hls.config.sigmaUid)for(var e=t.sigma,r=t.sigmaDenied,i=t.sigmaSignature,n=t.encryptionKeyUri,a=this.hls.config,o=a.sigmaDrmUrls,s=a.sigmaUid,u="Ul7x22jKG=oFuYAgS",l=t.startSN,c=0;c<o.length;c++){var d=o[c];if(0===n.indexOf(d))if(""===e||""===r||""===i)this._sentEvent({name:"denied",msg:"denied-1"});else{var f=!1,h=T()(u+":"+l+":0");if(e.toLowerCase()===h.toLowerCase())this._sentEvent({name:"hideInfo"});else{var p=T()(u+":"+l+":1");e.toLowerCase()===p.toLowerCase()?this._sentEvent({name:"showInfo"}):(this._sentEvent({name:"denied",msg:"denied-2"}),f=!0)}if(!f){var g=T()(u+":"+l+":"+r);if(g.toLowerCase()===i.toLowerCase()){var v=""+S.Base64.decode(r,!1);if(v.length>0)for(var y=v.split(","),m=0;m<y.length;m++){var b=y[m];b===s&&this._sentEvent({name:"denied",msg:"denied-3"}),f=!0}}else this._sentEvent({name:"denied",msg:"denied-4"}),f=!0}}}},e.prototype._sentEvent=function(t){this.hls&&this.hls.trigger(l.a.SIGMA_FINGER_PRINT,{data:t})},e.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag;if(this.state===A.FRAG_LOADING&&e&&"main"===r.type&&r.level===e.level&&r.sn===e.sn){var i=t.stats,n=this.levels[e.level],a=n.details;if(v.b.log("Loaded "+e.sn+" of ["+a.startSN+" ,"+a.endSN+"],level "+e.level),this.bitrateTest=!1,this.stats=i,!0===r.bitrateTest&&this.hls.nextLoadLevel)this.state=A.IDLE,this.startFragRequested=!1,i.tparsed=i.tbuffered=window.performance.now(),this.hls.trigger(l.a.FRAG_BUFFERED,{stats:i,frag:e,id:"main"}),this.tick();else if("initSegment"===r.sn)this.state=A.IDLE,i.tparsed=i.tbuffered=window.performance.now(),a.initSegment.data=t.payload,this.hls.trigger(l.a.FRAG_BUFFERED,{stats:i,frag:e,id:"main"}),this.tick();else{this.state=A.PARSING;var o=a.totalduration,s=e.level,c=e.sn,d=this.config.defaultAudioCodec||n.audioCodec;this.onsigmaHlsFingerPrint(a),this.audioCodecSwap&&(v.b.log("swapping playlist audio codec"),void 0===d&&(d=this.lastAudioCodec),d&&(d=-1!==d.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingBuffering=!0,this.appended=!1,v.b.log("Parsing "+c+" of ["+a.startSN+" ,"+a.endSN+"],level "+s+", cc "+e.cc);var f=this.demuxer;f||(f=this.demuxer=new u.a(this.hls,"main"));var h=this.media,p=h&&h.seeking,g=!p&&(a.PTSKnown||!a.live),y=a.initSegment?a.initSegment.data:[];f.push(t.payload,y,d,n.videoCodec,e,o,g,void 0)}}this.fragLoadError=0},e.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===A.PARSING){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&&(v.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",v.b.log("Android: force audio codec to "+o)),a.levelCodec=o,a.id=t.id}a=i.video,a&&(a.levelCodec=this.levels[this.level].videoCodec,a.id=t.id),this.hls.trigger(l.a.BUFFER_CODECS,i);for(n in i){a=i[n],v.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(l.a.BUFFER_APPENDING,{type:n,data:u,parent:"main",content:"initSegment"}))}this.tick()}},e.prototype.onFragParsingData=function(t){var e=this,r=this.fragCurrent,i=t.frag;if(r&&"main"===t.id&&i.sn===r.sn&&i.level===r.level&&("audio"!==t.type||!this.altAudio)&&this.state===A.PARSING){var n=this.levels[this.level],a=r;if(isNaN(t.endPTS)&&(t.endPTS=t.startPTS+r.duration,t.endDTS=t.startDTS+r.duration),!0===t.hasAudio&&a.addElementaryStream(d.a.ElementaryStreamTypes.AUDIO),!0===t.hasVideo&&a.addElementaryStream(d.a.ElementaryStreamTypes.VIDEO),v.b.log("Parsed "+t.type+",PTS:["+t.startPTS.toFixed(3)+","+t.endPTS.toFixed(3)+"],DTS:["+t.startDTS.toFixed(3)+"/"+t.endDTS.toFixed(3)+"],nb:"+t.nb+",dropped:"+(t.dropped||0)),"video"===t.type)if(a.dropped=t.dropped,a.dropped)if(a.backtracked)v.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 v.b.warn("missing video frame(s), backtracking fragment",a.sn),this.fragmentTracker.removeFragment(a),a.backtracked=!0,this.nextLoadPosition=t.startPTS,this.state=A.IDLE,this.fragPrevious=a,void this.tick();v.b.warn("missing video frame(s) on first frag, appending with gap",a.sn)}else a.backtracked=!1;var s=h.c(n.details,a,t.startPTS,t.endPTS,t.startDTS,t.endDTS),u=this.hls;u.trigger(l.a.LEVEL_PTS_UPDATED,{details:n.details,level:this.level,drift:s,type:t.type,start:t.startPTS,end:t.endPTS}),[t.data1,t.data2].forEach(function(r){r&&r.length&&e.state===A.PARSING&&(e.appended=!0,e.pendingBuffering=!0,u.trigger(l.a.BUFFER_APPENDING,{type:t.type,data:r,parent:"main",content:"data"}))}),this.tick()}},e.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===A.PARSING&&(this.stats.tparsed=window.performance.now(),this.state=A.PARSED,this._checkAppendedParsed())},e.prototype.onAudioTrackSwitching=function(t){var e=!!t.url,r=t.id;if(!e){if(this.mediaBuffer!==this.media){v.b.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i.loader&&(v.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=A.IDLE}var n=this.hls;n.trigger(l.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),n.trigger(l.a.AUDIO_TRACK_SWITCHED,{id:r}),this.altAudio=!1}},e.prototype.onAudioTrackSwitched=function(t){var e=t.id,r=!!this.hls.audioTracks[e].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(v.b.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()},e.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?(i=a,r=o,"video"===a&&(this.videoBuffer=e[a].buffer)):n=!0}n&&r?(v.b.log("alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},e.prototype.onBufferAppended=function(t){if("main"===t.parent){var e=this.state;e!==A.PARSING&&e!==A.PARSED||(this.pendingBuffering=t.pending>0,this._checkAppendedParsed())}},e.prototype._checkAppendedParsed=function(){if(!(this.state!==A.PARSED||this.appended&&this.pendingBuffering)){var t=this.fragCurrent;if(t){var e=this.mediaBuffer?this.mediaBuffer:this.media;v.b.log("main buffered : "+p.a.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(l.a.FRAG_BUFFERED,{stats:r,frag:t,id:"main"}),this.state=A.IDLE}this.tick()}},e.prototype.onError=function(t){var e=t.frag||this.fragCurrent;if(!e||"main"===e.type){var r=!!this.media&&s.a.isBuffered(this.media,this.media.currentTime)&&s.a.isBuffered(this.media,this.media.currentTime+.5);switch(t.details){case g.a.FRAG_LOAD_ERROR:case g.a.FRAG_LOAD_TIMEOUT:case g.a.KEY_LOAD_ERROR:case g.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);v.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=A.FRAG_LOADING_WAITING_RETRY}else v.b.error("mediaController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=A.ERROR;break;case g.a.LEVEL_LOAD_ERROR:case g.a.LEVEL_LOAD_TIMEOUT:this.state!==A.ERROR&&(t.fatal?(this.state=A.ERROR,v.b.warn("streamController: "+t.details+",switch to "+this.state+" state ...")):t.levelRetry||this.state!==A.WAITING_LEVEL||(this.state=A.IDLE));break;case g.a.BUFFER_FULL_ERROR:"main"!==t.parent||this.state!==A.PARSING&&this.state!==A.PARSED||(r?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=A.IDLE):(v.b.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},e.prototype._reduceMaxBufferLength=function(t){var e=this.config;return e.maxMaxBufferLength>=t&&(e.maxMaxBufferLength/=2,v.b.warn("main:reduce max buffer length to "+e.maxMaxBufferLength+"s"),!0)},e.prototype._checkBuffer=function(){var t=this.config,e=this.media;if(e&&0!==e.readyState){var r=e.currentTime,i=this.mediaBuffer?this.mediaBuffer:e,n=i.buffered;if(!this.loadedmetadata&&n.length)this.loadedmetadata=!0,this._seekToStartPos();else if(this.immediateSwitch)this.immediateLevelSwitchEnd();else{var a=!(e.paused&&e.readyState>1||e.ended||0===e.buffered.length),o=window.performance.now();if(r!==this.lastCurrentTime)this.stallReported&&(v.b.warn("playback not stuck anymore @"+r+", after "+Math.round(o-this.stalled)+"ms"),this.stallReported=!1),this.stalled=null,this.nudgeRetry=0;else if(a){var u=o-this.stalled,l=s.a.bufferInfo(e,r,t.maxBufferHole);if(!this.stalled)return void(this.stalled=o);u>=1e3&&this._reportStall(l.len),this._tryFixBufferStall(l,u)}}}},e.prototype.onFragLoadEmergencyAborted=function(){this.state=A.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},e.prototype.onBufferFlushed=function(){var t=this.mediaBuffer?this.mediaBuffer:this.media;t&&this.fragmentTracker.detectEvictedFragments(d.a.ElementaryStreamTypes.VIDEO,t.buffered),this.state=A.IDLE,this.fragPrevious=null},e.prototype.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},e.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)},e.prototype._tryFixBufferStall=function(t,e){var r=this.config,i=this.media,n=i.currentTime,a=this.fragmentTracker.getPartialFragment(n);a&&this._trySkipBufferHole(a),t.len>.5&&e>1e3*r.highBufferWatchdogPeriod&&(this.stalled=null,this._tryNudgeBuffer())},e.prototype._reportStall=function(t){var e=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,v.b.warn("Playback stalling at @"+r.currentTime+" due to low buffer"),e.trigger(l.a.ERROR,{type:g.b.MEDIA_ERROR,details:g.a.BUFFER_STALLED_ERROR,fatal:!1,buffer:t}))},e.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(i>=n&&i<o)return r.currentTime=Math.max(o,r.currentTime+.1),v.b.warn("skipping hole, adjusting currentTime from "+i+" to "+r.currentTime),this.stalled=null,void e.trigger(l.a.ERROR,{type:g.b.MEDIA_ERROR,details:g.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)}},e.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,n<t.nudgeMaxRetry){var a=i+n*t.nudgeOffset;v.b.log("adjust currentTime from "+i+" to "+a),r.currentTime=a,e.trigger(l.a.ERROR,{type:g.b.MEDIA_ERROR,details:g.a.BUFFER_NUDGE_ON_STALL,fatal:!1})}else v.b.error("still stuck in high buffer @"+i+" after "+t.nudgeMaxRetry+", raise fatal error"),e.trigger(l.a.ERROR,{type:g.b.MEDIA_ERROR,details:g.a.BUFFER_STALLED_ERROR,fatal:!0})},e.prototype._seekToStartPos=function(){var t=this.media,e=t.currentTime,r=t.seeking?e:this.startPosition;e!==r&&(v.b.log("target start position not buffered, seek to buffered.start(0) "+r+" from current time "+e+" "),t.currentTime=r)},_(e,[{key:"state",set:function(t){if(this.state!==t){var e=this.state;this._state=t,v.b.log("main stream:"+e+"->"+t),this.hls.trigger(l.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}}]),e}(m.a);e.a=R},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(e,r){i(this,t),this.subtle=e,this.aesIV=r}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}();e.a=n},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(e,r){i(this,t),this.subtle=e,this.key=r}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}();e.a=n},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t){var e=t.byteLength,r=e&&new DataView(t).getUint8(e-1);return r?t.slice(0,e-r):t}var a=function(){function t(){i(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,g=0;for(g=0;g<256;g++)f[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,t[h]=v,e[v]=h;var y=f[h],m=f[y],b=f[m],E=257*f[v]^16843008*v;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[v]=E<<24|E>>>8,l[v]=E<<16|E>>>16,c[v]=E<<8|E>>>24,d[v]=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],g=f[2],v=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=m<<8|m>>>24,m=c[m>>>24]<<24|c[m>>>16&255]<<16|c[m>>>8&255]<<8|c[255&m],m^=d[o/n|0]<<24):n>6&&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]]^g[c[m>>>8&255]]^v[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 a=this.keySize+6,o=this.invKeySchedule,s=this.invSBox,u=this.invSubMix,l=u[0],c=u[1],d=u[2],f=u[3],h=this.uint8ArrayToUint32Array_(r),p=h[0],g=h[1],v=h[2],y=h[3],m=new Int32Array(t),b=new Int32Array(m.length),E=void 0,T=void 0,S=void 0,_=void 0,A=void 0,R=void 0,w=void 0,I=void 0,L=void 0,k=void 0,D=void 0,O=void 0,P=void 0,C=void 0,M=this.networkToHostOrderSwap;e<m.length;){for(L=M(m[e]),k=M(m[e+1]),D=M(m[e+2]),O=M(m[e+3]),A=L^o[0],R=O^o[1],w=D^o[2],I=k^o[3],P=4,C=1;C<a;C++)E=l[A>>>24]^c[R>>16&255]^d[w>>8&255]^f[255&I]^o[P],T=l[R>>>24]^c[w>>16&255]^d[I>>8&255]^f[255&A]^o[P+1],S=l[w>>>24]^c[I>>16&255]^d[A>>8&255]^f[255&R]^o[P+2],_=l[I>>>24]^c[A>>16&255]^d[R>>8&255]^f[255&w]^o[P+3],A=E,R=T,w=S,I=_,P+=4;E=s[A>>>24]<<24^s[R>>16&255]<<16^s[w>>8&255]<<8^s[255&I]^o[P],T=s[R>>>24]<<24^s[w>>16&255]<<16^s[I>>8&255]<<8^s[255&A]^o[P+1],S=s[w>>>24]<<24^s[I>>16&255]<<16^s[A>>8&255]<<8^s[255&R]^o[P+2],_=s[I>>>24]<<24^s[A>>16&255]<<16^s[R>>8&255]<<8^s[255&w]^o[P+3],P+=3,b[e]=M(E^p),b[e+1]=M(_^g),b[e+2]=M(S^v),b[e+3]=M(T^y),p=L,g=k,v=D,y=O,e+=4}return i?n(b.buffer):b.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}();e.a=a},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(27),a=r(0),o=r(10),s=function(){function t(e,r,n){i(this,t),this.observer=e,this.config=n,this.remuxer=r}return t.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}},t.prototype.resetTimeStamp=function(){},t.probe=function(t){if(!t)return!1;for(var e=o.a.getID3Data(t,0)||[],r=e.length,i=t.length;r<i;r++)if(n.e(t,r))return a.b.log("ADTS sync word found !"),!0;return!1},t.prototype.append=function(t,e,r,i){for(var s=this._audioTrack,u=o.a.getID3Data(t,0)||[],l=o.a.getTimeStamp(u),c=l?90*l:9e4*e,d=0,f=c,h=t.length,p=u.length,g=[{pts:f,dts:f,data:u}];p<h-1;)if(n.d(t,p)&&p+5<h){n.c(s,this.observer,t,p,s.manifestCodec);var v=n.a(s,t,p,c,d);if(!v){a.b.log("Unable to parse AAC frame");break}p+=v.length,f=v.sample.pts,d++}else o.a.isHeader(t,p)?(u=o.a.getID3Data(t,p),g.push({pts:f,dts:f,data:u}),p+=u.length):p++;this.remuxer.remux(s,{samples:[]},{samples:g,inputTimeScale:9e4},{samples:[]},e,r,i)},t.prototype.destroy=function(){},t}();e.a=s},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(27),a=r(28),o=r(1),s=r(49),u=r(50),l=r(0),c=r(2),d={video:1,audio:2,id3:3,text:4},f=function(){function t(e,r,n,a){i(this,t),this.observer=e,this.config=n,this.typeSupported=a,this.remuxer=r,this.sampleAes=null}return t.prototype.setDecryptData=function(t){null!=t&&null!=t.key&&"SAMPLE-AES"===t.method?this.sampleAes=new u.a(this.observer,this.config,t,this.discardEPB):this.sampleAes=null},t.probe=function(e){var r=t._syncOffset(e);return!(r<0)&&(r&&l.b.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),!0)},t._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},t.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:d[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}},t.prototype.resetInitSegment=function(e,r,i,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=t.createTrack("video",n),this._audioTrack=t.createTrack("audio",n),this._id3Track=t.createTrack("id3",n),this._txtTrack=t.createTrack("text",n),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=r,this.videoCodec=i,this._duration=n},t.prototype.resetTimeStamp=function(){},t.prototype.append=function(e,r,i,n){var a=void 0,s=e.length,u=void 0,d=void 0,f=void 0,h=void 0,p=!1;this.contiguous=i;var g=this.pmtParsed,v=this._avcTrack,y=this._audioTrack,m=this._id3Track,b=v.pid,E=y.pid,T=m.pid,S=this._pmtId,_=v.pesData,A=y.pesData,R=m.pesData,w=this._parsePAT,I=this._parsePMT,L=this._parsePES,k=this._parseAVCPES.bind(this),D=this._parseAACPES.bind(this),O=this._parseMPEGPES.bind(this),P=this._parseID3PES.bind(this),C=t._syncOffset(e);for(s-=(s+C)%188,a=C;a<s;a+=188)if(71===e[a]){if(u=!!(64&e[a+1]),d=((31&e[a+1])<<8)+e[a+2],(48&e[a+3])>>4>1){if((f=a+5+e[a+4])===a+188)continue}else f=a+4;switch(d){case b:u&&(_&&(h=L(_))&&void 0!==h.pts&&k(h,!1),_={data:[],size:0}),_&&(_.data.push(e.subarray(f,a+188)),_.size+=a+188-f);break;case E:u&&(A&&(h=L(A))&&void 0!==h.pts&&(y.isAAC?D(h):O(h)),A={data:[],size:0}),A&&(A.data.push(e.subarray(f,a+188)),A.size+=a+188-f);break;case T:u&&(R&&(h=L(R))&&void 0!==h.pts&&P(h),R={data:[],size:0}),R&&(R.data.push(e.subarray(f,a+188)),R.size+=a+188-f);break;case 0:u&&(f+=e[f]+1),S=this._pmtId=w(e,f);break;case S:u&&(f+=e[f]+1);var M=I(e,f,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);b=M.avc,b>0&&(v.pid=b),E=M.audio,E>0&&(y.pid=E,y.isAAC=M.isAAC),T=M.id3,T>0&&(m.pid=T),p&&!g&&(l.b.log("reparse from beginning"),p=!1,a=C-188),g=this.pmtParsed=!0;break;case 17:case 8191:break;default:p=!0}}else this.observer.trigger(o.a.ERROR,{type:c.b.MEDIA_ERROR,details:c.a.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});_&&(h=L(_))&&void 0!==h.pts?(k(h,!0),v.pesData=null):v.pesData=_,A&&(h=L(A))&&void 0!==h.pts?(y.isAAC?D(h):O(h),y.pesData=null):(A&&A.size&&l.b.log("last AAC PES packet truncated,might overlap between fragments"),y.pesData=A),R&&(h=L(R))&&void 0!==h.pts?(P(h),m.pesData=null):m.pesData=R,null==this.sampleAes?this.remuxer.remux(y,v,m,this._txtTrack,r,i,n):this.decryptAndRemux(y,v,m,this._txtTrack,r,i,n)},t.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)},t.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)},t.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},t.prototype._parsePAT=function(t,e){return(31&t[e+10])<<8|t[e+11]},t.prototype._parsePMT=function(t,e,r,i){var n=void 0,a=void 0,o=void 0,s=void 0,u={audio:-1,avc:-1,id3:-1,isAAC:!0};for(n=(15&t[e+1])<<8|t[e+2],a=e+3+n-4,o=(15&t[e+10])<<8|t[e+11],e+=12+o;e<a;){switch(s=(31&t[e+1])<<8|t[e+2],t[e]){case 207:if(!i){l.b.log("unkown stream type:"+t[e]);break}case 15:-1===u.audio&&(u.audio=s);break;case 21:-1===u.id3&&(u.id3=s);break;case 219:if(!i){l.b.log("unkown stream type:"+t[e]);break}case 27:-1===u.avc&&(u.avc=s);break;case 3:case 4:r?-1===u.audio&&(u.audio=s,u.isAAC=!1):l.b.log("MPEG audio found, not supported in this browser for now");break;case 36:l.b.warn("HEVC stream type found, not supported for now");break;default:l.b.log("unkown stream type:"+t[e])}e+=5+((15&t[e+3])<<8|t[e+4])}return u},t.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,c=void 0,d=t.data;if(!t||0===t.size)return null;for(;d[0].length<19&&d.length>1;){var f=new Uint8Array(d[0].length+d[1].length);f.set(d[0]),f.set(d[1],d[0].length),d[0]=f,d.splice(1,1)}if(r=d[0],1===(r[0]<<16)+(r[1]<<8)+r[2]){if((n=(r[4]<<8)+r[5])&&n>t.size-6)return null;i=r[7],192&i&&(s=536870912*(14&r[9])+4194304*(255&r[10])+16384*(254&r[11])+128*(255&r[12])+(254&r[13])/2,s>4294967295&&(s-=8589934592),64&i?(u=536870912*(14&r[14])+4194304*(255&r[15])+16384*(254&r[16])+128*(255&r[17])+(254&r[18])/2,u>4294967295&&(u-=8589934592),s-u>54e5&&(l.b.warn(Math.round((s-u)/9e4)+"s delta between PTS and DTS, align them"),s=u)):u=s),a=r[8],c=a+9,t.size-=c,o=new Uint8Array(t.size);for(var h=0,p=d.length;h<p;h++){r=d[h];var g=r.byteLength;if(c){if(c>g){c-=g;continue}r=r.subarray(c),g-=c,c=0}o.set(r,e),e+=g}return n&&(n-=a+3),{data:o,pts:s,dts:u,len:n}}return null},t.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&&l.b.log(t.pts+"/"+t.dts+":"+t.debug)},t.prototype._parseAVCPES=function(t,e){var r=this,i=this._avcTrack,n=this._parseAVCNALu(t.data),a=void 0,o=this.avcSample,u=void 0,l=!1,c=void 0,d=this.pushAccesUnit.bind(this),f=function(t,e,r,i){return{key:t,pts:e,dts:r,units:[],debug:i}};t.data=null,o&&n.length&&!i.audFound&&(d(o,i),o=this.avcSample=f(!1,t.pts,t.dts,"")),n.forEach(function(e){switch(e.type){case 1:u=!0,o||(o=r.avcSample=f(!0,t.pts,t.dts,"")),o.frame=!0;var n=e.data;if(l&&n.length>4){var h=new s.a(n).readSliceType();2!==h&&4!==h&&7!==h&&9!==h||(o.key=!0)}break;case 5:u=!0,o||(o=r.avcSample=f(!0,t.pts,t.dts,"")),o.key=!0,o.frame=!0;break;case 6:u=!0,a=new s.a(r.discardEPB(e.data)),a.readUByte();for(var p=0,g=0,v=!1,y=0;!v&&a.bytesAvailable>1;){p=0;do{y=a.readUByte(),p+=y}while(255===y);g=0;do{y=a.readUByte(),g+=y}while(255===y);if(4===p&&0!==a.bytesAvailable){v=!0;if(181===a.readUByte()){if(49===a.readUShort()){if(1195456820===a.readUInt()){if(3===a.readUByte()){var m=a.readUByte(),b=a.readUByte(),E=31&m,T=[m,b];for(c=0;c<E;c++)T.push(a.readUByte()),T.push(a.readUByte()),T.push(a.readUByte());r._insertSampleInOrder(r._txtTrack.samples,{type:3,pts:t.pts,bytes:T})}}}}}else if(g<a.bytesAvailable)for(c=0;c<g;c++)a.readUByte()}break;case 7:if(u=!0,l=!0,!i.sps){a=new s.a(e.data);var S=a.readSPS();i.width=S.width,i.height=S.height,i.pixelRatio=S.pixelRatio,i.sps=[e.data],i.duration=r._duration;var _=e.data.subarray(1,4),A="avc1.";for(c=0;c<3;c++){var R=_[c].toString(16);R.length<2&&(R="0"+R),A+=R}i.codec=A}break;case 8:u=!0,i.pps||(i.pps=[e.data]);break;case 9:u=!1,i.audFound=!0,o&&d(o,i),o=r.avcSample=f(!1,t.pts,t.dts,"");break;case 12:u=!1;break;default:u=!1,o&&(o.debug+="unknown NAL "+e.type+" ")}if(o&&u){o.units.push(e)}}),e&&o&&(d(o,i),this.avcSample=null)},t.prototype._insertSampleInOrder=function(t,e){var r=t.length;if(r>0){if(e.pts>=t[r-1].pts)t.push(e);else for(var i=r-1;i>=0;i--)if(e.pts<t[i].pts){t.splice(i,0,e);break}}else t.push(e)},t.prototype._getLastNalUnit=function(){var t=this.avcSample,e=void 0;if(!t||0===t.units.length){var r=this._avcTrack,i=r.samples;t=i[i.length-1]}if(t){var n=t.units;e=n[n.length-1]}return e},t.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=void 0,d=-1,f=void 0;for(-1===o&&(d=0,f=31&t[0],o=0,e=1);e<r;)if(i=t[e++],o)if(1!==o)if(i)if(1===i){if(d>=0)l={data:t.subarray(d,e-o-1),type:f},u.push(l);else{var h=this._getLastNalUnit();if(h&&(s&&e<=4-s&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-s)),(n=e-o-1)>0)){var p=new Uint8Array(h.data.byteLength+n);p.set(h.data,0),p.set(t.subarray(0,n),h.data.byteLength),h.data=p}}e<r?(c=31&t[e],d=e,f=c,o=0):o=-1}else o=0;else o=3;else o=i?0:2;else o=i?0:1;if(d>=0&&o>=0&&(l={data:t.subarray(d,r),type:f,state:o},u.push(l)),0===u.length){var g=this._getLastNalUnit();if(g){var v=new Uint8Array(g.data.byteLength+t.byteLength);v.set(g.data,0),v.set(t,g.data.byteLength),g.data=v}}return a.naluState=o,u},t.prototype.discardEPB=function(t){for(var e=t.byteLength,r=[],i=1,n=void 0,a=void 0;i<e-2;)0===t[i]&&0===t[i+1]&&3===t[i+2]?(r.push(i+2),i+=2):i++;if(0===r.length)return t;n=e-r.length,a=new Uint8Array(n);var o=0;for(i=0;i<n;o++,i++)o===r[0]&&(o++,r.shift()),a[i]=t[o];return a},t.prototype._parseAACPES=function(t){var e=this._audioTrack,r=t.data,i=t.pts,a=this.aacOverFlow,s=this.aacLastPTS,u=void 0,d=void 0,f=void 0,h=void 0,p=void 0;if(a){var g=new Uint8Array(a.byteLength+r.byteLength);g.set(a,0),g.set(r,a.byteLength),r=g}for(f=0,p=r.length;f<p-1&&!n.d(r,f);f++);if(f){var v=void 0,y=void 0;if(f<p-1?(v="AAC PES did not start with ADTS header,offset:"+f,y=!1):(v="no ADTS header found in AAC PES",y=!0),l.b.warn("parsing error:"+v),this.observer.trigger(o.a.ERROR,{type:c.b.MEDIA_ERROR,details:c.a.FRAG_PARSING_ERROR,fatal:y,reason:v}),y)return}if(n.c(e,this.observer,r,f,this.audioCodec),d=0,u=n.b(e.samplerate),a&&s){var m=s+u;Math.abs(m-i)>1&&(l.b.log("AAC: align PTS for overlapping frames by "+Math.round((m-i)/90)),i=m)}for(;f<p;)if(n.d(r,f)&&f+5<p){var b=n.a(e,r,f,i,d);if(!b)break;f+=b.length,h=b.sample.pts,d++}else f++;a=f<p?r.subarray(f,p):null,this.aacOverFlow=a,this.aacLastPTS=h},t.prototype._parseMPEGPES=function(t){for(var e=t.data,r=e.length,i=0,n=0,o=t.pts;n<r;)if(a.a.isHeader(e,n)){var s=a.a.appendFrame(this._audioTrack,e,n,o,i);if(!s)break;n+=s.length,i++}else n++},t.prototype._parseID3PES=function(t){this._id3Track.samples.push(t)},t}();e.a=f},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(0),a=function(){function t(e){i(this,t),this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}return t.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},t.prototype.skipBits=function(t){var e=void 0;this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,e=t>>3,t-=e>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},t.prototype.readBits=function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&n.b.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),e=t-e,e>0&&this.bitsAvailable?r<<e|this.readBits(e):r},t.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()},t.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},t.prototype.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},t.prototype.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},t.prototype.readBoolean=function(){return 1===this.readBits(1)},t.prototype.readUByte=function(){return this.readBits(8)},t.prototype.readUShort=function(){return this.readBits(16)},t.prototype.readUInt=function(){return this.readBits(32)},t.prototype.skipScalingList=function(t){var e=8,r=8,i=void 0,n=void 0;for(i=0;i<t;i++)0!==r&&(n=this.readEG(),r=(e+n+256)%256),e=0===r?e:r},t.prototype.readSPS=function(){var t=0,e=0,r=0,i=0,n=void 0,a=void 0,o=void 0,s=void 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),g=this.skipBits.bind(this),v=this.skipEG.bind(this),y=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);if(d(),n=d(),f(5),g(3),d(),y(),100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n){var b=h();if(3===b&&g(1),y(),y(),g(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(g(1),v(),v(),a=h(),c=0;c<a;c++)v();y(),g(1),o=h(),s=h(),u=f(1),0===u&&g(1),g(1),p()&&(t=h(),e=h(),r=h(),i=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*(o+1)-2*t-2*e),height:(2-u)*(s+1)*16-(u?2:4)*(r+i),pixelRatio:T}},t.prototype.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t}();e.a=a},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(16),a=function(){function t(e,r,a,o){i(this,t),this.decryptdata=a,this.discardEPB=o,this.decrypter=new n.a(e,r,{removePKCS7Padding:!1})}return t.prototype.decryptBuffer=function(t,e){this.decrypter.decrypt(t,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,e)},t.prototype.decryptAacSample=function(t,e,r,i){var n=t[e].unit,a=n.subarray(16,n.length-n.length%16),o=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),s=this;this.decryptBuffer(o,function(a){a=new Uint8Array(a),n.set(a,16),i||s.decryptAacSamples(t,e+1,r)})},t.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}}},t.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},t.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},t.prototype.decryptAvcSample=function(t,e,r,i,n,a){var o=this.discardEPB(n.data),s=this.getAvcEncryptedData(o),u=this;this.decryptBuffer(s.buffer,function(s){n.data=u.getAvcDecryptedUnit(o,s),a||u.decryptAvcSamples(t,e,r+1,i)})},t.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}}}},t}();e.a=a},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(10),a=r(0),o=r(28),s=function(){function t(e,r,n){i(this,t),this.observer=e,this.config=n,this.remuxer=r}return t.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}},t.prototype.resetTimeStamp=function(){},t.probe=function(t){var e=void 0,r=void 0,i=n.a.getID3Data(t,0);if(i&&void 0!==n.a.getTimeStamp(i))for(e=i.length,r=Math.min(t.length-1,e+100);e<r;e++)if(o.a.probe(t,e))return a.b.log("MPEG Audio sync word found !"),!0;return!1},t.prototype.append=function(t,e,r,i){for(var a=n.a.getID3Data(t,0),s=n.a.getTimeStamp(a),u=s?90*s:9e4*e,l=a.length,c=t.length,d=0,f=0,h=this._audioTrack,p=[{pts:u,dts:u,data:a}];l<c;)if(o.a.isHeader(t,l)){var g=o.a.appendFrame(h,t,l,u,d);if(!g)break;l+=g.length,f=g.sample.pts,d++}else n.a.isHeader(t,l)?(a=n.a.getID3Data(t,l),p.push({pts:f,dts:f,data:a}),l+=a.length):l++;this.remuxer.remux(h,{samples:[]},{samples:p,inputTimeScale:9e4},{samples:[]},e,r,i)},t.prototype.destroy=function(){},t}();e.a=s},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(53),a=r(54),o=r(1),s=r(2),u=r(0),l=function(){function t(e,r,n,a){i(this,t),this.observer=e,this.config=r,this.typeSupported=n;var o=navigator.userAgent;this.isSafari=a&&a.indexOf("Apple")>-1&&o&&!o.match("CriOS"),this.ISGenerated=!1}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(t){this._initPTS=this._initDTS=t},t.prototype.resetInitSegment=function(){this.ISGenerated=!1},t.prototype.remux=function(t,e,r,i,n,a,s){if(this.ISGenerated||this.generateIS(t,e,n),this.ISGenerated){var l=t.samples.length,c=e.samples.length,d=n,f=n;if(l&&c){var h=(t.samples[0].dts-e.samples[0].dts)/e.inputTimeScale;d+=Math.max(0,h),f+=Math.max(0,-h)}if(l){t.timescale||(u.b.warn("regenerate InitSegment as audio detected"),this.generateIS(t,e,n));var p=this.remuxAudio(t,d,a,s);if(c){var g=void 0;p&&(g=p.endPTS-p.startPTS),e.timescale||(u.b.warn("regenerate InitSegment as video detected"),this.generateIS(t,e,n)),this.remuxVideo(e,f,a,g,s)}}else if(c){var v=this.remuxVideo(e,f,a,0,s);v&&t.codec&&this.remuxEmptyAudio(t,d,a,v)}}r.samples.length&&this.remuxID3(r,n),i.samples.length&&this.remuxText(i,n),this.observer.trigger(o.a.FRAG_PARSED)},t.prototype.generateIS=function(t,e,r){var i=this.observer,n=t.samples,l=e.samples,c=this.typeSupported,d="audio/mp4",f={},h={tracks:f},p=void 0===this._initPTS,g=void 0,v=void 0;if(p&&(g=v=1/0),t.config&&n.length&&(t.timescale=t.samplerate,u.b.log("audio sampling rate : "+t.samplerate),t.isAAC||(c.mpeg?(d="audio/mpeg",t.codec=""):c.mp3&&(t.codec="mp3")),f.audio={container:d,codec:t.codec,initSegment:!t.isAAC&&c.mpeg?new Uint8Array:a.a.initSegment([t]),metadata:{channelCount:t.channelCount}},p&&(g=v=n[0].pts-t.inputTimeScale*r)),e.sps&&e.pps&&l.length){var y=e.inputTimeScale;e.timescale=y,f.video={container:"video/mp4",codec:e.codec,initSegment:a.a.initSegment([e]),metadata:{width:e.width,height:e.height}},p&&(g=Math.min(g,l[0].pts-y*r),v=Math.min(v,l[0].dts-y*r),this.observer.trigger(o.a.INIT_PTS_FOUND,{initPTS:g}))}Object.keys(f).length?(i.trigger(o.a.FRAG_PARSING_INIT_SEGMENT,h),this.ISGenerated=!0,p&&(this._initPTS=g,this._initDTS=Math.max(v,g))):i.trigger(o.a.ERROR,{type:s.b.MEDIA_ERROR,details:s.a.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},t.prototype.remuxVideo=function(t,e,r,i,n){var l=8,c=t.timescale,d=void 0,f=void 0,h=void 0,p=void 0,g=void 0,v=void 0,y=void 0,m=t.samples,b=[],E=m.length,T=this._PTSNormalize,S=this._initDTS,_=this.nextAvcDts,A=this.isSafari;if(0!==E){A&&(r|=m.length&&_&&(n&&Math.abs(e-_/c)<.1||Math.abs(m[0].pts-_-S)<c/5)),r||(_=e*c),m.forEach(function(t){t.pts=T(t.pts-S,_),t.dts=T(t.dts-S,_)}),m.sort(function(t,e){var r=t.dts-e.dts,i=t.pts-e.pts;return r||i||t.id-e.id});var R=m.reduce(function(t,e){return Math.max(Math.min(t,e.pts-e.dts),-18e3)},0);if(R<0){u.b.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(R/90)+" ms to overcome this issue");for(var w=0;w<m.length;w++)m[w].dts+=R}var I=m[0];g=Math.max(I.dts,0),p=Math.max(I.pts,0);var L=Math.round((g-_)/90);r&&L&&(L>1?console.log("AVC:"+L+" ms hole between fragments detected,filling it"):L<-1&&console.log("AVC:"+-L+" ms overlapping between fragments detected"),g=_,m[0].dts=g,p=Math.max(p-L,_),m[0].pts=p,console.log("Video/PTS/DTS adjusted: "+Math.round(p/90)+"/"+Math.round(g/90)+",delta:"+L+" ms")),g,I=m[m.length-1],y=Math.max(I.dts,0),v=Math.max(I.pts,0,y),A&&(d=Math.round((y-g)/(m.length-1)));for(var k=0,D=0,O=0;O<E;O++){for(var P=m[O],C=P.units,M=C.length,N=0,x=0;x<M;x++)N+=C[x].data.length;D+=N,k+=M,P.length=N,P.dts=A?g+O*d:Math.max(P.dts,g),P.pts=Math.max(P.pts,P.dts)}var F=D+4*k+8;try{f=new Uint8Array(F)}catch(t){return void this.observer.trigger(o.a.ERROR,{type:s.b.MUX_ERROR,details:s.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:F,reason:"fail allocating video mdat "+F})}var U=new DataView(f.buffer);U.setUint32(0,F),f.set(a.a.types.mdat,4);for(var B=0;B<E;B++){for(var G=m[B],j=G.units,K=0,H=void 0,W=0,V=j.length;W<V;W++){var Y=j[W],q=Y.data,X=Y.data.byteLength;U.setUint32(l,X),l+=4,f.set(q,l),l+=X,K+=4+X}if(A)H=Math.max(0,d*Math.round((G.pts-G.dts)/d));else{if(B<E-1)d=m[B+1].dts-G.dts;else{var z=this.config,Q=G.dts-m[B>0?B-1:B].dts;if(z.stretchShortVideoTrack){var J=z.maxBufferHole,Z=Math.floor(J*c),$=(i?p+i*c:this.nextAudioPts)-G.pts;$>Z?(d=$-Q,d<0&&(d=Q),u.b.log("It is approximately "+$/90+" ms to the next segment; using duration "+d/90+" ms for the last video frame.")):d=Q}else d=Q}H=Math.round(G.pts-G.dts)}b.push({size:K,duration:d,cts:H,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:G.key?2:1,isNonSync:G.key?0:1}})}this.nextAvcDts=y+d;var tt=t.dropped;if(t.len=0,t.nbNalu=0,t.dropped=0,b.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var et=b[0].flags;et.dependsOn=2,et.isNonSync=0}t.samples=b,h=a.a.moof(t.sequenceNumber++,g,t),t.samples=[];var rt={data1:h,data2:f,startPTS:p/c,endPTS:(v+d)/c,startDTS:g/c,endDTS:this.nextAvcDts/c,type:"video",hasAudio:!1,hasVideo:!0,nb:b.length,dropped:tt};return this.observer.trigger(o.a.FRAG_PARSING_DATA,rt),rt}},t.prototype.remuxAudio=function(t,e,r,i){var l=t.inputTimeScale,c=t.timescale,d=l/c,f=t.isAAC?1024:1152,h=f*d,p=this._PTSNormalize,g=this._initDTS,v=!t.isAAC&&this.typeSupported.mpeg,y=void 0,m=void 0,b=void 0,E=void 0,T=void 0,S=void 0,_=void 0,A=t.samples,R=[],w=this.nextAudioPts;if(r|=A.length&&w&&(i&&Math.abs(e-w/l)<.1||Math.abs(A[0].pts-w-g)<20*h),A.forEach(function(t){t.pts=t.dts=p(t.pts-g,e*l)}),A=A.filter(function(t){return t.pts>=0}),0!==A.length){if(r||(w=i?e*l:A[0].pts),t.isAAC)for(var I=this.config.maxAudioFramesDrift,L=0,k=w;L<A.length;){var D,O=A[L],P=O.pts;D=P-k;var C=Math.abs(1e3*D/l);if(0==L&&this.observer.trigger("sigma_log","Remux Audio: "+D+"::"+C+"::"+h+"::"+I),D<=-I*h)u.b.warn("Dropping 1 audio frame @ "+(k/l).toFixed(3)+"s due to "+Math.round(C)+" ms overlap."),A.splice(L,1),t.len-=O.unit.length;else if(D>=I*h&&C<1e4&&k){var M=Math.round(D/h);u.b.warn("Injecting "+M+" audio frame @ "+(k/l).toFixed(3)+"s due to "+Math.round(1e3*D/l)+" ms gap.");for(var N=0;N<M;N++){var x=Math.max(k,0);b=n.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),b||(u.b.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),b=O.unit.subarray()),A.splice(L,0,{unit:b,pts:x,dts:x}),t.len+=b.length,k+=h,L++}O.pts=O.dts=k,k+=h,L++}else Math.abs(D),O.pts=O.dts=k,k+=h,L++}for(var F=0,U=A.length;F<U;F++){var B=A[F],G=B.unit,j=B.pts;if(void 0!==_)m.duration=Math.round((j-_)/d);else{var K=Math.round(1e3*(j-w)/l),H=0;if(r&&t.isAAC&&K){if(K>0&&K<1e4)H=Math.round((j-w)/h),u.b.log(K+" ms hole between AAC samples detected,filling it"),H>0&&(b=n.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),b||(b=G.subarray()),t.len+=H*b.length);else if(K<-12){u.b.log("drop overlapping AAC sample, expected/parsed/delta:"+(w/l).toFixed(3)+"s/"+(j/l).toFixed(3)+"s/"+-K+"ms"),t.len-=G.byteLength;continue}j=w}if(S=j,!(t.len>0))return;var W=v?t.len:t.len+8;y=v?0:8;try{E=new Uint8Array(W)}catch(t){return void this.observer.trigger(o.a.ERROR,{type:s.b.MUX_ERROR,details:s.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:W,reason:"fail allocating audio mdat "+W})}if(!v){new DataView(E.buffer).setUint32(0,W),E.set(a.a.types.mdat,4)}for(var V=0;V<H;V++)b=n.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount),b||(u.b.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),b=G.subarray()),E.set(b,y),y+=b.byteLength,m={size:b.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},R.push(m)}E.set(G,y);var Y=G.byteLength;y+=Y,m={size:Y,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},R.push(m),_=j}var q=0,X=R.length;if(X>=2&&(q=R[X-2].duration,m.duration=q),X){this.nextAudioPts=w=_+d*q,t.len=0,t.samples=R,T=v?new Uint8Array:a.a.moof(t.sequenceNumber++,S/d,t),t.samples=[];var z=S/l,Q=w/l,J={data1:T,data2:E,startPTS:z,endPTS:Q,startDTS:z,endDTS:Q,type:"audio",hasAudio:!0,hasVideo:!1,nb:X};return this.observer.trigger(o.a.FRAG_PARSING_DATA,J),J}return null}},t.prototype.remuxEmptyAudio=function(t,e,r,i){var a=t.inputTimeScale,o=t.samplerate?t.samplerate:a,s=a/o,l=this.nextAudioPts,c=(void 0!==l?l:i.startDTS*a)+this._initDTS,d=i.endDTS*a+this._initDTS,f=1024*s,h=Math.ceil((d-c)/f),p=n.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(u.b.warn("remux empty Audio"),!p)return void u.b.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var g=[],v=0;v<h;v++){var y=c+v*f;g.push({unit:p,pts:y,dts:y}),t.len+=p.length}t.samples=g,this.remuxAudio(t,e,r)},t.prototype.remuxID3=function(t,e){var r=t.samples.length,i=void 0,n=t.inputTimeScale,a=this._initPTS,s=this._initDTS;if(r){for(var u=0;u<r;u++)i=t.samples[u],i.pts=(i.pts-a)/n,i.dts=(i.dts-s)/n;this.observer.trigger(o.a.FRAG_PARSING_METADATA,{samples:t.samples})}t.samples=[],e=e},t.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 s=0;s<r;s++)i=t.samples[s],i.pts=(i.pts-a)/n;this.observer.trigger(o.a.FRAG_PARSING_USERDATA,{samples:t.samples})}t.samples=[],e=e},t.prototype._PTSNormalize=function(t,e){var r=void 0;if(void 0===e)return t;for(r=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=r;return t},t}();e.a=l},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(){i(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}();e.a=n},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=Math.pow(2,32)-1,a=function(){function t(){i(this,t)}return t.init=function(){t.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 e=void 0;for(e in t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);t.HDLR_TYPES={video:r,audio:i};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);t.STTS=t.STSC=t.STCO=a,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,o,u,o,s),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,n))},t.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),a[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},t.hdlr=function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])},t.mdat=function(e){return t.box(t.types.mdat,e)},t.mdhd=function(e,r){r*=e;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1));return t.box(t.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,r,i){return t.box(t.types.moof,t.mfhd(e),t.traf(i,r))},t.moov=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trak(e[r]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(t.mvex(e)))},t.mvex=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trex(e[r]);return t.box.apply(null,[t.types.mvex].concat(i))},t.mvhd=function(e,r){r*=e;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1)),o=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t.box(t.types.mvhd,o)},t.sdtp=function(e){var r=e.samples||[],i=new Uint8Array(4+r.length),n=void 0,a=void 0;for(a=0;a<r.length;a++)n=r[a].flags,i[a+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return t.box(t.types.sdtp,i)},t.stbl=function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))},t.avc1=function(e){var r=[],i=[],n=void 0,a=void 0,o=void 0;for(n=0;n<e.sps.length;n++)a=e.sps[n],o=a.byteLength,r.push(o>>>8&255),r.push(255&o),r=r.concat(Array.prototype.slice.call(a));for(n=0;n<e.pps.length;n++)a=e.pps[n],o=a.byteLength,i.push(o>>>8&255),i.push(255&o),i=i.concat(Array.prototype.slice.call(a));var s=t.box(t.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(i))),u=e.width,l=e.height,c=e.pixelRatio[0],d=e.pixelRatio[1];return t.box(t.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,u>>8&255,255&u,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,d>>24,d>>16&255,d>>8&255,255&d])))},t.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]))},t.mp4a=function(e){var r=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var r=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},t.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var r=e.id,i=e.duration*e.timescale,a=e.width,o=e.height,s=Math.floor(i/(n+1)),u=Math.floor(i%(n+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,u>>24,u>>16&255,u>>8&255,255&u,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,o>>8&255,255&o,0,0]))},t.traf=function(e,r){var i=t.sdtp(e),a=e.id,o=Math.floor(r/(n+1)),s=Math.floor(r%(n+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s])),t.trun(e,i.length+16+20+8+16+8+8),i)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var r=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,r){var i=e.samples||[],n=i.length,a=12+16*n,o=new Uint8Array(a),s=void 0,u=void 0,l=void 0,c=void 0,d=void 0,f=void 0;for(r+=8+a,o.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),s=0;s<n;s++)u=i[s],l=u.duration,c=u.size,d=u.flags,f=u.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,c>>>24&255,c>>>16&255,c>>>8&255,255&c,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,61440&d.degradPrio,15&d.degradPrio,f>>>24&255,f>>>16&255,f>>>8&255,255&f],12+16*s);return t.box(t.types.trun,o)},t.initSegment=function(e){t.types||t.init();var r=t.moov(e),i=void 0;return i=new Uint8Array(t.FTYP.byteLength+r.byteLength),i.set(t.FTYP),i.set(r,t.FTYP.byteLength),i},t}();e.a=a},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(1),a=function(){function t(e){i(this,t),this.observer=e}return t.prototype.destroy=function(){},t.prototype.resetTimeStamp=function(){},t.prototype.resetInitSegment=function(){},t.prototype.remux=function(t,e,r,i,a,o,s,u){var l=this.observer,c="";t&&(c+="audio"),e&&(c+="video"),l.trigger(n.a.FRAG_PARSING_DATA,{data1:u,startPTS:a,startDTS:a,type:c,hasAudio:!!t,hasVideo:!!e,nb:1,dropped:0}),l.trigger(n.a.FRAG_PARSED)},t}();e.a=a},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(5),s=r.n(o),u=r(4),l=r(8),c=function(t){function e(){return i(this,e),n(this,t.call(this))}return a(e,t),e.prototype.keyInfoFromStore=function(t,e){var r=this;this.callback=e,this._isRunningInWorker()?this.emit(u.b.DRM_INFO,t):l.a.getInstance().sessionInfo(t,function(t){r.onSessionInfo(t)})},e.prototype.onSessionInfo=function(t){this.callback&&(this.callback(null,t),this.callback=null)},e.prototype._isRunningInWorker=function(){return"function"==typeof importScripts},e.prototype._publicKey=function(){},e}(s.a);e.a=c},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(58),s=r(4),u=function(t){function e(){i(this,e);var r=n(this,t.call(this));return r._ready=!1,r._nativeInited=!1,r}return a(e,t),e.prototype.isReady=function(e,r){return this._ready&&t.prototype.isReady.call(this,e,r)},e.prototype.initDRM=function(t){if("function"!=typeof importScripts||this._nativeInited)this.nativeObj=Module.ccall("allocDrm","number",null,null);else{importScripts(t.wasmBaseUrl+t.module),this._nativeInited=!0;var e=this;Module.onNativeLoaded=function(){e._initNative()}}},e.prototype.setSessionInfo=function(t,e){this.nativeObj&&Module.ccall("setSessionInfo",null,["number","string"],[this.nativeObj,e])},e.prototype.hasLicense=function(t){return Module.ccall("hasLicense","bool",["number","string"],[this.nativeObj,t])},e.prototype.decrypt=function(t,e,r){if(this._setKeyIv(e),this.nativeObj){var i=new Uint8Array(t),n=i.byteLength,a=this.cacheMemory(n);Module.HEAP8.set(i,a);var o=Module.ccall("decrypt",null,["number","number","number"],[this.nativeObj,a,n]),u=Module.HEAPU8[o+n-1],l=n-u,c=new Uint8Array(l);c.set(Module.HEAPU8.subarray(o,o+l)),r(c),this.emit(s.b.DEMUX_COMPLETE)}else r(),this.emit(s.b.DEMUX_COMPLETE)},e.prototype.publicKey=function(){return this.nativeObj?Module.ccall("publicKey","string",["number"],[this.nativeObj]):""},e.prototype._initNative=function(){this.nativeObj=Module.ccall("allocDrm","number",null,null),this.emit(s.b.NATIVE_INITED)},e.prototype._setKeyIv=function(t){if(this.nativeObj){var e=new Uint8Array(t),r=e.byteLength,i=Module._malloc(r);Module.HEAPU8.set(e,i),Module.ccall("setKeyIv",null,["number","number","number"],[this.nativeObj,i,r]),Module._free(i)}},e.prototype.cacheMemory=function(t){return this.cacheSize||(this.cacheSize=0),this.cacheSize<t&&this.cacheAddr&&(Module._free(this.cacheAddr),this.cacheAddr=null),this.cacheAddr||(this.cacheSize=this.round_1024(t),this.cacheAddr=Module._malloc(this.cacheSize)),this.cacheAddr},e.prototype.round_1024=function(t){var e=Math.floor(t/16384)+1;return 16384*(e<64?64:e)},e}(o.a);e.a=u},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(5),s=r.n(o),u=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),l=function(t){function e(){return i(this,e),n(this,t.call(this))}return a(e,t),e.prototype.isReady=function(t,e){return this.licenseUrl==e},e.prototype.initDRM=function(t){},e.prototype.setKey=function(t){},e.prototype.decrypt=function(t,e,r){},e.prototype.setDrmInfo=function(t){},e.prototype.publicKey=function(){return""},e.prototype.hasLicense=function(){return!1},e.prototype.setSessionInfo=function(t){},u(e,[{key:"keyUri",set:function(t){this.licenseUrl=t}},{key:"drmInfo",set:function(t){this.setDrmInfo(t)}}]),e}(s.a);e.a=l},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(15),a=(r.n(n),r(8)),o=r(4),s=r(60),u=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),l=function(){function t(e){i(this,t),this.onwmsg=this._onWorkerMessage.bind(this),this.id=e,this.initWorker()}return t.prototype.initWorker=function(){var t=this,e='var Module = {"locateFile": function(file){return "__BASE_URL__" + file }};'.replace("__BASE_URL__",a.a.getInstance().nativeInfo.wasmBaseUrl||""),r=s.a.getIntanse().workerById(this.id,e);r.addEventListener("message",this.onwmsg),r.onerror=function(e){t.errorCallback&&t.errorCallback(e)},this.worker=r,this.postMessage({cmd:"initSigma",sigmaData:a.a.getInstance().nativeInfo})},t.prototype.addEventListener=function(t,e){this.eventListner=e},t.prototype.postMessage=function(t){this.worker&&this.worker.postMessage(t)},t.prototype.removeEventListener=function(t){this.eventListner=null,this.worker&&this.worker.removeEventListener(t,this.owmsg)},t.prototype.terminate=function(){this.worker&&(s.a.getIntanse().freeWorker(this.id,this.worker),this.worker.onerror=null)},t.prototype._onWorkerMessage=function(t){var e=this,r=t.data,i=r.event;"sigma_log"!=i&&(i==o.b.DRM_INFO?a.a.getInstance().sessionInfo(r.sessionId,function(t){e.postMessage({cmd:o.b.DRM_INFO,drmInfo:t})}):this.eventListner&&this.eventListner(t))},u(t,[{key:"objectUrl",get:function(){return this.worker?this.worker.objectUrl:null}},{key:"onError",set:function(t){this.errorCallback=t}}]),t}();e.a=l},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(15),a=r.n(n),o=function(){function t(){i(this,t),this.busyWorkers={},this.freeWorkers={}}return t.getIntanse=function(){return s},t.prototype.workerById=function(t,e){this.freeWorkers[t]&&0!=this.freeWorkers[t].length||(this.freeWorkers[t]||(this.freeWorkers[t]=[]),this.freeWorkers[t].push(this._createWorker(t,e)));var r=this.freeWorkers[t].shift();return this._addBusyWorker(t,r),r},t.prototype.freeWorker=function(t,e){if(this.busyWorkers[t])for(var r=0;r<this.busyWorkers[t].length;r++)if(this.busyWorkers[t][r]==e){var i=this.busyWorkers[t].splice(r,1)[0];this.freeWorkers[t].push(i)}},t.prototype._createWorker=function(t,e){var r=this.w=a()(61,{globalVariable:e});return this._addBusyWorker(t,r),r},t.prototype._addBusyWorker=function(t,e){this.busyWorkers[t]||(this.busyWorkers[t]=[]),this.busyWorkers[t].push(e)},t}(),s=new o;e.a=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),n=r.n(i),a=r(1),o=r(17),s=r(4),u=r(26),l=function(t){var e=!1,r=[],i=new n.a;i.trigger=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];i.emit.apply(i,[t,t].concat(r))},i.off=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];i.removeListener.apply(i,[t].concat(r))};var l=function(e,r){t.postMessage({event:e,data:r,url:t.demuxUrl})};o.a.getInstance().on(s.b.DRM_INFO,function(e){t.postMessage({event:s.b.DRM_INFO,sessionId:e})}),o.a.getInstance().on(s.b.DEMUX_COMPLETE,function(){l(s.b.DEMUX_COMPLETE)}),o.a.getInstance().on(s.b.NATIVE_INITED,function(){e=!0;for(var t=0;t<r.length;t++)c(r[t]);r=[]});var c=function(e){switch(e.cmd){case"initSigma":e.sigmaData&&e.sigmaData.module&&o.a.getInstance().init(e.sigmaData);break;case"init":var r=JSON.parse(e.config);t.demuxer=new u.a(i,e.typeSupported,r,e.vendor);try{enableLogs(!0===r.debug)}catch(t){console.warn("demuxerWorker: unable to enable logs")}l("init",null);break;case"demux":t.demuxUrl=e.url,t.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),e.data.byteLength>0&&null!=e.decryptdata&&null!=e.decryptdata.key&&"AES-128"===e.decryptdata.method||l(s.b.DEMUX_COMPLETE);break;case s.b.DRM_INFO:o.a.getInstance().onSessionInfo(e.drmInfo)}};t.addEventListener("message",function(t){var i=t.data;switch(i.cmd){case"initSigma":c(i);break;default:e?c(i):r.push(i)}}),i.on(a.a.FRAG_DECRYPTED,l),i.on(a.a.FRAG_PARSING_INIT_SEGMENT,l),i.on(a.a.FRAG_PARSED,l),i.on(a.a.ERROR,l),i.on(a.a.FRAG_PARSING_METADATA,l),i.on(a.a.FRAG_PARSING_USERDATA,l),i.on(a.a.INIT_PTS_FOUND,l),i.on("sigma_log",l),i.on(a.a.FRAG_PARSING_DATA,function(e,r){var i=[],n={event:e,data:r,url:t.demuxUrl};r.data1&&(n.data1=r.data1.buffer,i.push(r.data1.buffer),delete r.data1),r.data2&&(n.data2=r.data2.buffer,i.push(r.data2.buffer),delete r.data2),t.postMessage(n,i)})};e.default=l},function(t,e,r){"use strict";function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments[2],i=0;if(r.programDateTime){var n=Date.parse(r.programDateTime);isNaN(n)||(i=1e3*e+n-1e3*t)}return i}function n(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!Array.isArray(t)||!t.length||null===e)return null;if(e<t[0].pdt)return null;if(e>=t[t.length-1].endPdt)return null;for(var r=0;r<t.length;++r){var i=t[r];if(e<i.endPdt)return i}return null}function a(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=void 0,u=t?e[t.sn-e[0].sn+1]:null;return r<i&&(r>i-n&&(n=0),a=u&&!o(r,n,u)?u:s.a.search(e,o.bind(null,r,n))),a}function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&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}e.a=i,e.b=n,e.c=a,e.d=o;var s=r(9)},function(t,e,r){(function(r){var i,n;!function(e,r){t.exports=r(e)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:this,function(r){"use strict";r=r||{};var a=r.Base64,o="2.5.1",s;if(void 0!==t&&t.exports)try{s=eval("require('buffer').Buffer")}catch(t){s=void 0}var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=function(t){for(var e={},r=0,i=t.length;r<i;r++)e[t.charAt(r)]=r;return e}(u),c=String.fromCharCode,d=function(t){if(t.length<2){var e=t.charCodeAt(0);return e<128?t:e<2048?c(192|e>>>6)+c(128|63&e):c(224|e>>>12&15)+c(128|e>>>6&63)+c(128|63&e)}var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return c(240|e>>>18&7)+c(128|e>>>12&63)+c(128|e>>>6&63)+c(128|63&e)},f=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,h=function(t){return t.replace(f,d)},p=function(t){var e=[0,2,1][t.length%3],r=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[u.charAt(r>>>18),u.charAt(r>>>12&63),e>=2?"=":u.charAt(r>>>6&63),e>=1?"=":u.charAt(63&r)].join("")},g=r.btoa?function(t){return r.btoa(t)}:function(t){return t.replace(/[\s\S]{1,3}/g,p)},v=s?s.from&&Uint8Array&&s.from!==Uint8Array.from?function(t){return(t.constructor===s.constructor?t:s.from(t)).toString("base64")}:function(t){return(t.constructor===s.constructor?t:new s(t)).toString("base64")}:function(t){return g(h(t))},y=function(t,e){return e?v(String(t)).replace(/[+\/]/g,function(t){return"+"==t?"-":"_"}).replace(/=/g,""):v(String(t))},m=function(t){return y(t,!0)},b=new RegExp(["[\xC0-\xDF][\x80-\xBF]","[\xE0-\xEF][\x80-\xBF]{2}","[\xF0-\xF7][\x80-\xBF]{3}"].join("|"),"g"),E=function(t){switch(t.length){case 4:var e=(7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3),r=e-65536;return c(55296+(r>>>10))+c(56320+(1023&r));case 3:return c((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return c((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},T=function(t){return t.replace(b,E)},S=function(t){var e=t.length,r=e%4,i=(e>0?l[t.charAt(0)]<<18:0)|(e>1?l[t.charAt(1)]<<12:0)|(e>2?l[t.charAt(2)]<<6:0)|(e>3?l[t.charAt(3)]:0),n=[c(i>>>16),c(i>>>8&255),c(255&i)];return n.length-=[0,0,2,1][r],n.join("")},_=r.atob?function(t){return r.atob(t)}:function(t){return t.replace(/\S{1,4}/g,S)},A=function(t){return _(String(t).replace(/[^A-Za-z0-9\+\/]/g,""))},R=s?s.from&&Uint8Array&&s.from!==Uint8Array.from?function(t){return(t.constructor===s.constructor?t:s.from(t,"base64")).toString()}:function(t){return(t.constructor===s.constructor?t:new s(t,"base64")).toString()}:function(t){return T(_(t))},w=function(t){return R(String(t).replace(/[-_]/g,function(t){return"-"==t?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},I=function(){var t=r.Base64;return r.Base64=a,t};if(r.Base64={VERSION:o,atob:A,btoa:g,fromBase64:w,toBase64:y,utob:h,encode:y,encodeURI:m,btou:T,decode:w,noConflict:I,__buffer__:s},"function"==typeof Object.defineProperty){var L=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}};r.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",L(function(){return w(this)})),Object.defineProperty(String.prototype,"toBase64",L(function(t){return y(this,t)})),Object.defineProperty(String.prototype,"toBase64URI",L(function(){return y(this,!0)}))}}return r.Meteor&&(Base64=r.Base64),void 0!==t&&t.exports?t.exports.Base64=r.Base64:(i=[],void 0!==(n=function(){return r.Base64}.apply(e,i))&&(t.exports=n)),{Base64:r.Base64}})}).call(e,r(64))},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(3),u=r(0),l=r(2),c=r(24),d=r(19),f="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},h=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),p=window,g=p.performance,v=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.MANIFEST_LOADED,o.a.LEVEL_LOADED,o.a.AUDIO_TRACK_SWITCHED,o.a.FRAG_LOADED,o.a.ERROR));return a.canload=!1,a.currentLevelIndex=null,a.manualLevelIndex=-1,a.timer=null,a}return a(e,t),e.prototype.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},e.prototype.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},e.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()},e.prototype.stopLoad=function(){this.canload=!1},e.prototype.onManifestLoaded=function(t){var e=[],r=void 0,i={},n=null,a=!1,s=!1,f=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=[];if(t.levels.forEach(function(t){t.loadError=0,t.fragmentError=!1,a=a||!!t.videoCodec,s=s||!!t.audioCodec||!(!t.attrs||!t.attrs.AUDIO),f&&t.audioCodec&&-1!==t.audioCodec.indexOf("mp4a.40.34")&&(t.audioCodec=void 0),n=i[t.bitrate],n?n.url.push(t.url):(t.url=[t.url],t.urlId=0,i[t.bitrate]=t,e.push(t)),t.attrs&&t.attrs.AUDIO&&Object(d.a)(n||t,"audio",t.attrs.AUDIO),t.attrs&&t.attrs.SUBTITLES&&Object(d.a)(n||t,"text",t.attrs.SUBTITLES)}),a&&s&&(e=e.filter(function(t){return!!t.videoCodec})),e=e.filter(function(t){var e=t.audioCodec,r=t.videoCodec;return(!e||Object(c.a)(e))&&(!r||Object(c.a)(r))}),t.audioTracks&&(h=t.audioTracks.filter(function(t){return!t.audioCodec||Object(c.a)(t.audioCodec,"audio")})),e.length>0){r=e[0].bitrate,e.sort(function(t,e){return t.bitrate-e.bitrate}),this._levels=e;for(var p=0;p<e.length;p++)if(e[p].bitrate===r){this._firstLevel=p,u.b.log("manifest loaded,"+e.length+" level(s) found, first bitrate:"+r);break}this.hls.trigger(o.a.MANIFEST_PARSED,{levels:e,audioTracks:h,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:a,altAudio:h.length>0&&a})}else this.hls.trigger(o.a.ERROR,{type:l.b.MEDIA_ERROR,details:l.a.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},e.prototype.setLevelInternal=function(t){var e=this._levels,r=this.hls;if(t>=0&&t<e.length){if(this.clearTimer(),this.currentLevelIndex!==t){u.b.log("switching to level "+t),this.currentLevelIndex=t;var i=e[t];i.level=t,r.trigger(o.a.LEVEL_SWITCHING,i)}var n=e[t],a=n.details;if(!a||a.live){var s=n.urlId;r.trigger(o.a.LEVEL_LOADING,{url:n.url[s],level:t,id:s})}}else r.trigger(o.a.ERROR,{type:l.b.OTHER_ERROR,details:l.a.LEVEL_SWITCH_ERROR,level:t,fatal:!1,reason:"invalid level idx"})},e.prototype.onError=function(t){if(t.fatal)return void(t.type===l.b.NETWORK_ERROR&&this.clearTimer());var e=!1,r=!1,i=void 0;switch(t.details){case l.a.FRAG_LOAD_ERROR:case l.a.FRAG_LOAD_TIMEOUT:case l.a.KEY_LOAD_ERROR:case l.a.KEY_LOAD_TIMEOUT:i=t.frag.level,r=!0;break;case l.a.LEVEL_LOAD_ERROR:case l.a.LEVEL_LOAD_TIMEOUT:i=t.context.level,e=!0;break;case l.a.REMUX_ALLOC_ERROR:i=t.level,e=!0}void 0!==i&&this.recoverLevel(t,i,e,r)},e.prototype.recoverLevel=function(t,e,r,i){var n=this,a=this.hls.config,o=t.details,s=this._levels[e],l=void 0,c=void 0,d=void 0;if(s.loadError++,s.fragmentError=i,r){if(!(this.levelRetryCount+1<=a.levelLoadingMaxRetry))return u.b.error("level controller, cannot recover from "+o+" error"),this.currentLevelIndex=null,this.clearTimer(),void(t.fatal=!0);c=Math.min(Math.pow(2,this.levelRetryCount)*a.levelLoadingRetryDelay,a.levelLoadingMaxRetryTimeout),this.timer=setTimeout(function(){return n.loadLevel()},c),t.levelRetry=!0,this.levelRetryCount++,u.b.warn("level controller, "+o+", retry in "+c+" ms, current retry count is "+this.levelRetryCount)}(r||i)&&(l=s.url.length,l>1&&s.loadError<l?(s.urlId=(s.urlId+1)%l,s.details=void 0,u.b.warn("level controller, "+o+" for level "+e+": switching to redundant URL-id "+s.urlId)):-1===this.manualLevelIndex?(d=0===e?this._levels.length-1:e-1,u.b.warn("level controller, "+o+": switch to "+d),this.hls.nextAutoLevel=this.currentLevelIndex=d):i&&(u.b.warn("level controller, "+o+": reload a fragment"),this.currentLevelIndex=null))},e.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)}},e.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,u.b.log("same live playlist, reload twice faster")),o-=g.now()-t.stats.trequest,o=Math.max(a/2,Math.round(o)),u.b.log("live playlist, reload in "+Math.round(o)+" ms"),this.timer=setTimeout(function(){return e.loadLevel()},o)}else this.clearTimer()}},e.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())}},e.prototype.loadLevel=function(){if(u.b.debug("call to loadLevel"),null!==this.currentLevelIndex&&this.canload){var t=this._levels[this.currentLevelIndex];if("object"===(void 0===t?"undefined":f(t))&&t.url.length>0){var e=this.currentLevelIndex,r=t.urlId,i=t.url[r];u.b.log("Attempt loading level index "+e+" with URL-id "+r),this.hls.trigger(o.a.LEVEL_LOADING,{url:i,level:e,id:r})}}},h(e,[{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)}}]),e}(s.a);e.a=v},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(3),u=r(10),l=r(32),c=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.MEDIA_ATTACHED,o.a.MEDIA_DETACHING,o.a.FRAG_PARSING_METADATA));return a.id3Track=void 0,a.media=void 0,a}return a(e,t),e.prototype.destroy=function(){s.a.prototype.destroy.call(this)},e.prototype.onMediaAttached=function(t){this.media=t.media,this.media},e.prototype.onMediaDetaching=function(){Object(l.a)(this.id3Track),this.id3Track=void 0,this.media=void 0},e.prototype.getID3Track=function(t){for(var e=0;e<t.length;e++){var r=t[e];if("metadata"===r.kind&&"id3"===r.label)return Object(l.b)(r,this.media),r}return this.media.addTextTrack("metadata","id3")},e.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=u.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 l=0;l<a.length;l++){var c=a[l];if(!u.a.isTimeStampFrame(c)){var d=new i(o,s,"");d.value=c,this.id3Track.addCue(d)}}}}},e}(s.a);e.a=c},function(t,e,r){"use strict";r.d(e,"a",function(){return v});var i=r(68),n=r(71),a=r(72),o=r(73),s=r(74),u=r(75),l=r(76),c=r(77),d=r(79),f=r(83),h=r(84),p=r(85),g=r(86),v={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:s.a,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,abrController:i.a,bufferController:n.a,capLevelController:a.a,fpsController:o.a,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:g.a};v.subtitleStreamController=h.a,v.subtitleTrackController=f.a,v.timelineController=d.a,v.cueHandler=c,v.enableCEA708Captions=!0,v.enableWebVTT=!0,v.captionsTextTrack1Label="English",v.captionsTextTrack1LanguageCode="en",v.captionsTextTrack2Label="Spanish",v.captionsTextTrack2LanguageCode="es",v.audioStreamController=l.a,v.audioTrackController=u.a,v.emeController=p.a},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(3),u=r(14),l=r(2),c=r(0),d=r(69),f=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),h=window,p=h.performance,g=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.FRAG_LOADING,o.a.FRAG_LOADED,o.a.FRAG_BUFFERED,o.a.ERROR));return a.lastLoadedFragLevel=0,a._nextAutoLevel=-1,a.hls=r,a.timer=null,a._bwEstimator=null,a.onCheck=a._abandonRulesCheck.bind(a),a}return a(e,t),e.prototype.destroy=function(){this.clearTimer(),s.a.prototype.destroy.call(this)},e.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=r.levels[n].details.live,o=void 0,s=void 0;a?(o=i.abrEwmaFastLive,s=i.abrEwmaSlowLive):(o=i.abrEwmaFastVoD,s=i.abrEwmaSlowVoD),this._bwEstimator=new d.a(r,s,o,i.abrEwmaDefaultEstimate)}},e.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 c.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 s=p.now()-a.trequest,l=Math.abs(e.playbackRate);if(s>500*r.duration/l){var d=t.levels,f=Math.max(1,a.bw?a.bw/8:1e3*a.loaded/s),h=d[r.level],g=h.realBitrate?Math.max(h.realBitrate,h.bitrate):h.bitrate,v=a.total?a.total:Math.max(a.loaded,Math.round(r.duration*g/8)),y=e.currentTime,m=(v-a.loaded)/f,b=(u.a.bufferInfo(e,y,t.config.maxBufferHole).end-y)/l;if(b<2*r.duration/l&&m>b){var E=void 0,T=void 0;for(T=r.level-1;T>n;T--){var S=d[T].realBitrate?Math.max(d[T].realBitrate,d[T].bitrate):d[T].bitrate;if((E=r.duration*S/(6.4*f))<b)break}E<m&&(c.b.warn("loading too slow, abort fragment loading and switch to level "+T+":fragLoadedDelay["+T+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+E.toFixed(1)+"<"+m.toFixed(1)+":"+b.toFixed(1)),t.nextLoadLevel=T,this._bwEstimator.sample(s,a.loaded),i.abort(),this.clearTimer(),t.trigger(o.a.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:a}))}}}}},e.prototype.onFragLoaded=function(t){var e=t.frag;if("main"===e.type&&!isNaN(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)}}},e.prototype.onFragBuffered=function(t){var e=t.stats,r=t.frag;if(!(!0===e.aborted||"main"!==r.type||isNaN(r.sn)||r.bitrateTest&&e.tload!==e.tbuffered)){var i=e.tparsed-e.trequest;c.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}},e.prototype.onError=function(t){switch(t.details){case l.a.FRAG_LOAD_ERROR:case l.a.FRAG_LOAD_TIMEOUT:this.clearTimer()}},e.prototype.clearTimer=function(){clearInterval(this.timer),this.timer=null},e.prototype._findBestLevel=function(t,e,r,i,n,a,o,s,u){for(var l=n;l>=i;l--){var d=u[l],f=d.details,h=f?f.totalduration/f.fragments.length:e,p=!!f&&f.live,g=void 0;g=l<=t?o*r:s*r;var v=u[l].realBitrate?Math.max(u[l].realBitrate,u[l].bitrate):u[l].bitrate,y=v*h/g;if(c.b.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+l+"/"+Math.round(g)+"/"+v+"/"+h+"/"+a+"/"+y),g>v&&(!y||p&&!this.bitrateTestDelay||y<a))return l}return-1},f(e,[{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,l=a?a.currentTime:0,d=a&&0!==a.playbackRate?Math.abs(a.playbackRate):1,f=this._bwEstimator?this._bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,h=(u.a.bufferInfo(a,l,i.maxBufferHole).end-l)/d,p=this._findBestLevel(o,s,f,n,e,h,i.abrBandWidthFactor,i.abrBandWidthUpFactor,r);if(p>=0)return p;c.b.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var g=s?Math.min(s,i.maxStarvationDelay):i.maxStarvationDelay,v=i.abrBandWidthFactor,y=i.abrBandWidthUpFactor;if(0===h){var m=this.bitrateTestDelay;if(m){g=(s?Math.min(s,i.maxLoadingDelay):i.maxLoadingDelay)-m,c.b.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),v=y=1}}return p=this._findBestLevel(o,s,f,n,e,h+g,v,y,r),Math.max(p,0)}}]),e}(s.a);e.a=g},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(70),a=function(){function t(e,r,a,o){i(this,t),this.hls=e,this.defaultEstimate_=o,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new n.a(r),this.fast_=new n.a(a)}return t.prototype.sample=function(t,e){t=Math.max(t,this.minDelayMs_);var r=8e3*e/t,i=t/1e3;this.fast_.sample(i,r),this.slow_.sample(i,r)},t.prototype.canEstimate=function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_},t.prototype.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.prototype.destroy=function(){},t}();e.a=a},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(e){i(this,t),this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=0,this.totalWeight_=0}return t.prototype.sample=function(t,e){var r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t},t.prototype.getTotalWeight=function(){return this.totalWeight_},t.prototype.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/t}return this.estimate_},t}();e.a=n},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(3),u=r(0),l=r(2),c=r(18),d=Object(c.a)(),f=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.MEDIA_ATTACHING,o.a.MEDIA_DETACHING,o.a.MANIFEST_PARSED,o.a.BUFFER_RESET,o.a.BUFFER_APPENDING,o.a.BUFFER_CODECS,o.a.BUFFER_EOS,o.a.BUFFER_FLUSHING,o.a.LEVEL_PTS_UPDATED,o.a.LEVEL_UPDATED));return a._msDuration=null,a._levelDuration=null,a._live=null,a._objectUrl=null,a.onsbue=a.onSBUpdateEnd.bind(a),a.onsbe=a.onSBUpdateError.bind(a),a.pendingTracks={},a.tracks={},a}return a(e,t),e.prototype.destroy=function(){s.a.prototype.destroy.call(this)},e.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(Math.abs(i.timestampOffset-t.start)>.1){var n=i.updating;try{i.abort()}catch(t){n=!0,u.b.warn("can not abort audio buffer: "+t)}n?this.audioTimestampOffset=t.start:(u.b.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+t.start),i.timestampOffset=t.start)}}},e.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),u.b.log(i+" sourceBuffer(s) expected")),this.sourceBufferNb=i},e.prototype.onMediaAttaching=function(t){var e=this.media=t.media;if(e){var r=this.mediaSource=new d;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}},e.prototype.onMediaDetaching=function(){u.b.log("media source detaching");var t=this.mediaSource;if(t){if("open"===t.readyState)try{t.endOfStream()}catch(t){u.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()):u.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(o.a.MEDIA_DETACHED)},e.prototype.onMediaSourceOpen=function(){u.b.log("media source opened"),this.hls.trigger(o.a.MEDIA_ATTACHED,{media:this.media});var t=this.mediaSource;t&&t.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()},e.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())},e.prototype.onMediaSourceClose=function(){u.b.log("media source closed")},e.prototype.onMediaSourceEnded=function(){u.b.log("media source ended")},e.prototype.onSBUpdateEnd=function(){if(this.audioTimestampOffset){var t=this.sourceBuffer.audio;u.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 e=this.parent,r=this.segments.reduce(function(t,r){return r.parent===e?t+1:t},0),i={},n=this.sourceBuffer;for(var a in n)i[a]=n[a].buffered;this.hls.trigger(o.a.BUFFER_APPENDED,{parent:e,pending:r,timeRanges:i}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()},e.prototype.onSBUpdateError=function(t){u.b.error("sourceBuffer error:",t),this.hls.trigger(o.a.ERROR,{type:l.b.MEDIA_ERROR,details:l.a.BUFFER_APPENDING_ERROR,fatal:!1})},e.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},e.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()}},e.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,s=n.container+";codecs="+a;u.b.log("creating sourceBuffer("+s+")");try{var c=e[i]=r.addSourceBuffer(s);c.addEventListener("updateend",this.onsbue),c.addEventListener("error",this.onsbe),this.tracks[i]={codec:a,container:n.container},n.buffer=c}catch(t){u.b.error("error while trying to add sourceBuffer:"+t.message),this.hls.trigger(o.a.ERROR,{type:l.b.MEDIA_ERROR,details:l.a.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:t,mimeType:s})}}this.hls.trigger(o.a.BUFFER_CREATED,{tracks:t})},e.prototype.onBufferAppending=function(t){this._needsFlush||(this.segments?this.segments.push(t):this.segments=[t],this.doAppending())},e.prototype.onBufferAppendFail=function(t){u.b.error("sourceBuffer error:",t.event),this.hls.trigger(o.a.ERROR,{type:l.b.MEDIA_ERROR,details:l.a.BUFFER_APPENDING_ERROR,fatal:!1})},e.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,u.b.log(i+" sourceBuffer now EOS"));this.checkEos()},e.prototype.checkEos=function(){var t=this.sourceBuffer,e=this.mediaSource;if(!e||"open"!==e.readyState)return void(this._needsEos=!1);for(var r in t){var i=t[r];if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}u.b.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment");try{e.endOfStream()}catch(t){u.b.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1},e.prototype.onBufferFlushing=function(t){this.flushRange.push({start:t.startOffset,end:t.endOffset,type:t.type}),this.flushBufferCounter=0,this.doFlush()},e.prototype.onLevelUpdated=function(t){var e=t.details;e.fragments.length>0&&(this._levelDuration=e.totalduration+e.fragments[0].start,this._live=e.live,this.updateMediaElementDuration())},e.prototype.updateMediaElementDuration=function(){var t=this.hls.config,e=void 0;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;e=this.media.duration,null===this._msDuration&&(this._msDuration=this.mediaSource.duration),!0===this._live&&!0===t.liveDurationInfinity?(u.b.log("Media Source duration is set to Infinity"),this._msDuration=this.mediaSource.duration=1/0):(this._levelDuration>this._msDuration&&this._levelDuration>e||e===1/0||isNaN(e))&&(u.b.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},e.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){u.b.error("error while accessing sourceBuffer.buffered")}this.appended=e,this.hls.trigger(o.a.BUFFER_FLUSHED)}},e.prototype.doAppending=function(){var t=this.hls,e=this.sourceBuffer,r=this.segments;if(Object.keys(e).length){if(this.media.error)return this.segments=[],void u.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=i.type,a=e[n];a?a.updating?r.unshift(i):(a.ended=!1,this.parent=i.parent,a.appendBuffer(i.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(e){u.b.error("error while trying to append buffer:"+e.message),r.unshift(i);var s={type:l.b.MEDIA_ERROR,parent:i.parent};22!==e.code?(this.appendError?this.appendError++:this.appendError=1,s.details=l.a.BUFFER_APPEND_ERROR,this.appendError>t.config.appendErrorMaxRetry?(u.b.log("fail "+t.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],s.fatal=!0,t.trigger(o.a.ERROR,s)):(s.fatal=!1,t.trigger(o.a.ERROR,s))):(this.segments=[],s.details=l.a.BUFFER_FULL_ERROR,s.fatal=!1,t.trigger(o.a.ERROR,s))}}}},e.prototype.flushBuffer=function(t,e,r){var i=void 0,n=void 0,a=void 0,o=void 0,s=void 0,l=void 0,c=this.sourceBuffer;if(Object.keys(c).length){if(u.b.log("flushBuffer,pos/start/end: "+this.media.currentTime.toFixed(3)+"/"+t+"/"+e),this.flushBufferCounter<this.appended){for(var d in c)if(!r||d===r){if(i=c[d],i.ended=!1,i.updating)return u.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,l=e):(s=Math.max(a,t),l=Math.min(o,e)),Math.min(l,o)-s>.5)return this.flushBufferCounter++,i.remove(s,l),!1}catch(t){u.b.warn("exception while accessing sourcebuffer, it might have been removed from MediaSource")}}}else u.b.warn("abort flushing too many retries");u.b.log("buffer flushed")}return!0},e}(s.a);e.a=f},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(3),u=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),l=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.FPS_DROP_LEVEL_CAPPING,o.a.MEDIA_ATTACHING,o.a.MANIFEST_PARSED,o.a.BUFFER_CODECS));return a.autoLevelCapping=Number.POSITIVE_INFINITY,a.firstLevel=null,a.levels=[],a.media=null,a.restrictedLevels=[],a.timer=null,a}return a(e,t),e.prototype.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this._stopCapping())},e.prototype.onFpsDropLevelCapping=function(t){e.isLevelAllowed(t.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(t.droppedLevel)},e.prototype.onMediaAttaching=function(t){this.media=t.media instanceof window.HTMLVideoElement?t.media:null},e.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()},e.prototype.onBufferCodecs=function(t){this.hls.config.capLevelToPlayerSize&&t.video&&this._startCapping()},e.prototype.onLevelsUpdated=function(t){this.levels=t.levels},e.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}}},e.prototype.getMaxLevel=function(t){var r=this;if(!this.levels)return-1;var i=this.levels.filter(function(i,n){return e.isLevelAllowed(n,r.restrictedLevels)&&n<=t});return e.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},e.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())},e.prototype._stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},e.isLevelAllowed=function(t){return-1===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).indexOf(t)},e.getMaxLevelByMediaSize=function(t,e,r){if(!t||t&&!t.length)return-1;for(var i=t.length-1,n=0;n<t.length;n+=1){var a=t[n];if((a.width>=e||a.height>=r)&&function(t,e){return!e||(t.width!==e.width||t.height!==e.height)}(a,t[n+1])){i=n;break}}return i},u(e,[{key:"mediaWidth",get:function(){var t=void 0,r=this.media;return r&&(t=r.width||r.clientWidth||r.offsetWidth,t*=e.contentScaleFactor),t}},{key:"mediaHeight",get:function(){var t=void 0,r=this.media;return r&&(t=r.height||r.clientHeight||r.offsetHeight,t*=e.contentScaleFactor),t}}],[{key:"contentScaleFactor",get:function(){var t=1;try{t=window.devicePixelRatio}catch(t){}return t}}]),e}(s.a);e.a=l},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(3),u=r(0),l=window,c=l.performance,d=function(t){function e(r){return i(this,e),n(this,t.call(this,r,o.a.MEDIA_ATTACHING))}return a(e,t),e.prototype.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},e.prototype.onMediaAttaching=function(t){var e=this.hls.config;if(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)}},e.prototype.checkFPS=function(t,e,r){var i=c.now();if(e){if(this.lastTime){var n=i-this.lastTime,a=r-this.lastDroppedFrames,s=e-this.lastDecodedFrames,l=1e3*a/n,d=this.hls;if(d.trigger(o.a.FPS_DROP,{currentDropped:a,currentDecoded:s,totalDroppedFrames:r}),l>0&&a>d.config.fpsDroppedMonitoringThreshold*s){var f=d.currentLevel;u.b.warn("drop FPS ratio greater than max allowed value for currentLevel: "+f),f>0&&(-1===d.autoLevelCapping||d.autoLevelCapping>=f)&&(f-=1,d.trigger(o.a.FPS_DROP_LEVEL_CAPPING,{level:f,droppedLevel:d.currentLevel}),d.autoLevelCapping=f,d.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=e}},e.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)},e}(s.a);e.a=d},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=r(0),a="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},o=window,s=o.performance,u=o.XMLHttpRequest,l=function(){function t(e){i(this,t),e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}return t.prototype.destroy=function(){this.abort(),this.loader=null},t.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},t.prototype.load=function(t,e,r){this.context=t,this.config=e,this.callbacks=r,this.stats={trequest:s.now(),retry:0},this.retryDelay=e.retryDelay,this.loadInternal()},t.prototype.loadInternal=function(){var t=void 0,e=this.context;t=this.loader=new u;var r=this.stats;r.tfirst=0,r.loaded=0;var i=this.xhrSetup,n=e.body?"POST":"GET";try{if(i)try{i(t,e.url)}catch(r){t.open(n,e.url,!0),i(t,e.url)}t.readyState||t.open(n,e.url,!0)}catch(r){return void this.callbacks.onError({code:t.status,text:r.message},e,t)}if(e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),e.requestHeader&&"object"==a(e.requestHeader))for(var o=Object.keys(e.requestHeader),s=0;s<o.length;s++)t.setRequestHeader(o[s],e.requestHeader[o[s]]);t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=e.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),t.send(e.body)},t.prototype.readystatechange=function(t){var e=t.currentTarget,r=e.readyState,i=this.stats,a=this.context,o=this.config;if(!i.aborted&&r>=2)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(s.now(),i.trequest)),4===r){var u=e.status;if(u>=200&&u<300){i.tload=Math.max(i.tfirst,s.now());var l=void 0,c=void 0;"arraybuffer"===a.responseType?(l=e.response,c=l.byteLength):(l=e.responseText,c=l.length),i.loaded=i.total=c;var d={url:e.responseURL,data:l};this.callbacks.onSuccess(d,i,a,e)}else i.retry>=o.maxRetry||u>=400&&u<499?(n.b.error(u+" while loading "+a.url),this.callbacks.onError({code:u,text:e.statusText},a,e)):(n.b.warn(u+" while loading "+a.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,o.maxRetryDelay),i.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),o.timeout)},t.prototype.loadtimeout=function(){n.b.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},t.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)},t}();e.a=l},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(11),u=r(0),l=r(2),c=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),d=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.MANIFEST_LOADING,o.a.MANIFEST_PARSED,o.a.AUDIO_TRACK_LOADED,o.a.AUDIO_TRACK_SWITCHED,o.a.LEVEL_LOADED,o.a.ERROR));return a.trackId=-1,a.tracks=[],a.trackIdBlacklist=Object.create(null),a.audioGroupId=null,a}return a(e,t),e.prototype.onManifestLoading=function(){this.tracks=[],this.trackId=-1},e.prototype.onManifestParsed=function(t){var e=this.tracks=t.audioTracks||[];this.hls.trigger(o.a.AUDIO_TRACKS_UPDATED,{audioTracks:e})},e.prototype.onAudioTrackLoaded=function(t){if(t.id>=this.tracks.length)return void u.b.warn("Invalid audio track id:",t.id);if(u.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()},e.prototype.onAudioTrackSwitched=function(t){var e=this.tracks[t.id].groupId;e&&this.audioGroupId!==e&&(this.audioGroupId=e)},e.prototype.onLevelLoaded=function(t){var e=this.hls.levels[t.level];if(e.audioGroupIds){var r=e.audioGroupIds[e.urlId];this.audioGroupId!==r&&(this.hls.config.keepAudioTrackWhenSwitchLevel&&null!=this.audioGroupId||(this.audioGroupId=r),this._selectInitialAudioTrack())}},e.prototype.onError=function(t){t.type===l.b.NETWORK_ERROR&&(t.fatal&&this.clearInterval(),t.details===l.a.AUDIO_TRACK_LOAD_ERROR&&(u.b.warn("Network failure on audio-track id:",t.context.id),this._handleLoadError()))},e.prototype.doTick=function(){this._updateTrack(this.trackId)},e.prototype._selectInitialAudioTrack=function(){var t=this,e=this.tracks;if(e.length){var r=this.tracks[this.trackId],i=null;r&&(i=r.name);var n=e.filter(function(t){return t.default});n.length?e=n:u.b.warn("No default audio tracks defined");var a=!1,s=function(){e.forEach(function(e){a||t.audioGroupId&&e.groupId!==t.audioGroupId||i&&i!==e.name||(t.audioTrack=e.id,a=!0)})};s(),a||(i=null,this.hls.config.keepAudioTrackWhenSwitchLevel&&r?(this.audioGroupId=r.groupId,a=!0):s()),a||(u.b.error("No track found for running audio group-ID: "+this.audioGroupId),this.hls.trigger(o.a.ERROR,{type:l.b.MEDIA_ERROR,details:l.a.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))}},e.prototype._needsTrackLoading=function(t){var e=t.details;return!e||(!!e.live||void 0)},e.prototype._loadTrackDetailsIfNeeded=function(t){if(this._needsTrackLoading(t)){var e=t.url,r=t.id;u.b.log("loading audio-track playlist for id: "+r),this.hls.trigger(o.a.AUDIO_TRACK_LOADING,{url:e,id:r})}},e.prototype._updateTrack=function(t){if(!(t<0||t>=this.tracks.length)){this.clearInterval(),this.trackId=t,u.b.log("trying to update audio-track "+t);var e=this.tracks[t];this._loadTrackDetailsIfNeeded(e)}},e.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;u.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]){var s=this.tracks[o];if(s.name===r){a=o;break}}if(a===t)return void u.b.warn('No fallback audio-track found for name/language: "'+r+'" / "'+i+'"');u.b.log("Attempting audio-track fallback id:",a,"group-id:",this.tracks[a].groupId),this.audioTrack=a},c(e,[{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){if(this.trackId===t&&this.tracks[this.trackId].details)return void u.b.debug("Same id as current audio-track passed, and track details available -> no-op");if(t<0||t>=this.tracks.length)return void u.b.warn("Invalid id passed to audio-track controller");var e=this.tracks[t];u.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(o.a.AUDIO_TRACK_SWITCHING,{id:n,type:i,url:r}),this._loadTrackDetailsIfNeeded(e)}}]),e}(s.a);e.a=d},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(9),s=r(14),u=r(25),l=r(1),c=r(19),d=r(29),f=r(2),h=r(0),p=r(30),g=r(11),v=r(13),y=r(12),m=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),b=window,E=b.performance,T={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BUFFER_FLUSHING:"BUFFER_FLUSHING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS"},S=function(t){function e(r,a){i(this,e);var o=n(this,t.call(this,r,l.a.MEDIA_ATTACHED,l.a.MEDIA_DETACHING,l.a.AUDIO_TRACKS_UPDATED,l.a.AUDIO_TRACK_SWITCHING,l.a.AUDIO_TRACK_LOADED,l.a.KEY_LOADED,l.a.FRAG_LOADED,l.a.FRAG_PARSING_INIT_SEGMENT,l.a.FRAG_PARSING_DATA,l.a.FRAG_PARSED,l.a.ERROR,l.a.BUFFER_RESET,l.a.BUFFER_CREATED,l.a.BUFFER_APPENDED,l.a.BUFFER_FLUSHED,l.a.INIT_PTS_FOUND));return o.fragmentTracker=a,o.config=r.config,o.audioCodecSwap=!1,o._state=T.STOPPED,o.initPTS=[],o.waitingFragment=null,o.videoTrackCC=null,o.audioDecodedQueue=[],o.limitBufferTime=r.config.limitBufferTime||.5,o.unusedFragment=[],o.fragmentParsing=null,o}return a(e,t),e.prototype.onHandlerDestroying=function(){this.stopLoad(),t.prototype.onHandlerDestroying.call(this)},e.prototype.onHandlerDestroyed=function(){this.state=T.STOPPED,this.fragmentTracker=null,t.prototype.onHandlerDestroyed.call(this)},e.prototype.onInitPtsFound=function(t){var e=t.id,r=t.frag.cc,i=t.initPTS;"main"===e&&(this.initPTS[r]=i,this.videoTrackCC=r,h.b.log("InitPTS for cc: "+r+" found from video track: "+i),this.state===T.WAITING_INIT_PTS&&this.tick())},e.prototype.startLoad=function(t){if(this.tracks){var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,e>0&&-1===t?(h.b.log("audio:override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=T.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:t,this.state=T.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=t,this.state=T.STOPPED},e.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=T.STOPPED},e.prototype.doTick=function(){var t=void 0,e=void 0,r=void 0,i=this.hls,n=i.config;switch(this.state){case T.ERROR:case T.PAUSED:case T.BUFFER_FLUSHING:break;case T.STARTING:this.state=T.WAITING_TRACK,this.loadedmetadata=!1;break;case T.IDLE:var a=this.tracks;if(!a)break;if(!this.media&&(this.startFragRequested||!n.startFragPrefetch))break;if(this.loadedmetadata)t=this.media.currentTime;else if(void 0===(t=this.nextLoadPosition))break;var u=this.mediaBuffer?this.mediaBuffer:this.media,c=this.videoBuffer?this.videoBuffer:this.media,d=s.a.bufferInfo(u,t,n.maxBufferHole),f=s.a.bufferInfo(c,t,n.maxBufferHole),g=d.len,y=d.end,m=this.fragPrevious,b=Math.min(n.maxBufferLength,n.maxMaxBufferLength),S=Math.max(b,f.len),_=this.audioSwitch,A=this.trackId;if((g<S||_)&&A<a.length){if(void 0===(r=a[A].details)){this.state=T.WAITING_TRACK;break}if(!_&&!r.live&&m&&m.sn===r.endSN&&!d.nextStart&&(!this.media.seeking||this.media.duration-y<m.duration/2)){this.hls.trigger(l.a.BUFFER_EOS,{type:"audio"}),this.state=T.ENDED;break}var R=r.fragments,w=R.length,I=R[0].start,L=R[w-1].start+R[w-1].duration,k=void 0;if(_)if(r.live&&!r.PTSKnown)h.b.log("switching audiotrack, live stream, unknown PTS,load first fragment"),y=0;else if(y=t,r.PTSKnown&&t<I){if(!(d.end>I||d.nextStart))return;h.b.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=I+.05}if(r.initSegment&&!r.initSegment.data)k=r.initSegment;else if(y<=I){if(k=R[0],null!==this.videoTrackCC&&k.cc!==this.videoTrackCC&&(k=Object(p.b)(R,this.videoTrackCC)),r.live&&k.loadIdx&&k.loadIdx===this.fragLoadIdx){var D=d.nextStart?d.nextStart:I;return h.b.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(D+.05)),void(this.media.currentTime=D+.05)}if(this.media.readyState)for(var O=0;this.fragmentTracker.getState(k)==v.a.OK;)k=R[++O]}else{var P=void 0,C=n.maxFragLookUpTolerance,M=m?R[m.sn-R[0].sn+1]:void 0,N=function(t){var e=Math.min(C,t.duration);return t.start+t.duration-e<=y?1:t.start-e>y&&t.start?-1:0};y<L?(y>L-C&&(C=0),P=M&&!N(M)?M:o.a.search(R,N)):P=R[w-1],P&&(k=P,I=P.start,m&&k.level===m.level&&k.sn===m.sn&&k.urlId==m.urlId&&(k.sn<r.endSN?(k=R[k.sn+1-r.startSN],h.b.log("SN just loaded, load next one: "+k.sn)):k=null))}k&&(k.encrypted?(h.b.log("Loading key for "+k.sn+" of ["+r.startSN+" ,"+r.endSN+"],track "+A),this.state=T.KEY_LOADING,i.trigger(l.a.KEY_LOADING,{frag:k})):(h.b.log("Loading "+k.sn+", cc: "+k.cc+" of ["+r.startSN+" ,"+r.endSN+"],track "+A+", currentTime:"+t+",bufferEnd:"+y.toFixed(3)),(_||this.fragmentTracker.getState(k)===v.a.NOT_LOADED)&&(this.fragCurrent=k,this.startFragRequested=!0,isNaN(k.sn)||(this.nextLoadPosition=k.start+k.duration),i.trigger(l.a.FRAG_LOADING,{frag:k}),this.state=T.FRAG_LOADING)))}break;case T.WAITING_TRACK:e=this.tracks[this.trackId],e&&e.details&&(this.state=T.IDLE);break;case T.FRAG_LOADING_WAITING_RETRY:var x=E.now(),F=this.retryDate;u=this.media;var U=u&&u.seeking;(!F||x>=F||U)&&(h.b.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=T.IDLE);break;case T.WAITING_INIT_PTS:var B=this.videoTrackCC;if(void 0===this.initPTS[B])break;var G=this.waitingFragment;if(G){var j=G.frag.cc;B!==j?(e=this.tracks[this.trackId],e.details&&e.details.live&&(h.b.warn("Waiting fragment CC ("+j+") does not match video track CC ("+B+")"),this.waitingFragment=null,this.state=T.IDLE)):(this.state=T.FRAG_LOADING,this.onFragLoaded(this.waitingFragment),this.waitingFragment=null)}else this.state=T.IDLE;break;case T.STOPPED:case T.FRAG_LOADING:case T.PARSING:case T.PARSED:case T.ENDED:}if(this.media||this.mediaBuffer){var K=this.mediaBuffer?this.mediaBuffer:this.media,H=s.a.bufferInfo(K,this.media.currentTime,n.maxBufferHole),W=H.len,V=this.audioSwitch,Y=1==this.media.readyState||2==this.media.readyState;if(!V&&this.audioDecodedQueue.length>0&&(W<this.limitBufferTime||Y)){var q=this.audioDecodedQueue.shift(),X=q.frag.sn;for(this.hls.trigger(l.a.BUFFER_APPENDING,q);this.audioDecodedQueue.length>0&&this.audioDecodedQueue[0].frag.sn==X;)this.hls.trigger(l.a.BUFFER_APPENDING,this.audioDecodedQueue.shift())}}},e.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)},e.prototype.onMediaDetaching=function(){var t=this.media;t&&t.ended&&(h.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()},e.prototype.onMediaSeeking=function(){this.state===T.ENDED&&(this.state=T.IDLE),this.media&&(this.lastCurrentTime=this.media.currentTime),this.tick()},e.prototype.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},e.prototype.onAudioTracksUpdated=function(t){h.b.log("audio tracks updated"),this.tracks=t.audioTracks},e.prototype.onAudioTrackSwitching=function(t){var e=!!t.url;this.trackId=t.id,this.fragCurrent=null,this.state=T.PAUSED,this.waitingFragment=null,e?this.setInterval(100):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),e&&(this.audioSwitch=!0,this.state=T.IDLE,this._clearCache()),this.tick()},e.prototype.onAudioTrackLoaded=function(t){var e=t.details,r=t.id,i=this.tracks[r],n=e.totalduration,a=0;if(h.b.log("track "+r+" loaded ["+e.startSN+","+e.endSN+"],duration:"+n),e.live){var o=i.details;o&&e.fragments.length>0?(c.b(o,e),a=e.fragments[0].start,e.PTSKnown?h.b.log("live audio playlist sliding:"+a.toFixed(3)):h.b.log("live audio playlist - outdated PTS, unknown sliding")):(e.PTSKnown=!1,h.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;isNaN(s)?this.startPosition=0:(h.b.log("start time offset found in playlist, adjust startPosition to "+s),this.startPosition=s)}this.nextLoadPosition=this.startPosition}this.state===T.WAITING_TRACK&&(this.state=T.IDLE),this.tick()},e.prototype.onKeyLoaded=function(){this.state===T.KEY_LOADING&&(this.state=T.IDLE,this.tick())},e.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag;if(this.state===T.FRAG_LOADING&&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,c=e.cc,d=this.config.defaultAudioCodec||i.audioCodec||"mp4a.40.2",f=this.stats=t.stats;if("initSegment"===s)this.state=T.IDLE,f.tparsed=f.tbuffered=E.now(),n.initSegment.data=t.payload,this.hls.trigger(l.a.FRAG_BUFFERED,{stats:f,frag:e,id:"audio"}),this.tick();else{this.fragmentParsing&&this.unusedFragment.push(this.fragmentParsing),this.fragmentParsing=r,this.state=T.PARSING,this.appended=!1,this.demuxer||(this.demuxer=new u.a(this.hls,"audio"));var p=this.initPTS[c],g=n.initSegment?n.initSegment.data:[];if(n.initSegment||void 0!==p){this.pendingBuffering=!0,h.b.log("Demuxing "+s+" of ["+n.startSN+" ,"+n.endSN+"],track "+o);this.demuxer.push(t.payload,g,d,null,e,a,!1,p)}else h.b.log("unknown video PTS for continuity counter "+c+", waiting for video PTS before demuxing audio frag "+s+" of ["+n.startSN+" ,"+n.endSN+"],track "+o),this.waitingFragment=t,this.state=T.WAITING_INIT_PTS}}else"audio"==r.type&&this.unusedFragment.push(t.frag);this.fragLoadError=0},e.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===T.PARSING){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(l.a.BUFFER_CODECS,i),h.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",sn:t.frag.sn,frag:{type:t.frag.type,level:t.frag.level,urlId:t.frag.urlId,sn:t.frag.sn}};this.audioSwitch?this.pendingData=[o]:(this.appended=!0,this.pendingBuffering=!0,this._doAppending(o))}this.tick()}}else"audio"==r.type&&this.unusedFragment.push(r)},e.prototype.onFragParsingData=function(t){var e=this,r=this.fragCurrent,i=t.frag;if(r&&"audio"===t.id&&"audio"===t.type&&i.sn===r.sn&&i.level===r.level&&this.state===T.PARSING){var n=this.trackId,a=this.tracks[n],o=this.hls;isNaN(t.endPTS)&&(t.endPTS=t.startPTS+r.duration,t.endDTS=t.startDTS+r.duration),r.addElementaryStream(y.a.ElementaryStreamTypes.AUDIO),c.c(a.details,r,t.startPTS,t.endPTS);var u=this.audioSwitch,d=this.media,p=!1;if(u&&d)if(d.readyState){var g=d.currentTime,v=this.config.maxFragLookUpTolerance,m=s.a.bufferInfo(d,this.media.currentTime,this.hls.config.maxBufferHole),b=m.len;h.b.log("switching audio track : currentTime:"+g),g+v+b>=t.startPTS?(h.b.log("switching audio track : flushing all audio"),this.state=T.BUFFER_FLUSHING,o.trigger(l.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),p=!0,this.audioSwitch=!1,o.trigger(l.a.AUDIO_TRACK_SWITCHED,{id:n})):this.unusedFragment.push(i)}else this.audioSwitch=!1,o.trigger(l.a.AUDIO_TRACK_SWITCHED,{id:n});var E=this.pendingData;if(!E)return h.b.warn("Apparently attempt to enqueue media payload without codec initialization data upfront"),void o.trigger(l.a.ERROR,{type:f.b.MEDIA_ERROR,details:null,fatal:!0});this.audioSwitch||([t.data1,t.data2].forEach(function(e){e&&e.length&&E.push({type:t.type,data:e,parent:"audio",content:"data",sn:t.frag.sn,frag:{type:t.frag.type,level:t.frag.level,urlId:t.frag.urlId,sn:t.frag.sn}})}),!p&&E.length&&(E.forEach(function(t){e.state===T.PARSING&&(e.pendingBuffering=!0,e._doAppending(t))}),this.pendingData=[],this.appended=!0)),this.tick()}else"audio"==i.type&&this.unusedFragment.push(i)},e.prototype.onFragParsed=function(t){var e=this.fragCurrent,r=t.frag;"audio"==r.type&&r.sn===this.fragmentParsing.sn&&r.level===this.fragmentParsing.level&&(this.fragmentParsing=null),e&&"audio"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===T.PARSING&&(this.stats.tparsed=E.now(),this.state=T.PARSED,this._checkAppendedParsed())},e.prototype.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},e.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)},e.prototype.onBufferAppended=function(t){if("audio"===t.parent){var e=this.state;e!==T.PARSING&&e!==T.PARSED||(this.pendingBuffering=t.pending>0,this._checkAppendedParsed())}},e.prototype._checkAppendedParsed=function(){if(!(this.state!==T.PARSED||this.appended&&this.pendingBuffering)){var t=this.fragCurrent,e=this.stats,r=this.hls;if(t){this.fragPrevious=t,e.tbuffered=E.now(),r.trigger(l.a.FRAG_BUFFERED,{stats:e,frag:t,id:"audio"});var i=this.mediaBuffer?this.mediaBuffer:this.media;h.b.log("audio buffered : "+d.a.toString(i.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,r.trigger(l.a.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=T.IDLE}this.tick()}},e.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);h.b.warn("AudioStreamController: frag loading failed, retry in "+a+" ms"),this.retryDate=E.now()+a,this.state=T.FRAG_LOADING_WAITING_RETRY}else h.b.error("AudioStreamController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=T.ERROR}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!==T.ERROR&&(this.state=t.fatal?T.ERROR:T.IDLE,h.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===T.PARSING||this.state===T.PARSED)){var o=this.mediaBuffer,u=this.media.currentTime;if(o&&s.a.isBuffered(o,u)&&s.a.isBuffered(o,u+.5)){var c=this.config;c.maxMaxBufferLength>=c.maxBufferLength&&(c.maxMaxBufferLength/=2,h.b.warn("AudioStreamController: reduce max buffer length to "+c.maxMaxBufferLength+"s")),this.state=T.IDLE}else h.b.warn("AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=T.BUFFER_FLUSHING,this.hls.trigger(l.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}},e.prototype.onBufferFlushed=function(){var t=this,e=this.pendingData;this._clearCache(),e&&e.length?(h.b.log("AudioStreamController: appending pending audio data after buffer flushed"),e.forEach(function(e){t.hls.trigger(l.a.BUFFER_APPENDING,e)}),this.appended=!0,this.pendingData=[],this.state=T.PARSED):(this.state=T.IDLE,this.fragPrevious=null,this.tick())},e.prototype._doAppending=function(t){this.audioDecodedQueue.push(t)},e.prototype._clearCache=function(){for(var t=0;t<this.audioDecodedQueue.length;t++){var e=this.audioDecodedQueue[t];this.fragmentTracker.removeFragment(e.frag)}this.audioDecodedQueue=[];for(var r=0;r<this.unusedFragment.length;r++){var i=this.unusedFragment[r];this.fragmentTracker.removeFragment(i)}this.unusedFragment=[],this.fragmentParsing&&(this.fragmentTracker.removeFragment(this.fragmentParsing),this.fragmentParsing=null)},e.prototype.changeFragToUse=function(t){for(var e=0;e<this.unusedFragment.length;e++){var r=this.unusedFragment[e];r&&t.type==r.type&&t.level==r.level&&t.urlId==r.urlId&&t.sn==r.sn&&(this.unusedFragment.splice(e,1),e--)}},m(e,[{key:"state",set:function(t){if(this.state!==t){var e=this.state;this._state=t,h.b.log("audio stream:"+e+"->"+t)}},get:function(){return this._state}}]),e}(g.a);e.a=S},function(t,e,r){"use strict";function i(t,e,r,i){for(var a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,c=window.VTTCue||window.TextTrackCue,d=0;d<i.rows.length;d++)if(a=i.rows[d],s=!0,u=0,l="",!a.isEmpty()){for(var f=0;f<a.chars.length;f++)a.chars[f].uchar.match(/\s/)&&s?u++:(l+=a.chars[f].uchar,s=!1);a.cueStartTime=e,e===r&&(r+=1e-4),o=new c(e,r,Object(n.b)(l.trim())),u>=16?u--:u++,navigator.userAgent.match(/Firefox\//)?o.line=d+1:o.line=d>7?d-2:d+1,o.align="left",o.position=Math.max(0,Math.min(100,u/32*100+(navigator.userAgent.match(/Firefox\//)?50:0))),t.addCue(o)}}Object.defineProperty(e,"__esModule",{value:!0}),e.newCue=i;var n=r(34)},function(t,e,r){"use strict";e.a=function(){function t(t){return"string"==typeof t&&(!!a[t.toLowerCase()]&&t.toLowerCase())}function e(t){return"string"==typeof t&&(!!o[t.toLowerCase()]&&t.toLowerCase())}function r(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 i(i,a,o){var s=this,u=function(){if("undefined"!=typeof navigator)return/MSIE\s8\.0/.test(navigator.userAgent)}(),l={};u?s=document.createElement("custom"):l.enumerable=!0,s.hasBeenReset=!1;var c="",d=!1,f=i,h=a,p=o,g=null,v="",y=!0,m="auto",b="start",E=50,T="middle",S=50,_="middle";if(Object.defineProperty(s,"id",r({},l,{get:function(){return c},set:function(t){c=""+t}})),Object.defineProperty(s,"pauseOnExit",r({},l,{get:function(){return d},set:function(t){d=!!t}})),Object.defineProperty(s,"startTime",r({},l,{get:function(){return f},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");f=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"endTime",r({},l,{get:function(){return h},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");h=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"text",r({},l,{get:function(){return p},set:function(t){p=""+t,this.hasBeenReset=!0}})),Object.defineProperty(s,"region",r({},l,{get:function(){return g},set:function(t){g=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"vertical",r({},l,{get:function(){return v},set:function(e){var r=t(e);if(!1===r)throw new SyntaxError("An invalid or illegal string was specified.");v=r,this.hasBeenReset=!0}})),Object.defineProperty(s,"snapToLines",r({},l,{get:function(){return y},set:function(t){y=!!t,this.hasBeenReset=!0}})),Object.defineProperty(s,"line",r({},l,{get:function(){return m},set:function(t){if("number"!=typeof t&&t!==n)throw new SyntaxError("An invalid number or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"lineAlign",r({},l,{get:function(){return b},set:function(t){var r=e(t);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");b=r,this.hasBeenReset=!0}})),Object.defineProperty(s,"position",r({},l,{get:function(){return E},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"positionAlign",r({},l,{get:function(){return T},set:function(t){var r=e(t);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");T=r,this.hasBeenReset=!0}})),Object.defineProperty(s,"size",r({},l,{get:function(){return S},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");S=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"align",r({},l,{get:function(){return _},set:function(t){var r=e(t);if(!r)throw new SyntaxError("An invalid or illegal string was specified.");_=r,this.hasBeenReset=!0}})),s.displayState=void 0,u)return s}if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var n="auto",a={"":!0,lr:!0,rl:!0},o={start:!0,middle:!0,end:!0,left:!0,right:!0};return i.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},i}()},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}function o(t,e){return t&&t.label===e.name&&!(t.textTrack1||t.textTrack2)}function s(t,e,r,i){return Math.min(e,i)-Math.max(t,r)}var u=r(1),l=r(3),c=r(80),d=r(81),f=r(82),h=r(0),p=r(32),g=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,u.a.MEDIA_ATTACHING,u.a.MEDIA_DETACHING,u.a.FRAG_PARSING_USERDATA,u.a.FRAG_DECRYPTED,u.a.MANIFEST_LOADING,u.a.MANIFEST_LOADED,u.a.FRAG_LOADED,u.a.LEVEL_SWITCHING,u.a.INIT_PTS_FOUND));if(a.hls=r,a.config=r.config,a.enabled=!0,a.Cues=r.config.cueHandler,a.textTracks=[],a.tracks=[],a.unparsedVttFrags=[],a.initPTS=void 0,a.cueRanges=[],a.captionsTracks={},a.captionsProperties={textTrack1:{label:a.config.captionsTextTrack1Label,languageCode:a.config.captionsTextTrack1LanguageCode},textTrack2:{label:a.config.captionsTextTrack2Label,languageCode:a.config.captionsTextTrack2LanguageCode}},a.config.enableCEA708Captions){var o=new d.a(a,"textTrack1"),s=new d.a(a,"textTrack2");a.cea608Parser=new c.a(0,o,s)}return a}return a(e,t),e.prototype.addCues=function(t,e,r,i){for(var n=this.cueRanges,a=!1,o=n.length;o--;){var u=n[o],l=s(u[0],u[1],e,r);if(l>=0&&(u[0]=Math.min(u[0],e),u[1]=Math.max(u[1],r),a=!0,l/(r-e)>.5))return}a||n.push([e,r]),this.Cues.newCue(this.captionsTracks[t],e,r,i)},e.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=[])},e.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},e.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,Object(p.a)(n[t]),Object(p.b)(n[t],this.media);else{var o=this.createTextTrack("captions",r,i);o&&(o[t]=!0,n[t]=o)}}},e.prototype.createTextTrack=function(t,e,r){var i=this.media;if(i)return i.addTextTrack(t,e,r)},e.prototype.destroy=function(){l.a.prototype.destroy.call(this)},e.prototype.onMediaAttaching=function(t){this.media=t.media,this._cleanTracks()},e.prototype.onMediaDetaching=function(){var t=this.captionsTracks;Object.keys(t).forEach(function(e){Object(p.a)(t[e]),delete t[e]})},e.prototype.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0},this._cleanTracks()},e.prototype._cleanTracks=function(){var t=this.media;if(t){var e=t.textTracks;if(e)for(var r=0;r<e.length;r++)Object(p.a)(e[r])}},e.prototype.onManifestLoaded=function(t){var e=this;if(this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=void 0,this.cueRanges=[],this.config.enableWebVTT){this.tracks=t.subtitles||[];var r=this.media?this.media.textTracks:[];this.tracks.forEach(function(t,i){var n=void 0;if(i<r.length){var a=r[i];o(a,t)&&(n=a)}n||(n=e.createTextTrack("subtitles",t.name,t.lang)),t.default?n.mode=e.hls.subtitleDisplay?"showing":"hidden":n.mode="disabled",e.textTracks.push(n)})}},e.prototype.onLevelSwitching=function(){this.enabled="NONE"!==this.hls.currentLevel.closedCaptions},e.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(u.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})},e.prototype._parseVTTs=function(t,e){var r=this.vttCCs;r[t.cc]||(r[t.cc]={start:t.start,prevCC:this.prevCC,new:!0},this.prevCC=t.cc);var i=this.textTracks,n=this.hls;f.a.parse(e,this.initPTS,r,t.cc,function(e){var r=i[t.trackId];if("disabled"===r.mode)return void n.trigger(u.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t});e.forEach(function(t){if(!r.cues.getCueById(t.id))try{r.addCue(t)}catch(i){var e=new window.TextTrackCue(t.startTime,t.endTime,t.text);e.id=t.id,r.addCue(e)}}),n.trigger(u.a.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},function(e){h.b.log("Failed to parse VTT cue: "+e),n.trigger(u.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t})})},e.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)}},e.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)}},e.prototype.extractCea608Data=function(t){for(var e=31&t[0],r=2,i=void 0,n=void 0,a=void 0,o=void 0,s=void 0,u=[],l=0;l<e;l++)i=t[r++],n=127&t[r++],a=127&t[r++],o=0!=(4&i),s=3&i,0===n&&0===a||o&&0===s&&(u.push(n),u.push(a));return u},e}(l.a);e.a=g},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n={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},a=function(t){var e=t;return n.hasOwnProperty(t)&&(e=n[t]),String.fromCharCode(e)},o=15,s=100,u={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},l={17:2,18:4,21:6,22:8,23:10,19:13,20:15},c={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},d={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],h={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}},p=function(t){for(var e=[],r=0;r<t.length;r++)e.push(t[r].toString(16));return e},g=function(){function t(e,r,n,a,o){i(this,t),this.foreground=e||"white",this.underline=r||!1,this.italics=n||!1,this.background=a||"black",this.flash=o||!1}return t.prototype.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},t.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])}},t.prototype.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},t.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},t.prototype.copy=function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash},t.prototype.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},t}(),v=function(){function t(e,r,n,a,o,s){i(this,t),this.uchar=e||" ",this.penState=new g(r,n,a,o,s)}return t.prototype.reset=function(){this.uchar=" ",this.penState.reset()},t.prototype.setChar=function(t,e){this.uchar=t,this.penState.copy(e)},t.prototype.setPenState=function(t){this.penState.copy(t)},t.prototype.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)},t.prototype.copy=function(t){this.uchar=t.uchar,this.penState.copy(t.penState)},t.prototype.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},t}(),y=function(){function t(){i(this,t),this.chars=[];for(var e=0;e<s;e++)this.chars.push(new v);this.pos=0,this.currPenState=new g}return t.prototype.equals=function(t){for(var e=!0,r=0;r<s;r++)if(!this.chars[r].equals(t.chars[r])){e=!1;break}return e},t.prototype.copy=function(t){for(var e=0;e<s;e++)this.chars[e].copy(t.chars[e])},t.prototype.isEmpty=function(){for(var t=!0,e=0;e<s;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t},t.prototype.setCursor=function(t){this.pos!==t&&(this.pos=t),this.pos<0?(h.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>s&&(h.log("ERROR","Too large cursor position "+this.pos),this.pos=s)},t.prototype.moveCursor=function(t){var e=this.pos+t;if(t>1)for(var r=this.pos+1;r<e+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(e)},t.prototype.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},t.prototype.insertChar=function(t){t>=144&&this.backSpace();var e=a(t);if(this.pos>=s)return void h.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)},t.prototype.clearFromPos=function(t){var e=void 0;for(e=t;e<s;e++)this.chars[e].reset()},t.prototype.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.prototype.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.prototype.getTextString=function(){for(var t=[],e=!0,r=0;r<s;r++){var i=this.chars[r].uchar;" "!==i&&(e=!1),t.push(i)}return e?"":t.join("")},t.prototype.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},t}(),m=function(){function t(){i(this,t),this.rows=[];for(var e=0;e<o;e++)this.rows.push(new y);this.currRow=o-1,this.nrRollUpRows=null,this.reset()}return t.prototype.reset=function(){for(var t=0;t<o;t++)this.rows[t].clear();this.currRow=o-1},t.prototype.equals=function(t){for(var e=!0,r=0;r<o;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e},t.prototype.copy=function(t){for(var e=0;e<o;e++)this.rows[e].copy(t.rows[e])},t.prototype.isEmpty=function(){for(var t=!0,e=0;e<o;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t},t.prototype.backSpace=function(){this.rows[this.currRow].backSpace()},t.prototype.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},t.prototype.insertChar=function(t){this.rows[this.currRow].insertChar(t)},t.prototype.setPen=function(t){this.rows[this.currRow].setPenStyles(t)},t.prototype.moveCursor=function(t){this.rows[this.currRow].moveCursor(t)},t.prototype.setCursor=function(t){h.log("INFO","setCursor: "+t),this.rows[this.currRow].setCursor(t)},t.prototype.setPAC=function(t){h.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<o;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<h.time)for(var s=0;s<this.nrRollUpRows;s++)this.rows[e-this.nrRollUpRows+s+1].copy(n.rows[i+s])}}this.currRow=e;var u=this.rows[this.currRow];if(null!==t.indent){var l=t.indent,c=Math.max(l-1,0);u.setCursor(t.indent),t.color=u.chars[c].penState.foreground}var d={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(d)},t.prototype.setBkgData=function(t){h.log("INFO","bkgData = "+JSON.stringify(t)),this.backSpace(),this.setPen(t),this.insertChar(32)},t.prototype.setRollUpRows=function(t){this.nrRollUpRows=t},t.prototype.rollUp=function(){if(null===this.nrRollUpRows)return void h.log("DEBUG","roll_up but nrRollUpRows not set yet");h.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),h.log("INFO","Rolling up")},t.prototype.getDisplayText=function(t){t=t||!1;for(var e=[],r="",i=-1,n=0;n<o;n++){var a=this.rows[n].getTextString();a&&(i=n+1,t?e.push("Row "+i+": '"+a+"'"):e.push(a.trim()))}return e.length>0&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r},t.prototype.getTextAndFormat=function(){return this.rows},t}(),b=function(){function t(e,r){i(this,t),this.chNr=e,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new m,this.nonDisplayedMemory=new m,this.lastOutputScreen=new m,this.currRollUpRow=this.displayedMemory.rows[o-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}return t.prototype.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[o-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},t.prototype.getHandler=function(){return this.outputFilter},t.prototype.setHandler=function(t){this.outputFilter=t},t.prototype.setPAC=function(t){this.writeScreen.setPAC(t)},t.prototype.setBkgData=function(t){this.writeScreen.setBkgData(t)},t.prototype.setMode=function(t){t!==this.mode&&(this.mode=t,h.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)},t.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";h.log("INFO",r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(h.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},t.prototype.ccRCL=function(){h.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.prototype.ccBS=function(){h.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},t.prototype.ccAOF=function(){},t.prototype.ccAON=function(){},t.prototype.ccDER=function(){h.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.prototype.ccRU=function(t){h.log("INFO","RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)},t.prototype.ccFON=function(){h.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.prototype.ccRDC=function(){h.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.prototype.ccTR=function(){h.log("INFO","TR"),this.setMode("MODE_TEXT")},t.prototype.ccRTD=function(){h.log("INFO","RTD"),this.setMode("MODE_TEXT")},t.prototype.ccEDM=function(){h.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.prototype.ccCR=function(){h.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.prototype.ccENM=function(){h.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.prototype.ccEOC=function(){if(h.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,h.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},t.prototype.ccTO=function(t){h.log("INFO","TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)},t.prototype.ccMIDROW=function(t){var e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{var r=Math.floor(t/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=i[r]}h.log("INFO","MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},t.prototype.outputDataUpdate=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=h.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),!0===t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue()),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},t.prototype.cueSplitAtTime=function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))},t}(),E=function(){function t(e,r,n){i(this,t),this.field=e||1,this.outputs=[r,n],this.channels=[new b(1,r),new b(2,n)],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 t.prototype.getHandler=function(t){return this.channels[t].getHandler()},t.prototype.setHandler=function(t,e){this.channels[t].setHandler(e)},t.prototype.addData=function(t,e){var r=void 0,i=void 0,n=void 0,a=!1;this.lastTime=t,h.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(h.log("DATA","["+p([e[o],e[o+1]])+"] -> ("+p([i,n])+")"),r=this.parseCmd(i,n),r||(r=this.parseMidrow(i,n)),r||(r=this.parsePAC(i,n)),r||(r=this.parseBackgroundAttributes(i,n)),!r&&(a=this.parseChars(i,n)))if(this.currChNr&&this.currChNr>=0){var s=this.channels[this.currChNr-1];s.insertChars(a)}else h.log("WARNING","No channel found yet. TEXT-MODE?");r?this.dataCounters.cmd+=2:a?this.dataCounters.char+=2:(this.dataCounters.other+=2,h.log("WARNING","Couldn't parse cleaned data "+p([i,n])+" orig: "+p([e[o],e[o+1]])))}else this.dataCounters.padding+=2},t.prototype.parseCmd=function(t,e){var r=null,i=(20===t||28===t)&&e>=32&&e<=47,n=(23===t||31===t)&&e>=33&&e<=35;if(!i&&!n)return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,h.log("DEBUG","Repeated command ("+p([t,e])+") is dropped"),!0;r=20===t||23===t?1:2;var a=this.channels[r-1];return 20===t||28===t?32===e?a.ccRCL():33===e?a.ccBS():34===e?a.ccAOF():35===e?a.ccAON():36===e?a.ccDER():37===e?a.ccRU(2):38===e?a.ccRU(3):39===e?a.ccRU(4):40===e?a.ccFON():41===e?a.ccRDC():42===e?a.ccTR():43===e?a.ccRTD():44===e?a.ccEDM():45===e?a.ccCR():46===e?a.ccENM():47===e&&a.ccEOC():a.ccTO(e-32),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=r,!0},t.prototype.parseMidrow=function(t,e){var r=null;if((17===t||25===t)&&e>=32&&e<=47){if((r=17===t?1:2)!==this.currChNr)return h.log("ERROR","Mismatch channel in midrow parsing"),!1;return this.channels[r-1].ccMIDROW(e),h.log("DEBUG","MIDROW ("+p([t,e])+")"),!0}return!1},t.prototype.parsePAC=function(t,e){var r=null,i=null,n=(t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127,a=(16===t||24===t)&&e>=64&&e<=95;if(!n&&!a)return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;r=t<=23?1:2,i=e>=64&&e<=95?1===r?u[t]:c[t]:1===r?l[t]:d[t];var o=this.interpretPAC(i,e);return this.channels[r-1].setPAC(o),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=r,!0},t.prototype.interpretPAC=function(t,e){var r=e,i={color:null,italics:!1,indent:null,underline:!1,row:t};return r=e>95?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},t.prototype.parseChars=function(t,e){var r=null,i=null,n=null;if(t>=25?(r=2,n=t-8):(r=1,n=t),n>=17&&n<=19){var o=e;o=17===n?e+80:18===n?e+112:e+144,h.log("INFO","Special char '"+a(o)+"' in channel "+r),i=[o]}else t>=32&&t<=127&&(i=0===e?[t]:[t,e]);if(i){var s=p(i);h.log("DEBUG","Char codes = "+s.join(",")),this.lastCmdA=null,this.lastCmdB=null}return i},t.prototype.parseBackgroundAttributes=function(t,e){var r=void 0,i=void 0,n=void 0,a=void 0,o=(16===t||24===t)&&e>=32&&e<=47,s=(23===t||31===t)&&e>=45&&e<=47;return!(!o&&!s)&&(r={},16===t||24===t?(i=Math.floor((e-32)/2),r.background=f[i],e%2==1&&(r.background=r.background+"_semi")):45===e?r.background="transparent":(r.foreground="black",47===e&&(r.underline=!0)),n=t<24?1:2,a=this.channels[n-1],a.setBkgData(r),this.lastCmdA=null,this.lastCmdB=null,!0)},t.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},t.prototype.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].cueSplitAtTime(t)},t}();e.a=E},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(e,r){i(this,t),this.timelineController=e,this.trackName=r,this.startTime=null,this.endTime=null,this.screen=null}return t.prototype.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen),this.startTime=null)},t.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)},t}();e.a=n},function(t,e,r){"use strict";var i=r(34),n=r(10),a=function(t,e,r){return t.substr(r||0,e.length)===e},o=function(t){var e=parseInt(t.substr(-3)),r=parseInt(t.substr(-6,2)),i=parseInt(t.substr(-9,2)),n=t.length>9?parseInt(t.substr(0,t.indexOf(":"))):0;return isNaN(e)||isNaN(r)||isNaN(i)||isNaN(n)?-1:(e+=1e3*r,e+=6e4*i,e+=36e5*n)},s=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()},u=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,void(i.new=!1);for(;n&&n.new;)t.ccOffset+=i.start-n.start,i.new=!1,i=n,n=t[i.prevCC];t.presentationOffset=r},l={parse:function(t,e,r,l,c,d){var f=/\r\n|\n\r|\n|\r/g,h=Object(n.b)(new Uint8Array(t)).trim().replace(f,"\n").split("\n"),p="00:00.000",g=0,v=0,y=0,m=[],b=void 0,E=!0,T=new i.a;T.oncue=function(t){var e=r[l],i=r.ccOffset;e&&e.new&&(void 0!==v?i=r.ccOffset=e.start:u(r,l,y)),y&&(i=y+r.ccOffset-r.presentationOffset),t.startTime+=i-v,t.endTime+=i-v,t.id=s(t.startTime.toString())+s(t.endTime.toString())+s(t.text),t.text=decodeURIComponent(encodeURIComponent(t.text)),t.endTime>0&&m.push(t)},T.onparsingerror=function(t){b=t},T.onflush=function(){if(b&&d)return void d(b);c(m)},h.forEach(function(t){if(E){if(a(t,"X-TIMESTAMP-MAP=")){E=!1,t.substr(16).split(",").forEach(function(t){a(t,"LOCAL:")?p=t.substr(6):a(t,"MPEGTS:")&&(g=parseInt(t.substr(7)))});try{e=e<0?e+8589934592:e,g-=e,v=o(p)/1e3,y=g/9e4,-1===v&&(b=new Error("Malformed X-TIMESTAMP-MAP: "+t))}catch(e){b=new Error("Malformed X-TIMESTAMP-MAP: "+t)}return}""===t&&(E=!1)}T.parse(t+"\n")}),T.flush()}};e.a=l},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}function o(t){for(var e=[],r=0;r<t.length;r++)"subtitles"===t[r].kind&&e.push(t[r]);return e}var s=r(1),u=r(3),l=r(0),c=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),d=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,s.a.MEDIA_ATTACHED,s.a.MEDIA_DETACHING,s.a.MANIFEST_LOADING,s.a.MANIFEST_LOADED,s.a.SUBTITLE_TRACK_LOADED));return a.tracks=[],a.trackId=-1,a.media=null,a.subtitleDisplay=!0,a}return a(e,t),e.prototype._onTextTracksChanged=function(){if(this.media){for(var t=-1,e=o(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}},e.prototype.destroy=function(){u.a.prototype.destroy.call(this)},e.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))},e.prototype.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),this.media=null)},e.prototype.onManifestLoading=function(){this.tracks=[],this.trackId=-1},e.prototype.onManifestLoaded=function(t){var e=this,r=t.subtitles||[];this.tracks=r,this.trackId=-1,this.hls.trigger(s.a.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:r}),r.forEach(function(t){t.default&&(e.media?e.subtitleTrack=t.id:e.queuedDefaultTrack=t.id)})},e.prototype.onTick=function(){var t=this.trackId,e=this.tracks[t];if(e){var r=e.details;r&&!r.live||(l.b.log("(re)loading playlist for subtitle track "+t),this.hls.trigger(s.a.SUBTITLE_TRACK_LOADING,{url:e.url,id:t}))}},e.prototype.onSubtitleTrackLoaded=function(t){var e=this;t.id<this.tracks.length&&(l.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())},e.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,l.b.log("switching to subtitle track "+t),e.trigger(s.a.SUBTITLE_TRACK_SWITCH,{id:t}),-1!==t)){var i=r[t],n=i.details;n&&!n.live||(l.b.log("(re)loading playlist for subtitle track "+t),e.trigger(s.a.SUBTITLE_TRACK_LOADING,{url:i.url,id:t}))}},e.prototype._stopTimer=function(){this.timer&&(clearInterval(this.timer),this.timer=null)},e.prototype._toggleTrackModes=function(t){var e=this.media,r=this.subtitleDisplay,i=this.trackId;if(e){var n=o(e.textTracks);if(-1===t)[].slice.call(n).forEach(function(t){t.mode="disabled"});else{var a=n[i];a&&(a.mode="disabled")}var s=n[t];s&&(s.mode=r?"showing":"hidden")}},c(e,[{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))}}]),e}(u.a);e.a=d},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(1),s=r(0),u=r(16),l=r(11),c=window,d=c.performance,f={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING"},h=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,o.a.MEDIA_ATTACHED,o.a.ERROR,o.a.KEY_LOADED,o.a.FRAG_LOADED,o.a.SUBTITLE_TRACKS_UPDATED,o.a.SUBTITLE_TRACK_SWITCH,o.a.SUBTITLE_TRACK_LOADED,o.a.SUBTITLE_FRAG_PROCESSED));return a.config=r.config,a.vttFragSNsProcessed={},a.vttFragQueues=void 0,a.currentlyProcessing=null,a.state=f.STOPPED,a.currentTrackId=-1,a.decrypter=new u.a(r.observer,r.config),a}return a(e,t),e.prototype.onHandlerDestroyed=function(){this.state=f.STOPPED},e.prototype.clearVttFragQueues=function(){var t=this;this.vttFragQueues={},this.tracks.forEach(function(e){t.vttFragQueues[e.id]=[]})},e.prototype.nextFrag=function(){if(null===this.currentlyProcessing&&this.currentTrackId>-1&&this.vttFragQueues[this.currentTrackId].length){var t=this.currentlyProcessing=this.vttFragQueues[this.currentTrackId].shift();this.fragCurrent=t,this.hls.trigger(o.a.FRAG_LOADING,{frag:t}),this.state=f.FRAG_LOADING}},e.prototype.onSubtitleFragProcessed=function(t){t.success&&this.vttFragSNsProcessed[t.frag.trackId].push(t.frag.sn),this.currentlyProcessing=null,this.state=f.IDLE,this.nextFrag()},e.prototype.onMediaAttached=function(){this.state=f.IDLE},e.prototype.onError=function(t){var e=t.frag;e&&"subtitle"!==e.type||this.currentlyProcessing&&(this.currentlyProcessing=null,this.nextFrag())},e.prototype.doTick=function(){var t=this;switch(this.state){case f.IDLE:var e=this.tracks,r=this.currentTrackId,i=this.vttFragSNsProcessed[r],n=this.vttFragQueues[r],a=this.currentlyProcessing?this.currentlyProcessing.sn:-1,u=function(t){return i.indexOf(t.sn)>-1},l=function(t){return n.some(function(e){return e.sn===t.sn})};if(!e)break;var c;if(r<e.length&&(c=e[r].details),void 0===c)break;c.fragments.forEach(function(e){u(e)||e.sn===a||l(e)||(e.encrypted?(s.b.log("Loading key for "+e.sn),t.state=f.KEY_LOADING,t.hls.trigger(o.a.KEY_LOADING,{frag:e})):(e.trackId=r,n.push(e),t.nextFrag()))})}},e.prototype.onSubtitleTracksUpdated=function(t){var e=this;s.b.log("subtitle tracks updated"),this.tracks=t.subtitleTracks,this.clearVttFragQueues(),this.vttFragSNsProcessed={},this.tracks.forEach(function(t){e.vttFragSNsProcessed[t.id]=[]})},e.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()}},e.prototype.onSubtitleTrackLoaded=function(){this.tick()},e.prototype.onKeyLoaded=function(){this.state===f.KEY_LOADING&&(this.state=f.IDLE,this.tick())},e.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag.decryptdata,i=t.frag,n=this.hls;if(this.state===f.FRAG_LOADING&&e&&"subtitle"===t.frag.type&&e.sn===t.frag.sn&&t.payload.byteLength>0&&null!=r&&null!=r.key&&"AES-128"===r.method){var a=void 0;try{a=d.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=d.now()}catch(t){e=Date.now()}n.trigger(o.a.FRAG_DECRYPTED,{frag:i,payload:t,stats:{tstart:a,tdecrypt:e}})})}},e}(l.a);e.a=h},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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}function a(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)}var o=r(3),s=r(1),u=r(2),l=r(0),c=function(){function t(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(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),e}}(),d=window,f=d.XMLHttpRequest,h={WIDEVINE:"com.widevine.alpha",PLAYREADY:"com.microsoft.playready"},p=function(t,e,r){var i={videoCapabilities:[]};return e.forEach(function(t){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"'})}),[i]},g=function(t,e,r){switch(t){case h.WIDEVINE:return p(0,r);default:throw Error("Unknown key-system: "+t)}},v=function(t){function e(r){i(this,e);var a=n(this,t.call(this,r,s.a.MEDIA_ATTACHED,s.a.MANIFEST_PARSED));return a._widevineLicenseUrl=r.config.widevineLicenseUrl,a._licenseXhrSetup=r.config.licenseXhrSetup,a._emeEnabled=r.config.emeEnabled,a._requestMediaKeySystemAccess=r.config.requestMediaKeySystemAccessFunc,a._mediaKeysList=[],a._media=null,a._hasSetMediaKeys=!1,a._isMediaEncrypted=!1,a._requestLicenseFailureCount=0,a}return a(e,t),e.prototype.getLicenseServerUrl=function(t){var e=void 0;switch(t){case h.WIDEVINE:e=this._widevineLicenseUrl;break;default:e=null}return e||(l.b.error('No license server URL configured for key-system "'+t+'"'),this.hls.trigger(s.a.ERROR,{type:u.b.KEY_SYSTEM_ERROR,details:u.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})),e},e.prototype._attemptKeySystemAccess=function(t,e,r){var i=this,n=g(t,0,r);if(!n)return void l.b.warn("Can not create config for key-system (maybe because platform is not supported):",t);l.b.log("Requesting encrypted media key-system access"),this.requestMediaKeySystemAccess(t,n).then(function(e){i._onMediaKeySystemAccessObtained(t,e)}).catch(function(e){l.b.error('Failed to obtain key-system "'+t+'" access:',e)})},e.prototype._onMediaKeySystemAccessObtained=function(t,e){var r=this;l.b.log('Access for key-system "'+t+'" obtained');var i={mediaKeys:null,mediaKeysSession:null,mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:t};this._mediaKeysList.push(i),e.createMediaKeys().then(function(e){i.mediaKeys=e,l.b.log('Media-keys created for key-system "'+t+'"'),r._onMediaKeysCreated()}).catch(function(t){l.b.error("Failed to create media-keys:",t)})},e.prototype._onMediaKeysCreated=function(){var t=this;this._mediaKeysList.forEach(function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),t._onNewMediaKeySession(e.mediaKeysSession))})},e.prototype._onNewMediaKeySession=function(t){var e=this;l.b.log("New key-system session "+t.sessionId),t.addEventListener("message",function(r){e._onKeySessionMessage(t,r.message)},!1)},e.prototype._onKeySessionMessage=function(t,e){l.b.log("Got EME message event, creating license request"),this._requestLicense(e,function(e){l.b.log("Received license data, updating key-session"),t.update(e)})},e.prototype._onMediaEncrypted=function(t,e){l.b.log('Media is encrypted using "'+t+'" init data type'),this._isMediaEncrypted=!0,this._mediaEncryptionInitDataType=t,this._mediaEncryptionInitData=e,this._attemptSetMediaKeys(),this._generateRequestWithPreferredKeySession()},e.prototype._attemptSetMediaKeys=function(){if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys)return l.b.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(s.a.ERROR,{type:u.b.KEY_SYSTEM_ERROR,details:u.a.KEY_SYSTEM_NO_KEYS,fatal:!0});l.b.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},e.prototype._generateRequestWithPreferredKeySession=function(){var t=this,e=this._mediaKeysList[0];if(!e)return l.b.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(s.a.ERROR,{type:u.b.KEY_SYSTEM_ERROR,details:u.a.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(e.mediaKeysSessionInitialized)return void l.b.warn("Key-Session already initialized but requested again");var r=e.mediaKeysSession;r||(l.b.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(s.a.ERROR,{type:u.b.KEY_SYSTEM_ERROR,details:u.a.KEY_SYSTEM_NO_SESSION,fatal:!0}));var i=this._mediaEncryptionInitDataType,n=this._mediaEncryptionInitData;l.b.log('Generating key-session request for "'+i+'" init data type'),e.mediaKeysSessionInitialized=!0,r.generateRequest(i,n).then(function(){l.b.debug("Key-session generation succeeded")}).catch(function(e){l.b.error("Error generating key-session request:",e),t.hls.trigger(s.a.ERROR,{type:u.b.KEY_SYSTEM_ERROR,details:u.a.KEY_SYSTEM_NO_SESSION,fatal:!1})})},e.prototype._createLicenseXhr=function(t,e,r){var i=new f,n=this._licenseXhrSetup;try{if(n)try{n(i,t)}catch(e){i.open("POST",t,!0),n(i,t)}i.readyState||i.open("POST",t,!0)}catch(t){return l.b.error("Error setting up key-system license XHR",t),void this.hls.trigger(s.a.ERROR,{type:u.b.KEY_SYSTEM_ERROR,details:u.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}return i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,t,e,r),i},e.prototype._onLicenseRequestReadyStageChange=function(t,e,r,i){switch(t.readyState){case 4:if(200===t.status)this._requestLicenseFailureCount=0,l.b.log("License request succeeded"),i(t.response);else{if(l.b.error("License Request XHR failed ("+e+"). Status: "+t.status+" ("+t.statusText+")"),++this._requestLicenseFailureCount<=3){var n=3-this._requestLicenseFailureCount+1;return l.b.warn("Retrying license request, "+n+" attempts left"),void this._requestLicense(r,i)}this.hls.trigger(s.a.ERROR,{type:u.b.KEY_SYSTEM_ERROR,details:u.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}}},e.prototype._generateLicenseRequestChallenge=function(t,e){var r=void 0;return t.mediaKeySystemDomain===h.PLAYREADY?l.b.error("PlayReady is not supported (yet)"):t.mediaKeySystemDomain===h.WIDEVINE?r=e:l.b.error("Unsupported key-system:",t.mediaKeySystemDomain),r},e.prototype._requestLicense=function(t,e){l.b.log("Requesting content license for key-system");var r=this._mediaKeysList[0];if(!r)return l.b.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(s.a.ERROR,{type:u.b.KEY_SYSTEM_ERROR,details:u.a.KEY_SYSTEM_NO_ACCESS,fatal:!0});var i=this.getLicenseServerUrl(r.mediaKeySystemDomain),n=this._createLicenseXhr(i,t,e);l.b.log("Sending license request to URL: "+i),n.send(this._generateLicenseRequestChallenge(r,t))},e.prototype.onMediaAttached=function(t){var e=this;if(this._emeEnabled){var r=t.media;this._media=r,r.addEventListener("encrypted",function(t){e._onMediaEncrypted(t.initDataType,t.initData)})}},e.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(h.WIDEVINE,e,r)}},c(e,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),e}(o.a);e.a=v},function(t,e,r){"use strict";r.d(e,"a",function(){return i});var i=function(){return"undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null}()},function(t,e){/*! http://mths.be/endswith v0.2.0 by @mathias */
2
+ String.prototype.endsWith||function(){"use strict";var t=function(){try{var t={},e=Object.defineProperty,r=e(t,t,t)&&e}catch(t){}return r}(),e={}.toString,r=function(t){if(null==this)throw TypeError();var r=String(this);if(t&&"[object RegExp]"==e.call(t))throw TypeError();var i=r.length,n=String(t),a=n.length,o=i;if(arguments.length>1){var s=arguments[1];void 0!==s&&(o=s?Number(s):0)!=o&&(o=0)}var u=Math.min(Math.max(o,0),i),l=u-a;if(l<0)return!1;for(var c=-1;++c<a;)if(r.charCodeAt(l+c)!=n.charCodeAt(c))return!1;return!0};t?t(String.prototype,"endsWith",{value:r,configurable:!0,writable:!0}):String.prototype.endsWith=r}()},function(t,e,r){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(){}function a(){}function o(){}function s(){}function u(){}function l(){}var c="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},d=function(){function t(){i(this,t),this.logs=[],this.objQueue=[],this.timeOut=15e3,this.maxLog=20,this.setupTimer()}return t.prototype.setupTimer=function(){var t=this;this.timer=setTimeout(function(){t.timer=null,t.sendLog()},this.timeOut)},t.prototype.pushLog=function(t){this.objQueue=[],this.logs.push({log:this.pureObject(t),time:Date.now()}),this.triggerEventSend()},t.prototype.triggerEventSend=function(){this.logs.length>this.maxLog&&this.sendLog()},t.prototype.sendLog=function(){this.timer&&clearTimeout(this.timer),this.sendDataToServer(),this.setupTimer()},t.prototype.sendDataToServer=function(){if(this.logs.length>0){var t=JSON.stringify(this.logs);console.log(t)}this.logs=[]},t.prototype.pureObject=function(t){var e=this,r=t,i=void 0===t?"undefined":c(t),n=!1;if(this.objQueue.forEach(function(e){e==t&&(n=!0)}),n)return"circle";do{if(!t)break;if(Array.isArray(t)){if(t.length>100)break;r=t.map(function(t){return e.pureObject(t)});break}if("object"==i&&!Array.isArray(t)){this.objQueue.push(t),r={},Object.keys(t).forEach(function(i){r[i]=e.pureObject(t[i])});break}if("function"==i){r="Function()";break}r=t}while(!1);return r},t}();new d;e.a={debug:n,log:a,warn:o,error:s,info:u,track:l}}]).default});