hls-parser
Advanced tools
Comparing version 0.2.5 to 0.3.0
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HLS=e():t.HLS=e()}(window,function(){return function(r){var n={};function i(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}return i.m=r,i.c=n,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(t,e,r){(function(n){function E(t,e){return function(t){if(Array.isArray(t))return t}(t)||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||null==s.return||s.return()}finally{if(i)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function p(t){throw t}function i(t){var e,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10;return"number"==typeof t?t:(e=10===r?parseFloat(t,r):parseInt(t,r),isNaN(e)?0:e)}t.exports={THROW:p,ASSERT:function(t){for(var e=arguments.length,r=new Array(1<e?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var i=!0,o=!1,a=void 0;try{for(var s,u=r.entries()[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var c=E(s.value,2),f=c[0];c[1]||p(new Error("".concat(t," : Failed at [").concat(f,"]")))}}catch(t){o=!0,a=t}finally{try{i||null==u.return||u.return()}finally{if(o)throw a}}},CONDITIONALASSERT:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=!0,i=!1,o=void 0;try{for(var a,s=e.entries()[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=E(a.value,2),c=u[0],f=E(u[1],2),l=f[0],h=f[1];l&&(h||p(new Error("Conditional Assert : Failed at [".concat(c,"]"))))}}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}},PARAMCHECK:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=!0,i=!1,o=void 0;try{for(var a,s=e.entries()[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=E(a.value,2),c=u[0];void 0===u[1]&&p(new Error("Param Check : Failed at [".concat(c,"]")))}}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}},CONDITIONALPARAMCHECK:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=!0,i=!1,o=void 0;try{for(var a,s=e.entries()[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=E(a.value,2),c=u[0],f=E(u[1],2),l=f[0],h=f[1];l&&void 0===h&&p(new Error("Conditional Param Check : Failed at [".concat(c,"]")))}}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}},INVALIDPLAYLIST:function(t){p(new Error("Invalid Playlist : ".concat(t)))},toNumber:i,hexToByteSequence:function(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var e=[],r=0;r<t.length;r+=2)e.push(i(t.substr(r,2),16));return n.from(e)},byteSequenceToHex:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:t.length;r<=e&&p(new Error("end must be larger than start : start=".concat(e,", end=").concat(r)));for(var n=[],i=e;i<r;i++)n.push("0".concat((255&t[i]).toString(16).toUpperCase()).slice(-2));return"0x".concat(n.join(""))},tryCatch:function(t,e){try{return t()}catch(t){return e(t)}},splitAt:function(t,e){for(var r=2<arguments.length&&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=1<arguments.length&&void 0!==arguments[1]?arguments[1]:" ";return t&&(t=t.trim()," "===e||(t.startsWith(e)&&(t=t.slice(1)),t.endsWith(e)&&(t=t.slice(0,-1)))),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||null==s.return||s.return()}finally{if(i)throw o}}return e.join("")},formatDate:function(t){var e=t.getUTCFullYear(),r=("0"+(t.getUTCMonth()+1)).slice(-2),n=("0"+t.getUTCDate()).slice(-2),i=("0"+t.getUTCHours()).slice(-2),o=("0"+t.getUTCMinutes()).slice(-2),a=("0"+t.getUTCSeconds()).slice(-2),s=("00"+t.getUTCMilliseconds()).slice(-3);return"".concat(e,"-").concat(r,"-").concat(n,"T").concat(i,":").concat(o,":").concat(a,".").concat(s,"Z")},hasOwnProp:function(t,e){return Object.hasOwnProperty.call(t,e)}}}).call(this,r(4).Buffer)},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function y(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):e}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function I(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var S=r(0),a=function t(e){I(this,t),S.PARAMCHECK(e),this.type=e},s=function(t){function c(t){var e,r=t.isMasterPlaylist,n=t.uri,i=t.version,o=t.independentSegments,a=void 0!==o&&o,s=t.start,u=t.source;return I(this,c),e=y(this,d(c).call(this,"playlist")),S.PARAMCHECK(r),e.isMasterPlaylist=r,e.uri=n,e.version=i,e.independentSegments=a,e.start=s,e.source=u,e}return i(c,a),c}(),u=function(t){function c(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};I(this,c),e.isMasterPlaylist=!0,t=y(this,d(c).call(this,e));var r=e.variants,n=void 0===r?[]:r,i=e.currentVariant,o=e.sessionDataList,a=void 0===o?[]:o,s=e.sessionKeyList,u=void 0===s?[]:s;return t.variants=n,t.currentVariant=i,t.sessionDataList=a,t.sessionKeyList=u,t}return i(c,s),c}(),c=function(t){function p(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};I(this,p),e.isMasterPlaylist=!1,t=y(this,d(p).call(this,e));var r=e.targetDuration,n=e.mediaSequenceBase,i=void 0===n?0:n,o=e.discontinuitySequenceBase,a=void 0===o?0:o,s=e.endlist,u=void 0!==s&&s,c=e.playlistType,f=e.isIFrame,l=e.segments,h=void 0===l?[]:l,E=e.hash;return t.targetDuration=r,t.mediaSequenceBase=i,t.discontinuitySequenceBase=a,t.endlist=u,t.playlistType=c,t.isIFrame=f,t.segments=h,t.hash=E,t}return i(p,s),p}(),f=function(t){function T(t){var e,r=t.uri,n=t.mimeType,i=t.data,o=t.duration,a=t.title,s=t.byterange,u=t.discontinuity,c=t.mediaSequenceNumber,f=t.discontinuitySequence,l=t.key,h=t.map,E=t.programDateTime,p=t.dateRange;return I(this,T),e=y(this,d(T).call(this,"segment")),S.PARAMCHECK(r,c,f),e.uri=r,e.mimeType=n,e.data=i,e.duration=o,e.title=a,e.byterange=s,e.discontinuity=u,e.mediaSequenceNumber=c,e.discontinuitySequence=f,e.key=l,e.map=h,e.programDateTime=E,e.dateRange=p,e}return i(T,a),T}();t.exports={Rendition:function t(e){var r=e.type,n=e.uri,i=e.groupId,o=e.language,a=e.assocLanguage,s=e.name,u=e.isDefault,c=e.autoselect,f=e.forced,l=e.instreamId,h=e.characteristics,E=e.channels;I(this,t),S.PARAMCHECK(r,i,s),S.CONDITIONALASSERT(["SUBTITLES"===r,n],["CLOSED-CAPTIONS"===r,l],["CLOSED-CAPTIONS"===r,!n],[f,"CLOSED-CAPTIONS"===r]),this.type=r,this.uri=n,this.groupId=i,this.language=o,this.assocLanguage=a,this.name=s,this.isDefault=u,this.autoselect=c,this.forced=f,this.instreamId=l,this.characteristics=h,this.channels=E},Variant:function t(e){var r=e.uri,n=e.isIFrameOnly,i=void 0!==n&&n,o=e.bandwidth,a=e.averageBandwidth,s=e.codecs,u=e.resolution,c=e.frameRate,f=e.hdcpLevel,l=e.audio,h=void 0===l?[]:l,E=e.video,p=void 0===E?[]:E,T=e.subtitles,y=void 0===T?[]:T,d=e.closedCaptions,g=void 0===d?[]:d,A=e.currentRenditions,v=void 0===A?{audio:0,video:0,subtitles:0,closedCaptions:0}:A;I(this,t),S.PARAMCHECK(r,o),this.uri=r,this.isIFrameOnly=i,this.bandwidth=o,this.averageBandwidth=a,this.codecs=s,this.resolution=u,this.frameRate=c,this.hdcpLevel=f,this.audio=h,this.video=p,this.subtitles=y,this.closedCaptions=g,this.currentRenditions=v},SessionData:function t(e){var r=e.id,n=e.value,i=e.uri,o=e.language;I(this,t),S.PARAMCHECK(r,n||i),S.ASSERT("SessionData cannot have both value and uri, shoud be either.",!(n&&i)),this.id=r,this.value=n,this.uri=i,this.language=o},Key:function t(e){var r=e.method,n=e.uri,i=e.iv,o=e.format,a=e.formatVersion;I(this,t),S.PARAMCHECK(r),S.CONDITIONALPARAMCHECK(["NONE"!==r,n]),S.CONDITIONALASSERT(["NONE"===r,!(n||i||o||a)]),this.method=r,this.uri=n,this.iv=i,this.format=o,this.formatVersion=a},MediaInitializationSection:function t(e){var r=e.uri,n=e.mimeType,i=e.byterange;I(this,t),S.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,o=e.end,a=e.duration,s=e.plannedDuration,u=e.endOnNext,c=e.attributes,f=void 0===c?{}:c;I(this,t),S.PARAMCHECK(r,i),S.CONDITIONALPARAMCHECK([!0===u,n]),S.CONDITIONALASSERT([o,i<=o],[a,0<=a],[s,0<=s]),this.id=r,this.classId=n,this.start=i,this.end=o,this.duration=a,this.plannedDuration=s,this.endOnNext=u,this.attributes=f},Playlist:s,MasterPlaylist:u,MediaPlaylist:c,Segment:f}},function(t,e,r){var n=r(3),i=r(9),o=r(1);t.exports={parse:n,stringify:i,types:o}},function(t,e,r){function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||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||null==s.return||s.return()}finally{if(i)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var X=r(0),n=r(1),s=n.Rendition,m=n.Variant,S=n.SessionData,N=n.Key,f=n.MediaInitializationSection,l=n.DateRange,b=n.MasterPlaylist,O=n.MediaPlaylist,h=n.Segment;function E(t){return X.trim(t,'"')}function p(t){var e=X.splitAt(t,"@");return{length:X.toNumber(e[0]),offset:e[1]?X.toNumber(e[1]):-1}}function R(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function i(t){var e=X.splitByCommaWithPreservingQuotes(t),f={};return e.forEach(function(t){var e,r,n,i,o,a=w(X.splitAt(t,"="),2),s=a[0],u=a[1],c=E(u);switch(s){case"URI":f[s]=c;break;case"START-DATE":case"END-DATE":f[s]=new Date(c);break;case"IV":f[s]=(i=c,16!==(o=X.hexToByteSequence(i)).length&&X.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),o);break;case"BYTERANGE":f[s]=p(c);break;case"RESOLUTION":f[s]=(r=c,n=X.splitAt(r,"x"),{width:X.toNumber(n[0]),height:X.toNumber(n[1])});break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":f[s]="YES"===c;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":f[s]=X.toNumber(c);break;default:s.startsWith("SCTE35-")?f[s]=X.hexToByteSequence(c):s.startsWith("X-")?f[s]=(e=u).startsWith('"')?E(e):e.startsWith("0x")||e.startsWith("0X")?X.hexToByteSequence(e):X.toNumber(e):f[s]=c}}),f}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[X.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,i(e)];case"EXTINF":return[(r=e,n=X.splitAt(r,","),{duration:X.toNumber(n[0]),title:decodeURIComponent(escape(n[1]))}),null];case"EXT-X-BYTERANGE":return[p(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];case"EXT-X-PLAYLIST-TYPE":default:return[e,null]}var r,n}function T(){X.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function D(t,e,r){var n,i=(n=e.attributes,new s({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})),o=t[X.camelify(r)],a=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||null==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.":""}(o,i);a&&X.INVALIDPLAYLIST(a),o.push(i),i.isDefault&&(t.currentRenditions[X.camelify(r)]=o.length-1)}function P(t,e,r){var n,i,o,a=3<arguments.length&&void 0!==arguments[3]&&arguments[3],s=4<arguments.length?arguments[4]:void 0,u=new m({uri:r,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"]}),c=!0,f=!1,l=void 0;try{for(var h,E=t[Symbol.iterator]();!(c=(h=E.next()).done);c=!0){var p=h.value;if("EXT-X-MEDIA"===p.name){var T=p.attributes,y=T.TYPE;if(y&&T["GROUP-ID"]||X.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[y]===T["GROUP-ID"]&&(D(u,p,y),"CLOSED-CAPTIONS"===y)){var d=!0,g=!1,A=void 0;try{for(var v,I=u.closedCaptions[Symbol.iterator]();!(d=(v=I.next()).done);d=!0){var S=v.value.instreamId;if(S&&S.startsWith("SERVICE")&&s.compatibleVersion<7){s.compatibleVersion=7;break}}}catch(t){g=!0,A=t}finally{try{d||null==I.return||I.return()}finally{if(g)throw A}}}}}}catch(t){f=!0,l=t}finally{try{c||null==E.return||E.return()}finally{if(f)throw l}}return n=e,i=u,o=s,["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(e){"CLOSED-CAPTIONS"===e&&"NONE"===n[e]?(o.isClosedCaptionsNone=!0,i.closedCaptions=[]):n[e]&&!i[X.camelify(e)].find(function(t){return t.groupId===n[e]})&&X.INVALIDPLAYLIST("".concat(e," attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is ").concat(e,"."))}),u.isIFrameOnly=a,u}function L(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 M(a,t,e,r,n,i,s){for(var u=new h({uri:t,mediaSequenceNumber:n,discontinuitySequence:i}),o=function(t){var e=a[t],r=e.name,n=e.value,i=e.attributes;if("EXTINF"===r)!Number.isInteger(n.duration)&&s.compatibleVersion<3&&(s.compatibleVersion=3),Math.round(n.duration)>s.targetDuration&&X.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),u.duration=n.duration,u.title=n.title;else if("EXT-X-BYTERANGE"===r)s.compatibleVersion<4&&(s.compatibleVersion=4),u.byterange=n;else if("EXT-X-DISCONTINUITY"===r)u.discontinuity=!0;else if("EXT-X-KEY"===r)R(s,i),u.key=new N({method:i.METHOD,uri:i.URI,iv:i.IV,format:i.KEYFORMAT,formatVersion:i.KEYFORMATVERSIONS});else if("EXT-X-MAP"===r)s.compatibleVersion<5&&(s.compatibleVersion=5),s.hasMap=!0,u.map=new f({uri:i.URI,byterange:i.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===r)u.programDateTime=n;else if("EXT-X-DATERANGE"===r){var o={};Object.keys(i).forEach(function(t){(t.startsWith("SCTE35-")||t.startsWith("X-"))&&(o[t]=i[t])}),u.dateRange=new l({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:o})}},c=e;c<=r;c++)o(c);return u}function o(t,e){var r=new O,n=-1,i=0,o=!1,a=0,s=null,u=null,c=!0,f=!1,l=void 0;try{for(var h,E=t.entries()[Symbol.iterator]();!(c=(h=E.next()).done);c=!0){var p=w(h.value,2),T=p[0],y=p[1],d=y.name,g=y.value,A=y.attributes;if("Segment"!==y.category){if("EXT-X-VERSION"===d)void 0===r.version?r.version=g:X.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===d)r.targetDuration=e.targetDuration=g;else if("EXT-X-MEDIA-SEQUENCE"===d)0<r.segments.length&&X.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.mediaSequenceBase=i=g;else if("EXT-X-DISCONTINUITY-SEQUENCE"===d)0<r.segments.length&&X.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),o&&X.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT-X-DISCONTINUITY tag."),r.discontinuitySequenceBase=a=g;else if("EXT-X-ENDLIST"===d)r.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===d)r.playlistType=g;else if("EXT-X-I-FRAMES-ONLY"===d)e.compatibleVersion<4&&(e.compatibleVersion=4),r.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===d)r.independentSegments&&X.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0;else if("EXT-X-START"===d)r.start&&X.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof A["TIME-OFFSET"]&&X.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:A["TIME-OFFSET"],precise:A.PRECISE||!1};else if("string"==typeof y){-1===n&&X.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),r.targetDuration||X.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED");var v=M(t,y,n,T-1,i++,a,e);if(v){var I=v.discontinuity,S=v.key,m=v.map,N=v.byterange,b=v.uri;if(I&&(v.discontinuitySequence=++a),S?s=S:s&&(v.key=s),m?u=m:u&&(v.map=u),N&&-1===N.offset){var R=r.segments;if(0<R.length){var D=R[R.length-1];D.byterange&&D.uri===b?N.offset=D.byterange.offset+D.byterange.length:X.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 X.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}r.segments.push(v)}n=-1}}else-1===n&&(n=T),"EXT-X-DISCONTINUITY"===d&&(o=!0)}}catch(t){f=!0,l=t}finally{try{c||null==E.return||E.return()}finally{if(f)throw l}}return function(t){for(var e=new Map,r=new Map,n=!1,i=!1,o=t.length-1;0<=o;o--){var a=t[o],s=a.programDateTime,u=a.dateRange;if(s&&(i=!0),u){n=!0,u.endOnNext&&(u.end||u.duration)&&X.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var c=u.start.getTime(),f=u.duration||0;u.end&&u.duration&&c+1e3*f!==u.end.getTime()&&X.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),u.endOnNext&&(u.end=e.get(u.classId)),e.set(u.classId,u.start);var l=u.end?u.end.getTime():u.start.getTime()+1e3*(u.duration||0),h=r.get(u.classId);if(h){var E=!0,p=!1,T=void 0;try{for(var y,d=h[Symbol.iterator]();!(E=(y=d.next()).done);E=!0){var g=y.value;(g.start<=c&&g.end>c||g.start>=c&&g.start<l)&&X.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){p=!0,T=t}finally{try{E||null==d.return||d.return()}finally{if(p)throw T}}h.push({start:c,end:l})}else r.set(u.classId,[{start:c,end:l}])}}n&&!i&&X.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 a(t,e){var r,n,i=w(-1===(n=(r=t).indexOf(":"))?[r.slice(1).trim(),null]:[r.slice(1,n).trim(),r.slice(n+1).trim()],2),o=i[0],a=i[1],s=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"}}(o);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?e.isMasterPlaylist=!1:e.isMasterPlaylist&&T();if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return e.isMasterPlaylist=!0;!1===e.isMasterPlaylist&&T()}}(s,e),"Unknown"===s)return null;"MediaPlaylist"===s&&(e.hash[o]&&X.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[o]=!0);var u=w(c(o,a),2);return{name:o,category:s,value:u[0],attributes:u[1]}}function u(t,e){var r;return e.isMasterPlaylist?r=function(t,r){var n=new b,e=!0,i=!1,o=void 0;try{for(var a,s=t.entries()[Symbol.iterator]();!(e=(a=s.next()).done);e=!0){var u=w(a.value,2),c=u[0],f=u[1],l=f.name,h=f.value,E=f.attributes;if("EXT-X-VERSION"===l)n.version=h;else if("EXT-X-STREAM-INF"===l){var p=t[c+1];("string"!=typeof p||p.startsWith("#EXT"))&&X.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var T=P(t,E,p,!1,r);T&&n.variants.push(T)}else if("EXT-X-I-FRAME-STREAM-INF"===l){var y=P(t,E,E.URI,!0,r);y&&n.variants.push(y)}else"EXT-X-SESSION-DATA"===l?function(){var e=new S({id:E["DATA-ID"],value:E.VALUE,uri:E.URI,language:E.LANGUAGE});n.sessionDataList.find(function(t){return t.id===e.id&&t.language===e.language})&&X.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."),n.sessionDataList.push(e)}():"EXT-X-SESSION-KEY"===l?function(){"NONE"===E.METHOD&&X.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var e=new N({method:E.METHOD,uri:E.URI,iv:E.IV,format:E.KEYFORMAT,formatVersion:E.KEYFORMATVERSIONS});n.sessionKeyList.find(function(t){return L(t,e)})&&X.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."),R(r,E),n.sessionKeyList.push(e)}():"EXT-X-INDEPENDENT-SEGMENTS"===l?(n.independentSegments&&X.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),n.independentSegments=!0):"EXT-X-START"===l&&(n.start&&X.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof E["TIME-OFFSET"]&&X.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),n.start={offset:E["TIME-OFFSET"],precise:E.PRECISE||!1})}}catch(t){i=!0,o=t}finally{try{e||null==s.return||s.return()}finally{if(i)throw o}}if(r.isClosedCaptionsNone){var d=!0,g=!1,A=void 0;try{for(var v,I=n.variants[Symbol.iterator]();!(d=(v=I.next()).done);d=!0)0<v.value.closedCaptions.length&&X.INVALIDPLAYLIST("If there is a variant with CLOSED-CAPTIONS attribute of NONE, all EXT-X-STREAM-INF tags MUST have this attribute with a value of NONE")}catch(t){g=!0,A=t}finally{try{d||null==I.return||I.return()}finally{if(g)throw A}}}return n}(t,e):!(r=o(t,e)).isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6),1<e.compatibleVersion&&(!r.version||r.version<e.compatibleVersion)&&X.INVALIDPLAYLIST("EXT-X-VERSION needs to be ".concat(e.compatibleVersion," or higher.")),r}t.exports=function(t){var n,i,e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,isClosedCaptionsNone:!1,hash:{}},r=u((n=e,i=[],t.split("\n").forEach(function(t){var e=t.trim();if(e)if(e.startsWith("#")){if(e.startsWith("#EXT")){var r=a(e,n);return void(r&&i.push(r))}}else i.push(e)}),0!==i.length&&"EXTM3U"===i[0].name||X.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),i),e);return r.source=t,r}},function(t,B,e){"use strict";(function(t){ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HLS=e():t.HLS=e()}(window,function(){return function(r){var n={};function i(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}return i.m=r,i.c=n,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(t,e,r){(function(n){function E(t,e){return function(t){if(Array.isArray(t))return t}(t)||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||null==s.return||s.return()}finally{if(i)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var e={};function p(t){if(!e.strictMode)return console.error(t.message);throw t}function i(t){var e,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10;return"number"==typeof t?t:(e=10===r?parseFloat(t,r):parseInt(t,r),isNaN(e)?0:e)}t.exports={THROW:p,ASSERT:function(t){for(var e=arguments.length,r=new Array(1<e?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var i=!0,o=!1,a=void 0;try{for(var s,u=r.entries()[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var c=E(s.value,2),f=c[0];c[1]||p(new Error("".concat(t," : Failed at [").concat(f,"]")))}}catch(t){o=!0,a=t}finally{try{i||null==u.return||u.return()}finally{if(o)throw a}}},CONDITIONALASSERT:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=!0,i=!1,o=void 0;try{for(var a,s=e.entries()[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=E(a.value,2),c=u[0],f=E(u[1],2),l=f[0],h=f[1];l&&(h||p(new Error("Conditional Assert : Failed at [".concat(c,"]"))))}}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}},PARAMCHECK:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=!0,i=!1,o=void 0;try{for(var a,s=e.entries()[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=E(a.value,2),c=u[0];void 0===u[1]&&p(new Error("Param Check : Failed at [".concat(c,"]")))}}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}},CONDITIONALPARAMCHECK:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n=!0,i=!1,o=void 0;try{for(var a,s=e.entries()[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var u=E(a.value,2),c=u[0],f=E(u[1],2),l=f[0],h=f[1];l&&void 0===h&&p(new Error("Conditional Param Check : Failed at [".concat(c,"]")))}}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}},INVALIDPLAYLIST:function(t){p(new Error("Invalid Playlist : ".concat(t)))},toNumber:i,hexToByteSequence:function(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var e=[],r=0;r<t.length;r+=2)e.push(i(t.substr(r,2),16));return n.from(e)},byteSequenceToHex:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:t.length;r<=e&&p(new Error("end must be larger than start : start=".concat(e,", end=").concat(r)));for(var n=[],i=e;i<r;i++)n.push("0".concat((255&t[i]).toString(16).toUpperCase()).slice(-2));return"0x".concat(n.join(""))},tryCatch:function(t,e){try{return t()}catch(t){return e(t)}},splitAt:function(t,e){for(var r=2<arguments.length&&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=1<arguments.length&&void 0!==arguments[1]?arguments[1]:" ";return t&&(t=t.trim()," "===e||(t.startsWith(e)&&(t=t.slice(1)),t.endsWith(e)&&(t=t.slice(0,-1)))),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||null==s.return||s.return()}finally{if(i)throw o}}return e.join("")},formatDate:function(t){var e=t.getUTCFullYear(),r=("0"+(t.getUTCMonth()+1)).slice(-2),n=("0"+t.getUTCDate()).slice(-2),i=("0"+t.getUTCHours()).slice(-2),o=("0"+t.getUTCMinutes()).slice(-2),a=("0"+t.getUTCSeconds()).slice(-2),s=("00"+t.getUTCMilliseconds()).slice(-3);return"".concat(e,"-").concat(r,"-").concat(n,"T").concat(i,":").concat(o,":").concat(a,".").concat(s,"Z")},hasOwnProp:function(t,e){return Object.hasOwnProperty.call(t,e)},setOptions:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};e=Object.assign(e,t)},getOptions:function(){return Object.assign({},e)}}}).call(this,r(3).Buffer)},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function y(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):e}function d(t){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function I(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var S=r(0),a=function t(e){I(this,t),S.PARAMCHECK(e),this.type=e},s=function(t){function c(t){var e,r=t.isMasterPlaylist,n=t.uri,i=t.version,o=t.independentSegments,a=void 0!==o&&o,s=t.start,u=t.source;return I(this,c),e=y(this,d(c).call(this,"playlist")),S.PARAMCHECK(r),e.isMasterPlaylist=r,e.uri=n,e.version=i,e.independentSegments=a,e.start=s,e.source=u,e}return i(c,a),c}(),u=function(t){function c(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};I(this,c),e.isMasterPlaylist=!0,t=y(this,d(c).call(this,e));var r=e.variants,n=void 0===r?[]:r,i=e.currentVariant,o=e.sessionDataList,a=void 0===o?[]:o,s=e.sessionKeyList,u=void 0===s?[]:s;return t.variants=n,t.currentVariant=i,t.sessionDataList=a,t.sessionKeyList=u,t}return i(c,s),c}(),c=function(t){function p(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};I(this,p),e.isMasterPlaylist=!1,t=y(this,d(p).call(this,e));var r=e.targetDuration,n=e.mediaSequenceBase,i=void 0===n?0:n,o=e.discontinuitySequenceBase,a=void 0===o?0:o,s=e.endlist,u=void 0!==s&&s,c=e.playlistType,f=e.isIFrame,l=e.segments,h=void 0===l?[]:l,E=e.hash;return t.targetDuration=r,t.mediaSequenceBase=i,t.discontinuitySequenceBase=a,t.endlist=u,t.playlistType=c,t.isIFrame=f,t.segments=h,t.hash=E,t}return i(p,s),p}(),f=function(t){function T(t){var e,r=t.uri,n=t.mimeType,i=t.data,o=t.duration,a=t.title,s=t.byterange,u=t.discontinuity,c=t.mediaSequenceNumber,f=t.discontinuitySequence,l=t.key,h=t.map,E=t.programDateTime,p=t.dateRange;return I(this,T),e=y(this,d(T).call(this,"segment")),S.PARAMCHECK(r,c,f),e.uri=r,e.mimeType=n,e.data=i,e.duration=o,e.title=a,e.byterange=s,e.discontinuity=u,e.mediaSequenceNumber=c,e.discontinuitySequence=f,e.key=l,e.map=h,e.programDateTime=E,e.dateRange=p,e}return i(T,a),T}();t.exports={Rendition:function t(e){var r=e.type,n=e.uri,i=e.groupId,o=e.language,a=e.assocLanguage,s=e.name,u=e.isDefault,c=e.autoselect,f=e.forced,l=e.instreamId,h=e.characteristics,E=e.channels;I(this,t),S.PARAMCHECK(r,i,s),S.CONDITIONALASSERT(["SUBTITLES"===r,n],["CLOSED-CAPTIONS"===r,l],["CLOSED-CAPTIONS"===r,!n],[f,"CLOSED-CAPTIONS"===r]),this.type=r,this.uri=n,this.groupId=i,this.language=o,this.assocLanguage=a,this.name=s,this.isDefault=u,this.autoselect=c,this.forced=f,this.instreamId=l,this.characteristics=h,this.channels=E},Variant:function t(e){var r=e.uri,n=e.isIFrameOnly,i=void 0!==n&&n,o=e.bandwidth,a=e.averageBandwidth,s=e.codecs,u=e.resolution,c=e.frameRate,f=e.hdcpLevel,l=e.audio,h=void 0===l?[]:l,E=e.video,p=void 0===E?[]:E,T=e.subtitles,y=void 0===T?[]:T,d=e.closedCaptions,g=void 0===d?[]:d,A=e.currentRenditions,v=void 0===A?{audio:0,video:0,subtitles:0,closedCaptions:0}:A;I(this,t),S.PARAMCHECK(r,o),this.uri=r,this.isIFrameOnly=i,this.bandwidth=o,this.averageBandwidth=a,this.codecs=s,this.resolution=u,this.frameRate=c,this.hdcpLevel=f,this.audio=h,this.video=p,this.subtitles=y,this.closedCaptions=g,this.currentRenditions=v},SessionData:function t(e){var r=e.id,n=e.value,i=e.uri,o=e.language;I(this,t),S.PARAMCHECK(r,n||i),S.ASSERT("SessionData cannot have both value and uri, shoud be either.",!(n&&i)),this.id=r,this.value=n,this.uri=i,this.language=o},Key:function t(e){var r=e.method,n=e.uri,i=e.iv,o=e.format,a=e.formatVersion;I(this,t),S.PARAMCHECK(r),S.CONDITIONALPARAMCHECK(["NONE"!==r,n]),S.CONDITIONALASSERT(["NONE"===r,!(n||i||o||a)]),this.method=r,this.uri=n,this.iv=i,this.format=o,this.formatVersion=a},MediaInitializationSection:function t(e){var r=e.uri,n=e.mimeType,i=e.byterange;I(this,t),S.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,o=e.end,a=e.duration,s=e.plannedDuration,u=e.endOnNext,c=e.attributes,f=void 0===c?{}:c;I(this,t),S.PARAMCHECK(r,i),S.CONDITIONALPARAMCHECK([!0===u,n]),S.CONDITIONALASSERT([o,i<=o],[a,0<=a],[s,0<=s]),this.id=r,this.classId=n,this.start=i,this.end=o,this.duration=a,this.plannedDuration=s,this.endOnNext=u,this.attributes=f},Playlist:s,MasterPlaylist:u,MediaPlaylist:c,Segment:f}},function(t,e,r){var n=r(0),i=n.getOptions,o=n.setOptions,a=r(8),s=r(9),u=r(1);t.exports={parse:a,stringify:s,types:u,getOptions:i,setOptions:o}},function(t,B,e){"use strict";(function(t){ | ||
/*! | ||
@@ -8,3 +8,3 @@ * The buffer module from node.js, for the browser. | ||
*/ | ||
var n=e(6),o=e(7),a=e(8);function r(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(r()<e)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=l.prototype:(null===t&&(t=new l(e)),t.length=e),t}function l(t,e,r){if(!(l.TYPED_ARRAY_SUPPORT||this instanceof l))return new l(t,e,r);if("number"!=typeof t)return i(this,t,e,r);if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}function i(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);l.TYPED_ARRAY_SUPPORT?(t=e).__proto__=l.prototype:t=f(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!l.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|E(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(l.isBuffer(e)){var r=0|h(e.length);return 0===(t=s(t,r)).length||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):f(t,e);if("Buffer"===e.type&&a(e.data))return f(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function u(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 c(t,e){if(u(e),t=s(t,e<0?0:0|h(e)),!l.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e){var r=e.length<0?0:0|h(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function E(t,e){if(l.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 C(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(n)return C(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function T(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?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=l.from(e,n)),l.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(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;s/=a=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var f=-1;for(o=r;o<s;o++)if(c(t,o)===c(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*a}else-1!==f&&(o-=o-f),f=-1}else for(s<r+u&&(r=s-u),o=r;0<=o;o--){for(var l=!0,h=0;h<u;h++)if(c(t,o+h)!==c(e,h)){l=!1;break}if(l)return o}return-1}function d(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?i<(n=Number(n))&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");o/2<n&&(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 _(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function v(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,c=t[i],f=null,l=239<c?4:223<c?3:191<c?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&127<(u=(31&c)<<6|63&o)&&(f=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&2047<(u=(15&c)<<12|(63&o)<<6|63&a)&&(u<55296||57343<u)&&(f=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)&&65535<(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)&&u<1114112&&(f=u)}null===f?(f=65533,l=1):65535<f&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(t){var e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=I));return r}(n)}B.Buffer=l,B.SlowBuffer=function(t){+t!=t&&(t=0);return l.alloc(+t)},B.INSPECT_MAX_BYTES=50,l.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}}(),B.kMaxLength=r(),l.poolSize=8192,l._augment=function(t){return t.__proto__=l.prototype,t},l.from=function(t,e,r){return i(null,t,e,r)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(t,e,r){return n=null,o=e,a=r,u(i=t),i<=0?s(n,i):void 0!==o?"string"==typeof a?s(n,i).fill(o,a):s(n,i).fill(o):s(n,i);var n,i,o,a},l.allocUnsafe=function(t){return c(null,t)},l.allocUnsafeSlow=function(t){return c(null,t)},l.isBuffer=function(t){return!(null==t||!t._isBuffer)},l.compare=function(t,e){if(!l.isBuffer(t)||!l.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},l.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}},l.concat=function(t,e){if(!a(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);var r;if(void 0===e)for(r=e=0;r<t.length;++r)e+=t[r].length;var n=l.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!l.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},l.byteLength=E,l.prototype._isBuffer=!0,l.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)p(this,e,e+1);return this},l.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)p(this,e,e+3),p(this,e+1,e+2);return this},l.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)p(this,e,e+7),p(this,e+1,e+6),p(this,e+2,e+5),p(this,e+3,e+4);return this},l.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?v(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 N(this,e,r);case"utf8":case"utf-8":return v(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return m(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",e=B.INSPECT_MAX_BYTES;return 0<this.length&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},l.prototype.compare=function(t,e,r,n,i){if(!l.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(i<=n&&r<=e)return 0;if(i<=n)return-1;if(r<=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=t.slice(e,r),f=0;f<s;++f)if(u[f]!==c[f]){o=u[f],a=c[f];break}return o<a?-1:a<o?1:0},l.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},l.prototype.indexOf=function(t,e,r){return T(this,t,e,r,!0)},l.prototype.lastIndexOf=function(t,e,r){return T(this,t,e,r,!1)},l.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||i<r)&&(r=i),0<t.length&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,a,s,u,c,f,l,h,E,p=!1;;)switch(n){case"hex":return d(this,t,e,r);case"utf8":case"utf-8":return h=e,E=r,_(C(t,(l=this).length-h),l,h,E);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return g(this,t,e,r);case"base64":return u=this,c=e,f=r,_(Y(t),u,c,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=e,s=r,_(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}(t,(o=this).length-a),o,a,s);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function S(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 m(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 N(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||n<r)&&(r=n);for(var i="",o=e;o<r;++o)i+=U(t[o]);return i}function b(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 R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(r<t+e)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,r,n,i,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(i<e||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function w(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 X(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 O(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 P(t,e,r,n,i){return i||O(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,i){return i||O(t,0,r,8),o.write(t,e,r,n,52,8),r+8}l.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):n<t&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):n<e&&(e=n),e<t&&(e=t),l.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=l.prototype;else{var i=e-t;r=new l(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},l.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},l.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t+--e],i=1;0<e&&(i*=256);)n+=this[t+--e]*i;return n},l.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return(i*=128)<=n&&(n-=Math.pow(2,8*e)),n},l.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=e,i=1,o=this[t+--n];0<n&&(i*=256);)o+=this[t+--n]*i;return(i*=128)<=o&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||D(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},l.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||D(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;0<=--i&&(o*=256);)this[e+i]=t/o&255;return e+r},l.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):w(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):w(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):X(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):X(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(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},l.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;0<=--o&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):w(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):w(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):X(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):X(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,r){return P(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return P(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},l.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),0<n&&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;0<=i;--i)t[i+e]=this[i+r];else if(o<1e3||!l.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},l.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&&!l.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=l.isBuffer(t)?t:C(new l(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function U(t){return t<16?"0"+t.toString(16):t.toString(16)}function C(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if(55295<(r=t.charCodeAt(a))&&r<57344){if(!i){if(56319<r){-1<(e-=3)&&o.push(239,191,189);continue}if(a+1===n){-1<(e-=3)&&o.push(239,191,189);continue}i=r;continue}if(r<56320){-1<(e-=3)&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&-1<(e-=3)&&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 Y(t){return n.toByteArray(function(t){var e;if((t=(e=t,e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function _(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,e(5))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=E(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){for(var e,r=E(t),n=r[0],i=r[1],o=new h((c=n,f=i,3*(c+f)/4-f)),a=0,s=0<i?n-4:n,u=0;u<s;u+=4)e=l[t.charCodeAt(u)]<<18|l[t.charCodeAt(u+1)]<<12|l[t.charCodeAt(u+2)]<<6|l[t.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=255&e;var c,f;2===i&&(e=l[t.charCodeAt(u)]<<2|l[t.charCodeAt(u+1)]>>4,o[a++]=255&e);1===i&&(e=l[t.charCodeAt(u)]<<10|l[t.charCodeAt(u+1)]<<4|l[t.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=255&e);return o},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i=[],o=0,a=r-n;o<a;o+=16383)i.push(u(t,o,a<o+16383?a:o+16383));1===n?(e=t[r-1],i.push(s[e>>2]+s[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+"="));return i.join("")};for(var s=[],l=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i<o;++i)s[i]=n[i],l[n.charCodeAt(i)]=i;function E(t){var e=t.length;if(0<e%4)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 u(t,e,r){for(var n,i,o=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(s[(i=n)>>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,f=-7,l=r?i-1:0,h=r?-1:1,E=t[e+l];for(l+=h,o=E&(1<<-f)-1,E>>=-f,f+=s;0<f;o=256*o+t[e+l],l+=h,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;0<f;a=256*a+t[e+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(E?-1:1);a+=Math.pow(2,n),o-=c}return(E?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,f=(1<<c)-1,l=f>>1,h=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=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),2<=(e+=1<=a+l?h/u:h*Math.pow(2,1-l))*u&&(a++,u/=2),f<=a+l?(s=0,a=f):1<=a+l?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));8<=i;t[r+E]=255&s,E+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;0<c;t[r+E]=255&a,E+=p,a/=256,c-=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,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(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)}}function o(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):e}function s(t,e,r){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function u(t){var n="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;var e;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return a(t,arguments,f(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,t)})(t)}function a(t,e,r){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&c(i,r.prototype),i}).apply(null,arguments)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=r(0),h=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-MAP","#EXT-X-STREAM-INF"],E=["#EXT-X-KEY","#EXT-X-MEDIA"],p=function(t){function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=o(this,f(a).call(this))).baseUri=t,e}var e,r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(a,u(Array)),e=a,(r=[{key:"push",value:function(){for(var t=this,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=function(){var e=r[o];if(h.some(function(t){return e.startsWith(t)}))return s(f(a.prototype),"push",t).call(t,e),"continue";if(t.includes(e)){if(E.some(function(t){return e.startsWith(t)}))return"continue";l.INVALIDPLAYLIST("Redundant item (".concat(e,")"))}s(f(a.prototype),"push",t).call(t,e)},o=0;o<r.length;o++)i()}}])&&i(e.prototype,r),n&&i(e,n),a}();function v(t,e,r){var n=r?"#EXT-X-SESSION-KEY":"#EXT-X-KEY",i=["METHOD=".concat(e.method)];e.uri&&i.push('URI="'.concat(e.uri,'"')),e.iv&&(16!==e.iv.length&&l.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i.push("IV=".concat(l.byteSequenceToHex(e.iv)))),e.format&&i.push('KEYFORMAT="'.concat(e.format,'"')),e.formatVersion&&i.push('KEYFORMATVERSIONS="'.concat(e.formatVersion,'"')),t.push("".concat(n,":").concat(i.join(",")))}function I(t,e){var r=e.isIFrameOnly?"#EXT-X-I-FRAME-STREAM-INF":"#EXT-X-STREAM-INF",n=["BANDWIDTH=".concat(e.bandwidth)];if(e.averageBandwidth&&n.push("AVERAGE-BANDWIDTH=".concat(e.averageBandwidth)),e.isIFrameOnly&&n.push('URI="'.concat(e.uri,'"')),e.codecs&&n.push('CODECS="'.concat(e.codecs,'"')),e.resolution&&n.push("RESOLUTION=".concat(e.resolution.width,"x").concat(e.resolution.height)),e.frameRate&&n.push("FRAME-RATE=".concat(e.frameRate)),e.hdcpLevel&&n.push("HDCP-LEVEL=".concat(e.hdcpLevel)),0<e.audio.length){n.push('AUDIO="'.concat(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){N(t,s.value)}}catch(t){o=!0,a=t}finally{try{i||null==u.return||u.return()}finally{if(o)throw a}}}if(0<e.video.length){n.push('VIDEO="'.concat(e.video[0].groupId,'"'));var c=!0,f=!1,l=void 0;try{for(var h,E=e.video[Symbol.iterator]();!(c=(h=E.next()).done);c=!0){N(t,h.value)}}catch(t){f=!0,l=t}finally{try{c||null==E.return||E.return()}finally{if(f)throw l}}}if(0<e.subtitles.length){n.push('SUBTITLES="'.concat(e.subtitles[0].groupId,'"'));var p=!0,T=!1,y=void 0;try{for(var d,g=e.subtitles[Symbol.iterator]();!(p=(d=g.next()).done);p=!0){N(t,d.value)}}catch(t){T=!0,y=t}finally{try{p||null==g.return||g.return()}finally{if(T)throw y}}}if(0<e.closedCaptions.length){n.push('CLOSED-CAPTIONS="'.concat(e.closedCaptions[0].groupId,'"'));var A=!0,v=!1,I=void 0;try{for(var S,m=e.closedCaptions[Symbol.iterator]();!(A=(S=m.next()).done);A=!0){N(t,S.value)}}catch(t){v=!0,I=t}finally{try{A||null==m.return||m.return()}finally{if(v)throw I}}}t.push("".concat(r,":").concat(n.join(","))),e.isIFrameOnly||t.push("".concat(e.uri))}function N(t,e){var r=["TYPE=".concat(e.type),'GROUP-ID="'.concat(e.groupId,'"'),'NAME="'.concat(e.name,'"')];void 0!==e.isDefault&&r.push("DEFAULT=".concat(e.isDefault?"YES":"NO")),void 0!==e.autoselect&&r.push("AUTOSELECT=".concat(e.autoselect?"YES":"NO")),void 0!==e.forced&&r.push("FORCED=".concat(e.forced?"YES":"NO")),e.language&&r.push('LANGUAGE="'.concat(e.language,'"')),e.assocLanguage&&r.push('ASSOC-LANGUAGE="'.concat(e.assocLanguage,'"')),e.instreamId&&r.push('INSTREAM-ID="'.concat(e.instreamId,'"')),e.characteristics&&r.push('CHARACTERISTICS="'.concat(e.characteristics,'"')),e.channels&&r.push('CHANNELS="'.concat(e.channels,'"')),e.uri&&r.push('URI="'.concat(e.uri,'"')),t.push("#EXT-X-MEDIA:".concat(r.join(",")))}function T(t,e){e.byterange&&t.push("#EXT-X-BYTERANGE:".concat(e.byterange.length,"@").concat(e.byterange.offset)),e.discontinuity&&t.push("#EXT-X-DISCONTINUITY"),e.key&&v(t,e.key),e.map&&function(t,e){var r=['URI="'.concat(e.uri,'"')];e.byterange&&r.push("BYTERANGE=".concat(e.byterange));t.push("#EXT-X-MAP:".concat(r.join(",")))}(t,e.map),e.programDateTime&&t.push("#EXT-X-PROGRAM-DATE-TIME:".concat(l.formatDate(e.programDateTime))),e.dateRange&&function(t,e){var r=['ID="'.concat(e.id,'"'),'START-DATE="'.concat(l.formatDate(e.start),'"')];e.end&&r.push('END-DATE="'.concat(e.end,'"'));e.duration&&r.push("DURATION=".concat(e.duration));e.plannedDuration&&r.push("PLANNED-DURATION=".concat(e.plannedDuration));e.classId&&r.push('CLASS="'.concat(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("".concat(t,"=").concat(e.attributes[t])):r.push("".concat(t,'="').concat(e.attributes[t],'"')):t.startsWith("SCTE35-")&&r.push("".concat(t,"=").concat(l.byteSequenceToHex(e.attributes[t])))}),t.push("#EXT-X-DATERANGE:".concat(r.join(",")))}(t,e.dateRange),t.push("#EXTINF:".concat(e.duration,",").concat(unescape(encodeURIComponent(e.title||"")))),Array.prototype.push.call(t,"".concat(e.uri))}t.exports=function(t){l.PARAMCHECK(t),l.ASSERT("Not a playlist","playlist"===t.type);var e=new p(t.uri);return e.push("#EXTM3U"),t.version&&e.push("#EXT-X-VERSION:".concat(t.version)),t.independentSegments&&e.push("#EXT-X-INDEPENDENT-SEGMENTS:".concat(t.independentSegments)),t.start&&e.push("#EXT-X-START:TIME-OFFSET=".concat(t.start.offset).concat(t.start.precise?",PRECISE=YES":"")),t.isMasterPlaylist?function(t,e){var r,n,i,o=!0,a=!1,s=void 0;try{for(var u,c=e.sessionDataList[Symbol.iterator]();!(o=(u=c.next()).done);o=!0)r=t,n=u.value,i=void 0,i=['DATA-ID="'.concat(n.id,'"')],n.language&&i.push('LANGUAGE="'.concat(n.language,'"')),n.value?i.push('VALUE="'.concat(n.value,'"')):n.uri&&i.push('URI="'.concat(n.uri,'"')),r.push("#EXT-X-SESSION-DATA:".concat(i.join(",")))}catch(t){a=!0,s=t}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}var f=!0,l=!1,h=void 0;try{for(var E,p=e.sessionKeyList[Symbol.iterator]();!(f=(E=p.next()).done);f=!0)v(t,E.value,!0)}catch(t){l=!0,h=t}finally{try{f||null==p.return||p.return()}finally{if(l)throw h}}var T=!0,y=!1,d=void 0;try{for(var g,A=e.variants[Symbol.iterator]();!(T=(g=A.next()).done);T=!0)I(t,g.value)}catch(t){y=!0,d=t}finally{try{T||null==A.return||A.return()}finally{if(y)throw d}}}(e,t):function(t,e){e.targetDuration&&t.push("#EXT-X-TARGETDURATION:".concat(e.targetDuration)),e.mediaSequenceBase&&t.push("#EXT-X-MEDIA-SEQUENCE:".concat(e.mediaSequenceBase)),e.discontinuitySequenceBase&&t.push("#EXT-X-DISCONTINUITY-SEQUENCE:".concat(e.discontinuitySequenceBase)),e.playlistType&&t.push("#EXT-X-PLAYLIST-TYPE:".concat(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)T(t,o.value)}catch(t){n=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(n)throw i}}e.endlist&&t.push("#EXT-X-ENDLIST")}(e,t),e.join("\n")}}])}); | ||
var n=e(5),o=e(6),a=e(7);function r(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(r()<e)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=l.prototype:(null===t&&(t=new l(e)),t.length=e),t}function l(t,e,r){if(!(l.TYPED_ARRAY_SUPPORT||this instanceof l))return new l(t,e,r);if("number"!=typeof t)return i(this,t,e,r);if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}function i(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);l.TYPED_ARRAY_SUPPORT?(t=e).__proto__=l.prototype:t=f(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!l.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|E(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(l.isBuffer(e)){var r=0|h(e.length);return 0===(t=s(t,r)).length||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):f(t,e);if("Buffer"===e.type&&a(e.data))return f(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function u(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 c(t,e){if(u(e),t=s(t,e<0?0:0|h(e)),!l.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e){var r=e.length<0?0:0|h(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function E(t,e){if(l.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 C(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(n)return C(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function T(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?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=l.from(e,n)),l.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(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;s/=a=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var f=-1;for(o=r;o<s;o++)if(c(t,o)===c(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*a}else-1!==f&&(o-=o-f),f=-1}else for(s<r+u&&(r=s-u),o=r;0<=o;o--){for(var l=!0,h=0;h<u;h++)if(c(t,o+h)!==c(e,h)){l=!1;break}if(l)return o}return-1}function d(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?i<(n=Number(n))&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");o/2<n&&(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 _(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function v(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,a,s,u,c=t[i],f=null,l=239<c?4:223<c?3:191<c?2:1;if(i+l<=r)switch(l){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&127<(u=(31&c)<<6|63&o)&&(f=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&2047<(u=(15&c)<<12|(63&o)<<6|63&a)&&(u<55296||57343<u)&&(f=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)&&65535<(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)&&u<1114112&&(f=u)}null===f?(f=65533,l=1):65535<f&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(t){var e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=I));return r}(n)}B.Buffer=l,B.SlowBuffer=function(t){+t!=t&&(t=0);return l.alloc(+t)},B.INSPECT_MAX_BYTES=50,l.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}}(),B.kMaxLength=r(),l.poolSize=8192,l._augment=function(t){return t.__proto__=l.prototype,t},l.from=function(t,e,r){return i(null,t,e,r)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(t,e,r){return n=null,o=e,a=r,u(i=t),i<=0?s(n,i):void 0!==o?"string"==typeof a?s(n,i).fill(o,a):s(n,i).fill(o):s(n,i);var n,i,o,a},l.allocUnsafe=function(t){return c(null,t)},l.allocUnsafeSlow=function(t){return c(null,t)},l.isBuffer=function(t){return!(null==t||!t._isBuffer)},l.compare=function(t,e){if(!l.isBuffer(t)||!l.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},l.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}},l.concat=function(t,e){if(!a(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);var r;if(void 0===e)for(r=e=0;r<t.length;++r)e+=t[r].length;var n=l.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!l.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},l.byteLength=E,l.prototype._isBuffer=!0,l.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)p(this,e,e+1);return this},l.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)p(this,e,e+3),p(this,e+1,e+2);return this},l.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)p(this,e,e+7),p(this,e+1,e+6),p(this,e+2,e+5),p(this,e+3,e+4);return this},l.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?v(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 N(this,e,r);case"utf8":case"utf-8":return v(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return m(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",e=B.INSPECT_MAX_BYTES;return 0<this.length&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},l.prototype.compare=function(t,e,r,n,i){if(!l.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(i<=n&&r<=e)return 0;if(i<=n)return-1;if(r<=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=t.slice(e,r),f=0;f<s;++f)if(u[f]!==c[f]){o=u[f],a=c[f];break}return o<a?-1:a<o?1:0},l.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},l.prototype.indexOf=function(t,e,r){return T(this,t,e,r,!0)},l.prototype.lastIndexOf=function(t,e,r){return T(this,t,e,r,!1)},l.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||i<r)&&(r=i),0<t.length&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,a,s,u,c,f,l,h,E,p=!1;;)switch(n){case"hex":return d(this,t,e,r);case"utf8":case"utf-8":return h=e,E=r,_(C(t,(l=this).length-h),l,h,E);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return g(this,t,e,r);case"base64":return u=this,c=e,f=r,_(Y(t),u,c,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=e,s=r,_(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}(t,(o=this).length-a),o,a,s);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function S(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 m(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 N(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||n<r)&&(r=n);for(var i="",o=e;o<r;++o)i+=U(t[o]);return i}function b(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 R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(r<t+e)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,r,n,i,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(i<e||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function w(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 X(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 O(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 P(t,e,r,n,i){return i||O(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,i){return i||O(t,0,r,8),o.write(t,e,r,n,52,8),r+8}l.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):n<t&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):n<e&&(e=n),e<t&&(e=t),l.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=l.prototype;else{var i=e-t;r=new l(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},l.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},l.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t+--e],i=1;0<e&&(i*=256);)n+=this[t+--e]*i;return n},l.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return(i*=128)<=n&&(n-=Math.pow(2,8*e)),n},l.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=e,i=1,o=this[t+--n];0<n&&(i*=256);)o+=this[t+--n]*i;return(i*=128)<=o&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||D(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},l.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||D(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;0<=--i&&(o*=256);)this[e+i]=t/o&255;return e+r},l.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):w(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):w(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):X(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):X(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(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},l.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);D(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;0<=--o&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):w(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):w(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):X(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):X(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,r){return P(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return P(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},l.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),0<n&&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;0<=i;--i)t[i+e]=this[i+r];else if(o<1e3||!l.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},l.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&&!l.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=l.isBuffer(t)?t:C(new l(t,n).toString()),s=a.length;for(o=0;o<r-e;++o)this[o+e]=a[o%s]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function U(t){return t<16?"0"+t.toString(16):t.toString(16)}function C(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],a=0;a<n;++a){if(55295<(r=t.charCodeAt(a))&&r<57344){if(!i){if(56319<r){-1<(e-=3)&&o.push(239,191,189);continue}if(a+1===n){-1<(e-=3)&&o.push(239,191,189);continue}i=r;continue}if(r<56320){-1<(e-=3)&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&-1<(e-=3)&&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 Y(t){return n.toByteArray(function(t){var e;if((t=(e=t,e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function _(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,e(4))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=E(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){for(var e,r=E(t),n=r[0],i=r[1],o=new h((c=n,f=i,3*(c+f)/4-f)),a=0,s=0<i?n-4:n,u=0;u<s;u+=4)e=l[t.charCodeAt(u)]<<18|l[t.charCodeAt(u+1)]<<12|l[t.charCodeAt(u+2)]<<6|l[t.charCodeAt(u+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=255&e;var c,f;2===i&&(e=l[t.charCodeAt(u)]<<2|l[t.charCodeAt(u+1)]>>4,o[a++]=255&e);1===i&&(e=l[t.charCodeAt(u)]<<10|l[t.charCodeAt(u+1)]<<4|l[t.charCodeAt(u+2)]>>2,o[a++]=e>>8&255,o[a++]=255&e);return o},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i=[],o=0,a=r-n;o<a;o+=16383)i.push(u(t,o,a<o+16383?a:o+16383));1===n?(e=t[r-1],i.push(s[e>>2]+s[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+"="));return i.join("")};for(var s=[],l=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i<o;++i)s[i]=n[i],l[n.charCodeAt(i)]=i;function E(t){var e=t.length;if(0<e%4)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 u(t,e,r){for(var n,i,o=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(s[(i=n)>>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,c=u>>1,f=-7,l=r?i-1:0,h=r?-1:1,E=t[e+l];for(l+=h,o=E&(1<<-f)-1,E>>=-f,f+=s;0<f;o=256*o+t[e+l],l+=h,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;0<f;a=256*a+t[e+l],l+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(E?-1:1);a+=Math.pow(2,n),o-=c}return(E?-1:1)*a*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var a,s,u,c=8*o-i-1,f=(1<<c)-1,l=f>>1,h=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=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),2<=(e+=1<=a+l?h/u:h*Math.pow(2,1-l))*u&&(a++,u/=2),f<=a+l?(s=0,a=f):1<=a+l?(s=(e*u-1)*Math.pow(2,i),a+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));8<=i;t[r+E]=255&s,E+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;0<c;t[r+E]=255&a,E+=p,a/=256,c-=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,r){function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||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||null==s.return||s.return()}finally{if(i)throw o}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var X=r(0),n=r(1),s=n.Rendition,m=n.Variant,S=n.SessionData,N=n.Key,f=n.MediaInitializationSection,l=n.DateRange,b=n.MasterPlaylist,O=n.MediaPlaylist,h=n.Segment;function E(t){return X.trim(t,'"')}function p(t){var e=X.splitAt(t,"@");return{length:X.toNumber(e[0]),offset:e[1]?X.toNumber(e[1]):-1}}function R(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function i(t){var e=X.splitByCommaWithPreservingQuotes(t),f={};return e.forEach(function(t){var e,r,n,i,o,a=w(X.splitAt(t,"="),2),s=a[0],u=a[1],c=E(u);switch(s){case"URI":f[s]=c;break;case"START-DATE":case"END-DATE":f[s]=new Date(c);break;case"IV":f[s]=(i=c,16!==(o=X.hexToByteSequence(i)).length&&X.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),o);break;case"BYTERANGE":f[s]=p(c);break;case"RESOLUTION":f[s]=(r=c,n=X.splitAt(r,"x"),{width:X.toNumber(n[0]),height:X.toNumber(n[1])});break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":f[s]="YES"===c;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":f[s]=X.toNumber(c);break;default:s.startsWith("SCTE35-")?f[s]=X.hexToByteSequence(c):s.startsWith("X-")?f[s]=(e=u).startsWith('"')?E(e):e.startsWith("0x")||e.startsWith("0X")?X.hexToByteSequence(e):X.toNumber(e):f[s]=c}}),f}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[X.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,i(e)];case"EXTINF":return[(r=e,n=X.splitAt(r,","),{duration:X.toNumber(n[0]),title:decodeURIComponent(escape(n[1]))}),null];case"EXT-X-BYTERANGE":return[p(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];case"EXT-X-PLAYLIST-TYPE":default:return[e,null]}var r,n}function T(){X.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function D(t,e,r){var n,i=(n=e.attributes,new s({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})),o=t[X.camelify(r)],a=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||null==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.":""}(o,i);a&&X.INVALIDPLAYLIST(a),o.push(i),i.isDefault&&(t.currentRenditions[X.camelify(r)]=o.length-1)}function P(t,e,r){var n,i,o,a=3<arguments.length&&void 0!==arguments[3]&&arguments[3],s=4<arguments.length?arguments[4]:void 0,u=new m({uri:r,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"]}),c=!0,f=!1,l=void 0;try{for(var h,E=t[Symbol.iterator]();!(c=(h=E.next()).done);c=!0){var p=h.value;if("EXT-X-MEDIA"===p.name){var T=p.attributes,y=T.TYPE;if(y&&T["GROUP-ID"]||X.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[y]===T["GROUP-ID"]&&(D(u,p,y),"CLOSED-CAPTIONS"===y)){var d=!0,g=!1,A=void 0;try{for(var v,I=u.closedCaptions[Symbol.iterator]();!(d=(v=I.next()).done);d=!0){var S=v.value.instreamId;if(S&&S.startsWith("SERVICE")&&s.compatibleVersion<7){s.compatibleVersion=7;break}}}catch(t){g=!0,A=t}finally{try{d||null==I.return||I.return()}finally{if(g)throw A}}}}}}catch(t){f=!0,l=t}finally{try{c||null==E.return||E.return()}finally{if(f)throw l}}return n=e,i=u,o=s,["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(e){"CLOSED-CAPTIONS"===e&&"NONE"===n[e]?(o.isClosedCaptionsNone=!0,i.closedCaptions=[]):n[e]&&!i[X.camelify(e)].find(function(t){return t.groupId===n[e]})&&X.INVALIDPLAYLIST("".concat(e," attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is ").concat(e,"."))}),u.isIFrameOnly=a,u}function L(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 M(a,t,e,r,n,i,s){for(var u=new h({uri:t,mediaSequenceNumber:n,discontinuitySequence:i}),o=function(t){var e=a[t],r=e.name,n=e.value,i=e.attributes;if("EXTINF"===r)!Number.isInteger(n.duration)&&s.compatibleVersion<3&&(s.compatibleVersion=3),Math.round(n.duration)>s.targetDuration&&X.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),u.duration=n.duration,u.title=n.title;else if("EXT-X-BYTERANGE"===r)s.compatibleVersion<4&&(s.compatibleVersion=4),u.byterange=n;else if("EXT-X-DISCONTINUITY"===r)u.discontinuity=!0;else if("EXT-X-KEY"===r)R(s,i),u.key=new N({method:i.METHOD,uri:i.URI,iv:i.IV,format:i.KEYFORMAT,formatVersion:i.KEYFORMATVERSIONS});else if("EXT-X-MAP"===r)s.compatibleVersion<5&&(s.compatibleVersion=5),s.hasMap=!0,u.map=new f({uri:i.URI,byterange:i.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===r)u.programDateTime=n;else if("EXT-X-DATERANGE"===r){var o={};Object.keys(i).forEach(function(t){(t.startsWith("SCTE35-")||t.startsWith("X-"))&&(o[t]=i[t])}),u.dateRange=new l({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:o})}},c=e;c<=r;c++)o(c);return u}function o(t,e){var r=new O,n=-1,i=0,o=!1,a=0,s=null,u=null,c=!0,f=!1,l=void 0;try{for(var h,E=t.entries()[Symbol.iterator]();!(c=(h=E.next()).done);c=!0){var p=w(h.value,2),T=p[0],y=p[1],d=y.name,g=y.value,A=y.attributes;if("Segment"!==y.category){if("EXT-X-VERSION"===d)void 0===r.version?r.version=g:X.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===d)r.targetDuration=e.targetDuration=g;else if("EXT-X-MEDIA-SEQUENCE"===d)0<r.segments.length&&X.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),r.mediaSequenceBase=i=g;else if("EXT-X-DISCONTINUITY-SEQUENCE"===d)0<r.segments.length&&X.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),o&&X.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT-X-DISCONTINUITY tag."),r.discontinuitySequenceBase=a=g;else if("EXT-X-ENDLIST"===d)r.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===d)r.playlistType=g;else if("EXT-X-I-FRAMES-ONLY"===d)e.compatibleVersion<4&&(e.compatibleVersion=4),r.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===d)r.independentSegments&&X.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),r.independentSegments=!0;else if("EXT-X-START"===d)r.start&&X.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof A["TIME-OFFSET"]&&X.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),r.start={offset:A["TIME-OFFSET"],precise:A.PRECISE||!1};else if("string"==typeof y){-1===n&&X.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),r.targetDuration||X.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED");var v=M(t,y,n,T-1,i++,a,e);if(v){var I=v.discontinuity,S=v.key,m=v.map,N=v.byterange,b=v.uri;if(I&&(v.discontinuitySequence=++a),S?s=S:s&&(v.key=s),m?u=m:u&&(v.map=u),N&&-1===N.offset){var R=r.segments;if(0<R.length){var D=R[R.length-1];D.byterange&&D.uri===b?N.offset=D.byterange.offset+D.byterange.length:X.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 X.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}r.segments.push(v)}n=-1}}else-1===n&&(n=T),"EXT-X-DISCONTINUITY"===d&&(o=!0)}}catch(t){f=!0,l=t}finally{try{c||null==E.return||E.return()}finally{if(f)throw l}}return function(t){for(var e=new Map,r=new Map,n=!1,i=!1,o=t.length-1;0<=o;o--){var a=t[o],s=a.programDateTime,u=a.dateRange;if(s&&(i=!0),u){n=!0,u.endOnNext&&(u.end||u.duration)&&X.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var c=u.start.getTime(),f=u.duration||0;u.end&&u.duration&&c+1e3*f!==u.end.getTime()&&X.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),u.endOnNext&&(u.end=e.get(u.classId)),e.set(u.classId,u.start);var l=u.end?u.end.getTime():u.start.getTime()+1e3*(u.duration||0),h=r.get(u.classId);if(h){var E=!0,p=!1,T=void 0;try{for(var y,d=h[Symbol.iterator]();!(E=(y=d.next()).done);E=!0){var g=y.value;(g.start<=c&&g.end>c||g.start>=c&&g.start<l)&&X.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){p=!0,T=t}finally{try{E||null==d.return||d.return()}finally{if(p)throw T}}h.push({start:c,end:l})}else r.set(u.classId,[{start:c,end:l}])}}n&&!i&&X.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 a(t,e){var r,n,i=w(-1===(n=(r=t).indexOf(":"))?[r.slice(1).trim(),null]:[r.slice(1,n).trim(),r.slice(n+1).trim()],2),o=i[0],a=i[1],s=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"}}(o);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?e.isMasterPlaylist=!1:e.isMasterPlaylist&&T();if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return e.isMasterPlaylist=!0;!1===e.isMasterPlaylist&&T()}}(s,e),"Unknown"===s)return null;"MediaPlaylist"===s&&(e.hash[o]&&X.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[o]=!0);var u=w(c(o,a),2);return{name:o,category:s,value:u[0],attributes:u[1]}}function u(t,e){var r;return e.isMasterPlaylist?r=function(t,r){var n=new b,e=!0,i=!1,o=void 0;try{for(var a,s=t.entries()[Symbol.iterator]();!(e=(a=s.next()).done);e=!0){var u=w(a.value,2),c=u[0],f=u[1],l=f.name,h=f.value,E=f.attributes;if("EXT-X-VERSION"===l)n.version=h;else if("EXT-X-STREAM-INF"===l){var p=t[c+1];("string"!=typeof p||p.startsWith("#EXT"))&&X.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var T=P(t,E,p,!1,r);T&&n.variants.push(T)}else if("EXT-X-I-FRAME-STREAM-INF"===l){var y=P(t,E,E.URI,!0,r);y&&n.variants.push(y)}else"EXT-X-SESSION-DATA"===l?function(){var e=new S({id:E["DATA-ID"],value:E.VALUE,uri:E.URI,language:E.LANGUAGE});n.sessionDataList.find(function(t){return t.id===e.id&&t.language===e.language})&&X.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."),n.sessionDataList.push(e)}():"EXT-X-SESSION-KEY"===l?function(){"NONE"===E.METHOD&&X.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var e=new N({method:E.METHOD,uri:E.URI,iv:E.IV,format:E.KEYFORMAT,formatVersion:E.KEYFORMATVERSIONS});n.sessionKeyList.find(function(t){return L(t,e)})&&X.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."),R(r,E),n.sessionKeyList.push(e)}():"EXT-X-INDEPENDENT-SEGMENTS"===l?(n.independentSegments&&X.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),n.independentSegments=!0):"EXT-X-START"===l&&(n.start&&X.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof E["TIME-OFFSET"]&&X.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),n.start={offset:E["TIME-OFFSET"],precise:E.PRECISE||!1})}}catch(t){i=!0,o=t}finally{try{e||null==s.return||s.return()}finally{if(i)throw o}}if(r.isClosedCaptionsNone){var d=!0,g=!1,A=void 0;try{for(var v,I=n.variants[Symbol.iterator]();!(d=(v=I.next()).done);d=!0)0<v.value.closedCaptions.length&&X.INVALIDPLAYLIST("If there is a variant with CLOSED-CAPTIONS attribute of NONE, all EXT-X-STREAM-INF tags MUST have this attribute with a value of NONE")}catch(t){g=!0,A=t}finally{try{d||null==I.return||I.return()}finally{if(g)throw A}}}return n}(t,e):!(r=o(t,e)).isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6),1<e.compatibleVersion&&(!r.version||r.version<e.compatibleVersion)&&X.INVALIDPLAYLIST("EXT-X-VERSION needs to be ".concat(e.compatibleVersion," or higher.")),r}t.exports=function(t){var n,i,e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,isClosedCaptionsNone:!1,hash:{}},r=u((n=e,i=[],t.split("\n").forEach(function(t){var e=t.trim();if(e)if(e.startsWith("#")){if(e.startsWith("#EXT")){var r=a(e,n);return void(r&&i.push(r))}}else i.push(e)}),0!==i.length&&"EXTM3U"===i[0].name||X.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),i),e);return r.source=t,r}},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(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)}}function o(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):e}function s(t,e,r){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}})(t,e,r||t)}function u(t){var n="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;var e;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return a(t,arguments,f(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,t)})(t)}function a(t,e,r){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&c(i,r.prototype),i}).apply(null,arguments)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=r(0),h=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-MAP","#EXT-X-STREAM-INF"],E=["#EXT-X-KEY","#EXT-X-MEDIA"],p=function(t){function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=o(this,f(a).call(this))).baseUri=t,e}var e,r,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(a,u(Array)),e=a,(r=[{key:"push",value:function(){for(var t=this,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=function(){var e=r[o];if(h.some(function(t){return e.startsWith(t)}))return s(f(a.prototype),"push",t).call(t,e),"continue";if(t.includes(e)){if(E.some(function(t){return e.startsWith(t)}))return"continue";l.INVALIDPLAYLIST("Redundant item (".concat(e,")"))}s(f(a.prototype),"push",t).call(t,e)},o=0;o<r.length;o++)i()}}])&&i(e.prototype,r),n&&i(e,n),a}();function N(t,e){var r=Math.round(1e3*t)/1e3;return e?r.toFixed(e):r}function v(t,e,r){var n=r?"#EXT-X-SESSION-KEY":"#EXT-X-KEY",i=["METHOD=".concat(e.method)];e.uri&&i.push('URI="'.concat(e.uri,'"')),e.iv&&(16!==e.iv.length&&l.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i.push("IV=".concat(l.byteSequenceToHex(e.iv)))),e.format&&i.push('KEYFORMAT="'.concat(e.format,'"')),e.formatVersion&&i.push('KEYFORMATVERSIONS="'.concat(e.formatVersion,'"')),t.push("".concat(n,":").concat(i.join(",")))}function I(t,e){var r=e.isIFrameOnly?"#EXT-X-I-FRAME-STREAM-INF":"#EXT-X-STREAM-INF",n=["BANDWIDTH=".concat(e.bandwidth)];if(e.averageBandwidth&&n.push("AVERAGE-BANDWIDTH=".concat(e.averageBandwidth)),e.isIFrameOnly&&n.push('URI="'.concat(e.uri,'"')),e.codecs&&n.push('CODECS="'.concat(e.codecs,'"')),e.resolution&&n.push("RESOLUTION=".concat(e.resolution.width,"x").concat(e.resolution.height)),e.frameRate&&n.push("FRAME-RATE=".concat(N(e.frameRate,3))),e.hdcpLevel&&n.push("HDCP-LEVEL=".concat(e.hdcpLevel)),0<e.audio.length){n.push('AUDIO="'.concat(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){b(t,s.value)}}catch(t){o=!0,a=t}finally{try{i||null==u.return||u.return()}finally{if(o)throw a}}}if(0<e.video.length){n.push('VIDEO="'.concat(e.video[0].groupId,'"'));var c=!0,f=!1,l=void 0;try{for(var h,E=e.video[Symbol.iterator]();!(c=(h=E.next()).done);c=!0){b(t,h.value)}}catch(t){f=!0,l=t}finally{try{c||null==E.return||E.return()}finally{if(f)throw l}}}if(0<e.subtitles.length){n.push('SUBTITLES="'.concat(e.subtitles[0].groupId,'"'));var p=!0,T=!1,y=void 0;try{for(var d,g=e.subtitles[Symbol.iterator]();!(p=(d=g.next()).done);p=!0){b(t,d.value)}}catch(t){T=!0,y=t}finally{try{p||null==g.return||g.return()}finally{if(T)throw y}}}if(0<e.closedCaptions.length){n.push('CLOSED-CAPTIONS="'.concat(e.closedCaptions[0].groupId,'"'));var A=!0,v=!1,I=void 0;try{for(var S,m=e.closedCaptions[Symbol.iterator]();!(A=(S=m.next()).done);A=!0){b(t,S.value)}}catch(t){v=!0,I=t}finally{try{A||null==m.return||m.return()}finally{if(v)throw I}}}t.push("".concat(r,":").concat(n.join(","))),e.isIFrameOnly||t.push("".concat(e.uri))}function b(t,e){var r=["TYPE=".concat(e.type),'GROUP-ID="'.concat(e.groupId,'"'),'NAME="'.concat(e.name,'"')];void 0!==e.isDefault&&r.push("DEFAULT=".concat(e.isDefault?"YES":"NO")),void 0!==e.autoselect&&r.push("AUTOSELECT=".concat(e.autoselect?"YES":"NO")),void 0!==e.forced&&r.push("FORCED=".concat(e.forced?"YES":"NO")),e.language&&r.push('LANGUAGE="'.concat(e.language,'"')),e.assocLanguage&&r.push('ASSOC-LANGUAGE="'.concat(e.assocLanguage,'"')),e.instreamId&&r.push('INSTREAM-ID="'.concat(e.instreamId,'"')),e.characteristics&&r.push('CHARACTERISTICS="'.concat(e.characteristics,'"')),e.channels&&r.push('CHANNELS="'.concat(e.channels,'"')),e.uri&&r.push('URI="'.concat(e.uri,'"')),t.push("#EXT-X-MEDIA:".concat(r.join(",")))}function T(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;e.byterange&&t.push("#EXT-X-BYTERANGE:".concat(y(e.byterange))),e.discontinuity&&t.push("#EXT-X-DISCONTINUITY"),e.key&&v(t,e.key),e.map&&function(t,e){var r=['URI="'.concat(e.uri,'"')];e.byterange&&r.push("BYTERANGE=".concat(y(e.byterange)));t.push("#EXT-X-MAP:".concat(r.join(",")))}(t,e.map),e.programDateTime&&t.push("#EXT-X-PROGRAM-DATE-TIME:".concat(l.formatDate(e.programDateTime))),e.dateRange&&function(t,e){var r=['ID="'.concat(e.id,'"'),'START-DATE="'.concat(l.formatDate(e.start),'"')];e.end&&r.push('END-DATE="'.concat(e.end,'"'));e.duration&&r.push("DURATION=".concat(e.duration));e.plannedDuration&&r.push("PLANNED-DURATION=".concat(e.plannedDuration));e.classId&&r.push('CLASS="'.concat(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("".concat(t,"=").concat(e.attributes[t])):r.push("".concat(t,'="').concat(e.attributes[t],'"')):t.startsWith("SCTE35-")&&r.push("".concat(t,"=").concat(l.byteSequenceToHex(e.attributes[t])))}),t.push("#EXT-X-DATERANGE:".concat(r.join(",")))}(t,e.dateRange);var n=r<3?Math.round(e.duration):N(e.duration);t.push("#EXTINF:".concat(n,",").concat(unescape(encodeURIComponent(e.title||"")))),Array.prototype.push.call(t,"".concat(e.uri))}function y(t){return"".concat(t.length,"@").concat(t.offset)}t.exports=function(t){l.PARAMCHECK(t),l.ASSERT("Not a playlist","playlist"===t.type);var e=new p(t.uri);return e.push("#EXTM3U"),t.version&&e.push("#EXT-X-VERSION:".concat(t.version)),t.independentSegments&&e.push("#EXT-X-INDEPENDENT-SEGMENTS"),t.start&&e.push("#EXT-X-START:TIME-OFFSET=".concat(N(t.start.offset)).concat(t.start.precise?",PRECISE=YES":"")),t.isMasterPlaylist?function(t,e){var r,n,i,o=!0,a=!1,s=void 0;try{for(var u,c=e.sessionDataList[Symbol.iterator]();!(o=(u=c.next()).done);o=!0)r=t,n=u.value,i=void 0,i=['DATA-ID="'.concat(n.id,'"')],n.language&&i.push('LANGUAGE="'.concat(n.language,'"')),n.value?i.push('VALUE="'.concat(n.value,'"')):n.uri&&i.push('URI="'.concat(n.uri,'"')),r.push("#EXT-X-SESSION-DATA:".concat(i.join(",")))}catch(t){a=!0,s=t}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}var f=!0,l=!1,h=void 0;try{for(var E,p=e.sessionKeyList[Symbol.iterator]();!(f=(E=p.next()).done);f=!0)v(t,E.value,!0)}catch(t){l=!0,h=t}finally{try{f||null==p.return||p.return()}finally{if(l)throw h}}var T=!0,y=!1,d=void 0;try{for(var g,A=e.variants[Symbol.iterator]();!(T=(g=A.next()).done);T=!0)I(t,g.value)}catch(t){y=!0,d=t}finally{try{T||null==A.return||A.return()}finally{if(y)throw d}}}(e,t):function(t,e){e.targetDuration&&t.push("#EXT-X-TARGETDURATION:".concat(e.targetDuration)),e.mediaSequenceBase&&t.push("#EXT-X-MEDIA-SEQUENCE:".concat(e.mediaSequenceBase)),e.discontinuitySequenceBase&&t.push("#EXT-X-DISCONTINUITY-SEQUENCE:".concat(e.discontinuitySequenceBase)),e.playlistType&&t.push("#EXT-X-PLAYLIST-TYPE:".concat(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)T(t,o.value,e.version)}catch(t){n=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(n)throw i}}e.endlist&&t.push("#EXT-X-ENDLIST")}(e,t),e.join("\n")}}])}); | ||
//# sourceMappingURL=hls-parser.min.js.map |
@@ -0,1 +1,2 @@ | ||
const {getOptions, setOptions} = require('./utils'); | ||
const parse = require('./parse'); | ||
@@ -8,3 +9,5 @@ const stringify = require('./stringify'); | ||
stringify, | ||
types | ||
types, | ||
getOptions, | ||
setOptions | ||
}; |
{ | ||
"name": "hls-parser", | ||
"version": "0.2.5", | ||
"version": "0.3.0", | ||
"description": "A simple library to read/write HLS playlists", | ||
@@ -36,3 +36,3 @@ "main": "index.js", | ||
"coveralls": "^3.0.2", | ||
"nyc": "^13.2.0", | ||
"nyc": "^13.3.0", | ||
"uglifyjs-webpack-plugin": "^2.1.1", | ||
@@ -39,0 +39,0 @@ "webpack": "^4.29.3", |
@@ -63,2 +63,19 @@ [![Build Status](https://travis-ci.org/kuu/hls-parser.svg?branch=master)](https://travis-ci.org/kuu/hls-parser) | ||
A text data that conforms to [the HLS playlist spec](https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.1) | ||
### `HLS.setOptions(obj)` | ||
Updates the option values | ||
#### params | ||
| Name | Type | Required | Default | Description | | ||
| ------- | ------ | -------- | ------- | ------------- | | ||
| obj | Object | Yes | {} | An object holding option values which will be used to overwrite the internal option values. | | ||
##### supported options | ||
| Name | Type | Default | Description | | ||
| ---------- | ------- | ------- | ------------- | | ||
| strictMode | boolean | false | If true, the function throws an error when `parse`/`stringify` failed. If false, the function just logs the error and continues to run.| | ||
### `HLS.getOptions()` | ||
Retrieves the current option values | ||
#### return value | ||
A cloned object containing the current option values | ||
### `HLS.types` | ||
@@ -65,0 +82,0 @@ An object that holds all the classes described below. |
@@ -41,2 +41,7 @@ const utils = require('./utils'); | ||
function buildDecimalFloatingNumber(num, fixed) { | ||
const rounded = Math.round(num * 1000) / 1000; | ||
return fixed ? rounded.toFixed(fixed) : rounded; | ||
} | ||
function buildMasterPlaylist(lines, playlist) { | ||
@@ -104,3 +109,3 @@ for (const sessionData of playlist.sessionDataList) { | ||
if (variant.frameRate) { | ||
attrs.push(`FRAME-RATE=${variant.frameRate}`); | ||
attrs.push(`FRAME-RATE=${buildDecimalFloatingNumber(variant.frameRate, 3)}`); | ||
} | ||
@@ -193,3 +198,3 @@ if (variant.hdcpLevel) { | ||
for (const segment of playlist.segments) { | ||
buildSegment(lines, segment); | ||
buildSegment(lines, segment, playlist.version); | ||
} | ||
@@ -201,3 +206,3 @@ if (playlist.endlist) { | ||
function buildSegment(lines, segment) { | ||
function buildSegment(lines, segment, version = 1) { | ||
if (segment.byterange) { | ||
@@ -221,3 +226,4 @@ lines.push(`#EXT-X-BYTERANGE:${buildByteRange(segment.byterange)}`); | ||
} | ||
lines.push(`#EXTINF:${segment.duration},${unescape(encodeURIComponent(segment.title || ''))}`); | ||
const duration = version < 3 ? Math.round(segment.duration) : buildDecimalFloatingNumber(segment.duration); | ||
lines.push(`#EXTINF:${duration},${unescape(encodeURIComponent(segment.title || ''))}`); | ||
Array.prototype.push.call(lines, `${segment.uri}`); // URIs could be redundant when EXT-X-BYTERANGE is used | ||
@@ -281,6 +287,6 @@ } | ||
if (playlist.independentSegments) { | ||
lines.push(`#EXT-X-INDEPENDENT-SEGMENTS:${playlist.independentSegments}`); | ||
lines.push('#EXT-X-INDEPENDENT-SEGMENTS'); | ||
} | ||
if (playlist.start) { | ||
lines.push(`#EXT-X-START:TIME-OFFSET=${playlist.start.offset}${playlist.start.precise ? ',PRECISE=YES' : ''}`); | ||
lines.push(`#EXT-X-START:TIME-OFFSET=${buildDecimalFloatingNumber(playlist.start.offset)}${playlist.start.precise ? ',PRECISE=YES' : ''}`); | ||
} | ||
@@ -287,0 +293,0 @@ if (playlist.isMasterPlaylist) { |
33
utils.js
@@ -0,7 +1,12 @@ | ||
let options = {}; | ||
function THROW(err) { | ||
if (!options.strictMode) { | ||
return console.error(err.message); | ||
} | ||
throw err; | ||
} | ||
function ASSERT(msg, ...params) { | ||
for (const [index, param] of params.entries()) { | ||
function ASSERT(msg, ...options) { | ||
for (const [index, param] of options.entries()) { | ||
if (!param) { | ||
@@ -13,4 +18,4 @@ THROW(new Error(`${msg} : Failed at [${index}]`)); | ||
function CONDITIONALASSERT(...params) { | ||
for (const [index, [cond, param]] of params.entries()) { | ||
function CONDITIONALASSERT(...options) { | ||
for (const [index, [cond, param]] of options.entries()) { | ||
if (!cond) { | ||
@@ -25,4 +30,4 @@ continue; | ||
function PARAMCHECK(...params) { | ||
for (const [index, param] of params.entries()) { | ||
function PARAMCHECK(...options) { | ||
for (const [index, param] of options.entries()) { | ||
if (param === undefined) { | ||
@@ -34,4 +39,4 @@ THROW(new Error(`Param Check : Failed at [${index}]`)); | ||
function CONDITIONALPARAMCHECK(...params) { | ||
for (const [index, [cond, param]] of params.entries()) { | ||
function CONDITIONALPARAMCHECK(...options) { | ||
for (const [index, [cond, param]] of options.entries()) { | ||
if (!cond) { | ||
@@ -190,2 +195,10 @@ continue; | ||
function setOptions(newOptions = {}) { | ||
options = Object.assign(options, newOptions); | ||
} | ||
function getOptions() { | ||
return Object.assign({}, options); | ||
} | ||
module.exports = { | ||
@@ -207,3 +220,5 @@ THROW, | ||
formatDate, | ||
hasOwnProp | ||
hasOwnProp, | ||
setOptions, | ||
getOptions | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
455548
12
5537
205