!function(e){if("object"==typeofexports&&"undefined"!=typeofmodule)module.exports=e();elseif("function"==typeofdefine&&define.amd)define([],e);else{vart;t="undefined"!=typeofwindow?window:"undefined"!=typeofglobal?global:"undefined"!=typeofself?self:this,t.Hls=e()}}(function(){vare;returnfunctione(t,r,i){functiona(s,o){if(!r[s]){if(!t[s]){varl="function"==typeofrequire&&require;if(!o&&l)returnl(s,!0);if(n)returnn(s,!0);varu=newError("Cannot find module '"+s+"'");throwu.code="MODULE_NOT_FOUND",u}vard=r[s]={exports:{}};t[s][0].call(d.exports,function(e){varr=t[s][1][e];returna(r?r:e)},d,d.exports,e,t,r,i)}returnr[s].exports}for(varn="function"==typeofrequire&&require,s=0;s<i.length;s++)a(i[s]);returna}({1:[function(e,t,r){functioni(){this._events=this._events||{},this._maxListeners=this._maxListeners||void0}functiona(e){return"function"==typeofe}functionn(e){return"number"==typeofe}functions(e){return"object"==typeofe&&null!==e}functiono(e){returnvoid0===e}t.exports=i,i.EventEmitter=i,i.prototype._events=void0,i.prototype._maxListeners=void0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throwTypeError("n must be a positive number");returnthis._maxListeners=e,this},i.prototype.emit=function(e){vart,r,i,n,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceofError)throwt;vard=newError('Uncaught, unspecified "error" event. ('+t+")");throwd.context=t,d}if(r=this._events[e],o(r))return!1;if(a(r))switch(arguments.length){case1:r.call(this);break;case2:r.call(this,arguments[1]);break;case3:r.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),r.apply(this,n)}elseif(s(r))for(n=Array.prototype.slice.call(arguments,1),u=r.slice(),i=u.length,l=0;l<i;l++)u[l].apply(this,n);return!0},i.prototype.addListener=function(e,t){varr;if(!a(t))throwTypeError("listener must be a function");returnthis._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,a(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=o(this._maxListeners)?i.defaultMaxListeners:this._maxListeners)&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.trace),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){functionr(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!a(t))throwTypeError("listener must be a function");vari=!1;returnr.listener=t,this.on(e,r),this},i.prototype.removeListener=function(e,t){varr,i,n,o;if(!a(t))throwTypeError("listener must be a function");if(!this._events||!this._events[e])returnthis;if(r=this._events[e],n=r.length,i=-1,r===t||a(r.listener)&&r.listener===t)deletethis._events[e],this._events.removeListener&&this.emit("removeListener",e,t);elseif(s(r)){for(o=n;o-->0;)if(r[o]===t||r[o].listener&&r[o].listener===t){i=o;break}if(i<0)returnthis;1===r.length?(r.length=0,deletethis._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}returnthis},i.prototype.removeAllListeners=function(e){vart,r;if(!this._events)returnthis;if(!this._events.removeListener)return0===arguments.length?this._events={}:this._events[e]&&deletethis._events[e],this;if(0===arguments.length){for(tinthis._events)"removeListener"!==t&&this.removeAllListeners(t);returnthis.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],a(r))this.removeListener(e,r);elseif(r)for(;r.length;)this.removeListener(e,r[r.length-1]);returndeletethis._events[e],this},i.prototype.listeners=function(e){returnthis._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){vart=this._events[e];if(a(t))return1;if(t)returnt.length}return0},i.listenerCount=function(e,t){returne.listenerCount(t)}}
a(this,t);varr=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MANIFEST_LOADING,u.default.MANIFEST_LOADED,u.default.AUDIO_TRACK_LOADED));returnr.ticks=0,r.ontick=r.tick.bind(r),r}returns(t,e),o(t,[{key:"destroy",value:function(){f.default.prototype.destroy.call(this)}},{key:"tick",value:function(){1===++this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){this.updateTrack(this.trackId)}},{key:"onManifestLoading",value:function(){this.tracks=[],this.trackId=-1}},{key:"onManifestLoaded",value:function(e){vart=this,r=e.audioTracks||[],i=!1;this.tracks=r,this.hls.trigger(u.default.AUDIO_TRACKS_UPDATED,{audioTracks:r});vara=0;r.forEach(function(e){if(e.default)returnt.audioTrack=a,void(i=!0);a++}),i===!1&&r.length&&(c.logger.log("no default audio track defined, use first audio track as default"),this.audioTrack=0)}},{key:"onAudioTrackLoaded",value:function(e){e.id<this.tracks.length&&(c.logger.log("audioTrack "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.timer&&(this.timer=setInterval(this.ontick,1e3*e.details.targetduration)),!e.details.live&&this.timer&&(clearInterval(this.timer),this.timer=null))}},{key:"setAudioTrackInternal",value:function(e){if(e>=0&&e<this.tracks.length){this.timer&&(clearInterval(this.timer),this.timer=null),this.trackId=e,c.logger.log("switching to audioTrack "+e);vart=this.tracks[e],r=this.hls,i=t.type,a=t.url,n={id:e,type:i,url:a};r.trigger(u.default.AUDIO_TRACK_SWITCH,n),r.trigger(u.default.AUDIO_TRACK_SWITCHING,n);vars=t.details;!a||void0!==s&&s.live!==!0||(c.logger.log("(re)loading playlist for audioTrack "+e),r.trigger(u.default.AUDIO_TRACK_LOADING,{url:a,id:e}))}}},{key:"updateTrack",value:function(e){if(e>=0&&e<this.tracks.length){this.timer&&(clearInterval(this.timer),this.timer=null),this.trackId=e,c.logger.log("updating audioTrack "+e);vart=this.tracks[e],r=t.url,i=t.details;!r||void0!==i&&i.live!==!0||(c.logger.log("(re)loading playlist for audioTrack "+e),this.hls.trigger(u.default.AUDIO_TRACK_LOADING,{url:r,id:e}))}}},{key:"audioTracks",get:function(){returnthis.tracks}},{key:"audioTrack",get:function(){returnthis.trackId},set:function(e){this.trackId===e&&void0!==this.tracks[e].details||this.setAudioTrackInternal(e)}}]),t}(f.default);r.default=h},{31:31,32:32,50:50}],8:[function(e,t,r){"use strict";functioni(e){returne&&e.__esModule?e:{default:e}}functiona(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}functionn(e,t){if(!e)thrownewReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeoft&&"function"!=typeoft?e:t}functions(e,t){if("function"!=typeoft&&null!==t)thrownewTypeError("Super expression must either be null or a function, not "+typeoft);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});varo=function(){functione(e,t){for(varr=0;r<t.length;r++){vari=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"ini&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}returnfunction(t,r,i){returnr&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(32),u=i(l),d=e(31),f=i(d),c=e(50),h=e(30),g=function(e){functiont(e){a(this,t);varr=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.MANIFEST_PARSED,u.default.BUFFER_RESET,u.default.BUFFER_APPENDING,u.default.BUFFER_CODECS,u.default.BUFFER_EOS,u.default.BUFFER_FLUSHING,u.default.LEVEL_PTS_UPDATED,u.default.LEVEL_UPDATED));returnr._msDuration=null,r._levelDuration=null,r.onsbue=r.onSBUpdateEnd.bind(r),r.onsbe=r.onSBUpdateError.bind(r),r.pendingTracks={},r.tracks={},r}returns(t,e),o(t,[{key:"destroy",value:function(){f.default.prototype.destroy.call(this)}},{key:"onLevelPtsUpdated",value:function(e){vart=e.type,r=this.tracks.audio;if("audio"===t&&r&&"audio/mpeg"===r.container){vari=this.
}elsel=null;elsel.dropped&&!v&&(y&&y.backtracked?(k.logger.warn("Already backtracked from fragment "+(g+1)+", will not backtrack to fragment "+g+". Loading fragment "+(g+1)),l=y):(k.logger.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),l.dropped=0,p?(p.loadCounter&&p.loadCounter--,l=p):l=null))}returnl}},{key:"_loadFragmentOrKey",value:function(e,t,r,i,a){varn=this.hls,s=n.config;if(!e.decryptdata||null==e.decryptdata.uri||null!=e.decryptdata.key){if(k.logger.log("Loading "+e.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+t+", currentTime:"+i.toFixed(3)+",bufferEnd:"+a.toFixed(3)),void0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,e.loadCounter){e.loadCounter++;varo=s.fragLoadingLoopThreshold;if(e.loadCounter>o&&Math.abs(this.fragLoadIdx-e.loadIdx)<o)returnn.trigger(v.default.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:e}),!1}elsee.loadCounter=1;returne.loadIdx=this.fragLoadIdx,this.fragCurrent=e,this.startFragRequested=!0,isNaN(e.sn)||(this.nextLoadPosition=e.start+e.duration),e.autoLevel=n.autoLevelEnabled,e.bitrateTest=this.bitrateTest,n.trigger(v.default.FRAG_LOADING,{frag:e}),this.demuxer||(this.demuxer=newh.default(n,"main")),this.state=R.FRAG_LOADING,!0}k.logger.log("Loading key for "+e.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+t),this.state=R.KEY_LOADING,n.trigger(v.default.KEY_LOADING,{frag:e})}},{key:"getBufferedFrag",value:function(e){returnu.default.search(this._bufferedFrags,function(t){returne<t.startPTS?-1:e>t.endPTS?1:0})}},{key:"followingBufferedFrag",value:function(e){returne?this.getBufferedFrag(e.endPTS+.5):null}},{key:"_checkFragmentChanged",value:function(){vare,t,r=this.media;if(r&&r.readyState&&r.seeking===!1&&(t=r.currentTime,t>r.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=t),f.default.isBuffered(r,t)?e=this.getBufferedFrag(t):f.default.isBuffered(r,t+.1)&&(e=this.getBufferedFrag(t+.1)),e)){vari=e;if(i!==this.fragPlaying){this.hls.trigger(v.default.FRAG_CHANGED,{frag:i});vara=i.level;this.fragPlaying&&this.fragPlaying.level===a||this.hls.trigger(v.default.LEVEL_SWITCHED,{level:a}),this.fragPlaying=i}}}},{key:"immediateLevelSwitch",value:function(){if(k.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;vare=this.media,t=void0;e?(t=e.paused,e.pause()):t=!0,this.previouslyPaused=t}varr=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}},{key:"immediateLevelSwitchEnd",value:function(){vare=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,f.default.isBuffered(e,e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){vare=this.media;if(e&&e.readyState){vart=void0,r=void0,i=void0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,r=this.getBufferedFrag(e.currentTime),r&&r.startPTS>1&&this.flushMainBuffer(0,r.startPTS-1),e.paused)t=0;else{vara=this.hls.nextLoadLevel,n=this.levels[a],s=this.fragLastKbps;t=s&&this.fragCurrent?this.fragCurrent.duration*n.bitrate/(1e3*s)+1:0}if((i=this.getBufferedFrag(e.currentTime+t))&&(i=this.followingBufferedFrag(i))){varo=this.fragCurrent;o&&o.loader&&o.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(i.startPTS,Number.POSITIVE_INFINITY)}}}},{key:"flushMainBuffer",value:function(e,t){this.state=R.BUFFER_FLUSHING;varr={startOffset:e,endOffset:t};this.altAudio&&(r.type="video"),this.hls.trigger(v.default.BUFFER_FLUSHING,r)}},{key:"onMediaAttached",value:function(e){vart=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);varr=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition)}},{key:"onMediaDetaching",value:function
Object.defineProperty(e,i.key,i)}}returnfunction(t,r,i){returnr&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){functione(t,r){i(this,e),this.subtle=t,this.aesIV=r}returna(e,[{key:"decrypt",value:function(e,t){returnthis.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}]),e}();r.default=n},{}],17:[function(e,t,r){"use strict";functioni(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});vara=function(){functione(e,t){for(varr=0;r<t.length;r++){vari=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"ini&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}returnfunction(t,r,i){returnr&&e(t.prototype,r),i&&e(t,i),t}}(),n=function(){functione(){i(this,e),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[newUint32Array(256),newUint32Array(256),newUint32Array(256),newUint32Array(256)],this.invSubMix=[newUint32Array(256),newUint32Array(256),newUint32Array(256),newUint32Array(256)],this.sBox=newUint32Array(256),this.invSBox=newUint32Array(256),this.key=newUint32Array(0),this.initTable()}returna(e,[{key:"uint8ArrayToUint32Array_",value:function(e){for(vart=newDataView(e),r=newUint32Array(4),i=0;i<4;i++)r[i]=t.getUint32(4*i);returnr}},{key:"initTable",value:function(){vare=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],a=r[1],n=r[2],s=r[3],o=this.invSubMix,l=o[0],u=o[1],d=o[2],f=o[3],c=newUint32Array(256),h=0,g=0,v=0;for(v=0;v<256;v++)c[v]=v<128?v<<1:v<<1^283;for(v=0;v<256;v++){varp=g^g<<1^g<<2^g<<3^g<<4;p=p>>>8^255&p^99,e[h]=p,t[p]=h;vary=c[h],m=c[y],E=c[m],b=257*c[p]^16843008*p;i[h]=b<<24|b>>>8,a[h]=b<<16|b>>>16,n[h]=b<<8|b>>>24,s[h]=b,b=16843009*E^65537*m^257*y^16843008*h,l[p]=b<<24|b>>>8,u[p]=b<<16|b>>>16,d[p]=b<<8|b>>>24,f[p]=b,h?(h=y^c[c[c[E^y]]],g^=c[c[g]]):h=g=1}}},{key:"expandKey",value:function(e){for(vart=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i<t.length&&r;)r=t[i]===this.key[i],i++;if(!r){this.key=t;vara=this.keySize=t.length;if(4!==a&&6!==a&&8!==a)thrownewError("Invalid aes key size="+a);varn=this.ksRows=4*(a+6+1),s=void0,o=void0,l=this.keySchedule=newUint32Array(n),u=this.invKeySchedule=newUint32Array(n),d=this.sBox,f=this.rcon,c=this.invSubMix,h=c[0],g=c[1],v=c[2],p=c[3],y=void0,m=void0;for(s=0;s<n;s++)s<a?y=l[s]=t[s]:(m=y,s%a==0?(m=m<<8|m>>>24,m=d[m>>>24]<<24|d[m>>>16&255]<<16|d[m>>>8&255]<<8|d[255&m],m^=f[s/a|0]<<24):a>6&&s%a==4&&(m=d[m>>>24]<<24|d[m>>>16&255]<<16|d[m>>>8&255]<<8|d[255&m]),l[s]=y=(l[s-a]^m)>>>0);for(o=0;o<n;o++)s=n-o,m=3&o?l[s]:l[s-4],u[o]=o<4||s<=4?m:h[d[m>>>24]]^g[d[m>>>16&255]]^v[d[m>>>8&255]]^p[d[255&m]],u[o]=u[o]>>>0}}},{key:"networkToHostOrderSwap",value:function(e){returne<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}},{key:"decrypt",value:function(e,t,r){for(vari,a,n=this.keySize+6,s=this.invKeySchedule,o=this.invSBox,l=this.invSubMix,u=l[0],d=l[1],f=l[2],c=l[3],h=this.uint8ArrayToUint32Array_(r),g=h[0],v=h[1],p=h[2],y=h[3],m=newInt32Array(e),E=newInt32Array(m.length),b=void0,T=void0,_=void0,k=void0,R=void0,A=void0,S=void0,L=void0,w=void0,D=void0,O=void0,I=void0,P=this.networkToHostOrderSwap;t<m.length;){for(w=P(m[t]),D=P(m[t+1]),O=P(m[t+2]),I=P(m[t+3]),R=w^s[0],A=I^s[1],S=O^s[2],L=D^s[3],i=4,a=1;a<n;a++)b=u[R>>>24]^d[A>>16&255]^f[S>>8&255]^c[255&L]^s[i],T=u[A>>>24]^d[S>>16&255]^f[L>>8&255]^c[255&R]^s[i+1],_=u[S>>>24]^d[L>>16&255]^f[R>>8&255]^c[255&A]^s[i+2],k=u[L>>>24]^d[R>>16&255]^f[A>>8&255]^c[255&S]^s[i+3],R=b,A=T,S=_,L=k,i+=4;b=o[R>>>24]<<24^o[A>>16&255]<<16^o[S>>8&255]<<8^o[255&L]^s[i],T=o[A>>>24]<<24^o[S>>16&255]<<16^o[L>>8&255]<<8^o[255&R]^s[i+1],_=o[S>>>24]<<24^o[L>>16&255]<<16^o[R>>8&255]<<8^o[255&A]^s[i+2],k=o[L>>>24]<<24^o[R>>16&255]<<16^o[A>>8&255]<<8^o[255&S]^s[i+3],i+=3,E[t]=P(b^g),E[t+1]=P(k^v),E[t+2]=P(_^p),E[t+3]=P(T^y),g=w,v=D,p=O,y=I,t+=4}returnE.buffer}},{key:"destroy",value:function(){this.key=void0,this.keySize=void0,this.ksRows=void0,this.sBox=void0,this.invSBox=void0,this.subMix=void0,this.invSubMix=void0,this.keySchedule=void0,this.invKeySchedule=void0,this.rcon=void0}}]),e}();r.default=n},{}],18:[funct
s>4294967295&&(s-=8589934592),64&r?(o=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,o>4294967295&&(o-=8589934592),s-o>54e5&&(g.logger.warn(Math.round((s-o)/9e4)+"s delta between PTS and DTS, align them"),s=o)):o=s),a=t[8],l=a+9,e.size-=l,n=newUint8Array(e.size);for(varc=0,h=d.length;c<h;c++){t=d[c];varv=t.byteLength;if(l){if(l>v){l-=v;continue}t=t.subarray(l),v-=l,l=0}n.set(t,u),u+=v}returni&&(i-=a+3),{data:n,pts:s,dts:o,len:i}}returnnull}},{key:"pushAccesUnit",value:function(e,t){if(e.units.length&&e.frame){varr=t.samples,i=r.length;!this.config.forceKeyFrameOnDiscontinuity||e.key===!0||t.sps&&(i||this.contiguous)?(e.id=i,r.push(e)):t.dropped++}e.debug.length&&g.logger.log(e.pts+"/"+e.dts+":"+e.debug)}},{key:"_parseAVCPES",value:function(e,t){varr,i,a,n=this,s=this._avcTrack,o=this._parseAVCNALu(e.data),l=this.avcSample;e.data=null,o.forEach(function(t){switch(t.type){case1:i=!0,l.frame=!0;varo=t.data;if(o.length>4){varu=newf.default(o).readSliceType();2!==u&&4!==u&&7!==u&&9!==u||(l.key=!0)}break;case5:i=!0,l||(l=n.avcSample=n._createAVCSample(!0,e.pts,e.dts,"")),l.key=!0,l.frame=!0;break;case6:i=!0,r=newf.default(n.discardEPB(t.data)),r.readUByte();for(vard=0,c=0,h=!1,g=0;!h&&r.bytesAvailable>1;){d=0;do{g=r.readUByte(),d+=g}while(255===g);c=0;do{g=r.readUByte(),c+=g}while(255===g);if(4===d&&0!==r.bytesAvailable){h=!0;if(181===r.readUByte()){if(49===r.readUShort()){if(1195456820===r.readUInt()){if(3===r.readUByte()){varv=r.readUByte(),p=r.readUByte(),y=31&v,m=[v,p];for(a=0;a<y;a++)m.push(r.readUByte()),m.push(r.readUByte()),m.push(r.readUByte());n._insertSampleInOrder(n._txtTrack.samples,{type:3,pts:e.pts,bytes:m})}}}}}elseif(c<r.bytesAvailable)for(a=0;a<c;a++)r.readUByte()}break;case7:if(i=!0,!s.sps){r=newf.default(t.data);varE=r.readSPS();s.width=E.width,s.height=E.height,s.pixelRatio=E.pixelRatio,s.sps=[t.data],s.duration=n._duration;varb=t.data.subarray(1,4),T="avc1.";for(a=0;a<3;a++){var_=b[a].toString(16);_.length<2&&(_="0"+_),T+=_}s.codec=T}break;case8:i=!0,s.pps||(s.pps=[t.data]);break;case9:i=!1,l&&n.pushAccesUnit(l,s),l=n.avcSample=n._createAVCSample(!1,e.pts,e.dts,"");break;case12:i=!1;break;default:i=!1,l&&(l.debug+="unknown NAL "+t.type+" ")}if(l&&i){l.units.push(t)}}),t&&l&&(this.pushAccesUnit(l,s),this.avcSample=null)}},{key:"_createAVCSample",value:function(e,t,r,i){return{key:e,pts:t,dts:r,units:[],debug:i}}},{key:"_insertSampleInOrder",value:function(e,t){varr=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);elsefor(vari=r-1;i>=0;i--)if(t.pts<e[i].pts){e.splice(i,0,t);break}}elsee.push(t)}},{key:"_getLastNalUnit",value:function(){vare=this.avcSample,t=void0;if(!e||0===e.units.length){varr=this._avcTrack,i=r.samples;e=i[i.length-1]}if(e){vara=e.units;t=a[a.length-1]}returnt}},{key:"_parseAVCNALu",value:function(e){vart,r,i,a,n,s=0,o=e.byteLength,l=this._avcTrack,u=l.naluState||0,d=u,f=[],c=-1;for(u===-1&&(c=0,n=31&e[0],u=0,s=1);s<o;)if(t=e[s++],u)if(1!==u)if(t)if(1===t){if(c>=0)i={data:e.subarray(c,s-u-1),type:n},f.push(i);else{varh=this._getLastNalUnit();if(h&&(d&&s<=4-d&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-d)),(r=s-u-1)>0)){varg=newUint8Array(h.data.byteLength+r);g.set(h.data,0),g.set(e.subarray(0,r),h.data.byteLength),h.data=g}}s<o?(a=31&e[s],c=s,n=a,u=0):u=-1}elseu=0;elseu=3;elseu=t?0:2;elseu=t?0:1;if(c>=0&&u>=0&&(i={data:e.subarray(c,o),type:n,state:u},f.push(i)),0===f.length){varv=this._getLastNalUnit();if(v){varp=newUint8Array(v.data.byteLength+e.byteLength);p.set(v.data,0),p.set(e,v.data.byteLength),v.data=p}}returnl.naluState=u,f}},{key:"discardEPB",value:function(e){for(vart,r,i=e.byteLength,a=[],n=1;n<i-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(a.push(n+2),n+=2):n++;if(0===a.length)returne;t=i-a.length,r=newUint8Array(t);vars=0;for(n=0;n<t;s++,n++)s===a[0]&&(s++,a.shift()),r[n]=e[s];returnr}},{key:"_parseAACPES",value:function(e){vart,r,i,a,n,s,l,d,f,c=this._audioTrack,h=e.data,p=e.pts,y=this.aacOverFlow,m=this.aacLastPTS;if(y){varE=newUint8Array(y.byteLength+h.byteLength);E.set(y,0),E
;if(this.rawByteRange){vart=this.rawByteRange.split("@",2);if(1===t.length){varr=this.lastByteRangeEndOffset;e[0]=r?r:0}elsee[0]=parseInt(t[1]);e[1]=parseInt(t[0])+e[0]}}returnthis._byteRange}},{key:"byteRangeStartOffset",get:function(){returnthis.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){returnthis.byteRange[1]}},{key:"decryptdata",get:function(){returnthis._decryptdata||(this._decryptdata=this.fragmentDecryptdataFromLevelkey(this.levelkey,this.sn)),this._decryptdata}}]),e}(),k=function(e){functiont(e){s(this,t);varr=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,f.default.MANIFEST_LOADING,f.default.LEVEL_LOADING,f.default.AUDIO_TRACK_LOADING,f.default.SUBTITLE_TRACK_LOADING));returnr.loaders={},r}returnn(t,e),o(t,[{key:"destroy",value:function(){for(vareinthis.loaders){vart=this.loaders[e];t&&t.destroy()}this.loaders={},h.default.prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(e){this.load(e.url,{type:"manifest"})}},{key:"onLevelLoading",value:function(e){this.load(e.url,{type:"level",level:e.level,id:e.id})}},{key:"onAudioTrackLoading",value:function(e){this.load(e.url,{type:"audioTrack",id:e.id})}},{key:"onSubtitleTrackLoading",value:function(e){this.load(e.url,{type:"subtitleTrack",id:e.id})}},{key:"load",value:function(e,t){varr=this.loaders[t.type];if(r){vari=r.context;if(i&&i.url===e)returnvoidy.logger.trace("playlist request ongoing");y.logger.warn("abort previous loader for type:"+t.type),r.abort()}vara=this.hls.config,n=void0,s=void0,o=void0,l=void0;"manifest"===t.type?(n=a.manifestLoadingMaxRetry,s=a.manifestLoadingTimeOut,o=a.manifestLoadingRetryDelay,l=a.manifestLoadingMaxRetryTimeout):(n=a.levelLoadingMaxRetry,s=a.levelLoadingTimeOut,o=a.levelLoadingRetryDelay,l=a.levelLoadingMaxRetryTimeout,y.logger.log("loading playlist for "+t.type+" "+(t.level||t.id))),r=this.loaders[t.type]=t.loader=void0!==a.pLoader?newa.pLoader(a):newa.loader(a),t.url=e,t.responseType="";varu=void0,d=void0;u={timeout:s,maxRetry:n,retryDelay:o,maxRetryDelay:l},d={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},r.load(t,u,d)}},{key:"resolve",value:function(e,t){returnu.default.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}},{key:"parseMasterPlaylist",value:function(e,t){varr=[],i=void0;for(m.lastIndex=0;null!=(i=m.exec(e));){vara={},n=a.attrs=newp.default(i[1]);a.url=this.resolve(i[2],t);vars=n.decimalResolution("RESOLUTION");s&&(a.width=s.width,a.height=s.height),a.bitrate=n.decimalInteger("AVERAGE-BANDWIDTH")||n.decimalInteger("BANDWIDTH"),a.name=n.NAME;varo=n.CODECS;if(o){o=o.split(/[ ,]+/);for(varl=0;l<o.length;l++){varu=o[l];u.indexOf("avc1")!==-1?a.videoCodec=this.avc1toavcoti(u):a.audioCodec=u}}r.push(a)}returnr}},{key:"parseMasterPlaylistMedia",value:function(e,t,r){vari=void0,a=[],n=0;for(E.lastIndex=0;null!=(i=E.exec(e));){vars={},o=newp.default(i[1]);o.TYPE===r&&(s.groupId=o["GROUP-ID"],s.name=o.NAME,s.type=r,s.default="YES"===o.DEFAULT,s.autoselect="YES"===o.AUTOSELECT,s.forced="YES"===o.FORCED,o.URI&&(s.url=this.resolve(o.URI,t)),s.lang=o.LANGUAGE,s.name||(s.name=s.lang),s.id=n++,a.push(s))}returna}},{key:"avc1toavcoti",value:function(e){vart,r=e.split(".");returnr.length>2?(t=r.shift()+".",t+=parseInt(r.shift()).toString(16),t+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):t=e,t}},{key:"parseLevelPlaylist",value:function(e,t,r,i){vara,n,s=0,o=0,l={type:null,version:null,url:t,fragments:[],live:!0,startSN:0},u=newT,d=0,f=null,c=new_;for(b.lastIndex=0;null!==(a=b.exec(e));){varh=a[1];if(h){c.duration=parseFloat(h);varg=(" "+a[2]).slice(1);c.title=g?g:null,c.tagList.push(g?["INF",h,g]:["INF",h])}elseif(a[3]){if(!isNaN(c.duration)){varv=s++;c.type=i,c.start=o,c.levelkey=u,c.sn=v,c.level=r,c.cc=d,c.baseurl=t,c.relurl=(" "+a[3]).slice(1),l.fragments.push(c),f=c,o+=c.duration,c=new_}}elseif(a[4]){if(c.rawByteRange=(" "+a[4]).slice(1),f){varm=f.byteRangeEndOffset;m&&(c.lastByteRangeEndOffset=m)}}elseif(a[5])c.rawProgramDateTime=(" "+a[5]).slice(1),c.tagList
key:"copy",value:function(e){for(vart=0;t<l;t++)this.chars[t].copy(e.chars[t])}},{key:"isEmpty",value:function(){for(vare=!0,t=0;t<l;t++)if(!this.chars[t].isEmpty()){e=!1;break}returne}},{key:"setCursor",value:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(g.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>l&&(g.log("ERROR","Too large cursor position "+this.pos),this.pos=l)}},{key:"moveCursor",value:function(e){vart=this.pos+e;if(e>1)for(varr=this.pos+1;r<t+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)}},{key:"backSpace",value:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}},{key:"insertChar",value:function(e){e>=144&&this.backSpace();vart=s(e);if(this.pos>=l)returnvoidg.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}},{key:"clearFromPos",value:function(e){vart;for(t=e;t<l;t++)this.chars[t].reset()}},{key:"clear",value:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}},{key:"clearToEndOfRow",value:function(){this.clearFromPos(this.pos)}},{key:"getTextString",value:function(){for(vare=[],t=!0,r=0;r<l;r++){vari=this.chars[r].uchar;" "!==i&&(t=!1),e.push(i)}returnt?"":e.join("")}},{key:"setPenStyles",value:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}]),e}(),E=function(){functione(){i(this,e),this.rows=[];for(vart=0;t<o;t++)this.rows.push(newm);this.currRow=o-1,this.nrRollUpRows=null,this.reset()}returna(e,[{key:"reset",value:function(){for(vare=0;e<o;e++)this.rows[e].clear();this.currRow=o-1}},{key:"equals",value:function(e){for(vart=!0,r=0;r<o;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}returnt}},{key:"copy",value:function(e){for(vart=0;t<o;t++)this.rows[t].copy(e.rows[t])}},{key:"isEmpty",value:function(){for(vare=!0,t=0;t<o;t++)if(!this.rows[t].isEmpty()){e=!1;break}returne}},{key:"backSpace",value:function(){this.rows[this.currRow].backSpace()}},{key:"clearToEndOfRow",value:function(){this.rows[this.currRow].clearToEndOfRow()}},{key:"insertChar",value:function(e){this.rows[this.currRow].insertChar(e)}},{key:"setPen",value:function(e){this.rows[this.currRow].setPenStyles(e)}},{key:"moveCursor",value:function(e){this.rows[this.currRow].moveCursor(e)}},{key:"setCursor",value:function(e){g.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)}},{key:"setPAC",value:function(e){g.log("INFO","pacData = "+JSON.stringify(e));vart=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(varr=0;r<o;r++)this.rows[r].clear();vari=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){varn=a.rows[i].cueStartTime;if(n&&n<g.time)for(vars=0;s<this.nrRollUpRows;s++)this.rows[t-this.nrRollUpRows+s+1].copy(a.rows[i+s])}}this.currRow=t;varl=this.rows[this.currRow];if(null!==e.indent){varu=e.indent,d=Math.max(u-1,0);l.setCursor(e.indent),e.color=l.chars[d].penState.foreground}varf={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(f)}},{key:"setBkgData",value:function(e){g.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}},{key:"setRollUpRows",value:function(e){this.nrRollUpRows=e}},{key:"rollUp",value:function(){if(null===this.nrRollUpRows)returnvoidg.log("DEBUG","roll_up but nrRollUpRows not set yet");g.log("TEXT",this.getDisplayText());vare=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),g.log("INFO","Rolling up")}},{key:"getDisplayText",value:function(e){e=e||!1;for(vart=[],r="",i=-1,a=0;a<o;a++){varn=this.rows[a].getTextString();n&&(i=a+1,e?t.push("Row "+i+": '"+n+"'"):t.push(n.trim()))}returnt.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r}},{key:"getTextAndFormat",value:function(){returnthis.rows}}]),e}(),b=function(){functione(t,r){i(this,e),this.chNr=t,this.outputFilter=r,this.mode=nu