!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Hls=e():t.Hls=e()}(this,function(){return(a={},i.m=r=[function(t,e,r){"use strict";function i(){}function a(n){var o=u.console[n];return o?function(){for(var t=arguments.length,e=Array(t),r=0;r<t;r++)e[r]=arguments[r];var i,a;e[0]&&(e[0]=(i=n,a=e[0],"["+i+"] > "+a)),o.apply(u.console,e)}:i}r.d(e,"a",function(){return d}),r.d(e,"b",function(){return c});var n=r(4),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={trace:i,debug:i,log:i,warn:i,info:i,error:i},l=s,u=Object(n.a)(),d=function(t){if(!0===t||"object"===(void 0===t?"undefined":o(t))){!function(e){for(var t=arguments.length,r=Array(1<t?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];r.forEach(function(t){l[t]=e[t]?e[t].bind(e):a(t)})}(t,"debug","log","info","warn","error");try{l.log()}catch(t){l=s}}else l=s},c=l},function(t,e,r){"use strict";e.a={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},function(t,e,r){"use strict";r.d(e,"b",function(){return i}),r.d(e,"a",function(){return a});var i={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",KEY_SYSTEM_ERROR:"keySystemError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"},a={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";var i=r(0),a=r(2),n=r(1),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=new Set(["hlsEventGeneric","hlsHandlerDestroying","hlsHandlerDestroyed"]),l=(u.prototype.destroy=function(){this.onHandlerDestroying(),this.unregisterListeners(),this.onHandlerDestroyed()},u.prototype.onHandlerDestroying=function(){},u.prototype.onHandlerDestroyed=function(){},u.prototype.isEventHandler=function(){return"object"===o(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent},u.prototype.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){if(s.has(t))throw new Error("Forbidden event-name: "+t);this.hls.on(t,this.onEvent)},this)},u.prototype.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){this.hls.off(t,this.onEvent)},this)},u.prototype.onEvent=function(t,e){this.onEventGeneric(t,e)},u.prototype.onEventGeneric=function(t,e){try{(function(t,e){var r="on"+t.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,e)}).call(this,t,e).call()}catch(e){i.b.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.hls.trigger(n.a.ERROR,{type:a.b.OTHER_ERROR,details:a.a.INTERNAL_EXCEPTION,fatal:!1,event:t,err:e})}},u);function u(t){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,u),this.hls=t,this.onEvent=this.onEvent.bind(this);for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];this.handledEvents=r,this.useGenericHandler=!0,this.registerListeners()}e.a=l},function(t,e,r){"use strict";e.a=function(){return"undefined"==typeof window?self:window}},function(t,e,r){var i,d,a,n,c;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,d=/^([^\/;?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,c={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=this.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");return i.path=c.normalizePath(i.path),c.buildURLFromParts(i)}var a=this.parseURL(e);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=c.normalizePath(a.path),c.buildURLFromParts(a)):e;var n=this.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var o=d.exec(n.path);n.netLoc=o[1],n.path=o[2]}n.netLoc&&!n.path&&(n.path="/");var s={scheme:n.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(s.netLoc=n.netLoc,"/"!==a.path[0]))if(a.path){var l=n.path,u=l.substring(0,l.lastIndexOf("/")+1)+a.path;s.path=c.normalizePath(u)}else s.path=n.path,a.params||(s.params=n.params,a.query||(s.query=n.query));return null===s.path&&(s.path=r.alwaysNormalize?c.normalizePath(a.path):a.path),c.buildURLFromParts(s)},parseURL:function(t){var e=i.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(a,"");t.length!==(t=t.replace(n,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=c},function(t,e,r){"use strict";e.a={search:function(t,e){for(var r=0,i=t.length-1,a=null,n=null;r<=i;){var o=e(n=t[a=(r+i)/2|0]);if(0<o)r=a+1;else{if(!(o<0))return n;i=a-1}}return null}}},function(t,e,r){"use strict";r.d(e,"b",function(){return a});var i=(s.isHeader=function(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},s.isFooter=function(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},s.getID3Data=function(t,e){for(var r=e,i=0;s.isHeader(t,e);)i+=10,i+=s._readSize(t,e+6),s.isFooter(t,e+10)&&(i+=10),e+=i;if(0<i)return t.subarray(r,r+i)},s._readSize=function(t,e){var r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,(r|=(127&t[e+2])<<7)|127&t[e+3]},s.getTimeStamp=function(t){for(var e=s.getID3Frames(t),r=0;r<e.length;r++){var i=e[r];if(s.isTimeStampFrame(i))return s._readTimeStamp(i)}},s.isTimeStampFrame=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},s._getFrameData=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=s._readSize(t,4);return{type:e,size:r,data:t.subarray(10,10+r)}},s.getID3Frames=function(t){for(var e=0,r=[];s.isHeader(t,e);){for(var i=s._readSize(t,e+6),a=(e+=10)+i;e+8<a;){var n=s._getFrameData(t.subarray(e)),o=s._decodeFrame(n);o&&r.push(o),e+=n.size+10}s.isFooter(t,e)&&(e+=10)}return r},s._decodeFrame=function(t){return"PRIV"===t.type?s._decodePrivFrame(t):"T"===t.type[0]?s._decodeTextFrame(t):"W"===t.type[0]?s._decodeURLFrame(t):void 0},s._readTimeStamp=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),r=1&e[3],i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},s._decodePrivFrame=function(t){if(!(t.size<2)){var e=s._utf8ArrayToStr(t.data,!0),r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}}},s._decodeTextFrame=function(t){if(!(t.size<2)){if("TXXX"===t.type){var e=1,r=s._utf8ArrayToStr(t.data.subarray(e));e+=r.length+1;var i=s._utf8ArrayToStr(t.data.subarray(e));return{key:t.type,info:r,data:i}}var a=s._utf8ArrayToStr(t.data.subarray(1));return{key:t.type,data:a}}},s._decodeURLFrame=function(t){if("WXXX"===t.type){if(t.size<2)return;var e=1,r=s._utf8ArrayToStr(t.data.subarray(e));e+=r.length+1;var i=s._utf8ArrayToStr(t.data.subarray(e));return{key:t.type,info:r,data:i}}var a=s._utf8ArrayToStr(t.data);return{key:t.type,data:a}},s._utf8ArrayToStr=function(t){for(var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],r=t.length,i=void 0,a=void 0,n=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:a=t[s++],o+=String.fromCharCode((31&i)<<6|63&a);break;case 14:a=t[s++],n=t[s++],o+=String.fromCharCode((15&i)<<12|(63&a)<<6|(63&n)<<0)}}return o},s),a=i._utf8ArrayToStr;function s(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s)}e.a=i},function(t,e,r){"use strict";var n,i,a,o=r(3),s=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(l,n=o.a),l.prototype.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},l.prototype.hasInterval=function(){return!!this._tickInterval},l.prototype.hasNextTick=function(){return!!this._tickTimer},l.prototype.setInterval=(a=function(t){return!this._tickInterval&&(this._tickInterval=setInterval(this._boundTick,t),!0)},d.toString=function(){return a.toString()},d),l.prototype.clearInterval=(i=function(){return!(!this._tickInterval||(clearInterval(this._tickInterval),this._tickInterval=null))},u.toString=function(){return i.toString()},u),l.prototype.clearNextTick=function(){return!(!this._tickTimer||(clearTimeout(this._tickTimer),this._tickTimer=null))},l.prototype.tick=function(){1==++this._tickCallCount&&(this.doTick(),1<this._tickCallCount&&(this.clearNextTick(),this._tickTimer=setTimeout(this._boundTick,0)),this._tickCallCount=0)},l.prototype.doTick=function(){},l);function l(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l);for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var a=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,n.call.apply(n,[this,t].concat(r)));return a._tickInterval=null,a._tickTimer=null,a._tickCallCount=0,a._boundTick=a.tick.bind(a),a}function u(){return i.apply(this,arguments)}function d(t){return a.apply(this,arguments)}e.a=s},function(t,e,r){"use strict";var i=r(5),a=r.n(i),n=r(18),o=function(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),t},s=(l.prototype.addElementaryStream=function(t){this._elementaryStreams[t]=!0},l.prototype.hasElementaryStream=function(t){return!0===this._elementaryStreams[t]},l.prototype.createInitializationVector=function(t){for(var e=new Uint8Array(16),r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e},l.prototype.fragmentDecryptdataFromLevelkey=function(t,e){var r=t;return t&&t.method&&t.uri&&!t.iv&&((r=new n.a).method=t.method,r.baseuri=t.baseuri,r.reluri=t.reluri,r.iv=this.createInitializationVector(e)),r},o(l,[{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"}}}]),l);function l(){var t;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,l),this._url=null,this._byteRange=null,this._decryptdata=null,this.tagList=[],this._elementaryStreams=((t={})[l.ElementaryStreamTypes.AUDIO]=!1,t[l.ElementaryStreamTypes.VIDEO]=!1,t)}function u(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)}}e.a=s},function(t,e,r){"use strict";r.d(e,"a",function(){return o}),r.d(e,"b",function(){return s});var i,a=r(3),n=r(1),o={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},s=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(l,i=a.a),l.prototype.destroy=function(){this.fragments=null,this.timeRanges=null,this.config=null,a.a.prototype.destroy.call(this),i.prototype.destroy.call(this)},l.prototype.getBufferedFrag=function(i,a){var n=this.fragments,t=Object.keys(n).filter(function(t){var e=n[t];if(e.body.type!==a)return!1;if(!e.buffered)return!1;var r=e.body;return r.startPTS<=i&&i<=r.endPTS});if(0===t.length)return null;var e=t.pop();return n[e].body},l.prototype.detectEvictedFragments=function(a,n){var o=this,s=void 0,l=void 0;Object.keys(this.fragments).forEach(function(t){var e=o.fragments[t];if(!0===e.buffered){var r=e.range[a];if(r){s=r.time;for(var i=0;i<s.length;i++)if(l=s[i],!1===o.isTimeBuffered(l.startPTS,l.endPTS,n)){o.removeFragment(e.body);break}}}})},l.prototype.detectPartialFragments=function(r){var i=this,t=this.getFragmentKey(r),a=this.fragments[t];a&&(a.buffered=!0,Object.keys(this.timeRanges).forEach(function(t){if(!0===r.hasElementaryStream(t)){var e=i.timeRanges[t];a.range[t]=i.getBufferedTimes(r.startPTS,r.endPTS,e)}}))},l.prototype.getBufferedTimes=function(t,e,r){for(var i=[],a=void 0,n=void 0,o=!1,s=0;s<r.length;s++){if(a=r.start(s)-this.bufferPadding,n=r.end(s)+this.bufferPadding,a<=t&&e<=n){i.push({startPTS:Math.max(t,r.start(s)),endPTS:Math.min(e,r.end(s))});break}if(t<n&&a<e)i.push({startPTS:Math.max(t,r.start(s)),endPTS:Math.min(e,r.end(s))}),o=!0;else if(e<=a)break}return{time:i,partial:o}},l.prototype.getFragmentKey=function(t){return t.type+"_"+t.level+"_"+t.urlId+"_"+t.sn},l.prototype.getPartialFragment=function(r){var i=this,a=void 0,n=void 0,o=void 0,s=null,l=0;return Object.keys(this.fragments).forEach(function(t){var e=i.fragments[t];i.isPartial(e)&&(n=e.body.startPTS-i.bufferPadding,o=e.body.endPTS+i.bufferPadding,n<=r&&r<=o&&(a=Math.min(r-n,o-r),l<=a&&(s=e.body,l=a)))}),s},l.prototype.getState=function(t){var e=this.getFragmentKey(t),r=this.fragments[e],i=o.NOT_LOADED;return void 0!==r&&(i=r.buffered?!0===this.isPartial(r)?o.PARTIAL:o.OK:o.APPENDING),i},l.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)},l.prototype.isTimeBuffered=function(t,e,r){for(var i=void 0,a=void 0,n=0;n<r.length;n++){if(i=r.start(n)-this.bufferPadding,a=r.end(n)+this.bufferPadding,i<=t&&e<=a)return!0;if(e<=i)return!1}return!1},l.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}},l.prototype.onBufferAppended=function(t){var r=this;this.timeRanges=t.timeRanges,Object.keys(this.timeRanges).forEach(function(t){var e=r.timeRanges[t];r.detectEvictedFragments(t,e)})},l.prototype.onFragBuffered=function(t){this.detectPartialFragments(t.frag)},l.prototype.hasFragment=function(t){var e=this.getFragmentKey(t);return void 0!==this.fragments[e]},l.prototype.removeFragment=function(t){var e=this.getFragmentKey(t);delete this.fragments[e]},l.prototype.removeAllFragments=function(){this.fragments=Object.create(null)},l);function l(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,n.a.BUFFER_APPENDED,n.a.FRAG_BUFFERED,n.a.FRAG_LOADED));return e.bufferPadding=.2,e.fragments=Object.create(null),e.timeRanges=Object.create(null),e.config=t.config,e}},function(t,e,r){"use strict";r.d(e,"a",function(){return i});var i=(a.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},a.bufferInfo=function(t,e,r){try{if(t){var i=t.buffered,a=[],n=void 0;for(n=0;n<i.length;n++)a.push({start:i.start(n),end:i.end(n)});return this.bufferedInfo(a,e,r)}}catch(t){}return{len:0,start:e,end:e,nextStart:void 0}},a.bufferedInfo=function(t,e,r){var i=[],a=void 0,n=void 0,o=void 0,s=void 0,l=void 0;for(t.sort(function(t,e){return t.start-e.start||e.end-t.end}),l=0;l<t.length;l++){var u=i.length;if(u){var d=i[u-1].end;t[l].start-d<r?t[l].end>d&&(i[u-1].end=t[l].end):i.push(t[l])}else i.push(t[l])}for(a=l=0,n=o=e;l<i.length;l++){var c=i[l].start,h=i[l].end;if(c<=e+r&&e<h)n=c,a=(o=h)-e;else if(e+r<c){s=c;break}}return{len:a,start:n,end:o,nextStart:s}},a);function a(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a)}},function(t,e){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function l(t){return"function"==typeof t}function u(t){return"object"==typeof t&&null!==t}function d(t){return void 0===t}((t.exports=i).EventEmitter=i).prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},i.prototype.emit=function(t){var e,r,i,a,n,o;if(this._events||(this._events={}),"error"===t&&(!this._events.error||u(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var s=new Error('Uncaught, unspecified "error" event. ('+e+")");throw s.context=e,s}if(d(r=this._events[t]))return!1;if(l(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:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(u(r))for(a=Array.prototype.slice.call(arguments,1),i=(o=r.slice()).length,n=0;n<i;n++)o[n].apply(this,a);return!0},i.prototype.on=i.prototype.addListener=function(t,e){var r;if(!l(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,l(e.listener)?e.listener:e),this._events[t]?u(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,u(this._events[t])&&!this._events[t].warned&&(r=d(this._maxListeners)?i.defaultMaxListeners:this._maxListeners)&&0<r&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.once=function(t,e){function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}if(!l(e))throw TypeError("listener must be a function");var i=!1;return r.listener=e,this.on(t,r),this},i.prototype.removeListener=function(t,e){var r,i,a,n;if(!l(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(a=(r=this._events[t]).length,i=-1,r===e||l(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(u(r)){for(n=a;0<n--;)if(r[n]===e||r[n].listener&&r[n].listener===e){i=n;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},i.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(l(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},i.prototype.listeners=function(t){return this._events&&this._events[t]?l(this._events[t])?[this._events[t]]:this._events[t].slice():[]},i.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(l(e))return 1;if(e)return e.length}return 0},i.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){"use strict";var s=r(35),l=r(36),u=r(37),n=r(2),d=r(0),o=r(1),i=r(4),c=Object(i.a)(),a=(h.prototype.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},h.prototype.decrypt=function(e,r,i,a){var n=this;if(this.disableWebCrypto&&this.config.enableSoftwareAES){this.logEnabled&&(d.b.log("JS AES decrypt"),this.logEnabled=!1);var t=this.decryptor;t||(this.decryptor=t=new u.a),t.expandKey(r),a(t.decrypt(e,0,i,this.removePKCS7Padding))}else{this.logEnabled&&(d.b.log("WebCrypto AES decrypt"),this.logEnabled=!1);var o=this.subtle;this.key!==r&&(this.key=r,this.fastAesKey=new l.a(o,r)),this.fastAesKey.expandKey().then(function(t){new s.a(o,i).decrypt(e,t).catch(function(t){n.onWebCryptoError(t,e,r,i,a)}).then(function(t){a(t)})}).catch(function(t){n.onWebCryptoError(t,e,r,i,a)})}},h.prototype.onWebCryptoError=function(t,e,r,i,a){this.config.enableSoftwareAES?(d.b.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(e,r,i,a)):(d.b.error("decrypting error : "+t.message),this.observer.trigger(o.a.ERROR,{type:n.b.MEDIA_ERROR,details:n.a.FRAG_DECRYPT_ERROR,fatal:!0,reason:t.message}))},h.prototype.destroy=function(){var t=this.decryptor;t&&(t.destroy(),this.decryptor=void 0)},h);function h(t,e){var r=(2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).removePKCS7Padding,i=void 0===r||r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,h),this.logEnabled=!0,this.observer=t,this.config=e,this.removePKCS7Padding=i)try{var a=c.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(t){}this.disableWebCrypto=!this.subtle}e.a=a},function(t,e,r){"use strict";e.a=function(){if("undefined"!=typeof window)return window.MediaSource||window.WebKitMediaSource}},function(t,e,r){"use strict";function f(t,e,r){var i=t[e],a=t[r],n=a.startPTS;isNaN(n)?a.start=e<r?i.start+i.duration:Math.max(i.start-a.duration,0):e<r?(i.duration=n-i.start,i.duration<0&&g.b.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(a.duration=i.start-n,a.duration<0&&g.b.warn("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!"))}function p(t,e,r,i,a,n){var o=r;if(!isNaN(e.startPTS)){var s=Math.abs(e.startPTS-r);isNaN(e.deltaPTS)?e.deltaPTS=s:e.deltaPTS=Math.max(s,e.deltaPTS),o=Math.max(r,e.startPTS),r=Math.min(r,e.startPTS),i=Math.max(i,e.endPTS),a=Math.min(a,e.startDTS),n=Math.max(n,e.endDTS)}var l=r-e.start;e.start=e.startPTS=r,e.maxStartPTS=o,e.endPTS=i,e.startDTS=a,e.endDTS=n,e.duration=i-r;var u=e.sn;if(!t||u<t.startSN||u>t.endSN)return 0;var d,c=void 0,h=void 0;for(d=u-t.startSN,(c=t.fragments)[d]=e,h=d;0<h;h--)f(c,h,h-1);for(h=d;h<c.length-1;h++)f(c,h,h+1);return t.PTSKnown=!0,l}e.a=function(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)}},e.c=p,e.b=function(t,e){var r=Math.max(t.startSN,e.startSN)-e.startSN,i=Math.min(t.endSN,e.endSN)-e.startSN,a=e.startSN-t.startSN,n=t.fragments,o=e.fragments,s=0,l=void 0;if(e.initSegment&&t.initSegment&&(e.initSegment=t.initSegment),i<r)e.PTSKnown=!1;else{for(var u=r;u<=i;u++){var d=n[a+u],c=o[u];c&&d&&(s=d.cc-c.cc,isNaN(d.startPTS)||(c.start=c.startPTS=d.startPTS,c.endPTS=d.endPTS,c.duration=d.duration,c.backtracked=d.backtracked,c.dropped=d.dropped,l=c))}if(s)for(g.b.log("discontinuity sliding from playlist, take drift into account"),u=0;u<o.length;u++)o[u].cc+=s;if(l)p(e,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS);else if(0<=a&&a<n.length){var h=n[a].start;for(u=0;u<o.length;u++)o[u].start+=h}e.PTSKnown=t.PTSKnown}};var g=r(0)},function(t,e,r){"use strict";var i,g=r(1),a=r(3),o=r(2),h=r(0),n=r(17),v=r(29),s=function(t,e,r){return e&&d(t.prototype,e),r&&d(t,r),t},y=window.performance,m={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},l={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"},u=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(b,i=a.a),b.canHaveQualityLevels=function(t){return t!==m.AUDIO_TRACK&&t!==m.SUBTITLE_TRACK},b.mapContextToLevelType=function(t){switch(t.type){case m.AUDIO_TRACK:return l.AUDIO;case m.SUBTITLE_TRACK:return l.SUBTITLE;default:return l.MAIN}},b.getResponseUrl=function(t,e){var r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r},b.prototype.createInternalLoader=function(t){var e=this.hls.config,r=e.pLoader,i=e.loader,a=new(r||i)(e);return t.loader=a,this.loaders[t.type]=a},b.prototype.getInternalLoader=function(t){return this.loaders[t.type]},b.prototype.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},b.prototype.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},b.prototype.destroy=function(){this.destroyInternalLoaders(),i.prototype.destroy.call(this)},b.prototype.onManifestLoading=function(t){this.load(t.url,{type:m.MANIFEST,level:0,id:null})},b.prototype.onLevelLoading=function(t){this.load(t.url,{type:m.LEVEL,level:t.level,id:t.id})},b.prototype.onAudioTrackLoading=function(t){this.load(t.url,{type:m.AUDIO_TRACK,level:0,id:t.id})},b.prototype.onSubtitleTrackLoading=function(t){this.load(t.url,{type:m.SUBTITLE_TRACK,level:0,id:t.id})},b.prototype.load=function(t,e){var r=this.hls.config;this.st=(new Date).getTime(),h.b.debug("Loading playlist of type "+e.type+", level: "+e.level+", id: "+e.id);var i=this.getInternalLoader(e);if(i){var a=i.context;if(a&&a.url===t)return h.b.trace("playlist request ongoing"),!1;h.b.warn("aborting previous loader for type: "+e.type),i.abort()}var n=void 0,o=void 0,s=void 0,l=void 0;switch(e.type){case m.MANIFEST:n=r.manifestLoadingMaxRetry,o=r.manifestLoadingTimeOut,s=r.manifestLoadingRetryDelay,l=r.manifestLoadingMaxRetryTimeout;break;case m.LEVEL:n=0,o=r.levelLoadingTimeOut;break;default:n=r.levelLoadingMaxRetry,o=r.levelLoadingTimeOut,s=r.levelLoadingRetryDelay,l=r.levelLoadingMaxRetryTimeout}i=this.createInternalLoader(e),e.url=t,e.responseType=e.responseType||"";var u={timeout:o,maxRetry:n,retryDelay:s,maxRetryDelay:l},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};return h.b.debug("Calling internal loader delegate for URL: "+t),i.load(e,u,d),!0},b.prototype.loadsuccess=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;if(r.isSidxRequest)return this._handleSidxRequest(t,r),void this._handlePlaylistLoaded(t,e,r,i);this.resetInternalLoader(r.type);var a=t.data;try{Video.vodIns[this.hls.media.id.replace("media-video-","").replace("_html5_api","")].rheader=i.getResponseHeader("xst").split("/"),videoVODLog2(Video.vodIns[this.hls.media.id.replace("media-video-","").replace("_html5_api","")],0<a.indexOf("#EXTINF:")||0<a.indexOf("#EXT-X-TARGETDURATION:")?"mode":"master","success",(new Date).getTime()-this.st,r.url)}catch(e){console.log("cannot tracking master 1 !!!",e)}e.tload=y.now(),0===a.indexOf("#EXTM3U")?0<a.indexOf("#EXTINF:")||0<a.indexOf("#EXT-X-TARGETDURATION:")?this._handleTrackOrLevelPlaylist(t,e,r,i):this._handleMasterPlaylist(t,e,r,i):this._handleManifestParsingError(t,r,"no EXTM3U delimiter",i)},b.prototype.loaderror=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(e,r)},b.prototype.loadtimeout=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;this._handleNetworkError(e,r,!0)},b.prototype._handleMasterPlaylist=function(t,e,r,i){var a=this.hls,n=t.data,o=b.getResponseUrl(t,r),s=v.a.parseMasterPlaylist(n,o);if(s.length){var l=s.map(function(t){return{id:t.attrs.AUDIO,codec:t.audioCodec}}),u=v.a.parseMasterPlaylistMedia(n,o,"AUDIO",l),d=v.a.parseMasterPlaylistMedia(n,o,"SUBTITLES");if(u.length){var c=!1;u.forEach(function(t){t.url||(c=!0)}),!1===c&&s[0].audioCodec&&!s[0].attrs.AUDIO&&(h.b.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),u.unshift({type:"main",name:"main"}))}a.trigger(g.a.MANIFEST_LOADED,{levels:s,audioTracks:u,subtitles:d,url:o,stats:e,networkDetails:i})}else this._handleManifestParsingError(t,r,"no level found in manifest",i)},b.prototype._handleTrackOrLevelPlaylist=function(t,e,r,i){var a=this.hls,n=r.id,o=r.level,s=r.type,l=b.getResponseUrl(t,r),u=isNaN(n)?0:n,d=isNaN(o)?u:o,c=b.mapContextToLevelType(r),h=v.a.parseLevelPlaylist(t.data,l,d,c,u);if(h.tload=e.tload,s===m.MANIFEST){var f={url:l,details:h};a.trigger(g.a.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:l,stats:e,networkDetails:i})}if(e.tparsed=y.now(),h.needSidxRanges){var p=h.initSegment.url;this.load(p,{isSidxRequest:!0,type:s,level:o,levelDetails:h,id:n,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer"})}else r.levelDetails=h,this._handlePlaylistLoaded(t,e,r,i)},b.prototype._handleSidxRequest=function(t,a){var e=n.a.parseSegmentIndex(new Uint8Array(t.data));e.references.forEach(function(t,e){var r=t.info,i=a.levelDetails.fragments[e];0===i.byteRange.length&&(i.rawByteRange=String(1+r.end-r.start)+"@"+String(r.start))}),a.levelDetails.initSegment.rawByteRange=String(e.moovEndOffset)+"@0"},b.prototype._handleManifestParsingError=function(t,e,r,i){this.hls.trigger(g.a.ERROR,{type:o.b.NETWORK_ERROR,details:o.a.MANIFEST_PARSING_ERROR,fatal:!0,url:t.url,reason:r,networkDetails:i})},b.prototype._handleNetworkError=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];h.b.info("A network error occured while loading a "+t.type+"-type playlist");var i=void 0,a=void 0,n=this.getInternalLoader(t);try{Video.vodIns[this.hls.media.id.replace("media-video-","").replace("_html5_api","")].rheader=e.getResponseHeader("xst").split("/")}catch(e){}switch(t.type){case m.MANIFEST:i=r?o.a.MANIFEST_LOAD_TIMEOUT:o.a.MANIFEST_LOAD_ERROR,a=!0;try{videoVODLog2(Video.vodIns[this.hls.media.id.replace("media-video-","").replace("_html5_api","")],"master","error",(new Date).getTime()-this.st,this.hls.url)}catch(e){console.log("cannot tracking master !!!",e)}break;case m.LEVEL:i=r?o.a.LEVEL_LOAD_TIMEOUT:o.a.LEVEL_LOAD_ERROR,a=!1;try{videoVODLog2(Video.vodIns[this.hls.media.id.replace("media-video-","").replace("_html5_api","")],"mode","error",(new Date).getTime()-this.st,this.hls.url)}catch(e){console.log("cannot tracking mode !!!",e)}break;case m.AUDIO_TRACK:i=r?o.a.AUDIO_TRACK_LOAD_TIMEOUT:o.a.AUDIO_TRACK_LOAD_ERROR,a=!1;break;default:a=!1}n&&(n.abort(),this.resetInternalLoader(t.type)),this.hls.trigger(g.a.ERROR,{type:o.b.NETWORK_ERROR,details:i,fatal:a,url:n.url,loader:n,context:t,networkDetails:e})},b.prototype._handlePlaylistLoaded=function(t,e,r,i){var a=r.type,n=r.level,o=r.id,s=r.levelDetails;if(s.targetduration)if(b.canHaveQualityLevels(r.type))this.hls.trigger(g.a.LEVEL_LOADED,{details:s,level:n||0,id:o||0,stats:e,networkDetails:i});else switch(a){case m.AUDIO_TRACK:this.hls.trigger(g.a.AUDIO_TRACK_LOADED,{details:s,id:o,stats:e,networkDetails:i});break;case m.SUBTITLE_TRACK:this.hls.trigger(g.a.SUBTITLE_TRACK_LOADED,{details:s,id:o,stats:e,networkDetails:i})}else this._handleManifestParsingError(t,r,"invalid target duration",i)},s(b,null,[{key:"ContextType",get:function(){return m}},{key:"LevelType",get:function(){return l}}]),b);function b(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,b);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,g.a.MANIFEST_LOADING,g.a.LEVEL_LOADING,g.a.AUDIO_TRACK_LOADING,g.a.SUBTITLE_TRACK_LOADING));return e.loaders={},e}function d(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)}}e.a=u},function(t,e,r){"use strict";var h=r(0),l=r(1),s=Math.pow(2,32)-1,i=(g.prototype.resetTimeStamp=function(t){this.initPTS=t},g.prototype.resetInitSegment=function(t,e,r,i){if(t&&t.byteLength){var a=this.initData=g.parseInitSegment(t);null==e&&(e="mp4a.40.5"),null==r&&(r="avc1.42e01e");var n={};a.audio&&a.video?n.audiovideo={container:"video/mp4",codec:e+","+r,initSegment:i?t:null}:(a.audio&&(n.audio={container:"audio/mp4",codec:e,initSegment:i?t:null}),a.video&&(n.video={container:"video/mp4",codec:r,initSegment:i?t:null})),this.observer.trigger(l.a.FRAG_PARSING_INIT_SEGMENT,{tracks:n})}else e&&(this.audioCodec=e),r&&(this.videoCodec=r)},g.probe=function(t){return 0<g.findBox({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length},g.bin2str=function(t){return String.fromCharCode.apply(null,t)},g.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},g.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},g.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},g.findBox=function(t,e){var r=[],i=void 0,a=void 0,n=void 0,o=void 0,s=void 0,l=void 0;if(t.data?(s=t.start,n=t.end,t=t.data):(s=0,n=t.byteLength),!e.length)return null;for(i=s;i<n;)l=1<(a=g.readUint32(t,i))?i+a:n,g.bin2str(t.subarray(i+4,i+8))===e[0]&&(1===e.length?r.push({data:t,start:i+8,end:l}):(o=g.findBox({data:t,start:i+8,end:l},e.slice(1))).length&&(r=r.concat(o))),i=l;return r},g.parseSegmentIndex=function(t){var e=g.findBox(t,["moov"])[0],r=e?e.end:null,i=0,a=g.findBox(t,["sidx"]),n=void 0;if(!a||!a[0])return null;n=[];var o=(a=a[0]).data[0],s=g.readUint32(a,i=0===o?8:16);i+=4,i+=0===o?8:16,i+=2;var l=a.end+0,u=g.readUint16(a,i);i+=2;for(var d=0;d<u;d++){var c=i,h=g.readUint32(a,c);c+=4;var f=2147483647&h;if(1==(2147483648&h)>>>31)return void console.warn("SIDX has hierarchical references (not supported)");var p=g.readUint32(a,c);c+=4,n.push({referenceSize:f,subsegmentDuration:p,info:{duration:p/s,start:l,end:l+f-1}}),l+=f,i=c+=4}return{earliestPresentationTime:0,timescale:s,version:o,referencesCount:u,references:n,moovEndOffset:r}},g.parseInitSegment=function(t){var c=[];return g.findBox(t,["moov","trak"]).forEach(function(t){var e=g.findBox(t,["tkhd"])[0];if(e){var r=e.data[e.start],i=0===r?12:20,a=g.readUint32(e,i),n=g.findBox(t,["mdia","mdhd"])[0];if(n){r=n.data[n.start];var o=g.readUint32(n,i=0===r?12:20),s=g.findBox(t,["mdia","hdlr"])[0];if(s){var l={soun:"audio",vide:"video"}[g.bin2str(s.data.subarray(s.start+8,s.start+12))];if(l){var u=g.findBox(t,["mdia","minf","stbl","stsd"]);if(u.length){u=u[0];var d=g.bin2str(u.data.subarray(u.start+12,u.start+16));h.b.log("MP4Demuxer:"+l+":"+d+" found")}c[a]={timescale:o,type:l},c[l]={timescale:o,id:a}}}}}}),c},g.getStartDTS=function(a,t){var e,r,i=void 0;return i=g.findBox(t,["moof","traf"]),e=[].concat.apply([],i.map(function(i){return g.findBox(i,["tfhd"]).map(function(t){var e,r;return e=g.readUint32(t,4),r=a[e].timescale||9e4,g.findBox(i,["tfdt"]).map(function(t){var e,r=void 0;return e=t.data[t.start],r=g.readUint32(t,4),1===e&&(r*=Math.pow(2,32),r+=g.readUint32(t,8)),r})[0]/r})})),r=Math.min.apply(null,e),isFinite(r)?r:0},g.offsetStartDTS=function(i,t,o){g.findBox(t,["moof","traf"]).map(function(r){return g.findBox(r,["tfhd"]).map(function(t){var e=g.readUint32(t,4),n=i[e].timescale||9e4;g.findBox(r,["tfdt"]).map(function(t){var e=t.data[t.start],r=g.readUint32(t,4);if(0===e)g.writeUint32(t,4,r-o*n);else{r*=Math.pow(2,32),r+=g.readUint32(t,8),r-=o*n,r=Math.max(r,0);var i=Math.floor(r/(1+s)),a=Math.floor(r%(1+s));g.writeUint32(t,4,i),g.writeUint32(t,8,a)}})})})},g.prototype.append=function(t,e,r,i){var a=this.initData;a||(this.resetInitSegment(t,this.audioCodec,this.videoCodec,!1),a=this.initData);var n,o=this.initPTS;if(void 0===o){var s=g.getStartDTS(a,t);this.initPTS=o=s-e,this.observer.trigger(l.a.INIT_PTS_FOUND,{initPTS:o})}g.offsetStartDTS(a,t,o),n=g.getStartDTS(a,t),this.remuxer.remux(a.audio,a.video,null,null,n,r,i,t)},g.prototype.destroy=function(){},g);function g(t,e){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,g),this.observer=t,this.remuxer=e}e.a=i},function(t,e,r){"use strict";var i=r(5),a=r.n(i),n=(function(t,e,r){return e&&s(t.prototype,e),r&&s(t,r),t}(o,[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=a.a.buildAbsoluteURL(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}]),o);function o(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,o),this.method=null,this.key=null,this.iv=null,this._uri=null}function s(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)}}e.a=n},function(t,e,r){"use strict";function i(t,e){var r=n[e];return!!r&&!0===r[t.slice(0,4)]}function a(t,e){return window.MediaSource.isTypeSupported((e||"video")+'/mp4;codecs="'+t+'"')}r.d(e,"b",function(){return i}),r.d(e,"a",function(){return a});var n={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";var i=r(12),l=r.n(i),a=r(34),u=r.n(a),d=r(1),c=r(21),y=r(0),h=r(2),n=r(14),o=r(4),f=Object(o.a)(),p=Object(n.a)(),s=(g.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)},g.prototype.push=function(t,e,r,i,a,n,o,s){var l=this.w,u=isNaN(a.startDTS)?a.start:a.startDTS,d=a.decryptdata,c=this.frag,h=!(c&&a.cc===c.cc),f=!(c&&a.level===c.level),p=c&&a.sn===c.sn+1,g=!f&&p;if(h&&y.b.log(this.id+":discontinuity detected"),f&&y.b.log(this.id+":switch detected"),this.frag=a,l)l.postMessage({cmd:"demux",data:t,decryptdata:d,initSegment:e,audioCodec:r,videoCodec:i,timeOffset:u,discontinuity:h,trackSwitch:f,contiguous:g,duration:n,accurateTimeOffset:o,defaultInitPTS:s},t instanceof ArrayBuffer?[t]:[]);else{var v=this.demuxer;v&&v.push(t,d,e,r,i,u,h,f,g,n,o,s)}},g.prototype.onWorkerMessage=function(t){var e=t.data,r=this.hls;switch(e.event){case"init":f.URL.revokeObjectURL(this.w.objectURL);break;case d.a.FRAG_PARSING_DATA:e.data.data1=new Uint8Array(e.data1),e.data2&&(e.data.data2=new Uint8Array(e.data2));default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,r.trigger(e.event,e.data)}},g);function g(r,t){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,g),this.hls=r,this.id=t;var a=this.observer=new l.a,e=r.config;a.trigger=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];a.emit.apply(a,[t,t].concat(r))},a.off=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];a.removeListener.apply(a,[t].concat(r))};var i=function(t,e){(e=e||{}).frag=this.frag,e.id=this.id,r.trigger(t,e)}.bind(this);a.on(d.a.FRAG_DECRYPTED,i),a.on(d.a.FRAG_PARSING_INIT_SEGMENT,i),a.on(d.a.FRAG_PARSING_DATA,i),a.on(d.a.FRAG_PARSED,i),a.on(d.a.ERROR,i),a.on(d.a.FRAG_PARSING_METADATA,i),a.on(d.a.FRAG_PARSING_USERDATA,i),a.on(d.a.INIT_PTS_FOUND,i);var n={mp4:p.isTypeSupported("video/mp4"),mpeg:p.isTypeSupported("audio/mpeg"),mp3:p.isTypeSupported('audio/mp4; codecs="mp3"')},o=navigator.vendor;if(e.enableWorker&&"undefined"!=typeof Worker){y.b.log("demuxing in webworker");var s=void 0;try{s=this.w=u()(47),this.onwmsg=this.onWorkerMessage.bind(this),s.addEventListener("message",this.onwmsg),s.onerror=function(t){r.trigger(d.a.ERROR,{type:h.b.OTHER_ERROR,details:h.a.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},s.postMessage({cmd:"init",typeSupported:n,vendor:o,id:t,config:JSON.stringify(e)})}catch(t){y.b.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),s&&f.URL.revokeObjectURL(s.objectURL),this.demuxer=new c.a(a,n,e,o),this.w=void 0}}else this.demuxer=new c.a(a,n,e,o)}e.a=s},function(t,e,r){"use strict";var _=r(1),R=r(2),g=r(13),A=r(38),w=r(17),L=r(39),k=r(42),D=r(43),O=r(46),i=r(4),v=Object(i.a)(),a=(n.prototype.destroy=function(){var t=this.demuxer;t&&t.destroy()},n.prototype.push=function(t,r,i,a,n,o,s,l,u,d,c,h){if(0<t.byteLength&&null!=r&&null!=r.key&&"AES-128"===r.method){var e=this.decrypter;null==e&&(e=this.decrypter=new g.a(this.observer,this.config));var f=this,p=void 0;try{p=v.now()}catch(t){p=Date.now()}e.decrypt(t,r.key.buffer,r.iv.buffer,function(t){var e=void 0;try{e=v.now()}catch(t){e=Date.now()}f.observer.trigger(_.a.FRAG_DECRYPTED,{stats:{tstart:p,tdecrypt:e}}),f.pushDecrypted(new Uint8Array(t),r,new Uint8Array(i),a,n,o,s,l,u,d,c,h)})}else this.pushDecrypted(new Uint8Array(t),r,new Uint8Array(i),a,n,o,s,l,u,d,c,h)},n.prototype.pushDecrypted=function(t,e,r,i,a,n,o,s,l,u,d,c){var h=this.demuxer;if(!h||(o||s)&&!this.probe(t)){for(var f=this.observer,p=this.typeSupported,g=this.config,v=[{demux:L.a,remux:D.a},{demux:w.a,remux:O.a},{demux:A.a,remux:D.a},{demux:k.a,remux:D.a}],y=0,m=v.length;y<m;y++){var b=v[y],T=b.demux.probe;if(T(t)){var E=this.remuxer=new b.remux(f,g,p,this.vendor);h=new b.demux(f,E,g,p),this.probe=T;break}}if(!h)return void f.trigger(_.a.ERROR,{type:R.b.MEDIA_ERROR,details:R.a.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=h}var S=this.remuxer;(o||s)&&(h.resetInitSegment(r,i,a,u),S.resetInitSegment()),o&&(h.resetTimeStamp(c),S.resetTimeStamp(c)),"function"==typeof h.setDecryptData&&h.setDecryptData(e),h.append(t,n,l,d)},n);function n(t,e,r,i){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,n),this.observer=t,this.typeSupported=e,this.config=r,this.vendor=i}e.a=a},function(t,e,r){"use strict";function a(t,e){return 255===t[e]&&240==(246&t[e+1])}function d(t,e){return 1&t[e+1]?7:9}function c(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function h(t){return 9216e4/t}e.d=function(t,e){return!!(e+1<t.length&&a(t,e))},e.e=function(t,e){if(e+1<t.length&&a(t,e)){var r=d(t,e);e+5<t.length&&(r=c(t,e));var i=e+r;if(i===t.length||i+1<t.length&&a(t,i))return!0}return!1},e.c=function(t,e,r,i,a){if(!t.samplerate){var n=(o=e,s=r,l=i,u=a,p=f=h=c=void 0,g=navigator.userAgent.toLowerCase(),v=u,y=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],c=1+((192&s[l+2])>>>6),(d=(60&s[l+2])>>>2)>y.length-1?void o.trigger(T.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+d}):(f=(1&s[l+2])<<2,f|=(192&s[l+3])>>>6,m.b.log("manifest codec:"+u+",ADTS data:type:"+c+",sampleingIndex:"+d+"["+y[d]+"Hz],channelConfig:"+f),h=/firefox/i.test(g)?6<=d?(c=5,p=new Array(4),d-3):(c=2,p=new Array(2),d):-1!==g.indexOf("android")?(c=2,p=new Array(2),d):(c=5,p=new Array(4),u&&(-1!==u.indexOf("mp4a.40.29")||-1!==u.indexOf("mp4a.40.5"))||!u&&6<=d?d-3:((u&&-1!==u.indexOf("mp4a.40.2")&&(6<=d&&1===f||/vivaldi/i.test(g))||!u&&1===f)&&(c=2,p=new Array(2)),d)),p[0]=c<<3,p[0]|=(14&d)>>1,p[1]|=(1&d)<<7,p[1]|=f<<3,5===c&&(p[1]|=(14&h)>>1,p[2]=(1&h)<<7,p[2]|=8,p[3]=0),{config:p,samplerate:y[d],channelCount:f,codec:"mp4a.40."+c,manifestCodec:v}));t.config=n.config,t.samplerate=n.samplerate,t.channelCount=n.channelCount,t.codec=n.codec,t.manifestCodec=n.manifestCodec,m.b.log("parsed codec:"+t.codec+",rate:"+n.samplerate+",nb channel:"+n.channelCount)}var o,s,l,u,d,c,h,f,p,g,v,y},e.b=h,e.a=function(t,e,r,i,a){var n=function(t,e,r,i,a){var n,o=void 0,s=t.length;if(n=d(t,e),o=c(t,e),0<(o-=n)&&e+n+o<=s)return{headerLength:n,frameLength:o,stamp:r+i*a}}(e,r,i,a,h(t.samplerate));if(n){var o=n.stamp,s=n.headerLength,l=n.frameLength,u={unit:e.subarray(r+s,r+s+l),pts:o,dts:o};return t.samples.push(u),t.len+=l,{sample:u,length:l+s}}};var m=r(0),b=r(2),T=r(1);r(4)},function(t,e,r){"use strict";var g={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,a){if(!(r+24>e.length)){var n=this.parseHeader(e,r);if(n&&r+n.frameLength<=e.length){var o=i+a*(9e4*n.samplesPerFrame/n.sampleRate),s={unit:e.subarray(r,r+n.frameLength),pts:o,dts:o};return t.config=[],t.channelCount=n.channelCount,t.samplerate=n.sampleRate,t.samples.push(s),t.len+=n.frameLength,{sample:s,length:n.frameLength}}}},parseHeader:function(t,e){var r=t[e+1]>>3&3,i=t[e+1]>>1&3,a=t[e+2]>>4&15,n=t[e+2]>>2&3,o=t[e+2]>>1&1;if(1!=r&&0!=a&&15!=a&&3!=n){var s=3==r?3-i:3==i?3:4,l=1e3*g.BitratesMap[14*s+a-1],u=3==r?0:2==r?1:2,d=g.SamplingRateMap[3*u+n],c=t[e+3]>>6==3?1:2,h=g.SamplesCoefficients[r][i],f=g.BytesInSlot[i],p=8*h*f;return{sampleRate:d,channelCount:c,frameLength:parseInt(h*l/d+o,10)*f,samplesPerFrame:p}}},isHeaderPattern:function(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])},isHeader:function(t,e){return!!(e+1<t.length&&this.isHeaderPattern(t,e))},probe:function(t,e){if(e+1<t.length&&this.isHeaderPattern(t,e)){var r=this.parseHeader(t,e),i=4;r&&r.frameLength&&(i=r.frameLength);var a=e+i;if(a===t.length||a+1<t.length&&this.isHeaderPattern(t,a))return!0}return!1}};e.a=g},function(t,e,r){"use strict";e.a={toString:function(t){for(var e="",r=t.length,i=0;i<r;i++)e+="["+t.start(i).toFixed(3)+","+t.end(i).toFixed(3)+"]";return e}}},function(t,e,r){"use strict";function d(t,e){var r=t.fragments,i=e.fragments;if(i.length&&r.length){var a=function(t,e){for(var r=null,i=0;i<t.length;i+=1){var a=t[i];if(a&&a.cc===e){r=a;break}}return r}(r,i[0].cc);return!a||a&&!a.startPTS?void h.b.log("No frag in previous level to align on"):a}h.b.log("No fragments to align")}function c(r,t){t.fragments.forEach(function(t){if(t){var e=t.start+r;t.start=t.startPTS=e,t.endPTS=e+t.duration}}),t.PTSKnown=!0}e.b=function(t,e){return i.a.search(t,function(t){return t.cc<e?1:t.cc>e?-1:0})},e.a=function(t,e,r){if(a=t,o=r,s=!1,(n=e)&&n.details&&o&&(o.endCC>o.startCC||a&&a.cc<o.startCC)&&(s=!0),s){var i=d(e.details,r);i&&(h.b.log("Adjusting PTS using last level due to CC increase within current level"),c(i.start,r))}var a,n,o,s;if(!1===r.PTSKnown&&e&&e.details&&e.details.fragments&&e.details.fragments.length){var l=e.details.programDateTime,u=(r.programDateTime-l)/1e3+e.details.fragments[0].start;isNaN(u)||(h.b.log("adjusting PTS using programDateTime delta, sliding:"+u.toFixed(3)),c(u,r))}};var i=r(6),h=r(0)},function(t,e,r){"use strict";e.b=function(t,e){var r=null;try{r=new window.Event("addtrack")}catch(t){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)},e.a=function(t){if(t&&t.cues)for(;0<t.cues.length;)t.removeCue(t.cues[0])}},function(t,e,r){"use strict";function i(){this.window=window,this.state="INITIAL",this.buffer="",this.decoder=new a,this.regionList=[]}function s(){this.values=Object.create(null)}function l(t,e,r,i){var a=i?t.split(i):[t];for(var n in a)if("string"==typeof a[n]){var o=a[n].split(r);if(2===o.length)e(o[0],o[1])}}function u(i,t,o){function e(){var t,e=(t=i.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/))?t[3]?r(t[1],t[2],t[3].replace(":",""),t[4]):59<t[1]?r(t[1],t[2],0,t[4]):r(0,t[1],t[2],t[4]):null;function r(t,e,r,i){return 3600*(0|t)+60*(0|e)+(0|r)+(0|i)/1e3}if(null===e)throw new Error("Malformed timestamp: "+a);return i=i.replace(/^[^\sa-zA-Z-]+/,""),e}function r(){i=i.replace(/^\s+/,"")}var a=i;if(r(),t.startTime=e(),r(),"--\x3e"!==i.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+a);i=i.substr(3),r(),t.endTime=e(),r(),function(t,e){var n=new s;l(t,function(t,e){switch(t){case"region":for(var r=o.length-1;0<=r;r--)if(o[r].id===e){n.set(t,o[r].region);break}break;case"vertical":n.alt(t,e,["rl","lr"]);break;case"line":var i=e.split(","),a=i[0];n.integer(t,a),n.percent(t,a)&&n.set("snapToLines",!1),n.alt(t,a,["auto"]),2===i.length&&n.alt("lineAlign",i[1],["start",f,"end"]);break;case"position":i=e.split(","),n.percent(t,i[0]),2===i.length&&n.alt("positionAlign",i[1],["start",f,"end","line-left","line-right","auto"]);break;case"size":n.percent(t,e);break;case"align":n.alt(t,e,["start",f,"end","left","right"])}},/:/,/\s/),e.region=n.get("region",null),e.vertical=n.get("vertical","");var r=n.get("line","auto");"auto"===r&&-1===h.line&&(r=-1),e.line=r,e.lineAlign=n.get("lineAlign","start"),e.snapToLines=n.get("snapToLines",!0),e.size=n.get("size",100),e.align=n.get("align",f);var i=n.get("position","auto");"auto"===i&&50===h.position&&(i="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=i}(i,t)}function d(t){return t.replace(/<br(?: \/)?>/gi,"\n")}r.d(e,"b",function(){return d});function a(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}}var c=r(63);s.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,r){for(var i=0;i<r.length;++i)if(e===r[i]){this.set(t,e);break}},integer:function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},percent:function(t,e){return!!(e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&0<=(e=parseFloat(e))&&e<=100)&&(this.set(t,e),!0)}};var h=new c.a(0,0,0),f="middle"===h.align?"middle":"center";i.prototype={parse:function(t){function e(){var t=i.buffer,e=0;for(t=d(t);e<t.length&&"\r"!==t[e]&&"\n"!==t[e];)++e;var r=t.substr(0,e);return"\r"===t[e]&&++e,"\n"===t[e]&&++e,i.buffer=t.substr(e),r}var i=this;t&&(i.buffer+=i.decoder.decode(t,{stream:!0}));try{var r=void 0;if("INITIAL"===i.state){if(!/\r\n|\n/.test(i.buffer))return this;var a=(r=e()).match(/^()?WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var n=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;switch(n?n=!1:r=e(),i.state){case"HEADER":/:/.test(r)?l(r,function(t,e){},/:/):r||(i.state="ID");continue;case"NOTE":r||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){i.state="NOTE";break}if(!r)continue;if(i.cue=new c.a(0,0,""),i.state="CUE",-1===r.indexOf("--\x3e")){i.cue.id=r;continue}case"CUE":try{u(r,i.cue,i.regionList)}catch(t){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(n=!0)){i.oncue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}i.cue.text&&(i.cue.text+="\n"),i.cue.text+=r;continue;case"BADCUE":r||(i.state="ID");continue}}}catch(t){"CUETEXT"===i.state&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state="INITIAL"===i.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){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";Object.defineProperty(e,"__esModule",{value:!0});var i=r(5),a=r.n(i),n=r(2),E=r(16),S=r(31),_=r(32),R=r(10),A=r(33),w=r(49),L=r(50),o=r(51),k=r(0),s=r(52),l=r(1),u=r(12),D=r.n(u),d=function(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),t};function c(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)}}r(72);var h=(O.isSupported=function(){return Object(o.a)()},d(O,null,[{key:"version",get:function(){return"0.10.0"}},{key:"Events",get:function(){return l.a}},{key:"ErrorTypes",get:function(){return n.b}},{key:"ErrorDetails",get:function(){return n.a}},{key:"DefaultConfig",get:function(){return O.defaultConfig?O.defaultConfig:s.a},set:function(t){O.defaultConfig=t}}]),O.prototype.destroy=function(){k.b.log("destroy"),this.trigger(l.a.DESTROYING),this.detachMedia(),this.coreComponents.concat(this.networkControllers).forEach(function(t){t.destroy()}),this.url=null,this.observer.removeAllListeners(),this._autoLevelCapping=-1},O.prototype.attachMedia=function(t){k.b.log("attachMedia"),this.media=t,this.trigger(l.a.MEDIA_ATTACHING,{media:t})},O.prototype.detachMedia=function(){k.b.log("detachMedia"),this.trigger(l.a.MEDIA_DETACHING),this.media=null},O.prototype.loadSource=function(t){t=a.a.buildAbsoluteURL(window.location.href,t,{alwaysNormalize:!0}),k.b.log("loadSource:"+t),this.url=t,this.trigger(l.a.MANIFEST_LOADING,{url:t})},O.prototype.startLoad=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:-1;k.b.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},O.prototype.stopLoad=function(){k.b.log("stopLoad"),this.networkControllers.forEach(function(t){t.stopLoad()})},O.prototype.swapAudioCodec=function(){k.b.log("swapAudioCodec"),this.streamController.swapAudioCodec()},O.prototype.recoverMediaError=function(){k.b.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)},d(O,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){k.b.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){k.b.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){k.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){k.b.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){k.b.log("set startLevel:"+t),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){k.b.log("set autoLevelCapping:"+t),this._autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var t=this.levels,e=this.config.minAutoBitrate,r=t?t.length:0,i=0;i<r;i++)if((t[i].realBitrate?Math.max(t[i].realBitrate,t[i].bitrate):t[i].bitrate)>e)return i;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,e=this.autoLevelCapping;return-1===e&&t&&t.length?t.length-1:e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}}]),O);function O(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,O);var r=O.DefaultConfig;if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var i in r)i in t||(t[i]=r[i]);if(void 0!==t.liveMaxLatencyDurationCount&&t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(t.liveMaxLatencyDuration<=t.liveSyncDuration||void 0===t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(k.a)(t.debug),this.config=t,this._autoLevelCapping=-1;var a=this.observer=new D.a;a.trigger=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];a.emit.apply(a,[t,t].concat(r))},a.off=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];a.removeListener.apply(a,[t].concat(r))},this.on=a.on.bind(a),this.off=a.off.bind(a),this.once=a.once.bind(a),this.trigger=a.trigger.bind(a);var n=this.abrController=new t.abrController(this),o=new t.bufferController(this),s=new t.capLevelController(this),l=new t.fpsController(this),u=new E.a(this),d=new S.a(this),c=new _.a(this),h=new L.a(this),f=this.levelController=new w.a(this),p=new R.b(this),g=[f,this.streamController=new A.a(this,p)],v=t.audioStreamController;v&&g.push(new v(this,p)),this.networkControllers=g;var y=[u,d,c,n,o,s,l,h,p];if(v=t.audioTrackController){var m=new v(this);this.audioTrackController=m,y.push(m)}if(v=t.subtitleTrackController){var b=new v(this);this.subtitleTrackController=b,y.push(b)}if(v=t.emeController){var T=new v(this);this.emeController=T,y.push(T)}[t.subtitleStreamController,t.timelineController].forEach(function(t){t&&y.push(new t(e))}),this.coreComponents=y}e.default=h},function(t,e,r){"use strict";var i=r(5),a=r.n(i),k=r(9),D=r(18),O=r(30),I=r(0),s=r(19),l=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,d=/#EXT-X-MEDIA:(.*)/g,C=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)(\S+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),P=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)(.*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/,x=/\.(mp4|m4s|m4v|m4a)$/i,n=(c.findGroup=function(t,e){if(!t)return null;for(var r=null,i=0;i<t.length;i++){var a=t[i];a.id===e&&(r=a)}return r},c.convertAVC1ToAVCOTI=function(t){var e=void 0,r=t.split(".");return 2<r.length?(e=r.shift()+".",e+=parseInt(r.shift()).toString(16),e+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):e=t,e},c.resolve=function(t,e){return a.a.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},c.parseMasterPlaylist=function(t,e){var r=[],i=void 0;for(l.lastIndex=0;null!=(i=l.exec(t));){var a={},n=a.attrs=new O.a(i[1]);a.url=c.resolve(i[2],e);var o=n.decimalResolution("RESOLUTION");o&&(a.width=o.width,a.height=o.height),a.bitrate=n.decimalInteger("AVERAGE-BANDWIDTH")||n.decimalInteger("BANDWIDTH"),a.name=n.NAME,function(i,a){["video","audio"].forEach(function(e){var r=i.filter(function(t){return Object(s.b)(t,e)});if(r.length){var t=r.filter(function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)});a[e+"Codec"]=0<t.length?t[0]:r[0],i=i.filter(function(t){return-1===r.indexOf(t)})}}),a.unknownCodecs=i}([].concat((n.CODECS||"").split(/[ ,]+/)),a),a.videoCodec&&-1!==a.videoCodec.indexOf("avc1")&&(a.videoCodec=c.convertAVC1ToAVCOTI(a.videoCodec)),r.push(a)}return r},c.parseMasterPlaylistMedia=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:[],a=void 0,n=[],o=0;for(d.lastIndex=0;null!==(a=d.exec(t));){var s={},l=new O.a(a[1]);if(l.TYPE===r){if(s.groupId=l["GROUP-ID"],s.name=l.NAME,s.type=r,s.default="YES"===l.DEFAULT,s.autoselect="YES"===l.AUTOSELECT,s.forced="YES"===l.FORCED,l.URI&&(s.url=c.resolve(l.URI,e)),s.lang=l.LANGUAGE,s.name||(s.name=s.lang),i.length){var u=c.findGroup(i,s.groupId);s.audioCodec=u?u.codec:i[0].codec}s.id=o++,n.push(s)}}return n},c.parseLevelPlaylist=function(t,e,r,i,a){var n=0,o=0,s={type:null,version:null,url:e,fragments:[],live:!0,startSN:0},l=new D.a,u=0,d=null,c=new k.a,h=void 0,f=void 0;for(C.lastIndex=0;null!==(h=C.exec(t));){var p=h[1];if(p){c.duration=parseFloat(p);var g=(" "+h[2]).slice(1);c.title=g||null,c.tagList.push(g?["INF",p,g]:["INF",p])}else if(h[3]){if(!isNaN(c.duration)){var v=n++;c.type=i,c.start=o,c.levelkey=l,c.sn=v,c.level=r,c.cc=u,c.urlId=a,c.baseurl=e,c.relurl=(" "+h[3]).slice(1),s.programDateTime&&(d?c.rawProgramDateTime?c.pdt=Date.parse(c.rawProgramDateTime):c.pdt=d.pdt+1e3*d.duration:c.pdt=Date.parse(s.programDateTime),c.endPdt=c.pdt+1e3*c.duration),s.fragments.push(c),o+=(d=c).duration,c=new k.a}}else if(h[4]){if(c.rawByteRange=(" "+h[4]).slice(1),d){var y=d.byteRangeEndOffset;y&&(c.lastByteRangeEndOffset=y)}}else if(h[5])c.rawProgramDateTime=(" "+h[5]).slice(1),c.tagList.push(["PROGRAM-DATE-TIME",c.rawProgramDateTime]),void 0===s.programDateTime&&(s.programDateTime=new Date(new Date(Date.parse(h[5]))-1e3*o));else{for(h=h[0].match(P),f=1;f<h.length&&void 0===h[f];f++);var m=(" "+h[f+1]).slice(1),b=(" "+h[f+2]).slice(1);switch(h[f]){case"#":c.tagList.push(b?[m,b]:[m]);break;case"PLAYLIST-TYPE":s.type=m.toUpperCase();break;case"MEDIA-SEQUENCE":n=s.startSN=parseInt(m);break;case"TARGETDURATION":s.targetduration=parseFloat(m);break;case"VERSION":s.version=parseInt(m);break;case"EXTM3U":break;case"ENDLIST":s.live=!1;break;case"DIS":u++,c.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":u=parseInt(m);break;case"KEY":var T=m,E=new O.a(T),S=E.enumeratedString("METHOD"),_=E.URI,R=E.hexadecimalInteger("IV");S&&(l=new D.a,_&&0<=["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(S)&&(l.method=S,l.baseuri=e,l.reluri=_,l.key=null,l.iv=R));break;case"START":var A=m,w=new O.a(A).decimalFloatingPoint("TIME-OFFSET");isNaN(w)||(s.startTimeOffset=w);break;case"MAP":var L=new O.a(m);c.relurl=L.URI,c.rawByteRange=L.BYTERANGE,c.baseurl=e,c.level=r,c.type=i,c.sn="initSegment",s.initSegment=c,c=new k.a;break;default:I.b.warn("line parsed but not handled: "+h)}}}return(c=d)&&!c.relurl&&(s.fragments.pop(),o-=c.duration),s.totalduration=o,s.averagetargetduration=o/s.fragments.length,s.endSN=n-1,s.startCC=s.fragments[0]?s.fragments[0].cc:0,s.endCC=u,!s.initSegment&&s.fragments.length&&s.fragments.every(function(t){return x.test(t.relurl)})&&(I.b.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(c=new k.a).relurl=s.fragments[0].relurl,c.baseurl=e,c.level=r,c.type=i,c.sn="initSegment",s.initSegment=c,s.needSidxRanges=!0),s},c);function c(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c)}e.a=n},function(t,e,r){"use strict";var i=/^(\d+)x(\d+)$/,a=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,n=(o.prototype.decimalInteger=function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},o.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},o.prototype.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},o.prototype.decimalFloatingPoint=function(t){return parseFloat(this[t])},o.prototype.enumeratedString=function(t){return this[t]},o.prototype.decimalResolution=function(t){var e=i.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},o.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},o);function o(t){for(var e in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),"string"==typeof t&&(t=o.parseAttrList(t)),t)t.hasOwnProperty(e)&&(this[e]=t[e])}e.a=n},function(t,e,r){"use strict";var i,o=r(1),a=r(3),n=r(2),f=r(0),s=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(l,i=a.a),l.prototype.destroy=function(){var t=this.loaders;for(var e in t){var r=t[e];r&&r.destroy()}this.loaders={},i.prototype.destroy.call(this)},l.prototype.onFragLoading=function(t){var e=t.frag,r=e.type,i=this.loaders,a=this.hls.config,n=a.fLoader,o=a.loader;e.loaded=0;var s=i[r];s&&(f.b.warn("abort previous fragment loader for type: "+r),s.abort()),s=i[r]=e.loader=new(a.fLoader?n:o)(a);var l,u,d=void 0;d={url:e.url,frag:e,responseType:"arraybuffer",progressData:!1};var c=e.byteRangeStartOffset,h=e.byteRangeEndOffset;isNaN(c)||isNaN(h)||(d.rangeStart=c,d.rangeEnd=h),l={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout},u={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},s.load(d,l,u)},l.prototype.loadsuccess=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,a=t.data,n=r.frag;n.loader=void 0,this.loaders[n.type]=void 0,this.hls.trigger(o.a.FRAG_LOADED,{payload:a,frag:n,stats:e,networkDetails:i})},l.prototype.loaderror=function(t,e){var r=2<arguments.length&&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:n.b.NETWORK_ERROR,details:n.a.FRAG_LOAD_ERROR,fatal:!1,frag:e.frag,response:t,networkDetails:r})},l.prototype.loadtimeout=function(t,e){var r=2<arguments.length&&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:n.b.NETWORK_ERROR,details:n.a.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e.frag,networkDetails:r})},l.prototype.loadprogress=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,a=e.frag;a.loaded=t.loaded,this.hls.trigger(o.a.FRAG_LOAD_PROGRESS,{frag:a,stats:t,networkDetails:i})},l);function l(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,o.a.FRAG_LOADING));return e.loaders={},e}e.a=s},function(t,e,r){"use strict";var i,d=r(1),a=r(3),n=r(2),c=r(0),o=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(s,i=a.a),s.prototype.destroy=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={},a.a.prototype.destroy.call(this)},s.prototype.onKeyLoading=function(t){var e=t.frag,r=e.type,i=this.loaders[r],a=e.decryptdata,n=a.uri;if(n!==this.decrypturl||null===this.decryptkey){var o,s,l,u=this.hls.config;i&&(c.b.warn("abort previous key loader for type:"+r),i.abort()),e.loader=this.loaders[r]=new u.loader(u),this.decrypturl=n,this.decryptkey=null,o={url:n,frag:e,responseType:"arraybuffer"},s={timeout:u.fragLoadingTimeOut,maxRetry:u.fragLoadingMaxRetry,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout},l={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},e.loader.load(o,s,l)}else this.decryptkey&&(a.key=this.decryptkey,this.hls.trigger(d.a.KEY_LOADED,{frag:e}))},s.prototype.loadsuccess=function(t,e,r){var i=r.frag;this.decryptkey=i.decryptdata.key=new Uint8Array(t.data),i.loader=void 0,this.loaders[i.type]=void 0,this.hls.trigger(d.a.KEY_LOADED,{frag:i})},s.prototype.loaderror=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(d.a.ERROR,{type:n.b.NETWORK_ERROR,details:n.a.KEY_LOAD_ERROR,fatal:!1,frag:r,response:t})},s.prototype.loadtimeout=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(d.a.ERROR,{type:n.b.NETWORK_ERROR,details:n.a.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},s);function s(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,d.a.KEY_LOADING));return e.loaders={},e.decryptkey=null,e.decrypturl=null,e}e.a=o},function(t,e,r){"use strict";var i,p=r(6),f=r(11),g=r(20),v=r(1),a=r(10),u=r(9),n=r(16),d=r(15),o=r(24),s=r(2),y=r(0),c=r(25),l=r(8),m=r(48),h=r(73),b=function(t,e,r){return e&&P(t.prototype,e),r&&P(t,r),t},T="STOPPED",E="IDLE",S="KEY_LOADING",_="FRAG_LOADING",R="FRAG_LOADING_WAITING_RETRY",A="WAITING_LEVEL",w="PARSING",L="PARSED",k="BUFFER_FLUSHING",D="ENDED",O="ERROR",I=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(C,i=l.a),C.prototype.onHandlerDestroying=function(){this.stopLoad(),i.prototype.onHandlerDestroying.call(this)},C.prototype.onHandlerDestroyed=function(){this.state=T,this.fragmentTracker=null,i.prototype.onHandlerDestroyed.call(this)},C.prototype.startLoad=function(t){if(this.levels){var e=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var i=r.startLevel;-1===i&&(i=0,this.bitrateTest=!0),this.level=r.nextLoadLevel=i,this.loadedmetadata=!1}0<e&&-1===t&&(y.b.log("override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=E,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this.forceStartLoad=!0,this.state=T},C.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=T,this.forceStartLoad=!1},C.prototype.doTick=function(){switch(this.state){case k:this.fragLoadError=0;break;case E:this._doTickIdle();break;case A:var t=this.levels[this.level];t&&t.details&&(this.state=E);break;case R:var e=window.performance.now(),r=this.retryDate;(!r||r<=e||this.media&&this.media.seeking)&&(y.b.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=E)}this._checkBuffer(),this._checkFragmentChanged()},C.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;i=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var a=t.nextLoadLevel,n=this.levels[a];if(n){var o=n.bitrate,s=void 0;s=o?Math.max(8*e.maxBufferSize/o,e.maxBufferLength):e.maxBufferLength,s=Math.min(s,e.maxMaxBufferLength);var l=f.a.bufferInfo(this.mediaBuffer?this.mediaBuffer:r,i,e.maxBufferHole),u=l.len;if(!(s<=u)){y.b.trace("buffer length of "+u.toFixed(3)+" is below max of "+s.toFixed(3)+". checking for more payload ..."),this.level=t.nextLoadLevel=a;var d=n.details;if(!d||d.live&&this.levelLastLoaded!==a)return void(this.state=A);var c=this.fragPrevious;if(!d.live&&c&&!c.backtracked&&c.sn===d.endSN&&!l.nextStart&&Math.min(r.duration,c.start+c.duration)-Math.max(l.end,c.start)<=Math.max(.2,c.duration)){var h={};return this.altAudio&&(h.type="video"),this.hls.trigger(v.a.BUFFER_EOS,h),void(this.state=D)}this._fetchPayloadOrEos(i,l,d)}}}},C.prototype._fetchPayloadOrEos=function(t,e,r){var i=this.fragPrevious,a=this.level,n=r.fragments,o=n.length;if(0!==o){var s=n[0].start,l=n[o-1].start+n[o-1].duration,u=e.end,d=void 0;if(r.initSegment&&!r.initSegment.data)d=r.initSegment;else if(r.live){var c=this.config.initialLiveManifestSize;if(o<c)return void y.b.warn("Can not start playback of a level, reason: not enough fragments "+o+" < "+c);if(null===(d=this._ensureFragmentAtLivePoint(r,u,s,l,i,n,o)))return}else u<s&&(d=n[0]);(d=d||this._findFragment(s,i,o,n,u,l,r))&&(d.encrypted?(y.b.log("Loading key for "+d.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+a),this._loadKey(d)):(y.b.log("Loading "+d.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+a+", currentTime:"+t.toFixed(3)+",bufferEnd:"+u.toFixed(3)),this._loadFragment(d)))}},C.prototype._ensureFragmentAtLivePoint=function(t,e,r,i,a,n,o){var s=this.hls.config,l=this.media,u=void 0,d=void 0!==s.liveMaxLatencyDuration?s.liveMaxLatencyDuration:s.liveMaxLatencyDurationCount*t.targetduration;if(e<Math.max(r-s.maxFragLookUpTolerance,i-d)){var c=this.liveSyncPosition=this.computeLivePosition(r,t);y.b.log("buffer end: "+e.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+c.toFixed(3)),e=c,l&&l.readyState&&l.duration>c&&(l.currentTime=c),this.nextLoadPosition=c}if(t.PTSKnown&&i<e&&l&&l.readyState)return null;if(this.startFragRequested&&!t.PTSKnown){if(a)if(t.programDateTime)u=Object(m.b)(n,a.endPdt+1);else{var h=a.sn+1;if(h>=t.startSN&&h<=t.endSN){var f=n[h-t.startSN];a.cc===f.cc&&(u=f,y.b.log("live playlist, switching playlist, load frag with next SN: "+u.sn))}u||(u=p.a.search(n,function(t){return a.cc-t.cc}))&&y.b.log("live playlist, switching playlist, load frag with same CC: "+u.sn)}u||(u=n[Math.min(o-1,Math.round(o/2))],y.b.log("live playlist, switching playlist, unknown, load middle frag : "+u.sn))}return u},C.prototype._findFragment=function(t,e,r,i,a,n,o){var s=this.hls.config,l=void 0,u=void 0;if(a<n?o.programDateTime?(u=Object(m.b)(i,Object(m.a)(t,a,o)))&&!Object(m.d)(a,s.maxFragLookUpTolerance,u)||(y.b.warn("Frag found by PDT search did not fit within tolerance; falling back to finding by SN"),u=Object(m.c)(e,i,a,n,s.maxFragLookUpTolerance)):u=Object(m.c)(e,i,a,n,s.maxFragLookUpTolerance):u=i[r-1],u){var d=(l=u).sn-o.startSN,c=e&&l.level===e.level,h=i[d-1],f=i[1+d];if(e&&l.sn===e.sn)if(c&&!l.backtracked)if(l.sn<o.endSN){var p=e.deltaPTS;p&&p>s.maxBufferHole&&e.dropped&&d?(l=h,y.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")):(l=f,y.b.log("SN just loaded, load next one: "+l.sn))}else l=null;else l.backtracked&&(f&&f.backtracked?(y.b.warn("Already backtracked from fragment "+f.sn+", will not backtrack to fragment "+l.sn+". Loading fragment "+f.sn),l=f):(y.b.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),l.dropped=0,h?(l=h).backtracked=!0:d&&(l=null)))}return l},C.prototype._loadKey=function(t){this.state=S,this.hls.trigger(v.a.KEY_LOADING,{frag:t})},C.prototype._loadFragment=function(t){this.st=(new Date).getTime();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===a.a.NOT_LOADED||e===a.a.PARTIAL?(t.autoLevel=this.hls.autoLevelEnabled,t.bitrateTest=this.bitrateTest,this.hls.trigger(v.a.FRAG_LOADING,{frag:t}),this.demuxer||(this.demuxer=new g.a(this.hls,"main")),this.state=_):e===a.a.APPENDING&&this._reduceMaxBufferLength(t.duration)&&this.fragmentTracker.removeFragment(t)},C.prototype.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,n.a.LevelType.MAIN)},C.prototype.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.endPTS+.5):null},C.prototype._checkFragmentChanged=function(){var t=void 0,e=void 0,r=this.media;if(r&&r.readyState&&!1===r.seeking&&((e=r.currentTime)>this.lastCurrentTime&&(this.lastCurrentTime=e),f.a.isBuffered(r,e)?t=this.getBufferedFrag(e):f.a.isBuffered(r,e+.1)&&(t=this.getBufferedFrag(e+.1)),t)){var i=t;if(i!==this.fragPlaying){this.hls.trigger(v.a.FRAG_CHANGED,{frag:i});var a=i.level;this.fragPlaying&&this.fragPlaying.level===a||this.hls.trigger(v.a.LEVEL_SWITCHED,{level:a}),this.fragPlaying=i}}},C.prototype.immediateLevelSwitch=function(){if(y.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)},C.prototype.immediateLevelSwitchEnd=function(){var t=this.media;t&&t.buffered.length&&(this.immediateSwitch=!1,f.a.isBuffered(t,t.currentTime)&&(t.currentTime-=1e-4),this.previouslyPaused||t.play())},C.prototype.nextLevelSwitch=function(){var t=this.media;if(t&&t.readyState){var e,r=void 0,i=void 0;if((e=this.getBufferedFrag(t.currentTime))&&1<e.startPTS&&this.flushMainBuffer(0,e.startPTS-1),t.paused)r=0;else{var a=this.hls.nextLoadLevel,n=this.levels[a],o=this.fragLastKbps;r=o&&this.fragCurrent?this.fragCurrent.duration*n.bitrate/(1e3*o)+1:0}if((i=this.getBufferedFrag(t.currentTime+r))&&(i=this.followingBufferedFrag(i))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(i.maxStartPTS,Number.POSITIVE_INFINITY)}}},C.prototype.flushMainBuffer=function(t,e){this.state=k;var r={startOffset:t,endOffset:e};this.altAudio&&(r.type="video"),this.hls.trigger(v.a.BUFFER_FLUSHING,r)},C.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)},C.prototype.onMediaDetaching=function(){var t=this.media;t&&t.ended&&(y.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()},C.prototype.onMediaSeeking=function(){var t=this.media,e=t?t.currentTime:void 0,r=this.config;isNaN(e)||y.b.log("media seeking to "+e.toFixed(3));var i=this.mediaBuffer?this.mediaBuffer:t,a=f.a.bufferInfo(i,e,this.config.maxBufferHole);if(this.state===_){var n=this.fragCurrent;if(0===a.len&&n){var o=r.maxFragLookUpTolerance,s=n.start-o,l=n.start+n.duration+o;e<s||l<e?(n.loader&&(y.b.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),n.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=E):y.b.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===D&&(0===a.len&&(this.fragPrevious=0),this.state=E);t&&(this.lastCurrentTime=e),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=e),this.tick()},C.prototype.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:void 0;isNaN(e)||y.b.log("media seeked to "+e.toFixed(3)),this.tick()},C.prototype.onMediaEnded=function(){y.b.log("media ended"),this.startPosition=this.lastCurrentTime=0},C.prototype.onManifestLoading=function(){y.b.log("trigger BUFFER_RESET"),this.hls.trigger(v.a.BUFFER_RESET),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0},C.prototype.onManifestParsed=function(t){var e=!1,r=!1,i=void 0,a=0,n=window.aid_preload||{};a=0;try{a=h.getItem("lbw")}catch(t){}a=a<1?0:parseInt(a);for(var o=0,s=t.levels.length-1;0<=s;s--){var l=t.levels[s];if(a>=1.2*l.bitrate){if(n["m"+l.height]){o=s;break}0==o&&(o=s)}}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.hls.startLevel=o,this.audioCodecSwitch&&y.b.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1;var u=this.config;(u.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(u.startPosition)},C.prototype.onLevelLoaded=function(t){var e=t.details,r=t.level,i=this.levels[this.levelLastLoaded],a=this.levels[r],n=e.totalduration,o=0;if(y.b.log("level "+r+" loaded ["+e.startSN+","+e.endSN+"],duration:"+n),e.live){var s=a.details;s&&0<e.fragments.length?(d.b(s,e),o=e.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,s),e.PTSKnown&&!isNaN(o)?y.b.log("live playlist sliding:"+o.toFixed(3)):(y.b.log("live playlist - outdated PTS, unknown sliding"),Object(c.a)(this.fragPrevious,i,e))):(y.b.log("live playlist - first load, unknown sliding"),e.PTSKnown=!1,Object(c.a)(this.fragPrevious,i,e))}else e.PTSKnown=!1;if(a.details=e,this.levelLastLoaded=r,this.hls.trigger(v.a.LEVEL_UPDATED,{details:e,level:r}),!1===this.startFragRequested){if(-1===this.startPosition||-1===this.lastCurrentTime){var l=e.startTimeOffset;isNaN(l)?e.live?(this.startPosition=this.computeLivePosition(o,e),y.b.log("configure startPosition to "+this.startPosition)):this.startPosition=0:(l<0&&(y.b.log("negative start time offset "+l+", count from end of last fragment"),l=o+n+l),y.b.log("start time offset found in playlist, adjust startPosition to "+l),this.startPosition=l),this.lastCurrentTime=this.startPosition}this.nextLoadPosition=this.startPosition}this.state===A&&(this.state=E),this.tick()},C.prototype.onKeyLoaded=function(){this.state===S&&(this.state=E,this.tick())},C.prototype.onFragLoaded=function(t){try{videoVODLog2(Video.vodIns[this.hls.media.id.replace("media-video-","").replace("_html5_api","")],"ts","success",(new Date).getTime()-this.st,this.fragCurrent._url)}catch(e){console.log("cannot tracking ts !!!",e)}var e=this.fragCurrent,r=t.frag;if(this.state===_&&e&&"main"===r.type&&r.level===e.level&&r.sn===e.sn){var i=t.stats,a=this.levels[e.level],n=a.details;if(y.b.log("Loaded "+e.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+e.level),this.bitrateTest=!1,this.stats=i,!0===r.bitrateTest&&this.hls.nextLoadLevel)this.state=E,this.startFragRequested=!1,i.tparsed=i.tbuffered=window.performance.now(),this.hls.trigger(v.a.FRAG_BUFFERED,{stats:i,frag:e,id:"main"}),this.tick();else if("initSegment"===r.sn)this.state=E,i.tparsed=i.tbuffered=window.performance.now(),n.initSegment.data=t.payload,this.hls.trigger(v.a.FRAG_BUFFERED,{stats:i,frag:e,id:"main"}),this.tick();else{this.state=w;var o=n.totalduration,s=e.level,l=e.sn,u=this.config.defaultAudioCodec||a.audioCodec;this.audioCodecSwap&&(y.b.log("swapping playlist audio codec"),void 0===u&&(u=this.lastAudioCodec),u=u&&(-1!==u.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingBuffering=!0,this.appended=!1,y.b.log("Parsing "+l+" of ["+n.startSN+" ,"+n.endSN+"],level "+s+", cc "+e.cc);var d=this.demuxer;d=d||(this.demuxer=new g.a(this.hls,"main"));var c=this.media,h=!(c&&c.seeking)&&(n.PTSKnown||!n.live),f=n.initSegment?n.initSegment.data:[];d.push(t.payload,f,u,a.videoCodec,e,o,h,void 0)}}this.fragLoadError=0},C.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===w){var i=t.tracks,a=void 0,n=void 0;if(i.audio&&this.altAudio&&delete i.audio,n=i.audio){var o=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(y.b.log("swapping playlist audio codec"),o=-1!==o.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==n.metadata.channelCount&&-1===s.indexOf("firefox")&&(o="mp4a.40.5"),-1!==s.indexOf("android")&&"audio/mpeg"!==n.container&&(o="mp4a.40.2",y.b.log("Android: force audio codec to "+o)),n.levelCodec=o,n.id=t.id}for(a in(n=i.video)&&(n.levelCodec=this.levels[this.level].videoCodec,n.id=t.id),this.hls.trigger(v.a.BUFFER_CODECS,i),i){n=i[a],y.b.log("main track:"+a+",container:"+n.container+",codecs[level/parsed]=["+n.levelCodec+"/"+n.codec+"]");var l=n.initSegment;l&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(v.a.BUFFER_APPENDING,{type:a,data:l,parent:"main",content:"initSegment"}))}this.tick()}},C.prototype.onFragParsingData=function(e){var r=this,t=this.fragCurrent,i=e.frag;if(t&&"main"===e.id&&i.sn===t.sn&&i.level===t.level&&("audio"!==e.type||!this.altAudio)&&this.state===w){var a=this.levels[this.level],n=t;if(isNaN(e.endPTS)&&(e.endPTS=e.startPTS+t.duration,e.endDTS=e.startDTS+t.duration),!0===e.hasAudio&&n.addElementaryStream(u.a.ElementaryStreamTypes.AUDIO),!0===e.hasVideo&&n.addElementaryStream(u.a.ElementaryStreamTypes.VIDEO),y.b.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0)),"video"===e.type)if(n.dropped=e.dropped,n.dropped)if(n.backtracked)y.b.warn("Already backtracked on this fragment, appending with the gap",n.sn);else{var o=a.details;if(!o||n.sn!==o.startSN)return y.b.warn("missing video frame(s), backtracking fragment",n.sn),this.fragmentTracker.removeFragment(n),n.backtracked=!0,this.nextLoadPosition=e.startPTS,this.state=E,this.fragPrevious=n,void this.tick();y.b.warn("missing video frame(s) on first frag, appending with gap",n.sn)}else n.backtracked=!1;var s=d.c(a.details,n,e.startPTS,e.endPTS,e.startDTS,e.endDTS),l=this.hls;l.trigger(v.a.LEVEL_PTS_UPDATED,{details:a.details,level:this.level,drift:s,type:e.type,start:e.startPTS,end:e.endPTS}),[e.data1,e.data2].forEach(function(t){t&&t.length&&r.state===w&&(r.appended=!0,r.pendingBuffering=!0,l.trigger(v.a.BUFFER_APPENDING,{type:e.type,data:t,parent:"main",content:"data"}))}),this.tick()}},C.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===w&&(this.stats.tparsed=window.performance.now(),this.state=L,this._checkAppendedParsed())},C.prototype.onAudioTrackSwitching=function(t){var e=!!t.url,r=t.id;if(!e){if(this.mediaBuffer!==this.media){y.b.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i.loader&&(y.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=E}var a=this.hls;a.trigger(v.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),a.trigger(v.a.AUDIO_TRACK_SWITCHED,{id:r}),this.altAudio=!1}},C.prototype.onAudioTrackSwitched=function(t){var e=t.id,r=!!this.hls.audioTracks[e].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(y.b.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()},C.prototype.onBufferCreated=function(t){var e=t.tracks,r=void 0,i=void 0,a=!1;for(var n in e){var o=e[n];"main"===o.id?(r=o,"video"===(i=n)&&(this.videoBuffer=e[n].buffer)):a=!0}a&&r?(y.b.log("alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},C.prototype.onBufferAppended=function(t){if("main"===t.parent){var e=this.state;e!==w&&e!==L||(this.pendingBuffering=0<t.pending,this._checkAppendedParsed())}},C.prototype._checkAppendedParsed=function(){if(!(this.state!==L||this.appended&&this.pendingBuffering)){var t=this.fragCurrent;if(t){var e=this.mediaBuffer?this.mediaBuffer:this.media;y.b.log("main buffered : "+o.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(v.a.FRAG_BUFFERED,{stats:r,frag:t,id:"main"}),this.state=E}this.tick()}},C.prototype.onError=function(t){var e=t.frag||this.fragCurrent;if(!e||"main"===e.type){var r=!!this.media&&f.a.isBuffered(this.media,this.media.currentTime)&&f.a.isBuffered(this.media,this.media.currentTime+.5);switch(t.details){case s.a.FRAG_LOAD_ERROR:case s.a.FRAG_LOAD_TIMEOUT:case s.a.KEY_LOAD_ERROR:case s.a.KEY_LOAD_TIMEOUT:if(t.details==s.a.FRAG_LOAD_ERROR)try{videoVODLog2(Video.vodIns[this.hls.media.id.replace("media-video-","").replace("_html5_api","")],"ts","error",(new Date).getTime()-this.st,this.fragCurrent._url)}catch(e){console.log("cannot tracking ts !!!",e)}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);y.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=R}else y.b.error("mediaController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=O;break;case s.a.LEVEL_LOAD_ERROR:case s.a.LEVEL_LOAD_TIMEOUT:this.state!==O&&(t.fatal?(this.state=O,y.b.warn("streamController: "+t.details+",switch to "+this.state+" state ...")):t.levelRetry||this.state!==A||(this.state=E));break;case s.a.BUFFER_FULL_ERROR:"main"!==t.parent||this.state!==w&&this.state!==L||(r?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=E):(y.b.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},C.prototype._reduceMaxBufferLength=function(t){var e=this.config;return e.maxMaxBufferLength>=t&&(e.maxMaxBufferLength/=2,y.b.warn("main:reduce max buffer length to "+e.maxMaxBufferLength+"s"),!0)},C.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).buffered;if(!this.loadedmetadata&&i.length)this.loadedmetadata=!0,this._seekToStartPos();else if(this.immediateSwitch)this.immediateLevelSwitchEnd();else{var a=!(e.paused&&1<e.readyState||e.ended||0===e.buffered.length),n=window.performance.now();if(r!==this.lastCurrentTime)this.stallReported&&(y.b.warn("playback not stuck anymore @"+r+", after "+Math.round(n-this.stalled)+"ms"),this.stallReported=!1),this.stalled=null,this.nudgeRetry=0;else if(a){var o=n-this.stalled,s=f.a.bufferInfo(e,r,t.maxBufferHole);if(!this.stalled)return void(this.stalled=n);1e3<=o&&this._reportStall(s.len),this._tryFixBufferStall(s,o)}}}},C.prototype.onFragLoadEmergencyAborted=function(){this.state=E,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},C.prototype.onBufferFlushed=function(){var t=this.mediaBuffer?this.mediaBuffer:this.media;t&&this.fragmentTracker.detectEvictedFragments(u.a.ElementaryStreamTypes.VIDEO,t.buffered),this.state=E,this.fragPrevious=null},C.prototype.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.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)},C.prototype._tryFixBufferStall=function(t,e){var r=this.config,i=this.media.currentTime,a=this.fragmentTracker.getPartialFragment(i);a&&this._trySkipBufferHole(a),.5<t.len&&e>1e3*r.highBufferWatchdogPeriod&&(this.stalled=null,this._tryNudgeBuffer())},C.prototype._reportStall=function(t){var e=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,y.b.warn("Playback stalling at @"+r.currentTime+" due to low buffer"),e.trigger(v.a.ERROR,{type:s.b.MEDIA_ERROR,details:s.a.BUFFER_STALLED_ERROR,fatal:!1,buffer:t}))},C.prototype._trySkipBufferHole=function(t){for(var e=this.hls,r=this.media,i=r.currentTime,a=0,n=0;n<r.buffered.length;n++){var o=r.buffered.start(n);if(a<=i&&i<o)return r.currentTime=Math.max(o,r.currentTime+.1),y.b.warn("skipping hole, adjusting currentTime from "+i+" to "+r.currentTime),this.stalled=null,void e.trigger(v.a.ERROR,{type:s.b.MEDIA_ERROR,details:s.a.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+i+" to "+r.currentTime,frag:t});a=r.buffered.end(n)}},C.prototype._tryNudgeBuffer=function(){var t=this.config,e=this.hls,r=this.media,i=r.currentTime,a=(this.nudgeRetry||0)+1;if((this.nudgeRetry=a)<t.nudgeMaxRetry){var n=i+a*t.nudgeOffset;y.b.log("adjust currentTime from "+i+" to "+n),r.currentTime=n,e.trigger(v.a.ERROR,{type:s.b.MEDIA_ERROR,details:s.a.BUFFER_NUDGE_ON_STALL,fatal:!1})}else y.b.error("still stuck in high buffer @"+i+" after "+t.nudgeMaxRetry+", raise fatal error"),e.trigger(v.a.ERROR,{type:s.b.MEDIA_ERROR,details:s.a.BUFFER_STALLED_ERROR,fatal:!0})},C.prototype._seekToStartPos=function(){var t=this.media,e=t.currentTime,r=t.seeking?e:this.startPosition;e!==r&&(y.b.log("target start position not buffered, seek to buffered.start(0) "+r+" from current time "+e+" "),t.currentTime=r)},b(C,[{key:"state",set:function(t){if(this.state!==t){var e=this.state;this._state=t,y.b.log("main stream:"+e+"->"+t),this.hls.trigger(v.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}}]),C);function C(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,C);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,v.a.MEDIA_ATTACHED,v.a.MEDIA_DETACHING,v.a.MANIFEST_LOADING,v.a.MANIFEST_PARSED,v.a.LEVEL_LOADED,v.a.KEY_LOADED,v.a.FRAG_LOADED,v.a.FRAG_LOAD_EMERGENCY_ABORTED,v.a.FRAG_PARSING_INIT_SEGMENT,v.a.FRAG_PARSING_DATA,v.a.FRAG_PARSED,v.a.ERROR,v.a.AUDIO_TRACK_SWITCHING,v.a.AUDIO_TRACK_SWITCHED,v.a.BUFFER_CREATED,v.a.BUFFER_APPENDED,v.a.BUFFER_FLUSHED));return r.fragmentTracker=e,r.config=t.config,r.audioCodecSwap=!1,r._state=T,r.stallReported=!1,r}function P(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)}}e.a=I},function(t,e,u){function l(r){function i(t){if(a[t])return a[t].exports;var e=a[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}var a={};i.m=r,i.c=a,i.i=function(t){return t},i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/",i.oe=function(t){throw console.error(t),t};var t=i(i.s=ENTRY_MODULE);return t.default||t}function d(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function h(t,e,r){var i={};i[r]=[];var a=e.toString(),n=a.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/);if(!n)return i;for(var o,s=n[1],l=new RegExp("(\\\\n|\\W)"+d(s)+p,"g");o=l.exec(a);)"dll-reference"!==o[3]&&i[r].push(o[3]);for(l=new RegExp("\\("+d(s)+'\\("(dll-reference\\s('+c+'))"\\)\\)'+p,"g");o=l.exec(a);)t[o[2]]||(i[r].push(o[1]),t[o[2]]=u(o[1]).m),i[o[2]]=i[o[2]]||[],i[o[2]].push(o[4]);return i}function f(r){return Object.keys(r).reduce(function(t,e){return t||0<r[e].length},!1)}var c="[\\.|\\-|\\+|\\w|/|@]+",p="\\((/\\*.*?\\*/)?s?.*?("+c+").*?\\)";t.exports=function(t,e){e=e||{};var r={main:u.m},i=e.all?{main:Object.keys(r)}:function(t,e){for(var r={main:[e]},i={main:[]},a={main:{}};f(r);)for(var n=Object.keys(r),o=0;o<n.length;o++){var s=n[o],l=r[s].pop();if(a[s]=a[s]||{},!a[s][l]&&t[s][l]){a[s][l]=!0,i[s]=i[s]||[],i[s].push(l);for(var u=h(t,t[s][l],s),d=Object.keys(u),c=0;c<d.length;c++)r[d[c]]=r[d[c]]||[],r[d[c]]=r[d[c]].concat(u[d[c]])}}return i}(r,t),a="";Object.keys(i).filter(function(t){return"main"!==t}).forEach(function(e){for(var t=0;i[e][t];)t++;i[e].push(t),r[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",a=a+"var "+e+" = ("+l.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+i[e].map(function(t){return JSON.stringify(t)+": "+r[e][t].toString()}).join(",")+"});\n"}),a=a+"("+l.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+i.main.map(function(t){return JSON.stringify(t)+": "+r.main[t].toString()}).join(",")+"})(self);";var n=new window.Blob([a],{type:"text/javascript"});if(e.bare)return n;var o=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(n),s=new window.Worker(o);return s.objectURL=o,s}},function(t,e,r){"use strict";var i=(a.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},a);function a(t,e){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,a),this.subtle=t,this.aesIV=e}e.a=i},function(t,e,r){"use strict";var i=(a.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},a);function a(t,e){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,a),this.subtle=t,this.key=e}e.a=i},function(t,e,r){"use strict";var i=(a.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},a.prototype.initTable=function(){var t=this.sBox,e=this.invSBox,r=this.subMix,i=r[0],a=r[1],n=r[2],o=r[3],s=this.invSubMix,l=s[0],u=s[1],d=s[2],c=s[3],h=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)h[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;var y=h[e[t[f]=v]=f],m=h[y],b=h[m],T=257*h[v]^16843008*v;i[f]=T<<24|T>>>8,a[f]=T<<16|T>>>16,n[f]=T<<8|T>>>24,o[f]=T,T=16843009*b^65537*m^257*y^16843008*f,l[v]=T<<24|T>>>8,u[v]=T<<16|T>>>16,d[v]=T<<8|T>>>24,c[v]=T,f?(f=y^h[h[h[b^y]]],p^=h[h[p]]):f=p=1}},a.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 a=this.keySize=e.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);var n=this.ksRows=4*(a+6+1),o=void 0,s=void 0,l=this.keySchedule=new Uint32Array(n),u=this.invKeySchedule=new Uint32Array(n),d=this.sBox,c=this.rcon,h=this.invSubMix,f=h[0],p=h[1],g=h[2],v=h[3],y=void 0,m=void 0;for(o=0;o<n;o++)o<a?y=l[o]=e[o]:(m=y,o%a==0?(m=d[(m=m<<8|m>>>24)>>>24]<<24|d[m>>>16&255]<<16|d[m>>>8&255]<<8|d[255&m],m^=c[o/a|0]<<24):6<a&&o%a==4&&(m=d[m>>>24]<<24|d[m>>>16&255]<<16|d[m>>>8&255]<<8|d[255&m]),l[o]=y=(l[o-a]^m)>>>0);for(s=0;s<n;s++)o=n-s,m=3&s?l[o]:l[o-4],u[s]=s<4||o<=4?m:f[d[m>>>24]]^p[d[m>>>16&255]]^g[d[m>>>8&255]]^v[d[255&m]],u[s]=u[s]>>>0}},a.prototype.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},a.prototype.decrypt=function(t,e,r,i){for(var a=this.keySize+6,n=this.invKeySchedule,o=this.invSBox,s=this.invSubMix,l=s[0],u=s[1],d=s[2],c=s[3],h=this.uint8ArrayToUint32Array_(r),f=h[0],p=h[1],g=h[2],v=h[3],y=new Int32Array(t),m=new Int32Array(y.length),b=void 0,T=void 0,E=void 0,S=void 0,_=void 0,R=void 0,A=void 0,w=void 0,L=void 0,k=void 0,D=void 0,O=void 0,I=void 0,C=void 0,P=this.networkToHostOrderSwap;e<y.length;){for(L=P(y[e]),k=P(y[e+1]),D=P(y[e+2]),O=P(y[e+3]),_=L^n[0],R=O^n[1],A=D^n[2],w=k^n[3],I=4,C=1;C<a;C++)b=l[_>>>24]^u[R>>16&255]^d[A>>8&255]^c[255&w]^n[I],T=l[R>>>24]^u[A>>16&255]^d[w>>8&255]^c[255&_]^n[I+1],E=l[A>>>24]^u[w>>16&255]^d[_>>8&255]^c[255&R]^n[I+2],S=l[w>>>24]^u[_>>16&255]^d[R>>8&255]^c[255&A]^n[I+3],_=b,R=T,A=E,w=S,I+=4;b=o[_>>>24]<<24^o[R>>16&255]<<16^o[A>>8&255]<<8^o[255&w]^n[I],T=o[R>>>24]<<24^o[A>>16&255]<<16^o[w>>8&255]<<8^o[255&_]^n[I+1],E=o[A>>>24]<<24^o[w>>16&255]<<16^o[_>>8&255]<<8^o[255&R]^n[I+2],S=o[w>>>24]<<24^o[_>>16&255]<<16^o[R>>8&255]<<8^o[255&A]^n[I+3],I+=3,m[e]=P(b^f),m[e+1]=P(S^p),m[e+2]=P(E^g),m[e+3]=P(T^v),f=L,p=k,g=D,v=O,e+=4}return i?(x=m.buffer,F=x.byteLength,(M=F&&new DataView(x).getUint8(F-1))?x.slice(0,F-M):x):m.buffer;var x,F,M},a.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},a);function a(){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,a),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()}e.a=i},function(t,e,r){"use strict";var p=r(22),g=r(0),v=r(7),i=(a.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}},a.prototype.resetTimeStamp=function(){},a.probe=function(t){if(!t)return!1;for(var e=(v.a.getID3Data(t,0)||[]).length,r=t.length;e<r;e++)if(p.e(t,e))return g.b.log("ADTS sync word found !"),!0;return!1},a.prototype.append=function(t,e,r,i){for(var a=this._audioTrack,n=v.a.getID3Data(t,0)||[],o=v.a.getTimeStamp(n),s=o?90*o:9e4*e,l=0,u=s,d=t.length,c=n.length,h=[{pts:u,dts:u,data:n}];c<d-1;)if(p.d(t,c)&&c+5<d){p.c(a,this.observer,t,c,a.manifestCodec);var f=p.a(a,t,c,s,l);if(!f){g.b.log("Unable to parse AAC frame");break}c+=f.length,u=f.sample.pts,l++}else v.a.isHeader(t,c)?(n=v.a.getID3Data(t,c),h.push({pts:u,dts:u,data:n}),c+=n.length):c++;this.remuxer.remux(a,{samples:[]},{samples:h,inputTimeScale:9e4},{samples:[]},e,r,i)},a.prototype.destroy=function(){},a);function a(t,e,r){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,a),this.observer=t,this.config=r,this.remuxer=e}e.a=i},function(t,e,r){"use strict";var v=r(22),s=r(23),I=r(1),R=r(40),i=r(41),C=r(0),P=r(2),a={video:1,audio:2,id3:3,text:4},n=(x.prototype.setDecryptData=function(t){null!=t&&null!=t.key&&"SAMPLE-AES"===t.method?this.sampleAes=new i.a(this.observer,this.config,t,this.discardEPB):this.sampleAes=null},x.probe=function(t){var e=x._syncOffset(t);return!(e<0||(e&&C.b.warn("MPEG2-TS detected but first sync word found @ offset "+e+", junk ahead ?"),0))},x._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},x.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:a[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}},x.prototype.resetInitSegment=function(t,e,r,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=x.createTrack("video",i),this._audioTrack=x.createTrack("audio",i),this._id3Track=x.createTrack("id3",i),this._txtTrack=x.createTrack("text",i),this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=r,this._duration=i},x.prototype.resetTimeStamp=function(){},x.prototype.append=function(t,e,r,i){var a=void 0,n=t.length,o=void 0,s=void 0,l=void 0,u=void 0,d=!1;this.contiguous=r;var c=this.pmtParsed,h=this._avcTrack,f=this._audioTrack,p=this._id3Track,g=h.pid,v=f.pid,y=p.pid,m=this._pmtId,b=h.pesData,T=f.pesData,E=p.pesData,S=this._parsePAT,_=this._parsePMT,R=this._parsePES,A=this._parseAVCPES.bind(this),w=this._parseAACPES.bind(this),L=this._parseMPEGPES.bind(this),k=this._parseID3PES.bind(this),D=x._syncOffset(t);for(n-=(n+D)%188,a=D;a<n;a+=188)if(71===t[a]){if(o=!!(64&t[a+1]),s=((31&t[a+1])<<8)+t[a+2],1<(48&t[a+3])>>4){if((l=a+5+t[a+4])===a+188)continue}else l=a+4;switch(s){case g:o&&(b&&(u=R(b))&&void 0!==u.pts&&A(u,!1),b={data:[],size:0}),b&&(b.data.push(t.subarray(l,a+188)),b.size+=a+188-l);break;case v:o&&(T&&(u=R(T))&&void 0!==u.pts&&(f.isAAC?w:L)(u),T={data:[],size:0}),T&&(T.data.push(t.subarray(l,a+188)),T.size+=a+188-l);break;case y:o&&(E&&(u=R(E))&&void 0!==u.pts&&k(u),E={data:[],size:0}),E&&(E.data.push(t.subarray(l,a+188)),E.size+=a+188-l);break;case 0:o&&(l+=t[l]+1),m=this._pmtId=S(t,l);break;case m:o&&(l+=t[l]+1);var O=_(t,l,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);0<(g=O.avc)&&(h.pid=g),0<(v=O.audio)&&(f.pid=v,f.isAAC=O.isAAC),0<(y=O.id3)&&(p.pid=y),d&&!c&&(C.b.log("reparse from beginning"),d=!1,a=D-188),c=this.pmtParsed=!0;break;case 17:case 8191:break;default:d=!0}}else this.observer.trigger(I.a.ERROR,{type:P.b.MEDIA_ERROR,details:P.a.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b&&(u=R(b))&&void 0!==u.pts?(A(u,!0),h.pesData=null):h.pesData=b,T&&(u=R(T))&&void 0!==u.pts?((f.isAAC?w:L)(u),f.pesData=null):(T&&T.size&&C.b.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=T),E&&(u=R(E))&&void 0!==u.pts?(k(u),p.pesData=null):p.pesData=E,null==this.sampleAes?this.remuxer.remux(f,h,p,this._txtTrack,e,r,i):this.decryptAndRemux(f,h,p,this._txtTrack,e,r,i)},x.prototype.decryptAndRemux=function(t,e,r,i,a,n,o){if(t.samples&&t.isAAC){var s=this;this.sampleAes.decryptAacSamples(t.samples,0,function(){s.decryptAndRemuxAvc(t,e,r,i,a,n,o)})}else this.decryptAndRemuxAvc(t,e,r,i,a,n,o)},x.prototype.decryptAndRemuxAvc=function(t,e,r,i,a,n,o){if(e.samples){var s=this;this.sampleAes.decryptAvcSamples(e.samples,0,0,function(){s.remuxer.remux(t,e,r,i,a,n,o)})}else this.remuxer.remux(t,e,r,i,a,n,o)},x.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},x.prototype._parsePAT=function(t,e){return(31&t[e+10])<<8|t[e+11]},x.prototype._parsePMT=function(t,e,r,i){var a,n=void 0,o={audio:-1,avc:-1,id3:-1,isAAC:!0};for(a=e+3+((15&t[e+1])<<8|t[e+2])-4,e+=12+((15&t[e+10])<<8|t[e+11]);e<a;){switch(n=(31&t[e+1])<<8|t[e+2],t[e]){case 207:if(!i){C.b.log("unkown stream type:"+t[e]);break}case 15:-1===o.audio&&(o.audio=n);break;case 21:-1===o.id3&&(o.id3=n);break;case 219:if(!i){C.b.log("unkown stream type:"+t[e]);break}case 27:-1===o.avc&&(o.avc=n);break;case 3:case 4:r?-1===o.audio&&(o.audio=n,o.isAAC=!1):C.b.log("MPEG audio found, not supported in this browser for now");break;case 36:C.b.warn("HEVC stream type found, not supported for now");break;default:C.b.log("unkown stream type:"+t[e])}e+=5+((15&t[e+3])<<8|t[e+4])}return o},x.prototype._parsePES=function(t){var e=0,r=void 0,i=void 0,a=void 0,n=void 0,o=void 0,s=void 0,l=void 0,u=void 0,d=t.data;if(!t||0===t.size)return null;for(;d[0].length<19&&1<d.length;){var c=new Uint8Array(d[0].length+d[1].length);c.set(d[0]),c.set(d[1],d[0].length),d[0]=c,d.splice(1,1)}if(1!==((r=d[0])[0]<<16)+(r[1]<<8)+r[2])return null;if((a=(r[4]<<8)+r[5])&&a>t.size-6)return null;192&(i=r[7])&&(4294967295<(s=536870912*(14&r[9])+4194304*(255&r[10])+16384*(254&r[11])+128*(255&r[12])+(254&r[13])/2)&&(s-=8589934592),64&i?(4294967295<(l=536870912*(14&r[14])+4194304*(255&r[15])+16384*(254&r[16])+128*(255&r[17])+(254&r[18])/2)&&(l-=8589934592),54e5<s-l&&(C.b.warn(Math.round((s-l)/9e4)+"s delta between PTS and DTS, align them"),s=l)):l=s),u=(n=r[8])+9,t.size-=u,o=new Uint8Array(t.size);for(var h=0,f=d.length;h<f;h++){var p=(r=d[h]).byteLength;if(u){if(p<u){u-=p;continue}r=r.subarray(u),p-=u,u=0}o.set(r,e),e+=p}return a&&(a-=n+3),{data:o,pts:s,dts:l,len:a}},x.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&&C.b.log(t.pts+"/"+t.dts+":"+t.debug)},x.prototype._parseAVCPES=function(p,t){function g(t,e,r,i){return{key:t,pts:e,dts:r,units:[],debug:i}}var v=this,y=this._avcTrack,e=this._parseAVCNALu(p.data),m=void 0,b=this.avcSample,T=void 0,E=!1,S=void 0,_=this.pushAccesUnit.bind(this);p.data=null,b&&e.length&&!y.audFound&&(_(b,y),b=this.avcSample=g(!1,p.pts,p.dts,"")),e.forEach(function(t){switch(t.type){case 1:T=!0,(b=b||(v.avcSample=g(!0,p.pts,p.dts,""))).frame=!0;var e=t.data;if(E&&4<e.length){var r=new R.a(e).readSliceType();2!==r&&4!==r&&7!==r&&9!==r||(b.key=!0)}break;case 5:T=!0,(b=b||(v.avcSample=g(!0,p.pts,p.dts,""))).key=!0,b.frame=!0;break;case 6:T=!0,(m=new R.a(v.discardEPB(t.data))).readUByte();for(var i=0,a=0,n=!1,o=0;!n&&1<m.bytesAvailable;){for(i=0;i+=o=m.readUByte(),255===o;);for(a=0;a+=o=m.readUByte(),255===o;);if(4===i&&0!==m.bytesAvailable){if(n=!0,181===m.readUByte()&&49===m.readUShort()&&1195456820===m.readUInt()&&3===m.readUByte()){var s=m.readUByte(),l=31&s,u=[s,m.readUByte()];for(S=0;S<l;S++)u.push(m.readUByte()),u.push(m.readUByte()),u.push(m.readUByte());v._insertSampleInOrder(v._txtTrack.samples,{type:3,pts:p.pts,bytes:u})}}else if(a<m.bytesAvailable)for(S=0;S<a;S++)m.readUByte()}break;case 7:if(E=T=!0,!y.sps){var d=(m=new R.a(t.data)).readSPS();y.width=d.width,y.height=d.height,y.pixelRatio=d.pixelRatio,y.sps=[t.data],y.duration=v._duration;var c=t.data.subarray(1,4),h="avc1.";for(S=0;S<3;S++){var f=c[S].toString(16);f.length<2&&(f="0"+f),h+=f}y.codec=h}break;case 8:T=!0,y.pps||(y.pps=[t.data]);break;case 9:T=!1,y.audFound=!0,b&&_(b,y),b=v.avcSample=g(!1,p.pts,p.dts,"");break;case 12:T=!1;break;default:T=!1,b&&(b.debug+="unknown NAL "+t.type+" ")}b&&T&&b.units.push(t)}),t&&b&&(_(b,y),this.avcSample=null)},x.prototype._insertSampleInOrder=function(t,e){var r=t.length;if(0<r){if(e.pts>=t[r-1].pts)t.push(e);else for(var i=r-1;0<=i;i--)if(e.pts<t[i].pts){t.splice(i,0,e);break}}else t.push(e)},x.prototype._getLastNalUnit=function(){var t=this.avcSample,e=void 0;if(!t||0===t.units.length){var r=this._avcTrack.samples;t=r[r.length-1]}if(t){var i=t.units;e=i[i.length-1]}return e},x.prototype._parseAVCNALu=function(t){var e=0,r=t.byteLength,i=void 0,a=void 0,n=this._avcTrack,o=n.naluState||0,s=o,l=[],u=void 0,d=-1,c=void 0;for(-1===o&&(c=31&t[d=0],o=0,e=1);e<r;)if(i=t[e++],o)if(1!==o)if(i)if(1===i){if(0<=d)u={data:t.subarray(d,e-o-1),type:c},l.push(u);else{var h=this._getLastNalUnit();if(h&&(s&&e<=4-s&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-s)),0<(a=e-o-1))){var f=new Uint8Array(h.data.byteLength+a);f.set(h.data,0),f.set(t.subarray(0,a),h.data.byteLength),h.data=f}}o=e<r?(c=31&t[d=e],0):-1}else o=0;else o=3;else o=i?0:2;else o=i?0:1;if(0<=d&&0<=o&&(u={data:t.subarray(d,r),type:c,state:o},l.push(u)),0===l.length){var p=this._getLastNalUnit();if(p){var g=new Uint8Array(p.data.byteLength+t.byteLength);g.set(p.data,0),g.set(t,p.data.byteLength),p.data=g}}return n.naluState=o,l},x.prototype.discardEPB=function(t){for(var e,r=t.byteLength,i=[],a=1,n=void 0;a<r-2;)0===t[a]&&0===t[a+1]&&3===t[a+2]?(i.push(a+2),a+=2):a++;if(0===i.length)return t;e=r-i.length,n=new Uint8Array(e);var o=0;for(a=0;a<e;o++,a++)o===i[0]&&(o++,i.shift()),n[a]=t[o];return n},x.prototype._parseAACPES=function(t){var e,r,i=this._audioTrack,a=t.data,n=t.pts,o=this.aacOverFlow,s=this.aacLastPTS,l=void 0,u=void 0,d=void 0;if(o){var c=new Uint8Array(o.byteLength+a.byteLength);c.set(o,0),c.set(a,o.byteLength),a=c}for(u=0,r=a.length;u<r-1&&!v.d(a,u);u++);if(u){var h=void 0,f=void 0;if(f=u<r-1?(h="AAC PES did not start with ADTS header,offset:"+u,!1):(h="no ADTS header found in AAC PES",!0),C.b.warn("parsing error:"+h),this.observer.trigger(I.a.ERROR,{type:P.b.MEDIA_ERROR,details:P.a.FRAG_PARSING_ERROR,fatal:f,reason:h}),f)return}if(v.c(i,this.observer,a,u,this.audioCodec),l=0,e=v.b(i.samplerate),o&&s){var p=s+e;1<Math.abs(p-n)&&(C.b.log("AAC: align PTS for overlapping frames by "+Math.round((p-n)/90)),n=p)}for(;u<r;)if(v.d(a,u)&&u+5<r){var g=v.a(i,a,u,n,l);if(!g)break;u+=g.length,d=g.sample.pts,l++}else u++;o=u<r?a.subarray(u,r):null,this.aacOverFlow=o,this.aacLastPTS=d},x.prototype._parseMPEGPES=function(t){for(var e=t.data,r=e.length,i=0,a=0,n=t.pts;a<r;)if(s.a.isHeader(e,a)){var o=s.a.appendFrame(this._audioTrack,e,a,n,i);if(!o)break;a+=o.length,i++}else a++},x.prototype._parseID3PES=function(t){this._id3Track.samples.push(t)},x);function x(t,e,r,i){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,x),this.observer=t,this.config=r,this.typeSupported=i,this.remuxer=e,this.sampleAes=null}e.a=n},function(t,e,r){"use strict";var i=r(0),a=(n.prototype.loadWord=function(){var t=this.data,e=this.bytesAvailable,r=t.byteLength-e,i=new Uint8Array(4),a=Math.min(4,e);if(0===a)throw new Error("no bytes available");i.set(t.subarray(r,r+a)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*a,this.bytesAvailable-=a},n.prototype.skipBits=function(t){var e=void 0;this.bitsAvailable>t||(t-=this.bitsAvailable,t-=(e=t>>3)>>3,this.bytesAvailable-=e,this.loadWord()),this.word<<=t,this.bitsAvailable-=t},n.prototype.readBits=function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return 32<t&&i.b.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,0<this.bitsAvailable?this.word<<=e:0<this.bytesAvailable&&this.loadWord(),0<(e=t-e)&&this.bitsAvailable?r<<e|this.readBits(e):r},n.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()},n.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},n.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},n.prototype.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},n.prototype.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},n.prototype.readBoolean=function(){return 1===this.readBits(1)},n.prototype.readUByte=function(){return this.readBits(8)},n.prototype.readUShort=function(){return this.readBits(16)},n.prototype.readUInt=function(){return this.readBits(32)},n.prototype.skipScalingList=function(t){var e=8,r=8,i=void 0;for(i=0;i<t;i++)0!==r&&(r=(e+this.readEG()+256)%256),e=0===r?e:r},n.prototype.readSPS=function(){var t,e,r,i,a=0,n=0,o=0,s=0,l=void 0,u=void 0,d=void 0,c=this.readUByte.bind(this),h=this.readBits.bind(this),f=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(c(),t=c(),h(5),g(3),c(),y(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){var b=f();if(3===b&&g(1),y(),y(),g(1),p())for(u=3!==b?8:12,d=0;d<u;d++)p()&&m(d<6?16:64)}y();var T=f();if(0===T)f();else if(1===T)for(g(1),v(),v(),l=f(),d=0;d<l;d++)v();y(),g(1),e=f(),r=f(),0===(i=h(1))&&g(1),g(1),p()&&(a=f(),n=f(),o=f(),s=f());var E=[1,1];if(p()&&p())switch(c()){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:E=[c()<<8|c(),c()<<8|c()]}return{width:Math.ceil(16*(e+1)-2*a-2*n),height:(2-i)*(r+1)*16-(i?2:4)*(o+s),pixelRatio:E}},n.prototype.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},n);function n(t){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,n),this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}e.a=a},function(t,e,r){"use strict";var a=r(13),i=(n.prototype.decryptBuffer=function(t,e){this.decrypter.decrypt(t,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,e)},n.prototype.decryptAacSample=function(e,r,i,a){var n=e[r].unit,t=n.subarray(16,n.length-n.length%16),o=t.buffer.slice(t.byteOffset,t.byteOffset+t.length),s=this;this.decryptBuffer(o,function(t){t=new Uint8Array(t),n.set(t,16),a||s.decryptAacSamples(e,r+1,i)})},n.prototype.decryptAacSamples=function(t,e,r){for(;;e++){if(e>=t.length)return void r();if(!(t[e].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(t,e,r,i),!i)return}}},n.prototype.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e),i=0,a=32;a<=t.length-16;a+=160,i+=16)r.set(t.subarray(a,a+16),i);return r},n.prototype.getAvcDecryptedUnit=function(t,e){e=new Uint8Array(e);for(var r=0,i=32;i<=t.length-16;i+=160,r+=16)t.set(e.subarray(r,r+16),i);return t},n.prototype.decryptAvcSample=function(e,r,i,a,n,o){var s=this.discardEPB(n.data),t=this.getAvcEncryptedData(s),l=this;this.decryptBuffer(t.buffer,function(t){n.data=l.getAvcDecryptedUnit(s,t),o||l.decryptAvcSamples(e,r,i+1,a)})},n.prototype.decryptAvcSamples=function(t,e,r,i){for(;;e++,r=0){if(e>=t.length)return void i();for(var a=t[e].units;!(r>=a.length);r++){var n=a[r];if(!(n.length<=48||1!==n.type&&5!==n.type)){var o=this.decrypter.isSync();if(this.decryptAvcSample(t,e,r,i,n,o),!o)return}}}},n);function n(t,e,r,i){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,n),this.decryptdata=r,this.discardEPB=i,this.decrypter=new a.a(t,e,{removePKCS7Padding:!1})}e.a=i},function(t,e,r){"use strict";var p=r(7),a=r(0),g=r(23),i=(n.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}},n.prototype.resetTimeStamp=function(){},n.probe=function(t){var e=void 0,r=void 0,i=p.a.getID3Data(t,0);if(i&&void 0!==p.a.getTimeStamp(i))for(e=i.length,r=Math.min(t.length-1,e+100);e<r;e++)if(g.a.probe(t,e))return a.b.log("MPEG Audio sync word found !"),!0;return!1},n.prototype.append=function(t,e,r,i){for(var a=p.a.getID3Data(t,0),n=p.a.getTimeStamp(a),o=n?90*n:9e4*e,s=a.length,l=t.length,u=0,d=0,c=this._audioTrack,h=[{pts:o,dts:o,data:a}];s<l;)if(g.a.isHeader(t,s)){var f=g.a.appendFrame(c,t,s,o,u);if(!f)break;s+=f.length,d=f.sample.pts,u++}else p.a.isHeader(t,s)?(a=p.a.getID3Data(t,s),h.push({pts:d,dts:d,data:a}),s+=a.length):s++;this.remuxer.remux(c,{samples:[]},{samples:h,inputTimeScale:9e4},{samples:[]},e,r,i)},n.prototype.destroy=function(){},n);function n(t,e,r){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,n),this.observer=t,this.config=r,this.remuxer=e}e.a=i},function(t,e,r){"use strict";var Y=r(44),Z=r(45),tt=r(1),et=r(2),rt=r(0),i=(n.prototype.destroy=function(){},n.prototype.resetTimeStamp=function(t){this._initPTS=this._initDTS=t},n.prototype.resetInitSegment=function(){this.ISGenerated=!1},n.prototype.remux=function(t,e,r,i,a,n,o){if(this.ISGenerated||this.generateIS(t,e,a),this.ISGenerated){var s=t.samples.length,l=e.samples.length,u=a,d=a;if(s&&l){var c=(t.samples[0].dts-e.samples[0].dts)/e.inputTimeScale;u+=Math.max(0,c),d+=Math.max(0,-c)}if(s){t.timescale||(rt.b.warn("regenerate InitSegment as audio detected"),this.generateIS(t,e,a));var h=this.remuxAudio(t,u,n,o);if(l){var f=void 0;h&&(f=h.endPTS-h.startPTS),e.timescale||(rt.b.warn("regenerate InitSegment as video detected"),this.generateIS(t,e,a)),this.remuxVideo(e,d,n,f,o)}}else if(l){var p=this.remuxVideo(e,d,n,0,o);p&&t.codec&&this.remuxEmptyAudio(t,u,n,p)}}r.samples.length&&this.remuxID3(r,a),i.samples.length&&this.remuxText(i,a),this.observer.trigger(tt.a.FRAG_PARSED)},n.prototype.generateIS=function(t,e,r){var i=this.observer,a=t.samples,n=e.samples,o=this.typeSupported,s="audio/mp4",l={},u={tracks:l},d=void 0===this._initPTS,c=void 0,h=void 0;if(d&&(c=h=1/0),t.config&&a.length&&(t.timescale=t.samplerate,rt.b.log("audio sampling rate : "+t.samplerate),t.isAAC||(o.mpeg?(s="audio/mpeg",t.codec=""):o.mp3&&(t.codec="mp3")),l.audio={container:s,codec:t.codec,initSegment:!t.isAAC&&o.mpeg?new Uint8Array:Z.a.initSegment([t]),metadata:{channelCount:t.channelCount}},d&&(c=h=a[0].pts-t.inputTimeScale*r)),e.sps&&e.pps&&n.length){var f=e.inputTimeScale;e.timescale=f,l.video={container:"video/mp4",codec:e.codec,initSegment:Z.a.initSegment([e]),metadata:{width:e.width,height:e.height}},d&&(c=Math.min(c,n[0].pts-f*r),h=Math.min(h,n[0].dts-f*r),this.observer.trigger(tt.a.INIT_PTS_FOUND,{initPTS:c}))}Object.keys(l).length?(i.trigger(tt.a.FRAG_PARSING_INIT_SEGMENT,u),this.ISGenerated=!0,d&&(this._initPTS=c,this._initDTS=h)):i.trigger(tt.a.ERROR,{type:et.b.MEDIA_ERROR,details:et.a.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},n.prototype.remuxVideo=function(t,e,r,i,a){var n=8,o=t.timescale,s=void 0,l=void 0,u=void 0,d=void 0,c=void 0,h=void 0,f=void 0,p=t.samples,g=[],v=p.length,y=this._PTSNormalize,m=this._initDTS,b=this.nextAvcDts,T=this.isSafari;if(0!==v){T&&(r|=p.length&&b&&(a&&Math.abs(e-b/o)<.1||Math.abs(p[0].pts-b-m)<o/5)),r||(b=e*o),p.forEach(function(t){t.pts=y(t.pts-m,b),t.dts=y(t.dts-m,b)}),p.sort(function(t,e){var r=t.dts-e.dts,i=t.pts-e.pts;return r||i||t.id-e.id});var E=p.reduce(function(t,e){return Math.max(Math.min(t,e.pts-e.dts),-18e3)},0);if(E<0){rt.b.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(E/90)+" ms to overcome this issue");for(var S=0;S<p.length;S++)p[S].dts+=E}var _=p[0];c=Math.max(_.dts,0),d=Math.max(_.pts,0);var R=Math.round((c-b)/90);r&&R&&(1<R?rt.b.log("AVC:"+R+" ms hole between fragments detected,filling it"):R<-1&&rt.b.log("AVC:"+-R+" ms overlapping between fragments detected"),c=b,p[0].dts=c,d=Math.max(d-R,b),p[0].pts=d,rt.b.log("Video/PTS/DTS adjusted: "+Math.round(d/90)+"/"+Math.round(c/90)+",delta:"+R+" ms")),_=p[p.length-1],f=Math.max(_.dts,0),h=Math.max(_.pts,0,f),T&&(s=Math.round((f-c)/(p.length-1)));for(var A=0,w=0,L=0;L<v;L++){for(var k=p[L],D=k.units,O=D.length,I=0,C=0;C<O;C++)I+=D[C].data.length;w+=I,A+=O,k.length=I,k.dts=T?c+L*s:Math.max(k.dts,c),k.pts=Math.max(k.pts,k.dts)}var P=w+4*A+8;try{l=new Uint8Array(P)}catch(t){return void this.observer.trigger(tt.a.ERROR,{type:et.b.MUX_ERROR,details:et.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:P,reason:"fail allocating video mdat "+P})}var x=new DataView(l.buffer);x.setUint32(0,P),l.set(Z.a.types.mdat,4);for(var F=0;F<v;F++){for(var M=p[F],N=M.units,U=0,B=void 0,G=0,K=N.length;G<K;G++){var j=N[G],H=j.data,V=j.data.byteLength;x.setUint32(n,V),n+=4,l.set(H,n),n+=V,U+=4+V}if(T)B=Math.max(0,s*Math.round((M.pts-M.dts)/s));else{if(F<v-1)s=p[F+1].dts-M.dts;else{var Y=this.config,W=M.dts-p[0<F?F-1:F].dts;if(Y.stretchShortVideoTrack){var q=Y.maxBufferHole,X=Math.floor(q*o),z=(i?d+i*o:this.nextAudioPts)-M.pts;X<z?((s=z-W)<0&&(s=W),rt.b.log("It is approximately "+z/90+" ms to the next segment; using duration "+s/90+" ms for the last video frame.")):s=W}else s=W}B=Math.round(M.pts-M.dts)}g.push({size:U,duration:s,cts:B,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:M.key?2:1,isNonSync:M.key?0:1}})}this.nextAvcDts=f+s;var Q=t.dropped;if(t.len=0,t.nbNalu=0,t.dropped=0,g.length&&-1<navigator.userAgent.toLowerCase().indexOf("chrome")){var $=g[0].flags;$.dependsOn=2,$.isNonSync=0}t.samples=g,u=Z.a.moof(t.sequenceNumber++,c,t),t.samples=[];var J={data1:u,data2:l,startPTS:d/o,endPTS:(h+s)/o,startDTS:c/o,endDTS:this.nextAvcDts/o,type:"video",hasAudio:!1,hasVideo:!0,nb:g.length,dropped:Q};return this.observer.trigger(tt.a.FRAG_PARSING_DATA,J),J}},n.prototype.remuxAudio=function(t,e,r,i){var a=t.inputTimeScale,n=t.timescale,o=a/n,s=(t.isAAC?1024:1152)*o,l=this._PTSNormalize,u=this._initDTS,d=!t.isAAC&&this.typeSupported.mpeg,c=void 0,h=void 0,f=void 0,p=void 0,g=void 0,v=void 0,y=void 0,m=t.samples,b=[],T=this.nextAudioPts;if(r|=m.length&&T&&(i&&Math.abs(e-T/a)<.1||Math.abs(m[0].pts-T-u)<20*s),m.forEach(function(t){t.pts=t.dts=l(t.pts-u,e*a)}),0!==(m=m.filter(function(t){return 0<=t.pts})).length){if(r||(T=i?e*a:m[0].pts),t.isAAC)for(var E=this.config.maxAudioFramesDrift,S=0,_=T;S<m.length;){var R,A=m[S];R=A.pts-_;var w=Math.abs(1e3*R/a);if(R<=-E*s)rt.b.warn("Dropping 1 audio frame @ "+(_/a).toFixed(3)+"s due to "+Math.round(w)+" ms overlap."),m.splice(S,1),t.len-=A.unit.length;else if(E*s<=R&&w<1e4&&_){var L=Math.round(R/s);rt.b.warn("Injecting "+L+" audio frame @ "+(_/a).toFixed(3)+"s due to "+Math.round(1e3*R/a)+" ms gap.");for(var k=0;k<L;k++){var D=Math.max(_,0);(f=Y.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount))||(rt.b.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),f=A.unit.subarray()),m.splice(S,0,{unit:f,pts:D,dts:D}),t.len+=f.length,_+=s,S++}A.pts=A.dts=_,_+=s,S++}else Math.abs(R),A.pts=A.dts=_,_+=s,S++}for(var O=0,I=m.length;O<I;O++){var C=m[O],P=C.unit,x=C.pts;if(void 0!==y)h.duration=Math.round((x-y)/o);else{var F=Math.round(1e3*(x-T)/a),M=0;if(r&&t.isAAC&&F){if(0<F&&F<1e4)M=Math.round((x-T)/s),rt.b.log(F+" ms hole between AAC samples detected,filling it"),0<M&&(f=(f=Y.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount))||P.subarray(),t.len+=M*f.length);else if(F<-12){rt.b.log("drop overlapping AAC sample, expected/parsed/delta:"+(T/a).toFixed(3)+"s/"+(x/a).toFixed(3)+"s/"+-F+"ms"),t.len-=P.byteLength;continue}x=T}if(v=x,!(0<t.len))return;var N=d?t.len:t.len+8;c=d?0:8;try{p=new Uint8Array(N)}catch(t){return void this.observer.trigger(tt.a.ERROR,{type:et.b.MUX_ERROR,details:et.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:N,reason:"fail allocating audio mdat "+N})}d||(new DataView(p.buffer).setUint32(0,N),p.set(Z.a.types.mdat,4));for(var U=0;U<M;U++)(f=Y.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount))||(rt.b.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),f=P.subarray()),p.set(f,c),c+=f.byteLength,h={size:f.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},b.push(h)}p.set(P,c);var B=P.byteLength;c+=B,h={size:B,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},b.push(h),y=x}var G=0,K=b.length;if(2<=K&&(G=b[K-2].duration,h.duration=G),K){this.nextAudioPts=T=y+o*G,t.len=0,t.samples=b,g=d?new Uint8Array:Z.a.moof(t.sequenceNumber++,v/o,t),t.samples=[];var j=v/a,H=T/a,V={data1:g,data2:p,startPTS:j,endPTS:H,startDTS:j,endDTS:H,type:"audio",hasAudio:!0,hasVideo:!1,nb:K};return this.observer.trigger(tt.a.FRAG_PARSING_DATA,V),V}return null}},n.prototype.remuxEmptyAudio=function(t,e,r,i){var a=t.inputTimeScale,n=a/(t.samplerate?t.samplerate:a),o=this.nextAudioPts,s=(void 0!==o?o:i.startDTS*a)+this._initDTS,l=i.endDTS*a+this._initDTS,u=1024*n,d=Math.ceil((l-s)/u),c=Y.a.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(rt.b.warn("remux empty Audio"),c){for(var h=[],f=0;f<d;f++){var p=s+f*u;h.push({unit:c,pts:p,dts:p}),t.len+=c.length}t.samples=h,this.remuxAudio(t,e,r)}else rt.b.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},n.prototype.remuxID3=function(t,e){var r=t.samples.length,i=void 0,a=t.inputTimeScale,n=this._initPTS,o=this._initDTS;if(r){for(var s=0;s<r;s++)(i=t.samples[s]).pts=(i.pts-n)/a,i.dts=(i.dts-o)/a;this.observer.trigger(tt.a.FRAG_PARSING_METADATA,{samples:t.samples})}t.samples=[]},n.prototype.remuxText=function(t,e){t.samples.sort(function(t,e){return t.pts-e.pts});var r=t.samples.length,i=void 0,a=t.inputTimeScale,n=this._initPTS;if(r){for(var o=0;o<r;o++)(i=t.samples[o]).pts=(i.pts-n)/a;this.observer.trigger(tt.a.FRAG_PARSING_USERDATA,{samples:t.samples})}t.samples=[]},n.prototype._PTSNormalize=function(t,e){var r;if(void 0===e)return t;for(r=e<t?-8589934592:8589934592;4294967296<Math.abs(t-e);)t+=r;return t},n);function n(t,e,r,i){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,n),this.observer=t,this.config=e,this.typeSupported=r;var a=navigator.userAgent;this.isSafari=i&&-1<i.indexOf("Apple")&&a&&!a.match("CriOS"),this.ISGenerated=!1}e.a=i},function(t,e,r){"use strict";var i=(a.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},a);function a(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a)}e.a=i},function(t,e,r){"use strict";var s=Math.pow(2,32)-1,i=(h.init=function(){h.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var t=void 0;for(t in h.types)h.types.hasOwnProperty(t)&&(h.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var e=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);h.HDLR_TYPES={video:e,audio:r};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);h.STTS=h.STSC=h.STCO=a,h.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),h.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),h.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),h.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var n=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);h.FTYP=h.box(h.types.ftyp,n,s,n,o),h.DINF=h.box(h.types.dinf,h.box(h.types.dref,i))},h.box=function(t){for(var e=Array.prototype.slice.call(arguments,1),r=8,i=e.length,a=i,n=void 0;i--;)r+=e[i].byteLength;for((n=new Uint8Array(r))[0]=r>>24&255,n[1]=r>>16&255,n[2]=r>>8&255,n[3]=255&r,n.set(t,4),i=0,r=8;i<a;i++)n.set(e[i],r),r+=e[i].byteLength;return n},h.hdlr=function(t){return h.box(h.types.hdlr,h.HDLR_TYPES[t])},h.mdat=function(t){return h.box(h.types.mdat,t)},h.mdhd=function(t,e){e*=t;var r=Math.floor(e/(1+s)),i=Math.floor(e%(1+s));return h.box(h.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},h.mdia=function(t){return h.box(h.types.mdia,h.mdhd(t.timescale,t.duration),h.hdlr(t.type),h.minf(t))},h.mfhd=function(t){return h.box(h.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},h.minf=function(t){return"audio"===t.type?h.box(h.types.minf,h.box(h.types.smhd,h.SMHD),h.DINF,h.stbl(t)):h.box(h.types.minf,h.box(h.types.vmhd,h.VMHD),h.DINF,h.stbl(t))},h.moof=function(t,e,r){return h.box(h.types.moof,h.mfhd(t),h.traf(r,e))},h.moov=function(t){for(var e=t.length,r=[];e--;)r[e]=h.trak(t[e]);return h.box.apply(null,[h.types.moov,h.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(h.mvex(t)))},h.mvex=function(t){for(var e=t.length,r=[];e--;)r[e]=h.trex(t[e]);return h.box.apply(null,[h.types.mvex].concat(r))},h.mvhd=function(t,e){e*=t;var r=Math.floor(e/(1+s)),i=Math.floor(e%(1+s)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return h.box(h.types.mvhd,a)},h.sdtp=function(t){var e=t.samples||[],r=new Uint8Array(4+e.length),i=void 0,a=void 0;for(a=0;a<e.length;a++)i=e[a].flags,r[a+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return h.box(h.types.sdtp,r)},h.stbl=function(t){return h.box(h.types.stbl,h.stsd(t),h.box(h.types.stts,h.STTS),h.box(h.types.stsc,h.STSC),h.box(h.types.stsz,h.STSZ),h.box(h.types.stco,h.STCO))},h.avc1=function(t){var e=[],r=[],i=void 0,a=void 0,n=void 0;for(i=0;i<t.sps.length;i++)n=(a=t.sps[i]).byteLength,e.push(n>>>8&255),e.push(255&n),e=e.concat(Array.prototype.slice.call(a));for(i=0;i<t.pps.length;i++)n=(a=t.pps[i]).byteLength,r.push(n>>>8&255),r.push(255&n),r=r.concat(Array.prototype.slice.call(a));var o=h.box(h.types.avcC,new Uint8Array([1,e[3],e[4],e[5],255,224|t.sps.length].concat(e).concat([t.pps.length]).concat(r))),s=t.width,l=t.height,u=t.pixelRatio[0],d=t.pixelRatio[1];return h.box(h.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,s>>8&255,255&s,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]),o,h.box(h.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),h.box(h.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,d>>24,d>>16&255,d>>8&255,255&d])))},h.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]))},h.mp4a=function(t){var e=t.samplerate;return h.box(h.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]),h.box(h.types.esds,h.esds(t)))},h.mp3=function(t){var e=t.samplerate;return h.box(h.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]))},h.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?h.box(h.types.stsd,h.STSD,h.mp4a(t)):h.box(h.types.stsd,h.STSD,h.mp3(t)):h.box(h.types.stsd,h.STSD,h.avc1(t))},h.tkhd=function(t){var e=t.id,r=t.duration*t.timescale,i=t.width,a=t.height,n=Math.floor(r/(1+s)),o=Math.floor(r%(1+s));return h.box(h.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,a>>8&255,255&a,0,0]))},h.traf=function(t,e){var r=h.sdtp(t),i=t.id,a=Math.floor(e/(1+s)),n=Math.floor(e%(1+s));return h.box(h.types.traf,h.box(h.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),h.box(h.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,n>>24,n>>16&255,n>>8&255,255&n])),h.trun(t,r.length+16+20+8+16+8+8),r)},h.trak=function(t){return t.duration=t.duration||4294967295,h.box(h.types.trak,h.tkhd(t),h.mdia(t))},h.trex=function(t){var e=t.id;return h.box(h.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},h.trun=function(t,e){var r=t.samples||[],i=r.length,a=12+16*i,n=new Uint8Array(a),o=void 0,s=void 0,l=void 0,u=void 0,d=void 0,c=void 0;for(e+=8+a,n.set([0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),o=0;o<i;o++)l=(s=r[o]).duration,u=s.size,d=s.flags,c=s.cts,n.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,u>>>24&255,u>>>16&255,u>>>8&255,255&u,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,61440&d.degradPrio,15&d.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*o);return h.box(h.types.trun,n)},h.initSegment=function(t){h.types||h.init();var e=h.moov(t),r=void 0;return(r=new Uint8Array(h.FTYP.byteLength+e.byteLength)).set(h.FTYP),r.set(e,h.FTYP.byteLength),r},h);function h(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,h)}e.a=i},function(t,e,r){"use strict";var d=r(1),i=(a.prototype.destroy=function(){},a.prototype.resetTimeStamp=function(){},a.prototype.resetInitSegment=function(){},a.prototype.remux=function(t,e,r,i,a,n,o,s){var l=this.observer,u="";t&&(u+="audio"),e&&(u+="video"),l.trigger(d.a.FRAG_PARSING_DATA,{data1:s,startPTS:a,startDTS:a,type:u,hasAudio:!!t,hasVideo:!!e,nb:1,dropped:0}),l.trigger(d.a.FRAG_PARSED)},a);function a(t){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,a),this.observer=t}e.a=i},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=r(21),s=r(1),l=r(0),i=r(12),u=r.n(i);e.default=function(a){var n=new u.a;n.trigger=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];n.emit.apply(n,[t,t].concat(r))},n.off=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];n.removeListener.apply(n,[t].concat(r))};function i(t,e){a.postMessage({event:t,data:e})}a.addEventListener("message",function(t){var e=t.data;switch(e.cmd){case"init":var r=JSON.parse(e.config);a.demuxer=new o.a(n,e.typeSupported,r,e.vendor);try{Object(l.a)(!0===r.debug)}catch(t){console.warn("demuxerWorker: unable to enable logs")}i("init",null);break;case"demux":a.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)}}),n.on(s.a.FRAG_DECRYPTED,i),n.on(s.a.FRAG_PARSING_INIT_SEGMENT,i),n.on(s.a.FRAG_PARSED,i),n.on(s.a.ERROR,i),n.on(s.a.FRAG_PARSING_METADATA,i),n.on(s.a.FRAG_PARSING_USERDATA,i),n.on(s.a.INIT_PTS_FOUND,i),n.on(s.a.FRAG_PARSING_DATA,function(t,e){var r=[],i={event:t,data:e};e.data1&&(i.data1=e.data1.buffer,r.push(e.data1.buffer),delete e.data1),e.data2&&(i.data2=e.data2.buffer,r.push(e.data2.buffer),delete e.data2),a.postMessage(i,r)})}},function(t,e,r){"use strict";function s(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=arguments[2],i=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=t?1:r.start-i>t&&r.start?-1:0}e.a=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=arguments[2],i=0;if(r.programDateTime){var a=Date.parse(r.programDateTime);isNaN(a)||(i=1e3*e+a-1e3*t)}return i},e.b=function(t){var e=1<arguments.length&&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},e.c=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,n=void 0,o=t?e[t.sn-e[0].sn+1]:null;return r<i&&(i-a<r&&(a=0),n=o&&!s(r,a,o)?o:l.a.search(e,s.bind(null,r,a))),n},e.d=s;var l=r(6)},function(t,e,r){"use strict";var i,d=r(1),a=r(3),c=r(0),h=r(2),f=r(19),p=r(15),n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t,e,r){return e&&g(t.prototype,e),r&&g(t,r),t},l=window.performance,s=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(u,i=a.a),u.prototype.onHandlerDestroying=function(){this.clearTimer(),this.manualLevelIndex=-1},u.prototype.clearTimer=function(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)},u.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()},u.prototype.stopLoad=function(){this.canload=!1},u.prototype.onManifestLoaded=function(t){var e=[],r=void 0,i={},a=null,n=!1,o=!1,s=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),l=[];if(t.levels.forEach(function(t){t.loadError=0,t.fragmentError=!1,n=n||!!t.videoCodec,o=o||!!t.audioCodec||!(!t.attrs||!t.attrs.AUDIO),s&&t.audioCodec&&-1!==t.audioCodec.indexOf("mp4a.40.34")&&(t.audioCodec=void 0),(a=i[t.bitrate])?a.url.push(t.url):(t.url=[t.url],t.urlId=0,i[t.bitrate]=t,e.push(t)),t.attrs&&t.attrs.AUDIO&&Object(p.a)(a||t,"audio",t.attrs.AUDIO),t.attrs&&t.attrs.SUBTITLES&&Object(p.a)(a||t,"text",t.attrs.SUBTITLES)}),n&&o&&(e=e.filter(function(t){return!!t.videoCodec})),e=e.filter(function(t){var e=t.audioCodec,r=t.videoCodec;return(!e||Object(f.a)(e))&&(!r||Object(f.a)(r))}),t.audioTracks&&(l=t.audioTracks.filter(function(t){return!t.audioCodec||Object(f.a)(t.audioCodec,"audio")})),0<e.length){r=e[0].bitrate,e.sort(function(t,e){return t.bitrate-e.bitrate}),this._levels=e;for(var u=0;u<e.length;u++)if(e[u].bitrate===r){this._firstLevel=u,c.b.log("manifest loaded,"+e.length+" level(s) found, first bitrate:"+r);break}this.hls.trigger(d.a.MANIFEST_PARSED,{levels:e,audioTracks:l,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:n,altAudio:0<l.length&&n})}else this.hls.trigger(d.a.ERROR,{type:h.b.MEDIA_ERROR,details:h.a.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:this.hls.url,reason:"no level with compatible codecs found in manifest"})},u.prototype.setLevelInternal=function(t){var e=this._levels,r=this.hls;if(0<=t&&t<e.length){if(this.clearTimer(),this.currentLevelIndex!==t){c.b.log("switching to level "+t);var i=e[this.currentLevelIndex=t];i.level=t,r.trigger(d.a.LEVEL_SWITCHING,i)}var a=e[t],n=a.details;if(!n||n.live){var o=a.urlId;r.trigger(d.a.LEVEL_LOADING,{url:a.url[o],level:t,id:o})}}else r.trigger(d.a.ERROR,{type:h.b.OTHER_ERROR,details:h.a.LEVEL_SWITCH_ERROR,level:t,fatal:!1,reason:"invalid level idx"})},u.prototype.onError=function(t){if(t.fatal)t.type===h.b.NETWORK_ERROR&&this.clearTimer();else{var e=!1,r=!1,i=void 0;switch(t.details){case h.a.FRAG_LOAD_ERROR:case h.a.FRAG_LOAD_TIMEOUT:case h.a.KEY_LOAD_ERROR:case h.a.KEY_LOAD_TIMEOUT:i=t.frag.level,r=!0;break;case h.a.LEVEL_LOAD_ERROR:case h.a.LEVEL_LOAD_TIMEOUT:i=t.context.level,e=!0;break;case h.a.REMUX_ALLOC_ERROR:i=t.level,e=!0}void 0!==i&&this.recoverLevel(t,i,e,r)}},u.prototype.recoverLevel=function(t,e,r,i){var a=this,n=this.hls.config,o=t.details,s=this._levels[e],l=void 0,u=void 0,d=void 0;if(s.loadError++,s.fragmentError=i,r){if(!(this.levelRetryCount+1<=n.levelLoadingMaxRetry))return c.b.error("level controller, cannot recover from "+o+" error"),this.currentLevelIndex=null,this.clearTimer(),void(t.fatal=!0);u=Math.min(Math.pow(2,this.levelRetryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout),this.timer=setTimeout(function(){return a.loadLevel()},u),t.levelRetry=!0,this.levelRetryCount++,c.b.warn("level controller, "+o+", retry in "+u+" ms, current retry count is "+this.levelRetryCount)}(r||i)&&(1<(l=s.url.length)&&s.loadError<l?(s.urlId=(s.urlId+1)%l,s.details=void 0,c.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,c.b.warn("level controller, "+o+": switch to "+d),this.hls.nextAutoLevel=this.currentLevelIndex=d):i&&(c.b.warn("level controller, "+o+": reload a fragment"),this.currentLevelIndex=null))},u.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)}},u.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 a=t.details;if(a.live){var n=1e3*(a.averagetargetduration?a.averagetargetduration:a.targetduration),o=n,s=i.details;s&&a.endSN===s.endSN&&(o/=2,c.b.log("same live playlist, reload twice faster")),o-=l.now()-t.stats.trequest,o=Math.max(n/2,Math.round(o)),c.b.log("live playlist, reload in "+Math.round(o)+" ms"),this.timer=setTimeout(function(){return e.loadLevel()},o)}else this.clearTimer()}},u.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())}},u.prototype.loadLevel=function(){if(c.b.debug("call to loadLevel"),null!==this.currentLevelIndex&&this.canload){var t=this._levels[this.currentLevelIndex];if("object"===(void 0===t?"undefined":n(t))&&0<t.url.length){var e=this.currentLevelIndex,r=t.urlId,i=t.url[r];c.b.log("Attempt loading level index "+e+" with URL-id "+r),this.hls.trigger(d.a.LEVEL_LOADING,{url:i,level:e,id:r})}}},o(u,[{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)return this._startLevel;var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel},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)}}]),u);function u(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,d.a.MANIFEST_LOADED,d.a.LEVEL_LOADED,d.a.AUDIO_TRACK_SWITCHED,d.a.FRAG_LOADED,d.a.ERROR));return e.canload=!1,e.currentLevelIndex=null,e.manualLevelIndex=-1,e.timer=null,e}function g(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)}}e.a=s},function(t,e,r){"use strict";var i,a=r(1),n=r(3),c=r(7),o=r(26),s=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(l,i=n.a),l.prototype.destroy=function(){n.a.prototype.destroy.call(this)},l.prototype.onMediaAttached=function(t){this.media=t.media,this.media},l.prototype.onMediaDetaching=function(){Object(o.a)(this.id3Track),this.id3Track=void 0,this.media=void 0},l.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(o.b)(r,this.media),r}return this.media.addTextTrack("metadata","id3")},l.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,a=0;a<r.length;a++){var n=c.a.getID3Frames(r[a].data);if(n){var o=r[a].pts,s=a<r.length-1?r[a+1].pts:e.endPTS;o===s&&(s+=1e-4);for(var l=0;l<n.length;l++){var u=n[l];if(!c.a.isTimeStampFrame(u)){var d=new i(o,s,"");d.value=u,this.id3Track.addCue(d)}}}}},l);function l(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,a.a.MEDIA_ATTACHED,a.a.MEDIA_DETACHING,a.a.FRAG_PARSING_METADATA));return e.id3Track=void 0,e.media=void 0,e}e.a=s},function(t,e,r){"use strict";e.a=function(){var t=Object(a.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};var a=r(14)},function(t,e,r){"use strict";r.d(e,"a",function(){return v});var i=r(53),a=r(56),n=r(57),o=r(58),s=r(59),l=r(60),u=r(61),d=r(62),c=r(64),h=r(68),f=r(69),p=r(70),g=r(71),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:3e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:3e4,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:a.a,capLevelController:n.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=f.a,v.subtitleTrackController=h.a,v.timelineController=c.a,v.cueHandler=d,v.enableCEA708Captions=!0,v.enableWebVTT=!0,v.captionsTextTrack1Label="English",v.captionsTextTrack1LanguageCode="en",v.captionsTextTrack2Label="Spanish",v.captionsTextTrack2LanguageCode="es",v.audioStreamController=u.a,v.audioTrackController=l.a,v.emeController=p.a},function(t,e,r){"use strict";var i,b=r(1),a=r(3),T=r(11),n=r(2),E=r(0),u=r(54),y=r(73),o=function(t,e,r){return e&&d(t.prototype,e),r&&d(t,r),t},S=window.performance,s=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(l,i=a.a),l.prototype.destroy=function(){this.clearTimer(),a.a.prototype.destroy.call(this)},l.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,a=e.level,n=r.levels[a].details.live,o=void 0,s=void 0,l=0;try{l=y.getItem("lbw")}catch(t){}l=l<1?i.abrEwmaDefaultEstimate:parseInt(l),s=n?(o=i.abrEwmaFastLive,i.abrEwmaSlowLive):(o=i.abrEwmaFastVoD,i.abrEwmaSlowVoD),this._bwEstimator=new u.a(r,s,o,l)}},l.prototype._abandonRulesCheck=function(){var t=this.hls,e=t.media,r=this.fragCurrent;if(r){var i=r.loader,a=t.minAutoLevel;if(!i||i.stats&&i.stats.aborted)return E.b.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);var n=i.stats;if(e&&n&&(!e.paused&&0!==e.playbackRate||!e.readyState)&&r.autoLevel&&r.level){var o=S.now()-n.trequest,s=Math.abs(e.playbackRate);if(o>500*r.duration/s){var l=t.levels,u=Math.max(1,n.bw?n.bw/8:1e3*n.loaded/o),d=l[r.level],c=d.realBitrate?Math.max(d.realBitrate,d.bitrate):d.bitrate,h=n.total?n.total:Math.max(n.loaded,Math.round(r.duration*c/8)),f=e.currentTime,p=(h-n.loaded)/u,g=(T.a.bufferInfo(e,f,t.config.maxBufferHole).end-f)/s;if(g<2*r.duration/s&&g<p){var v=void 0,y=void 0;for(y=r.level-1;a<y;y--){var m=l[y].realBitrate?Math.max(l[y].realBitrate,l[y].bitrate):l[y].bitrate;if((v=r.duration*m/(6.4*u))<g)break}v<p&&(E.b.warn("loading too slow, abort fragment loading and switch to level "+y+":fragLoadedDelay["+y+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+v.toFixed(1)+"<"+p.toFixed(1)+":"+g.toFixed(1)),t.nextLoadLevel=y,this._bwEstimator.sample(o,n.loaded),i.abort(),this.clearTimer(),t.trigger(b.a.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:n}))}}}}},l.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,a=(r.loaded?r.loaded.duration:0)+t.frag.duration;r.loaded={bytes:i,duration:a},r.realBitrate=Math.round(8*i/a)}if(t.frag.bitrateTest){var n=t.stats;n.tparsed=n.tbuffered=n.tload,this.onFragBuffered(t)}}},l.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;E.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}},l.prototype.onError=function(t){switch(t.details){case n.a.FRAG_LOAD_ERROR:case n.a.FRAG_LOAD_TIMEOUT:this.clearTimer()}},l.prototype.clearTimer=function(){clearInterval(this.timer),this.timer=null},l.prototype._findBestLevel=function(t,e,r,i,a,n,o,s,l){for(var u=a;i<=u;u--){var d,c=l[u].details,h=c?c.totalduration/c.fragments.length:e,f=!!c&&c.live;d=u<=t?o*r:s*r;var p=l[u].realBitrate?Math.max(l[u].realBitrate,l[u].bitrate):l[u].bitrate,g=p*h/d;if(E.b.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(d)+"/"+p+"/"+h+"/"+n+"/"+g),p<d&&(!g||f&&!this.bitrateTestDelay||g<n))return u}return-1},o(l,[{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,a=t.minAutoLevel,n=t.media,o=this.lastLoadedFragLevel,s=this.fragCurrent?this.fragCurrent.duration:0,l=n?n.currentTime:0,u=n&&0!==n.playbackRate?Math.abs(n.playbackRate):1,d=this._bwEstimator?this._bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,c=(T.a.bufferInfo(n,l,i.maxBufferHole).end-l)/u,h=this._findBestLevel(o,s,d,a,e,c,i.abrBandWidthFactor,i.abrBandWidthUpFactor,r);try{y.setItem("lbw",Math.floor(d))}catch(t){}if(window.lastBW=Math.floor(d),0<=h)return h;E.b.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var f=s?Math.min(s,i.maxStarvationDelay):i.maxStarvationDelay,p=i.abrBandWidthFactor,g=i.abrBandWidthUpFactor;if(0==c){var v=this.bitrateTestDelay;v&&(f=(s?Math.min(s,i.maxLoadingDelay):i.maxLoadingDelay)-v,E.b.trace("bitrate test took "+Math.round(1e3*v)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*f)+" ms"),p=g=1)}return h=this._findBestLevel(o,s,d,a,e,c+f,p,g,r),Math.max(h,0)}}]),l);function l(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,b.a.FRAG_LOADING,b.a.FRAG_LOADED,b.a.FRAG_BUFFERED,b.a.ERROR));return e.lastLoadedFragLevel=0,e._nextAutoLevel=-1,e.hls=t,e.timer=null,e._bwEstimator=null,e.onCheck=e._abandonRulesCheck.bind(e),e}function d(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)}}e.a=s},function(t,e,r){"use strict";var a=r(55),i=(n.prototype.sample=function(t,e){var r=8e3*e/(t=Math.max(t,this.minDelayMs_)),i=t/1e3;this.fast_.sample(i,r),this.slow_.sample(i,r)},n.prototype.canEstimate=function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_},n.prototype.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},n.prototype.destroy=function(){},n);function n(t,e,r,i){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,n),this.hls=t,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new a.a(e),this.fast_=new a.a(r)}e.a=i},function(t,e,r){"use strict";var i=(a.prototype.sample=function(t,e){var r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t},a.prototype.getTotalWeight=function(){return this.totalWeight_},a.prototype.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/t}return this.estimate_},a);function a(t){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,a),this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=0,this.totalWeight_=0}e.a=i},function(t,e,r){"use strict";var i,l=r(1),a=r(3),c=r(0),u=r(2),n=r(14),o=Object(n.a)(),s=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(d,i=a.a),d.prototype.destroy=function(){a.a.prototype.destroy.call(this)},d.prototype.onLevelPtsUpdated=function(t){var e=t.type,r=this.tracks.audio;if("audio"===e&&r&&"audio/mpeg"===r.container){var i=this.sourceBuffer.audio;if(.1<Math.abs(i.timestampOffset-t.start)){var a=i.updating;try{i.abort()}catch(t){a=!0,c.b.warn("can not abort audio buffer: "+t)}a?this.audioTimestampOffset=t.start:(c.b.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+t.start),i.timestampOffset=t.start)}}},d.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),c.b.log(i+" sourceBuffer(s) expected")),this.sourceBufferNb=i},d.prototype.onMediaAttaching=function(t){var e=this.media=t.media;if(e){var r=this.mediaSource=new o;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}},d.prototype.onMediaDetaching=function(){c.b.log("media source detaching");var t=this.mediaSource;if(t){if("open"===t.readyState)try{t.endOfStream()}catch(t){c.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()):c.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(l.a.MEDIA_DETACHED)},d.prototype.onMediaSourceOpen=function(){c.b.log("media source opened"),this.hls.trigger(l.a.MEDIA_ATTACHED,{media:this.media});var t=this.mediaSource;t&&t.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()},d.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())},d.prototype.onMediaSourceClose=function(){c.b.log("media source closed")},d.prototype.onMediaSourceEnded=function(){c.b.log("media source ended")},d.prototype.onSBUpdateEnd=function(){if(this.audioTimestampOffset){var t=this.sourceBuffer.audio;c.b.warn("change mpeg audio timestamp offset from "+t.timestampOffset+" to "+this.audioTimestampOffset),t.timestampOffset=this.audioTimestampOffset,delete this.audioTimestampOffset}this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1;var r=this.parent,e=this.segments.reduce(function(t,e){return e.parent===r?t+1:t},0),i={},a=this.sourceBuffer;for(var n in a)i[n]=a[n].buffered;this.hls.trigger(l.a.BUFFER_APPENDED,{parent:r,pending:e,timeRanges:i}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()},d.prototype.onSBUpdateError=function(t){c.b.error("sourceBuffer error:",t),this.hls.trigger(l.a.ERROR,{type:u.b.MEDIA_ERROR,details:u.a.BUFFER_APPENDING_ERROR,fatal:!1})},d.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},d.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()}},d.prototype.createSourceBuffers=function(t){var e=this.sourceBuffer,r=this.mediaSource;for(var i in t)if(!e[i]){var a=t[i],n=a.levelCodec||a.codec,o=a.container+";codecs="+n;c.b.log("creating sourceBuffer("+o+")");try{var s=e[i]=r.addSourceBuffer(o);s.addEventListener("updateend",this.onsbue),s.addEventListener("error",this.onsbe),this.tracks[i]={codec:n,container:a.container},a.buffer=s}catch(t){c.b.error("error while trying to add sourceBuffer:"+t.message),this.hls.trigger(l.a.ERROR,{type:u.b.MEDIA_ERROR,details:u.a.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:t,mimeType:o})}}this.hls.trigger(l.a.BUFFER_CREATED,{tracks:t})},d.prototype.onBufferAppending=function(t){this._needsFlush||(this.segments?this.segments.push(t):this.segments=[t],this.doAppending())},d.prototype.onBufferAppendFail=function(t){c.b.error("sourceBuffer error:",t.event),this.hls.trigger(l.a.ERROR,{type:u.b.MEDIA_ERROR,details:u.a.BUFFER_APPENDING_ERROR,fatal:!1})},d.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,c.b.log(i+" sourceBuffer now EOS"));this.checkEos()},d.prototype.checkEos=function(){var t=this.sourceBuffer,e=this.mediaSource;if(e&&"open"===e.readyState){for(var r in t){var i=t[r];if(!i.ended)return;if(i.updating)return void(this._needsEos=!0)}c.b.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment");try{e.endOfStream()}catch(t){c.b.warn("exception while calling mediaSource.endOfStream()")}this._needsEos=!1}else this._needsEos=!1},d.prototype.onBufferFlushing=function(t){this.flushRange.push({start:t.startOffset,end:t.endOffset,type:t.type}),this.flushBufferCounter=0,this.doFlush()},d.prototype.onLevelUpdated=function(t){var e=t.details;0<e.fragments.length&&(this._levelDuration=e.totalduration+e.fragments[0].start,this._live=e.live,this.updateMediaElementDuration())},d.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?(c.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))&&(c.b.log("Updating Media Source duration to "+this._levelDuration.toFixed(3)),this._msDuration=this.mediaSource.duration=this._levelDuration)}},d.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){c.b.error("error while accessing sourceBuffer.buffered")}this.appended=e,this.hls.trigger(l.a.BUFFER_FLUSHED)}},d.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 c.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 a=e[i.type];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){c.b.error("error while trying to append buffer:"+e.message),r.unshift(i);var n={type:u.b.MEDIA_ERROR,parent:i.parent};22!==e.code?(this.appendError?this.appendError++:this.appendError=1,n.details=u.a.BUFFER_APPEND_ERROR,this.appendError>t.config.appendErrorMaxRetry?(c.b.log("fail "+t.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],n.fatal=!0):n.fatal=!1):(this.segments=[],n.details=u.a.BUFFER_FULL_ERROR,n.fatal=!1),t.trigger(l.a.ERROR,n)}}}},d.prototype.flushBuffer=function(t,e,r){var i=void 0,a=void 0,n=void 0,o=void 0,s=void 0,l=void 0,u=this.sourceBuffer;if(Object.keys(u).length){if(c.b.log("flushBuffer,pos/start/end: "+this.media.currentTime.toFixed(3)+"/"+t+"/"+e),this.flushBufferCounter<this.appended){for(var d in u)if(!r||d===r){if((i=u[d]).ended=!1,i.updating)return c.b.warn("cannot flush, sb updating in progress"),!1;try{for(a=0;a<i.buffered.length;a++)if(n=i.buffered.start(a),o=i.buffered.end(a),l=-1!==navigator.userAgent.toLowerCase().indexOf("firefox")&&e===Number.POSITIVE_INFINITY?(s=t,e):(s=Math.max(n,t),Math.min(o,e)),.5<Math.min(l,o)-s)return this.flushBufferCounter++,c.b.log("flush "+d+" ["+s+","+l+"], of ["+n+","+o+"], pos:"+this.media.currentTime),i.remove(s,l),!1}catch(t){c.b.warn("exception while accessing sourcebuffer, it might have been removed from MediaSource")}}}else c.b.warn("abort flushing too many retries");c.b.log("buffer flushed")}return!0},d);function d(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,l.a.MEDIA_ATTACHING,l.a.MEDIA_DETACHING,l.a.MANIFEST_PARSED,l.a.BUFFER_RESET,l.a.BUFFER_APPENDING,l.a.BUFFER_CODECS,l.a.BUFFER_EOS,l.a.BUFFER_FLUSHING,l.a.LEVEL_PTS_UPDATED,l.a.LEVEL_UPDATED));return e._msDuration=null,e._levelDuration=null,e._live=null,e._objectUrl=null,e.onsbue=e.onSBUpdateEnd.bind(e),e.onsbe=e.onSBUpdateError.bind(e),e.pendingTracks={},e.tracks={},e}e.a=s},function(t,e,r){"use strict";var i,a=r(1),n=r(3),o=function(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),t},s=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(l,i=n.a),l.prototype.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this._stopCapping())},l.prototype.onFpsDropLevelCapping=function(t){l.isLevelAllowed(t.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(t.droppedLevel)},l.prototype.onMediaAttaching=function(t){this.media=t.media instanceof window.HTMLVideoElement?t.media:null},l.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()},l.prototype.onBufferCodecs=function(t){this.hls.config.capLevelToPlayerSize&&t.video&&this._startCapping()},l.prototype.onLevelsUpdated=function(t){this.levels=t.levels},l.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}}},l.prototype.getMaxLevel=function(r){var i=this;if(!this.levels)return-1;var t=this.levels.filter(function(t,e){return l.isLevelAllowed(e,i.restrictedLevels)&&e<=r});return l.getMaxLevelByMediaSize(t,this.mediaWidth,this.mediaHeight)},l.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())},l.prototype._stopCapping=function(){this.restrictedLevels=[],this.firstLevel=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer),this.timer=null)},l.isLevelAllowed=function(t){return-1===(1<arguments.length&&void 0!==arguments[1]?arguments[1]:[]).indexOf(t)},l.getMaxLevelByMediaSize=function(t,e,r){if(!t||t&&!t.length)return-1;for(var i=t.length-1,a=0;a<t.length;a+=1){var n=t[a];if((n.width>=e||n.height>=r)&&(!(o=t[a+1])||n.width!==o.width||n.height!==o.height)){i=a;break}}var o;return i},o(l,[{key:"mediaWidth",get:function(){var t=void 0,e=this.media;return e&&(t=e.width||e.clientWidth||e.offsetWidth,t*=l.contentScaleFactor),t}},{key:"mediaHeight",get:function(){var t=void 0,e=this.media;return e&&(t=e.height||e.clientHeight||e.offsetHeight,t*=l.contentScaleFactor),t}}],[{key:"contentScaleFactor",get:function(){var t=1;try{t=window.devicePixelRatio}catch(t){}return t}}]),l);function l(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,a.a.FPS_DROP_LEVEL_CAPPING,a.a.MEDIA_ATTACHING,a.a.MANIFEST_PARSED,a.a.BUFFER_CODECS));return e.autoLevelCapping=Number.POSITIVE_INFINITY,e.firstLevel=null,e.levels=[],e.media=null,e.restrictedLevels=[],e.timer=null,e}function u(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)}}e.a=s},function(t,e,r){"use strict";var i,d=r(1),a=r(3),c=r(0),h=window.performance,n=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,i=a.a),o.prototype.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},o.prototype.onMediaAttaching=function(t){var e=this.hls.config;e.capLevelOnFPSDrop&&("function"==typeof(this.video=t.media instanceof window.HTMLVideoElement?t.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),e.fpsDroppedMonitoringPeriod))},o.prototype.checkFPS=function(t,e,r){var i=h.now();if(e){if(this.lastTime){var a=i-this.lastTime,n=r-this.lastDroppedFrames,o=e-this.lastDecodedFrames,s=1e3*n/a,l=this.hls;if(l.trigger(d.a.FPS_DROP,{currentDropped:n,currentDecoded:o,totalDroppedFrames:r}),0<s&&n>l.config.fpsDroppedMonitoringThreshold*o){var u=l.currentLevel;c.b.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),0<u&&(-1===l.autoLevelCapping||l.autoLevelCapping>=u)&&(--u,l.trigger(d.a.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,l.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=e}},o.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)},o);function o(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,d.a.MEDIA_ATTACHING))}e.a=n},function(t,e,r){"use strict";var d=r(0),i=window,c=i.performance,a=i.XMLHttpRequest,n=(o.prototype.destroy=function(){this.abort(),this.loader=null},o.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},o.prototype.load=function(t,e,r){this.context=t,this.config=e,this.callbacks=r,this.stats={trequest:c.now(),retry:0},this.retryDelay=e.retryDelay,this.loadInternal()},o.prototype.loadInternal=function(){var t=void 0,e=this.context;t=this.loader=new a;var r=this.stats;r.tfirst=0,r.loaded=0;var i=this.xhrSetup;try{if(i)try{i(t,e.url)}catch(r){t.open("GET",e.url,!0),i(t,e.url)}t.readyState||t.open("GET",e.url,!0)}catch(r){return void this.callbacks.onError({code:t.status,text:r.message},e,t)}e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),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()},o.prototype.readystatechange=function(t){var e=t.currentTarget,r=e.readyState,i=this.stats,a=this.context,n=this.config;if(!i.aborted&&2<=r)if(window.clearTimeout(this.requestTimeout),0===i.tfirst&&(i.tfirst=Math.max(c.now(),i.trequest)),4===r){var o=e.status;if(200<=o&&o<300){i.tload=Math.max(i.tfirst,c.now());var s=void 0,l=void 0;l="arraybuffer"===a.responseType?(s=e.response).byteLength:(s=e.responseText).length,i.loaded=i.total=l;var u={url:e.responseURL,data:s};this.callbacks.onSuccess(u,i,a,e)}else i.retry>=n.maxRetry||400<=o&&o<499?(d.b.error(o+" while loading "+a.url),this.callbacks.onError({code:o,text:e.statusText},a,e)):(d.b.warn(o+" 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,n.maxRetryDelay),i.retry++)}else this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),n.timeout)},o.prototype.loadtimeout=function(){d.b.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},o.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)},o);function o(t){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,o),t&&t.xhrSetup&&(this.xhrSetup=t.xhrSetup)}e.a=n},function(t,e,r){"use strict";var i,s=r(1),a=r(8),l=r(0),u=r(2),n=function(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),t},o=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(d,i=a.a),d.prototype.onManifestLoading=function(){this.tracks=[],this.trackId=-1},d.prototype.onManifestParsed=function(t){var e=this.tracks=t.audioTracks||[];this.hls.trigger(s.a.AUDIO_TRACKS_UPDATED,{audioTracks:e})},d.prototype.onAudioTrackLoaded=function(t){if(t.id>=this.tracks.length)l.b.warn("Invalid audio track id:",t.id);else{if(l.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()}},d.prototype.onAudioTrackSwitched=function(t){var e=this.tracks[t.id].groupId;e&&this.audioGroupId!==e&&(this.audioGroupId=e)},d.prototype.onLevelLoaded=function(t){var e=this.hls.levels[t.level];if(e.audioGroupIds){var r=e.audioGroupIds[e.urlId];this.audioGroupId!==r&&(this.audioGroupId=r,this._selectInitialAudioTrack())}},d.prototype.onError=function(t){t.type===u.b.NETWORK_ERROR&&(t.fatal&&this.clearInterval(),t.details===u.a.AUDIO_TRACK_LOAD_ERROR&&(l.b.warn("Network failure on audio-track id:",t.context.id),this._handleLoadError()))},d.prototype.doTick=function(){this._updateTrack(this.trackId)},d.prototype._selectInitialAudioTrack=function(){var e=this,t=this.tracks;if(t.length){var r=this.tracks[this.trackId],i=null;r&&(i=r.name);var a=t.filter(function(t){return t.default});a.length?t=a:l.b.warn("No default audio tracks defined");var n=!1,o=function(){t.forEach(function(t){n||e.audioGroupId&&t.groupId!==e.audioGroupId||i&&i!==t.name||(e.audioTrack=t.id,n=!0)})};o(),n||(i=null,o()),n||(l.b.error("No track found for running audio group-ID: "+this.audioGroupId),this.hls.trigger(s.a.ERROR,{type:u.b.MEDIA_ERROR,details:u.a.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))}},d.prototype._needsTrackLoading=function(t){var e=t.details;return!e||!!e.live||void 0},d.prototype._loadTrackDetailsIfNeeded=function(t){if(this._needsTrackLoading(t)){var e=t.url,r=t.id;l.b.log("loading audio-track playlist for id: "+r),this.hls.trigger(s.a.AUDIO_TRACK_LOADING,{url:e,id:r})}},d.prototype._updateTrack=function(t){if(!(t<0||t>=this.tracks.length)){this.clearInterval(),this.trackId=t,l.b.log("trying to update audio-track "+t);var e=this.tracks[t];this._loadTrackDetailsIfNeeded(e)}},d.prototype._handleLoadError=function(){this.trackIdBlacklist[this.trackId]=!0;var t=this.trackId,e=this.tracks[t],r=e.name,i=e.language,a=e.groupId;l.b.warn("Loading failed on audio track id: "+t+", group-id: "+a+', name/language: "'+r+'" / "'+i+'"');for(var n=t,o=0;o<this.tracks.length;o++)if(!this.trackIdBlacklist[o]&&this.tracks[o].name===r){n=o;break}n!==t?(l.b.log("Attempting audio-track fallback id:",n,"group-id:",this.tracks[n].groupId),this.audioTrack=n):l.b.warn('No fallback audio-track found for name/language: "'+r+'" / "'+i+'"')},n(d,[{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)l.b.debug("Same id as current audio-track passed, and track details available -> no-op");else if(t<0||t>=this.tracks.length)l.b.warn("Invalid id passed to audio-track controller");else{var e=this.tracks[t];l.b.log("Now switching to audio-track index "+t),this.clearInterval(),this.trackId=t;var r=e.url,i=e.type,a=e.id;this.hls.trigger(s.a.AUDIO_TRACK_SWITCHING,{id:a,type:i,url:r}),this._loadTrackDetailsIfNeeded(e)}}}]),d);function d(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,s.a.MANIFEST_LOADING,s.a.MANIFEST_PARSED,s.a.AUDIO_TRACK_LOADED,s.a.AUDIO_TRACK_SWITCHED,s.a.LEVEL_LOADED,s.a.ERROR));return e.trackId=-1,e.tracks=[],e.trackIdBlacklist=Object.create(null),e.audioGroupId=null,e}function c(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)}}e.a=o},function(t,e,r){"use strict";var i,P=r(6),x=r(11),f=r(20),F=r(1),h=r(15),a=r(24),p=r(2),M=r(0),N=r(25),n=r(8),U=r(10),g=r(9),o=function(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),t},B=window.performance,s="STOPPED",G="STARTING",K="IDLE",j="PAUSED",H="KEY_LOADING",V="FRAG_LOADING",Y="FRAG_LOADING_WAITING_RETRY",W="WAITING_TRACK",v="PARSING",u="PARSED",q="BUFFER_FLUSHING",X="ENDED",z="ERROR",Q="WAITING_INIT_PTS",l=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(d,i=n.a),d.prototype.onHandlerDestroying=function(){this.stopLoad(),i.prototype.onHandlerDestroying.call(this)},d.prototype.onHandlerDestroyed=function(){this.state=s,this.fragmentTracker=null,i.prototype.onHandlerDestroyed.call(this)},d.prototype.onInitPtsFound=function(t){var e=t.id,r=t.frag.cc,i=t.initPTS;"main"===e&&(this.initPTS[r]=i,this.videoTrackCC=r,M.b.log("InitPTS for cc: "+r+" found from video track: "+i),this.state===Q&&this.tick())},d.prototype.startLoad=function(t){if(this.tracks){var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),(this.fragLoadError=0)<e&&-1===t?(M.b.log("audio:override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=K):(this.lastCurrentTime=this.startPosition?this.startPosition:t,this.state=G),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=t,this.state=s},d.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=s},d.prototype.doTick=function(){var t=void 0,e=void 0,r=void 0,i=this.hls,a=i.config;switch(this.state){case z:case j:case q:break;case G:this.state=W,this.loadedmetadata=!1;break;case K:var n=this.tracks;if(!n)break;if(!this.media&&(this.startFragRequested||!a.startFragPrefetch))break;if(this.loadedmetadata)t=this.media.currentTime;else if(void 0===(t=this.nextLoadPosition))break;var o=this.mediaBuffer?this.mediaBuffer:this.media,s=this.videoBuffer?this.videoBuffer:this.media,l=x.a.bufferInfo(o,t,a.maxBufferHole),u=x.a.bufferInfo(s,t,a.maxBufferHole),d=l.len,c=l.end,h=this.fragPrevious,f=Math.min(a.maxBufferLength,a.maxMaxBufferLength),p=Math.max(f,u.len),g=this.audioSwitch,v=this.trackId;if((d<p||g)&&v<n.length){if(void 0===(r=n[v].details)){this.state=W;break}if(!g&&!r.live&&h&&h.sn===r.endSN&&!l.nextStart&&(!this.media.seeking||this.media.duration-c<h.duration/2)){this.hls.trigger(F.a.BUFFER_EOS,{type:"audio"}),this.state=X;break}var y=r.fragments,m=y.length,b=y[0].start,T=y[m-1].start+y[m-1].duration,E=void 0;if(g)if(r.live&&!r.PTSKnown)M.b.log("switching audiotrack, live stream, unknown PTS,load first fragment"),c=0;else if(c=t,r.PTSKnown&&t<b){if(!(l.end>b||l.nextStart))return;M.b.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=b+.05}if(r.initSegment&&!r.initSegment.data)E=r.initSegment;else if(c<=b){if(E=y[0],null!==this.videoTrackCC&&E.cc!==this.videoTrackCC&&(E=Object(N.b)(y,this.videoTrackCC)),r.live&&E.loadIdx&&E.loadIdx===this.fragLoadIdx){var S=l.nextStart?l.nextStart:b;return M.b.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(S+.05)),void(this.media.currentTime=S+.05)}}else{var _=void 0,R=a.maxFragLookUpTolerance,A=h?y[h.sn-y[0].sn+1]:void 0,w=function(t){var e=Math.min(R,t.duration);return t.start+t.duration-e<=c?1:t.start-e>c&&t.start?-1:0};(_=c<T?(T-R<c&&(R=0),A&&!w(A)?A:P.a.search(y,w)):y[m-1])&&(b=(E=_).start,h&&E.level===h.level&&E.sn===h.sn&&(E.sn<r.endSN?(E=y[E.sn+1-r.startSN],M.b.log("SN just loaded, load next one: "+E.sn)):E=null))}E&&(E.encrypted?(M.b.log("Loading key for "+E.sn+" of ["+r.startSN+" ,"+r.endSN+"],track "+v),this.state=H,i.trigger(F.a.KEY_LOADING,{frag:E})):(M.b.log("Loading "+E.sn+", cc: "+E.cc+" of ["+r.startSN+" ,"+r.endSN+"],track "+v+", currentTime:"+t+",bufferEnd:"+c.toFixed(3)),!g&&this.fragmentTracker.getState(E)!==U.a.NOT_LOADED||(this.fragCurrent=E,this.startFragRequested=!0,isNaN(E.sn)||(this.nextLoadPosition=E.start+E.duration),i.trigger(F.a.FRAG_LOADING,{frag:E}),this.state=V)))}break;case W:(e=this.tracks[this.trackId])&&e.details&&(this.state=K);break;case Y:var L=B.now(),k=this.retryDate,D=(o=this.media)&&o.seeking;(!k||k<=L||D)&&(M.b.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=K);break;case Q:var O=this.videoTrackCC;if(void 0===this.initPTS[O])break;var I=this.waitingFragment;if(I){var C=I.frag.cc;O!==C?(e=this.tracks[this.trackId]).details&&e.details.live&&(M.b.warn("Waiting fragment CC ("+C+") does not match video track CC ("+O+")"),this.waitingFragment=null,this.state=K):(this.state=V,this.onFragLoaded(this.waitingFragment),this.waitingFragment=null)}else this.state=K}},d.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)},d.prototype.onMediaDetaching=function(){var t=this.media;t&&t.ended&&(M.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()},d.prototype.onMediaSeeking=function(){this.state===X&&(this.state=K),this.media&&(this.lastCurrentTime=this.media.currentTime),this.tick()},d.prototype.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},d.prototype.onAudioTracksUpdated=function(t){M.b.log("audio tracks updated"),this.tracks=t.audioTracks},d.prototype.onAudioTrackSwitching=function(t){var e=!!t.url;this.trackId=t.id,this.fragCurrent=null,this.state=j,this.waitingFragment=null,e?this.setInterval(100):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),e&&(this.audioSwitch=!0,this.state=K),this.tick()},d.prototype.onAudioTrackLoaded=function(t){var e=t.details,r=t.id,i=this.tracks[r],a=e.totalduration,n=0;if(M.b.log("track "+r+" loaded ["+e.startSN+","+e.endSN+"],duration:"+a),e.live){var o=i.details;o&&0<e.fragments.length?(h.b(o,e),n=e.fragments[0].start,e.PTSKnown?M.b.log("live audio playlist sliding:"+n.toFixed(3)):M.b.log("live audio playlist - outdated PTS, unknown sliding")):(e.PTSKnown=!1,M.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:(M.b.log("start time offset found in playlist, adjust startPosition to "+s),this.startPosition=s)}this.nextLoadPosition=this.startPosition}this.state===W&&(this.state=K),this.tick()},d.prototype.onKeyLoaded=function(){this.state===H&&(this.state=K,this.tick())},d.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag;if(this.state===V&&e&&"audio"===r.type&&r.level===e.level&&r.sn===e.sn){var i=this.tracks[this.trackId],a=i.details,n=a.totalduration,o=e.level,s=e.sn,l=e.cc,u=this.config.defaultAudioCodec||i.audioCodec||"mp4a.40.2",d=this.stats=t.stats;if("initSegment"===s)this.state=K,d.tparsed=d.tbuffered=B.now(),a.initSegment.data=t.payload,this.hls.trigger(F.a.FRAG_BUFFERED,{stats:d,frag:e,id:"audio"}),this.tick();else{this.state=v,this.appended=!1,this.demuxer||(this.demuxer=new f.a(this.hls,"audio"));var c=this.initPTS[l],h=a.initSegment?a.initSegment.data:[];a.initSegment||void 0!==c?(this.pendingBuffering=!0,M.b.log("Demuxing "+s+" of ["+a.startSN+" ,"+a.endSN+"],track "+o),this.demuxer.push(t.payload,h,u,null,e,n,!1,c)):(M.b.log("unknown video PTS for continuity counter "+l+", waiting for video PTS before demuxing audio frag "+s+" of ["+a.startSN+" ,"+a.endSN+"],track "+o),this.waitingFragment=t,this.state=Q)}}this.fragLoadError=0},d.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===v){var i=t.tracks,a=void 0;if(i.video&&delete i.video,a=i.audio){a.levelCodec=a.codec,a.id=t.id,this.hls.trigger(F.a.BUFFER_CODECS,i),M.b.log("audio track:audio,container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var n=a.initSegment;if(n){var o={type:"audio",data:n,parent:"audio",content:"initSegment"};this.audioSwitch?this.pendingData=[o]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(F.a.BUFFER_APPENDING,o))}this.tick()}}},d.prototype.onFragParsingData=function(e){var r=this,t=this.fragCurrent,i=e.frag;if(t&&"audio"===e.id&&"audio"===e.type&&i.sn===t.sn&&i.level===t.level&&this.state===v){var a=this.trackId,n=this.tracks[a],o=this.hls;isNaN(e.endPTS)&&(e.endPTS=e.startPTS+t.duration,e.endDTS=e.startDTS+t.duration),t.addElementaryStream(g.a.ElementaryStreamTypes.AUDIO),M.b.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),h.c(n.details,t,e.startPTS,e.endPTS);var s=this.audioSwitch,l=this.media,u=!1;if(s&&l)if(l.readyState){var d=l.currentTime;M.b.log("switching audio track : currentTime:"+d),d>=e.startPTS&&(M.b.log("switching audio track : flushing all audio"),this.state=q,o.trigger(F.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),u=!0,this.audioSwitch=!1,o.trigger(F.a.AUDIO_TRACK_SWITCHED,{id:a}))}else this.audioSwitch=!1,o.trigger(F.a.AUDIO_TRACK_SWITCHED,{id:a});var c=this.pendingData;if(!c)return M.b.warn("Apparently attempt to enqueue media payload without codec initialization data upfront"),void o.trigger(F.a.ERROR,{type:p.b.MEDIA_ERROR,details:null,fatal:!0});this.audioSwitch||([e.data1,e.data2].forEach(function(t){t&&t.length&&c.push({type:e.type,data:t,parent:"audio",content:"data"})}),!u&&c.length&&(c.forEach(function(t){r.state===v&&(r.pendingBuffering=!0,r.hls.trigger(F.a.BUFFER_APPENDING,t))}),this.pendingData=[],this.appended=!0)),this.tick()}},d.prototype.onFragParsed=function(t){var e=this.fragCurrent,r=t.frag;e&&"audio"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===v&&(this.stats.tparsed=B.now(),this.state=u,this._checkAppendedParsed())},d.prototype.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},d.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)},d.prototype.onBufferAppended=function(t){if("audio"===t.parent){var e=this.state;e!==v&&e!==u||(this.pendingBuffering=0<t.pending,this._checkAppendedParsed())}},d.prototype._checkAppendedParsed=function(){if(!(this.state!==u||this.appended&&this.pendingBuffering)){var t=this.fragCurrent,e=this.stats,r=this.hls;if(t){this.fragPrevious=t,e.tbuffered=B.now(),r.trigger(F.a.FRAG_BUFFERED,{stats:e,frag:t,id:"audio"});var i=this.mediaBuffer?this.mediaBuffer:this.media;M.b.log("audio buffered : "+a.a.toString(i.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,r.trigger(F.a.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=K}this.tick()}},d.prototype.onError=function(t){var e=t.frag;if(!e||"audio"===e.type)switch(t.details){case p.a.FRAG_LOAD_ERROR:case p.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 a=this.config;if(i<=a.fragLoadingMaxRetry){this.fragLoadError=i;var n=Math.min(Math.pow(2,i-1)*a.fragLoadingRetryDelay,a.fragLoadingMaxRetryTimeout);M.b.warn("AudioStreamController: frag loading failed, retry in "+n+" ms"),this.retryDate=B.now()+n,this.state=Y}else M.b.error("AudioStreamController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=z}break;case p.a.AUDIO_TRACK_LOAD_ERROR:case p.a.AUDIO_TRACK_LOAD_TIMEOUT:case p.a.KEY_LOAD_ERROR:case p.a.KEY_LOAD_TIMEOUT:this.state!==z&&(this.state=t.fatal?z:K,M.b.warn("AudioStreamController: "+t.details+" while loading frag, now switching to "+this.state+" state ..."));break;case p.a.BUFFER_FULL_ERROR:if("audio"===t.parent&&(this.state===v||this.state===u)){var o=this.mediaBuffer,s=this.media.currentTime;if(o&&x.a.isBuffered(o,s)&&x.a.isBuffered(o,s+.5)){var l=this.config;l.maxMaxBufferLength>=l.maxBufferLength&&(l.maxMaxBufferLength/=2,M.b.warn("AudioStreamController: reduce max buffer length to "+l.maxMaxBufferLength+"s")),this.state=K}else M.b.warn("AudioStreamController: buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=q,this.hls.trigger(F.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})}}},d.prototype.onBufferFlushed=function(){var e=this,t=this.pendingData;t&&t.length?(M.b.log("AudioStreamController: appending pending audio data after buffer flushed"),t.forEach(function(t){e.hls.trigger(F.a.BUFFER_APPENDING,t)}),this.appended=!0,this.pendingData=[],this.state=u):(this.state=K,this.fragPrevious=null,this.tick())},o(d,[{key:"state",set:function(t){if(this.state!==t){var e=this.state;this._state=t,M.b.log("audio stream:"+e+"->"+t)}},get:function(){return this._state}}]),d);function d(t,e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,F.a.MEDIA_ATTACHED,F.a.MEDIA_DETACHING,F.a.AUDIO_TRACKS_UPDATED,F.a.AUDIO_TRACK_SWITCHING,F.a.AUDIO_TRACK_LOADED,F.a.KEY_LOADED,F.a.FRAG_LOADED,F.a.FRAG_PARSING_INIT_SEGMENT,F.a.FRAG_PARSING_DATA,F.a.FRAG_PARSED,F.a.ERROR,F.a.BUFFER_RESET,F.a.BUFFER_CREATED,F.a.BUFFER_APPENDED,F.a.BUFFER_FLUSHED,F.a.INIT_PTS_FOUND));return r.fragmentTracker=e,r.config=t.config,r.audioCodecSwap=!1,r._state=s,r.initPTS=[],r.waitingFragment=null,r.videoTrackCC=null,r}function c(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)}}e.a=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.newCue=function(t,e,r,i){for(var a=void 0,n=void 0,o=void 0,s=void 0,l=void 0,u=window.VTTCue||window.TextTrackCue,d=0;d<i.rows.length;d++)if(o=!0,s=0,l="",!(a=i.rows[d]).isEmpty()){for(var c=0;c<a.chars.length;c++)a.chars[c].uchar.match(/\s/)&&o?s++:(l+=a.chars[c].uchar,o=!1);(a.cueStartTime=e)===r&&(r+=1e-4),n=new u(e,r,Object(h.b)(l.trim())),16<=s?s--:s++,navigator.userAgent.match(/Firefox\//)?n.line=d+1:n.line=7<d?d-2:d+1,n.align="left",n.position=Math.max(0,Math.min(100,s/32*100+(navigator.userAgent.match(/Firefox\//)?50:0))),t.addCue(n)}};var h=r(27)},function(t,e,r){"use strict";e.a=function(){function T(t){return"string"==typeof t&&!!e[t.toLowerCase()]&&t.toLowerCase()}function E(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)t[i]=r[i]}return t}function t(t,e,r){var i=this,a=function(){if("undefined"!=typeof navigator)return/MSIE\s8\.0/.test(navigator.userAgent)}(),n={};a?i=document.createElement("custom"):n.enumerable=!0,i.hasBeenReset=!1;var o="",s=!1,l=t,u=e,d=r,c=null,h="",f=!0,p="auto",g="start",v=50,y="middle",m=50,b="middle";if(Object.defineProperty(i,"id",E({},n,{get:function(){return o},set:function(t){o=""+t}})),Object.defineProperty(i,"pauseOnExit",E({},n,{get:function(){return s},set:function(t){s=!!t}})),Object.defineProperty(i,"startTime",E({},n,{get:function(){return l},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");l=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"endTime",E({},n,{get:function(){return u},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");u=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"text",E({},n,{get:function(){return d},set:function(t){d=""+t,this.hasBeenReset=!0}})),Object.defineProperty(i,"region",E({},n,{get:function(){return c},set:function(t){c=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"vertical",E({},n,{get:function(){return h},set:function(t){var e,r="string"==typeof(e=t)&&!!S[e.toLowerCase()]&&e.toLowerCase();if(!1===r)throw new SyntaxError("An invalid or illegal string was specified.");h=r,this.hasBeenReset=!0}})),Object.defineProperty(i,"snapToLines",E({},n,{get:function(){return f},set:function(t){f=!!t,this.hasBeenReset=!0}})),Object.defineProperty(i,"line",E({},n,{get:function(){return p},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");p=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"lineAlign",E({},n,{get:function(){return g},set:function(t){var e=T(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");g=e,this.hasBeenReset=!0}})),Object.defineProperty(i,"position",E({},n,{get:function(){return v},set:function(t){if(t<0||100<t)throw new Error("Position must be between 0 and 100.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"positionAlign",E({},n,{get:function(){return y},set:function(t){var e=T(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(i,"size",E({},n,{get:function(){return m},set:function(t){if(t<0||100<t)throw new Error("Size must be between 0 and 100.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"align",E({},n,{get:function(){return b},set:function(t){var e=T(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");b=e,this.hasBeenReset=!0}})),i.displayState=void 0,a)return i}if("undefined"!=typeof window&&window.VTTCue)return window.VTTCue;var S={"":!0,lr:!0,rl:!0},e={start:!0,middle:!0,end:!0,left:!0,right:!0};return t.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},t}()},function(t,e,r){"use strict";var a,o=r(1),i=r(3),n=r(65),s=r(66),l=r(67),u=r(0),d=r(26),c=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(h,a=i.a),h.prototype.addCues=function(t,e,r,i){for(var a=this.cueRanges,n=!1,o=a.length;o--;){var s=a[o],l=(u=s[0],d=s[1],c=e,h=r,Math.min(d,h)-Math.max(u,c));if(0<=l&&(s[0]=Math.min(s[0],e),s[1]=Math.max(s[1],r),n=!0,.5<l/(r-e)))return}var u,d,c,h;n||a.push([e,r]),this.Cues.newCue(this.captionsTracks[t],e,r,i)},h.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=[])},h.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},h.prototype.createCaptionsTrack=function(t){var e=this.captionsProperties[t],r=e.label,i=e.languageCode,a=this.captionsTracks;if(!a[t]){var n=this.getExistingTrack(t);if(n)a[t]=n,Object(d.a)(a[t]),Object(d.b)(a[t],this.media);else{var o=this.createTextTrack("captions",r,i);o&&(o[t]=!0,a[t]=o)}}},h.prototype.createTextTrack=function(t,e,r){var i=this.media;if(i)return i.addTextTrack(t,e,r)},h.prototype.destroy=function(){i.a.prototype.destroy.call(this)},h.prototype.onMediaAttaching=function(t){this.media=t.media,this._cleanTracks()},h.prototype.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach(function(t){Object(d.a)(e[t]),delete e[t]})},h.prototype.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0},this._cleanTracks()},h.prototype._cleanTracks=function(){var t=this.media;if(t){var e=t.textTracks;if(e)for(var r=0;r<e.length;r++)Object(d.a)(e[r])}},h.prototype.onManifestLoaded=function(t){var o=this;if(this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=void 0,this.cueRanges=[],this.config.enableWebVTT){this.tracks=t.subtitles||[];var s=this.media?this.media.textTracks:[];this.tracks.forEach(function(t,e){var r,i,a=void 0;if(e<s.length){var n=s[e];i=t,!(r=n)||r.label!==i.name||r.textTrack1||r.textTrack2||(a=n)}a=a||o.createTextTrack("subtitles",t.name,t.lang),t.default?a.mode=o.hls.subtitleDisplay?"showing":"hidden":a.mode="disabled",o.textTracks.push(a)})}},h.prototype.onLevelSwitching=function(){this.enabled="NONE"!==this.hls.currentLevel.closedCaptions},h.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 a=this.cea608Parser;a&&a.reset()}this.lastSn=i}else if("subtitle"===e.type)if(r.byteLength){if(void 0===this.initPTS)return void this.unparsedVttFrags.push(t);var n=e.decryptdata;null!=n&&null!=n.key&&"AES-128"===n.method||this._parseVTTs(e,r)}else this.hls.trigger(o.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})},h.prototype._parseVTTs=function(e,t){var r=this.vttCCs;r[e.cc]||(r[e.cc]={start:e.start,prevCC:this.prevCC,new:!0},this.prevCC=e.cc);var a=this.textTracks,n=this.hls;l.a.parse(t,this.initPTS,r,e.cc,function(t){var i=a[e.trackId];"disabled"!==i.mode?(t.forEach(function(e){if(!i.cues.getCueById(e.id))try{i.addCue(e)}catch(t){var r=new window.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,i.addCue(r)}}),n.trigger(o.a.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})):n.trigger(o.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})},function(t){u.b.log("Failed to parse VTT cue: "+t),n.trigger(o.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e})})},h.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)}},h.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)}},h.prototype.extractCea608Data=function(t){for(var e=31&t[0],r=2,i=void 0,a=void 0,n=void 0,o=[],s=0;s<e;s++)i=t[r++],a=127&t[r++],n=127&t[r++],0===a&&0===n||0!=(4&i)&&0==(3&i)&&(o.push(a),o.push(n));return o},h);function h(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,h);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,a.call(this,t,o.a.MEDIA_ATTACHING,o.a.MEDIA_DETACHING,o.a.FRAG_PARSING_USERDATA,o.a.FRAG_DECRYPTED,o.a.MANIFEST_LOADING,o.a.MANIFEST_LOADED,o.a.FRAG_LOADED,o.a.LEVEL_SWITCHING,o.a.INIT_PTS_FOUND));if(e.hls=t,e.config=t.config,e.enabled=!0,e.Cues=t.config.cueHandler,e.textTracks=[],e.tracks=[],e.unparsedVttFrags=[],e.initPTS=void 0,e.cueRanges=[],e.captionsTracks={},e.captionsProperties={textTrack1:{label:e.config.captionsTextTrack1Label,languageCode:e.config.captionsTextTrack1LanguageCode},textTrack2:{label:e.config.captionsTextTrack2Label,languageCode:e.config.captionsTextTrack2LanguageCode}},e.config.enableCEA708Captions){var r=new s.a(e,"textTrack1"),i=new s.a(e,"textTrack2");e.cea608Parser=new n.a(0,r,i)}return e}e.a=c},function(t,e,r){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t){var e=t;return i.hasOwnProperty(t)&&(e=i[t]),String.fromCharCode(e)}function l(t){for(var e=[],r=0;r<t.length;r++)e.push(t[r].toString(16));return e}var i={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},n={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},u={17:2,18:4,21:6,22:8,23:10,19:13,20:15},d={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},c={25:2,26:4,29:6,30:8,31:10,27:13,28:15},h=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],f={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=(R.prototype.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},R.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])}},R.prototype.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},R.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},R.prototype.copy=function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash},R.prototype.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},R),a=(_.prototype.reset=function(){this.uchar=" ",this.penState.reset()},_.prototype.setChar=function(t,e){this.uchar=t,this.penState.copy(e)},_.prototype.setPenState=function(t){this.penState.copy(t)},_.prototype.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)},_.prototype.copy=function(t){this.uchar=t.uchar,this.penState.copy(t.penState)},_.prototype.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},_),g=(S.prototype.equals=function(t){for(var e=!0,r=0;r<100;r++)if(!this.chars[r].equals(t.chars[r])){e=!1;break}return e},S.prototype.copy=function(t){for(var e=0;e<100;e++)this.chars[e].copy(t.chars[e])},S.prototype.isEmpty=function(){for(var t=!0,e=0;e<100;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t},S.prototype.setCursor=function(t){this.pos!==t&&(this.pos=t),this.pos<0?(f.log("ERROR","Negative cursor position "+this.pos),this.pos=0):100<this.pos&&(f.log("ERROR","Too large cursor position "+this.pos),this.pos=100)},S.prototype.moveCursor=function(t){var e=this.pos+t;if(1<t)for(var r=this.pos+1;r<e+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(e)},S.prototype.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},S.prototype.insertChar=function(t){144<=t&&this.backSpace();var e=s(t);100<=this.pos?f.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))},S.prototype.clearFromPos=function(t){var e=void 0;for(e=t;e<100;e++)this.chars[e].reset()},S.prototype.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},S.prototype.clearToEndOfRow=function(){this.clearFromPos(this.pos)},S.prototype.getTextString=function(){for(var t=[],e=!0,r=0;r<100;r++){var i=this.chars[r].uchar;" "!==i&&(e=!1),t.push(i)}return e?"":t.join("")},S.prototype.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},S),v=(E.prototype.reset=function(){for(var t=0;t<15;t++)this.rows[t].clear();this.currRow=14},E.prototype.equals=function(t){for(var e=!0,r=0;r<15;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e},E.prototype.copy=function(t){for(var e=0;e<15;e++)this.rows[e].copy(t.rows[e])},E.prototype.isEmpty=function(){for(var t=!0,e=0;e<15;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t},E.prototype.backSpace=function(){this.rows[this.currRow].backSpace()},E.prototype.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},E.prototype.insertChar=function(t){this.rows[this.currRow].insertChar(t)},E.prototype.setPen=function(t){this.rows[this.currRow].setPenStyles(t)},E.prototype.moveCursor=function(t){this.rows[this.currRow].moveCursor(t)},E.prototype.setCursor=function(t){f.log("INFO","setCursor: "+t),this.rows[this.currRow].setCursor(t)},E.prototype.setPAC=function(t){f.log("INFO","pacData = "+JSON.stringify(t));var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var r=0;r<15;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var n=a.rows[i].cueStartTime;if(n&&n<f.time)for(var o=0;o<this.nrRollUpRows;o++)this.rows[e-this.nrRollUpRows+o+1].copy(a.rows[i+o])}}this.currRow=e;var s=this.rows[this.currRow];if(null!==t.indent){var l=t.indent,u=Math.max(l-1,0);s.setCursor(t.indent),t.color=s.chars[u].penState.foreground}var d={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(d)},E.prototype.setBkgData=function(t){f.log("INFO","bkgData = "+JSON.stringify(t)),this.backSpace(),this.setPen(t),this.insertChar(32)},E.prototype.setRollUpRows=function(t){this.nrRollUpRows=t},E.prototype.rollUp=function(){if(null!==this.nrRollUpRows){f.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),f.log("INFO","Rolling up")}else f.log("DEBUG","roll_up but nrRollUpRows not set yet")},E.prototype.getDisplayText=function(t){t=t||!1;for(var e=[],r="",i=-1,a=0;a<15;a++){var n=this.rows[a].getTextString();n&&(i=a+1,t?e.push("Row "+i+": '"+n+"'"):e.push(n.trim()))}return 0<e.length&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r},E.prototype.getTextAndFormat=function(){return this.rows},E),y=(T.prototype.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},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,f.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";f.log("INFO",r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(f.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},T.prototype.ccRCL=function(){f.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},T.prototype.ccBS=function(){f.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(){f.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},T.prototype.ccRU=function(t){f.log("INFO","RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)},T.prototype.ccFON=function(){f.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},T.prototype.ccRDC=function(){f.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},T.prototype.ccTR=function(){f.log("INFO","TR"),this.setMode("MODE_TEXT")},T.prototype.ccRTD=function(){f.log("INFO","RTD"),this.setMode("MODE_TEXT")},T.prototype.ccEDM=function(){f.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},T.prototype.ccCR=function(){f.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},T.prototype.ccENM=function(){f.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},T.prototype.ccEOC=function(){if(f.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,f.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},T.prototype.ccTO=function(t){f.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=46<=t,e.italics)e.foreground="white";else{var r=Math.floor(t/2)-16;e.foreground=["white","green","blue","cyan","red","yellow","magenta"][r]}f.log("INFO","MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},T.prototype.outputDataUpdate=function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=f.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),m=(b.prototype.getHandler=function(t){return this.channels[t].getHandler()},b.prototype.setHandler=function(t,e){this.channels[t].setHandler(e)},b.prototype.addData=function(t,e){var r=void 0,i=void 0,a=void 0,n=!1;this.lastTime=t,f.setTime(t);for(var o=0;o<e.length;o+=2)i=127&e[o],a=127&e[o+1],0!==i||0!==a?(f.log("DATA","["+l([e[o],e[o+1]])+"] -> ("+l([i,a])+")"),!(r=(r=(r=(r=this.parseCmd(i,a))||this.parseMidrow(i,a))||this.parsePAC(i,a))||this.parseBackgroundAttributes(i,a))&&(n=this.parseChars(i,a))&&(this.currChNr&&0<=this.currChNr?this.channels[this.currChNr-1].insertChars(n):f.log("WARNING","No channel found yet. TEXT-MODE?")),r?this.dataCounters.cmd+=2:n?this.dataCounters.char+=2:(this.dataCounters.other+=2,f.log("WARNING","Couldn't parse cleaned data "+l([i,a])+" orig: "+l([e[o],e[o+1]])))):this.dataCounters.padding+=2},b.prototype.parseCmd=function(t,e){var r;if(!((20===t||28===t)&&32<=e&&e<=47||(23===t||31===t)&&33<=e&&e<=35))return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,f.log("DEBUG","Repeated command ("+l([t,e])+") is dropped"),!0;r=20===t||23===t?1:2;var i=this.channels[r-1];return 20===t||28===t?32===e?i.ccRCL():33===e?i.ccBS():34===e?i.ccAOF():35===e?i.ccAON():36===e?i.ccDER():37===e?i.ccRU(2):38===e?i.ccRU(3):39===e?i.ccRU(4):40===e?i.ccFON():41===e?i.ccRDC():42===e?i.ccTR():43===e?i.ccRTD():44===e?i.ccEDM():45===e?i.ccCR():46===e?i.ccENM():47===e&&i.ccEOC():i.ccTO(e-32),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=r,!0},b.prototype.parseMidrow=function(t,e){var r=null;return(17===t||25===t)&&32<=e&&e<=47&&((r=17===t?1:2)!==this.currChNr?(f.log("ERROR","Mismatch channel in midrow parsing"),!1):(this.channels[r-1].ccMIDROW(e),f.log("DEBUG","MIDROW ("+l([t,e])+")"),!0))},b.prototype.parsePAC=function(t,e){var r,i;if(!((17<=t&&t<=23||25<=t&&t<=31)&&64<=e&&e<=127||(16===t||24===t)&&64<=e&&e<=95))return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,!(this.lastCmdB=null);r=t<=23?1:2,i=64<=e&&e<=95?1==r?n[t]:d[t]:1==r?u[t]:c[t];var a=this.interpretPAC(i,e);return this.channels[r-1].setPAC(a),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=r,!0},b.prototype.interpretPAC=function(t,e){var r,i={color:null,italics:!1,indent:null,underline:!1,row:t};return r=95<e?e-96:e-64,i.underline=1==(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i},b.prototype.parseChars=function(t,e){var r,i=null,a=null,n=null;17<=(n=25<=t?(i=2,t-8):(i=1,t))&&n<=19?(r=17===n?e+80:18===n?e+112:e+144,f.log("INFO","Special char '"+s(r)+"' in channel "+i),a=[r]):32<=t&&t<=127&&(a=0===e?[t]:[t,e]);if(a){var o=l(a);f.log("DEBUG","Char codes = "+o.join(",")),this.lastCmdA=null,this.lastCmdB=null}return a},b.prototype.parseBackgroundAttributes=function(t,e){var r=void 0,i=void 0,a=void 0;return!(!((16===t||24===t)&&32<=e&&e<=47)&&!((23===t||31===t)&&45<=e&&e<=47)||(r={},16===t||24===t?(i=Math.floor((e-32)/2),r.background=h[i],e%2==1&&(r.background=r.background+"_semi")):45===e?r.background="transparent":(r.foreground="black",47===e&&(r.underline=!0)),a=t<24?1:2,this.channels[a-1].setBkgData(r),this.lastCmdA=null,this.lastCmdB=null))},b.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},b.prototype.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].cueSplitAtTime(t)},b);function b(t,e,r){o(this,b),this.field=t||1,this.outputs=[e,r],this.channels=[new y(1,e),new y(2,r)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}}function T(t,e){o(this,T),this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new v,this.nonDisplayedMemory=new v,this.lastOutputScreen=new v,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}function E(){o(this,E),this.rows=[];for(var t=0;t<15;t++)this.rows.push(new g);this.currRow=14,this.nrRollUpRows=null,this.reset()}function S(){o(this,S),this.chars=[];for(var t=0;t<100;t++)this.chars.push(new a);this.pos=0,this.currPenState=new p}function _(t,e,r,i,a,n){o(this,_),this.uchar=t||" ",this.penState=new p(e,r,i,a,n)}function R(t,e,r,i,a){o(this,R),this.foreground=t||"white",this.underline=e||!1,this.italics=r||!1,this.background=i||"black",this.flash=a||!1}e.a=m},function(t,e,r){"use strict";var i=(a.prototype.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen),this.startTime=null)},a.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)},a);function a(t,e){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,a),this.timelineController=t,this.trackName=e,this.startTime=null,this.endTime=null,this.screen=null}e.a=i},function(t,e,r){"use strict";function g(t,e,r){return t.substr(r||0,e.length)===e}function v(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()}var y=r(27),m=r(7),i={parse:function(t,o,i,a,e,r){var n=Object(m.b)(new Uint8Array(t)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),s="00:00.000",l=0,u=0,d=0,c=[],h=void 0,f=!0,p=new y.a;p.oncue=function(t){var e=i[a],r=i.ccOffset;e&&e.new&&(void 0!==u?r=i.ccOffset=e.start:function(t,e,r){var i=t[e],a=t[i.prevCC];if(!a||!a.new&&i.new)return t.ccOffset=t.presentationOffset=i.start,i.new=!1;for(;a&&a.new;)t.ccOffset+=i.start-a.start,i.new=!1,a=t[(i=a).prevCC];t.presentationOffset=r}(i,a,d)),d&&(r=d+i.ccOffset-i.presentationOffset),t.startTime+=r-u,t.endTime+=r-u,t.id=v(t.startTime.toString())+v(t.endTime.toString())+v(t.text),t.text=decodeURIComponent(encodeURIComponent(t.text)),0<t.endTime&&c.push(t)},p.onparsingerror=function(t){h=t},p.onflush=function(){h&&r?r(h):e(c)},n.forEach(function(e){if(f){if(g(e,"X-TIMESTAMP-MAP=")){f=!1,e.substr(16).split(",").forEach(function(t){g(t,"LOCAL:")?s=t.substr(6):g(t,"MPEGTS:")&&(l=parseInt(t.substr(7)))});try{l-=o=o<0?o+8589934592:o,t=s,r=parseInt(t.substr(-3)),i=parseInt(t.substr(-6,2)),a=parseInt(t.substr(-9,2)),n=9<t.length?parseInt(t.substr(0,t.indexOf(":"))):0,u=(isNaN(r)||isNaN(i)||isNaN(a)||isNaN(n)?-1:(r+=1e3*i,r+=6e4*a,r+=36e5*n))/1e3,d=l/9e4,-1===u&&(h=new Error("Malformed X-TIMESTAMP-MAP: "+e))}catch(t){h=new Error("Malformed X-TIMESTAMP-MAP: "+e)}return}""===e&&(f=!1)}var t,r,i,a,n;p.parse(e+"\n")}),p.flush()}};e.a=i},function(t,e,r){"use strict";function s(t){for(var e=[],r=0;r<t.length;r++)"subtitles"===t[r].kind&&e.push(t[r]);return e}var i,n=r(1),a=r(3),o=r(0),l=function(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),t},u=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(d,i=a.a),d.prototype._onTextTracksChanged=function(){if(this.media){for(var t=-1,e=s(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}},d.prototype.destroy=function(){a.a.prototype.destroy.call(this)},d.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))},d.prototype.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),this.media=null)},d.prototype.onManifestLoading=function(){this.tracks=[],this.trackId=-1},d.prototype.onManifestLoaded=function(t){var e=this,r=t.subtitles||[];this.tracks=r,this.trackId=-1,this.hls.trigger(n.a.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:r}),r.forEach(function(t){t.default&&(e.media?e.subtitleTrack=t.id:e.queuedDefaultTrack=t.id)})},d.prototype.onTick=function(){var t=this.trackId,e=this.tracks[t];if(e){var r=e.details;r&&!r.live||(o.b.log("(re)loading playlist for subtitle track "+t),this.hls.trigger(n.a.SUBTITLE_TRACK_LOADING,{url:e.url,id:t}))}},d.prototype.onSubtitleTrackLoaded=function(t){var e=this;t.id<this.tracks.length&&(o.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())},d.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,o.b.log("switching to subtitle track "+t),e.trigger(n.a.SUBTITLE_TRACK_SWITCH,{id:t}),-1!==t)){var i=r[t],a=i.details;a&&!a.live||(o.b.log("(re)loading playlist for subtitle track "+t),e.trigger(n.a.SUBTITLE_TRACK_LOADING,{url:i.url,id:t}))}},d.prototype._stopTimer=function(){this.timer&&(clearInterval(this.timer),this.timer=null)},d.prototype._toggleTrackModes=function(t){var e=this.media,r=this.subtitleDisplay,i=this.trackId;if(e){var a=s(e.textTracks);if(-1===t)[].slice.call(a).forEach(function(t){t.mode="disabled"});else{var n=a[i];n&&(n.mode="disabled")}var o=a[t];o&&(o.mode=r?"showing":"hidden")}},l(d,[{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))}}]),d);function d(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,n.a.MEDIA_ATTACHED,n.a.MEDIA_DETACHING,n.a.MANIFEST_LOADING,n.a.MANIFEST_LOADED,n.a.SUBTITLE_TRACK_LOADED));return e.tracks=[],e.trackId=-1,e.media=null,e.subtitleDisplay=!0,e}function c(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)}}e.a=u},function(t,e,r){"use strict";var i,l=r(1),u=r(0),a=r(13),n=r(8),o=window.performance,s="STOPPED",d="IDLE",c="KEY_LOADING",h="FRAG_LOADING",f=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(p,i=n.a),p.prototype.onHandlerDestroyed=function(){this.state=s},p.prototype.clearVttFragQueues=function(){var e=this;this.vttFragQueues={},this.tracks.forEach(function(t){e.vttFragQueues[t.id]=[]})},p.prototype.nextFrag=function(){if(null===this.currentlyProcessing&&-1<this.currentTrackId&&this.vttFragQueues[this.currentTrackId].length){var t=this.currentlyProcessing=this.vttFragQueues[this.currentTrackId].shift();this.fragCurrent=t,this.hls.trigger(l.a.FRAG_LOADING,{frag:t}),this.state=h}},p.prototype.onSubtitleFragProcessed=function(t){t.success&&this.vttFragSNsProcessed[t.frag.trackId].push(t.frag.sn),this.currentlyProcessing=null,this.state=d,this.nextFrag()},p.prototype.onMediaAttached=function(){this.state=d},p.prototype.onError=function(t){var e=t.frag;e&&"subtitle"!==e.type||this.currentlyProcessing&&(this.currentlyProcessing=null,this.nextFrag())},p.prototype.doTick=function(){var i=this;switch(this.state){case d:var t,e=this.tracks,a=this.currentTrackId,n=this.vttFragSNsProcessed[a],o=this.vttFragQueues[a],s=this.currentlyProcessing?this.currentlyProcessing.sn:-1;if(!e)break;if(a<e.length&&(t=e[a].details),void 0===t)break;t.fragments.forEach(function(t){var e,r;r=t,-1<n.indexOf(r.sn)||t.sn===s||(e=t,o.some(function(t){return t.sn===e.sn}))||(t.encrypted?(u.b.log("Loading key for "+t.sn),i.state=c,i.hls.trigger(l.a.KEY_LOADING,{frag:t})):(t.trackId=a,o.push(t),i.nextFrag()))})}},p.prototype.onSubtitleTracksUpdated=function(t){var e=this;u.b.log("subtitle tracks updated"),this.tracks=t.subtitleTracks,this.clearVttFragQueues(),this.vttFragSNsProcessed={},this.tracks.forEach(function(t){e.vttFragSNsProcessed[t.id]=[]})},p.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()}},p.prototype.onSubtitleTrackLoaded=function(){this.tick()},p.prototype.onKeyLoaded=function(){this.state===c&&(this.state=d,this.tick())},p.prototype.onFragLoaded=function(t){var e=this.fragCurrent,r=t.frag.decryptdata,i=t.frag,a=this.hls;if(this.state===h&&e&&"subtitle"===t.frag.type&&e.sn===t.frag.sn&&0<t.payload.byteLength&&null!=r&&null!=r.key&&"AES-128"===r.method){var n=void 0;try{n=o.now()}catch(t){n=Date.now()}this.decrypter.decrypt(t.payload,r.key.buffer,r.iv.buffer,function(t){var e=void 0;try{e=o.now()}catch(t){e=Date.now()}a.trigger(l.a.FRAG_DECRYPTED,{frag:i,payload:t,stats:{tstart:n,tdecrypt:e}})})}},p);function p(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,l.a.MEDIA_ATTACHED,l.a.ERROR,l.a.KEY_LOADED,l.a.FRAG_LOADED,l.a.SUBTITLE_TRACKS_UPDATED,l.a.SUBTITLE_TRACK_SWITCH,l.a.SUBTITLE_TRACK_LOADED,l.a.SUBTITLE_FRAG_PROCESSED));return e.config=t.config,e.vttFragSNsProcessed={},e.vttFragQueues=void 0,e.currentlyProcessing=null,e.state=s,e.currentTrackId=-1,e.decrypter=new a.a(t.observer,t.config),e}e.a=f},function(t,e,r){"use strict";function n(t,e,r){switch(t){case c:return i={videoCapabilities:[]},r.forEach(function(t){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"'})}),[i];default:throw Error("Unknown key-system: "+t)}var i}var i,a=r(3),o=r(1),s=r(2),l=r(0),u=function(t,e,r){return e&&g(t.prototype,e),r&&g(t,r),t},d=window.XMLHttpRequest,c="com.widevine.alpha",h="com.microsoft.playready",f=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(p,i=a.a),p.prototype.getLicenseServerUrl=function(t){var e=void 0;switch(t){case c:e=this._widevineLicenseUrl;break;default:e=null}return e||(l.b.error('No license server URL configured for key-system "'+t+'"'),this.hls.trigger(o.a.ERROR,{type:s.b.KEY_SYSTEM_ERROR,details:s.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})),e},p.prototype._attemptKeySystemAccess=function(e,t,r){var i=this,a=n(e,0,r);a?(l.b.log("Requesting encrypted media key-system access"),this.requestMediaKeySystemAccess(e,a).then(function(t){i._onMediaKeySystemAccessObtained(e,t)}).catch(function(t){l.b.error('Failed to obtain key-system "'+e+'" access:',t)})):l.b.warn("Can not create config for key-system (maybe because platform is not supported):",e)},p.prototype._onMediaKeySystemAccessObtained=function(e,t){var r=this;l.b.log('Access for key-system "'+e+'" obtained');var i={mediaKeys:null,mediaKeysSession:null,mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(i),t.createMediaKeys().then(function(t){i.mediaKeys=t,l.b.log('Media-keys created for key-system "'+e+'"'),r._onMediaKeysCreated()}).catch(function(t){l.b.error("Failed to create media-keys:",t)})},p.prototype._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach(function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))})},p.prototype._onNewMediaKeySession=function(e){var r=this;l.b.log("New key-system session "+e.sessionId),e.addEventListener("message",function(t){r._onKeySessionMessage(e,t.message)},!1)},p.prototype._onKeySessionMessage=function(e,t){l.b.log("Got EME message event, creating license request"),this._requestLicense(t,function(t){l.b.log("Received license data, updating key-session"),e.update(t)})},p.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()},p.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(o.a.ERROR,{type:s.b.KEY_SYSTEM_ERROR,details:s.a.KEY_SYSTEM_NO_KEYS,fatal:!0});l.b.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},p.prototype._generateRequestWithPreferredKeySession=function(){var e=this,t=this._mediaKeysList[0];if(!t)return l.b.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(o.a.ERROR,{type:s.b.KEY_SYSTEM_ERROR,details:s.a.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(t.mediaKeysSessionInitialized)l.b.warn("Key-Session already initialized but requested again");else{var r=t.mediaKeysSession;r||(l.b.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(o.a.ERROR,{type:s.b.KEY_SYSTEM_ERROR,details:s.a.KEY_SYSTEM_NO_SESSION,fatal:!0}));var i=this._mediaEncryptionInitDataType,a=this._mediaEncryptionInitData;l.b.log('Generating key-session request for "'+i+'" init data type'),t.mediaKeysSessionInitialized=!0,r.generateRequest(i,a).then(function(){l.b.debug("Key-session generation succeeded")}).catch(function(t){l.b.error("Error generating key-session request:",t),e.hls.trigger(o.a.ERROR,{type:s.b.KEY_SYSTEM_ERROR,details:s.a.KEY_SYSTEM_NO_SESSION,fatal:!1})})}},p.prototype._createLicenseXhr=function(t,e,r){var i=new d,a=this._licenseXhrSetup;try{if(a)try{a(i,t)}catch(e){i.open("POST",t,!0),a(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(o.a.ERROR,{type:s.b.KEY_SYSTEM_ERROR,details:s.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}return i.responseType="arraybuffer",i.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,i,t,e,r),i},p.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 a=3-this._requestLicenseFailureCount+1;return l.b.warn("Retrying license request, "+a+" attempts left"),void this._requestLicense(r,i)}this.hls.trigger(o.a.ERROR,{type:s.b.KEY_SYSTEM_ERROR,details:s.a.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}}},p.prototype._generateLicenseRequestChallenge=function(t,e){var r=void 0;return t.mediaKeySystemDomain===h?l.b.error("PlayReady is not supported (yet)"):t.mediaKeySystemDomain===c?r=e:l.b.error("Unsupported key-system:",t.mediaKeySystemDomain),r},p.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(o.a.ERROR,{type:s.b.KEY_SYSTEM_ERROR,details:s.a.KEY_SYSTEM_NO_ACCESS,fatal:!0});var i=this.getLicenseServerUrl(r.mediaKeySystemDomain),a=this._createLicenseXhr(i,t,e);l.b.log("Sending license request to URL: "+i),a.send(this._generateLicenseRequestChallenge(r,t))},p.prototype.onMediaAttached=function(t){var e=this;if(this._emeEnabled){var r=t.media;(this._media=r).addEventListener("encrypted",function(t){e._onMediaEncrypted(t.initDataType,t.initData)})}},p.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(c,e,r)}},u(p,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),p);function p(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p);var e=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,i.call(this,t,o.a.MEDIA_ATTACHED,o.a.MANIFEST_PARSED));return e._widevineLicenseUrl=t.config.widevineLicenseUrl,e._licenseXhrSetup=t.config.licenseXhrSetup,e._emeEnabled=t.config.emeEnabled,e._requestMediaKeySystemAccess=t.config.requestMediaKeySystemAccessFunc,e._mediaKeysList=[],e._media=null,e._hasSetMediaKeys=!1,e._isMediaEncrypted=!1,e._requestLicenseFailureCount=0,e}function g(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)}}e.a=f},function(t,e,r){"use strict";r.d(e,"a",function(){return i});var i="undefined"!=typeof window&&window.navigator&&window.navigator.requestMediaKeySystemAccess?window.navigator.requestMediaKeySystemAccess.bind(window.navigator):null},function(t,e){String.prototype.endsWith||function(){"use strict";function t(t){if(null==this)throw TypeError();var e=String(this);if(t&&"[object RegExp]"==u.call(t))throw TypeError();var r=e.length,i=String(t),a=i.length,n=r;if(1<arguments.length){var o=arguments[1];void 0!==o&&(n=o?Number(o):0)!=n&&(n=0)}var s=Math.min(Math.max(n,0),r)-a;if(s<0)return!1;for(var l=-1;++l<a;)if(e.charCodeAt(s+l)!=i.charCodeAt(l))return!1;return!0}var e=function(){try{var t={},e=Object.defineProperty,r=e(t,t,t)&&e}catch(t){}return r}(),u={}.toString;e?e(String.prototype,"endsWith",{value:t,configurable:!0,writable:!0}):String.prototype.endsWith=t}()},function(t,e){var r=window.localStorage||{getItem:function(){return!1},setItem:function(t,e){return!1},removeItem:function(t){return!1}};t.exports=r}],i.c=a,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=28)).default;function i(t){if(a[t])return a[t].exports;var e=a[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}var r,a});