Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hls-parser

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hls-parser - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

4

dist/hls-parser.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HLS=e():t.HLS=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=9)}([function(t,e,r){"use strict";(function(e){var r=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function n(t){throw t}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if("number"==typeof t)return t;var r=void 0;return r=10===e?parseFloat(t,e):parseInt(t,e),isNaN(r)?0:r}t.exports={THROW:n,ASSERT:function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];var a=!0,s=!1,u=void 0;try{for(var f,h=i.entries()[Symbol.iterator]();!(a=(f=h.next()).done);a=!0){var l=r(f.value,2),c=l[0];l[1]||n(new Error(t+" : Failed at ["+c+"]"))}}catch(t){s=!0,u=t}finally{try{!a&&h.return&&h.return()}finally{if(s)throw u}}},CONDITIONALASSERT:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var h=r(u.value,2),l=h[0],c=r(h[1],2),E=c[0],p=c[1];E&&(p||n(new Error("Conditional Assert : Failed at ["+l+"]")))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},PARAMCHECK:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var h=r(u.value,2),l=h[0];void 0===h[1]&&n(new Error("Param Check : Failed at ["+l+"]"))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},CONDITIONALPARAMCHECK:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var h=r(u.value,2),l=h[0],c=r(h[1],2),E=c[0],p=c[1];E&&void 0===p&&n(new Error("Conditional Param Check : Failed at ["+l+"]"))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},INVALIDPLAYLIST:function(t){n(new Error("Invalid Playlist : "+t))},toNumber:i,hexToByteSequence:function(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var r=[],n=0;n<t.length;n+=2)r.push(i(t.substr(n,2),16));return e.from(r)},byteSequenceToHex:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;r<=e&&n(new Error("end must be larger than start : start="+e+", end="+r));for(var i=[],o=e;o<r;o++)i.push(("0"+(255&t[o]).toString(16).toUpperCase()).slice(-2));return"0x"+i.join("")},tryCatch:function(t,e){try{return t()}catch(t){return e(t)}},splitAt:function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=-1,i=0,o=0;i<t.length;i++)if(t[i]===e){if(o++===r)return[t.slice(0,i),t.slice(i+1)];n=i}return-1!==n?[t.slice(0,n),t.slice(n+1)]:[t]},trim:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return t?(t=t.trim()," "===e?t:(t.startsWith(e)&&(t=t.slice(1)),t.endsWith(e)&&(t=t.slice(0,-1)),t)):t},splitByCommaWithPreservingQuotes:function(t){for(var e=[],r=!0,n=0,i=[],o=0;o<t.length;o++){var a=t[o];r&&","===a?(e.push(t.slice(n,o).trim()),n=o+1):'"'!==a&&"'"!==a||(r?(i.push(a),r=!1):a===i[i.length-1]?(i.pop(),r=!0):i.push(a))}return e.push(t.slice(n).trim()),e},camelify:function(t){var e=[],r=!1,n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;"-"!==u&&"_"!==u?r?(e.push(u.toUpperCase()),r=!1):e.push(u.toLowerCase()):r=!0}}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return e.join("")},formatDate:function(t){return t.getUTCFullYear()+"-"+("0"+(t.getUTCMonth()+1)).slice(-2)+"-"+("0"+t.getUTCDate()).slice(-2)+"T"+("0"+t.getUTCHours()).slice(-2)+":"+("0"+t.getUTCMinutes()).slice(-2)+":"+("0"+t.getUTCSeconds()).slice(-2)+"."+("00"+t.getUTCMilliseconds()).slice(-3)+"Z"},hasOwnProp:function(t,e){return Object.hasOwnProperty.call(t,e)}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=r(0),s=function t(e){o(this,t),a.PARAMCHECK(e),this.type=e},u=function(t){function e(t){var r=t.isMasterPlaylist,i=t.uri,s=t.version,u=t.independentSegments,f=void 0!==u&&u,h=t.start,l=t.source;o(this,e);var c=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"playlist"));return a.PARAMCHECK(r),c.isMasterPlaylist=r,c.uri=i,c.version=s,c.independentSegments=f,c.start=h,c.source=l,c}return i(e,s),e}(),f=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t.isMasterPlaylist=!0;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.variants,a=void 0===i?[]:i,s=t.currentVariant,u=t.sessionDataList,f=void 0===u?[]:u,h=t.sessionKeyList,l=void 0===h?[]:h;return r.variants=a,r.currentVariant=s,r.sessionDataList=f,r.sessionKeyList=l,r}return i(e,u),e}(),h=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t.isMasterPlaylist=!1;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.targetDuration,a=t.mediaSequenceBase,s=void 0===a?0:a,u=t.discontinuitySequenceBase,f=void 0===u?0:u,h=t.endlist,l=void 0!==h&&h,c=t.playlistType,E=t.isIFrame,p=t.segments,T=void 0===p?[]:p,y=t.hash;return r.targetDuration=i,r.mediaSequenceBase=s,r.discontinuitySequenceBase=f,r.endlist=l,r.playlistType=c,r.isIFrame=E,r.segments=T,r.hash=y,r}return i(e,u),e}(),l=function(t){function e(t){var r=t.uri,i=t.mimeType,s=t.data,u=t.duration,f=t.title,h=t.byterange,l=t.discontinuity,c=t.mediaSequenceNumber,E=t.discontinuitySequence,p=t.key,T=t.map,y=t.programDateTime,d=t.dateRange;o(this,e);var A=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"segment"));return a.PARAMCHECK(r,c,E),A.uri=r,A.mimeType=i,A.data=s,A.duration=u,A.title=f,A.byterange=h,A.discontinuity=l,A.mediaSequenceNumber=c,A.discontinuitySequence=E,A.key=p,A.map=T,A.programDateTime=y,A.dateRange=d,A}return i(e,s),e}();t.exports={Rendition:function t(e){var r=e.type,n=e.uri,i=e.groupId,s=e.language,u=e.assocLanguage,f=e.name,h=e.isDefault,l=e.autoselect,c=e.forced,E=e.instreamId,p=e.characteristics,T=e.channels;o(this,t),a.PARAMCHECK(r,i,f),a.CONDITIONALASSERT(["SUBTITLES"===r,n],["CLOSED-CAPTIONS"===r,E],["CLOSED-CAPTIONS"===r,!n],[c,"CLOSED-CAPTIONS"===r]),this.type=r,this.uri=n,this.groupId=i,this.language=s,this.assocLanguage=u,this.name=f,this.isDefault=h,this.autoselect=l,this.forced=c,this.instreamId=E,this.characteristics=p,this.channels=T},Variant:function t(e){var r=e.uri,n=e.isIFrameOnly,i=void 0!==n&&n,s=e.bandwidth,u=e.averageBandwidth,f=e.codecs,h=e.resolution,l=e.frameRate,c=e.hdcpLevel,E=e.audio,p=void 0===E?[]:E,T=e.video,y=void 0===T?[]:T,d=e.subtitles,A=void 0===d?[]:d,g=e.closedCaptions,v=void 0===g?[]:g,I=e.currentRenditions,S=void 0===I?{AUDIO:0,VIDEO:0,SUBTITLES:0,"CLOSED-CAPTIONS":0}:I;o(this,t),a.PARAMCHECK(r,s),this.uri=r,this.isIFrameOnly=i,this.bandwidth=s,this.averageBandwidth=u,this.codecs=f,this.resolution=h,this.frameRate=l,this.hdcpLevel=c,this.audio=p,this.video=y,this.subtitles=A,this.closedCaptions=v,this.currentRenditions=S},SessionData:function t(e){var r=e.id,n=e.value,i=e.uri,s=e.language;o(this,t),a.PARAMCHECK(r,n||i),a.ASSERT("SessionData cannot have both value and uri, shoud be either.",!(n&&i)),this.id=r,this.value=n,this.uri=i,this.language=s},Key:function t(e){var r=e.method,n=e.uri,i=e.iv,s=e.format,u=e.formatVersion;o(this,t),a.PARAMCHECK(r),a.CONDITIONALPARAMCHECK(["NONE"!==r,n]),a.CONDITIONALASSERT(["NONE"===r,!(n||i||s||u)]),this.method=r,this.uri=n,this.iv=i,this.format=s,this.formatVersion=u},MediaInitializationSection:function t(e){var r=e.uri,n=e.mimeType,i=e.byterange;o(this,t),a.PARAMCHECK(r),this.uri=r,this.mimeType=n,this.byterange=i},DateRange:function t(e){var r=e.id,n=e.classId,i=e.start,s=e.end,u=e.duration,f=e.plannedDuration,h=e.endOnNext,l=e.attributes,c=void 0===l?{}:l;o(this,t),a.PARAMCHECK(r,i),a.CONDITIONALPARAMCHECK([!0===h,n]),a.CONDITIONALASSERT([s,i<=s],[u,u>=0],[f,f>=0]),this.id=r,this.classId=n,this.start=i,this.end=s,this.duration=u,this.plannedDuration=f,this.endOnNext=h,this.attributes=c},Playlist:u,MasterPlaylist:f,MediaPlaylist:h,Segment:l}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(n):void 0};var o=r(0),a=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-STREAM-INF"],s=["#EXT-X-KEY","#EXT-X-MEDIA"],u=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.baseUri=t,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,Array),n(e,[{key:"push",value:function(){for(var t=this,r=arguments.length,n=Array(r),u=0;u<r;u++)n[u]=arguments[u];var f=!0,h=!1,l=void 0;try{for(var c,E=function(){var r=c.value;if(a.some(function(t){return r.startsWith(t)}))return i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r),"continue";if(t.includes(r)){if(s.some(function(t){return r.startsWith(t)}))return"continue";o.INVALIDPLAYLIST("Redundant item ("+r+")")}i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r)},p=n[Symbol.iterator]();!(f=(c=p.next()).done);f=!0)E()}catch(t){h=!0,l=t}finally{try{!f&&p.return&&p.return()}finally{if(h)throw l}}}}]),e}();function f(t,e){var r=['DATA-ID="'+e.id+'"'];e.language&&r.push('LANGUAGE="'+e.language+'"'),e.value?r.push('VALUE="'+e.value+'"'):e.uri&&r.push('URI="'+e.uri+'"'),t.push("#EXT-X-SESSION-DATA:"+r.join(","))}function h(t,e,r){var n=r?"#EXT-X-SESSION-KEY":"#EXT-X-KEY",i=["METHOD="+e.method];e.uri&&i.push('URI="'+e.uri+'"'),e.iv&&(16!==e.iv.length&&o.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i.push("IV="+o.byteSequenceToHex(e.iv))),e.format&&i.push('KEYFORMAT="'+e.format+'"'),e.formatVersion&&i.push('KEYFORMATVERSIONS="'+e.formatVersion+'"'),t.push(n+":"+i.join(","))}function l(t,e){var r=e.isIFrameOnly?"#EXT-X-I-FRAME-STREAM-INF":"#EXT-X-STREAM-INF",n=["BANDWIDTH="+e.bandwidth];if(e.averageBandwidth&&n.push("AVERAGE-BANDWIDTH="+e.averageBandwidth),e.isIFrameOnly&&n.push('URI="'+e.uri+'"'),e.codecs&&n.push('CODECS="'+e.codecs+'"'),e.resolution&&n.push("RESOLUTION="+e.resolution.width+"x"+e.resolution.height),e.frameRate&&n.push("FRAME-RATE="+e.frameRate),e.hdcpLevel&&n.push("HDCP-LEVEL="+e.hdcpLevel),e.audio.length>0){n.push('AUDIO="'+e.audio[0].groupId+'"');var i=!0,o=!1,a=void 0;try{for(var s,u=e.audio[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){c(t,s.value)}}catch(t){o=!0,a=t}finally{try{!i&&u.return&&u.return()}finally{if(o)throw a}}}if(e.video.length>0){n.push('VIDEO="'+e.video[0].groupId+'"');var f=!0,h=!1,l=void 0;try{for(var E,p=e.video[Symbol.iterator]();!(f=(E=p.next()).done);f=!0){c(t,E.value)}}catch(t){h=!0,l=t}finally{try{!f&&p.return&&p.return()}finally{if(h)throw l}}}if(e.subtitles.length>0){n.push('SUBTITLES="'+e.subtitles[0].groupId+'"');var T=!0,y=!1,d=void 0;try{for(var A,g=e.subtitles[Symbol.iterator]();!(T=(A=g.next()).done);T=!0){c(t,A.value)}}catch(t){y=!0,d=t}finally{try{!T&&g.return&&g.return()}finally{if(y)throw d}}}if(e.closedCaptions.length>0){n.push('CLOSED-CAPTIONS="'+e.closedCaptions[0].groupId+'"');var v=!0,I=!1,S=void 0;try{for(var m,N=e.closedCaptions[Symbol.iterator]();!(v=(m=N.next()).done);v=!0){c(t,m.value)}}catch(t){I=!0,S=t}finally{try{!v&&N.return&&N.return()}finally{if(I)throw S}}}t.push(r+":"+n.join(",")),e.isIFrameOnly||t.push(""+e.uri)}function c(t,e){var r=["TYPE="+e.type,'GROUP-ID="'+e.groupId+'"','NAME="'+e.name+'"'];void 0!==e.isDefault&&r.push("DEFAULT="+(e.isDefault?"YES":"NO")),void 0!==e.autoselect&&r.push("AUTOSELECT="+(e.autoselect?"YES":"NO")),void 0!==e.forced&&r.push("FORCED="+(e.forced?"YES":"NO")),e.language&&r.push('LANGUAGE="'+e.language+'"'),e.assocLanguage&&r.push('ASSOC-LANGUAGE="'+e.assocLanguage+'"'),e.instreamId&&r.push('INSTREAM-ID="'+e.instreamId+'"'),e.characteristics&&r.push('CHARACTERISTICS="'+e.characteristics+'"'),e.channels&&r.push('CHANNELS="'+e.channels+'"'),e.uri&&r.push('URI="'+e.uri+'"'),t.push("#EXT-X-MEDIA:"+r.join(","))}function E(t,e){e.byterange&&t.push("#EXT-X-BYTERANGE:"+e.byterange.length+"@"+e.byterange.offset),e.discontinuity&&t.push("#EXT-X-DISCONTINUITY"),e.key&&h(t,e.key),e.map&&function(t,e){var r=['URI="'+e.uri+'"'];e.byterange&&r.push("BYTERANGE="+e.byterange);t.push("#EXT-X-MAP:"+r.join(","))}(t,e.map),e.programDateTime&&t.push("#EXT-X-PROGRAM-DATE-TIME:"+o.formatDate(e.programDateTime)),e.dateRange&&function(t,e){var r=['ID="'+e.id+'"','START-DATE="'+o.formatDate(e.start)+'"'];e.end&&r.push('END-DATE="'+e.end+'"');e.duration&&r.push("DURATION="+e.duration);e.plannedDuration&&r.push("PLANNED-DURATION="+e.plannedDuration);e.classId&&r.push('CLASS="'+e.classId+'"');e.endOnNext&&r.push("END-ON-NEXT=YES");Object.keys(e.attributes).forEach(function(t){t.startsWith("X-")?"number"==typeof e.attributes[t]?r.push(t+"="+e.attributes[t]):r.push(t+'="'+e.attributes[t]+'"'):t.startsWith("SCTE35-")&&r.push(t+"="+o.byteSequenceToHex(e.attributes[t]))}),t.push("#EXT-X-DATERANGE:"+r.join(","))}(t,e.dateRange),t.push("#EXTINF:"+e.duration+","+unescape(encodeURIComponent(e.title||""))),t.push(""+e.uri)}t.exports=function(t){o.PARAMCHECK(t),o.ASSERT("Not a playlist","playlist"===t.type);var e=new u(t.uri);return e.push("#EXTM3U"),t.version&&e.push("#EXT-X-VERSION:"+t.version),t.independentSegments&&e.push("#EXT-X-INDEPENDENT-SEGMENTS:"+t.independentSegments),t.start&&e.push("#EXT-X-START:TIME-OFFSET="+t.start.offset+(t.start.precise?",PRECISE=YES":"")),t.isMasterPlaylist?function(t,e){var r=!0,n=!1,i=void 0;try{for(var o,a=e.sessionDataList[Symbol.iterator]();!(r=(o=a.next()).done);r=!0)f(t,o.value)}catch(t){n=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}var s=!0,u=!1,c=void 0;try{for(var E,p=e.sessionKeyList[Symbol.iterator]();!(s=(E=p.next()).done);s=!0)h(t,E.value,!0)}catch(t){u=!0,c=t}finally{try{!s&&p.return&&p.return()}finally{if(u)throw c}}var T=!0,y=!1,d=void 0;try{for(var A,g=e.variants[Symbol.iterator]();!(T=(A=g.next()).done);T=!0)l(t,A.value)}catch(t){y=!0,d=t}finally{try{!T&&g.return&&g.return()}finally{if(y)throw d}}}(e,t):function(t,e){e.targetDuration&&t.push("#EXT-X-TARGETDURATION:"+e.targetDuration),e.mediaSequenceBase&&t.push("#EXT-X-MEDIA-SEQUENCE:"+e.mediaSequenceBase),e.discontinuitySequenceBase&&t.push("#EXT-X-DISCONTINUITY-SEQUENCE:"+e.discontinuitySequenceBase),e.playlistType&&t.push("#EXT-X-PLAYLIST-TYPE:"+e.playlistType),e.isIFrame&&t.push("#EXT-X-I-FRAMES-ONLY");var r=!0,n=!1,i=void 0;try{for(var o,a=e.segments[Symbol.iterator]();!(r=(o=a.next()).done);r=!0)E(t,o.value)}catch(t){n=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}e.endlist&&t.push("#EXT-X-ENDLIST")}(e,t),e.join("\n")}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,f=u>>1,h=-7,l=r?i-1:0,c=r?-1:1,E=t[e+l];for(l+=c,o=E&(1<<-h)-1,E>>=-h,h+=s;h>0;o=256*o+t[e+l],l+=c,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+l],l+=c,h-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(E?-1:1);a+=Math.pow(2,n),o-=f}return(E?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,f=8*o-i-1,h=(1<<f)-1,l=h>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:o-1,p=n?1:-1,T=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+l>=1?c/u:c*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[r+E]=255&s,E+=p,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;t[r+E]=255&a,E+=p,a/=256,f-=8);t[r+E-p]|=128*T}},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){for(var e,r=f(t),n=r[0],a=r[1],s=new o(function(t,e,r){return 3*(e+r)/4-r}(0,n,a)),u=0,h=a>0?n-4:n,l=0;l<h;l+=4)e=i[t.charCodeAt(l)]<<18|i[t.charCodeAt(l+1)]<<12|i[t.charCodeAt(l+2)]<<6|i[t.charCodeAt(l+3)],s[u++]=e>>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=i[t.charCodeAt(l)]<<2|i[t.charCodeAt(l+1)]>>4,s[u++]=255&e);1===a&&(e=i[t.charCodeAt(l)]<<10|i[t.charCodeAt(l+1)]<<4|i[t.charCodeAt(l+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(h(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HLS=e():t.HLS=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=9)}([function(t,e,r){"use strict";(function(e){var r=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function n(t){throw t}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if("number"==typeof t)return t;var r=void 0;return r=10===e?parseFloat(t,e):parseInt(t,e),isNaN(r)?0:r}t.exports={THROW:n,ASSERT:function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];var a=!0,s=!1,u=void 0;try{for(var f,l=i.entries()[Symbol.iterator]();!(a=(f=l.next()).done);a=!0){var h=r(f.value,2),c=h[0];h[1]||n(new Error(t+" : Failed at ["+c+"]"))}}catch(t){s=!0,u=t}finally{try{!a&&l.return&&l.return()}finally{if(s)throw u}}},CONDITIONALASSERT:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var l=r(u.value,2),h=l[0],c=r(l[1],2),E=c[0],p=c[1];E&&(p||n(new Error("Conditional Assert : Failed at ["+h+"]")))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},PARAMCHECK:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var l=r(u.value,2),h=l[0];void 0===l[1]&&n(new Error("Param Check : Failed at ["+h+"]"))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},CONDITIONALPARAMCHECK:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var l=r(u.value,2),h=l[0],c=r(l[1],2),E=c[0],p=c[1];E&&void 0===p&&n(new Error("Conditional Param Check : Failed at ["+h+"]"))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},INVALIDPLAYLIST:function(t){n(new Error("Invalid Playlist : "+t))},toNumber:i,hexToByteSequence:function(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var r=[],n=0;n<t.length;n+=2)r.push(i(t.substr(n,2),16));return e.from(r)},byteSequenceToHex:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;r<=e&&n(new Error("end must be larger than start : start="+e+", end="+r));for(var i=[],o=e;o<r;o++)i.push(("0"+(255&t[o]).toString(16).toUpperCase()).slice(-2));return"0x"+i.join("")},tryCatch:function(t,e){try{return t()}catch(t){return e(t)}},splitAt:function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=-1,i=0,o=0;i<t.length;i++)if(t[i]===e){if(o++===r)return[t.slice(0,i),t.slice(i+1)];n=i}return-1!==n?[t.slice(0,n),t.slice(n+1)]:[t]},trim:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return t?(t=t.trim()," "===e?t:(t.startsWith(e)&&(t=t.slice(1)),t.endsWith(e)&&(t=t.slice(0,-1)),t)):t},splitByCommaWithPreservingQuotes:function(t){for(var e=[],r=!0,n=0,i=[],o=0;o<t.length;o++){var a=t[o];r&&","===a?(e.push(t.slice(n,o).trim()),n=o+1):'"'!==a&&"'"!==a||(r?(i.push(a),r=!1):a===i[i.length-1]?(i.pop(),r=!0):i.push(a))}return e.push(t.slice(n).trim()),e},camelify:function(t){var e=[],r=!1,n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;"-"!==u&&"_"!==u?r?(e.push(u.toUpperCase()),r=!1):e.push(u.toLowerCase()):r=!0}}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return e.join("")},formatDate:function(t){return t.getUTCFullYear()+"-"+("0"+(t.getUTCMonth()+1)).slice(-2)+"-"+("0"+t.getUTCDate()).slice(-2)+"T"+("0"+t.getUTCHours()).slice(-2)+":"+("0"+t.getUTCMinutes()).slice(-2)+":"+("0"+t.getUTCSeconds()).slice(-2)+"."+("00"+t.getUTCMilliseconds()).slice(-3)+"Z"},hasOwnProp:function(t,e){return Object.hasOwnProperty.call(t,e)}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=r(0),s=function t(e){o(this,t),a.PARAMCHECK(e),this.type=e},u=function(t){function e(t){var r=t.isMasterPlaylist,i=t.uri,s=t.version,u=t.independentSegments,f=void 0!==u&&u,l=t.start,h=t.source;o(this,e);var c=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"playlist"));return a.PARAMCHECK(r),c.isMasterPlaylist=r,c.uri=i,c.version=s,c.independentSegments=f,c.start=l,c.source=h,c}return i(e,s),e}(),f=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t.isMasterPlaylist=!0;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.variants,a=void 0===i?[]:i,s=t.currentVariant,u=t.sessionDataList,f=void 0===u?[]:u,l=t.sessionKeyList,h=void 0===l?[]:l;return r.variants=a,r.currentVariant=s,r.sessionDataList=f,r.sessionKeyList=h,r}return i(e,u),e}(),l=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t.isMasterPlaylist=!1;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.targetDuration,a=t.mediaSequenceBase,s=void 0===a?0:a,u=t.discontinuitySequenceBase,f=void 0===u?0:u,l=t.endlist,h=void 0!==l&&l,c=t.playlistType,E=t.isIFrame,p=t.segments,T=void 0===p?[]:p,y=t.hash;return r.targetDuration=i,r.mediaSequenceBase=s,r.discontinuitySequenceBase=f,r.endlist=h,r.playlistType=c,r.isIFrame=E,r.segments=T,r.hash=y,r}return i(e,u),e}(),h=function(t){function e(t){var r=t.uri,i=t.mimeType,s=t.data,u=t.duration,f=t.title,l=t.byterange,h=t.discontinuity,c=t.mediaSequenceNumber,E=t.discontinuitySequence,p=t.key,T=t.map,y=t.programDateTime,d=t.dateRange;o(this,e);var A=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"segment"));return a.PARAMCHECK(r,c,E),A.uri=r,A.mimeType=i,A.data=s,A.duration=u,A.title=f,A.byterange=l,A.discontinuity=h,A.mediaSequenceNumber=c,A.discontinuitySequence=E,A.key=p,A.map=T,A.programDateTime=y,A.dateRange=d,A}return i(e,s),e}();t.exports={Rendition:function t(e){var r=e.type,n=e.uri,i=e.groupId,s=e.language,u=e.assocLanguage,f=e.name,l=e.isDefault,h=e.autoselect,c=e.forced,E=e.instreamId,p=e.characteristics,T=e.channels;o(this,t),a.PARAMCHECK(r,i,f),a.CONDITIONALASSERT(["SUBTITLES"===r,n],["CLOSED-CAPTIONS"===r,E],["CLOSED-CAPTIONS"===r,!n],[c,"CLOSED-CAPTIONS"===r]),this.type=r,this.uri=n,this.groupId=i,this.language=s,this.assocLanguage=u,this.name=f,this.isDefault=l,this.autoselect=h,this.forced=c,this.instreamId=E,this.characteristics=p,this.channels=T},Variant:function t(e){var r=e.uri,n=e.isIFrameOnly,i=void 0!==n&&n,s=e.bandwidth,u=e.averageBandwidth,f=e.codecs,l=e.resolution,h=e.frameRate,c=e.hdcpLevel,E=e.audio,p=void 0===E?[]:E,T=e.video,y=void 0===T?[]:T,d=e.subtitles,A=void 0===d?[]:d,g=e.closedCaptions,v=void 0===g?[]:g,I=e.currentRenditions,S=void 0===I?{AUDIO:0,VIDEO:0,SUBTITLES:0,"CLOSED-CAPTIONS":0}:I;o(this,t),a.PARAMCHECK(r,s),this.uri=r,this.isIFrameOnly=i,this.bandwidth=s,this.averageBandwidth=u,this.codecs=f,this.resolution=l,this.frameRate=h,this.hdcpLevel=c,this.audio=p,this.video=y,this.subtitles=A,this.closedCaptions=v,this.currentRenditions=S},SessionData:function t(e){var r=e.id,n=e.value,i=e.uri,s=e.language;o(this,t),a.PARAMCHECK(r,n||i),a.ASSERT("SessionData cannot have both value and uri, shoud be either.",!(n&&i)),this.id=r,this.value=n,this.uri=i,this.language=s},Key:function t(e){var r=e.method,n=e.uri,i=e.iv,s=e.format,u=e.formatVersion;o(this,t),a.PARAMCHECK(r),a.CONDITIONALPARAMCHECK(["NONE"!==r,n]),a.CONDITIONALASSERT(["NONE"===r,!(n||i||s||u)]),this.method=r,this.uri=n,this.iv=i,this.format=s,this.formatVersion=u},MediaInitializationSection:function t(e){var r=e.uri,n=e.mimeType,i=e.byterange;o(this,t),a.PARAMCHECK(r),this.uri=r,this.mimeType=n,this.byterange=i},DateRange:function t(e){var r=e.id,n=e.classId,i=e.start,s=e.end,u=e.duration,f=e.plannedDuration,l=e.endOnNext,h=e.attributes,c=void 0===h?{}:h;o(this,t),a.PARAMCHECK(r,i),a.CONDITIONALPARAMCHECK([!0===l,n]),a.CONDITIONALASSERT([s,i<=s],[u,u>=0],[f,f>=0]),this.id=r,this.classId=n,this.start=i,this.end=s,this.duration=u,this.plannedDuration=f,this.endOnNext=l,this.attributes=c},Playlist:u,MasterPlaylist:f,MediaPlaylist:l,Segment:h}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(n):void 0};var o=r(0),a=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-STREAM-INF"],s=["#EXT-X-KEY","#EXT-X-MEDIA"],u=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.baseUri=t,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,Array),n(e,[{key:"push",value:function(){for(var t=this,r=arguments.length,n=Array(r),u=0;u<r;u++)n[u]=arguments[u];var f=!0,l=!1,h=void 0;try{for(var c,E=function(){var r=c.value;if(a.some(function(t){return r.startsWith(t)}))return i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r),"continue";if(t.includes(r)){if(s.some(function(t){return r.startsWith(t)}))return"continue";o.INVALIDPLAYLIST("Redundant item ("+r+")")}i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r)},p=n[Symbol.iterator]();!(f=(c=p.next()).done);f=!0)E()}catch(t){l=!0,h=t}finally{try{!f&&p.return&&p.return()}finally{if(l)throw h}}}}]),e}();function f(t,e){var r=['DATA-ID="'+e.id+'"'];e.language&&r.push('LANGUAGE="'+e.language+'"'),e.value?r.push('VALUE="'+e.value+'"'):e.uri&&r.push('URI="'+e.uri+'"'),t.push("#EXT-X-SESSION-DATA:"+r.join(","))}function l(t,e,r){var n=r?"#EXT-X-SESSION-KEY":"#EXT-X-KEY",i=["METHOD="+e.method];e.uri&&i.push('URI="'+e.uri+'"'),e.iv&&(16!==e.iv.length&&o.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i.push("IV="+o.byteSequenceToHex(e.iv))),e.format&&i.push('KEYFORMAT="'+e.format+'"'),e.formatVersion&&i.push('KEYFORMATVERSIONS="'+e.formatVersion+'"'),t.push(n+":"+i.join(","))}function h(t,e){var r=e.isIFrameOnly?"#EXT-X-I-FRAME-STREAM-INF":"#EXT-X-STREAM-INF",n=["BANDWIDTH="+e.bandwidth];if(e.averageBandwidth&&n.push("AVERAGE-BANDWIDTH="+e.averageBandwidth),e.isIFrameOnly&&n.push('URI="'+e.uri+'"'),e.codecs&&n.push('CODECS="'+e.codecs+'"'),e.resolution&&n.push("RESOLUTION="+e.resolution.width+"x"+e.resolution.height),e.frameRate&&n.push("FRAME-RATE="+e.frameRate),e.hdcpLevel&&n.push("HDCP-LEVEL="+e.hdcpLevel),e.audio.length>0){n.push('AUDIO="'+e.audio[0].groupId+'"');var i=!0,o=!1,a=void 0;try{for(var s,u=e.audio[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){c(t,s.value)}}catch(t){o=!0,a=t}finally{try{!i&&u.return&&u.return()}finally{if(o)throw a}}}if(e.video.length>0){n.push('VIDEO="'+e.video[0].groupId+'"');var f=!0,l=!1,h=void 0;try{for(var E,p=e.video[Symbol.iterator]();!(f=(E=p.next()).done);f=!0){c(t,E.value)}}catch(t){l=!0,h=t}finally{try{!f&&p.return&&p.return()}finally{if(l)throw h}}}if(e.subtitles.length>0){n.push('SUBTITLES="'+e.subtitles[0].groupId+'"');var T=!0,y=!1,d=void 0;try{for(var A,g=e.subtitles[Symbol.iterator]();!(T=(A=g.next()).done);T=!0){c(t,A.value)}}catch(t){y=!0,d=t}finally{try{!T&&g.return&&g.return()}finally{if(y)throw d}}}if(e.closedCaptions.length>0){n.push('CLOSED-CAPTIONS="'+e.closedCaptions[0].groupId+'"');var v=!0,I=!1,S=void 0;try{for(var m,N=e.closedCaptions[Symbol.iterator]();!(v=(m=N.next()).done);v=!0){c(t,m.value)}}catch(t){I=!0,S=t}finally{try{!v&&N.return&&N.return()}finally{if(I)throw S}}}t.push(r+":"+n.join(",")),e.isIFrameOnly||t.push(""+e.uri)}function c(t,e){var r=["TYPE="+e.type,'GROUP-ID="'+e.groupId+'"','NAME="'+e.name+'"'];void 0!==e.isDefault&&r.push("DEFAULT="+(e.isDefault?"YES":"NO")),void 0!==e.autoselect&&r.push("AUTOSELECT="+(e.autoselect?"YES":"NO")),void 0!==e.forced&&r.push("FORCED="+(e.forced?"YES":"NO")),e.language&&r.push('LANGUAGE="'+e.language+'"'),e.assocLanguage&&r.push('ASSOC-LANGUAGE="'+e.assocLanguage+'"'),e.instreamId&&r.push('INSTREAM-ID="'+e.instreamId+'"'),e.characteristics&&r.push('CHARACTERISTICS="'+e.characteristics+'"'),e.channels&&r.push('CHANNELS="'+e.channels+'"'),e.uri&&r.push('URI="'+e.uri+'"'),t.push("#EXT-X-MEDIA:"+r.join(","))}function E(t,e){e.byterange&&t.push("#EXT-X-BYTERANGE:"+e.byterange.length+"@"+e.byterange.offset),e.discontinuity&&t.push("#EXT-X-DISCONTINUITY"),e.key&&l(t,e.key),e.map&&function(t,e){var r=['URI="'+e.uri+'"'];e.byterange&&r.push("BYTERANGE="+e.byterange);t.push("#EXT-X-MAP:"+r.join(","))}(t,e.map),e.programDateTime&&t.push("#EXT-X-PROGRAM-DATE-TIME:"+o.formatDate(e.programDateTime)),e.dateRange&&function(t,e){var r=['ID="'+e.id+'"','START-DATE="'+o.formatDate(e.start)+'"'];e.end&&r.push('END-DATE="'+e.end+'"');e.duration&&r.push("DURATION="+e.duration);e.plannedDuration&&r.push("PLANNED-DURATION="+e.plannedDuration);e.classId&&r.push('CLASS="'+e.classId+'"');e.endOnNext&&r.push("END-ON-NEXT=YES");Object.keys(e.attributes).forEach(function(t){t.startsWith("X-")?"number"==typeof e.attributes[t]?r.push(t+"="+e.attributes[t]):r.push(t+'="'+e.attributes[t]+'"'):t.startsWith("SCTE35-")&&r.push(t+"="+o.byteSequenceToHex(e.attributes[t]))}),t.push("#EXT-X-DATERANGE:"+r.join(","))}(t,e.dateRange),t.push("#EXTINF:"+e.duration+","+unescape(encodeURIComponent(e.title||""))),t.push(""+e.uri)}t.exports=function(t){o.PARAMCHECK(t),o.ASSERT("Not a playlist","playlist"===t.type);var e=new u(t.uri);return e.push("#EXTM3U"),t.version&&e.push("#EXT-X-VERSION:"+t.version),t.independentSegments&&e.push("#EXT-X-INDEPENDENT-SEGMENTS:"+t.independentSegments),t.start&&e.push("#EXT-X-START:TIME-OFFSET="+t.start.offset+(t.start.precise?",PRECISE=YES":"")),t.isMasterPlaylist?function(t,e){var r=!0,n=!1,i=void 0;try{for(var o,a=e.sessionDataList[Symbol.iterator]();!(r=(o=a.next()).done);r=!0)f(t,o.value)}catch(t){n=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}var s=!0,u=!1,c=void 0;try{for(var E,p=e.sessionKeyList[Symbol.iterator]();!(s=(E=p.next()).done);s=!0)l(t,E.value,!0)}catch(t){u=!0,c=t}finally{try{!s&&p.return&&p.return()}finally{if(u)throw c}}var T=!0,y=!1,d=void 0;try{for(var A,g=e.variants[Symbol.iterator]();!(T=(A=g.next()).done);T=!0)h(t,A.value)}catch(t){y=!0,d=t}finally{try{!T&&g.return&&g.return()}finally{if(y)throw d}}}(e,t):function(t,e){e.targetDuration&&t.push("#EXT-X-TARGETDURATION:"+e.targetDuration),e.mediaSequenceBase&&t.push("#EXT-X-MEDIA-SEQUENCE:"+e.mediaSequenceBase),e.discontinuitySequenceBase&&t.push("#EXT-X-DISCONTINUITY-SEQUENCE:"+e.discontinuitySequenceBase),e.playlistType&&t.push("#EXT-X-PLAYLIST-TYPE:"+e.playlistType),e.isIFrame&&t.push("#EXT-X-I-FRAMES-ONLY");var r=!0,n=!1,i=void 0;try{for(var o,a=e.segments[Symbol.iterator]();!(r=(o=a.next()).done);r=!0)E(t,o.value)}catch(t){n=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}e.endlist&&t.push("#EXT-X-ENDLIST")}(e,t),e.join("\n")}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,f=u>>1,l=-7,h=r?i-1:0,c=r?-1:1,E=t[e+h];for(h+=c,o=E&(1<<-l)-1,E>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=c,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=c,l-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(E?-1:1);a+=Math.pow(2,n),o-=f}return(E?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,f=8*o-i-1,l=(1<<f)-1,h=l>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:o-1,p=n?1:-1,T=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?c/u:c*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+E]=255&s,E+=p,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;t[r+E]=255&a,E+=p,a/=256,f-=8);t[r+E-p]|=128*T}},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){for(var e,r=f(t),n=r[0],a=r[1],s=new o(function(t,e,r){return 3*(e+r)/4-r}(0,n,a)),u=0,l=a>0?n-4:n,h=0;h<l;h+=4)e=i[t.charCodeAt(h)]<<18|i[t.charCodeAt(h+1)]<<12|i[t.charCodeAt(h+2)]<<6|i[t.charCodeAt(h+3)],s[u++]=e>>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=i[t.charCodeAt(h)]<<2|i[t.charCodeAt(h+1)]>>4,s[u++]=255&e);1===a&&(e=i[t.charCodeAt(h)]<<10|i[t.charCodeAt(h+1)]<<4|i[t.charCodeAt(h+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(l(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){
/*!

@@ -8,2 +8,2 @@ * The buffer module from node.js, for the browser.

*/
var n=r(5),i=r(4),o=r(3);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=c(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|E(e.length);return 0===(t=s(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):c(t,e);if("Buffer"===e.type&&o(e.data))return c(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(h(e),t=s(t,e<0?0:0|E(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function c(t,e){var r=e.length<0?0:0|E(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function E(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return x(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function T(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:d(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):d(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var h=-1;for(o=r;o<s;o++)if(f(t,o)===f(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*a}else-1!==h&&(o-=o-h),h=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var l=!0,c=0;c<u;c++)if(f(t,o+c)!==f(e,c)){l=!1;break}if(l)return o}return-1}function A(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function g(t,e,r,n){return G(F(e,t.length-r),t,r,n)}function v(t,e,r,n){return G(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function I(t,e,r,n){return v(t,e,r,n)}function S(t,e,r,n){return G(x(e),t,r,n)}function m(t,e,r,n){return G(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function N(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function b(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,f=t[i],h=null,l=f>239?4:f>223?3:f>191?2:1;if(i+l<=r)switch(l){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function(t){var e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return f(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return h(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return l(null,t)},u.allocUnsafeSlow=function(t){return l(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)T(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)T(this,e,e+3),T(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)T(this,e,e+7),T(this,e+1,e+6),T(this,e+2,e+5),T(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?b(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return X(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return D(this,e,r);case"latin1":case"binary":return w(this,e,r);case"base64":return N(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,s=Math.min(o,a),f=this.slice(n,i),h=t.slice(e,r),l=0;l<s;++l)if(f[l]!==h[l]){o=f[l],a=h[l];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return I(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function D(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function w(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function X(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=V(t[o]);return i}function O(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function M(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function U(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function C(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Y(t,e,r,n,o){return o||C(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function _(t,e,r,n,o){return o||C(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return Y(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return Y(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return _(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return _(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:F(new u(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function x(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(6))},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),o=r(1),a=o.Rendition,s=o.Variant,u=o.SessionData,f=o.Key,h=o.MediaInitializationSection,l=o.DateRange,c=o.MasterPlaylist,E=o.MediaPlaylist,p=o.Segment;function T(t){return i.trim(t,'"')}function y(t){var e=i.splitAt(t,"@");return{length:i.toNumber(e[0]),offset:e[1]?i.toNumber(e[1]):-1}}function d(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function A(t){var e={};return i.splitByCommaWithPreservingQuotes(t).forEach(function(t){var r,o,a=i.splitAt(t,"="),s=n(a,2),u=s[0],f=s[1],h=T(f);switch(u){case"URI":e[u]=h;break;case"START-DATE":case"END-DATE":e[u]=new Date(h);break;case"IV":e[u]=(r=h,16!==(o=i.hexToByteSequence(r)).length&&i.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),o);break;case"BYTERANGE":e[u]=y(h);break;case"RESOLUTION":e[u]=function(t){var e=i.splitAt(t,"x");return{width:i.toNumber(e[0]),height:i.toNumber(e[1])}}(h);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":e[u]="YES"===h;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":e[u]=i.toNumber(h);break;default:u.startsWith("SCTE35-")?e[u]=i.hexToByteSequence(h):u.startsWith("X-")?e[u]=function(t){return t.startsWith('"')?T(t):t.startsWith("0x")||t.startsWith("0X")?i.hexToByteSequence(t):i.toNumber(t)}(f):e[u]=h}}),e}function g(t,e){switch(t){case"EXTM3U":case"EXT-X-DISCONTINUITY":case"EXT-X-ENDLIST":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-INDEPENDENT-SEGMENTS":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[i.toNumber(e),null];case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-DATERANGE":case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":case"EXT-X-START":return[null,A(e)];case"EXTINF":return[function(t){var e=i.splitAt(t,",");return{duration:i.toNumber(e[0]),title:decodeURIComponent(escape(e[1]))}}(e),null];case"EXT-X-BYTERANGE":return[y(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];case"EXT-X-PLAYLIST-TYPE":default:return[e,null]}}function v(){i.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function I(t,e,r){var n,o=(n=e.attributes,new a({type:n.TYPE,uri:n.URI,groupId:n["GROUP-ID"],language:n.LANGUAGE,assocLanguage:n["ASSOC-LANGUAGE"],name:n.NAME,isDefault:n.DEFAULT,autoselect:n.AUTOSELECT,forced:n.FORCED,instreamId:n["INSTREAM-ID"],characteristics:n.CHARACTERISTICS,channels:n.CHANNELS})),s=t[i.camelify(r)],u=function(t,e){var r=!1,n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";u.isDefault&&(r=!0)}}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(s,o);u&&i.INVALIDPLAYLIST(u),s.push(o),o.isDefault&&(t.currentRenditions[r]=s.length-1)}function S(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments[4],a=new s({uri:r,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"]}),u=!0,f=!1,h=void 0;try{for(var l,c=t[Symbol.iterator]();!(u=(l=c.next()).done);u=!0){var E=l.value;if("EXT-X-MEDIA"===E.name){var p=E.attributes,T=p.TYPE;if(T&&p["GROUP-ID"]||i.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[T]===p["GROUP-ID"]&&(I(a,E,T),"CLOSED-CAPTIONS"===T)){var y=!0,d=!1,A=void 0;try{for(var g,v=a.closedCaptions[Symbol.iterator]();!(y=(g=v.next()).done);y=!0){var S=g.value.instreamId;if(S&&S.startsWith("SERVICE")&&o.compatibleVersion<7){o.compatibleVersion=7;break}}}catch(t){d=!0,A=t}finally{try{!y&&v.return&&v.return()}finally{if(d)throw A}}}}}}catch(t){f=!0,h=t}finally{try{!u&&c.return&&c.return()}finally{if(f)throw h}}return function(t,e){["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(r){t[r]&&!e[i.camelify(r)].find(function(e){return e.groupId===t[r]})&&i.INVALIDPLAYLIST(r+" attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is "+r+".")})}(e,a),a.isIFrameOnly=n,a}function m(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.length!==e.iv.length)return!1;for(var r=0;r<t.iv.length;r++)if(t.iv[r]!==e.iv[r])return!1}else if(e.iv)return!1;return t.format===e.format&&t.formatVersion===e.formatVersion}function N(t,e,r,n,o,a,s){for(var u=new p({uri:e,mediaSequenceNumber:o,discontinuitySequence:a}),c=function(e){var r=t[e],n=r.name,o=r.value,a=r.attributes;if("EXTINF"===n)!Number.isInteger(o.duration)&&s.compatibleVersion<3&&(s.compatibleVersion=3),Math.round(o.duration)>s.targetDuration&&i.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),u.duration=o.duration,u.title=o.title;else if("EXT-X-BYTERANGE"===n)s.compatibleVersion<4&&(s.compatibleVersion=4),u.byterange=o;else if("EXT-X-DISCONTINUITY"===n)u.discontinuity=!0;else if("EXT-X-KEY"===n)d(s,a),u.key=new f({method:a.METHOD,uri:a.URI,iv:a.IV,format:a.KEYFORMAT,formatVersion:a.KEYFORMATVERSIONS});else if("EXT-X-MAP"===n)s.compatibleVersion<5&&(s.compatibleVersion=5),s.hasMap=!0,u.map=new h({uri:a.URI,byterange:a.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===n)u.programDateTime=o;else if("EXT-X-DATERANGE"===n){var c={};Object.keys(a).forEach(function(t){(t.startsWith("SCTE35-")||t.startsWith("X-"))&&(c[t]=a[t])}),u.dateRange=new l({id:a.ID,classId:a.CLASS,start:a["START-DATE"],end:a["END-DATE"],duration:a.DURATION,plannedDuration:a["PLANNED-DURATION"],endOnNext:a["END-ON-NEXT"],attributes:c})}},E=r;E<=n;E++)c(E);return u}function b(t,e){var r=new E,o=-1,a=0,s=0,u=null,f=null,h=!0,l=!1,c=void 0;try{for(var p,T=t.entries()[Symbol.iterator]();!(h=(p=T.next()).done);h=!0){var y=n(p.value,2),d=y[0],A=y[1],g=A.name,v=A.value,I=A.attributes;if("Segment"!==A.category){if("EXT-X-VERSION"===g)void 0===r.version?r.version=v:i.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===g)r.targetDuration=e.targetDuration=v;else if("EXT-X-MEDIA-SEQUENCE"===g)(r.segments.length>0||-1!==o)&&i.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.mediaSequenceBase=a=v;else if("EXT-X-DISCONTINUITY-SEQUENCE"===g)(r.segments.length>0||-1!==o)&&i.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.discontinuitySequenceBase=s=v;else if("EXT-X-ENDLIST"===g)r.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===g)r.playlistType=v;else if("EXT-X-I-FRAMES-ONLY"===g)e.compatibleVersion<4&&(e.compatibleVersion=4),r.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===g)r.independentSegments&&i.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0;else if("EXT-X-START"===g)r.start&&i.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof I["TIME-OFFSET"]&&i.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:I["TIME-OFFSET"],precise:I.PRECISE||!1};else if("string"==typeof A){-1===o&&i.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),r.targetDuration||i.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED");var S=N(t,A,o,d-1,a++,s,e);if(S){var m=S.discontinuity,b=S.key,R=S.map,D=S.byterange,w=S.uri;if(m&&(S.discontinuitySequence=++s),b?u=b:u&&(S.key=u),R?f=R:f&&(S.map=f),D&&-1===D.offset){var X=r.segments;if(X.length>0){var O=X[X.length-1];O.byterange&&O.uri===w?D.offset=O.byterange.offset+O.byterange.length:i.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST be a sub-range of the same media resource")}else i.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}r.segments.push(S)}o=-1}}else-1===o&&(o=d)}}catch(t){l=!0,c=t}finally{try{!h&&T.return&&T.return()}finally{if(l)throw c}}return function(t){for(var e=new Map,r=new Map,n=!1,o=!1,a=t.length-1;a>=0;a--){var s=t[a],u=s.programDateTime,f=s.dateRange;if(u&&(o=!0),f){n=!0,f.endOnNext&&(f.end||f.duration)&&i.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var h=f.start.getTime(),l=f.duration||0;f.end&&f.duration&&h+1e3*l!==f.end.getTime()&&i.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),f.endOnNext&&(f.end=e.get(f.classId)),e.set(f.classId,f.start);var c=f.end?f.end.getTime():f.start.getTime()+1e3*(f.duration||0),E=r.get(f.classId);if(E){var p=!0,T=!1,y=void 0;try{for(var d,A=E[Symbol.iterator]();!(p=(d=A.next()).done);p=!0){var g=d.value;(g.start<=h&&g.end>h||g.start>=h&&g.start<c)&&i.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){T=!0,y=t}finally{try{!p&&A.return&&A.return()}finally{if(T)throw y}}E.push({start:h,end:c})}else r.set(f.classId,[{start:h,end:c}])}}n&&!o&&i.INVALIDPLAYLIST("If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain at least one EXT-X-PROGRAM-DATE-TIME tag.")}(r.segments),r}function R(t,e){var r=function(t){var e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),o=n(r,2),a=o[0],s=o[1],u=function(t){switch(t){case"EXTM3U":case"EXT-X-VERSION":return"Basic";case"EXTINF":case"EXT-X-BYTERANGE":case"EXT-X-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":return"Segment";case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":case"EXT-X-ENDLIST":case"EXT-X-PLAYLIST-TYPE":case"EXT-X-I-FRAMES-ONLY":return"MediaPlaylist";case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":return"MasterPlaylist";case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-START":return"MediaorMasterPlaylist";default:return"Unknown"}}(a);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&v());if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&v()}}(u,e),"Unknown"===u)return null;"MediaPlaylist"===u&&(e.hash[a]&&i.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[a]=!0);var f=g(a,s),h=n(f,2);return{name:a,category:u,value:h[0],attributes:h[1]}}function D(t,e){var r=void 0;return e.isMasterPlaylist?r=function(t,e){var r=new c,o=!0,a=!1,s=void 0;try{for(var h,l=t.entries()[Symbol.iterator]();!(o=(h=l.next()).done);o=!0){var E=n(h.value,2),p=E[0],T=E[1],y=T.name,A=T.value,g=T.attributes;if("EXT-X-VERSION"===y)r.version=A;else if("EXT-X-STREAM-INF"===y){var v=t[p+1];("string"!=typeof v||v.startsWith("#EXT"))&&i.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var I=S(t,g,v,!1,e);I&&r.variants.push(I)}else if("EXT-X-I-FRAME-STREAM-INF"===y){var N=S(t,g,g.URI,!0,e);N&&r.variants.push(N)}else"EXT-X-SESSION-DATA"===y?function(){var t=new u({id:g["DATA-ID"],value:g.VALUE,uri:g.URI,language:g.LANGUAGE});r.sessionDataList.find(function(e){return e.id===t.id&&e.language===t.language})&&i.INVALIDPLAYLIST("A Playlist MUST NOT contain more than one EXT-X-SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute."),r.sessionDataList.push(t)}():"EXT-X-SESSION-KEY"===y?function(){"NONE"===g.METHOD&&i.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var t=new f({method:g.METHOD,uri:g.URI,iv:g.IV,format:g.KEYFORMAT,formatVersion:g.KEYFORMATVERSIONS});r.sessionKeyList.find(function(e){return m(e,t)})&&i.INVALIDPLAYLIST("A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS attribute values."),d(e,g),r.sessionKeyList.push(t)}():"EXT-X-INDEPENDENT-SEGMENTS"===y?(r.independentSegments&&i.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0):"EXT-X-START"===y&&(r.start&&i.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof g["TIME-OFFSET"]&&i.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:g["TIME-OFFSET"],precise:g.PRECISE||!1})}}catch(t){a=!0,s=t}finally{try{!o&&l.return&&l.return()}finally{if(a)throw s}}return r}(t,e):!(r=b(t,e)).isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6),e.compatibleVersion>1&&(!r.version||r.version<e.compatibleVersion)&&i.INVALIDPLAYLIST("EXT-X-VERSION needs to be "+e.compatibleVersion+" or higher."),r}t.exports=function(t){var e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,hash:{}},r=D(function(t,e){var r=[];return t.split("\n").forEach(function(t){var n=t.trim();if(n)if(n.startsWith("#")){if(n.startsWith("#EXT")){var i=R(n,e);return void(i&&r.push(i))}}else r.push(n)}),0!==r.length&&"EXTM3U"===r[0].name||i.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),r}(t,e),e);return r.source=t,r}},function(t,e,r){"use strict";var n=r(8),i=r(2),o=r(1);t.exports={parse:n,stringify:i,types:o}}])});
var n=r(5),i=r(4),o=r(3);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=c(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|E(e.length);return 0===(t=s(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):c(t,e);if("Buffer"===e.type&&o(e.data))return c(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(l(e),t=s(t,e<0?0:0|E(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function c(t,e){var r=e.length<0?0:0|E(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function E(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return x(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function T(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:d(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):d(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=r;o<s;o++)if(f(t,o)===f(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var h=!0,c=0;c<u;c++)if(f(t,o+c)!==f(e,c)){h=!1;break}if(h)return o}return-1}function A(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function g(t,e,r,n){return G(F(e,t.length-r),t,r,n)}function v(t,e,r,n){return G(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function I(t,e,r,n){return v(t,e,r,n)}function S(t,e,r,n){return G(x(e),t,r,n)}function m(t,e,r,n){return G(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function N(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function b(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,f=t[i],l=null,h=f>239?4:f>223?3:f>191?2:1;if(i+h<=r)switch(h){case 1:f<128&&(l=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(t){var e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return f(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return l(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return h(null,t)},u.allocUnsafeSlow=function(t){return h(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)T(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)T(this,e,e+3),T(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)T(this,e,e+7),T(this,e+1,e+6),T(this,e+2,e+5),T(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?b(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return X(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return D(this,e,r);case"latin1":case"binary":return w(this,e,r);case"base64":return N(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,s=Math.min(o,a),f=this.slice(n,i),l=t.slice(e,r),h=0;h<s;++h)if(f[h]!==l[h]){o=f[h],a=l[h];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return I(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function D(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function w(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function X(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=V(t[o]);return i}function O(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function M(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function U(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function C(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Y(t,e,r,n,o){return o||C(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function _(t,e,r,n,o){return o||C(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return Y(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return Y(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return _(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return _(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:F(new u(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function x(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(6))},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),o=r(1),a=o.Rendition,s=o.Variant,u=o.SessionData,f=o.Key,l=o.MediaInitializationSection,h=o.DateRange,c=o.MasterPlaylist,E=o.MediaPlaylist,p=o.Segment;function T(t){return i.trim(t,'"')}function y(t){var e=i.splitAt(t,"@");return{length:i.toNumber(e[0]),offset:e[1]?i.toNumber(e[1]):-1}}function d(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function A(t){var e={};return i.splitByCommaWithPreservingQuotes(t).forEach(function(t){var r,o,a=i.splitAt(t,"="),s=n(a,2),u=s[0],f=s[1],l=T(f);switch(u){case"URI":e[u]=l;break;case"START-DATE":case"END-DATE":e[u]=new Date(l);break;case"IV":e[u]=(r=l,16!==(o=i.hexToByteSequence(r)).length&&i.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),o);break;case"BYTERANGE":e[u]=y(l);break;case"RESOLUTION":e[u]=function(t){var e=i.splitAt(t,"x");return{width:i.toNumber(e[0]),height:i.toNumber(e[1])}}(l);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":e[u]="YES"===l;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":e[u]=i.toNumber(l);break;default:u.startsWith("SCTE35-")?e[u]=i.hexToByteSequence(l):u.startsWith("X-")?e[u]=function(t){return t.startsWith('"')?T(t):t.startsWith("0x")||t.startsWith("0X")?i.hexToByteSequence(t):i.toNumber(t)}(f):e[u]=l}}),e}function g(t,e){switch(t){case"EXTM3U":case"EXT-X-DISCONTINUITY":case"EXT-X-ENDLIST":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-INDEPENDENT-SEGMENTS":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[i.toNumber(e),null];case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-DATERANGE":case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":case"EXT-X-START":return[null,A(e)];case"EXTINF":return[function(t){var e=i.splitAt(t,",");return{duration:i.toNumber(e[0]),title:decodeURIComponent(escape(e[1]))}}(e),null];case"EXT-X-BYTERANGE":return[y(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];case"EXT-X-PLAYLIST-TYPE":default:return[e,null]}}function v(){i.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function I(t,e,r){var n,o=(n=e.attributes,new a({type:n.TYPE,uri:n.URI,groupId:n["GROUP-ID"],language:n.LANGUAGE,assocLanguage:n["ASSOC-LANGUAGE"],name:n.NAME,isDefault:n.DEFAULT,autoselect:n.AUTOSELECT,forced:n.FORCED,instreamId:n["INSTREAM-ID"],characteristics:n.CHARACTERISTICS,channels:n.CHANNELS})),s=t[i.camelify(r)],u=function(t,e){var r=!1,n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";u.isDefault&&(r=!0)}}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(s,o);u&&i.INVALIDPLAYLIST(u),s.push(o),o.isDefault&&(t.currentRenditions[r]=s.length-1)}function S(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments[4],a=new s({uri:r,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"]}),u=!0,f=!1,l=void 0;try{for(var h,c=t[Symbol.iterator]();!(u=(h=c.next()).done);u=!0){var E=h.value;if("EXT-X-MEDIA"===E.name){var p=E.attributes,T=p.TYPE;if(T&&p["GROUP-ID"]||i.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[T]===p["GROUP-ID"]&&(I(a,E,T),"CLOSED-CAPTIONS"===T)){var y=!0,d=!1,A=void 0;try{for(var g,v=a.closedCaptions[Symbol.iterator]();!(y=(g=v.next()).done);y=!0){var S=g.value.instreamId;if(S&&S.startsWith("SERVICE")&&o.compatibleVersion<7){o.compatibleVersion=7;break}}}catch(t){d=!0,A=t}finally{try{!y&&v.return&&v.return()}finally{if(d)throw A}}}}}}catch(t){f=!0,l=t}finally{try{!u&&c.return&&c.return()}finally{if(f)throw l}}return function(t,e,r){["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(n){"CLOSED-CAPTIONS"===n&&"NONE"===t[n]?(r.isClosedCaptionsNone=!0,e.closedCaptions=[]):t[n]&&!e[i.camelify(n)].find(function(e){return e.groupId===t[n]})&&i.INVALIDPLAYLIST(n+" attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is "+n+".")})}(e,a,o),a.isIFrameOnly=n,a}function m(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.length!==e.iv.length)return!1;for(var r=0;r<t.iv.length;r++)if(t.iv[r]!==e.iv[r])return!1}else if(e.iv)return!1;return t.format===e.format&&t.formatVersion===e.formatVersion}function N(t,e,r,n,o,a,s){for(var u=new p({uri:e,mediaSequenceNumber:o,discontinuitySequence:a}),c=function(e){var r=t[e],n=r.name,o=r.value,a=r.attributes;if("EXTINF"===n)!Number.isInteger(o.duration)&&s.compatibleVersion<3&&(s.compatibleVersion=3),Math.round(o.duration)>s.targetDuration&&i.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),u.duration=o.duration,u.title=o.title;else if("EXT-X-BYTERANGE"===n)s.compatibleVersion<4&&(s.compatibleVersion=4),u.byterange=o;else if("EXT-X-DISCONTINUITY"===n)u.discontinuity=!0;else if("EXT-X-KEY"===n)d(s,a),u.key=new f({method:a.METHOD,uri:a.URI,iv:a.IV,format:a.KEYFORMAT,formatVersion:a.KEYFORMATVERSIONS});else if("EXT-X-MAP"===n)s.compatibleVersion<5&&(s.compatibleVersion=5),s.hasMap=!0,u.map=new l({uri:a.URI,byterange:a.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===n)u.programDateTime=o;else if("EXT-X-DATERANGE"===n){var c={};Object.keys(a).forEach(function(t){(t.startsWith("SCTE35-")||t.startsWith("X-"))&&(c[t]=a[t])}),u.dateRange=new h({id:a.ID,classId:a.CLASS,start:a["START-DATE"],end:a["END-DATE"],duration:a.DURATION,plannedDuration:a["PLANNED-DURATION"],endOnNext:a["END-ON-NEXT"],attributes:c})}},E=r;E<=n;E++)c(E);return u}function b(t,e){var r=new E,o=-1,a=0,s=0,u=null,f=null,l=!0,h=!1,c=void 0;try{for(var p,T=t.entries()[Symbol.iterator]();!(l=(p=T.next()).done);l=!0){var y=n(p.value,2),d=y[0],A=y[1],g=A.name,v=A.value,I=A.attributes;if("Segment"!==A.category){if("EXT-X-VERSION"===g)void 0===r.version?r.version=v:i.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===g)r.targetDuration=e.targetDuration=v;else if("EXT-X-MEDIA-SEQUENCE"===g)(r.segments.length>0||-1!==o)&&i.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.mediaSequenceBase=a=v;else if("EXT-X-DISCONTINUITY-SEQUENCE"===g)(r.segments.length>0||-1!==o)&&i.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.discontinuitySequenceBase=s=v;else if("EXT-X-ENDLIST"===g)r.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===g)r.playlistType=v;else if("EXT-X-I-FRAMES-ONLY"===g)e.compatibleVersion<4&&(e.compatibleVersion=4),r.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===g)r.independentSegments&&i.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0;else if("EXT-X-START"===g)r.start&&i.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof I["TIME-OFFSET"]&&i.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:I["TIME-OFFSET"],precise:I.PRECISE||!1};else if("string"==typeof A){-1===o&&i.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),r.targetDuration||i.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED");var S=N(t,A,o,d-1,a++,s,e);if(S){var m=S.discontinuity,b=S.key,R=S.map,D=S.byterange,w=S.uri;if(m&&(S.discontinuitySequence=++s),b?u=b:u&&(S.key=u),R?f=R:f&&(S.map=f),D&&-1===D.offset){var X=r.segments;if(X.length>0){var O=X[X.length-1];O.byterange&&O.uri===w?D.offset=O.byterange.offset+O.byterange.length:i.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST be a sub-range of the same media resource")}else i.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}r.segments.push(S)}o=-1}}else-1===o&&(o=d)}}catch(t){h=!0,c=t}finally{try{!l&&T.return&&T.return()}finally{if(h)throw c}}return function(t){for(var e=new Map,r=new Map,n=!1,o=!1,a=t.length-1;a>=0;a--){var s=t[a],u=s.programDateTime,f=s.dateRange;if(u&&(o=!0),f){n=!0,f.endOnNext&&(f.end||f.duration)&&i.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var l=f.start.getTime(),h=f.duration||0;f.end&&f.duration&&l+1e3*h!==f.end.getTime()&&i.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),f.endOnNext&&(f.end=e.get(f.classId)),e.set(f.classId,f.start);var c=f.end?f.end.getTime():f.start.getTime()+1e3*(f.duration||0),E=r.get(f.classId);if(E){var p=!0,T=!1,y=void 0;try{for(var d,A=E[Symbol.iterator]();!(p=(d=A.next()).done);p=!0){var g=d.value;(g.start<=l&&g.end>l||g.start>=l&&g.start<c)&&i.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){T=!0,y=t}finally{try{!p&&A.return&&A.return()}finally{if(T)throw y}}E.push({start:l,end:c})}else r.set(f.classId,[{start:l,end:c}])}}n&&!o&&i.INVALIDPLAYLIST("If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain at least one EXT-X-PROGRAM-DATE-TIME tag.")}(r.segments),r}function R(t,e){var r=function(t){var e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),o=n(r,2),a=o[0],s=o[1],u=function(t){switch(t){case"EXTM3U":case"EXT-X-VERSION":return"Basic";case"EXTINF":case"EXT-X-BYTERANGE":case"EXT-X-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":return"Segment";case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":case"EXT-X-ENDLIST":case"EXT-X-PLAYLIST-TYPE":case"EXT-X-I-FRAMES-ONLY":return"MediaPlaylist";case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":return"MasterPlaylist";case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-START":return"MediaorMasterPlaylist";default:return"Unknown"}}(a);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&v());if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&v()}}(u,e),"Unknown"===u)return null;"MediaPlaylist"===u&&(e.hash[a]&&i.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[a]=!0);var f=g(a,s),l=n(f,2);return{name:a,category:u,value:l[0],attributes:l[1]}}function D(t,e){var r=void 0;return e.isMasterPlaylist?r=function(t,e){var r=new c,o=!0,a=!1,s=void 0;try{for(var l,h=t.entries()[Symbol.iterator]();!(o=(l=h.next()).done);o=!0){var E=n(l.value,2),p=E[0],T=E[1],y=T.name,A=T.value,g=T.attributes;if("EXT-X-VERSION"===y)r.version=A;else if("EXT-X-STREAM-INF"===y){var v=t[p+1];("string"!=typeof v||v.startsWith("#EXT"))&&i.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var I=S(t,g,v,!1,e);I&&r.variants.push(I)}else if("EXT-X-I-FRAME-STREAM-INF"===y){var N=S(t,g,g.URI,!0,e);N&&r.variants.push(N)}else"EXT-X-SESSION-DATA"===y?function(){var t=new u({id:g["DATA-ID"],value:g.VALUE,uri:g.URI,language:g.LANGUAGE});r.sessionDataList.find(function(e){return e.id===t.id&&e.language===t.language})&&i.INVALIDPLAYLIST("A Playlist MUST NOT contain more than one EXT-X-SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute."),r.sessionDataList.push(t)}():"EXT-X-SESSION-KEY"===y?function(){"NONE"===g.METHOD&&i.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var t=new f({method:g.METHOD,uri:g.URI,iv:g.IV,format:g.KEYFORMAT,formatVersion:g.KEYFORMATVERSIONS});r.sessionKeyList.find(function(e){return m(e,t)})&&i.INVALIDPLAYLIST("A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS attribute values."),d(e,g),r.sessionKeyList.push(t)}():"EXT-X-INDEPENDENT-SEGMENTS"===y?(r.independentSegments&&i.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0):"EXT-X-START"===y&&(r.start&&i.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof g["TIME-OFFSET"]&&i.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:g["TIME-OFFSET"],precise:g.PRECISE||!1})}}catch(t){a=!0,s=t}finally{try{!o&&h.return&&h.return()}finally{if(a)throw s}}if(e.isClosedCaptionsNone){var b=!0,R=!1,D=void 0;try{for(var w,X=r.variants[Symbol.iterator]();!(b=(w=X.next()).done);b=!0)w.value.closedCaptions.length>0&&i.INVALIDPLAYLIST("If there is a variant with CLOSED-CAPTIONS attribute of NONE, all EXT-X-STREAM-INF tags MUST have this attribute with a value of NONE")}catch(t){R=!0,D=t}finally{try{!b&&X.return&&X.return()}finally{if(R)throw D}}}return r}(t,e):!(r=b(t,e)).isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6),e.compatibleVersion>1&&(!r.version||r.version<e.compatibleVersion)&&i.INVALIDPLAYLIST("EXT-X-VERSION needs to be "+e.compatibleVersion+" or higher."),r}t.exports=function(t){var e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,isClosedCaptionsNone:!1,hash:{}},r=D(function(t,e){var r=[];return t.split("\n").forEach(function(t){var n=t.trim();if(n)if(n.startsWith("#")){if(n.startsWith("#EXT")){var i=R(n,e);return void(i&&r.push(i))}}else r.push(n)}),0!==r.length&&"EXTM3U"===r[0].name||i.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),r}(t,e),e);return r.source=t,r}},function(t,e,r){"use strict";var n=r(8),i=r(2),o=r(1);t.exports={parse:n,stringify:i,types:o}}])});

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HLS=e():t.HLS=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=9)}([function(t,e,r){"use strict";(function(e){var r=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function n(t){throw t}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if("number"==typeof t)return t;var r=void 0;return r=10===e?parseFloat(t,e):parseInt(t,e),isNaN(r)?0:r}t.exports={THROW:n,ASSERT:function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];var a=!0,s=!1,u=void 0;try{for(var f,h=i.entries()[Symbol.iterator]();!(a=(f=h.next()).done);a=!0){var l=r(f.value,2),c=l[0];l[1]||n(new Error(t+" : Failed at ["+c+"]"))}}catch(t){s=!0,u=t}finally{try{!a&&h.return&&h.return()}finally{if(s)throw u}}},CONDITIONALASSERT:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var h=r(u.value,2),l=h[0],c=r(h[1],2),E=c[0],p=c[1];E&&(p||n(new Error("Conditional Assert : Failed at ["+l+"]")))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},PARAMCHECK:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var h=r(u.value,2),l=h[0];void 0===h[1]&&n(new Error("Param Check : Failed at ["+l+"]"))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},CONDITIONALPARAMCHECK:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var h=r(u.value,2),l=h[0],c=r(h[1],2),E=c[0],p=c[1];E&&void 0===p&&n(new Error("Conditional Param Check : Failed at ["+l+"]"))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},INVALIDPLAYLIST:function(t){n(new Error("Invalid Playlist : "+t))},toNumber:i,hexToByteSequence:function(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var r=[],n=0;n<t.length;n+=2)r.push(i(t.substr(n,2),16));return e.from(r)},byteSequenceToHex:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;r<=e&&n(new Error("end must be larger than start : start="+e+", end="+r));for(var i=[],o=e;o<r;o++)i.push(("0"+(255&t[o]).toString(16).toUpperCase()).slice(-2));return"0x"+i.join("")},tryCatch:function(t,e){try{return t()}catch(t){return e(t)}},splitAt:function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=-1,i=0,o=0;i<t.length;i++)if(t[i]===e){if(o++===r)return[t.slice(0,i),t.slice(i+1)];n=i}return-1!==n?[t.slice(0,n),t.slice(n+1)]:[t]},trim:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return t?(t=t.trim()," "===e?t:(t.startsWith(e)&&(t=t.slice(1)),t.endsWith(e)&&(t=t.slice(0,-1)),t)):t},splitByCommaWithPreservingQuotes:function(t){for(var e=[],r=!0,n=0,i=[],o=0;o<t.length;o++){var a=t[o];r&&","===a?(e.push(t.slice(n,o).trim()),n=o+1):'"'!==a&&"'"!==a||(r?(i.push(a),r=!1):a===i[i.length-1]?(i.pop(),r=!0):i.push(a))}return e.push(t.slice(n).trim()),e},camelify:function(t){var e=[],r=!1,n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;"-"!==u&&"_"!==u?r?(e.push(u.toUpperCase()),r=!1):e.push(u.toLowerCase()):r=!0}}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return e.join("")},formatDate:function(t){return t.getUTCFullYear()+"-"+("0"+(t.getUTCMonth()+1)).slice(-2)+"-"+("0"+t.getUTCDate()).slice(-2)+"T"+("0"+t.getUTCHours()).slice(-2)+":"+("0"+t.getUTCMinutes()).slice(-2)+":"+("0"+t.getUTCSeconds()).slice(-2)+"."+("00"+t.getUTCMilliseconds()).slice(-3)+"Z"},hasOwnProp:function(t,e){return Object.hasOwnProperty.call(t,e)}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=r(0),s=function t(e){o(this,t),a.PARAMCHECK(e),this.type=e},u=function(t){function e(t){var r=t.isMasterPlaylist,i=t.uri,s=t.version,u=t.independentSegments,f=void 0!==u&&u,h=t.start,l=t.source;o(this,e);var c=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"playlist"));return a.PARAMCHECK(r),c.isMasterPlaylist=r,c.uri=i,c.version=s,c.independentSegments=f,c.start=h,c.source=l,c}return i(e,s),e}(),f=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t.isMasterPlaylist=!0;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.variants,a=void 0===i?[]:i,s=t.currentVariant,u=t.sessionDataList,f=void 0===u?[]:u,h=t.sessionKeyList,l=void 0===h?[]:h;return r.variants=a,r.currentVariant=s,r.sessionDataList=f,r.sessionKeyList=l,r}return i(e,u),e}(),h=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t.isMasterPlaylist=!1;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.targetDuration,a=t.mediaSequenceBase,s=void 0===a?0:a,u=t.discontinuitySequenceBase,f=void 0===u?0:u,h=t.endlist,l=void 0!==h&&h,c=t.playlistType,E=t.isIFrame,p=t.segments,T=void 0===p?[]:p,y=t.hash;return r.targetDuration=i,r.mediaSequenceBase=s,r.discontinuitySequenceBase=f,r.endlist=l,r.playlistType=c,r.isIFrame=E,r.segments=T,r.hash=y,r}return i(e,u),e}(),l=function(t){function e(t){var r=t.uri,i=t.mimeType,s=t.data,u=t.duration,f=t.title,h=t.byterange,l=t.discontinuity,c=t.mediaSequenceNumber,E=t.discontinuitySequence,p=t.key,T=t.map,y=t.programDateTime,d=t.dateRange;o(this,e);var A=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"segment"));return a.PARAMCHECK(r,c,E),A.uri=r,A.mimeType=i,A.data=s,A.duration=u,A.title=f,A.byterange=h,A.discontinuity=l,A.mediaSequenceNumber=c,A.discontinuitySequence=E,A.key=p,A.map=T,A.programDateTime=y,A.dateRange=d,A}return i(e,s),e}();t.exports={Rendition:function t(e){var r=e.type,n=e.uri,i=e.groupId,s=e.language,u=e.assocLanguage,f=e.name,h=e.isDefault,l=e.autoselect,c=e.forced,E=e.instreamId,p=e.characteristics,T=e.channels;o(this,t),a.PARAMCHECK(r,i,f),a.CONDITIONALASSERT(["SUBTITLES"===r,n],["CLOSED-CAPTIONS"===r,E],["CLOSED-CAPTIONS"===r,!n],[c,"CLOSED-CAPTIONS"===r]),this.type=r,this.uri=n,this.groupId=i,this.language=s,this.assocLanguage=u,this.name=f,this.isDefault=h,this.autoselect=l,this.forced=c,this.instreamId=E,this.characteristics=p,this.channels=T},Variant:function t(e){var r=e.uri,n=e.isIFrameOnly,i=void 0!==n&&n,s=e.bandwidth,u=e.averageBandwidth,f=e.codecs,h=e.resolution,l=e.frameRate,c=e.hdcpLevel,E=e.audio,p=void 0===E?[]:E,T=e.video,y=void 0===T?[]:T,d=e.subtitles,A=void 0===d?[]:d,g=e.closedCaptions,v=void 0===g?[]:g,I=e.currentRenditions,S=void 0===I?{AUDIO:0,VIDEO:0,SUBTITLES:0,"CLOSED-CAPTIONS":0}:I;o(this,t),a.PARAMCHECK(r,s),this.uri=r,this.isIFrameOnly=i,this.bandwidth=s,this.averageBandwidth=u,this.codecs=f,this.resolution=h,this.frameRate=l,this.hdcpLevel=c,this.audio=p,this.video=y,this.subtitles=A,this.closedCaptions=v,this.currentRenditions=S},SessionData:function t(e){var r=e.id,n=e.value,i=e.uri,s=e.language;o(this,t),a.PARAMCHECK(r,n||i),a.ASSERT("SessionData cannot have both value and uri, shoud be either.",!(n&&i)),this.id=r,this.value=n,this.uri=i,this.language=s},Key:function t(e){var r=e.method,n=e.uri,i=e.iv,s=e.format,u=e.formatVersion;o(this,t),a.PARAMCHECK(r),a.CONDITIONALPARAMCHECK(["NONE"!==r,n]),a.CONDITIONALASSERT(["NONE"===r,!(n||i||s||u)]),this.method=r,this.uri=n,this.iv=i,this.format=s,this.formatVersion=u},MediaInitializationSection:function t(e){var r=e.uri,n=e.mimeType,i=e.byterange;o(this,t),a.PARAMCHECK(r),this.uri=r,this.mimeType=n,this.byterange=i},DateRange:function t(e){var r=e.id,n=e.classId,i=e.start,s=e.end,u=e.duration,f=e.plannedDuration,h=e.endOnNext,l=e.attributes,c=void 0===l?{}:l;o(this,t),a.PARAMCHECK(r,i),a.CONDITIONALPARAMCHECK([!0===h,n]),a.CONDITIONALASSERT([s,i<=s],[u,u>=0],[f,f>=0]),this.id=r,this.classId=n,this.start=i,this.end=s,this.duration=u,this.plannedDuration=f,this.endOnNext=h,this.attributes=c},Playlist:u,MasterPlaylist:f,MediaPlaylist:h,Segment:l}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(n):void 0};var o=r(0),a=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-STREAM-INF"],s=["#EXT-X-KEY","#EXT-X-MEDIA"],u=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.baseUri=t,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,Array),n(e,[{key:"push",value:function(){for(var t=this,r=arguments.length,n=Array(r),u=0;u<r;u++)n[u]=arguments[u];var f=!0,h=!1,l=void 0;try{for(var c,E=function(){var r=c.value;if(a.some(function(t){return r.startsWith(t)}))return i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r),"continue";if(t.includes(r)){if(s.some(function(t){return r.startsWith(t)}))return"continue";o.INVALIDPLAYLIST("Redundant item ("+r+")")}i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r)},p=n[Symbol.iterator]();!(f=(c=p.next()).done);f=!0)E()}catch(t){h=!0,l=t}finally{try{!f&&p.return&&p.return()}finally{if(h)throw l}}}}]),e}();function f(t,e){var r=['DATA-ID="'+e.id+'"'];e.language&&r.push('LANGUAGE="'+e.language+'"'),e.value?r.push('VALUE="'+e.value+'"'):e.uri&&r.push('URI="'+e.uri+'"'),t.push("#EXT-X-SESSION-DATA:"+r.join(","))}function h(t,e,r){var n=r?"#EXT-X-SESSION-KEY":"#EXT-X-KEY",i=["METHOD="+e.method];e.uri&&i.push('URI="'+e.uri+'"'),e.iv&&(16!==e.iv.length&&o.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i.push("IV="+o.byteSequenceToHex(e.iv))),e.format&&i.push('KEYFORMAT="'+e.format+'"'),e.formatVersion&&i.push('KEYFORMATVERSIONS="'+e.formatVersion+'"'),t.push(n+":"+i.join(","))}function l(t,e){var r=e.isIFrameOnly?"#EXT-X-I-FRAME-STREAM-INF":"#EXT-X-STREAM-INF",n=["BANDWIDTH="+e.bandwidth];if(e.averageBandwidth&&n.push("AVERAGE-BANDWIDTH="+e.averageBandwidth),e.isIFrameOnly&&n.push('URI="'+e.uri+'"'),e.codecs&&n.push('CODECS="'+e.codecs+'"'),e.resolution&&n.push("RESOLUTION="+e.resolution.width+"x"+e.resolution.height),e.frameRate&&n.push("FRAME-RATE="+e.frameRate),e.hdcpLevel&&n.push("HDCP-LEVEL="+e.hdcpLevel),e.audio.length>0){n.push('AUDIO="'+e.audio[0].groupId+'"');var i=!0,o=!1,a=void 0;try{for(var s,u=e.audio[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){c(t,s.value)}}catch(t){o=!0,a=t}finally{try{!i&&u.return&&u.return()}finally{if(o)throw a}}}if(e.video.length>0){n.push('VIDEO="'+e.video[0].groupId+'"');var f=!0,h=!1,l=void 0;try{for(var E,p=e.video[Symbol.iterator]();!(f=(E=p.next()).done);f=!0){c(t,E.value)}}catch(t){h=!0,l=t}finally{try{!f&&p.return&&p.return()}finally{if(h)throw l}}}if(e.subtitles.length>0){n.push('SUBTITLES="'+e.subtitles[0].groupId+'"');var T=!0,y=!1,d=void 0;try{for(var A,g=e.subtitles[Symbol.iterator]();!(T=(A=g.next()).done);T=!0){c(t,A.value)}}catch(t){y=!0,d=t}finally{try{!T&&g.return&&g.return()}finally{if(y)throw d}}}if(e.closedCaptions.length>0){n.push('CLOSED-CAPTIONS="'+e.closedCaptions[0].groupId+'"');var v=!0,I=!1,S=void 0;try{for(var m,N=e.closedCaptions[Symbol.iterator]();!(v=(m=N.next()).done);v=!0){c(t,m.value)}}catch(t){I=!0,S=t}finally{try{!v&&N.return&&N.return()}finally{if(I)throw S}}}t.push(r+":"+n.join(",")),e.isIFrameOnly||t.push(""+e.uri)}function c(t,e){var r=["TYPE="+e.type,'GROUP-ID="'+e.groupId+'"','NAME="'+e.name+'"'];void 0!==e.isDefault&&r.push("DEFAULT="+(e.isDefault?"YES":"NO")),void 0!==e.autoselect&&r.push("AUTOSELECT="+(e.autoselect?"YES":"NO")),void 0!==e.forced&&r.push("FORCED="+(e.forced?"YES":"NO")),e.language&&r.push('LANGUAGE="'+e.language+'"'),e.assocLanguage&&r.push('ASSOC-LANGUAGE="'+e.assocLanguage+'"'),e.instreamId&&r.push('INSTREAM-ID="'+e.instreamId+'"'),e.characteristics&&r.push('CHARACTERISTICS="'+e.characteristics+'"'),e.channels&&r.push('CHANNELS="'+e.channels+'"'),e.uri&&r.push('URI="'+e.uri+'"'),t.push("#EXT-X-MEDIA:"+r.join(","))}function E(t,e){e.byterange&&t.push("#EXT-X-BYTERANGE:"+e.byterange.length+"@"+e.byterange.offset),e.discontinuity&&t.push("#EXT-X-DISCONTINUITY"),e.key&&h(t,e.key),e.map&&function(t,e){var r=['URI="'+e.uri+'"'];e.byterange&&r.push("BYTERANGE="+e.byterange);t.push("#EXT-X-MAP:"+r.join(","))}(t,e.map),e.programDateTime&&t.push("#EXT-X-PROGRAM-DATE-TIME:"+o.formatDate(e.programDateTime)),e.dateRange&&function(t,e){var r=['ID="'+e.id+'"','START-DATE="'+o.formatDate(e.start)+'"'];e.end&&r.push('END-DATE="'+e.end+'"');e.duration&&r.push("DURATION="+e.duration);e.plannedDuration&&r.push("PLANNED-DURATION="+e.plannedDuration);e.classId&&r.push('CLASS="'+e.classId+'"');e.endOnNext&&r.push("END-ON-NEXT=YES");Object.keys(e.attributes).forEach(function(t){t.startsWith("X-")?"number"==typeof e.attributes[t]?r.push(t+"="+e.attributes[t]):r.push(t+'="'+e.attributes[t]+'"'):t.startsWith("SCTE35-")&&r.push(t+"="+o.byteSequenceToHex(e.attributes[t]))}),t.push("#EXT-X-DATERANGE:"+r.join(","))}(t,e.dateRange),t.push("#EXTINF:"+e.duration+","+unescape(encodeURIComponent(e.title||""))),t.push(""+e.uri)}t.exports=function(t){o.PARAMCHECK(t),o.ASSERT("Not a playlist","playlist"===t.type);var e=new u(t.uri);return e.push("#EXTM3U"),t.version&&e.push("#EXT-X-VERSION:"+t.version),t.independentSegments&&e.push("#EXT-X-INDEPENDENT-SEGMENTS:"+t.independentSegments),t.start&&e.push("#EXT-X-START:TIME-OFFSET="+t.start.offset+(t.start.precise?",PRECISE=YES":"")),t.isMasterPlaylist?function(t,e){var r=!0,n=!1,i=void 0;try{for(var o,a=e.sessionDataList[Symbol.iterator]();!(r=(o=a.next()).done);r=!0)f(t,o.value)}catch(t){n=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}var s=!0,u=!1,c=void 0;try{for(var E,p=e.sessionKeyList[Symbol.iterator]();!(s=(E=p.next()).done);s=!0)h(t,E.value,!0)}catch(t){u=!0,c=t}finally{try{!s&&p.return&&p.return()}finally{if(u)throw c}}var T=!0,y=!1,d=void 0;try{for(var A,g=e.variants[Symbol.iterator]();!(T=(A=g.next()).done);T=!0)l(t,A.value)}catch(t){y=!0,d=t}finally{try{!T&&g.return&&g.return()}finally{if(y)throw d}}}(e,t):function(t,e){e.targetDuration&&t.push("#EXT-X-TARGETDURATION:"+e.targetDuration),e.mediaSequenceBase&&t.push("#EXT-X-MEDIA-SEQUENCE:"+e.mediaSequenceBase),e.discontinuitySequenceBase&&t.push("#EXT-X-DISCONTINUITY-SEQUENCE:"+e.discontinuitySequenceBase),e.playlistType&&t.push("#EXT-X-PLAYLIST-TYPE:"+e.playlistType),e.isIFrame&&t.push("#EXT-X-I-FRAMES-ONLY");var r=!0,n=!1,i=void 0;try{for(var o,a=e.segments[Symbol.iterator]();!(r=(o=a.next()).done);r=!0)E(t,o.value)}catch(t){n=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}e.endlist&&t.push("#EXT-X-ENDLIST")}(e,t),e.join("\n")}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,f=u>>1,h=-7,l=r?i-1:0,c=r?-1:1,E=t[e+l];for(l+=c,o=E&(1<<-h)-1,E>>=-h,h+=s;h>0;o=256*o+t[e+l],l+=c,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+l],l+=c,h-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(E?-1:1);a+=Math.pow(2,n),o-=f}return(E?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,f=8*o-i-1,h=(1<<f)-1,l=h>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:o-1,p=n?1:-1,T=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+l>=1?c/u:c*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=h?(s=0,a=h):a+l>=1?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[r+E]=255&s,E+=p,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;t[r+E]=255&a,E+=p,a/=256,f-=8);t[r+E-p]|=128*T}},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){for(var e,r=f(t),n=r[0],a=r[1],s=new o(function(t,e,r){return 3*(e+r)/4-r}(0,n,a)),u=0,h=a>0?n-4:n,l=0;l<h;l+=4)e=i[t.charCodeAt(l)]<<18|i[t.charCodeAt(l+1)]<<12|i[t.charCodeAt(l+2)]<<6|i[t.charCodeAt(l+3)],s[u++]=e>>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=i[t.charCodeAt(l)]<<2|i[t.charCodeAt(l+1)]>>4,s[u++]=255&e);1===a&&(e=i[t.charCodeAt(l)]<<10|i[t.charCodeAt(l+1)]<<4|i[t.charCodeAt(l+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(h(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HLS=e():t.HLS=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=9)}([function(t,e,r){"use strict";(function(e){var r=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function n(t){throw t}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if("number"==typeof t)return t;var r=void 0;return r=10===e?parseFloat(t,e):parseInt(t,e),isNaN(r)?0:r}t.exports={THROW:n,ASSERT:function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];var a=!0,s=!1,u=void 0;try{for(var f,l=i.entries()[Symbol.iterator]();!(a=(f=l.next()).done);a=!0){var h=r(f.value,2),c=h[0];h[1]||n(new Error(t+" : Failed at ["+c+"]"))}}catch(t){s=!0,u=t}finally{try{!a&&l.return&&l.return()}finally{if(s)throw u}}},CONDITIONALASSERT:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var l=r(u.value,2),h=l[0],c=r(l[1],2),E=c[0],p=c[1];E&&(p||n(new Error("Conditional Assert : Failed at ["+h+"]")))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},PARAMCHECK:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var l=r(u.value,2),h=l[0];void 0===l[1]&&n(new Error("Param Check : Failed at ["+h+"]"))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},CONDITIONALPARAMCHECK:function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=!0,a=!1,s=void 0;try{for(var u,f=e.entries()[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var l=r(u.value,2),h=l[0],c=r(l[1],2),E=c[0],p=c[1];E&&void 0===p&&n(new Error("Conditional Param Check : Failed at ["+h+"]"))}}catch(t){a=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}},INVALIDPLAYLIST:function(t){n(new Error("Invalid Playlist : "+t))},toNumber:i,hexToByteSequence:function(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var r=[],n=0;n<t.length;n+=2)r.push(i(t.substr(n,2),16));return e.from(r)},byteSequenceToHex:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;r<=e&&n(new Error("end must be larger than start : start="+e+", end="+r));for(var i=[],o=e;o<r;o++)i.push(("0"+(255&t[o]).toString(16).toUpperCase()).slice(-2));return"0x"+i.join("")},tryCatch:function(t,e){try{return t()}catch(t){return e(t)}},splitAt:function(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=-1,i=0,o=0;i<t.length;i++)if(t[i]===e){if(o++===r)return[t.slice(0,i),t.slice(i+1)];n=i}return-1!==n?[t.slice(0,n),t.slice(n+1)]:[t]},trim:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";return t?(t=t.trim()," "===e?t:(t.startsWith(e)&&(t=t.slice(1)),t.endsWith(e)&&(t=t.slice(0,-1)),t)):t},splitByCommaWithPreservingQuotes:function(t){for(var e=[],r=!0,n=0,i=[],o=0;o<t.length;o++){var a=t[o];r&&","===a?(e.push(t.slice(n,o).trim()),n=o+1):'"'!==a&&"'"!==a||(r?(i.push(a),r=!1):a===i[i.length-1]?(i.pop(),r=!0):i.push(a))}return e.push(t.slice(n).trim()),e},camelify:function(t){var e=[],r=!1,n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;"-"!==u&&"_"!==u?r?(e.push(u.toUpperCase()),r=!1):e.push(u.toLowerCase()):r=!0}}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return e.join("")},formatDate:function(t){return t.getUTCFullYear()+"-"+("0"+(t.getUTCMonth()+1)).slice(-2)+"-"+("0"+t.getUTCDate()).slice(-2)+"T"+("0"+t.getUTCHours()).slice(-2)+":"+("0"+t.getUTCMinutes()).slice(-2)+":"+("0"+t.getUTCSeconds()).slice(-2)+"."+("00"+t.getUTCMilliseconds()).slice(-3)+"Z"},hasOwnProp:function(t,e){return Object.hasOwnProperty.call(t,e)}}}).call(this,r(7).Buffer)},function(t,e,r){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=r(0),s=function t(e){o(this,t),a.PARAMCHECK(e),this.type=e},u=function(t){function e(t){var r=t.isMasterPlaylist,i=t.uri,s=t.version,u=t.independentSegments,f=void 0!==u&&u,l=t.start,h=t.source;o(this,e);var c=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"playlist"));return a.PARAMCHECK(r),c.isMasterPlaylist=r,c.uri=i,c.version=s,c.independentSegments=f,c.start=l,c.source=h,c}return i(e,s),e}(),f=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t.isMasterPlaylist=!0;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.variants,a=void 0===i?[]:i,s=t.currentVariant,u=t.sessionDataList,f=void 0===u?[]:u,l=t.sessionKeyList,h=void 0===l?[]:l;return r.variants=a,r.currentVariant=s,r.sessionDataList=f,r.sessionKeyList=h,r}return i(e,u),e}(),l=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),t.isMasterPlaylist=!1;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.targetDuration,a=t.mediaSequenceBase,s=void 0===a?0:a,u=t.discontinuitySequenceBase,f=void 0===u?0:u,l=t.endlist,h=void 0!==l&&l,c=t.playlistType,E=t.isIFrame,p=t.segments,T=void 0===p?[]:p,y=t.hash;return r.targetDuration=i,r.mediaSequenceBase=s,r.discontinuitySequenceBase=f,r.endlist=h,r.playlistType=c,r.isIFrame=E,r.segments=T,r.hash=y,r}return i(e,u),e}(),h=function(t){function e(t){var r=t.uri,i=t.mimeType,s=t.data,u=t.duration,f=t.title,l=t.byterange,h=t.discontinuity,c=t.mediaSequenceNumber,E=t.discontinuitySequence,p=t.key,T=t.map,y=t.programDateTime,d=t.dateRange;o(this,e);var A=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"segment"));return a.PARAMCHECK(r,c,E),A.uri=r,A.mimeType=i,A.data=s,A.duration=u,A.title=f,A.byterange=l,A.discontinuity=h,A.mediaSequenceNumber=c,A.discontinuitySequence=E,A.key=p,A.map=T,A.programDateTime=y,A.dateRange=d,A}return i(e,s),e}();t.exports={Rendition:function t(e){var r=e.type,n=e.uri,i=e.groupId,s=e.language,u=e.assocLanguage,f=e.name,l=e.isDefault,h=e.autoselect,c=e.forced,E=e.instreamId,p=e.characteristics,T=e.channels;o(this,t),a.PARAMCHECK(r,i,f),a.CONDITIONALASSERT(["SUBTITLES"===r,n],["CLOSED-CAPTIONS"===r,E],["CLOSED-CAPTIONS"===r,!n],[c,"CLOSED-CAPTIONS"===r]),this.type=r,this.uri=n,this.groupId=i,this.language=s,this.assocLanguage=u,this.name=f,this.isDefault=l,this.autoselect=h,this.forced=c,this.instreamId=E,this.characteristics=p,this.channels=T},Variant:function t(e){var r=e.uri,n=e.isIFrameOnly,i=void 0!==n&&n,s=e.bandwidth,u=e.averageBandwidth,f=e.codecs,l=e.resolution,h=e.frameRate,c=e.hdcpLevel,E=e.audio,p=void 0===E?[]:E,T=e.video,y=void 0===T?[]:T,d=e.subtitles,A=void 0===d?[]:d,g=e.closedCaptions,v=void 0===g?[]:g,I=e.currentRenditions,S=void 0===I?{AUDIO:0,VIDEO:0,SUBTITLES:0,"CLOSED-CAPTIONS":0}:I;o(this,t),a.PARAMCHECK(r,s),this.uri=r,this.isIFrameOnly=i,this.bandwidth=s,this.averageBandwidth=u,this.codecs=f,this.resolution=l,this.frameRate=h,this.hdcpLevel=c,this.audio=p,this.video=y,this.subtitles=A,this.closedCaptions=v,this.currentRenditions=S},SessionData:function t(e){var r=e.id,n=e.value,i=e.uri,s=e.language;o(this,t),a.PARAMCHECK(r,n||i),a.ASSERT("SessionData cannot have both value and uri, shoud be either.",!(n&&i)),this.id=r,this.value=n,this.uri=i,this.language=s},Key:function t(e){var r=e.method,n=e.uri,i=e.iv,s=e.format,u=e.formatVersion;o(this,t),a.PARAMCHECK(r),a.CONDITIONALPARAMCHECK(["NONE"!==r,n]),a.CONDITIONALASSERT(["NONE"===r,!(n||i||s||u)]),this.method=r,this.uri=n,this.iv=i,this.format=s,this.formatVersion=u},MediaInitializationSection:function t(e){var r=e.uri,n=e.mimeType,i=e.byterange;o(this,t),a.PARAMCHECK(r),this.uri=r,this.mimeType=n,this.byterange=i},DateRange:function t(e){var r=e.id,n=e.classId,i=e.start,s=e.end,u=e.duration,f=e.plannedDuration,l=e.endOnNext,h=e.attributes,c=void 0===h?{}:h;o(this,t),a.PARAMCHECK(r,i),a.CONDITIONALPARAMCHECK([!0===l,n]),a.CONDITIONALASSERT([s,i<=s],[u,u>=0],[f,f>=0]),this.id=r,this.classId=n,this.start=i,this.end=s,this.duration=u,this.plannedDuration=f,this.endOnNext=l,this.attributes=c},Playlist:u,MasterPlaylist:f,MediaPlaylist:l,Segment:h}},function(t,e,r){"use strict";var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),i=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,r,n)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(n):void 0};var o=r(0),a=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-STREAM-INF"],s=["#EXT-X-KEY","#EXT-X-MEDIA"],u=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.baseUri=t,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,Array),n(e,[{key:"push",value:function(){for(var t=this,r=arguments.length,n=Array(r),u=0;u<r;u++)n[u]=arguments[u];var f=!0,l=!1,h=void 0;try{for(var c,E=function(){var r=c.value;if(a.some(function(t){return r.startsWith(t)}))return i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r),"continue";if(t.includes(r)){if(s.some(function(t){return r.startsWith(t)}))return"continue";o.INVALIDPLAYLIST("Redundant item ("+r+")")}i(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r)},p=n[Symbol.iterator]();!(f=(c=p.next()).done);f=!0)E()}catch(t){l=!0,h=t}finally{try{!f&&p.return&&p.return()}finally{if(l)throw h}}}}]),e}();function f(t,e){var r=['DATA-ID="'+e.id+'"'];e.language&&r.push('LANGUAGE="'+e.language+'"'),e.value?r.push('VALUE="'+e.value+'"'):e.uri&&r.push('URI="'+e.uri+'"'),t.push("#EXT-X-SESSION-DATA:"+r.join(","))}function l(t,e,r){var n=r?"#EXT-X-SESSION-KEY":"#EXT-X-KEY",i=["METHOD="+e.method];e.uri&&i.push('URI="'+e.uri+'"'),e.iv&&(16!==e.iv.length&&o.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i.push("IV="+o.byteSequenceToHex(e.iv))),e.format&&i.push('KEYFORMAT="'+e.format+'"'),e.formatVersion&&i.push('KEYFORMATVERSIONS="'+e.formatVersion+'"'),t.push(n+":"+i.join(","))}function h(t,e){var r=e.isIFrameOnly?"#EXT-X-I-FRAME-STREAM-INF":"#EXT-X-STREAM-INF",n=["BANDWIDTH="+e.bandwidth];if(e.averageBandwidth&&n.push("AVERAGE-BANDWIDTH="+e.averageBandwidth),e.isIFrameOnly&&n.push('URI="'+e.uri+'"'),e.codecs&&n.push('CODECS="'+e.codecs+'"'),e.resolution&&n.push("RESOLUTION="+e.resolution.width+"x"+e.resolution.height),e.frameRate&&n.push("FRAME-RATE="+e.frameRate),e.hdcpLevel&&n.push("HDCP-LEVEL="+e.hdcpLevel),e.audio.length>0){n.push('AUDIO="'+e.audio[0].groupId+'"');var i=!0,o=!1,a=void 0;try{for(var s,u=e.audio[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){c(t,s.value)}}catch(t){o=!0,a=t}finally{try{!i&&u.return&&u.return()}finally{if(o)throw a}}}if(e.video.length>0){n.push('VIDEO="'+e.video[0].groupId+'"');var f=!0,l=!1,h=void 0;try{for(var E,p=e.video[Symbol.iterator]();!(f=(E=p.next()).done);f=!0){c(t,E.value)}}catch(t){l=!0,h=t}finally{try{!f&&p.return&&p.return()}finally{if(l)throw h}}}if(e.subtitles.length>0){n.push('SUBTITLES="'+e.subtitles[0].groupId+'"');var T=!0,y=!1,d=void 0;try{for(var A,g=e.subtitles[Symbol.iterator]();!(T=(A=g.next()).done);T=!0){c(t,A.value)}}catch(t){y=!0,d=t}finally{try{!T&&g.return&&g.return()}finally{if(y)throw d}}}if(e.closedCaptions.length>0){n.push('CLOSED-CAPTIONS="'+e.closedCaptions[0].groupId+'"');var v=!0,I=!1,S=void 0;try{for(var m,N=e.closedCaptions[Symbol.iterator]();!(v=(m=N.next()).done);v=!0){c(t,m.value)}}catch(t){I=!0,S=t}finally{try{!v&&N.return&&N.return()}finally{if(I)throw S}}}t.push(r+":"+n.join(",")),e.isIFrameOnly||t.push(""+e.uri)}function c(t,e){var r=["TYPE="+e.type,'GROUP-ID="'+e.groupId+'"','NAME="'+e.name+'"'];void 0!==e.isDefault&&r.push("DEFAULT="+(e.isDefault?"YES":"NO")),void 0!==e.autoselect&&r.push("AUTOSELECT="+(e.autoselect?"YES":"NO")),void 0!==e.forced&&r.push("FORCED="+(e.forced?"YES":"NO")),e.language&&r.push('LANGUAGE="'+e.language+'"'),e.assocLanguage&&r.push('ASSOC-LANGUAGE="'+e.assocLanguage+'"'),e.instreamId&&r.push('INSTREAM-ID="'+e.instreamId+'"'),e.characteristics&&r.push('CHARACTERISTICS="'+e.characteristics+'"'),e.channels&&r.push('CHANNELS="'+e.channels+'"'),e.uri&&r.push('URI="'+e.uri+'"'),t.push("#EXT-X-MEDIA:"+r.join(","))}function E(t,e){e.byterange&&t.push("#EXT-X-BYTERANGE:"+e.byterange.length+"@"+e.byterange.offset),e.discontinuity&&t.push("#EXT-X-DISCONTINUITY"),e.key&&l(t,e.key),e.map&&function(t,e){var r=['URI="'+e.uri+'"'];e.byterange&&r.push("BYTERANGE="+e.byterange);t.push("#EXT-X-MAP:"+r.join(","))}(t,e.map),e.programDateTime&&t.push("#EXT-X-PROGRAM-DATE-TIME:"+o.formatDate(e.programDateTime)),e.dateRange&&function(t,e){var r=['ID="'+e.id+'"','START-DATE="'+o.formatDate(e.start)+'"'];e.end&&r.push('END-DATE="'+e.end+'"');e.duration&&r.push("DURATION="+e.duration);e.plannedDuration&&r.push("PLANNED-DURATION="+e.plannedDuration);e.classId&&r.push('CLASS="'+e.classId+'"');e.endOnNext&&r.push("END-ON-NEXT=YES");Object.keys(e.attributes).forEach(function(t){t.startsWith("X-")?"number"==typeof e.attributes[t]?r.push(t+"="+e.attributes[t]):r.push(t+'="'+e.attributes[t]+'"'):t.startsWith("SCTE35-")&&r.push(t+"="+o.byteSequenceToHex(e.attributes[t]))}),t.push("#EXT-X-DATERANGE:"+r.join(","))}(t,e.dateRange),t.push("#EXTINF:"+e.duration+","+unescape(encodeURIComponent(e.title||""))),t.push(""+e.uri)}t.exports=function(t){o.PARAMCHECK(t),o.ASSERT("Not a playlist","playlist"===t.type);var e=new u(t.uri);return e.push("#EXTM3U"),t.version&&e.push("#EXT-X-VERSION:"+t.version),t.independentSegments&&e.push("#EXT-X-INDEPENDENT-SEGMENTS:"+t.independentSegments),t.start&&e.push("#EXT-X-START:TIME-OFFSET="+t.start.offset+(t.start.precise?",PRECISE=YES":"")),t.isMasterPlaylist?function(t,e){var r=!0,n=!1,i=void 0;try{for(var o,a=e.sessionDataList[Symbol.iterator]();!(r=(o=a.next()).done);r=!0)f(t,o.value)}catch(t){n=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}var s=!0,u=!1,c=void 0;try{for(var E,p=e.sessionKeyList[Symbol.iterator]();!(s=(E=p.next()).done);s=!0)l(t,E.value,!0)}catch(t){u=!0,c=t}finally{try{!s&&p.return&&p.return()}finally{if(u)throw c}}var T=!0,y=!1,d=void 0;try{for(var A,g=e.variants[Symbol.iterator]();!(T=(A=g.next()).done);T=!0)h(t,A.value)}catch(t){y=!0,d=t}finally{try{!T&&g.return&&g.return()}finally{if(y)throw d}}}(e,t):function(t,e){e.targetDuration&&t.push("#EXT-X-TARGETDURATION:"+e.targetDuration),e.mediaSequenceBase&&t.push("#EXT-X-MEDIA-SEQUENCE:"+e.mediaSequenceBase),e.discontinuitySequenceBase&&t.push("#EXT-X-DISCONTINUITY-SEQUENCE:"+e.discontinuitySequenceBase),e.playlistType&&t.push("#EXT-X-PLAYLIST-TYPE:"+e.playlistType),e.isIFrame&&t.push("#EXT-X-I-FRAMES-ONLY");var r=!0,n=!1,i=void 0;try{for(var o,a=e.segments[Symbol.iterator]();!(r=(o=a.next()).done);r=!0)E(t,o.value)}catch(t){n=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}e.endlist&&t.push("#EXT-X-ENDLIST")}(e,t),e.join("\n")}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,f=u>>1,l=-7,h=r?i-1:0,c=r?-1:1,E=t[e+h];for(h+=c,o=E&(1<<-l)-1,E>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=c,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=c,l-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(E?-1:1);a+=Math.pow(2,n),o-=f}return(E?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,f=8*o-i-1,l=(1<<f)-1,h=l>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:o-1,p=n?1:-1,T=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?c/u:c*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+E]=255&s,E+=p,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;t[r+E]=255&a,E+=p,a/=256,f-=8);t[r+E-p]|=128*T}},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){for(var e,r=f(t),n=r[0],a=r[1],s=new o(function(t,e,r){return 3*(e+r)/4-r}(0,n,a)),u=0,l=a>0?n-4:n,h=0;h<l;h+=4)e=i[t.charCodeAt(h)]<<18|i[t.charCodeAt(h+1)]<<12|i[t.charCodeAt(h+2)]<<6|i[t.charCodeAt(h+3)],s[u++]=e>>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=i[t.charCodeAt(h)]<<2|i[t.charCodeAt(h+1)]>>4,s[u++]=255&e);1===a&&(e=i[t.charCodeAt(h)]<<10|i[t.charCodeAt(h+1)]<<4|i[t.charCodeAt(h+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;a<s;a+=16383)o.push(l(t,a,a+16383>s?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)n[s]=a[s],i[a.charCodeAt(s)]=s;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var i,o,a=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){
/*!

@@ -8,2 +8,2 @@ * The buffer module from node.js, for the browser.

*/
var n=r(5),i=r(4),o=r(3);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=c(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|E(e.length);return 0===(t=s(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):c(t,e);if("Buffer"===e.type&&o(e.data))return c(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(h(e),t=s(t,e<0?0:0|E(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function c(t,e){var r=e.length<0?0:0|E(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function E(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return x(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function T(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:d(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):d(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var h=-1;for(o=r;o<s;o++)if(f(t,o)===f(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*a}else-1!==h&&(o-=o-h),h=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var l=!0,c=0;c<u;c++)if(f(t,o+c)!==f(e,c)){l=!1;break}if(l)return o}return-1}function A(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function g(t,e,r,n){return G(F(e,t.length-r),t,r,n)}function v(t,e,r,n){return G(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function I(t,e,r,n){return v(t,e,r,n)}function S(t,e,r,n){return G(x(e),t,r,n)}function m(t,e,r,n){return G(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function N(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function b(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,f=t[i],h=null,l=f>239?4:f>223?3:f>191?2:1;if(i+l<=r)switch(l){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function(t){var e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return f(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return h(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return l(null,t)},u.allocUnsafeSlow=function(t){return l(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)T(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)T(this,e,e+3),T(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)T(this,e,e+7),T(this,e+1,e+6),T(this,e+2,e+5),T(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?b(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return X(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return D(this,e,r);case"latin1":case"binary":return w(this,e,r);case"base64":return N(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,s=Math.min(o,a),f=this.slice(n,i),h=t.slice(e,r),l=0;l<s;++l)if(f[l]!==h[l]){o=f[l],a=h[l];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return I(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function D(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function w(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function X(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=V(t[o]);return i}function O(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function M(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function U(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function C(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Y(t,e,r,n,o){return o||C(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function _(t,e,r,n,o){return o||C(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return Y(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return Y(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return _(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return _(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:F(new u(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function x(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(6))},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),o=r(1),a=o.Rendition,s=o.Variant,u=o.SessionData,f=o.Key,h=o.MediaInitializationSection,l=o.DateRange,c=o.MasterPlaylist,E=o.MediaPlaylist,p=o.Segment;function T(t){return i.trim(t,'"')}function y(t){var e=i.splitAt(t,"@");return{length:i.toNumber(e[0]),offset:e[1]?i.toNumber(e[1]):-1}}function d(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function A(t){var e={};return i.splitByCommaWithPreservingQuotes(t).forEach(function(t){var r,o,a=i.splitAt(t,"="),s=n(a,2),u=s[0],f=s[1],h=T(f);switch(u){case"URI":e[u]=h;break;case"START-DATE":case"END-DATE":e[u]=new Date(h);break;case"IV":e[u]=(r=h,16!==(o=i.hexToByteSequence(r)).length&&i.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),o);break;case"BYTERANGE":e[u]=y(h);break;case"RESOLUTION":e[u]=function(t){var e=i.splitAt(t,"x");return{width:i.toNumber(e[0]),height:i.toNumber(e[1])}}(h);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":e[u]="YES"===h;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":e[u]=i.toNumber(h);break;default:u.startsWith("SCTE35-")?e[u]=i.hexToByteSequence(h):u.startsWith("X-")?e[u]=function(t){return t.startsWith('"')?T(t):t.startsWith("0x")||t.startsWith("0X")?i.hexToByteSequence(t):i.toNumber(t)}(f):e[u]=h}}),e}function g(t,e){switch(t){case"EXTM3U":case"EXT-X-DISCONTINUITY":case"EXT-X-ENDLIST":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-INDEPENDENT-SEGMENTS":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[i.toNumber(e),null];case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-DATERANGE":case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":case"EXT-X-START":return[null,A(e)];case"EXTINF":return[function(t){var e=i.splitAt(t,",");return{duration:i.toNumber(e[0]),title:decodeURIComponent(escape(e[1]))}}(e),null];case"EXT-X-BYTERANGE":return[y(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];case"EXT-X-PLAYLIST-TYPE":default:return[e,null]}}function v(){i.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function I(t,e,r){var n,o=(n=e.attributes,new a({type:n.TYPE,uri:n.URI,groupId:n["GROUP-ID"],language:n.LANGUAGE,assocLanguage:n["ASSOC-LANGUAGE"],name:n.NAME,isDefault:n.DEFAULT,autoselect:n.AUTOSELECT,forced:n.FORCED,instreamId:n["INSTREAM-ID"],characteristics:n.CHARACTERISTICS,channels:n.CHANNELS})),s=t[i.camelify(r)],u=function(t,e){var r=!1,n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";u.isDefault&&(r=!0)}}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(s,o);u&&i.INVALIDPLAYLIST(u),s.push(o),o.isDefault&&(t.currentRenditions[r]=s.length-1)}function S(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments[4],a=new s({uri:r,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"]}),u=!0,f=!1,h=void 0;try{for(var l,c=t[Symbol.iterator]();!(u=(l=c.next()).done);u=!0){var E=l.value;if("EXT-X-MEDIA"===E.name){var p=E.attributes,T=p.TYPE;if(T&&p["GROUP-ID"]||i.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[T]===p["GROUP-ID"]&&(I(a,E,T),"CLOSED-CAPTIONS"===T)){var y=!0,d=!1,A=void 0;try{for(var g,v=a.closedCaptions[Symbol.iterator]();!(y=(g=v.next()).done);y=!0){var S=g.value.instreamId;if(S&&S.startsWith("SERVICE")&&o.compatibleVersion<7){o.compatibleVersion=7;break}}}catch(t){d=!0,A=t}finally{try{!y&&v.return&&v.return()}finally{if(d)throw A}}}}}}catch(t){f=!0,h=t}finally{try{!u&&c.return&&c.return()}finally{if(f)throw h}}return function(t,e){["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(r){t[r]&&!e[i.camelify(r)].find(function(e){return e.groupId===t[r]})&&i.INVALIDPLAYLIST(r+" attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is "+r+".")})}(e,a),a.isIFrameOnly=n,a}function m(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.length!==e.iv.length)return!1;for(var r=0;r<t.iv.length;r++)if(t.iv[r]!==e.iv[r])return!1}else if(e.iv)return!1;return t.format===e.format&&t.formatVersion===e.formatVersion}function N(t,e,r,n,o,a,s){for(var u=new p({uri:e,mediaSequenceNumber:o,discontinuitySequence:a}),c=function(e){var r=t[e],n=r.name,o=r.value,a=r.attributes;if("EXTINF"===n)!Number.isInteger(o.duration)&&s.compatibleVersion<3&&(s.compatibleVersion=3),Math.round(o.duration)>s.targetDuration&&i.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),u.duration=o.duration,u.title=o.title;else if("EXT-X-BYTERANGE"===n)s.compatibleVersion<4&&(s.compatibleVersion=4),u.byterange=o;else if("EXT-X-DISCONTINUITY"===n)u.discontinuity=!0;else if("EXT-X-KEY"===n)d(s,a),u.key=new f({method:a.METHOD,uri:a.URI,iv:a.IV,format:a.KEYFORMAT,formatVersion:a.KEYFORMATVERSIONS});else if("EXT-X-MAP"===n)s.compatibleVersion<5&&(s.compatibleVersion=5),s.hasMap=!0,u.map=new h({uri:a.URI,byterange:a.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===n)u.programDateTime=o;else if("EXT-X-DATERANGE"===n){var c={};Object.keys(a).forEach(function(t){(t.startsWith("SCTE35-")||t.startsWith("X-"))&&(c[t]=a[t])}),u.dateRange=new l({id:a.ID,classId:a.CLASS,start:a["START-DATE"],end:a["END-DATE"],duration:a.DURATION,plannedDuration:a["PLANNED-DURATION"],endOnNext:a["END-ON-NEXT"],attributes:c})}},E=r;E<=n;E++)c(E);return u}function b(t,e){var r=new E,o=-1,a=0,s=0,u=null,f=null,h=!0,l=!1,c=void 0;try{for(var p,T=t.entries()[Symbol.iterator]();!(h=(p=T.next()).done);h=!0){var y=n(p.value,2),d=y[0],A=y[1],g=A.name,v=A.value,I=A.attributes;if("Segment"!==A.category){if("EXT-X-VERSION"===g)void 0===r.version?r.version=v:i.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===g)r.targetDuration=e.targetDuration=v;else if("EXT-X-MEDIA-SEQUENCE"===g)(r.segments.length>0||-1!==o)&&i.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.mediaSequenceBase=a=v;else if("EXT-X-DISCONTINUITY-SEQUENCE"===g)(r.segments.length>0||-1!==o)&&i.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.discontinuitySequenceBase=s=v;else if("EXT-X-ENDLIST"===g)r.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===g)r.playlistType=v;else if("EXT-X-I-FRAMES-ONLY"===g)e.compatibleVersion<4&&(e.compatibleVersion=4),r.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===g)r.independentSegments&&i.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0;else if("EXT-X-START"===g)r.start&&i.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof I["TIME-OFFSET"]&&i.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:I["TIME-OFFSET"],precise:I.PRECISE||!1};else if("string"==typeof A){-1===o&&i.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),r.targetDuration||i.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED");var S=N(t,A,o,d-1,a++,s,e);if(S){var m=S.discontinuity,b=S.key,R=S.map,D=S.byterange,w=S.uri;if(m&&(S.discontinuitySequence=++s),b?u=b:u&&(S.key=u),R?f=R:f&&(S.map=f),D&&-1===D.offset){var X=r.segments;if(X.length>0){var O=X[X.length-1];O.byterange&&O.uri===w?D.offset=O.byterange.offset+O.byterange.length:i.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST be a sub-range of the same media resource")}else i.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}r.segments.push(S)}o=-1}}else-1===o&&(o=d)}}catch(t){l=!0,c=t}finally{try{!h&&T.return&&T.return()}finally{if(l)throw c}}return function(t){for(var e=new Map,r=new Map,n=!1,o=!1,a=t.length-1;a>=0;a--){var s=t[a],u=s.programDateTime,f=s.dateRange;if(u&&(o=!0),f){n=!0,f.endOnNext&&(f.end||f.duration)&&i.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var h=f.start.getTime(),l=f.duration||0;f.end&&f.duration&&h+1e3*l!==f.end.getTime()&&i.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),f.endOnNext&&(f.end=e.get(f.classId)),e.set(f.classId,f.start);var c=f.end?f.end.getTime():f.start.getTime()+1e3*(f.duration||0),E=r.get(f.classId);if(E){var p=!0,T=!1,y=void 0;try{for(var d,A=E[Symbol.iterator]();!(p=(d=A.next()).done);p=!0){var g=d.value;(g.start<=h&&g.end>h||g.start>=h&&g.start<c)&&i.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){T=!0,y=t}finally{try{!p&&A.return&&A.return()}finally{if(T)throw y}}E.push({start:h,end:c})}else r.set(f.classId,[{start:h,end:c}])}}n&&!o&&i.INVALIDPLAYLIST("If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain at least one EXT-X-PROGRAM-DATE-TIME tag.")}(r.segments),r}function R(t,e){var r=function(t){var e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),o=n(r,2),a=o[0],s=o[1],u=function(t){switch(t){case"EXTM3U":case"EXT-X-VERSION":return"Basic";case"EXTINF":case"EXT-X-BYTERANGE":case"EXT-X-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":return"Segment";case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":case"EXT-X-ENDLIST":case"EXT-X-PLAYLIST-TYPE":case"EXT-X-I-FRAMES-ONLY":return"MediaPlaylist";case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":return"MasterPlaylist";case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-START":return"MediaorMasterPlaylist";default:return"Unknown"}}(a);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&v());if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&v()}}(u,e),"Unknown"===u)return null;"MediaPlaylist"===u&&(e.hash[a]&&i.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[a]=!0);var f=g(a,s),h=n(f,2);return{name:a,category:u,value:h[0],attributes:h[1]}}function D(t,e){var r=void 0;return e.isMasterPlaylist?r=function(t,e){var r=new c,o=!0,a=!1,s=void 0;try{for(var h,l=t.entries()[Symbol.iterator]();!(o=(h=l.next()).done);o=!0){var E=n(h.value,2),p=E[0],T=E[1],y=T.name,A=T.value,g=T.attributes;if("EXT-X-VERSION"===y)r.version=A;else if("EXT-X-STREAM-INF"===y){var v=t[p+1];("string"!=typeof v||v.startsWith("#EXT"))&&i.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var I=S(t,g,v,!1,e);I&&r.variants.push(I)}else if("EXT-X-I-FRAME-STREAM-INF"===y){var N=S(t,g,g.URI,!0,e);N&&r.variants.push(N)}else"EXT-X-SESSION-DATA"===y?function(){var t=new u({id:g["DATA-ID"],value:g.VALUE,uri:g.URI,language:g.LANGUAGE});r.sessionDataList.find(function(e){return e.id===t.id&&e.language===t.language})&&i.INVALIDPLAYLIST("A Playlist MUST NOT contain more than one EXT-X-SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute."),r.sessionDataList.push(t)}():"EXT-X-SESSION-KEY"===y?function(){"NONE"===g.METHOD&&i.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var t=new f({method:g.METHOD,uri:g.URI,iv:g.IV,format:g.KEYFORMAT,formatVersion:g.KEYFORMATVERSIONS});r.sessionKeyList.find(function(e){return m(e,t)})&&i.INVALIDPLAYLIST("A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS attribute values."),d(e,g),r.sessionKeyList.push(t)}():"EXT-X-INDEPENDENT-SEGMENTS"===y?(r.independentSegments&&i.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0):"EXT-X-START"===y&&(r.start&&i.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof g["TIME-OFFSET"]&&i.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:g["TIME-OFFSET"],precise:g.PRECISE||!1})}}catch(t){a=!0,s=t}finally{try{!o&&l.return&&l.return()}finally{if(a)throw s}}return r}(t,e):!(r=b(t,e)).isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6),e.compatibleVersion>1&&(!r.version||r.version<e.compatibleVersion)&&i.INVALIDPLAYLIST("EXT-X-VERSION needs to be "+e.compatibleVersion+" or higher."),r}t.exports=function(t){var e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,hash:{}},r=D(function(t,e){var r=[];return t.split("\n").forEach(function(t){var n=t.trim();if(n)if(n.startsWith("#")){if(n.startsWith("#EXT")){var i=R(n,e);return void(i&&r.push(i))}}else r.push(n)}),0!==r.length&&"EXTM3U"===r[0].name||i.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),r}(t,e),e);return r.source=t,r}},function(t,e,r){"use strict";var n=r(8),i=r(2),o=r(1);t.exports={parse:n,stringify:i,types:o}}])});
var n=r(5),i=r(4),o=r(3);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=c(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=s(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|E(e.length);return 0===(t=s(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):c(t,e);if("Buffer"===e.type&&o(e.data))return c(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(l(e),t=s(t,e<0?0:0|E(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function c(t,e){var r=e.length<0?0:0|E(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function E(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return x(t).length;default:if(n)return F(t).length;e=(""+e).toLowerCase(),n=!0}}function T(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:d(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):d(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function d(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=r;o<s;o++)if(f(t,o)===f(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){for(var h=!0,c=0;c<u;c++)if(f(t,o+c)!==f(e,c)){h=!1;break}if(h)return o}return-1}function A(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function g(t,e,r,n){return G(F(e,t.length-r),t,r,n)}function v(t,e,r,n){return G(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function I(t,e,r,n){return v(t,e,r,n)}function S(t,e,r,n){return G(x(e),t,r,n)}function m(t,e,r,n){return G(function(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function N(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function b(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,f=t[i],l=null,h=f>239?4:f>223?3:f>191?2:1;if(i+h<=r)switch(h){case 1:f<128&&(l=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(t){var e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return f(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return l(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return h(null,t)},u.allocUnsafeSlow=function(t){return h(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)T(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)T(this,e,e+3),T(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)T(this,e,e+7),T(this,e+1,e+6),T(this,e+2,e+5),T(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?b(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return X(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return D(this,e,r);case"latin1":case"binary":return w(this,e,r);case"base64":return N(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,s=Math.min(o,a),f=this.slice(n,i),l=t.slice(e,r),h=0;h<s;++h)if(f[h]!==l[h]){o=f[h],a=l[h];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return g(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return I(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function D(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function w(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function X(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=V(t[o]);return i}function O(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function P(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function M(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function U(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function C(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Y(t,e,r,n,o){return o||C(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function _(t,e,r,n,o){return o||C(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||P(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||L(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);L(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return Y(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return Y(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return _(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return _(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=u.isBuffer(t)?t:F(new u(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function x(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function G(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(6))},function(t,e,r){"use strict";var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=r(0),o=r(1),a=o.Rendition,s=o.Variant,u=o.SessionData,f=o.Key,l=o.MediaInitializationSection,h=o.DateRange,c=o.MasterPlaylist,E=o.MediaPlaylist,p=o.Segment;function T(t){return i.trim(t,'"')}function y(t){var e=i.splitAt(t,"@");return{length:i.toNumber(e[0]),offset:e[1]?i.toNumber(e[1]):-1}}function d(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function A(t){var e={};return i.splitByCommaWithPreservingQuotes(t).forEach(function(t){var r,o,a=i.splitAt(t,"="),s=n(a,2),u=s[0],f=s[1],l=T(f);switch(u){case"URI":e[u]=l;break;case"START-DATE":case"END-DATE":e[u]=new Date(l);break;case"IV":e[u]=(r=l,16!==(o=i.hexToByteSequence(r)).length&&i.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),o);break;case"BYTERANGE":e[u]=y(l);break;case"RESOLUTION":e[u]=function(t){var e=i.splitAt(t,"x");return{width:i.toNumber(e[0]),height:i.toNumber(e[1])}}(l);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":e[u]="YES"===l;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":e[u]=i.toNumber(l);break;default:u.startsWith("SCTE35-")?e[u]=i.hexToByteSequence(l):u.startsWith("X-")?e[u]=function(t){return t.startsWith('"')?T(t):t.startsWith("0x")||t.startsWith("0X")?i.hexToByteSequence(t):i.toNumber(t)}(f):e[u]=l}}),e}function g(t,e){switch(t){case"EXTM3U":case"EXT-X-DISCONTINUITY":case"EXT-X-ENDLIST":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-INDEPENDENT-SEGMENTS":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[i.toNumber(e),null];case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-DATERANGE":case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":case"EXT-X-START":return[null,A(e)];case"EXTINF":return[function(t){var e=i.splitAt(t,",");return{duration:i.toNumber(e[0]),title:decodeURIComponent(escape(e[1]))}}(e),null];case"EXT-X-BYTERANGE":return[y(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];case"EXT-X-PLAYLIST-TYPE":default:return[e,null]}}function v(){i.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function I(t,e,r){var n,o=(n=e.attributes,new a({type:n.TYPE,uri:n.URI,groupId:n["GROUP-ID"],language:n.LANGUAGE,assocLanguage:n["ASSOC-LANGUAGE"],name:n.NAME,isDefault:n.DEFAULT,autoselect:n.AUTOSELECT,forced:n.FORCED,instreamId:n["INSTREAM-ID"],characteristics:n.CHARACTERISTICS,channels:n.CHANNELS})),s=t[i.camelify(r)],u=function(t,e){var r=!1,n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=a.value;if(u.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";u.isDefault&&(r=!0)}}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(s,o);u&&i.INVALIDPLAYLIST(u),s.push(o),o.isDefault&&(t.currentRenditions[r]=s.length-1)}function S(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments[4],a=new s({uri:r,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"]}),u=!0,f=!1,l=void 0;try{for(var h,c=t[Symbol.iterator]();!(u=(h=c.next()).done);u=!0){var E=h.value;if("EXT-X-MEDIA"===E.name){var p=E.attributes,T=p.TYPE;if(T&&p["GROUP-ID"]||i.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[T]===p["GROUP-ID"]&&(I(a,E,T),"CLOSED-CAPTIONS"===T)){var y=!0,d=!1,A=void 0;try{for(var g,v=a.closedCaptions[Symbol.iterator]();!(y=(g=v.next()).done);y=!0){var S=g.value.instreamId;if(S&&S.startsWith("SERVICE")&&o.compatibleVersion<7){o.compatibleVersion=7;break}}}catch(t){d=!0,A=t}finally{try{!y&&v.return&&v.return()}finally{if(d)throw A}}}}}}catch(t){f=!0,l=t}finally{try{!u&&c.return&&c.return()}finally{if(f)throw l}}return function(t,e,r){["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(n){"CLOSED-CAPTIONS"===n&&"NONE"===t[n]?(r.isClosedCaptionsNone=!0,e.closedCaptions=[]):t[n]&&!e[i.camelify(n)].find(function(e){return e.groupId===t[n]})&&i.INVALIDPLAYLIST(n+" attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is "+n+".")})}(e,a,o),a.isIFrameOnly=n,a}function m(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.length!==e.iv.length)return!1;for(var r=0;r<t.iv.length;r++)if(t.iv[r]!==e.iv[r])return!1}else if(e.iv)return!1;return t.format===e.format&&t.formatVersion===e.formatVersion}function N(t,e,r,n,o,a,s){for(var u=new p({uri:e,mediaSequenceNumber:o,discontinuitySequence:a}),c=function(e){var r=t[e],n=r.name,o=r.value,a=r.attributes;if("EXTINF"===n)!Number.isInteger(o.duration)&&s.compatibleVersion<3&&(s.compatibleVersion=3),Math.round(o.duration)>s.targetDuration&&i.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),u.duration=o.duration,u.title=o.title;else if("EXT-X-BYTERANGE"===n)s.compatibleVersion<4&&(s.compatibleVersion=4),u.byterange=o;else if("EXT-X-DISCONTINUITY"===n)u.discontinuity=!0;else if("EXT-X-KEY"===n)d(s,a),u.key=new f({method:a.METHOD,uri:a.URI,iv:a.IV,format:a.KEYFORMAT,formatVersion:a.KEYFORMATVERSIONS});else if("EXT-X-MAP"===n)s.compatibleVersion<5&&(s.compatibleVersion=5),s.hasMap=!0,u.map=new l({uri:a.URI,byterange:a.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===n)u.programDateTime=o;else if("EXT-X-DATERANGE"===n){var c={};Object.keys(a).forEach(function(t){(t.startsWith("SCTE35-")||t.startsWith("X-"))&&(c[t]=a[t])}),u.dateRange=new h({id:a.ID,classId:a.CLASS,start:a["START-DATE"],end:a["END-DATE"],duration:a.DURATION,plannedDuration:a["PLANNED-DURATION"],endOnNext:a["END-ON-NEXT"],attributes:c})}},E=r;E<=n;E++)c(E);return u}function b(t,e){var r=new E,o=-1,a=0,s=0,u=null,f=null,l=!0,h=!1,c=void 0;try{for(var p,T=t.entries()[Symbol.iterator]();!(l=(p=T.next()).done);l=!0){var y=n(p.value,2),d=y[0],A=y[1],g=A.name,v=A.value,I=A.attributes;if("Segment"!==A.category){if("EXT-X-VERSION"===g)void 0===r.version?r.version=v:i.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===g)r.targetDuration=e.targetDuration=v;else if("EXT-X-MEDIA-SEQUENCE"===g)(r.segments.length>0||-1!==o)&&i.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.mediaSequenceBase=a=v;else if("EXT-X-DISCONTINUITY-SEQUENCE"===g)(r.segments.length>0||-1!==o)&&i.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.discontinuitySequenceBase=s=v;else if("EXT-X-ENDLIST"===g)r.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===g)r.playlistType=v;else if("EXT-X-I-FRAMES-ONLY"===g)e.compatibleVersion<4&&(e.compatibleVersion=4),r.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===g)r.independentSegments&&i.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0;else if("EXT-X-START"===g)r.start&&i.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof I["TIME-OFFSET"]&&i.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:I["TIME-OFFSET"],precise:I.PRECISE||!1};else if("string"==typeof A){-1===o&&i.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),r.targetDuration||i.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED");var S=N(t,A,o,d-1,a++,s,e);if(S){var m=S.discontinuity,b=S.key,R=S.map,D=S.byterange,w=S.uri;if(m&&(S.discontinuitySequence=++s),b?u=b:u&&(S.key=u),R?f=R:f&&(S.map=f),D&&-1===D.offset){var X=r.segments;if(X.length>0){var O=X[X.length-1];O.byterange&&O.uri===w?D.offset=O.byterange.offset+O.byterange.length:i.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST be a sub-range of the same media resource")}else i.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}r.segments.push(S)}o=-1}}else-1===o&&(o=d)}}catch(t){h=!0,c=t}finally{try{!l&&T.return&&T.return()}finally{if(h)throw c}}return function(t){for(var e=new Map,r=new Map,n=!1,o=!1,a=t.length-1;a>=0;a--){var s=t[a],u=s.programDateTime,f=s.dateRange;if(u&&(o=!0),f){n=!0,f.endOnNext&&(f.end||f.duration)&&i.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var l=f.start.getTime(),h=f.duration||0;f.end&&f.duration&&l+1e3*h!==f.end.getTime()&&i.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),f.endOnNext&&(f.end=e.get(f.classId)),e.set(f.classId,f.start);var c=f.end?f.end.getTime():f.start.getTime()+1e3*(f.duration||0),E=r.get(f.classId);if(E){var p=!0,T=!1,y=void 0;try{for(var d,A=E[Symbol.iterator]();!(p=(d=A.next()).done);p=!0){var g=d.value;(g.start<=l&&g.end>l||g.start>=l&&g.start<c)&&i.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){T=!0,y=t}finally{try{!p&&A.return&&A.return()}finally{if(T)throw y}}E.push({start:l,end:c})}else r.set(f.classId,[{start:l,end:c}])}}n&&!o&&i.INVALIDPLAYLIST("If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain at least one EXT-X-PROGRAM-DATE-TIME tag.")}(r.segments),r}function R(t,e){var r=function(t){var e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),o=n(r,2),a=o[0],s=o[1],u=function(t){switch(t){case"EXTM3U":case"EXT-X-VERSION":return"Basic";case"EXTINF":case"EXT-X-BYTERANGE":case"EXT-X-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":return"Segment";case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":case"EXT-X-ENDLIST":case"EXT-X-PLAYLIST-TYPE":case"EXT-X-I-FRAMES-ONLY":return"MediaPlaylist";case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":return"MasterPlaylist";case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-START":return"MediaorMasterPlaylist";default:return"Unknown"}}(a);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&v());if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&v()}}(u,e),"Unknown"===u)return null;"MediaPlaylist"===u&&(e.hash[a]&&i.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[a]=!0);var f=g(a,s),l=n(f,2);return{name:a,category:u,value:l[0],attributes:l[1]}}function D(t,e){var r=void 0;return e.isMasterPlaylist?r=function(t,e){var r=new c,o=!0,a=!1,s=void 0;try{for(var l,h=t.entries()[Symbol.iterator]();!(o=(l=h.next()).done);o=!0){var E=n(l.value,2),p=E[0],T=E[1],y=T.name,A=T.value,g=T.attributes;if("EXT-X-VERSION"===y)r.version=A;else if("EXT-X-STREAM-INF"===y){var v=t[p+1];("string"!=typeof v||v.startsWith("#EXT"))&&i.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var I=S(t,g,v,!1,e);I&&r.variants.push(I)}else if("EXT-X-I-FRAME-STREAM-INF"===y){var N=S(t,g,g.URI,!0,e);N&&r.variants.push(N)}else"EXT-X-SESSION-DATA"===y?function(){var t=new u({id:g["DATA-ID"],value:g.VALUE,uri:g.URI,language:g.LANGUAGE});r.sessionDataList.find(function(e){return e.id===t.id&&e.language===t.language})&&i.INVALIDPLAYLIST("A Playlist MUST NOT contain more than one EXT-X-SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute."),r.sessionDataList.push(t)}():"EXT-X-SESSION-KEY"===y?function(){"NONE"===g.METHOD&&i.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var t=new f({method:g.METHOD,uri:g.URI,iv:g.IV,format:g.KEYFORMAT,formatVersion:g.KEYFORMATVERSIONS});r.sessionKeyList.find(function(e){return m(e,t)})&&i.INVALIDPLAYLIST("A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS attribute values."),d(e,g),r.sessionKeyList.push(t)}():"EXT-X-INDEPENDENT-SEGMENTS"===y?(r.independentSegments&&i.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0):"EXT-X-START"===y&&(r.start&&i.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof g["TIME-OFFSET"]&&i.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:g["TIME-OFFSET"],precise:g.PRECISE||!1})}}catch(t){a=!0,s=t}finally{try{!o&&h.return&&h.return()}finally{if(a)throw s}}if(e.isClosedCaptionsNone){var b=!0,R=!1,D=void 0;try{for(var w,X=r.variants[Symbol.iterator]();!(b=(w=X.next()).done);b=!0)w.value.closedCaptions.length>0&&i.INVALIDPLAYLIST("If there is a variant with CLOSED-CAPTIONS attribute of NONE, all EXT-X-STREAM-INF tags MUST have this attribute with a value of NONE")}catch(t){R=!0,D=t}finally{try{!b&&X.return&&X.return()}finally{if(R)throw D}}}return r}(t,e):!(r=b(t,e)).isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6),e.compatibleVersion>1&&(!r.version||r.version<e.compatibleVersion)&&i.INVALIDPLAYLIST("EXT-X-VERSION needs to be "+e.compatibleVersion+" or higher."),r}t.exports=function(t){var e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,isClosedCaptionsNone:!1,hash:{}},r=D(function(t,e){var r=[];return t.split("\n").forEach(function(t){var n=t.trim();if(n)if(n.startsWith("#")){if(n.startsWith("#EXT")){var i=R(n,e);return void(i&&r.push(i))}}else r.push(n)}),0!==r.length&&"EXTM3U"===r[0].name||i.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),r}(t,e),e);return r.source=t,r}},function(t,e,r){"use strict";var n=r(8),i=r(2),o=r(1);t.exports={parse:n,stringify:i,types:o}}])});
{
"name": "hls-parser",
"version": "0.1.7",
"version": "0.1.8",
"description": "A simple library to read/write HLS playlists",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -240,5 +240,8 @@ const utils = require('./utils');

function matchTypes(attrs, variant) {
function matchTypes(attrs, variant, params) {
['AUDIO', 'VIDEO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => {
if (attrs[type] && !variant[utils.camelify(type)].find(item => item.groupId === attrs[type])) {
if (type === 'CLOSED-CAPTIONS' && attrs[type] === 'NONE') {
params.isClosedCaptionsNone = true;
variant.closedCaptions = [];
} else if (attrs[type] && !variant[utils.camelify(type)].find(item => item.groupId === attrs[type])) {
utils.INVALIDPLAYLIST(`${type} attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is ${type}.`);

@@ -279,3 +282,3 @@ }

}
matchTypes(variantAttrs, variant);
matchTypes(variantAttrs, variant, params);
variant.isIFrameOnly = iFrameOnly;

@@ -377,2 +380,9 @@ return variant;

}
if (params.isClosedCaptionsNone) {
for (const variant of playlist.variants) {
if (variant.closedCaptions.length > 0) {
utils.INVALIDPLAYLIST('If there is a variant with CLOSED-CAPTIONS attribute of NONE, all EXT-X-STREAM-INF tags MUST have this attribute with a value of NONE');
}
}
}
return playlist;

@@ -683,2 +693,3 @@ }

compatibleVersion: 1,
isClosedCaptionsNone: false,
hash: {}

@@ -685,0 +696,0 @@ };

[![Build Status](https://travis-ci.org/kuu/hls-parser.svg?branch=master)](https://travis-ci.org/kuu/hls-parser)
[![Coverage Status](https://coveralls.io/repos/github/kuu/hls-parser/badge.svg?branch=master)](https://coveralls.io/github/kuu/hls-parser?branch=master)
[![Dependency Status](https://gemnasium.com/badges/github.com/kuu/hls-parser.svg)](https://gemnasium.com/github.com/kuu/hls-parser)
[![Dependency Status](https://david-dm.org/kuu/hls-parser.svg)](https://david-dm.org/kuu/hls-parser)
[![Development Dependency Status](https://david-dm.org/kuu/hls-parser/dev-status.svg)](https://david-dm.org/kuu/hls-parser#info=devDependencies)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)

@@ -5,0 +6,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc