!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Hls=e()}}(function(){return function s(e,t,r){function i(n,d){if(!t[n]){if(!e[n]){var l="function"==typeof require&&require;if(!d&&l)return l(n,!0);if(a)return a(n,!0);var u=new Error("Cannot find module '"+n+"'");throw u.code="MODULE_NOT_FOUND",u}var o=t[n]={exports:{}};e[n][0].call(o.exports,function(t){var r=e[n][1][t];return i(r?r:t)},o,o.exports,s,e,t,r)}return t[n].exports}for(var a="function"==typeof require&&require,n=0;ne||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},e.prototype.emit=function(l){var s,e,u,n,a,o;if(this._events||(this._events={}),"error"===l&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(s=arguments[1],s instanceof Error)throw s;throw TypeError('Uncaught, unspecified "error" event.')}if(e=this._events[l],i(e))return!1;if(t(e))switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),e.apply(this,n)}else if(r(e))for(n=Array.prototype.slice.call(arguments,1),o=e.slice(),u=o.length,a=0;u>a;a++)o[a].apply(this,n);return!0},e.prototype.addListener=function(n,a){var s;if(!t(a))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",n,t(a.listener)?a.listener:a),this._events[n]?r(this._events[n])?this._events[n].push(a):this._events[n]=[this._events[n],a]:this._events[n]=a,r(this._events[n])&&!this._events[n].warned&&(s=i(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[n].length>s&&(this._events[n].warned=!0,"function"==typeof console.trace)),this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(i,e){function r(){this.removeListener(i,r),n||(n=!0,e.apply(this,arguments))}if(!t(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(i,r),this},e.prototype.removeListener=function(n,i){var e,s,o,a;if(!t(i))throw TypeError("listener must be a function");if(!this._events||!this._events[n])return this;if(e=this._events[n],o=e.length,s=-1,e===i||t(e.listener)&&e.listener===i)delete this._events[n],this._events.removeListener&&this.emit("removeListener",n,i);else if(r(e)){for(a=o;a-- >0;)if(e[a]===i||e[a].listener&&e[a].listener===i){s=a;break}if(0>s)return this;1===e.length?(e.length=0,delete this._events[n]):e.splice(s,1),this._events.removeListener&&this.emit("removeListener",n,i)}return this},e.prototype.removeAllListeners=function(r){var i,e;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[r]&&delete this._events[r],this;if(0===arguments.length){for(i in this._events)"removeListener"!==i&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events={},this}if(e=this._events[r],t(e))this.removeListener(r,e);else if(e)for(;e.length;)this.removeListener(r,e[e.length-1]);return delete this._events[r],this},e.prototype.listeners=function(e){var r;return r=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},e.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(t(e))return 1;if(e)return e.length}return 0},e.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(a,i,s){var n=arguments[3],e=arguments[4],r=arguments[5],t=JSON.stringify;i.exports=function(l){for(var i,s=Object.keys(r),a=0,d=s.length;d>a;a++){var o=s[a],u=r[o].exports;if(u===l||u.default===l){i=o;break}}if(!i){i=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},a=0,d=s.length;d>a;a++){var o=s[a];f[o]=o}e[i]=[Function(["require","module","exports"],"("+l+")(self)"),f]}var h=Math.floor(Math.pow(16,8)*Math.random()).toString(16),c={};c[i]=i,e[h]=[Function(["require"],"var f = require("+t(i)+");(f.default ? f.default : f)(self);"),c];var g="("+n+")({"+Object.keys(e).map(function(r){return t(r)+":["+e[r][0]+","+t(e[r][1])+"]"}).join(",")+"},{},["+t(h)+"])",v=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(v.createObjectURL(new Blob([g],{type:"text/javascript"})))}},{}],3:[function(e,p,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function g(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(i,r){for(var t=0;t500*e.duration){var d=Math.max(1,1e3*e.loaded/u);e.expectedLens){var o=void 0,r=void 0;for(r=e.level-1;r>=0&&(o=e.duration*n.levels[r].bitrate/(6.4*d),i.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay["+r+"] :"+l.toFixed(1)+"/"+s.toFixed(1)+"/"+o.toFixed(1)),!(s>o));r--);l>o&&(r=Math.max(0,r),n.nextLoadLevel=r,i.logger.warn("loading too slow, abort fragment loading and switch to level "+r),e.loader.abort(),this.clearTimer(),n.trigger(t.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e}))}}}}},{key:"onFragLoaded",value:function(e){this.clearTimer(),this.lastLoadedFragLevel=e.frag.level,this._nextAutoLevel=-1}},{key:"onError",value:function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping=e}},{key:"nextAutoLevel",get:function(){var i,e,r,n=this.lastbw,t=this.hls;if(r=-1===this._autoLevelCapping&&t.levels&&t.levels.length?t.levels.length-1:this._autoLevelCapping,-1!==this._nextAutoLevel)return Math.min(this._nextAutoLevel,r);for(e=0;r>=e;e++)if(i=e<=this.lastLoadedFragLevel?.8*n:.7*n,ia.config.appendErrorMaxRetry)return t.logger.log("fail "+a.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),n=[],i.fatal=!0,void a.trigger(e.default.ERROR,i);i.fatal=!1,a.trigger(e.default.ERROR,i)}else n=[],i.details=r.ErrorDetails.BUFFER_FULL_ERROR,a.trigger(e.default.ERROR,i)}}}}},{key:"flushBuffer",value:function(l,s){var e,r,o,a,i,n;if(this.flushBufferCounter.5)return this.flushBufferCounter++,t.logger.log("flush "+u+" ["+i+","+n+"], of ["+o+","+a+"], pos:"+this.media.currentTime),e.remove(i,n),!1}else t.logger.warn("abort flushing too many retries");return t.logger.log("buffer flushed"),!0}}]),i}(s.default);n.default=o},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],5:[function(e,h,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(i,r){for(var t=0;tthis.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(a){var r=void 0,e=void 0,t=void 0,s=this.mediaWidth,o=this.mediaHeight,i=0,n=0;for(e=0;a>=e&&(t=this.levels[e],r=e,i=t.width,n=t.height,!(i>=s||n>=o));e++);return r}},{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}},{key:"mediaWidth",get:function(){var e=void 0;return this.media&&(e=this.media.width||this.media.clientWidth||this.media.offsetWidth,e*=this.contentScaleFactor),e}},{key:"mediaHeight",get:function(){var e=void 0;return this.media&&(e=this.media.height||this.media.clientHeight||this.media.offsetHeight,e*=this.contentScaleFactor),e}}]),e}(s.default);t.default=u},{"../event-handler":21,"../events":22}],6:[function(i,g,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;t=0&&ie&&(this._level===e&&void 0!==t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this._manualLevel},set:function(e){this._manualLevel=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){return void 0===this._startLevel?this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this._manualLevel?this._manualLevel:this.hls.abrController.nextAutoLevel},set:function(e){this.level=e,-1===this._manualLevel&&(this.hls.abrController.nextAutoLevel=e)}}]),i}(f.default);n.default=o},{"../errors":20,"../event-handler":21,"../events":22,"../utils/logger":36}],7:[function(n,A,o){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function g(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(o,"__esModule",{value:!0});var m=function(){function e(i,r){for(var t=0;t1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var _,l,a,E=this,f=this.hls,o=f.config;switch(this.state){case e.ERROR:case e.PAUSED:break;case e.STARTING:var b=f.startLevel;-1===b&&(b=0,this.fragBitrateTest=!0),this.level=f.nextLoadLevel=b,this.state=e.WAITING_LEVEL,this.loadedmetadata=!1;break;case e.IDLE:if(!this.media&&(this.startFragRequested||!o.startFragPrefetch))break;_=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition,l=f.nextLoadLevel;var h,R=s.default.bufferInfo(this.media,_,o.maxBufferHole),T=R.len,u=R.end,c=this.fragPrevious;if(this.levels[l].hasOwnProperty("bitrate")?(h=Math.max(8*o.maxBufferSize/this.levels[l].bitrate,o.maxBufferLength),h=Math.min(h,o.maxMaxBufferLength)):h=o.maxBufferLength,h>T){if(f.nextLoadLevel=l,this.level=l,a=this.levels[l].details,"undefined"==typeof a||a.live&&this.levelLastLoaded!==l){this.state=e.WAITING_LEVEL;break}var d=a.fragments,g=d.length,v=d[0].start,y=d[g-1].start+d[g-1].duration,n=void 0;if(a.live){var S=void 0!==o.liveMaxLatencyDuration?o.liveMaxLatencyDuration:o.liveMaxLatencyDurationCount*a.targetduration;if(uy)break;if(this.startFragRequested&&!a.PTSKnown){if(c){var m=c.sn+1;m>=a.startSN&&m<=a.endSN&&(n=d[m-a.startSN],t.logger.log("live playlist, switching playlist, load frag with next SN: "+n.sn))}n||(n=d[Math.min(g-1,Math.round(g/2))],t.logger.log("live playlist, switching playlist, unknown, load middle frag : "+n.sn))}}else v>u&&(n=d[0]);if(n||!function(){var i=void 0,s=o.maxFragLookUpTolerance;y>u?(u>y-s&&(s=0),i=p.default.search(d,function(e){return e.start+e.duration-s<=u?1:e.start-s>u?-1:0})):i=d[g-1],i&&(n=i,v=i.start,c&&n.level===c.level&&n.sn===c.sn&&(n.sn1&&(n.expectedLen=Math.round(n.duration*this.levels[l].bitrate/8),n.trequest=performance.now()),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,n.loadCounter){n.loadCounter++;var A=o.fragLoadingLoopThreshold;if(n.loadCounter>A&&Math.abs(this.fragLoadIdx-n.loadIdx)=L||O)&&(t.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=e.IDLE);break;case e.STOPPED:case e.FRAG_LOADING:case e.PARSING:case e.PARSED:case e.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"getBufferRange",value:function(i){var e,t,r=this.bufferRange;if(r)for(e=r.length-1;e>=0;e--)if(t=r[e],i>=t.start&&i<=t.end)return t;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(r){var i=this.media;if(i)for(var t=i.buffered,e=0;e=t.start(e)&&r<=t.end(e))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var t,e,i=this.media;if(i&&i.seeking===!1&&(e=i.currentTime,e>i.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),this.isBuffered(e)?t=this.getBufferRange(e):this.isBuffered(e+.1)&&(t=this.getBufferRange(e+.1)),t)){var n=t.frag;n!==this.fragPlaying&&(this.fragPlaying=n, this.hls.trigger(r.default.FRAG_CHANGED,{frag:n}))}}},{key:"immediateLevelSwitch",value:function(){t.logger.log("immediateLevelSwitch"),this.immediateSwitch||(this.immediateSwitch=!0,this.previouslyPaused=this.media.paused,this.media.pause());var i=this.fragCurrent;i&&i.loader&&i.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})}},{key:"immediateLevelSwitchEnd",value:function(){this.immediateSwitch=!1;var e=this.media;e&&e.readyState&&(e.currentTime-=1e-4,this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){var t=this.media;if(t&&t.readyState){var a=void 0,n=void 0,i=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,n=this.getBufferRange(t.currentTime),n&&n.start>1&&(this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:n.start-1})),t.paused)a=0;else{var l=this.hls.nextLoadLevel,u=this.levels[l],o=this.fragLastKbps;a=o&&this.fragCurrent?this.fragCurrent.duration*u.bitrate/(1e3*o)+1:0}if(i=this.getBufferRange(t.currentTime+a),i&&(i=this.followingBufferRange(i))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:i.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(t){var e=this.media=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),this.levels&&this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(t.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var r=this.levels;r&&r.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){if(this.state===e.FRAG_LOADING){if(0===s.default.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len){t.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load");var r=this.fragCurrent;r&&(r.loader&&r.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.state=e.IDLE}}else this.state===e.ENDED&&(this.state=e.IDLE);this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){this.tick()}},{key:"onMediaEnded",value:function(){t.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){t.logger.log("trigger BUFFER_RESET"),this.hls.trigger(r.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1}},{key:"onManifestParsed",value:function(r){var e,i=!1,n=!1;r.levels.forEach(function(t){e=t.audioCodec,e&&(-1!==e.indexOf("mp4a.40.2")&&(i=!0),-1!==e.indexOf("mp4a.40.5")&&(n=!0))}),this.audioCodecSwitch=i&&n,this.audioCodecSwitch&&t.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startLevelLoaded=!1,this.startFragRequested=!1,this.config.autoStartLoad&&this.hls.startLoad()}},{key:"onLevelLoaded",value:function(s){var i=s.details,n=s.level,o=this.levels[n],l=i.totalduration,a=0;if(t.logger.log("level "+n+" loaded ["+i.startSN+","+i.endSN+"],duration:"+l),this.levelLastLoaded=n,i.live){var d=o.details;d?(u.default.mergeDetails(d,i),a=i.fragments[0].start,i.PTSKnown?t.logger.log("live playlist sliding:"+a.toFixed(3)):t.logger.log("live playlist - outdated PTS, unknown sliding")):(i.PTSKnown=!1,t.logger.log("live playlist - first load, unknown sliding"))}else i.PTSKnown=!1;if(o.details=i,this.hls.trigger(r.default.LEVEL_UPDATED,{details:i,level:n}),this.startFragRequested===!1){if(i.live){var f=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*i.targetduration;this.startPosition=Math.max(0,a+l-f)}this.nextLoadPosition=this.startPosition}this.state===e.WAITING_LEVEL&&(this.state=e.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===e.KEY_LOADING&&(this.state=e.IDLE,this.tick())}},{key:"onFragLoaded",value:function(n){var i=this.fragCurrent;if(this.state===e.FRAG_LOADING&&i&&n.frag.level===i.level&&n.frag.sn===i.sn)if(t.logger.log("Loaded "+i.sn+" of level "+i.level),this.fragBitrateTest===!0)this.state=e.IDLE,this.fragBitrateTest=!1,this.startFragRequested=!1,n.stats.tparsed=n.stats.tbuffered=performance.now(),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:n.stats,frag:i});else{this.state=e.PARSING,this.stats=n.stats;var s=this.levels[this.level],o=s.details,f=o.totalduration,h=i.start,l=i.level,u=i.sn,a=s.audioCodec||this.config.defaultAudioCodec;this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),void 0===a&&(a=this.lastAudioCodec),a&&(a=-1!==a.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,t.logger.log("Demuxing "+u+" of ["+o.startSN+" ,"+o.endSN+"],level "+l);var d=this.demuxer;d&&d.push(n.payload,a,s.videoCodec,h,i.cc,l,u,f,i.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(l){if(this.state===e.PARSING){var o,i,n=l.tracks;if(i=n.audio){var a=this.levels[this.level].audioCodec,u=navigator.userAgent.toLowerCase();a&&this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),a=-1!==a.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&-1===u.indexOf("firefox")&&(a="mp4a.40.5"),-1!==u.indexOf("android")&&(a="mp4a.40.2",t.logger.log("Android: force audio codec to"+a)),i.levelCodec=a}if(i=n.video,i&&(i.levelCodec=this.levels[this.level].videoCodec),l.unique){var s={codec:"",levelCodec:""};for(o in l.tracks)i=n[o],s.container=i.container,s.codec&&(s.codec+=",",s.levelCodec+=","),i.codec&&(s.codec+=i.codec),i.levelCodec&&(s.levelCodec+=i.levelCodec);n={audiovideo:s}}this.hls.trigger(r.default.BUFFER_CODECS,n);for(o in n){i=n[o],t.logger.log("track:"+o+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var d=i.initSegment;d&&(this.pendingAppending++,this.hls.trigger(r.default.BUFFER_APPENDING,{type:o,data:d}))}this.tick()}}},{key:"onFragParsingData",value:function(i){var o=this;if(this.state===e.PARSING){this.tparse2=Date.now();var n=this.levels[this.level],a=this.fragCurrent;t.logger.log("parsed "+i.type+",PTS:["+i.startPTS.toFixed(3)+","+i.endPTS.toFixed(3)+"],DTS:["+i.startDTS.toFixed(3)+"/"+i.endDTS.toFixed(3)+"],nb:"+i.nb);var l=u.default.updateFragPTS(n.details,a.sn,i.startPTS,i.endPTS),s=this.hls;s.trigger(r.default.LEVEL_PTS_UPDATED,{details:n.details,level:this.level,drift:l}),[i.data1,i.data2].forEach(function(e){e&&(o.pendingAppending++,s.trigger(r.default.BUFFER_APPENDING,{type:i.type,data:e}))}),this.nextLoadPosition=i.endPTS,this.bufferRange.push({type:i.type,start:i.startPTS,end:i.endPTS,frag:a}),this.tick()}else t.logger.warn("not in PARSING state but "+this.state+", ignoring FRAG_PARSING_DATA event")}},{key:"onFragParsed",value:function(){this.state===e.PARSING&&(this.stats.tparsed=performance.now(),this.state=e.PARSED,this._checkAppendedParsed())}},{key:"onBufferAppended",value:function(){switch(this.state){case e.PARSING:case e.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===e.PARSED&&0===this.pendingAppending){var n=this.fragCurrent,i=this.stats;n&&(this.fragPrevious=n,i.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*i.length/(i.tbuffered-i.tfirst)),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:i,frag:n}),t.logger.log("media buffered : "+this.timeRangesToString(this.media.buffered)),this.state=e.IDLE),this.tick()}}},{key:"onError",value:function(n){switch(n.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!n.fatal){var a=this.fragLoadError;if(a?a++:a=1,a<=this.config.fragLoadingMaxRetry){this.fragLoadError=a,n.frag.loadCounter=0;var s=Math.min(Math.pow(2,a-1)*this.config.fragLoadingRetryDelay,64e3);t.logger.warn("mediaController: frag loading failed, retry in "+s+" ms"),this.retryDate=performance.now()+s,this.state=e.FRAG_LOADING_WAITING_RETRY}else t.logger.error("mediaController: "+n.details+" reaches max retry, redispatch as fatal ..."),n.fatal=!0,this.hls.trigger(r.default.ERROR,n),this.state=e.ERROR}break;case i.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case i.ErrorDetails.LEVEL_LOAD_ERROR:case i.ErrorDetails.LEVEL_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==e.ERROR&&(this.state=n.fatal?e.ERROR:e.IDLE,t.logger.warn("mediaController: "+n.details+" while loading frag,switch to "+this.state+" state ..."));break;case i.ErrorDetails.BUFFER_FULL_ERROR:this.config.maxMaxBufferLength/=2,t.logger.warn("reduce max buffer length to "+this.config.maxMaxBufferLength+"s and trigger a nextLevelSwitch to flush old buffer and fix QuotaExceededError"),this.nextLevelSwitch()}}},{key:"_checkBuffer",value:function(){var e=this.media;if(e){var h=e.readyState;if(h){var n,a,d=this.seekAfterBuffered;if(d)e.duration>=d&&(n=d,this.seekAfterBuffered=void 0);else{a=e.currentTime;var p=this.loadedmetadata;!p&&e.buffered.length&&(this.loadedmetadata=!0,a||a===this.startPosition||(n=this.startPosition))}n&&(a=n,t.logger.log("target seek position:"+n));var l=s.default.bufferInfo(e,a,0),m=!(e.paused||e.ended||e.seeking||2>h),f=.4,c=a>e.playbackRate*this.lastCurrentTime;if(this.stalled&&c&&(this.stalled=!1,t.logger.log("playback not stuck anymore @"+a)),m&&l.len<=f){if(c?(f=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=this.config.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,t.logger.log("playback seems stuck @"+a),this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),l.len<=f){var o=l.nextStart,g=o-a;if(o&&g0&&!e.seeking){t.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+o+" + nudge "+this.seekHoleNudgeDuration);var y=o+this.seekHoleNudgeDuration-e.currentTime;e.currentTime=o+this.seekHoleNudgeDuration,this.hls.trigger(r.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:y})}}}else{var v=e.currentTime;if(n&&v!==n){if(0===l.len){var u=l.nextStart;void 0!==u&&u-ne;e++)r+="["+t.start(e)+","+t.end(e)+"]";return r}},{key:"currentLevel",get:function(){if(this.media){var e=this.getBufferRange(this.media.currentTime);if(e)return e.frag.level}return-1}},{key:"nextBufferRange",get:function(){return this.media?this.followingBufferRange(this.getBufferRange(this.media.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferRange;return e?e.frag.level:-1}}]),n}(l.default);o.default=f},{"../demux/demuxer":16,"../errors":20,"../event-handler":21,"../events":22,"../helper/buffer-helper":23,"../helper/level-helper":24,"../utils/binary-search":34,"../utils/logger":36}],8:[function(t,g,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var c=function(){function e(i,r){for(var t=0;te;e++)c[(n[e]=e<<1^283*(e>>7))^e]=e;for(i=r=0;!h[i];i^=u||1,r=c[r]||1)for(t=r^r<<1^r<<2^r<<3^r<<4,t=t>>8^255&t^99,h[i]=t,g[t]=i,d=n[f=n[u=n[i]]],l=16843009*d^65537*f^257*u^16843008*i,s=257*n[t]^16843008*t,e=0;4>e;e++)a[e][i]=s=s<<24^s>>>8,o[e][t]=l=l<<24^l>>>8;for(e=0;5>e;e++)a[e]=a[e].slice(0),o[e]=o[e].slice(0)}},{key:"decrypt",value:function(R,p,_,b,E,m){var h,v,g,a,e=this._key[1],t=R^e[0],i=b^e[1],n=_^e[2],r=p^e[3],y=e.length/4-2,s=4,o=this._tables[1],f=o[0],d=o[1],u=o[2],l=o[3],c=o[4];for(a=0;y>a;a++)h=f[t>>>24]^d[i>>16&255]^u[n>>8&255]^l[255&r]^e[s],v=f[i>>>24]^d[n>>16&255]^u[r>>8&255]^l[255&t]^e[s+1],g=f[n>>>24]^d[r>>16&255]^u[t>>8&255]^l[255&i]^e[s+2],r=f[r>>>24]^d[t>>16&255]^u[i>>8&255]^l[255&n]^e[s+3],s+=4,t=h,i=v,n=g;for(a=0;4>a;a++)E[(3&-a)+m]=c[t>>>24]<<24^c[i>>16&255]<<16^c[n>>8&255]<<8^c[255&r]^e[s++],h=t,t=i,i=n,n=r,r=h}}]),e}();e.default=i},{}],10:[function(t,l,e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t>8|e>>>24}},{key:"doDecrypt",value:function(i,v,n){var u,h,o,f,l,c,d,a,e,r=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>2),p=new s.default(Array.prototype.slice.call(v)),g=new Uint8Array(i.byteLength),t=new Int32Array(g.buffer);for(u=~~n[0],h=~~n[1],o=~~n[2],f=~~n[3],e=0;ee&&(255!==t[e]||240!==(240&t[e+1]));e++);for(r.audiosamplerate||(n=o.default.getAudioConfig(this.observer,t,e,p),r.config=n.config,r.audiosamplerate=n.samplerate,r.channelCount=n.channelCount,r.codec=n.codec,r.duration=y,l.logger.log("parsed codec:"+r.codec+",rate:"+n.samplerate+",nb channel:"+n.channelCount)),c=0,v=9216e4/r.audiosamplerate;u>e+5&&(s=1&t[e+1]?7:9,a=(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5,a-=s,a>0&&u>=e+s+a);)for(f=h+c*v,g={unit:t.subarray(e+s,e+s+a),pts:f,dts:f},r.samples.push(g),r.len+=a,e+=a+s,c++;u-1>e&&(255!==t[e]||240!==(240&t[e+1]));e++);this.remuxer.remux(this._aacTrack,{samples:[]},{samples:[{pts:h,dts:h,unit:d.payload}]},{samples:[]},m)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){var e,r,n=new i.default(t);if(n.hasTimeStamp)for(e=n.length,r=t.length;r-1>e;e++)if(255===t[e]&&240===(240&t[e+1]))return!0;return!1}}]),e}();t.default=s},{"../demux/id3":18,"../utils/logger":36,"./adts":13}],13:[function(e,o,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t>>6)+1,e=(60&u[l+2])>>>2,e>d.length-1?void h.trigger(Event.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+e}):(o=(1&u[l+2])<<2,o|=(192&u[l+3])>>>6,a.logger.log("manifest codec:"+n+",ADTS data:type:"+i+",sampleingIndex:"+e+"["+d[e]+"Hz],channelConfig:"+o),-1!==f.indexOf("firefox")?e>=6?(i=5,t=new Array(4),s=e-3):(i=2,t=new Array(2),s=e):-1!==f.indexOf("android")?(i=2,t=new Array(2),s=e):(i=5,t=new Array(4),n&&(-1!==n.indexOf("mp4a.40.29")||-1!==n.indexOf("mp4a.40.5"))||!n&&e>=6?s=e-3:((n&&-1!==n.indexOf("mp4a.40.2")&&e>=6&&1===o||!n&&1===o)&&(i=2,t=new Array(2)),s=e)),t[0]=i<<3,t[0]|=(14&e)>>1,t[1]|=(1&e)<<7,t[1]|=o<<3,5===i&&(t[1]|=(14&s)>>1,t[2]=(1&s)<<7,t[2]|=8,t[3]=0),{config:t,samplerate:d[e],channelCount:o,codec:"mp4a.40."+i})}}]),e}();t.default=s},{"../errors":20,"../utils/logger":36}],14:[function(e,y,i){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t1?r-1:0),e=1;r>e;e++)n[e-1]=arguments[e];t.emit.apply(t,[i,i].concat(n))},t.off=function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),e=1;r>e;e++)i[e-1]=arguments[e];t.removeListener.apply(t,[n].concat(i))},r.addEventListener("message",function(i){var e=i.data;switch(e.cmd){case"init":r.demuxer=new u.default(t,e.typeSupported);break;case"demux":r.demuxer.push(new Uint8Array(e.data),e.audioCodec,e.videoCodec,e.timeOffset,e.cc,e.level,e.sn,e.duration)}}),t.on(e.default.FRAG_PARSING_INIT_SEGMENT,function(t,e){r.postMessage({event:t,tracks:e.tracks,unique:e.unique})}),t.on(e.default.FRAG_PARSING_DATA,function(i,e){var t={event:i,type:e.type,startPTS:e.startPTS,endPTS:e.endPTS,startDTS:e.startDTS,endDTS:e.endDTS,data1:e.data1.buffer,data2:e.data2.buffer,nb:e.nb};r.postMessage(t,[t.data1,t.data2])}),t.on(e.default.FRAG_PARSED,function(e){r.postMessage({event:e})}),t.on(e.default.ERROR,function(e,t){r.postMessage({event:e,data:t})}),t.on(e.default.FRAG_PARSING_METADATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)}),t.on(e.default.FRAG_PARSING_USERDATA,function(e,t){var i={event:e,samples:t.samples};r.postMessage(i)})};i.default=o},{"../demux/demuxer-inline":14,"../events":22,events:1}],16:[function(t,v,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t0&&null!=e&&null!=e.key&&"AES-128"===e.method){null==this.decrypter&&(this.decrypter=new l.default(this.hls));var d=this;this.decrypter.decrypt(t,e.key,e.iv,function(e){d.pushDecrypted(e,r,i,n,a,s,o,u)})}else this.pushDecrypted(t,r,i,n,a,s,o,u)}},{key:"onWorkerMessage",value:function(i){var t=i.data;switch(t.event){case e.default.FRAG_PARSING_INIT_SEGMENT:var r={};r.tracks=t.tracks,r.unique=t.unique,this.hls.trigger(e.default.FRAG_PARSING_INIT_SEGMENT,r);break;case e.default.FRAG_PARSING_DATA:this.hls.trigger(e.default.FRAG_PARSING_DATA,{data1:new Uint8Array(t.data1),data2:new Uint8Array(t.data2),startPTS:t.startPTS,endPTS:t.endPTS,startDTS:t.startDTS,endDTS:t.endDTS,type:t.type,nb:t.nb});break;case e.default.FRAG_PARSING_METADATA:this.hls.trigger(e.default.FRAG_PARSING_METADATA,{samples:t.samples});break;case e.default.FRAG_PARSING_USERDATA:this.hls.trigger(e.default.FRAG_PARSING_USERDATA,{samples:t.samples});break;default:this.hls.trigger(t.event,t.data)}}}]),r}();i.default=o},{"../crypt/decrypter":11,"../demux/demuxer-inline":14,"../demux/demuxer-worker":15,"../events":22,"../utils/logger":36,webworkify:2}],17:[function(t,s,e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function e(i,r){for(var t=0;te?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),e=t-e,e>0?r<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(n){var t,i,r=8,e=8;for(t=0;n>t;t++)0!==e&&(i=this.readEG(),e=(r+i+256)%256),r=0===e?r:e}},{key:"readSPS",value:function(){var t,v,p,l,n,a,i,o,r,s=0,d=0,f=0,h=0,c=1;if(this.readUByte(),t=this.readUByte(),v=this.readBits(5),this.skipBits(3),p=this.readUByte(),this.skipUEG(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){ var g=this.readUEG();if(3===g&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(o=3!==g?8:12,r=0;o>r;r++)this.readBoolean()&&(6>r?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var u=this.readUEG();if(0===u)this.readUEG();else if(1===u)for(this.skipBits(1),this.skipEG(),this.skipEG(),l=this.readUEG(),r=0;l>r;r++)this.skipEG();if(this.skipUEG(),this.skipBits(1),n=this.readUEG(),a=this.readUEG(),i=this.readBits(1),0===i&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(s=this.readUEG(),d=this.readUEG(),f=this.readUEG(),h=this.readUEG()),this.readBoolean()&&this.readBoolean()){var e=void 0,y=this.readUByte();switch(y){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=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}e&&(c=e[0]/e[1])}return{width:Math.ceil((16*(n+1)-2*s-2*d)*c),height:(2-i)*(a+1)*16-(i?2:4)*(f+h)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();e.default=a},{"../utils/logger":36}],18:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;tr);return t}},{key:"_parseID3Frames",value:function(r,t,a){for(var n,s,o,l,i;a>=t+8;)switch(n=this.readUTF(r,t,4),t+=4,s=r[t++]<<24+r[t++]<<16+r[t++]<<8+r[t++],l=r[t++]<<8+r[t++],o=t,n){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(r,t,44)){t+=44,t+=4;var u=1&r[t++];this._hasTimeStamp=!0,i=((r[t++]<<23)+(r[t++]<<15)+(r[t++]<<7)+r[t++])/45,u&&(i+=47721858.84),i=Math.round(i),e.logger.trace("ID3 timestamp found: "+i),this._timeStamp=i}}}},{key:"hasTimeStamp",get:function(){return this._hasTimeStamp}},{key:"timeStamp",get:function(){return this._timeStamp}},{key:"length",get:function(){return this._length}},{key:"payload",get:function(){return this._payload}}]),t}();t.default=a},{"../utils/logger":36}],19:[function(t,g,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var f=function(){function e(i,r){for(var t=0;tt;t+=188)if(71===i[t]){if(d=!!(64&i[t+1]),u=((31&i[t+1])<<8)+i[t+2],y=(48&i[t+3])>>4,y>1){if(n=t+5+i[t+4],n===t+188)continue}else n=t+4;if(v)if(u===h){if(d){if(s&&(this._parseAVCPES(this._parsePES(s)),b&&this._avcTrack.codec&&(-1===f||this._aacTrack.codec)))return void this.remux(i);s={data:[],size:0}}s&&(s.data.push(i.subarray(n,t+188)),s.size+=t+188-n)}else if(u===f){if(d){if(o&&(this._parseAACPES(this._parsePES(o)),b&&this._aacTrack.codec&&(-1===h||this._avcTrack.codec)))return void this.remux(i);o={data:[],size:0}}o&&(o.data.push(i.subarray(n,t+188)),o.size+=t+188-n)}else u===_&&(d&&(l&&this._parseID3PES(this._parsePES(l)),l={data:[],size:0}),l&&(l.data.push(i.subarray(n,t+188)),l.size+=t+188-n));else d&&(n+=i[n]+1),0===u?this._parsePAT(i,n):u===this._pmtId?(this._parsePMT(i,n),v=this.pmtParsed=!0,h=this._avcTrack.id,f=this._aacTrack.id,_=this._id3Track.id,g&&(e.logger.log("reparse from beginning"),g=!1,t=-188)):(e.logger.log("unknown PID found before PAT/PMT"),g=!0)}else this.observer.trigger(a.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s&&this._parseAVCPES(this._parsePES(s)),o&&this._parseAACPES(this._parsePES(o)),l&&this._parseID3PES(this._parsePES(l)),this.remux(null)}},{key:"remux",value:function(e){this.remuxer.remux(this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,this.timeOffset,this.contiguous,e)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){this._pmtId=(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(r,t){var n,a,s,i;for(n=(15&r[t+1])<<8|r[t+2],a=t+3+n-4,s=(15&r[t+10])<<8|r[t+11],t+=12+s;a>t;){switch(i=(31&r[t+1])<<8|r[t+2],r[t]){case 15:this._aacTrack.id=i;break;case 21:this._id3Track.id=i;break;case 27:this._avcTrack.id=i;break;default:e.logger.log("unkown stream type:"+r[t])}t+=((15&r[t+3])<<8|r[t+4])+5}}},{key:"_parsePES",value:function(o){var e,a,h,d,u,l,i,r,t,f=0,s=o.data;if(e=s[0],h=(e[0]<<16)+(e[1]<<8)+e[2],1===h){for(d=(e[4]<<8)+e[5],a=e[7],192&a&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,i>4294967295&&(i-=8589934592),64&a?(r=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r>4294967295&&(r-=8589934592)):r=i),u=e[8],t=u+9,o.size-=t,l=new Uint8Array(o.size);s.length;){e=s.shift();var n=e.byteLength;if(t){if(t>n){t-=n;continue}e=e.subarray(t),n-=t,t=0}l.set(e,f),f+=n}return{data:l,pts:i,dts:r,len:d}}return null}},{key:"_parseAVCPES",value:function(i){var t,p,a,l,y=this,r=this._avcTrack,u=r.samples,m=this._parseAVCNALu(i.data),d=[],o=!1,h=!1,c=0;if(0===m.length&&u.length>0){var g=u[u.length-1],f=g.units.units[g.units.units.length-1],v=new Uint8Array(f.data.byteLength+i.data.byteLength);v.set(f.data,0),v.set(i.data,f.data.byteLength),f.data=v,g.units.length+=i.data.byteLength,r.len+=i.data.byteLength}i.data=null;var n="";m.forEach(function(e){switch(e.type){case 1:a=!0,o&&(n+="NDR ");break;case 5:a=!0,o&&(n+="IDR "),h=!0;break;case 6:a=!0,o&&(n+="SEI "),t=new s.default(e.data),t.readUByte();var E=t.readUByte();if(4===E){var v=0;do v=t.readUByte();while(255===v);var R=t.readUByte();if(181===R){var _=t.readUShort();if(49===_){var A=t.readUInt();if(1195456820===A){var k=t.readUByte();if(3===k){var g=t.readUByte(),b=t.readUByte(),T=31&g,f=[g,b];for(l=0;T>l;l++)f.push(t.readUByte()),f.push(t.readUByte()),f.push(t.readUByte());y._txtTrack.samples.push({type:3,pts:i.pts,bytes:f})}}}}}break;case 7:if(a=!0,o&&(n+="SPS "),!r.sps){t=new s.default(e.data);var p=t.readSPS();r.width=p.width,r.height=p.height,r.sps=[e.data],r.duration=y._duration;var L=e.data.subarray(1,4),m="avc1.";for(l=0;3>l;l++){var u=L[l].toString(16);u.length<2&&(u="0"+u),m+=u}r.codec=m}break;case 8:a=!0,o&&(n+="PPS "),r.pps||(r.pps=[e.data]);break;case 9:a=!1,o&&(n+="AUD ");break;default:a=!1,n+="unknown NAL "+e.type+" "}a&&(d.push(e),c+=e.data.byteLength)}),(o||n.length)&&e.logger.log(n),d.length&&(h===!0||r.sps&&(u.length||this.contiguous))&&(p={units:{units:d,length:c},pts:i.pts,dts:i.dts,key:h},u.push(p),r.len+=c,r.nbNalu+=d.length)}},{key:"_parseAVCNALu",value:function(r){for(var a,i,s,p,n,l,t=0,h=r.byteLength,e=0,d=[];h>t;)switch(a=r[t++],e){case 0:0===a&&(e=1);break;case 1:e=0===a?2:0;break;case 2:case 3:if(0===a)e=3;else if(1===a&&h>t){if(p=31&r[t],n)s={data:r.subarray(n,t-e-1),type:l},d.push(s);else if(i=t-e-1){var c=this._avcTrack,f=c.samples;if(f.length){var g=f[f.length-1],v=g.units.units,o=v[v.length-1],u=new Uint8Array(o.data.byteLength+i);u.set(o.data,0),u.set(r.subarray(0,i),o.data.byteLength),o.data=u,g.units.length+=i,c.len+=i}}n=t,l=p,e=0}else e=0}return n&&(s={data:r.subarray(n,h),type:l},d.push(s)),d}},{key:"_parseAACPES",value:function(R){var l,o,p,E,t,d,f,s,_,n=this._aacTrack,i=R.data,g=R.pts,k=0,L=this._duration,A=this.audioCodec,u=this.aacOverFlow,b=this.lastAacPTS;if(u){var m=new Uint8Array(u.byteLength+i.byteLength);m.set(u,0),m.set(i,u.byteLength),i=m}for(t=k,s=i.length;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);if(t){var y,h;if(s-1>t?(y="AAC PES did not start with ADTS header,offset:"+t,h=!1):(y="no ADTS header found in AAC PES",h=!0),this.observer.trigger(a.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:h,reason:y}),h)return}if(n.audiosamplerate||(l=c.default.getAudioConfig(this.observer,i,t,A),n.config=l.config,n.audiosamplerate=l.samplerate,n.channelCount=l.channelCount,n.codec=l.codec,n.duration=L,e.logger.log("parsed codec:"+n.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)),E=0,p=9216e4/n.audiosamplerate,u&&b){var v=b+p;Math.abs(v-g)>1&&(e.logger.log("AAC: align PTS for overlapping frames by "+Math.round((v-g)/90)),g=v)}for(;s>t+5&&(d=1&i[t+1]?7:9,o=(3&i[t+3])<<11|i[t+4]<<3|(224&i[t+5])>>>5,o-=d,o>0&&s>=t+d+o);)for(f=g+E*p,_={unit:i.subarray(t+d,t+d+o),pts:f,dts:f},n.samples.push(_),n.len+=o,t+=o+d,E++;s-1>t&&(255!==i[t]||240!==(240&i[t+1]));t++);u=s>t?i.subarray(t,s):null,this.aacOverFlow=u,this.lastAacPTS=f}},{key:"_parseID3PES",value:function(e){this._id3Track.samples.push(e)}}],[{key:"probe",value:function(e){return e.length>=564&&71===e[0]&&71===e[188]&&71===e[376]}}]),t}();n.default=o},{"../errors":20,"../events":22,"../utils/logger":36,"./adts":13,"./exp-golomb":17}],20:[function(t,r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},e.ErrorDetails={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",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],21:[function(e,f,t){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},d=function(){function e(i,r){for(var t=0;t1?r-1:0),t=1;r>t;t++)i[t-1]=arguments[t];this.handledEvents=i,this.useGenericHandler=!0,this.registerListeners()}return d(e,[{key:"destroy",value:function(){this.unregisterListeners()}},{key:"isEventHandler",value:function(){return"object"===a(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent}},{key:"registerListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){if("hlsEventGeneric"===e)throw new Error("Forbidden event name: "+e);this.hls.on(e,this.onEvent)}.bind(this))}},{key:"unregisterListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){this.hls.off(e,this.onEvent)}.bind(this))}},{key:"onEvent",value:function(e,t){this.onEventGeneric(e,t)}},{key:"onEventGeneric",value:function(e,t){var i=function(t,r){var e="on"+t.replace("hls","");if("function"!=typeof this[e])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+e+")");return this[e].bind(this,r)};try{i.call(this,e,t).call()}catch(t){o.logger.error("internal error happened while processing "+e+":"+t.message),this.hls.trigger(s.default.ERROR,{type:r.ErrorTypes.OTHER_ERROR,details:r.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}}}]),e}();t.default=l},{"./errors":20,"./events":22,"./utils/logger":36}],22:[function(t,e,r){"use strict";e.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",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_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVEL_SWITCH:"hlsLevelSwitch",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",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",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded"}},{}],23:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;td&&(t[u-1].end=r[e].end):t.push(r[e])}else t.push(r[e])}for(e=0,o=0,l=n=i;e=a&&f>i)l=a,n=f,o=n-i;else if(a>i+s){h=a;break}}return{len:o,start:l,end:n,nextStart:h}}}]),e}();e.default=i},{}],24:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;th)return void(i.PTSKnown=!1);for(var r=c;h>=r;r++){var o=f[u+r],n=l[r];d=o.cc-n.cc,isNaN(o.startPTS)||(n.start=n.startPTS=o.startPTS,n.endPTS=o.endPTS,n.duration=o.duration,s=n)}if(d)for(e.logger.log("discontinuity sliding from playlist, take drift into account"),r=0;r=0&&ui.endSN)return 0;o=l-i.startSN,a=i.fragments,r=a[o],isNaN(r.startPTS)||(n=Math.min(n,r.startPTS),s=Math.max(s,r.endPTS));var u=n-r.start;for(r.start=r.startPTS=n,r.endPTS=s,r.duration=s-n,e=o;e>0;e--)t.updatePTS(a,e,e-1);for(e=o;ei?r.start=t.start+t.duration:r.start=t.start-r.duration:n>i?(t.duration=a-t.start,t.duration<0&&e.logger.error("negative duration computed for frag "+t.sn+",level "+t.level+", there should be some duration drift between playlist and fragment!")):(r.duration=t.start-a,r.duration<0&&e.logger.error("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!"))}}]),t}();t.default=a},{"../utils/logger":36}],25:[function(t,I,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;t1?t-1:0),e=1;t>e;e++)n[e-1]=arguments[e];i.emit.apply(i,[r,r].concat(n))},i.off=function(n){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];i.removeListener.apply(i,[n].concat(r))},this.on=i.on.bind(i),this.off=i.off.bind(i),this.trigger=i.trigger.bind(i),this.playlistLoader=new d.default(this),this.fragmentLoader=new h.default(this),this.levelController=new R.default(this),this.abrController=new r.abrController(this),this.bufferController=new r.bufferController(this),this.capLevelController=new r.capLevelController(this),this.streamController=new r.streamController(this),this.timelineController=new r.timelineController(this),this.keyLoader=new p.default(this)}return a(t,null,[{key:"isSupported",value:function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"Events",get:function(){return i.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig||(t.defaultConfig={autoStartLoad:!0,debug:!1,capLevelToPlayerSize:!1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,stalledInBufferedNudgeThreshold:10,maxFragLookUpTolerance:.2,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,abrController:g.default,bufferController:P.default,capLevelController:m.default,streamController:b.default,timelineController:L.default,enableCEA708Captions:!0,enableMP2TPassThrough:!1}),t.defaultConfig},set:function(e){t.defaultConfig=e}}]),a(t,[{key:"destroy",value:function(){e.logger.log("destroy"),this.trigger(i.default.DESTROYING),this.detachMedia(),this.playlistLoader.destroy(),this.fragmentLoader.destroy(),this.levelController.destroy(),this.abrController.destroy(),this.bufferController.destroy(),this.capLevelController.destroy(),this.streamController.destroy(),this.timelineController.destroy(),this.keyLoader.destroy(),this.url=null,this.observer.removeAllListeners()}},{key:"attachMedia",value:function(t){e.logger.log("attachMedia"),this.media=t,this.trigger(i.default.MEDIA_ATTACHING,{media:t})}},{key:"detachMedia",value:function(){e.logger.log("detachMedia"),this.trigger(i.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(t){e.logger.log("loadSource:"+t),this.url=t,this.trigger(i.default.MANIFEST_LOADING,{url:t})}},{key:"startLoad",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0];e.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(t)}},{key:"stopLoad",value:function(){e.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad()}},{key:"swapAudioCodec",value:function(){e.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){e.logger.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){e.logger.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){e.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){e.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return this.levelController.firstLevel},set:function(t){e.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){e.logger.log("set startLevel:"+t),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(t){e.logger.log("set autoLevelCapping:"+t),this.abrController.autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}}]),t}();n.default=l},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":6,"./controller/stream-controller":7,"./controller/timeline-controller":8,"./errors":20,"./events":22,"./loader/fragment-loader":27,"./loader/key-loader":28,"./loader/playlist-loader":29,"./utils/logger":36,"./utils/xhr-loader":38,events:1}],26:[function(e,t,r){"use strict";t.exports=e("./hls.js").default},{"./hls.js":25}],27:[function(r,c,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var h=function(){function e(i,r){for(var t=0;t2?(e=t.shift()+".",e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).substr(-4)):e=r,e}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"parseLevelPlaylist",value:function(L,l,A){var e,b,s,a,v=0,o=0,i={url:l,fragments:[],live:!0,startSN:0},r={method:null,key:null,iv:null,uri:null},E=0,f=null,t=null;for(b=/(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\d\.]+)[^\r\n]*([\r\n]+[^#|\r\n]+)?)|(?:#EXT-X-(BYTERANGE):([\d]+[@[\d]*)]*[\r\n]+([^#|\r\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.*))/g;null!==(e=b.exec(L));)switch(e.shift(),e=e.filter(function(e){return void 0!==e}),e[0]){case"MEDIA-SEQUENCE":v=i.startSN=parseInt(e[1]);break;case"TARGETDURATION":i.targetduration=parseFloat(e[1]);break;case"ENDLIST":i.live=!1;break;case"DIS":E++;break;case"BYTERANGE":var c=e[1].split("@");a=1===c.length?s:parseInt(c[1]),s=parseInt(c[0])+a,t&&!t.url&&(t.byteRangeStartOffset=a,t.byteRangeEndOffset=s,t.url=this.resolve(e[2],l));break;case"INF":var g=parseFloat(e[1]);if(!isNaN(g)){var u,m=v++;if(r.method&&r.uri&&!r.iv){u=this.cloneObj(r);for(var y=new Uint8Array(16),d=12;16>d;d++)y[d]=m>>8*(15-d)&255;u.iv=y}else u=r;var k=e[2]?this.resolve(e[2],l):null;t={url:k,duration:g,start:o,sn:m,level:A,cc:E,byteRangeStartOffset:a,byteRangeEndOffset:s,decryptdata:u,programDateTime:f},i.fragments.push(t),o+=g,a=null,f=null}break;case"KEY":var R=e[1],p=new n.default(R),h=p.enumeratedString("METHOD"),_=p.URI,T=p.hexadecimalInteger("IV");h&&(r={method:null,key:null,iv:null,uri:null},_&&"AES-128"===h&&(r.method=h,r.uri=this.resolve(_,l),r.key=null,r.iv=T));break;case"PROGRAM-DATE-TIME":f=new Date(Date.parse(e[1]))}return t&&!t.url&&(i.fragments.pop(),o-=t.duration),i.totalduration=o,i.endSN=v-1,i}},{key:"loadsuccess",value:function(u,i){var s,o=u.currentTarget,a=o.responseText,r=o.responseURL,l=this.id,d=this.id2,n=this.hls;if(this.loading=!1,void 0===r&&(r=this.url),i.tload=performance.now(),i.mtime=new Date(o.getResponseHeader("Last-Modified")),0===a.indexOf("#EXTM3U"))if(a.indexOf("#EXTINF:")>0)if(null===this.id)n.trigger(t.default.MANIFEST_LOADED,{levels:[{url:r}],url:r,stats:i});else{var f=this.parseLevelPlaylist(a,r,l);i.tparsed=performance.now(),n.trigger(t.default.LEVEL_LOADED,{details:f,level:l,id:d,stats:i})}else s=this.parseMasterPlaylist(a,r),s.length?n.trigger(t.default.MANIFEST_LOADED,{levels:s,url:r,stats:i}):n.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no level found in manifest"});else n.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(n){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_ERROR,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_ERROR,i=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,response:n.currentTarget,level:this.id,id:this.id2})}},{key:"loadtimeout",value:function(){var r,i;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_TIMEOUT,i=!0):(r=e.ErrorDetails.LEVEL_LOAD_TIMEOUT,i=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:i,url:this.url,loader:this.loader,level:this.id,id:this.id2})}}]),r}(a.default);s.default=u},{"../errors":20,"../event-handler":21,"../events":22,"../utils/attr-list":33,"../utils/url":37}],30:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t.set(n,4),r=0,e=8;a>r;r++)t.set(i[r],e),e+=i[r].byteLength;return t}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){return r*=t,e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,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,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))}},{key:"moov",value:function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))}},{key:"mvex",value:function(r){for(var t=r.length,i=[];t--;)i[t]=e.trex(r[t]);return e.box.apply(null,[e.types.mvex].concat(i))}},{key:"mvhd",value:function(t,r){r*=t;var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,i)}},{key:"sdtp",value:function(a){var r,t,i=a.samples||[],n=new Uint8Array(4+i.length);for(t=0;t>>8&255),i.push(255&a),i=i.concat(Array.prototype.slice.call(n));for(r=0;r>>8&255),s.push(255&a),s=s.concat(Array.prototype.slice.call(n));var u=e.box(e.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(s))),o=t.width,l=t.height;return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,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]),u,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value: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]))}},{key:"mp4a",value:function(t){var r=t.audiosamplerate;return e.box(e.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,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,i=t.duration*t.timescale,n=t.width,a=t.height;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(i,t){var n=e.sdtp(i),r=i.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])),e.trun(i,n.length+16+16+8+16+8+8),n)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(r){var t=r.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(h,o){var i,n,a,s,t,l,d=h.samples||[],r=d.length,f=12+16*r,u=new Uint8Array(f);for(o+=8+f,u.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o],0),i=0;r>i;i++)n=d[i],a=n.duration,s=n.size,t=n.flags,l=n.cts,u.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,61440&t.degradPrio,15&t.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,u)}},{key:"initSegment",value:function(i){e.types||e.init();var t,r=e.moov(i);return t=new Uint8Array(e.FTYP.byteLength+r.byteLength),t.set(e.FTYP),t.set(r,e.FTYP.byteLength),t}}]),e}();e.default=i},{}],31:[function(i,h,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function e(i,r){for(var t=0;tMath.pow(2,32)&&!function(){var e=function r(t,e){return e?r(e,t%e):t};i.timescale=i.audiosamplerate/e(i.audiosamplerate,1024)}(),e.logger.log("audio mp4 timescale :"+i.timescale),l.audio={container:"audio/mp4",codec:i.codec,initSegment:r.default.initSegment([i]),metadata:{channelCount:i.channelCount}},u&&(a=o=g[0].pts-f*h)),n.sps&&n.pps&&d.length&&(n.timescale=this.MP4_TIMESCALE,l.video={container:"video/mp4",codec:n.codec,initSegment:r.default.initSegment([n]),metadata:{width:n.width,height:n.height}},u&&(a=Math.min(a,d[0].pts-f*h),o=Math.min(o,d[0].dts-f*h))),Object.keys(l).length?(c.trigger(t.default.FRAG_PARSING_INIT_SEGMENT,v),this.ISGenerated=!0,u&&(this._initPTS=a,this._initDTS=o)):c.trigger(t.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(n,w,S){var L,s,p,A,f,d,T,k,R,g,_,v,o,i,a,E=8,c=this.PES_TIMESCALE,h=this.PES2MP4SCALEFACTOR,u=[];for(d=new Uint8Array(n.len+4*n.nbNalu+8),L=new DataView(d.buffer),L.setUint32(0,d.byteLength),d.set(r.default.types.mdat,4);n.samples.length;){for(s=n.samples.shift(),A=0;s.units.units.length;)f=s.units.units.shift(),L.setUint32(E,f.data.byteLength),E+=4,d.set(f.data,E),E+=f.data.byteLength,A+=4+f.data.byteLength;if(_=s.pts-this._initDTS,v=s.dts-this._initDTS,v=Math.min(_,v),void 0!==g){o=this._PTSNormalize(_,g),i=this._PTSNormalize(v,g);var m=(i-g)/h;0>=m&&(e.logger.log("invalid sample duration at PTS/DTS: "+s.pts+"/"+s.dts+":"+m),m=1),p.duration=m}else{var y=void 0,l=void 0;y=S?this.nextAvcDts:w*c,o=this._PTSNormalize(_,y),i=this._PTSNormalize(v,y),l=Math.round((i-y)/90),S&&l&&(l>1?e.logger.log("AVC:"+l+" ms hole between fragments detected,filling it"):-1>l&&e.logger.log("AVC:"+-l+" ms overlapping between fragments detected"),i=y,o=Math.max(o-l,i),e.logger.log("Video/PTS/DTS adjusted: "+o+"/"+i+",delta:"+l)),k=Math.max(0,o),R=Math.max(0,i)}p={size:A,duration:0,cts:(o-i)/h,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0}},a=p.flags,s.key===!0?(a.dependsOn=2,a.isNonSync=0):(a.dependsOn=1,a.isNonSync=1),u.push(p),g=i}var b=0;u.length>=2&&(b=u[u.length-2].duration,p.duration=b),this.nextAvcDts=i+b*h,n.len=0,n.nbNalu=0,u.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&(a=u[0].flags,a.dependsOn=2,a.isNonSync=0),n.samples=u,T=r.default.moof(n.sequenceNumber++,R/h,n),n.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:T,data2:d,startPTS:k/c,endPTS:(o+h*b)/c,startDTS:R/c,endDTS:this.nextAvcDts/c,type:"video",nb:u.length})}},{key:"remuxAudio",value:function(i,D,S){var T,p,a,h,o,k,L,b,u,v,R,d,n,A=8,s=this.PES_TIMESCALE,w=i.timescale,f=s/w,E=1024*i.timescale/i.audiosamplerate,m=[],_=[];for(i.samples.sort(function(e,t){return e.pts-t.pts}),_=i.samples;_.length;){if(p=_.shift(),h=p.unit,v=p.pts-this._initDTS,R=p.dts-this._initDTS,void 0!==u)d=this._PTSNormalize(v,u),n=this._PTSNormalize(R,u),a.duration=(n-u)/f,Math.abs(a.duration-E)>E/10&&e.logger.log("invalid AAC sample duration at PTS "+Math.round(v/90)+",should be 1024,found :"+Math.round(a.duration*i.audiosamplerate/i.timescale)),a.duration=E,n=E*f+u;else{var c=void 0,l=void 0;if(c=S?this.nextAacPts:D*s,d=this._PTSNormalize(v,c),n=this._PTSNormalize(R,c),l=Math.round(1e3*(d-c)/s),S&&l){if(l>0)e.logger.log(l+" ms hole between AAC samples detected,filling it");else if(-12>l){e.logger.log(-l+" ms overlapping between AAC samples detected, drop frame"),i.len-=h.byteLength;continue}d=n=c}if(L=Math.max(0,d),b=Math.max(0,n),!(i.len>0))return;o=new Uint8Array(i.len+8),T=new DataView(o.buffer),T.setUint32(0,o.byteLength),o.set(r.default.types.mdat,4)}o.set(h,A),A+=h.byteLength,a={size:h.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},m.push(a),u=n}var y=0,g=m.length;g>=2&&(y=m[g-2].duration,a.duration=y),g&&(this.nextAacPts=d+f*y,i.len=0,i.samples=m,k=r.default.moof(i.sequenceNumber++,b/f,i),i.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:k,data2:o,startPTS:L/s,endPTS:this.nextAacPts/s,startDTS:b/s,endDTS:(n+f*y)/s,type:"audio",nb:g}))}},{key:"remuxID3",value:function(r,n){var e,a=r.samples.length;if(a){for(var i=0;a>i;i++)e=r.samples[i],e.pts=(e.pts-this._initPTS)/this.PES_TIMESCALE,e.dts=(e.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_METADATA,{samples:r.samples})}r.samples=[],n=n}},{key:"remuxText",value:function(e,n){e.samples.sort(function(e,t){return e.pts-t.pts});var r,a=e.samples.length;if(a){for(var i=0;a>i;i++)r=e.samples[i],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[],n=n}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=e>t?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),i}();n.default=d},{"../errors":20,"../events":22,"../remux/mp4-generator":30,"../utils/logger":36}],32:[function(r,l,e){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function e(i,r){for(var t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"hexadecimalInteger",value:function(r){if(this[r]){var e=(this[r]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var i=new Uint8Array(e.length/2),t=0;tNumber.MAX_SAFE_INTEGER?1/0:e}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(t){var e=/^(\d+)x(\d+)$/.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}}],[{key:"parseAttrList",value:function(n){for(var t,a=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,r={};null!==(t=a.exec(n));){var e=t[2],i='"';0===e.indexOf(i)&&e.lastIndexOf(i)===e.length-1&&(e=e.slice(1,-1)),r[t[1]]=e}return r}}]),e}();e.default=i},{}],34:[function(r,e,i){"use strict";var t={search:function(n,s){for(var t=0,r=n.length-1,e=null,i=null;r>=t;){e=(t+r)/2|0,i=n[e];var a=s(i);if(a>0)t=e+1;else{if(!(0>a))return i;r=e-1}}return null}};e.exports=t},{}],35:[function(n,a,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(i,r){for(var t=0;t0;)e.removeCue(e.cues[0])}},{key:"push",value:function(r,i){this.cue||this._createCue();for(var n,t,e,s,o,u=31&i[0],a=2,l=0;u>l;l++)if(n=i[a++],t=127&i[a++],e=127&i[a++],s=0!==(4&n),o=3&n,(0!==t||0!==e)&&s&&0===o){if(32&t||64&t)this.cue.text+=this._fromCharCode(t)+this._fromCharCode(e);else if((17===t||25===t)&&e>=48&&63>=e)switch(e){case 48:this.cue.text+="®";break;case 49:this.cue.text+="°";break;case 50:this.cue.text+="½";break;case 51:this.cue.text+="¿";break;case 52:this.cue.text+="™";break;case 53:this.cue.text+="¢";break;case 54:this.cue.text+="";break;case 55:this.cue.text+="£";break;case 56:this.cue.text+="♪";break;case 57:this.cue.text+=" ";break;case 58:this.cue.text+="è";break;case 59:this.cue.text+="â";break;case 60:this.cue.text+="ê";break;case 61:this.cue.text+="î";break;case 62:this.cue.text+="ô";break;case 63:this.cue.text+="û"}if((17===t||25===t)&&e>=32&&47>=e)switch(e){case 32:break;case 33:break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:break;case 42:break;case 43:break;case 44:break;case 45:break;case 46:break;case 47:}if((20===t||28===t)&&e>=32&&47>=e)switch(e){case 32:this._clearActiveCues(r);break;case 33:this.cue.text=this.cue.text.substr(0,this.cue.text.length-1);break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:this._clearActiveCues(r);break;case 42:break;case 43:break;case 44:this._clearActiveCues(r);break;case 45:break;case 46:this._text="";break;case 47:this._flipMemory(r)}if((23===t||31===t)&&e>=33&&35>=e)switch(e){case 33:break;case 34:break;case 35:}}}},{key:"_fromCharCode",value:function(e){switch(e){case 42:return"á";case 2:return"á";case 2:return"é";case 4:return"í";case 5:return"ó";case 6:return"ú";case 3:return"ç";case 4:return"÷";case 5:return"Ñ";case 6:return"ñ";case 7:return"█";default:return String.fromCharCode(e)}}},{key:"_flipMemory",value:function(e){this._clearActiveCues(e),this._flushCaptions(e)}},{key:"_flushCaptions",value:function(s){this._has708||(this._textTrack=this.media.addTextTrack("captions","English","en"),this._has708=!0);var e=!0,i=!1,n=void 0;try{for(var a,t=this.memory[Symbol.iterator]();!(e=(a=t.next()).done);e=!0){var r=a.value;r.startTime=s,this._textTrack.addCue(r),this.display.push(r)}}catch(e){i=!0,n=e}finally{try{!e&&t.return&&t.return()}finally{if(i)throw n}}this.memory=[],this.cue=null}},{key:"_clearActiveCues",value:function(a){var e=!0,r=!1,i=void 0;try{for(var n,t=this.display[Symbol.iterator]();!(e=(n=t.next()).done);e=!0){var s=n.value;s.endTime=a}}catch(e){r=!0,i=e}finally{try{!e&&t.return&&t.return()}finally{if(r)throw i}}this.display=[]}},{key:"_clearBufferedCues",value:function(){}}]),e}();e.default=i},{}],36:[function(l,u,r){"use strict";function e(){}function n(t,e){return e="["+t+"] > "+e}function a(t){var r=window.console[t];return r?function(){for(var a=arguments.length,e=Array(a),i=0;a>i;i++)e[i]=arguments[i];e[0]&&(e[0]=n(t,e[0])),r.apply(window.console,e)}:e}function s(r){for(var i=arguments.length,n=Array(i>1?i-1:0),e=1;i>e;e++)n[e-1]=arguments[e];n.forEach(function(e){t[e]=r[e]?r[e].bind(r):a(e)})}Object.defineProperty(r,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i={trace:e,debug:e,log:e,warn:e,info:e,error:e},t=i;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{t.log()}catch(e){t=i}}else t=i},r.logger=t},{}],37:[function(r,t,i){"use strict";var e={buildAbsoluteURL:function(r,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var l=null,o=null,a=/^([^#]*)(.*)$/.exec(t);a&&(o=a[2],t=a[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(l=s[2],t=s[1]);var f=/^([^#]*)(.*)$/.exec(r);f&&(r=f[1]);var u=/^([^\?]*)(.*)$/.exec(r);u&&(r=u[1]);var i=/^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(r);if(!i)throw new Error("Error trying to parse base URL.");var h=i[2]||"",d=i[1]||"",c=i[4],n=null;return n=/^\/\//.test(t)?h+"//"+e.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?d+"/"+e.buildAbsolutePath("",t.substring(1)):e.buildAbsolutePath(d+c,t),l&&(n+=l),o&&(n+=o),n},buildAbsolutePath:function(a,s){for(var i,e,o=s,n="",t=a.replace(/[^\/]*$/,o.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),r=0;e=t.indexOf("/../",r),e>-1;r=e+i)i=/^\/(?:\.\.\/)*/.exec(t.slice(e))[0].length,n=(n+t.substring(r,e)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(i-1)/3+"}$"),"/");return n+t.substr(r)}};t.exports=e},{}],38:[function(r,s,t){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(i,r){for(var t=0;t=200&&300>r?(window.clearTimeout(this.timeoutHandle),t.tload=performance.now(),this.onSuccess(i,t)):t.retry