!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],tinstanceofError)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&&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
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},{32:32,33:33,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(33),u=i(l),d=e(32),f=i(d),c=e(50),h=e(31),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.sourceBuffer.audio;if(Math.abs(i.timestampOffset-e.start)>.1){vara=i.updating;try{i.abort()}catch(e){a=!0,c.logger.warn("can not abort audio buffer: "+e)}a?this.audioTimestampOffset=e.start:(c.logger.warn("change mpeg audio timestamp offset from "+i.timestampOffset+" to "+e.start),i.timestampOffset=e.start)}}}},{key:"onManifestParsed",value:function(e){vart=e.audio,r=e.video,i=0;e.altAudio&&(t||r)&&(i=(t?1:0)+(r?1:0),c.logger.log(i+" sourceBuffer(s) expected")),this.sourceBufferNb=i}},{key:"onMediaAttaching",value:function(e){vart=this.media=e.media;if(t){varr=this.mediaSource=new
;returne.start+e.duration-t<=a?1:e.start-t>a&&e.start?-1:0};if(a<n?(a>n-f&&(f=0),d=c&&!h(c)?c:u.default.search(i,h)):d=i[r-1],d){l=d;varg=l.sn-s.startSN,v=t&&l.level===t.level,p=i[g-1],y=i[g+1];if(v&&l.sn===t.sn)if(l.sn<s.endSN){varm=t.deltaPTS;m&&m>o.maxBufferHole&&t.dropped&&g?(l=p,k.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),t.loadCounter--):(l=y,k.logger.log("SN just loaded, load next one: "+l.sn))}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&&(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="vid
for(vart,r,i,a,n,s=31&e[0],o=2,l=[],u=0;u<s;u++)t=e[o++],r=127&e[o++],i=127&e[o++],a=0!==(4&t),n=3&t,0===r&&0===i||a&&0===n&&(l.push(r),l.push(i));returnl}}]),t}(v.default);r.default=T},{32:32,33:33,47:47,50:50,54:54}],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(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},{}],18:[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=[],this.subMix[0]=newUint32Array(256),this.subMix[1]=newUint32Array(256),this.subMix[2]=newUint32Array(256),this.subMix[3]=newUint32Array(256),this.invSubMix=[],this.invSubMix[0]=newUint32Array(256),this.invSubMix[1]=newUint32Array(256),this.invSubMix[2]=newUint32Array(256),this.invSubMix[3]=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<r.length;i++)r[i]=t.getUint32(4*i);returnr}},{key:"initTable",value:function(){vare=this.sBox,t=this.invSBox,r=this.subMix[0],i=this.subMix[1],a=this.subMix[2],n=this.subMix[3],s=this.invSubMix[0],o=this.invSubMix[1],l=this.invSubMix[2],u=this.invSubMix[3],d=newUint32Array(256),f=0,c=0,h=0;for(h=0;h<256;h++)d[h]=h<128?h<<1:h<<1^283;for(h=0;h<256;h++){varg=c^c<<1^c<<2^c<<3^c<<4;g=g>>>8^255&g^99,e[f]=g,t[g]=f;varv=d[f],p=d[v],y=d[p],m=257*d[g]^16843008*g;r[f]=m<<24|m>>>8,i[f]=m<<16|m>>>16,a[f]=m<<8|m>>>24,n[f]=m,m=16843009*y^65537*p^257*v^16843008*f,s[g]=m<<24|m>>>8,o[g]=m<<16|m>>>16,l[g]=m<<8|m>>>24,u[g]=m,f?(f=v^d[d[d[y^v]]],c^=d[d[c]]):f=c=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(this.ksRows),u=this.invKeySchedule=newUint32Array(this.ksRows),d=this.sBox,f=this.rcon,c=this.invSubMix[0],h=this.invSubMix[1],g=this.invSubMix[2],v=this.invSubMix[3],p=void0,y=void0;for(s=0;s<n;s++)s<a?p=l[s]=t[s]:(y=p,s%a===0?(y=y<<8|y>>>24,y=d[y>>>24]<<24|d[y>>>16&255]<<16|d[y>>>8&255]<<8|d[255&y],y^=f[s/a|0]<<24):a>6&&s%a===4&&(y=d[y>>>24]<<24|d[y>>>16&255]<<16|d[y>>>8&255]<<8|d[255&y]),l[s]=p=(l[s-a]^y)>>>0);for(o=0;o<n;o++)s=n-o,y=3&o?l[s]:l[s-4],u[o]=o<4||s<=4?y:c[d[y>>>24]]^h[d[y>>>16&255]]^g[d[y>>>8&255]]^v[d[255&y]],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[0],u=this.invSubMix[1],d=this.invSubMix[2],f=this.invSubMix[3],c=this.uint8ArrayToUint32Array_(r),h=c[0],g=c[1],v=c[2],p=c[3],y=newInt32Array(e),m=newInt32Array(y.length),E=void0,b=void0,T=void0,_=void0,k=void0,R=void0,A=void0,S=void0,L=void0,w=void0,D=void0,O=void0;t<y.length;){for(L=this.networkToHostOrderSwap(y[t]),w=this.networkToHostOrderSwap(y[t+1]),D=this.networkToHostOrderSwap(y[t+2]),O=this.networkToHostOrderSw
case15:l.audio===-1&&(l.audio=o);break;case21:l.id3===-1&&(l.id3=o);break;case219:if(!i){g.logger.log("unkown stream type:"+e[t]);break}case27:l.avc===-1&&(l.avc=o);break;case3:case4:r?l.audio===-1&&(l.audio=o,l.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser for now");break;case36:g.logger.warn("HEVC stream type found, not supported for now");break;default:g.logger.log("unkown stream type:"+e[t])}t+=((15&e[t+3])<<8|e[t+4])+5}returnl}},{key:"_parsePES",value:function(e){vart,r,i,a,n,s,o,l,u,d=0,f=e.data;if(!e||0===e.size)returnnull;for(;f[0].length<19&&f.length>1;){varc=newUint8Array(f[0].length+f[1].length);c.set(f[0]),c.set(f[1],f[0].length),f[0]=c,f.splice(1,1)}if(t=f[0],i=(t[0]<<16)+(t[1]<<8)+t[2],1===i){if(a=(t[4]<<8)+t[5],a&&a>e.size-6)returnnull;r=t[7],192&r&&(o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,o>4294967295&&(o-=8589934592),64&r?(l=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,l>4294967295&&(l-=8589934592),o-l>54e5&&(g.logger.warn(Math.round((o-l)/9e4)+"s delta between PTS and DTS, align them"),o=l)):l=o),n=t[8],u=n+9,e.size-=u,s=newUint8Array(e.size);for(varh=0,v=f.length;h<v;h++){t=f[h];varp=t.byteLength;if(u){if(u>p){u-=p;continue}t=t.subarray(u),p-=u,u=0}s.set(t,d),d+=p}returna&&(a-=n+3),{data:s,pts:o,dts:l,len:a}}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;dog=r.readUByte(),d+=g;while(255===g);c=0;dog=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,r
value:function(e){for(vart=newUint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;returnt}},{key:"fragmentDecryptdataFromLevelkey",value:function(e,t){varr=e;returne&&e.method&&e.uri&&!e.iv&&(r=newT,r.method=e.method,r.baseuri=e.baseuri,r.reluri=e.reluri,r.iv=this.createInitializationVector(t)),r}},{key:"cloneObj",value:function(e){returnJSON.parse(JSON.stringify(e))}},{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=u.default.buildAbsoluteURL(this.baseurl,this.relurl)),this._url},set:function(e){this._url=e}},{key:"programDateTime",get:function(){return!this._programDateTime&&this.rawProgramDateTime&&(this._programDateTime=newDate(Date.parse(this.rawProgramDateTime))),this._programDateTime}},{key:"byteRange",get:function(){if(!this._byteRange){vare=this._byteRange=[];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)}},{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+=parseI
return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}]),e}(),v=function(){functione(t,r,a,n,s,o){i(this,e),this.uchar=t||" ",this.penState=newg(r,a,n,s,o)}returna(e,[{key:"reset",value:function(){this.uchar=" ",this.penState.reset()}},{key:"setChar",value:function(e,t){this.uchar=e,this.penState.copy(t)}},{key:"setPenState",value:function(e){this.penState.copy(e)}},{key:"equals",value:function(e){returnthis.uchar===e.uchar&&this.penState.equals(e.penState)}},{key:"copy",value:function(e){this.uchar=e.uchar,this.penState.copy(e.penState)}},{key:"isEmpty",value:function(){return" "===this.uchar&&this.penState.isDefault()}}]),e}(),p=function(){functione(){i(this,e),this.chars=[];for(vart=0;t<100;t++)this.chars.push(newv);this.pos=0,this.currPenState=newg}returna(e,[{key:"equals",value:function(e){for(vart=!0,r=0;r<100;r++)if(!this.chars[r].equals(e.chars[r])){t=!1;break}returnt}},{key:"copy",value:function(e){for(vart=0;t<100;t++)this.chars[t].copy(e.chars[t])}},{key:"isEmpty",value:function(){for(vare=!0,t=0;t<100;t++)if(!this.chars[t].isEmpty()){e=!1;break}returne}},{key:"setCursor",value:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(c.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(c.log("ERROR","Too large cursor position "+this.pos),this.pos=100)}},{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>=100)returnvoidc.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<100;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<100;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}(),y=function(){functione(){i(this,e),this.rows=[];for(vart=0;t<15;t++)this.rows.push(newp);this.currRow=14,this.nrRollUpRows=null,this.reset()}returna(e,[{key:"reset",value:function(){for(vare=0;e<15;e++)this.rows[e].clear();this.currRow=14}},{key:"equals",value:function(e){for(vart=!0,r=0;r<15;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}returnt}},{key:"copy",value:function(e){for(vart=0;t<15;t++)this.rows[t].copy(e.rows[t])}},{key:"isEmpty",value:function(){for(vare=!0,t=0;t<15;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){c.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)}},{key:"setPAC",value:function(e){c.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<15;r++)this.rows[r].clear();vari=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){varn=a.rows[i].cueStartTime;if(n&&n<c.time)for(vars=0;s<this.nrRollUpRows;s++)this.rows[t-this.nrRollUpRows+s+1].copy(a.rows[i+s])}}this.currRow=t;varo=this.rows[this.currRow];if(null!==e.indent){varl=e.indent,u=Math.max(l-1,0);o.setCursor(e.indent),e.color=o.chars[u].penState.for