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.6 to 0.1.7

5

dist/hls-parser.min.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HLS=e():t.HLS=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=4)}([function(t,e,r){"use strict";(function(e){function r(t){throw t}function n(t){for(var e=arguments.length,n=Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];var a=!0,o=!1,s=void 0;try{for(var u,f=n.entries()[Symbol.iterator]();!(a=(u=f.next()).done);a=!0){var h=g(u.value,2),l=h[0];h[1]||r(new Error(t+" : Failed at ["+l+"]"))}}catch(t){o=!0,s=t}finally{try{!a&&f.return&&f.return()}finally{if(o)throw s}}}function i(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=!0,a=!1,o=void 0;try{for(var s,u=e.entries()[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var f=g(s.value,2),h=f[0],l=g(f[1],2),c=l[0],E=l[1];c&&(E||r(new Error("Conditional Assert : Failed at ["+h+"]")))}}catch(t){a=!0,o=t}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}}function a(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=!0,a=!1,o=void 0;try{for(var s,u=e.entries()[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var f=g(s.value,2),h=f[0];void 0===f[1]&&r(new Error("Param Check : Failed at ["+h+"]"))}}catch(t){a=!0,o=t}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}}function o(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var i=!0,a=!1,o=void 0;try{for(var s,u=e.entries()[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var f=g(s.value,2),h=f[0],l=g(f[1],2),c=l[0],E=l[1];c&&(void 0===E&&r(new Error("Conditional Param Check : Failed at ["+h+"]")))}}catch(t){a=!0,o=t}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}}function s(t){r(new Error("Invalid Playlist : "+t))}function u(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}function f(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var r=[],n=0;n<t.length;n+=2)r.push(u(t.substr(n,2),16));return e.from(r)}function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;n<=e&&r(new Error("end must be larger than start : start="+e+", end="+n));for(var i=[],a=e;a<n;a++)i.push(("0"+(255&t[a]).toString(16).toUpperCase()).slice(-2));return"0x"+i.join("")}function l(t,e){try{return t()}catch(t){return e(t)}}function c(t,e){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=-1,i=0,a=0;i<t.length;i++)if(t[i]===e){if(a++===r)return[t.slice(0,i),t.slice(i+1)];n=i}return-1!==n?[t.slice(0,n),t.slice(n+1)]:[t]}function E(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}function p(t){for(var e=[],r=!0,n=0,i=[],a=0;a<t.length;a++){var o=t[a];r&&","===o?(e.push(t.slice(n,a).trim()),n=a+1):'"'!==o&&"'"!==o||(r?(i.push(o),r=!1):o===i[i.length-1]?(i.pop(),r=!0):i.push(o))}return e.push(t.slice(n).trim()),e}function T(t){var e=[],r=!1,n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var u=o.value;"-"!==u&&"_"!==u?r?(e.push(u.toUpperCase()),r=!1):e.push(u.toLowerCase()):r=!0}}catch(t){i=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return e.join("")}function y(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"}function d(t,e){return Object.hasOwnProperty.call(t,e)}var g=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(t){i=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.exports={THROW:r,ASSERT:n,CONDITIONALASSERT:i,PARAMCHECK:a,CONDITIONALPARAMCHECK:o,INVALIDPLAYLIST:s,toNumber:u,hexToByteSequence:f,byteSequenceToHex:h,tryCatch:l,splitAt:c,trim:E,splitByCommaWithPreservingQuotes:p,camelify:T,formatDate:y,hasOwnProp:d}}).call(e,r(6).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 a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=r(0),s=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;a(this,t),o.PARAMCHECK(r,i,f),o.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},u=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,g=void 0===d?[]:d,A=e.closedCaptions,v=void 0===A?[]:A,I=e.currentRenditions,S=void 0===I?{AUDIO:0,VIDEO:0,SUBTITLES:0,"CLOSED-CAPTIONS":0}:I;a(this,t),o.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=g,this.closedCaptions=v,this.currentRenditions=S},f=function t(e){var r=e.id,n=e.value,i=e.uri,s=e.language;a(this,t),o.PARAMCHECK(r,n||i),o.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},h=function t(e){var r=e.method,n=e.uri,i=e.iv,s=e.format,u=e.formatVersion;a(this,t),o.PARAMCHECK(r),o.CONDITIONALPARAMCHECK(["NONE"!==r,n]),o.CONDITIONALASSERT(["NONE"===r,!(n||i||s||u)]),this.method=r,this.uri=n,this.iv=i,this.format=s,this.formatVersion=u},l=function t(e){var r=e.uri,n=e.mimeType,i=e.byterange;a(this,t),o.PARAMCHECK(r),this.uri=r,this.mimeType=n,this.byterange=i},c=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;a(this,t),o.PARAMCHECK(r,i),o.CONDITIONALPARAMCHECK([!0===h,n]),o.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},E=function t(e){a(this,t),o.PARAMCHECK(e),this.type=e},p=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;a(this,e);var c=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"playlist"));return o.PARAMCHECK(r),c.isMasterPlaylist=r,c.uri=i,c.version=s,c.independentSegments=f,c.start=h,c.source=l,c}return i(e,t),e}(E),T=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),t.isMasterPlaylist=!0;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.variants,o=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=o,r.currentVariant=s,r.sessionDataList=f,r.sessionKeyList=l,r}return i(e,t),e}(p),y=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),t.isMasterPlaylist=!1;var r=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t)),i=t.targetDuration,o=t.mediaSequenceBase,s=void 0===o?0:o,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,t),e}(p),d=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;a(this,e);var g=n(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,"segment"));return o.PARAMCHECK(r,c,E),g.uri=r,g.mimeType=i,g.data=s,g.duration=u,g.title=f,g.byterange=h,g.discontinuity=l,g.mediaSequenceNumber=c,g.discontinuitySequence=E,g.key=p,g.map=T,g.programDateTime=y,g.dateRange=d,g}return i(e,t),e}(E);t.exports={Rendition:s,Variant:u,SessionData:f,Key:h,MediaInitializationSection:l,DateRange:c,Playlist:p,MasterPlaylist:T,MediaPlaylist:y,Segment:d}},function(t,e,r){"use strict";function n(t){return P.trim(t,'"')}function i(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"}}function a(t){var e=P.splitAt(t,",");return{duration:P.toNumber(e[0]),title:decodeURIComponent(escape(e[1]))}}function o(t){var e=P.splitAt(t,"@");return{length:P.toNumber(e[0]),offset:e[1]?P.toNumber(e[1]):-1}}function s(t){var e=P.splitAt(t,"x");return{width:P.toNumber(e[0]),height:P.toNumber(e[1])}}function u(t){var e=P.hexToByteSequence(t);return 16!==e.length&&P.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),e}function f(t){return t.startsWith('"')?n(t):t.startsWith("0x")||t.startsWith("0X")?P.hexToByteSequence(t):P.toNumber(t)}function h(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function l(t){var e=P.splitByCommaWithPreservingQuotes(t),r={};return e.forEach(function(t){var e=P.splitAt(t,"="),i=O(e,2),a=i[0],h=i[1],l=n(h);switch(a){case"URI":r[a]=l;break;case"START-DATE":case"END-DATE":r[a]=new Date(l);break;case"IV":r[a]=u(l);break;case"BYTERANGE":r[a]=o(l);break;case"RESOLUTION":r[a]=s(l);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":r[a]="YES"===l;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":r[a]=P.toNumber(l);break;default:a.startsWith("SCTE35-")?r[a]=P.hexToByteSequence(l):a.startsWith("X-")?r[a]=f(h):r[a]=l}}),r}function c(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[P.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,l(e)];case"EXTINF":return[a(e),null];case"EXT-X-BYTERANGE":return[o(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];case"EXT-X-PLAYLIST-TYPE":default:return[e,null]}}function E(){P.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function p(t){var e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}function T(t){var e=t.attributes;return new M({type:e.TYPE,uri:e.URI,groupId:e["GROUP-ID"],language:e.LANGUAGE,assocLanguage:e["ASSOC-LANGUAGE"],name:e.NAME,isDefault:e.DEFAULT,autoselect:e.AUTOSELECT,forced:e.FORCED,instreamId:e["INSTREAM-ID"],characteristics:e.CHARACTERISTICS,channels:e.CHANNELS})}function y(t,e){var r=!1,n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var u=o.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,a=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}function d(t,e,r){var n=T(e),i=t[P.camelify(r)],a=y(i,n);a&&P.INVALIDPLAYLIST(a),i.push(n),n.isDefault&&(t.currentRenditions[r]=i.length-1)}function g(t,e){["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(r){t[r]&&!e[P.camelify(r)].find(function(e){return e.groupId===t[r]})&&P.INVALIDPLAYLIST(r+" attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is "+r+".")})}function A(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments[4],a=new U({uri:r,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"]}),o=!0,s=!1,u=void 0;try{for(var f,h=t[Symbol.iterator]();!(o=(f=h.next()).done);o=!0){var l=f.value;if("EXT-X-MEDIA"===l.name){var c=l.attributes,E=c.TYPE;if(E&&c["GROUP-ID"]||P.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[E]===c["GROUP-ID"]&&(d(a,l,E),"CLOSED-CAPTIONS"===E)){var p=!0,T=!1,y=void 0;try{for(var A,v=a.closedCaptions[Symbol.iterator]();!(p=(A=v.next()).done);p=!0){var I=A.value,S=I.instreamId;if(S&&S.startsWith("SERVICE")&&i.compatibleVersion<7){i.compatibleVersion=7;break}}}catch(t){T=!0,y=t}finally{try{!p&&v.return&&v.return()}finally{if(T)throw y}}}}}}catch(t){s=!0,u=t}finally{try{!o&&h.return&&h.return()}finally{if(s)throw u}}return g(e,a),a.isIFrameOnly=n,a}function v(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 I(t,e){var r=new V,n=!0,i=!1,a=void 0;try{for(var o,s=t.entries()[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var u=O(o.value,2),f=u[0],l=u[1],c=l.name,E=l.value,p=l.attributes;if("EXT-X-VERSION"===c)r.version=E;else if("EXT-X-STREAM-INF"===c){var T=t[f+1];("string"!=typeof T||T.startsWith("#EXT"))&&P.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var y=A(t,p,T,!1,e);y&&r.variants.push(y)}else if("EXT-X-I-FRAME-STREAM-INF"===c){var d=A(t,p,p.URI,!0,e);d&&r.variants.push(d)}else"EXT-X-SESSION-DATA"===c?function(){var t=new C({id:p["DATA-ID"],value:p.VALUE,uri:p.URI,language:p.LANGUAGE});r.sessionDataList.find(function(e){return e.id===t.id&&e.language===t.language})&&P.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"===c?function(){"NONE"===p.METHOD&&P.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var t=new Y({method:p.METHOD,uri:p.URI,iv:p.IV,format:p.KEYFORMAT,formatVersion:p.KEYFORMATVERSIONS});r.sessionKeyList.find(function(e){return v(e,t)})&&P.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."),h(e,p),r.sessionKeyList.push(t)}():"EXT-X-INDEPENDENT-SEGMENTS"===c?(r.independentSegments&&P.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0):"EXT-X-START"===c&&(r.start&&P.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof p["TIME-OFFSET"]&&P.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:p["TIME-OFFSET"],precise:p.PRECISE||!1})}}catch(t){i=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}function S(t,e,r,n,i,a,o){for(var s=new x({uri:e,mediaSequenceNumber:i,discontinuitySequence:a}),u=r;u<=n;u++)!function(e){var r=t[e].name,n=t[e].value,i=t[e].attributes;if("EXTINF"===r)!Number.isInteger(n.duration)&&o.compatibleVersion<3&&(o.compatibleVersion=3),Math.round(n.duration)>o.targetDuration&&P.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),s.duration=n.duration,s.title=n.title;else if("EXT-X-BYTERANGE"===r)o.compatibleVersion<4&&(o.compatibleVersion=4),s.byterange=n;else if("EXT-X-DISCONTINUITY"===r)s.discontinuity=!0;else if("EXT-X-KEY"===r)h(o,i),s.key=new Y({method:i.METHOD,uri:i.URI,iv:i.IV,format:i.KEYFORMAT,formatVersion:i.KEYFORMATVERSIONS});else if("EXT-X-MAP"===r)o.compatibleVersion<5&&(o.compatibleVersion=5),o.hasMap=!0,s.map=new _({uri:i.URI,byterange:i.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===r)s.programDateTime=n;else if("EXT-X-DATERANGE"===r){var a={};Object.keys(i).forEach(function(t){(t.startsWith("SCTE35-")||t.startsWith("X-"))&&(a[t]=i[t])}),s.dateRange=new B({id:i.ID,classId:i.CLASS,start:i["START-DATE"],end:i["END-DATE"],duration:i.DURATION,plannedDuration:i["PLANNED-DURATION"],endOnNext:i["END-ON-NEXT"],attributes:a})}}(u);return s}function m(t,e){var r=new F,n=-1,i=0,a=0,o=null,s=null,u=!0,f=!1,h=void 0;try{for(var l,c=t.entries()[Symbol.iterator]();!(u=(l=c.next()).done);u=!0){var E=O(l.value,2),p=E[0],T=E[1],y=T.name,d=T.value,g=T.attributes;if("Segment"!==T.category){if("EXT-X-VERSION"===y)void 0===r.version?r.version=d:P.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===y)r.targetDuration=e.targetDuration=d;else if("EXT-X-MEDIA-SEQUENCE"===y)(r.segments.length>0||-1!==n)&&P.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.mediaSequenceBase=i=d;else if("EXT-X-DISCONTINUITY-SEQUENCE"===y)(r.segments.length>0||-1!==n)&&P.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.discontinuitySequenceBase=a=d;else if("EXT-X-ENDLIST"===y)r.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===y)r.playlistType=d;else if("EXT-X-I-FRAMES-ONLY"===y)e.compatibleVersion<4&&(e.compatibleVersion=4),r.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===y)r.independentSegments&&P.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0;else if("EXT-X-START"===y)r.start&&P.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof g["TIME-OFFSET"]&&P.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:g["TIME-OFFSET"],precise:g.PRECISE||!1};else if("string"==typeof T){-1===n&&P.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),r.targetDuration||P.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED");var A=S(t,T,n,p-1,i++,a,e);if(A){if(A.discontinuity&&(A.discontinuitySequence=++a),A.key?o=A.key:o&&(A.key=o),A.map?s=A.map:s&&(A.map=s),A.byterange&&-1===A.byterange.offset){var v=r.segments;if(v.length>0){var I=v[v.length-1];I.byterange&&I.uri===A.uri?A.byterange.offset=I.byterange.offset+I.byterange.length:P.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 P.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}r.segments.push(A)}n=-1}}else-1===n&&(n=p)}}catch(t){f=!0,h=t}finally{try{!u&&c.return&&c.return()}finally{if(f)throw h}}return N(r.segments),r}function N(t){for(var e=new Map,r=new Map,n=!1,i=!1,a=t.length-1;a>=0;a--){var o=t[a];if(o.programDateTime&&(i=!0),o.dateRange){n=!0;var s=o.dateRange;s.endOnNext&&(s.end||s.duration)&&P.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var u=s.start.getTime(),f=s.duration||0;s.end&&s.duration&&u+1e3*f!==s.end.getTime()&&P.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),s.endOnNext&&(s.end=e.get(s.classId)),e.set(s.classId,s.start);var h=s.end?s.end.getTime():s.start.getTime()+1e3*(s.duration||0),l=r.get(s.classId);if(l){var c=!0,E=!1,p=void 0;try{for(var T,y=l[Symbol.iterator]();!(c=(T=y.next()).done);c=!0){var d=T.value;(d.start<=u&&d.end>u||d.start>=u&&d.start<h)&&P.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){E=!0,p=t}finally{try{!c&&y.return&&y.return()}finally{if(E)throw p}}l.push({start:u,end:h})}else r.set(s.classId,[{start:u,end:h}])}}n&&!i&&P.INVALIDPLAYLIST("If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain at least one EXT-X-PROGRAM-DATE-TIME tag.")}function b(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&E());if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&E()}}function R(t,e){var r=p(t),n=O(r,2),a=n[0],o=n[1],s=i(a);if(b(s,e),"Unknown"===s)return null;"MediaPlaylist"===s&&(e.hash[a]&&P.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[a]=!0);var u=c(a,o),f=O(u,2);return{name:a,category:s,value:f[0],attributes:f[1]}}function D(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||P.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),r}function X(t,e){var r=void 0;return e.isMasterPlaylist?r=I(t,e):(r=m(t,e),!r.isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6)),e.compatibleVersion>1&&(!r.version||r.version<e.compatibleVersion)&&P.INVALIDPLAYLIST("EXT-X-VERSION needs to be "+e.compatibleVersion+" or higher."),r}function w(t){var e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,hash:{}},r=D(t,e),n=X(r,e);return n.source=t,n}var O=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(t){i=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),P=r(0),L=r(1),M=L.Rendition,U=L.Variant,C=L.SessionData,Y=L.Key,_=L.MediaInitializationSection,B=L.DateRange,V=L.MasterPlaylist,F=L.MediaPlaylist,x=L.Segment;t.exports=w},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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 a(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){var r=!0,n=!1,i=void 0;try{for(var a,o=e.sessionDataList[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){s(t,a.value)}}catch(t){n=!0,i=t}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}var h=!0,l=!1,c=void 0;try{for(var E,p=e.sessionKeyList[Symbol.iterator]();!(h=(E=p.next()).done);h=!0){u(t,E.value,!0)}}catch(t){l=!0,c=t}finally{try{!h&&p.return&&p.return()}finally{if(l)throw c}}var T=!0,y=!1,d=void 0;try{for(var g,A=e.variants[Symbol.iterator]();!(T=(g=A.next()).done);T=!0){f(t,g.value)}}catch(t){y=!0,d=t}finally{try{!T&&A.return&&A.return()}finally{if(y)throw d}}}function s(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 u(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&&g.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i.push("IV="+g.byteSequenceToHex(e.iv))),e.format&&i.push('KEYFORMAT="'+e.format+'"'),e.formatVersion&&i.push('KEYFORMATVERSIONS="'+e.formatVersion+'"'),t.push(n+":"+i.join(","))}function f(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,a=!1,o=void 0;try{for(var s,u=e.audio[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){h(t,s.value)}}catch(t){a=!0,o=t}finally{try{!i&&u.return&&u.return()}finally{if(a)throw o}}}if(e.video.length>0){n.push('VIDEO="'+e.video[0].groupId+'"');var f=!0,l=!1,c=void 0;try{for(var E,p=e.video[Symbol.iterator]();!(f=(E=p.next()).done);f=!0){h(t,E.value)}}catch(t){l=!0,c=t}finally{try{!f&&p.return&&p.return()}finally{if(l)throw c}}}if(e.subtitles.length>0){n.push('SUBTITLES="'+e.subtitles[0].groupId+'"');var T=!0,y=!1,d=void 0;try{for(var g,A=e.subtitles[Symbol.iterator]();!(T=(g=A.next()).done);T=!0){h(t,g.value)}}catch(t){y=!0,d=t}finally{try{!T&&A.return&&A.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){h(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 h(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 l(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 a,o=e.segments[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){c(t,a.value)}}catch(t){n=!0,i=t}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}e.endlist&&t.push("#EXT-X-ENDLIST")}function c(t,e){e.byterange&&t.push("#EXT-X-BYTERANGE:"+e.byterange.length+"@"+e.byterange.offset),e.discontinuity&&t.push("#EXT-X-DISCONTINUITY"),e.key&&u(t,e.key),e.map&&E(t,e.map),e.programDateTime&&t.push("#EXT-X-PROGRAM-DATE-TIME:"+g.formatDate(e.programDateTime)),e.dateRange&&p(t,e.dateRange),t.push("#EXTINF:"+e.duration+","+unescape(encodeURIComponent(e.title||""))),t.push(""+e.uri)}function E(t,e){var r=['URI="'+e.uri+'"'];e.byterange&&r.push("BYTERANGE="+e.byterange),t.push("#EXT-X-MAP:"+r.join(","))}function p(t,e){var r=['ID="'+e.id+'"','START-DATE="'+g.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+"="+g.byteSequenceToHex(e.attributes[t]))}),t.push("#EXT-X-DATERANGE:"+r.join(","))}function T(t){g.PARAMCHECK(t),g.ASSERT("Not a playlist","playlist"===t.type);var e=new I(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?o(e,t):l(e,t),e.join("\n")}var y=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}}(),d=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,r,n)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(n)},g=r(0),A=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-STREAM-INF"],v=["#EXT-X-KEY","#EXT-X-MEDIA"],I=function(t){function e(t){n(this,e);var r=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.baseUri=t,r}return a(e,t),y(e,[{key:"push",value:function(){for(var t=this,r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];var a=!0,o=!1,s=void 0;try{for(var u,f=n[Symbol.iterator]();!(a=(u=f.next()).done);a=!0){(function(){var r=u.value;if(A.some(function(t){return r.startsWith(t)}))return d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r),"continue";if(t.includes(r)){if(v.some(function(t){return r.startsWith(t)}))return"continue";g.INVALIDPLAYLIST("Redundant item ("+r+")")}d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"push",t).call(t,r)})()}}catch(t){o=!0,s=t}finally{try{!a&&f.return&&f.return()}finally{if(o)throw s}}}}]),e}(Array);t.exports=T},function(t,e,r){"use strict";var n=r(2),i=r(3),a=r(1);t.exports={parse:n,stringify:i,types:a}},function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function a(t){var e,r,i,a,o,s,u=t.length;o=n(t),s=new l(3*u/4-o),i=o>0?u-4:u;var f=0;for(e=0,r=0;e<i;e+=4,r+=3)a=h[t.charCodeAt(e)]<<18|h[t.charCodeAt(e+1)]<<12|h[t.charCodeAt(e+2)]<<6|h[t.charCodeAt(e+3)],s[f++]=a>>16&255,s[f++]=a>>8&255,s[f++]=255&a;return 2===o?(a=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[f++]=255&a):1===o&&(a=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[f++]=a>>8&255,s[f++]=255&a),s}function o(t){return f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}function s(t,e,r){for(var n,i=[],a=e;a<r;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(o(n));return i.join("")}function u(t){for(var e,r=t.length,n=r%3,i="",a=[],o=0,u=r-n;o<u;o+=16383)a.push(s(t,o,o+16383>u?u:o+16383));return 1===n?(e=t[r-1],i+=f[e>>2],i+=f[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=f[e>>10],i+=f[e>>4&63],i+=f[e<<2&63],i+="="),a.push(i),a.join("")}e.byteLength=i,e.toByteArray=a,e.fromByteArray=u;for(var f=[],h=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E=0,p=c.length;E<p;++E)f[E]=c[E],h[c.charCodeAt(E)]=E;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},function(t,e,r){"use strict";(function(t){function n(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t,e){if(n()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=a.prototype):(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,r){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(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 f(this,t)}return o(this,t,e,r)}function o(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?c(t,e,r,n):"string"==typeof e?h(t,e,r):E(t,e)}function s(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 u(t,e,r,n){return s(e),e<=0?i(t,e):void 0!==r?"string"==typeof n?i(t,e).fill(r,n):i(t,e).fill(r):i(t,e)}function f(t,e){if(s(e),t=i(t,e<0?0:0|p(e)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function h(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|y(e,r);t=i(t,n);var o=t.write(e,r);return o!==n&&(t=t.slice(0,o)),t}function l(t,e){var r=e.length<0?0:0|p(e.length);t=i(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function c(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");return e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n),a.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=a.prototype):t=l(t,e),t}function E(t,e){if(a.isBuffer(e)){var r=0|p(e.length);return t=i(t,r),0===t.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||Q(e.length)?i(t,0):l(t,e);if("Buffer"===e.type&&J(e.data))return l(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function p(t){if(t>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function T(t){return+t!=t&&(t=0),a.alloc(+t)}function y(t,e){if(a.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 K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(n)return K(t).length;e=(""+e).toLowerCase(),n=!0}}function d(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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return L(this,e,r);case"utf8":case"utf-8":return X(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return D(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function A(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=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=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;o=2,s/=2,u/=2,r/=2}var f;if(i){var h=-1;for(f=r;f<s;f++)if(a(t,f)===a(e,-1===h?0:f-h)){if(-1===h&&(h=f),f-h+1===u)return h*o}else-1!==h&&(f-=f-h),h=-1}else for(r+u>s&&(r=s-u),f=r;f>=0;f--){for(var l=!0,c=0;c<u;c++)if(a(t,f+c)!==a(e,c)){l=!1;break}if(l)return f}return-1}function I(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(e.substr(2*o,2),16);if(isNaN(s))return o;t[r+o]=s}return o}function S(t,e,r,n){return q(K(e,t.length-r),t,r,n)}function m(t,e,r,n){return q(k(e),t,r,n)}function N(t,e,r,n){return m(t,e,r,n)}function b(t,e,r,n){return q(W(e),t,r,n)}function R(t,e,r,n){return q(H(e,t.length-r),t,r,n)}function D(t,e,r){return 0===e&&r===t.length?z.fromByteArray(t):z.fromByteArray(t.slice(e,r))}function X(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var a=t[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(i+s<=r){var u,f,h,l;switch(s){case 1:a<128&&(o=a);break;case 2:u=t[i+1],128==(192&u)&&(l=(31&a)<<6|63&u)>127&&(o=l);break;case 3:u=t[i+1],f=t[i+2],128==(192&u)&&128==(192&f)&&(l=(15&a)<<12|(63&u)<<6|63&f)>2047&&(l<55296||l>57343)&&(o=l);break;case 4:u=t[i+1],f=t[i+2],h=t[i+3],128==(192&u)&&128==(192&f)&&128==(192&h)&&(l=(15&a)<<18|(63&u)<<12|(63&f)<<6|63&h)>65535&&l<1114112&&(o=l)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return w(n)}function w(t){var e=t.length;if(e<=$)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=$));return r}function O(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 P(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 L(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=e;a<r;++a)i+=j(t[a]);return i}function M(t,e,r){for(var n=t.slice(e,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function U(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 C(t,e,r,n,i,o){if(!a.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 Y(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,a=Math.min(t.length-r,2);i<a;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function _(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,a=Math.min(t.length-r,4);i<a;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function B(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function V(t,e,r,n,i){return i||B(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,i){return i||B(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,e,r,n,52,8),r+8}function x(t){if(t=G(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function G(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function j(t){return t<16?"0"+t.toString(16):t.toString(16)}function K(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o<n;++o){if((r=t.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.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;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function k(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function H(t,e){for(var r,n,i,a=[],o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,a.push(i),a.push(n);return a}function W(t){return z.toByteArray(x(t))}function q(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}function Q(t){return t!==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,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){
/*!
* The buffer module from node.js, for the browser.

@@ -7,2 +8,2 @@ *

*/
var z=r(5),Z=r(7),J=r(8);e.Buffer=a,e.SlowBuffer=T,e.INSPECT_MAX_BYTES=50,a.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=n(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,r){return o(null,t,e,r)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,r){return u(null,t,e,r)},a.allocUnsafe=function(t){return f(null,t)},a.allocUnsafeSlow=function(t){return f(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.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},a.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}},a.concat=function(t,e){if(!J(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!a.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},a.byteLength=y,a.prototype._isBuffer=!0,a.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)g(this,e,e+1);return this},a.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)g(this,e,e+3),g(this,e+1,e+2);return this},a.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)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?X(this,0,t):d.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.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+">"},a.prototype.compare=function(t,e,r,n,i){if(!a.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,s=r-e,u=Math.min(o,s),f=this.slice(n,i),h=t.slice(e,r),l=0;l<u;++l)if(f[l]!==h[l]){o=f[l],s=h[l];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return A(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return A(this,t,e,r,!1)},a.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 a=!1;;)switch(n){case"hex":return I(this,t,e,r);case"utf8":case"utf-8":return S(this,t,e,r);case"ascii":return m(this,t,e,r);case"latin1":case"binary":return N(this,t,e,r);case"base64":return b(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n;if(a.TYPED_ARRAY_SUPPORT)n=this.subarray(t,e),n.__proto__=a.prototype;else{var i=e-t;n=new a(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},a.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return n},a.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},a.prototype.readUInt8=function(t,e){return e||U(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||U(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||U(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||U(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||U(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},a.prototype.readInt8=function(t,e){return e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){e||U(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){e||U(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return e||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||U(t,4,this.length),Z.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||U(t,4,this.length),Z.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||U(t,8,this.length),Z.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||U(t,8,this.length),Z.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){C(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a<r&&(i*=256);)this[e+a]=t/i&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){C(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Y(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):Y(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):_(this,t,e,!0),e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):_(this,t,e,!1),e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a<r&&(o*=256);)t<0&&0===s&&0!==this[e+a-1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Y(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):Y(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):_(this,t,e,!0),e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):_(this,t,e,!1),e+4},a.prototype.writeFloatLE=function(t,e,r){return V(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return V(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},a.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||!a.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},a.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&&!a.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;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=a.isBuffer(t)?t:K(new a(t,n).toString()),u=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%u]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,r(9))},function(t,e){e.read=function(t,e,r,n,i){var a,o,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,a=E&(1<<-h)-1,E>>=-h,h+=s;h>0;a=256*a+t[e+l],l+=c,h-=8);for(o=a&(1<<-h)-1,a>>=-h,h+=n;h>0;o=256*o+t[e+l],l+=c,h-=8);if(0===a)a=1-f;else{if(a===u)return o?NaN:1/0*(E?-1:1);o+=Math.pow(2,n),a-=f}return(E?-1:1)*o*Math.pow(2,a-n)},e.write=function(t,e,r,n,i,a){var o,s,u,f=8*a-i-1,h=(1<<f)-1,l=h>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:a-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,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),e+=o+l>=1?c/u:c*Math.pow(2,1-l),e*u>=2&&(o++,u/=2),o+l>=h?(s=0,o=h):o+l>=1?(s=(e*u-1)*Math.pow(2,i),o+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;t[r+E]=255&s,E+=p,s/=256,i-=8);for(o=o<<i|s,f+=i;f>0;t[r+E]=255&o,E+=p,o/=256,f-=8);t[r+E-p]|=128*T}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},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}])});
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}}])});

21

package.json
{
"name": "hls-parser",
"version": "0.1.6",
"version": "0.1.7",
"description": "A simple library to read/write HLS playlists",

@@ -9,3 +9,3 @@ "main": "index.js",

"coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
"build": "rm -fR ./dist; webpack",
"build": "rm -fR ./dist; webpack --mode production",
"test": "npm run lint && npm run build && nsp check && ava --verbose"

@@ -32,10 +32,12 @@ },

"devDependencies": {
"ava": "^0.19.1",
"babel-loader": "^7.0.0",
"ava": "^0.25.0",
"babel-loader": "^7.1.4",
"babel-preset-es2015": "^6.24.1",
"coveralls": "^2.13.0",
"nsp": "^2.6.3",
"nyc": "^10.2.0",
"webpack": "^2.5.1",
"xo": "^0.18.1"
"coveralls": "^3.0.1",
"nsp": "^3.2.1",
"nyc": "^11.7.3",
"uglifyjs-webpack-plugin": "^1.2.5",
"webpack": "^4.8.3",
"webpack-cli": "^2.1.3",
"xo": "^0.21.0"
},

@@ -49,2 +51,3 @@ "engines": {

"rules": {
"camelcase": 0,
"capitalized-comments": 0,

@@ -51,0 +54,0 @@ "dot-notation": 0,

@@ -78,3 +78,4 @@ const utils = require('./utils');

return unquote(str);
} else if (str.startsWith('0x') || str.startsWith('0X')) {
}
if (str.startsWith('0x') || str.startsWith('0X')) {
return utils.hexToByteSequence(str);

@@ -193,4 +194,3 @@ }

function parseRendition(line) {
const attributes = line.attributes;
function parseRendition({attributes}) {
const rendition = new Rendition({

@@ -270,4 +270,3 @@ type: attributes['TYPE'],

if (renditionType === 'CLOSED-CAPTIONS') {
for (const rendition of variant.closedCaptions) {
const instreamId = rendition.instreamId;
for (const {instreamId} of variant.closedCaptions) {
if (instreamId && instreamId.startsWith('SERVICE') && params.compatibleVersion < 7) {

@@ -320,6 +319,3 @@ params.compatibleVersion = 7;

const playlist = new MasterPlaylist();
for (const [index, line] of lines.entries()) {
const name = line.name;
const value = line.value;
const attributes = line.attributes;
for (const [index, {name, value, attributes}] of lines.entries()) {
if (name === 'EXT-X-VERSION') {

@@ -389,5 +385,3 @@ playlist.version = value;

for (let i = start; i <= end; i++) {
const name = lines[i].name;
const value = lines[i].value;
const attributes = lines[i].attributes;
const {name, value, attributes} = lines[i];
if (name === 'EXTINF') {

@@ -456,9 +450,7 @@ if (!Number.isInteger(value.duration) && params.compatibleVersion < 3) {

let discontinuitySequence = 0;
let key = null;
let map = null;
let currentKey = null;
let currentMap = null;
for (const [index, line] of lines.entries()) {
const name = line.name;
const value = line.value;
const attributes = line.attributes;
if (line.category === 'Segment') {
const {name, value, attributes, category} = line;
if (category === 'Segment') {
if (segmentStart === -1) {

@@ -519,21 +511,22 @@ segmentStart = index;

if (segment) {
if (segment.discontinuity) {
const {discontinuity, key, map, byterange, uri} = segment;
if (discontinuity) {
segment.discontinuitySequence = ++discontinuitySequence;
}
if (segment.key) {
key = segment.key;
} else if (key) {
segment.key = key;
if (key) {
currentKey = key;
} else if (currentKey) {
segment.key = currentKey;
}
if (segment.map) {
map = segment.map;
} else if (map) {
segment.map = map;
if (map) {
currentMap = map;
} else if (currentMap) {
segment.map = currentMap;
}
if (segment.byterange && segment.byterange.offset === -1) {
const segments = playlist.segments;
if (byterange && byterange.offset === -1) {
const {segments} = playlist;
if (segments.length > 0) {
const prevSegment = segments[segments.length - 1];
if (prevSegment.byterange && prevSegment.uri === segment.uri) {
segment.byterange.offset = prevSegment.byterange.offset + prevSegment.byterange.length;
if (prevSegment.byterange && prevSegment.uri === uri) {
byterange.offset = prevSegment.byterange.offset + prevSegment.byterange.length;
} else {

@@ -561,9 +554,8 @@ utils.INVALIDPLAYLIST('If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST be a sub-range of the same media resource');

for (let i = segments.length - 1; i >= 0; i--) {
const segment = segments[i];
if (segment.programDateTime) {
const {programDateTime, dateRange} = segments[i];
if (programDateTime) {
hasProgramDateTime = true;
}
if (segment.dateRange) {
if (dateRange) {
hasDateRange = true;
const dateRange = segment.dateRange;
if (dateRange.endOnNext && (dateRange.end || dateRange.duration)) {

@@ -570,0 +562,0 @@ utils.INVALIDPLAYLIST('An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.');

Sorry, the diff of this file is too big to display

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