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

hls-parser

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hls-parser - npm Package Compare versions

Comparing version 0.10.2 to 0.10.3

2

dist/hls-parser.min.js
/*! For license information please see hls-parser.min.js.LICENSE.txt */
!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()}(self,(function(){return t={851:(t,e,n)=>{var a=n(771),r=a.getOptions,i=a.setOptions,o=n(463),s=n(367),c=n(890);t.exports={parse:o,stringify:s,types:c,getOptions:r,setOptions:i}},463:(t,e,n)=>{function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],a=!0,r=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);a=!0);}catch(t){r=!0,i=t}finally{try{a||null==s.return||s.return()}finally{if(r)throw i}}return n}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=i(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0,r=function(){};return{s:r,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){c=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw o}}}}function i(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n<e;n++)a[n]=t[n];return a}var s=n(771),c=n(890),u=c.Rendition,l=c.Variant,T=c.SessionData,E=c.Key,f=c.MediaInitializationSection,I=c.DateRange,h=c.SpliceInfo,A=c.MasterPlaylist,p=c.MediaPlaylist,d=c.Segment,S=c.PartialSegment,N=c.PrefetchSegment,y=c.RenditionReport;function X(t){return s.trim(t,'"')}function v(t){var e=s.splitAt(t,",");return{duration:s.toNumber(e[0]),title:decodeURIComponent(escape(e[1]))}}function m(t){var e=s.splitAt(t,"@");return{length:s.toNumber(e[0]),offset:e[1]?s.toNumber(e[1]):-1}}function R(t){var e=s.splitAt(t,"x");return{width:s.toNumber(e[0]),height:s.toNumber(e[1])}}function L(t){var e="ALLOWED-CPC: Each entry must consit of KEYFORMAT and Content Protection Configuration",n=t.split(",");0===n.length&&s.INVALIDPLAYLIST(e);var i,o=[],c=r(n);try{for(c.s();!(i=c.n()).done;){var u=i.value,l=a(s.splitAt(u,":"),2),T=l[0],E=l[1];T&&E?o.push({format:T,cpcList:E.split("/")}):s.INVALIDPLAYLIST(e)}}catch(t){c.e(t)}finally{c.f()}return o}function D(t){return t.startsWith('"')?X(t):t.startsWith("0x")||t.startsWith("0X")?s.hexToByteSequence(t):s.toNumber(t)}function g(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function O(t){var e,n,i,o={},c=r(s.splitByCommaWithPreservingQuotes(t));try{for(c.s();!(e=c.n()).done;){var u=e.value,l=a(s.splitAt(u,"="),2),T=l[0],E=l[1],f=X(E);switch(T){case"URI":o[T]=f;break;case"START-DATE":case"END-DATE":o[T]=new Date(f);break;case"IV":o[T]=(n=f,i=void 0,16!==(i=s.hexToByteSequence(n)).length&&s.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i);break;case"BYTERANGE":o[T]=m(f);break;case"RESOLUTION":o[T]=R(f);break;case"ALLOWED-CPC":o[T]=L(f);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":case"CAN-BLOCK-RELOAD":case"INDEPENDENT":case"GAP":o[T]="YES"===f;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":case"CAN-SKIP-UNTIL":case"HOLD-BACK":case"PART-HOLD-BACK":case"PART-TARGET":case"BYTERANGE-START":case"BYTERANGE-LENGTH":case"LAST-MSN":case"LAST-PART":case"SKIPPED-SEGMENTS":case"SCORE":o[T]=s.toNumber(f);break;default:T.startsWith("SCTE35-")?o[T]=s.hexToByteSequence(f):T.startsWith("X-")?o[T]=D(E):("VIDEO-RANGE"===T&&"SDR"!==f&&"HLG"!==f&&"PQ"!==f&&s.INVALIDPLAYLIST('VIDEO-RANGE: unknown value "'.concat(f,'"')),o[T]=f)}}}catch(t){c.e(t)}finally{c.f()}return o}function P(){s.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function b(t,e,n){var a,i=(a=e.attributes,new u({type:a.TYPE,uri:a.URI,groupId:a["GROUP-ID"],language:a.LANGUAGE,assocLanguage:a["ASSOC-LANGUAGE"],name:a.NAME,isDefault:a.DEFAULT,autoselect:a.AUTOSELECT,forced:a.FORCED,instreamId:a["INSTREAM-ID"],characteristics:a.CHARACTERISTICS,channels:a.CHANNELS})),o=t[s.camelify(n)],c=function(t,e){var n,a=!1,i=r(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";o.isDefault&&(a=!0)}}catch(t){i.e(t)}finally{i.f()}return a&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(o,i);c&&s.INVALIDPLAYLIST(c),o.push(i),i.isDefault&&(t.currentRenditions[s.camelify(n)]=o.length-1)}function C(t,e,n,a,i){var o,c=new l({uri:n,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],score:e.SCORE,codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"],allowedCpc:e["ALLOWED-CPC"],videoRange:e["VIDEO-RANGE"],stableVariantId:e["STABLE-VARIANT-ID"]}),u=r(t);try{for(u.s();!(o=u.n()).done;){var T=o.value;if("EXT-X-MEDIA"===T.name){var E=T.attributes,f=E.TYPE;if(f&&E["GROUP-ID"]||s.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[f]===E["GROUP-ID"]&&(b(c,T,f),"CLOSED-CAPTIONS"===f)){var I,h=r(c.closedCaptions);try{for(h.s();!(I=h.n()).done;){var A=I.value.instreamId;if(A&&A.startsWith("SERVICE")&&i.compatibleVersion<7){i.compatibleVersion=7;break}}}catch(t){h.e(t)}finally{h.f()}}}}}catch(t){u.e(t)}finally{u.f()}return function(t,e,n){for(var a=function(){var a=i[r];"CLOSED-CAPTIONS"===a&&"NONE"===t[a]?(n.isClosedCaptionsNone=!0,e.closedCaptions=[]):t[a]&&!e[s.camelify(a)].some((function(e){return e.groupId===t[a]}))&&s.INVALIDPLAYLIST("".concat(a," attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is ").concat(a,"."))},r=0,i=["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"];r<i.length;r++)a()}(e,c,i),c.isIFrameOnly=a,c}function M(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.length!==e.iv.length)return!1;for(var n=0;n<t.iv.length;n++)if(t.iv[n]!==e.iv[n])return!1}else if(e.iv)return!1;return t.format===e.format&&t.formatVersion===e.formatVersion}function U(t,e,n,a,r,i,o){for(var c=new d({uri:e,mediaSequenceNumber:r,discontinuitySequence:i}),u=!1,l=!1,T=n;T<=a;T++){var A=t[T],p=A.name,N=A.value,y=A.attributes;if("EXTINF"===p)!Number.isInteger(N.duration)&&o.compatibleVersion<3&&(o.compatibleVersion=3),Math.round(N.duration)>o.targetDuration&&s.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),c.duration=N.duration,c.title=N.title;else if("EXT-X-BYTERANGE"===p)o.compatibleVersion<4&&(o.compatibleVersion=4),c.byterange=N;else if("EXT-X-DISCONTINUITY"===p)c.parts.length>0&&s.INVALIDPLAYLIST("EXT-X-DISCONTINUITY must appear before the first EXT-X-PART tag of the Parent Segment."),c.discontinuity=!0;else if("EXT-X-KEY"===p)c.parts.length>0&&s.INVALIDPLAYLIST("EXT-X-KEY must appear before the first EXT-X-PART tag of the Parent Segment."),g(o,y),c.key=new E({method:y.METHOD,uri:y.URI,iv:y.IV,format:y.KEYFORMAT,formatVersion:y.KEYFORMATVERSIONS});else if("EXT-X-MAP"===p)c.parts.length>0&&s.INVALIDPLAYLIST("EXT-X-MAP must appear before the first EXT-X-PART tag of the Parent Segment."),o.compatibleVersion<5&&(o.compatibleVersion=5),o.hasMap=!0,c.map=new f({uri:y.URI,byterange:y.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===p)c.programDateTime=N;else if("EXT-X-DATERANGE"===p){for(var X={},v=0,m=Object.keys(y);v<m.length;v++){var R=m[v];(R.startsWith("SCTE35-")||R.startsWith("X-"))&&(X[R]=y[R])}c.dateRange=new I({id:y.ID,classId:y.CLASS,start:y["START-DATE"],end:y["END-DATE"],duration:y.DURATION,plannedDuration:y["PLANNED-DURATION"],endOnNext:y["END-ON-NEXT"],attributes:X})}else if("EXT-X-CUE-OUT"===p)c.markers.push(new h({type:"OUT",duration:N}));else if("EXT-X-CUE-IN"===p)c.markers.push(new h({type:"IN"}));else if("EXT-X-CUE-OUT-CONT"===p||"EXT-X-CUE"===p||"EXT-OATCLS-SCTE35"===p||"EXT-X-ASSET"===p||"EXT-X-SCTE35"===p)c.markers.push(new h({type:"RAW",tagName:p,value:N}));else if("EXT-X-PRELOAD-HINT"!==p||y.TYPE)if("EXT-X-PRELOAD-HINT"===p&&"PART"===y.TYPE&&l)s.INVALIDPLAYLIST("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist.");else if("EXT-X-PART"!==p&&"EXT-X-PRELOAD-HINT"!==p||y.URI){if("EXT-X-PRELOAD-HINT"===p&&"MAP"===y.TYPE)u&&s.INVALIDPLAYLIST("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist."),u=!0,o.hasMap=!0,c.map=new f({hint:!0,uri:y.URI,byterange:{length:y["BYTERANGE-LENGTH"],offset:y["BYTERANGE-START"]||0}});else if("EXT-X-PART"===p||"EXT-X-PRELOAD-HINT"===p&&"PART"===y.TYPE){"EXT-X-PART"!==p||y.DURATION||s.INVALIDPLAYLIST("EXT-X-PART: DURATION attribute is mandatory"),"EXT-X-PRELOAD-HINT"===p&&(l=!0);var L=new S({hint:"EXT-X-PRELOAD-HINT"===p,uri:y.URI,byterange:"EXT-X-PART"===p?y.BYTERANGE:{length:y["BYTERANGE-LENGTH"],offset:y["BYTERANGE-START"]||0},duration:y.DURATION,independent:y.INDEPENDENT,gap:y.GAP});c.parts.push(L)}}else s.INVALIDPLAYLIST("EXT-X-PART / EXT-X-PRELOAD-HINT: URI attribute is mandatory");else s.INVALIDPLAYLIST("EXT-X-PRELOAD-HINT: TYPE attribute is mandatory")}return c}function Y(t,e,n,a,r,i,o){for(var c=new N({uri:e,mediaSequenceNumber:r,discontinuitySequence:i}),u=n;u<=a;u++){var l=t[u],T=l.name,f=l.attributes;"EXTINF"===T?s.INVALIDPLAYLIST("A prefetch segment must not be advertised with an EXTINF tag."):"EXT-X-DISCONTINUITY"===T?s.INVALIDPLAYLIST("A prefetch segment must not be advertised with an EXT-X-DISCONTINUITY tag."):"EXT-X-PREFETCH-DISCONTINUITY"===T?c.discontinuity=!0:"EXT-X-KEY"===T?(g(o,f),c.key=new E({method:f.METHOD,uri:f.URI,iv:f.IV,format:f.KEYFORMAT,formatVersion:f.KEYFORMATVERSIONS})):"EXT-X-MAP"===T&&s.INVALIDPLAYLIST("Prefetch segments must not be advertised with an EXT-X-MAP tag.")}return c}function V(t,e){var n,i=new p,o=-1,c=0,u=!1,l=!1,T=0,E=null,f=null,I=!1,h=r(t.entries());try{for(h.s();!(n=h.n()).done;){var A=a(n.value,2),d=A[0],S=A[1],N=S.name,X=S.value,v=S.attributes;if("Segment"!==S.category){if("EXT-X-VERSION"===N)void 0===i.version?i.version=X:s.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===N)i.targetDuration=e.targetDuration=X;else if("EXT-X-MEDIA-SEQUENCE"===N)i.segments.length>0&&s.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),i.mediaSequenceBase=c=X;else if("EXT-X-DISCONTINUITY-SEQUENCE"===N)i.segments.length>0&&s.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),u&&s.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT-X-DISCONTINUITY tag."),i.discontinuitySequenceBase=T=X;else if("EXT-X-ENDLIST"===N)i.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===N)i.playlistType=X;else if("EXT-X-I-FRAMES-ONLY"===N)e.compatibleVersion<4&&(e.compatibleVersion=4),i.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===N)i.independentSegments&&s.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),i.independentSegments=!0;else if("EXT-X-START"===N)i.start&&s.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof v["TIME-OFFSET"]&&s.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),i.start={offset:v["TIME-OFFSET"],precise:v.PRECISE||!1};else if("EXT-X-SERVER-CONTROL"===N)v["CAN-BLOCK-RELOAD"]||s.INVALIDPLAYLIST("EXT-X-SERVER-CONTROL: CAN-BLOCK-RELOAD=YES is mandatory for Low-Latency HLS"),i.lowLatencyCompatibility={canBlockReload:v["CAN-BLOCK-RELOAD"],canSkipUntil:v["CAN-SKIP-UNTIL"],holdBack:v["HOLD-BACK"],partHoldBack:v["PART-HOLD-BACK"]};else if("EXT-X-PART-INF"===N)v["PART-TARGET"]||s.INVALIDPLAYLIST("EXT-X-PART-INF: PART-TARGET attribute is mandatory"),i.partTargetDuration=v["PART-TARGET"];else if("EXT-X-RENDITION-REPORT"===N)v.URI||s.INVALIDPLAYLIST("EXT-X-RENDITION-REPORT: URI attribute is mandatory"),0===v.URI.search(/^[a-z]+:/)&&s.INVALIDPLAYLIST("EXT-X-RENDITION-REPORT: URI must be relative to the playlist uri"),i.renditionReports.push(new y({uri:v.URI,lastMSN:v["LAST-MSN"],lastPart:v["LAST-PART"]}));else if("EXT-X-SKIP"===N)v["SKIPPED-SEGMENTS"]||s.INVALIDPLAYLIST("EXT-X-SKIP: SKIPPED-SEGMENTS attribute is mandatory"),e.compatibleVersion<9&&(e.compatibleVersion=9),i.skip=v["SKIPPED-SEGMENTS"],c+=i.skip;else if("EXT-X-PREFETCH"===N){var m=Y(t,X,-1===o?d:o,d-1,c++,T,e);m&&(m.discontinuity&&(m.discontinuitySequence++,T=m.discontinuitySequence),m.key?E=m.key:m.key=E,i.prefetchSegments.push(m)),l=!0,o=-1}else if("string"==typeof S){-1===o&&s.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),i.targetDuration||s.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED"),l&&s.INVALIDPLAYLIST("These segments must appear after all complete segments.");var R=U(t,S,o,d-1,c++,T,e);if(R){var L=a(w(i,R,T,E,f),3);T=L[0],E=L[1],f=L[2],!I&&R.parts.length>0&&(I=!0)}o=-1}}else-1===o&&(o=d),"EXT-X-DISCONTINUITY"===N&&(u=!0)}}catch(t){h.e(t)}finally{h.f()}if(-1!==o){var D=U(t,"",o,t.length-1,c++,T,e);if(D){var g=D.parts;g.length>0&&!i.endlist&&!g[g.length-1].hint&&s.INVALIDPLAYLIST("If the Playlist contains EXT-X-PART tags and does not contain an EXT-X-ENDLIST tag, the Playlist must contain an EXT-X-PRELOAD-HINT tag with a TYPE=PART attribute"),w(i,D,E,f),!I&&D.parts.length>0&&(I=!0)}}return function(t){for(var e=new Map,n=new Map,a=!1,i=!1,o=t.length-1;o>=0;o--){var c=t[o],u=c.programDateTime,l=c.dateRange;if(u&&(i=!0),l&&l.start){a=!0,l.endOnNext&&(l.end||l.duration)&&s.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var T=l.start.getTime(),E=l.duration||0;l.end&&l.duration&&T+1e3*E!==l.end.getTime()&&s.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),l.endOnNext&&(l.end=e.get(l.classId)),e.set(l.classId,l.start);var f=l.end?l.end.getTime():l.start.getTime()+1e3*(l.duration||0),I=n.get(l.classId);if(I){var h,A=r(I);try{for(A.s();!(h=A.n()).done;){var p=h.value;(p.start<=T&&p.end>T||p.start>=T&&p.start<f)&&s.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){A.e(t)}finally{A.f()}I.push({start:T,end:f})}else n.set(l.classId,[{start:T,end:f}])}}a&&!i&&s.INVALIDPLAYLIST("If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain at least one EXT-X-PROGRAM-DATE-TIME tag.")}(i.segments),i.lowLatencyCompatibility&&function(t,e){var n=t.lowLatencyCompatibility,i=t.targetDuration,o=t.partTargetDuration,c=t.segments,u=t.renditionReports,l=n.canSkipUntil,T=n.holdBack,E=n.partHoldBack;if(l<6*i&&s.INVALIDPLAYLIST("The Skip Boundary must be at least six times the EXT-X-TARGETDURATION."),T<3*i&&s.INVALIDPLAYLIST("HOLD-BACK must be at least three times the EXT-X-TARGETDURATION."),e){void 0===o&&s.INVALIDPLAYLIST("EXT-X-PART-INF is required if a Playlist contains one or more EXT-X-PART tags"),void 0===E&&s.INVALIDPLAYLIST("EXT-X-PART: PART-HOLD-BACK attribute is mandatory"),E<o&&s.INVALIDPLAYLIST("PART-HOLD-BACK must be at least PART-TARGET");var f,I=r(c.entries());try{for(I.s();!(f=I.n()).done;){var h=a(f.value,2),A=h[0],p=h[1].parts;p.length>0&&A<c.length-3&&s.INVALIDPLAYLIST("Remove EXT-X-PART tags from the Playlist after they are greater than three target durations from the end of the Playlist.");var d,S=r(p.entries());try{for(S.s();!(d=S.n()).done;){var N=a(d.value,2),y=N[0],X=N[1].duration;void 0!==X&&(X>o&&s.INVALIDPLAYLIST("PART-TARGET is the maximum duration of any Partial Segment"),y<p.length-1&&X<.85*o&&s.INVALIDPLAYLIST("All Partial Segments except the last part of a segment must have a duration of at least 85% of PART-TARGET"))}}catch(t){S.e(t)}finally{S.f()}}}catch(t){I.e(t)}finally{I.f()}}var v,m=r(u);try{for(m.s();!(v=m.n()).done;){var R=v.value,L=c[c.length-1];R.lastMSN||(R.lastMSN=L.mediaSequenceNumber),!R.lastPart&&L.parts.length>0&&(R.lastPart=L.parts.length-1)}}catch(t){m.e(t)}finally{m.f()}}(i,I),i}function w(t,e,n,a,r){var i=e.discontinuity,o=e.key,c=e.map,u=e.byterange,l=e.uri;if(i&&(e.discontinuitySequence=n+1),o||(e.key=a),c||(e.map=r),u&&-1===u.offset){var T=t.segments;if(T.length>0){var E=T[T.length-1];E.byterange&&E.uri===l?u.offset=E.byterange.offset+E.byterange.length:s.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 s.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}return t.segments.push(e),[e.discontinuitySequence,e.key,e.map]}function F(t,e){var n=a(function(t){var e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),2),r=n[0],i=n[1],o=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-PREFETCH-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":case"EXT-X-CUE-OUT":case"EXT-X-CUE-IN":case"EXT-X-CUE-OUT-CONT":case"EXT-X-CUE":case"EXT-OATCLS-SCTE35":case"EXT-X-ASSET":case"EXT-X-SCTE35":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":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":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PREFETCH":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":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"}}(r);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&P());if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&P()}}(o,e),"Unknown"===o)return null;"MediaPlaylist"===o&&"EXT-X-RENDITION-REPORT"!==r&&"EXT-X-PREFETCH"!==r&&(e.hash[r]&&s.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[r]=!0);var c=a(function(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":case"EXT-X-CUE-IN":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[s.toNumber(e),null];case"EXT-X-CUE-OUT":return Number.isNaN(Number(e))?[null,O(e)]:[s.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":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return[null,O(e)];case"EXTINF":return[v(e),null];case"EXT-X-BYTERANGE":return[m(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];case"EXT-X-PLAYLIST-TYPE":default:return[e,null]}}(r,i),2);return{name:r,category:o,value:c[0],attributes:c[1]}}function G(t,e){var n;return e.isMasterPlaylist?n=function(t,e){var n,i=new A,o=!1,c=r(t.entries());try{for(c.s();!(n=c.n()).done;){var u=a(n.value,2),l=u[0],f=u[1],I=f.name,h=f.value,p=f.attributes;if("EXT-X-VERSION"===I)i.version=h;else if("EXT-X-STREAM-INF"===I){var d=t[l+1];("string"!=typeof d||d.startsWith("#EXT"))&&s.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var S=C(t,p,d,!1,e);S&&("number"==typeof S.score&&(o=!0,S.score<0&&s.INVALIDPLAYLIST("SCORE attribute on EXT-X-STREAM-INF must be positive decimal-floating-point number.")),i.variants.push(S))}else if("EXT-X-I-FRAME-STREAM-INF"===I){var N=C(t,p,p.URI,!0,e);N&&i.variants.push(N)}else"EXT-X-SESSION-DATA"===I?function(){var t=new T({id:p["DATA-ID"],value:p.VALUE,uri:p.URI,language:p.LANGUAGE});i.sessionDataList.some((function(e){return e.id===t.id&&e.language===t.language}))&&s.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."),i.sessionDataList.push(t)}():"EXT-X-SESSION-KEY"===I?function(){"NONE"===p.METHOD&&s.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var t=new E({method:p.METHOD,uri:p.URI,iv:p.IV,format:p.KEYFORMAT,formatVersion:p.KEYFORMATVERSIONS});i.sessionKeyList.some((function(e){return M(e,t)}))&&s.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."),g(e,p),i.sessionKeyList.push(t)}():"EXT-X-INDEPENDENT-SEGMENTS"===I?(i.independentSegments&&s.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),i.independentSegments=!0):"EXT-X-START"===I&&(i.start&&s.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof p["TIME-OFFSET"]&&s.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),i.start={offset:p["TIME-OFFSET"],precise:p.PRECISE||!1})}}catch(t){c.e(t)}finally{c.f()}if(o){var y,X=r(i.variants);try{for(X.s();!(y=X.n()).done;)"number"!=typeof y.value.score&&s.INVALIDPLAYLIST("If any Variant Stream contains the SCORE attribute, then all Variant Streams in the Master Playlist SHOULD have a SCORE attribute")}catch(t){X.e(t)}finally{X.f()}}if(e.isClosedCaptionsNone){var v,m=r(i.variants);try{for(m.s();!(v=m.n()).done;)v.value.closedCaptions.length>0&&s.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){m.e(t)}finally{m.f()}}return i}(t,e):!(n=V(t,e)).isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6),e.compatibleVersion>1&&(!n.version||n.version<e.compatibleVersion)&&s.INVALIDPLAYLIST("EXT-X-VERSION needs to be ".concat(e.compatibleVersion," or higher.")),n}t.exports=function(t){var e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,isClosedCaptionsNone:!1,hash:{}},n=G(function(t,e){var n,a=[],i=r(t.split("\n"));try{for(i.s();!(n=i.n()).done;){var o=n.value,c=Buffer.from(o.trim()).toString();if(c)if(c.startsWith("#")){if(c.startsWith("#EXT")){var u=F(c,e);u&&a.push(u)}}else a.push(c)}}catch(t){i.e(t)}finally{i.f()}return 0!==a.length&&"EXTM3U"===a[0].name||s.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),a}(t,e),e);return n.source=t,n}},367:(t,e,n)=>{function a(t){return(a="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 r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],a=!0,r=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);a=!0);}catch(t){r=!0,i=t}finally{try{a||null==s.return||s.return()}finally{if(r)throw i}}return n}}(t,e)||o(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0,r=function(){};return{s:r,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){c=!0,i=t},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw i}}}}function o(t,e){if(t){if("string"==typeof t)return s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n<e;n++)a[n]=t[n];return a}function c(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function u(t,e,n){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var a=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(a){var r=Object.getOwnPropertyDescriptor(a,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function l(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function T(t){var e="function"==typeof Map?new Map:void 0;return(T=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return E(t,arguments,h(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),I(a,t)})(t)}function E(t,e,n){return(E=f()?Reflect.construct:function(t,e,n){var a=[null];a.push.apply(a,e);var r=new(Function.bind.apply(t,a));return n&&I(r,n.prototype),r}).apply(null,arguments)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function I(t,e){return(I=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var A=n(771),p=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-STREAM-INF","#EXT-X-CUE-OUT","#EXT-X-CUE-IN","#EXT-X-KEY","#EXT-X-MAP"],d=["#EXT-X-MEDIA"],S=function(t){!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&&I(t,e)}(s,t);var e,n,a,r,i,o=(e=s,n=f(),function(){var t,a=h(e);if(n){var r=h(this).constructor;t=Reflect.construct(a,arguments,r)}else t=a.apply(this,arguments);return l(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=o.call(this)).baseUri=t,e}return a=s,(r=[{key:"push",value:function(){for(var t=this,e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];for(var r=function(){var e=o[i];if(!e.startsWith("#"))return u(h(s.prototype),"push",t).call(t,e),"continue";if(p.some((function(t){return e.startsWith(t)})))return u(h(s.prototype),"push",t).call(t,e),"continue";if(t.includes(e)){if(d.some((function(t){return e.startsWith(t)})))return"continue";A.INVALIDPLAYLIST("Redundant item (".concat(e,")"))}u(h(s.prototype),"push",t).call(t,e)},i=0,o=n;i<o.length;i++)r()}}])&&c(a.prototype,r),i&&c(a,i),s}(T(Array));function N(t,e){var n=1e3;e&&(n=Math.pow(10,e));var a=Math.round(t*n)/n;return e?a.toFixed(e):a}function y(t){var e=t.toString(10),n=e.indexOf(".");return-1===n?0:e.length-n-1}function X(t){var e=['DATA-ID="'.concat(t.id,'"')];return t.language&&e.push('LANGUAGE="'.concat(t.language,'"')),t.value?e.push('VALUE="'.concat(t.value,'"')):t.uri&&e.push('URI="'.concat(t.uri,'"')),"#EXT-X-SESSION-DATA:".concat(e.join(","))}function v(t,e){var n=e?"#EXT-X-SESSION-KEY":"#EXT-X-KEY",a=["METHOD=".concat(t.method)];return t.uri&&a.push('URI="'.concat(t.uri,'"')),t.iv&&(16!==t.iv.length&&A.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),a.push("IV=".concat(A.byteSequenceToHex(t.iv)))),t.format&&a.push('KEYFORMAT="'.concat(t.format,'"')),t.formatVersion&&a.push('KEYFORMATVERSIONS="'.concat(t.formatVersion,'"')),"".concat(n,":").concat(a.join(","))}function m(t,e){var n=e.isIFrameOnly?"#EXT-X-I-FRAME-STREAM-INF":"#EXT-X-STREAM-INF",a=["BANDWIDTH=".concat(e.bandwidth)];if(e.averageBandwidth&&a.push("AVERAGE-BANDWIDTH=".concat(e.averageBandwidth)),e.isIFrameOnly&&a.push('URI="'.concat(e.uri,'"')),e.codecs&&a.push('CODECS="'.concat(e.codecs,'"')),e.resolution&&a.push("RESOLUTION=".concat(e.resolution.width,"x").concat(e.resolution.height)),e.frameRate&&a.push("FRAME-RATE=".concat(N(e.frameRate,3))),e.hdcpLevel&&a.push("HDCP-LEVEL=".concat(e.hdcpLevel)),e.audio.length>0){a.push('AUDIO="'.concat(e.audio[0].groupId,'"'));var r,o=i(e.audio);try{for(o.s();!(r=o.n()).done;){var s=r.value;t.push(R(s))}}catch(t){o.e(t)}finally{o.f()}}if(e.video.length>0){a.push('VIDEO="'.concat(e.video[0].groupId,'"'));var c,u=i(e.video);try{for(u.s();!(c=u.n()).done;){var l=c.value;t.push(R(l))}}catch(t){u.e(t)}finally{u.f()}}if(e.subtitles.length>0){a.push('SUBTITLES="'.concat(e.subtitles[0].groupId,'"'));var T,E=i(e.subtitles);try{for(E.s();!(T=E.n()).done;){var f=T.value;t.push(R(f))}}catch(t){E.e(t)}finally{E.f()}}if(A.getOptions().allowClosedCaptionsNone&&0===e.closedCaptions.length)a.push("CLOSED-CAPTIONS=NONE");else if(e.closedCaptions.length>0){a.push('CLOSED-CAPTIONS="'.concat(e.closedCaptions[0].groupId,'"'));var I,h=i(e.closedCaptions);try{for(h.s();!(I=h.n()).done;){var p=I.value;t.push(R(p))}}catch(t){h.e(t)}finally{h.f()}}if(e.score&&a.push("SCORE=".concat(e.score)),e.allowedCpc){var d,S=[],y=i(e.allowedCpc);try{for(y.s();!(d=y.n()).done;){var X=d.value,v=X.format,m=X.cpcList;S.push("".concat(v,":").concat(m.join("/")))}}catch(t){y.e(t)}finally{y.f()}a.push('ALLOWED-CPC="'.concat(S.join(","),'"'))}e.videoRange&&a.push("VIDEO-RANGE=".concat(e.videoRange)),e.stableVariantId&&a.push('STABLE-VARIANT-ID="'.concat(e.stableVariantId,'"')),t.push("".concat(n,":").concat(a.join(","))),e.isIFrameOnly||t.push("".concat(e.uri))}function R(t){var e=["TYPE=".concat(t.type),'GROUP-ID="'.concat(t.groupId,'"'),'NAME="'.concat(t.name,'"')];return void 0!==t.isDefault&&e.push("DEFAULT=".concat(t.isDefault?"YES":"NO")),void 0!==t.autoselect&&e.push("AUTOSELECT=".concat(t.autoselect?"YES":"NO")),void 0!==t.forced&&e.push("FORCED=".concat(t.forced?"YES":"NO")),t.language&&e.push('LANGUAGE="'.concat(t.language,'"')),t.assocLanguage&&e.push('ASSOC-LANGUAGE="'.concat(t.assocLanguage,'"')),t.instreamId&&e.push('INSTREAM-ID="'.concat(t.instreamId,'"')),t.characteristics&&e.push('CHARACTERISTICS="'.concat(t.characteristics,'"')),t.channels&&e.push('CHANNELS="'.concat(t.channels,'"')),t.uri&&e.push('URI="'.concat(t.uri,'"')),"#EXT-X-MEDIA:".concat(e.join(","))}function L(t,e,n,a){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,i=!1,o="";if(e.discontinuity&&t.push("#EXT-X-DISCONTINUITY"),e.key){var s=v(e.key);s!==n&&(t.push(s),n=s)}if(e.map){var c=D(e.map);c!==a&&(t.push(c),a=c)}if(e.programDateTime&&t.push("#EXT-X-PROGRAM-DATE-TIME:".concat(A.formatDate(e.programDateTime))),e.dateRange&&t.push(O(e.dateRange)),e.markers.length>0&&(o=P(t,e.markers)),e.parts.length>0&&(i=b(t,e.parts)),i)return[n,a];var u=r<3?Math.round(e.duration):N(e.duration,y(e.duration));return t.push("#EXTINF:".concat(u,",").concat(unescape(encodeURIComponent(e.title||"")))),e.byterange&&t.push("#EXT-X-BYTERANGE:".concat(g(e.byterange))),Array.prototype.push.call(t,"".concat(e.uri)),[n,a,o]}function D(t){var e=['URI="'.concat(t.uri,'"')];return t.byterange&&e.push('BYTERANGE="'.concat(g(t.byterange),'"')),"#EXT-X-MAP:".concat(e.join(","))}function g(t){var e=t.offset,n=t.length;return"".concat(n,"@").concat(e)}function O(t){var e=['ID="'.concat(t.id,'"')];t.start&&e.push('START-DATE="'.concat(A.formatDate(t.start),'"')),t.end&&e.push('END-DATE="'.concat(t.end,'"')),t.duration&&e.push("DURATION=".concat(t.duration)),t.plannedDuration&&e.push("PLANNED-DURATION=".concat(t.plannedDuration)),t.classId&&e.push('CLASS="'.concat(t.classId,'"')),t.endOnNext&&e.push("END-ON-NEXT=YES");for(var n=0,a=Object.keys(t.attributes);n<a.length;n++){var r=a[n];r.startsWith("X-")?"number"==typeof t.attributes[r]?e.push("".concat(r,"=").concat(t.attributes[r])):e.push("".concat(r,'="').concat(t.attributes[r],'"')):r.startsWith("SCTE35-")&&e.push("".concat(r,"=").concat(A.byteSequenceToHex(t.attributes[r])))}return"#EXT-X-DATERANGE:".concat(e.join(","))}function P(t,e){var n,a="",r=i(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;if("OUT"===o.type)a="OUT",t.push("#EXT-X-CUE-OUT:DURATION=".concat(o.duration));else if("IN"===o.type)a="IN",t.push("#EXT-X-CUE-IN");else if("RAW"===o.type){var s=o.value?":".concat(o.value):"";t.push("#".concat(o.tagName).concat(s))}}}catch(t){r.e(t)}finally{r.f()}return a}function b(t,e){var n,a=!1,r=i(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.hint){var s=[];if(s.push("TYPE=PART",'URI="'.concat(o.uri,'"')),o.byterange){var c=o.byterange,u=c.offset,l=c.length;s.push("BYTERANGE-START=".concat(u)),l&&s.push("BYTERANGE-LENGTH=".concat(l))}t.push("#EXT-X-PRELOAD-HINT:".concat(s.join(","))),a=!0}else{var T=[];T.push("DURATION=".concat(o.duration),'URI="'.concat(o.uri,'"')),o.byterange&&T.push("BYTERANGE=".concat(g(o.byterange))),o.independent&&T.push("INDEPENDENT=YES"),o.gap&&T.push("GAP=YES"),t.push("#EXT-X-PART:".concat(T.join(",")))}}}catch(t){r.e(t)}finally{r.f()}return a}t.exports=function(t){A.PARAMCHECK(t),A.ASSERT("Not a playlist","playlist"===t.type);var e=new S(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 n,a=i(e.sessionDataList);try{for(a.s();!(n=a.n()).done;){var r=n.value;t.push(X(r))}}catch(t){a.e(t)}finally{a.f()}var o,s=i(e.sessionKeyList);try{for(s.s();!(o=s.n()).done;){var c=o.value;t.push(v(c,!0))}}catch(t){s.e(t)}finally{s.f()}var u,l=i(e.variants);try{for(l.s();!(u=l.n()).done;)m(t,u.value)}catch(t){l.e(t)}finally{l.f()}}(e,t):function(t,e){var n="",a="",o=!1;if(e.targetDuration&&t.push("#EXT-X-TARGETDURATION:".concat(e.targetDuration)),e.lowLatencyCompatibility){var s=e.lowLatencyCompatibility,c=s.canBlockReload,u=s.canSkipUntil,l=s.holdBack,T=s.partHoldBack,E=[];E.push("CAN-BLOCK-RELOAD=".concat(c?"YES":"NO")),void 0!==u&&E.push("CAN-SKIP-UNTIL=".concat(u)),void 0!==l&&E.push("HOLD-BACK=".concat(l)),void 0!==T&&E.push("PART-HOLD-BACK=".concat(T)),t.push("#EXT-X-SERVER-CONTROL:".concat(E.join(",")))}e.partTargetDuration&&t.push("#EXT-X-PART-INF:PART-TARGET=".concat(e.partTargetDuration)),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"),e.skip>0&&t.push("#EXT-X-SKIP:SKIPPED-SEGMENTS=".concat(e.skip));var f,I=i(e.segments);try{for(I.s();!(f=I.n()).done;){var h,p=r(L(t,f.value,n,a,e.version),3);n=p[0],a=p[1],"OUT"===(h=p[2])?o=!0:"IN"===h&&o&&(o=!1)}}catch(t){I.e(t)}finally{I.f()}"VOD"===e.playlistType&&o&&t.push("#EXT-X-CUE-IN"),e.prefetchSegments.length>2&&A.INVALIDPLAYLIST("The server must deliver no more than two prefetch segments");var d,S=i(e.prefetchSegments);try{for(S.s();!(d=S.n()).done;){var N=d.value;N.discontinuity&&t.push("#EXT-X-PREFETCH-DISCONTINUITY"),t.push("#EXT-X-PREFETCH:".concat(N.uri))}}catch(t){S.e(t)}finally{S.f()}e.endlist&&t.push("#EXT-X-ENDLIST");var y,X=i(e.renditionReports);try{for(X.s();!(y=X.n()).done;){var v=y.value,m=[];m.push('URI="'.concat(v.uri,'"'),"LAST-MSN=".concat(v.lastMSN)),void 0!==v.lastPart&&m.push("LAST-PART=".concat(v.lastPart)),t.push("#EXT-X-RENDITION-REPORT:".concat(m.join(",")))}}catch(t){X.e(t)}finally{X.f()}}(e,t),e.join("\n")}},890:(t,e,n)=>{function a(t){return(a="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 r(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&&i(t,e)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,a=c(t);if(e){var r=c(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=n(771),T=function t(e){u(this,t),l.PARAMCHECK(e),this.type=e},E=function(t){r(n,t);var e=o(n);function n(t){var a,r=t.isMasterPlaylist,i=t.uri,o=t.version,s=t.independentSegments,c=void 0!==s&&s,T=t.start,E=t.source;return u(this,n),a=e.call(this,"playlist"),l.PARAMCHECK(r),a.isMasterPlaylist=r,a.uri=i,a.version=o,a.independentSegments=c,a.start=T,a.source=E,a}return n}(T),f=function(t){r(n,t);var e=o(n);function n(){var t,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,n),a.isMasterPlaylist=!0,t=e.call(this,a);var r=a.variants,i=void 0===r?[]:r,o=a.currentVariant,s=a.sessionDataList,c=void 0===s?[]:s,l=a.sessionKeyList,T=void 0===l?[]:l;return t.variants=i,t.currentVariant=o,t.sessionDataList=c,t.sessionKeyList=T,t}return n}(E),I=function(t){r(n,t);var e=o(n);function n(){var t,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,n),a.isMasterPlaylist=!1,t=e.call(this,a);var r=a.targetDuration,i=a.mediaSequenceBase,o=void 0===i?0:i,s=a.discontinuitySequenceBase,c=void 0===s?0:s,l=a.endlist,T=void 0!==l&&l,E=a.playlistType,f=a.isIFrame,I=a.segments,h=void 0===I?[]:I,A=a.prefetchSegments,p=void 0===A?[]:A,d=a.lowLatencyCompatibility,S=a.partTargetDuration,N=a.renditionReports,y=void 0===N?[]:N,X=a.skip,v=void 0===X?0:X,m=a.hash;return t.targetDuration=r,t.mediaSequenceBase=o,t.discontinuitySequenceBase=c,t.endlist=T,t.playlistType=E,t.isIFrame=f,t.segments=h,t.prefetchSegments=p,t.lowLatencyCompatibility=d,t.partTargetDuration=S,t.renditionReports=y,t.skip=v,t.hash=m,t}return n}(E),h=function(t){r(n,t);var e=o(n);function n(t){var a,r=t.uri,i=t.mimeType,o=t.data,s=t.duration,c=t.title,l=t.byterange,T=t.discontinuity,E=t.mediaSequenceNumber,f=void 0===E?0:E,I=t.discontinuitySequence,h=void 0===I?0:I,A=t.key,p=t.map,d=t.programDateTime,S=t.dateRange,N=t.markers,y=void 0===N?[]:N,X=t.parts,v=void 0===X?[]:X;return u(this,n),(a=e.call(this,"segment")).uri=r,a.mimeType=i,a.data=o,a.duration=s,a.title=c,a.byterange=l,a.discontinuity=T,a.mediaSequenceNumber=f,a.discontinuitySequence=h,a.key=A,a.map=p,a.programDateTime=d,a.dateRange=S,a.markers=y,a.parts=v,a}return n}(T),A=function(t){r(n,t);var e=o(n);function n(t){var a,r=t.hint,i=void 0!==r&&r,o=t.uri,s=t.duration,c=t.independent,T=t.byterange,E=t.gap;return u(this,n),a=e.call(this,"part"),l.PARAMCHECK(o),a.hint=i,a.uri=o,a.duration=s,a.independent=c,a.duration=s,a.byterange=T,a.gap=E,a}return n}(T),p=function(t){r(n,t);var e=o(n);function n(t){var a,r=t.uri,i=t.discontinuity,o=t.mediaSequenceNumber,s=void 0===o?0:o,c=t.discontinuitySequence,T=void 0===c?0:c,E=t.key;return u(this,n),a=e.call(this,"prefetch"),l.PARAMCHECK(r),a.uri=r,a.discontinuity=i,a.mediaSequenceNumber=s,a.discontinuitySequence=T,a.key=E,a}return n}(T);t.exports={Rendition:function t(e){var n=e.type,a=e.uri,r=e.groupId,i=e.language,o=e.assocLanguage,s=e.name,c=e.isDefault,T=e.autoselect,E=e.forced,f=e.instreamId,I=e.characteristics,h=e.channels;u(this,t),l.PARAMCHECK(n,r,s),l.CONDITIONALASSERT(["SUBTITLES"===n,a],["CLOSED-CAPTIONS"===n,f],["CLOSED-CAPTIONS"===n,!a],[E,"SUBTITLES"===n]),this.type=n,this.uri=a,this.groupId=r,this.language=i,this.assocLanguage=o,this.name=s,this.isDefault=c,this.autoselect=T,this.forced=E,this.instreamId=f,this.characteristics=I,this.channels=h},Variant:function t(e){var n=e.uri,a=e.isIFrameOnly,r=void 0!==a&&a,i=e.bandwidth,o=e.averageBandwidth,s=e.score,c=e.codecs,T=e.resolution,E=e.frameRate,f=e.hdcpLevel,I=e.allowedCpc,h=e.videoRange,A=e.stableVariantId,p=e.audio,d=void 0===p?[]:p,S=e.video,N=void 0===S?[]:S,y=e.subtitles,X=void 0===y?[]:y,v=e.closedCaptions,m=void 0===v?[]:v,R=e.currentRenditions,L=void 0===R?{audio:0,video:0,subtitles:0,closedCaptions:0}:R;u(this,t),l.PARAMCHECK(n,i),this.uri=n,this.isIFrameOnly=r,this.bandwidth=i,this.averageBandwidth=o,this.score=s,this.codecs=c,this.resolution=T,this.frameRate=E,this.hdcpLevel=f,this.allowedCpc=I,this.videoRange=h,this.stableVariantId=A,this.audio=d,this.video=N,this.subtitles=X,this.closedCaptions=m,this.currentRenditions=L},SessionData:function t(e){var n=e.id,a=e.value,r=e.uri,i=e.language;u(this,t),l.PARAMCHECK(n,a||r),l.ASSERT("SessionData cannot have both value and uri, shoud be either.",!(a&&r)),this.id=n,this.value=a,this.uri=r,this.language=i},Key:function t(e){var n=e.method,a=e.uri,r=e.iv,i=e.format,o=e.formatVersion;u(this,t),l.PARAMCHECK(n),l.CONDITIONALPARAMCHECK(["NONE"!==n,a]),l.CONDITIONALASSERT(["NONE"===n,!(a||r||i||o)]),this.method=n,this.uri=a,this.iv=r,this.format=i,this.formatVersion=o},MediaInitializationSection:function t(e){var n=e.hint,a=void 0!==n&&n,r=e.uri,i=e.mimeType,o=e.byterange;u(this,t),l.PARAMCHECK(r),this.hint=a,this.uri=r,this.mimeType=i,this.byterange=o},DateRange:function t(e){var n=e.id,a=e.classId,r=e.start,i=e.end,o=e.duration,s=e.plannedDuration,c=e.endOnNext,T=e.attributes,E=void 0===T?{}:T;u(this,t),l.PARAMCHECK(n),l.CONDITIONALPARAMCHECK([!0===c,a]),l.CONDITIONALASSERT([i,r],[i,r<=i],[o,o>=0],[s,s>=0]),this.id=n,this.classId=a,this.start=r,this.end=i,this.duration=o,this.plannedDuration=s,this.endOnNext=c,this.attributes=E},SpliceInfo:function t(e){var n=e.type,a=e.duration,r=e.tagName,i=e.value;u(this,t),l.PARAMCHECK(n),l.CONDITIONALPARAMCHECK(["OUT"===n,a]),l.CONDITIONALPARAMCHECK(["RAW"===n,r]),this.type=n,this.duration=a,this.tagName=r,this.value=i},Playlist:E,MasterPlaylist:f,MediaPlaylist:I,Segment:h,PartialSegment:A,PrefetchSegment:p,RenditionReport:function t(e){var n=e.uri,a=e.lastMSN,r=e.lastPart;u(this,t),l.PARAMCHECK(n),this.uri=n,this.lastMSN=a,this.lastPart=r}}},771:t=>{function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],a=!0,r=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);a=!0);}catch(t){r=!0,i=t}finally{try{a||null==s.return||s.return()}finally{if(r)throw i}}return n}}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=a(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){c=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw o}}}}function a(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n<e;n++)a[n]=t[n];return a}var i={};function o(t){if(i.strictMode)throw t;i.silent||console.error(t.message)}function s(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if("number"==typeof t)return t;var n=10===e?Number.parseFloat(t,e):Number.parseInt(t,e);return Number.isNaN(n)?0:n}t.exports={THROW:o,ASSERT:function(t){for(var a=arguments.length,r=new Array(a>1?a-1:0),i=1;i<a;i++)r[i-1]=arguments[i];var s,c=n(r.entries());try{for(c.s();!(s=c.n()).done;){var u=e(s.value,2),l=u[0],T=u[1];T||o(new Error("".concat(t," : Failed at [").concat(l,"]")))}}catch(t){c.e(t)}finally{c.f()}},CONDITIONALASSERT:function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];var i,s=n(a.entries());try{for(s.s();!(i=s.n()).done;){var c=e(i.value,2),u=c[0],l=e(c[1],2),T=l[0],E=l[1];T&&(E||o(new Error("Conditional Assert : Failed at [".concat(u,"]"))))}}catch(t){s.e(t)}finally{s.f()}},PARAMCHECK:function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];var i,s=n(a.entries());try{for(s.s();!(i=s.n()).done;){var c=e(i.value,2),u=c[0],l=c[1];void 0===l&&o(new Error("Param Check : Failed at [".concat(u,"]")))}}catch(t){s.e(t)}finally{s.f()}},CONDITIONALPARAMCHECK:function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];var i,s=n(a.entries());try{for(s.s();!(i=s.n()).done;){var c=e(i.value,2),u=c[0],l=e(c[1],2),T=l[0],E=l[1];T&&void 0===E&&o(new Error("Conditional Param Check : Failed at [".concat(u,"]")))}}catch(t){s.e(t)}finally{s.f()}},INVALIDPLAYLIST:function(t){o(new Error("Invalid Playlist : ".concat(t)))},toNumber:s,hexToByteSequence:function(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var e=[],n=0;n<t.length;n+=2)e.push(s(t.slice(n,n+2),16));return Buffer.from(e)},byteSequenceToHex:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;n<=e&&o(new Error("end must be larger than start : start=".concat(e,", end=").concat(n)));for(var a=[],r=e;r<n;r++)a.push("0".concat((255&t[r]).toString(16).toUpperCase()).slice(-2));return"0x".concat(a.join(""))},tryCatch:function(t,e){try{return t()}catch(t){return e(t)}},splitAt:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=-1,r=0,i=0;r<t.length;r++)if(t[r]===e){if(i++===n)return[t.slice(0,r),t.slice(r+1)];a=r}return-1!==a?[t.slice(0,a),t.slice(a+1)]:[t]},trim:function(t){var e=arguments.length>1&&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):t},splitByCommaWithPreservingQuotes:function(t){for(var e=[],n=!0,a=0,r=[],i=0;i<t.length;i++){var o=t[i];n&&","===o?(e.push(t.slice(a,i).trim()),a=i+1):'"'!==o&&"'"!==o||(n?(r.push(o),n=!1):o===r[r.length-1]?(r.pop(),n=!0):r.push(o))}return e.push(t.slice(a).trim()),e},camelify:function(t){var e,a=[],r=!1,i=n(t);try{for(i.s();!(e=i.n()).done;){var o=e.value;"-"!==o&&"_"!==o?r?(a.push(o.toUpperCase()),r=!1):a.push(o.toLowerCase()):r=!0}}catch(t){i.e(t)}finally{i.f()}return a.join("")},formatDate:function(t){var e=t.getUTCFullYear(),n=("0"+(t.getUTCMonth()+1)).slice(-2),a=("0"+t.getUTCDate()).slice(-2),r=("0"+t.getUTCHours()).slice(-2),i=("0"+t.getUTCMinutes()).slice(-2),o=("0"+t.getUTCSeconds()).slice(-2),s=("00"+t.getUTCMilliseconds()).slice(-3);return"".concat(e,"-").concat(n,"-").concat(a,"T").concat(r,":").concat(i,":").concat(o,".").concat(s,"Z")},hasOwnProp:function(t,e){return Object.hasOwnProperty.call(t,e)},setOptions:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i=Object.assign(i,t)},getOptions:function(){return Object.assign({},i)}}}},e={},function n(a){var r=e[a];if(void 0!==r)return r.exports;var i=e[a]={exports:{}};return t[a](i,i.exports,n),i.exports}(851);var t,e}));
!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()}(self,(function(){return t={851:(t,e,n)=>{var a=n(771),r=a.getOptions,i=a.setOptions,o=n(463),s=n(367),c=n(890);t.exports={parse:o,stringify:s,types:c,getOptions:r,setOptions:i}},463:(t,e,n)=>{function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],a=!0,r=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);a=!0);}catch(t){r=!0,i=t}finally{try{a||null==s.return||s.return()}finally{if(r)throw i}}return n}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=i(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0,r=function(){};return{s:r,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){c=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw o}}}}function i(t,e){if(t){if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n<e;n++)a[n]=t[n];return a}var s=n(771),c=n(890),u=c.Rendition,l=c.Variant,T=c.SessionData,E=c.Key,f=c.MediaInitializationSection,I=c.DateRange,h=c.SpliceInfo,A=c.MasterPlaylist,p=c.MediaPlaylist,d=c.Segment,S=c.PartialSegment,N=c.PrefetchSegment,y=c.RenditionReport;function X(t){return s.trim(t,'"')}function v(t){var e=s.splitAt(t,",");return{duration:s.toNumber(e[0]),title:decodeURIComponent(escape(e[1]))}}function m(t){var e=s.splitAt(t,"@");return{length:s.toNumber(e[0]),offset:e[1]?s.toNumber(e[1]):-1}}function R(t){var e=s.splitAt(t,"x");return{width:s.toNumber(e[0]),height:s.toNumber(e[1])}}function L(t){var e="ALLOWED-CPC: Each entry must consit of KEYFORMAT and Content Protection Configuration",n=t.split(",");0===n.length&&s.INVALIDPLAYLIST(e);var i,o=[],c=r(n);try{for(c.s();!(i=c.n()).done;){var u=i.value,l=a(s.splitAt(u,":"),2),T=l[0],E=l[1];T&&E?o.push({format:T,cpcList:E.split("/")}):s.INVALIDPLAYLIST(e)}}catch(t){c.e(t)}finally{c.f()}return o}function D(t){return t.startsWith('"')?X(t):t.startsWith("0x")||t.startsWith("0X")?s.hexToByteSequence(t):s.toNumber(t)}function g(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function O(t){var e,n,i,o={},c=r(s.splitByCommaWithPreservingQuotes(t));try{for(c.s();!(e=c.n()).done;){var u=e.value,l=a(s.splitAt(u,"="),2),T=l[0],E=l[1],f=X(E);switch(T){case"URI":o[T]=f;break;case"START-DATE":case"END-DATE":o[T]=new Date(f);break;case"IV":o[T]=(n=f,i=void 0,16!==(i=s.hexToByteSequence(n)).length&&s.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i);break;case"BYTERANGE":o[T]=m(f);break;case"RESOLUTION":o[T]=R(f);break;case"ALLOWED-CPC":o[T]=L(f);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":case"CAN-BLOCK-RELOAD":case"INDEPENDENT":case"GAP":o[T]="YES"===f;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":case"CAN-SKIP-UNTIL":case"HOLD-BACK":case"PART-HOLD-BACK":case"PART-TARGET":case"BYTERANGE-START":case"BYTERANGE-LENGTH":case"LAST-MSN":case"LAST-PART":case"SKIPPED-SEGMENTS":case"SCORE":o[T]=s.toNumber(f);break;default:T.startsWith("SCTE35-")?o[T]=s.hexToByteSequence(f):T.startsWith("X-")?o[T]=D(E):("VIDEO-RANGE"===T&&"SDR"!==f&&"HLG"!==f&&"PQ"!==f&&s.INVALIDPLAYLIST('VIDEO-RANGE: unknown value "'.concat(f,'"')),o[T]=f)}}}catch(t){c.e(t)}finally{c.f()}return o}function P(){s.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function b(t,e,n){var a,i=(a=e.attributes,new u({type:a.TYPE,uri:a.URI,groupId:a["GROUP-ID"],language:a.LANGUAGE,assocLanguage:a["ASSOC-LANGUAGE"],name:a.NAME,isDefault:a.DEFAULT,autoselect:a.AUTOSELECT,forced:a.FORCED,instreamId:a["INSTREAM-ID"],characteristics:a.CHARACTERISTICS,channels:a.CHANNELS})),o=t[s.camelify(n)],c=function(t,e){var n,a=!1,i=r(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";o.isDefault&&(a=!0)}}catch(t){i.e(t)}finally{i.f()}return a&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(o,i);c&&s.INVALIDPLAYLIST(c),o.push(i),i.isDefault&&(t.currentRenditions[s.camelify(n)]=o.length-1)}function C(t,e,n,a,i){var o,c=new l({uri:n,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],score:e.SCORE,codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"],allowedCpc:e["ALLOWED-CPC"],videoRange:e["VIDEO-RANGE"],stableVariantId:e["STABLE-VARIANT-ID"]}),u=r(t);try{for(u.s();!(o=u.n()).done;){var T=o.value;if("EXT-X-MEDIA"===T.name){var E=T.attributes,f=E.TYPE;if(f&&E["GROUP-ID"]||s.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[f]===E["GROUP-ID"]&&(b(c,T,f),"CLOSED-CAPTIONS"===f)){var I,h=r(c.closedCaptions);try{for(h.s();!(I=h.n()).done;){var A=I.value.instreamId;if(A&&A.startsWith("SERVICE")&&i.compatibleVersion<7){i.compatibleVersion=7;break}}}catch(t){h.e(t)}finally{h.f()}}}}}catch(t){u.e(t)}finally{u.f()}return function(t,e,n){for(var a=function(){var a=i[r];"CLOSED-CAPTIONS"===a&&"NONE"===t[a]?(n.isClosedCaptionsNone=!0,e.closedCaptions=[]):t[a]&&!e[s.camelify(a)].some((function(e){return e.groupId===t[a]}))&&s.INVALIDPLAYLIST("".concat(a," attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is ").concat(a,"."))},r=0,i=["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"];r<i.length;r++)a()}(e,c,i),c.isIFrameOnly=a,c}function M(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.length!==e.iv.length)return!1;for(var n=0;n<t.iv.length;n++)if(t.iv[n]!==e.iv[n])return!1}else if(e.iv)return!1;return t.format===e.format&&t.formatVersion===e.formatVersion}function U(t,e,n,a,r,i,o){for(var c=new d({uri:e,mediaSequenceNumber:r,discontinuitySequence:i}),u=!1,l=!1,T=n;T<=a;T++){var A=t[T],p=A.name,N=A.value,y=A.attributes;if("EXTINF"===p)!Number.isInteger(N.duration)&&o.compatibleVersion<3&&(o.compatibleVersion=3),Math.round(N.duration)>o.targetDuration&&s.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),c.duration=N.duration,c.title=N.title;else if("EXT-X-BYTERANGE"===p)o.compatibleVersion<4&&(o.compatibleVersion=4),c.byterange=N;else if("EXT-X-DISCONTINUITY"===p)c.parts.length>0&&s.INVALIDPLAYLIST("EXT-X-DISCONTINUITY must appear before the first EXT-X-PART tag of the Parent Segment."),c.discontinuity=!0;else if("EXT-X-KEY"===p)c.parts.length>0&&s.INVALIDPLAYLIST("EXT-X-KEY must appear before the first EXT-X-PART tag of the Parent Segment."),g(o,y),c.key=new E({method:y.METHOD,uri:y.URI,iv:y.IV,format:y.KEYFORMAT,formatVersion:y.KEYFORMATVERSIONS});else if("EXT-X-MAP"===p)c.parts.length>0&&s.INVALIDPLAYLIST("EXT-X-MAP must appear before the first EXT-X-PART tag of the Parent Segment."),o.compatibleVersion<5&&(o.compatibleVersion=5),o.hasMap=!0,c.map=new f({uri:y.URI,byterange:y.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===p)c.programDateTime=N;else if("EXT-X-DATERANGE"===p){for(var X={},v=0,m=Object.keys(y);v<m.length;v++){var R=m[v];(R.startsWith("SCTE35-")||R.startsWith("X-"))&&(X[R]=y[R])}c.dateRange=new I({id:y.ID,classId:y.CLASS,start:y["START-DATE"],end:y["END-DATE"],duration:y.DURATION,plannedDuration:y["PLANNED-DURATION"],endOnNext:y["END-ON-NEXT"],attributes:X})}else if("EXT-X-CUE-OUT"===p)c.markers.push(new h({type:"OUT",duration:(null==y?void 0:y.DURATION)||N}));else if("EXT-X-CUE-IN"===p)c.markers.push(new h({type:"IN"}));else if("EXT-X-CUE-OUT-CONT"===p||"EXT-X-CUE"===p||"EXT-OATCLS-SCTE35"===p||"EXT-X-ASSET"===p||"EXT-X-SCTE35"===p)c.markers.push(new h({type:"RAW",tagName:p,value:N}));else if("EXT-X-PRELOAD-HINT"!==p||y.TYPE)if("EXT-X-PRELOAD-HINT"===p&&"PART"===y.TYPE&&l)s.INVALIDPLAYLIST("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist.");else if("EXT-X-PART"!==p&&"EXT-X-PRELOAD-HINT"!==p||y.URI){if("EXT-X-PRELOAD-HINT"===p&&"MAP"===y.TYPE)u&&s.INVALIDPLAYLIST("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist."),u=!0,o.hasMap=!0,c.map=new f({hint:!0,uri:y.URI,byterange:{length:y["BYTERANGE-LENGTH"],offset:y["BYTERANGE-START"]||0}});else if("EXT-X-PART"===p||"EXT-X-PRELOAD-HINT"===p&&"PART"===y.TYPE){"EXT-X-PART"!==p||y.DURATION||s.INVALIDPLAYLIST("EXT-X-PART: DURATION attribute is mandatory"),"EXT-X-PRELOAD-HINT"===p&&(l=!0);var L=new S({hint:"EXT-X-PRELOAD-HINT"===p,uri:y.URI,byterange:"EXT-X-PART"===p?y.BYTERANGE:{length:y["BYTERANGE-LENGTH"],offset:y["BYTERANGE-START"]||0},duration:y.DURATION,independent:y.INDEPENDENT,gap:y.GAP});c.parts.push(L)}}else s.INVALIDPLAYLIST("EXT-X-PART / EXT-X-PRELOAD-HINT: URI attribute is mandatory");else s.INVALIDPLAYLIST("EXT-X-PRELOAD-HINT: TYPE attribute is mandatory")}return c}function Y(t,e,n,a,r,i,o){for(var c=new N({uri:e,mediaSequenceNumber:r,discontinuitySequence:i}),u=n;u<=a;u++){var l=t[u],T=l.name,f=l.attributes;"EXTINF"===T?s.INVALIDPLAYLIST("A prefetch segment must not be advertised with an EXTINF tag."):"EXT-X-DISCONTINUITY"===T?s.INVALIDPLAYLIST("A prefetch segment must not be advertised with an EXT-X-DISCONTINUITY tag."):"EXT-X-PREFETCH-DISCONTINUITY"===T?c.discontinuity=!0:"EXT-X-KEY"===T?(g(o,f),c.key=new E({method:f.METHOD,uri:f.URI,iv:f.IV,format:f.KEYFORMAT,formatVersion:f.KEYFORMATVERSIONS})):"EXT-X-MAP"===T&&s.INVALIDPLAYLIST("Prefetch segments must not be advertised with an EXT-X-MAP tag.")}return c}function V(t,e){var n,i=new p,o=-1,c=0,u=!1,l=!1,T=0,E=null,f=null,I=!1,h=r(t.entries());try{for(h.s();!(n=h.n()).done;){var A=a(n.value,2),d=A[0],S=A[1],N=S.name,X=S.value,v=S.attributes;if("Segment"!==S.category){if("EXT-X-VERSION"===N)void 0===i.version?i.version=X:s.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===N)i.targetDuration=e.targetDuration=X;else if("EXT-X-MEDIA-SEQUENCE"===N)i.segments.length>0&&s.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),i.mediaSequenceBase=c=X;else if("EXT-X-DISCONTINUITY-SEQUENCE"===N)i.segments.length>0&&s.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),u&&s.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT-X-DISCONTINUITY tag."),i.discontinuitySequenceBase=T=X;else if("EXT-X-ENDLIST"===N)i.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===N)i.playlistType=X;else if("EXT-X-I-FRAMES-ONLY"===N)e.compatibleVersion<4&&(e.compatibleVersion=4),i.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===N)i.independentSegments&&s.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),i.independentSegments=!0;else if("EXT-X-START"===N)i.start&&s.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof v["TIME-OFFSET"]&&s.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),i.start={offset:v["TIME-OFFSET"],precise:v.PRECISE||!1};else if("EXT-X-SERVER-CONTROL"===N)v["CAN-BLOCK-RELOAD"]||s.INVALIDPLAYLIST("EXT-X-SERVER-CONTROL: CAN-BLOCK-RELOAD=YES is mandatory for Low-Latency HLS"),i.lowLatencyCompatibility={canBlockReload:v["CAN-BLOCK-RELOAD"],canSkipUntil:v["CAN-SKIP-UNTIL"],holdBack:v["HOLD-BACK"],partHoldBack:v["PART-HOLD-BACK"]};else if("EXT-X-PART-INF"===N)v["PART-TARGET"]||s.INVALIDPLAYLIST("EXT-X-PART-INF: PART-TARGET attribute is mandatory"),i.partTargetDuration=v["PART-TARGET"];else if("EXT-X-RENDITION-REPORT"===N)v.URI||s.INVALIDPLAYLIST("EXT-X-RENDITION-REPORT: URI attribute is mandatory"),0===v.URI.search(/^[a-z]+:/)&&s.INVALIDPLAYLIST("EXT-X-RENDITION-REPORT: URI must be relative to the playlist uri"),i.renditionReports.push(new y({uri:v.URI,lastMSN:v["LAST-MSN"],lastPart:v["LAST-PART"]}));else if("EXT-X-SKIP"===N)v["SKIPPED-SEGMENTS"]||s.INVALIDPLAYLIST("EXT-X-SKIP: SKIPPED-SEGMENTS attribute is mandatory"),e.compatibleVersion<9&&(e.compatibleVersion=9),i.skip=v["SKIPPED-SEGMENTS"],c+=i.skip;else if("EXT-X-PREFETCH"===N){var m=Y(t,X,-1===o?d:o,d-1,c++,T,e);m&&(m.discontinuity&&(m.discontinuitySequence++,T=m.discontinuitySequence),m.key?E=m.key:m.key=E,i.prefetchSegments.push(m)),l=!0,o=-1}else if("string"==typeof S){-1===o&&s.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),i.targetDuration||s.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED"),l&&s.INVALIDPLAYLIST("These segments must appear after all complete segments.");var R=U(t,S,o,d-1,c++,T,e);if(R){var L=a(w(i,R,T,E,f),3);T=L[0],E=L[1],f=L[2],!I&&R.parts.length>0&&(I=!0)}o=-1}}else-1===o&&(o=d),"EXT-X-DISCONTINUITY"===N&&(u=!0)}}catch(t){h.e(t)}finally{h.f()}if(-1!==o){var D=U(t,"",o,t.length-1,c++,T,e);if(D){var g=D.parts;g.length>0&&!i.endlist&&!g[g.length-1].hint&&s.INVALIDPLAYLIST("If the Playlist contains EXT-X-PART tags and does not contain an EXT-X-ENDLIST tag, the Playlist must contain an EXT-X-PRELOAD-HINT tag with a TYPE=PART attribute"),w(i,D,E,f),!I&&D.parts.length>0&&(I=!0)}}return function(t){for(var e=new Map,n=new Map,a=!1,i=!1,o=t.length-1;o>=0;o--){var c=t[o],u=c.programDateTime,l=c.dateRange;if(u&&(i=!0),l&&l.start){a=!0,l.endOnNext&&(l.end||l.duration)&&s.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var T=l.start.getTime(),E=l.duration||0;l.end&&l.duration&&T+1e3*E!==l.end.getTime()&&s.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),l.endOnNext&&(l.end=e.get(l.classId)),e.set(l.classId,l.start);var f=l.end?l.end.getTime():l.start.getTime()+1e3*(l.duration||0),I=n.get(l.classId);if(I){var h,A=r(I);try{for(A.s();!(h=A.n()).done;){var p=h.value;(p.start<=T&&p.end>T||p.start>=T&&p.start<f)&&s.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){A.e(t)}finally{A.f()}I.push({start:T,end:f})}else n.set(l.classId,[{start:T,end:f}])}}a&&!i&&s.INVALIDPLAYLIST("If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain at least one EXT-X-PROGRAM-DATE-TIME tag.")}(i.segments),i.lowLatencyCompatibility&&function(t,e){var n=t.lowLatencyCompatibility,i=t.targetDuration,o=t.partTargetDuration,c=t.segments,u=t.renditionReports,l=n.canSkipUntil,T=n.holdBack,E=n.partHoldBack;if(l<6*i&&s.INVALIDPLAYLIST("The Skip Boundary must be at least six times the EXT-X-TARGETDURATION."),T<3*i&&s.INVALIDPLAYLIST("HOLD-BACK must be at least three times the EXT-X-TARGETDURATION."),e){void 0===o&&s.INVALIDPLAYLIST("EXT-X-PART-INF is required if a Playlist contains one or more EXT-X-PART tags"),void 0===E&&s.INVALIDPLAYLIST("EXT-X-PART: PART-HOLD-BACK attribute is mandatory"),E<o&&s.INVALIDPLAYLIST("PART-HOLD-BACK must be at least PART-TARGET");var f,I=r(c.entries());try{for(I.s();!(f=I.n()).done;){var h=a(f.value,2),A=h[0],p=h[1].parts;p.length>0&&A<c.length-3&&s.INVALIDPLAYLIST("Remove EXT-X-PART tags from the Playlist after they are greater than three target durations from the end of the Playlist.");var d,S=r(p.entries());try{for(S.s();!(d=S.n()).done;){var N=a(d.value,2),y=N[0],X=N[1].duration;void 0!==X&&(X>o&&s.INVALIDPLAYLIST("PART-TARGET is the maximum duration of any Partial Segment"),y<p.length-1&&X<.85*o&&s.INVALIDPLAYLIST("All Partial Segments except the last part of a segment must have a duration of at least 85% of PART-TARGET"))}}catch(t){S.e(t)}finally{S.f()}}}catch(t){I.e(t)}finally{I.f()}}var v,m=r(u);try{for(m.s();!(v=m.n()).done;){var R=v.value,L=c[c.length-1];R.lastMSN||(R.lastMSN=L.mediaSequenceNumber),!R.lastPart&&L.parts.length>0&&(R.lastPart=L.parts.length-1)}}catch(t){m.e(t)}finally{m.f()}}(i,I),i}function w(t,e,n,a,r){var i=e.discontinuity,o=e.key,c=e.map,u=e.byterange,l=e.uri;if(i&&(e.discontinuitySequence=n+1),o||(e.key=a),c||(e.map=r),u&&-1===u.offset){var T=t.segments;if(T.length>0){var E=T[T.length-1];E.byterange&&E.uri===l?u.offset=E.byterange.offset+E.byterange.length:s.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 s.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}return t.segments.push(e),[e.discontinuitySequence,e.key,e.map]}function F(t,e){var n=a(function(t){var e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),2),r=n[0],i=n[1],o=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-PREFETCH-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":case"EXT-X-CUE-OUT":case"EXT-X-CUE-IN":case"EXT-X-CUE-OUT-CONT":case"EXT-X-CUE":case"EXT-OATCLS-SCTE35":case"EXT-X-ASSET":case"EXT-X-SCTE35":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":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":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PREFETCH":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":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"}}(r);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&P());if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&P()}}(o,e),"Unknown"===o)return null;"MediaPlaylist"===o&&"EXT-X-RENDITION-REPORT"!==r&&"EXT-X-PREFETCH"!==r&&(e.hash[r]&&s.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[r]=!0);var c=a(function(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":case"EXT-X-CUE-IN":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[s.toNumber(e),null];case"EXT-X-CUE-OUT":return Number.isNaN(Number(e))?[null,O(e)]:[s.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":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return[null,O(e)];case"EXTINF":return[v(e),null];case"EXT-X-BYTERANGE":return[m(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];case"EXT-X-PLAYLIST-TYPE":default:return[e,null]}}(r,i),2);return{name:r,category:o,value:c[0],attributes:c[1]}}function G(t,e){var n;return e.isMasterPlaylist?n=function(t,e){var n,i=new A,o=!1,c=r(t.entries());try{for(c.s();!(n=c.n()).done;){var u=a(n.value,2),l=u[0],f=u[1],I=f.name,h=f.value,p=f.attributes;if("EXT-X-VERSION"===I)i.version=h;else if("EXT-X-STREAM-INF"===I){var d=t[l+1];("string"!=typeof d||d.startsWith("#EXT"))&&s.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var S=C(t,p,d,!1,e);S&&("number"==typeof S.score&&(o=!0,S.score<0&&s.INVALIDPLAYLIST("SCORE attribute on EXT-X-STREAM-INF must be positive decimal-floating-point number.")),i.variants.push(S))}else if("EXT-X-I-FRAME-STREAM-INF"===I){var N=C(t,p,p.URI,!0,e);N&&i.variants.push(N)}else"EXT-X-SESSION-DATA"===I?function(){var t=new T({id:p["DATA-ID"],value:p.VALUE,uri:p.URI,language:p.LANGUAGE});i.sessionDataList.some((function(e){return e.id===t.id&&e.language===t.language}))&&s.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."),i.sessionDataList.push(t)}():"EXT-X-SESSION-KEY"===I?function(){"NONE"===p.METHOD&&s.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var t=new E({method:p.METHOD,uri:p.URI,iv:p.IV,format:p.KEYFORMAT,formatVersion:p.KEYFORMATVERSIONS});i.sessionKeyList.some((function(e){return M(e,t)}))&&s.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."),g(e,p),i.sessionKeyList.push(t)}():"EXT-X-INDEPENDENT-SEGMENTS"===I?(i.independentSegments&&s.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),i.independentSegments=!0):"EXT-X-START"===I&&(i.start&&s.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof p["TIME-OFFSET"]&&s.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),i.start={offset:p["TIME-OFFSET"],precise:p.PRECISE||!1})}}catch(t){c.e(t)}finally{c.f()}if(o){var y,X=r(i.variants);try{for(X.s();!(y=X.n()).done;)"number"!=typeof y.value.score&&s.INVALIDPLAYLIST("If any Variant Stream contains the SCORE attribute, then all Variant Streams in the Master Playlist SHOULD have a SCORE attribute")}catch(t){X.e(t)}finally{X.f()}}if(e.isClosedCaptionsNone){var v,m=r(i.variants);try{for(m.s();!(v=m.n()).done;)v.value.closedCaptions.length>0&&s.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){m.e(t)}finally{m.f()}}return i}(t,e):!(n=V(t,e)).isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6),e.compatibleVersion>1&&(!n.version||n.version<e.compatibleVersion)&&s.INVALIDPLAYLIST("EXT-X-VERSION needs to be ".concat(e.compatibleVersion," or higher.")),n}t.exports=function(t){var e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,isClosedCaptionsNone:!1,hash:{}},n=G(function(t,e){var n,a=[],i=r(t.split("\n"));try{for(i.s();!(n=i.n()).done;){var o=n.value,c=Buffer.from(o.trim()).toString();if(c)if(c.startsWith("#")){if(c.startsWith("#EXT")){var u=F(c,e);u&&a.push(u)}}else a.push(c)}}catch(t){i.e(t)}finally{i.f()}return 0!==a.length&&"EXTM3U"===a[0].name||s.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),a}(t,e),e);return n.source=t,n}},367:(t,e,n)=>{function a(t){return(a="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 r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],a=!0,r=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);a=!0);}catch(t){r=!0,i=t}finally{try{a||null==s.return||s.return()}finally{if(r)throw i}}return n}}(t,e)||o(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var a=0,r=function(){};return{s:r,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){c=!0,i=t},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw i}}}}function o(t,e){if(t){if("string"==typeof t)return s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n<e;n++)a[n]=t[n];return a}function c(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function u(t,e,n){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var a=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(a){var r=Object.getOwnPropertyDescriptor(a,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function l(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function T(t){var e="function"==typeof Map?new Map:void 0;return(T=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return E(t,arguments,h(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),I(a,t)})(t)}function E(t,e,n){return(E=f()?Reflect.construct:function(t,e,n){var a=[null];a.push.apply(a,e);var r=new(Function.bind.apply(t,a));return n&&I(r,n.prototype),r}).apply(null,arguments)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function I(t,e){return(I=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var A=n(771),p=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-STREAM-INF","#EXT-X-CUE-OUT","#EXT-X-CUE-IN","#EXT-X-KEY","#EXT-X-MAP"],d=["#EXT-X-MEDIA"],S=function(t){!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&&I(t,e)}(s,t);var e,n,a,r,i,o=(e=s,n=f(),function(){var t,a=h(e);if(n){var r=h(this).constructor;t=Reflect.construct(a,arguments,r)}else t=a.apply(this,arguments);return l(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=o.call(this)).baseUri=t,e}return a=s,(r=[{key:"push",value:function(){for(var t=this,e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];for(var r=function(){var e=o[i];if(!e.startsWith("#"))return u(h(s.prototype),"push",t).call(t,e),"continue";if(p.some((function(t){return e.startsWith(t)})))return u(h(s.prototype),"push",t).call(t,e),"continue";if(t.includes(e)){if(d.some((function(t){return e.startsWith(t)})))return"continue";A.INVALIDPLAYLIST("Redundant item (".concat(e,")"))}u(h(s.prototype),"push",t).call(t,e)},i=0,o=n;i<o.length;i++)r()}}])&&c(a.prototype,r),i&&c(a,i),s}(T(Array));function N(t,e){var n=1e3;e&&(n=Math.pow(10,e));var a=Math.round(t*n)/n;return e?a.toFixed(e):a}function y(t){var e=t.toString(10),n=e.indexOf(".");return-1===n?0:e.length-n-1}function X(t){var e=['DATA-ID="'.concat(t.id,'"')];return t.language&&e.push('LANGUAGE="'.concat(t.language,'"')),t.value?e.push('VALUE="'.concat(t.value,'"')):t.uri&&e.push('URI="'.concat(t.uri,'"')),"#EXT-X-SESSION-DATA:".concat(e.join(","))}function v(t,e){var n=e?"#EXT-X-SESSION-KEY":"#EXT-X-KEY",a=["METHOD=".concat(t.method)];return t.uri&&a.push('URI="'.concat(t.uri,'"')),t.iv&&(16!==t.iv.length&&A.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),a.push("IV=".concat(A.byteSequenceToHex(t.iv)))),t.format&&a.push('KEYFORMAT="'.concat(t.format,'"')),t.formatVersion&&a.push('KEYFORMATVERSIONS="'.concat(t.formatVersion,'"')),"".concat(n,":").concat(a.join(","))}function m(t,e){var n=e.isIFrameOnly?"#EXT-X-I-FRAME-STREAM-INF":"#EXT-X-STREAM-INF",a=["BANDWIDTH=".concat(e.bandwidth)];if(e.averageBandwidth&&a.push("AVERAGE-BANDWIDTH=".concat(e.averageBandwidth)),e.isIFrameOnly&&a.push('URI="'.concat(e.uri,'"')),e.codecs&&a.push('CODECS="'.concat(e.codecs,'"')),e.resolution&&a.push("RESOLUTION=".concat(e.resolution.width,"x").concat(e.resolution.height)),e.frameRate&&a.push("FRAME-RATE=".concat(N(e.frameRate,3))),e.hdcpLevel&&a.push("HDCP-LEVEL=".concat(e.hdcpLevel)),e.audio.length>0){a.push('AUDIO="'.concat(e.audio[0].groupId,'"'));var r,o=i(e.audio);try{for(o.s();!(r=o.n()).done;){var s=r.value;t.push(R(s))}}catch(t){o.e(t)}finally{o.f()}}if(e.video.length>0){a.push('VIDEO="'.concat(e.video[0].groupId,'"'));var c,u=i(e.video);try{for(u.s();!(c=u.n()).done;){var l=c.value;t.push(R(l))}}catch(t){u.e(t)}finally{u.f()}}if(e.subtitles.length>0){a.push('SUBTITLES="'.concat(e.subtitles[0].groupId,'"'));var T,E=i(e.subtitles);try{for(E.s();!(T=E.n()).done;){var f=T.value;t.push(R(f))}}catch(t){E.e(t)}finally{E.f()}}if(A.getOptions().allowClosedCaptionsNone&&0===e.closedCaptions.length)a.push("CLOSED-CAPTIONS=NONE");else if(e.closedCaptions.length>0){a.push('CLOSED-CAPTIONS="'.concat(e.closedCaptions[0].groupId,'"'));var I,h=i(e.closedCaptions);try{for(h.s();!(I=h.n()).done;){var p=I.value;t.push(R(p))}}catch(t){h.e(t)}finally{h.f()}}if(e.score&&a.push("SCORE=".concat(e.score)),e.allowedCpc){var d,S=[],y=i(e.allowedCpc);try{for(y.s();!(d=y.n()).done;){var X=d.value,v=X.format,m=X.cpcList;S.push("".concat(v,":").concat(m.join("/")))}}catch(t){y.e(t)}finally{y.f()}a.push('ALLOWED-CPC="'.concat(S.join(","),'"'))}e.videoRange&&a.push("VIDEO-RANGE=".concat(e.videoRange)),e.stableVariantId&&a.push('STABLE-VARIANT-ID="'.concat(e.stableVariantId,'"')),t.push("".concat(n,":").concat(a.join(","))),e.isIFrameOnly||t.push("".concat(e.uri))}function R(t){var e=["TYPE=".concat(t.type),'GROUP-ID="'.concat(t.groupId,'"'),'NAME="'.concat(t.name,'"')];return void 0!==t.isDefault&&e.push("DEFAULT=".concat(t.isDefault?"YES":"NO")),void 0!==t.autoselect&&e.push("AUTOSELECT=".concat(t.autoselect?"YES":"NO")),void 0!==t.forced&&e.push("FORCED=".concat(t.forced?"YES":"NO")),t.language&&e.push('LANGUAGE="'.concat(t.language,'"')),t.assocLanguage&&e.push('ASSOC-LANGUAGE="'.concat(t.assocLanguage,'"')),t.instreamId&&e.push('INSTREAM-ID="'.concat(t.instreamId,'"')),t.characteristics&&e.push('CHARACTERISTICS="'.concat(t.characteristics,'"')),t.channels&&e.push('CHANNELS="'.concat(t.channels,'"')),t.uri&&e.push('URI="'.concat(t.uri,'"')),"#EXT-X-MEDIA:".concat(e.join(","))}function L(t,e,n,a){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,i=!1,o="";if(e.discontinuity&&t.push("#EXT-X-DISCONTINUITY"),e.key){var s=v(e.key);s!==n&&(t.push(s),n=s)}if(e.map){var c=D(e.map);c!==a&&(t.push(c),a=c)}if(e.programDateTime&&t.push("#EXT-X-PROGRAM-DATE-TIME:".concat(A.formatDate(e.programDateTime))),e.dateRange&&t.push(O(e.dateRange)),e.markers.length>0&&(o=P(t,e.markers)),e.parts.length>0&&(i=b(t,e.parts)),i)return[n,a];var u=r<3?Math.round(e.duration):N(e.duration,y(e.duration));return t.push("#EXTINF:".concat(u,",").concat(unescape(encodeURIComponent(e.title||"")))),e.byterange&&t.push("#EXT-X-BYTERANGE:".concat(g(e.byterange))),Array.prototype.push.call(t,"".concat(e.uri)),[n,a,o]}function D(t){var e=['URI="'.concat(t.uri,'"')];return t.byterange&&e.push('BYTERANGE="'.concat(g(t.byterange),'"')),"#EXT-X-MAP:".concat(e.join(","))}function g(t){var e=t.offset,n=t.length;return"".concat(n,"@").concat(e)}function O(t){var e=['ID="'.concat(t.id,'"')];t.start&&e.push('START-DATE="'.concat(A.formatDate(t.start),'"')),t.end&&e.push('END-DATE="'.concat(t.end,'"')),t.duration&&e.push("DURATION=".concat(t.duration)),t.plannedDuration&&e.push("PLANNED-DURATION=".concat(t.plannedDuration)),t.classId&&e.push('CLASS="'.concat(t.classId,'"')),t.endOnNext&&e.push("END-ON-NEXT=YES");for(var n=0,a=Object.keys(t.attributes);n<a.length;n++){var r=a[n];r.startsWith("X-")?"number"==typeof t.attributes[r]?e.push("".concat(r,"=").concat(t.attributes[r])):e.push("".concat(r,'="').concat(t.attributes[r],'"')):r.startsWith("SCTE35-")&&e.push("".concat(r,"=").concat(A.byteSequenceToHex(t.attributes[r])))}return"#EXT-X-DATERANGE:".concat(e.join(","))}function P(t,e){var n,a="",r=i(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;if("OUT"===o.type)a="OUT",t.push("#EXT-X-CUE-OUT:DURATION=".concat(o.duration));else if("IN"===o.type)a="IN",t.push("#EXT-X-CUE-IN");else if("RAW"===o.type){var s=o.value?":".concat(o.value):"";t.push("#".concat(o.tagName).concat(s))}}}catch(t){r.e(t)}finally{r.f()}return a}function b(t,e){var n,a=!1,r=i(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.hint){var s=[];if(s.push("TYPE=PART",'URI="'.concat(o.uri,'"')),o.byterange){var c=o.byterange,u=c.offset,l=c.length;s.push("BYTERANGE-START=".concat(u)),l&&s.push("BYTERANGE-LENGTH=".concat(l))}t.push("#EXT-X-PRELOAD-HINT:".concat(s.join(","))),a=!0}else{var T=[];T.push("DURATION=".concat(o.duration),'URI="'.concat(o.uri,'"')),o.byterange&&T.push("BYTERANGE=".concat(g(o.byterange))),o.independent&&T.push("INDEPENDENT=YES"),o.gap&&T.push("GAP=YES"),t.push("#EXT-X-PART:".concat(T.join(",")))}}}catch(t){r.e(t)}finally{r.f()}return a}t.exports=function(t){A.PARAMCHECK(t),A.ASSERT("Not a playlist","playlist"===t.type);var e=new S(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 n,a=i(e.sessionDataList);try{for(a.s();!(n=a.n()).done;){var r=n.value;t.push(X(r))}}catch(t){a.e(t)}finally{a.f()}var o,s=i(e.sessionKeyList);try{for(s.s();!(o=s.n()).done;){var c=o.value;t.push(v(c,!0))}}catch(t){s.e(t)}finally{s.f()}var u,l=i(e.variants);try{for(l.s();!(u=l.n()).done;)m(t,u.value)}catch(t){l.e(t)}finally{l.f()}}(e,t):function(t,e){var n="",a="",o=!1;if(e.targetDuration&&t.push("#EXT-X-TARGETDURATION:".concat(e.targetDuration)),e.lowLatencyCompatibility){var s=e.lowLatencyCompatibility,c=s.canBlockReload,u=s.canSkipUntil,l=s.holdBack,T=s.partHoldBack,E=[];E.push("CAN-BLOCK-RELOAD=".concat(c?"YES":"NO")),void 0!==u&&E.push("CAN-SKIP-UNTIL=".concat(u)),void 0!==l&&E.push("HOLD-BACK=".concat(l)),void 0!==T&&E.push("PART-HOLD-BACK=".concat(T)),t.push("#EXT-X-SERVER-CONTROL:".concat(E.join(",")))}e.partTargetDuration&&t.push("#EXT-X-PART-INF:PART-TARGET=".concat(e.partTargetDuration)),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"),e.skip>0&&t.push("#EXT-X-SKIP:SKIPPED-SEGMENTS=".concat(e.skip));var f,I=i(e.segments);try{for(I.s();!(f=I.n()).done;){var h,p=r(L(t,f.value,n,a,e.version),3);n=p[0],a=p[1],"OUT"===(h=p[2])?o=!0:"IN"===h&&o&&(o=!1)}}catch(t){I.e(t)}finally{I.f()}"VOD"===e.playlistType&&o&&t.push("#EXT-X-CUE-IN"),e.prefetchSegments.length>2&&A.INVALIDPLAYLIST("The server must deliver no more than two prefetch segments");var d,S=i(e.prefetchSegments);try{for(S.s();!(d=S.n()).done;){var N=d.value;N.discontinuity&&t.push("#EXT-X-PREFETCH-DISCONTINUITY"),t.push("#EXT-X-PREFETCH:".concat(N.uri))}}catch(t){S.e(t)}finally{S.f()}e.endlist&&t.push("#EXT-X-ENDLIST");var y,X=i(e.renditionReports);try{for(X.s();!(y=X.n()).done;){var v=y.value,m=[];m.push('URI="'.concat(v.uri,'"'),"LAST-MSN=".concat(v.lastMSN)),void 0!==v.lastPart&&m.push("LAST-PART=".concat(v.lastPart)),t.push("#EXT-X-RENDITION-REPORT:".concat(m.join(",")))}}catch(t){X.e(t)}finally{X.f()}}(e,t),e.join("\n")}},890:(t,e,n)=>{function a(t){return(a="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 r(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&&i(t,e)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,a=c(t);if(e){var r=c(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var l=n(771),T=function t(e){u(this,t),l.PARAMCHECK(e),this.type=e},E=function(t){r(n,t);var e=o(n);function n(t){var a,r=t.isMasterPlaylist,i=t.uri,o=t.version,s=t.independentSegments,c=void 0!==s&&s,T=t.start,E=t.source;return u(this,n),a=e.call(this,"playlist"),l.PARAMCHECK(r),a.isMasterPlaylist=r,a.uri=i,a.version=o,a.independentSegments=c,a.start=T,a.source=E,a}return n}(T),f=function(t){r(n,t);var e=o(n);function n(){var t,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,n),a.isMasterPlaylist=!0,t=e.call(this,a);var r=a.variants,i=void 0===r?[]:r,o=a.currentVariant,s=a.sessionDataList,c=void 0===s?[]:s,l=a.sessionKeyList,T=void 0===l?[]:l;return t.variants=i,t.currentVariant=o,t.sessionDataList=c,t.sessionKeyList=T,t}return n}(E),I=function(t){r(n,t);var e=o(n);function n(){var t,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u(this,n),a.isMasterPlaylist=!1,t=e.call(this,a);var r=a.targetDuration,i=a.mediaSequenceBase,o=void 0===i?0:i,s=a.discontinuitySequenceBase,c=void 0===s?0:s,l=a.endlist,T=void 0!==l&&l,E=a.playlistType,f=a.isIFrame,I=a.segments,h=void 0===I?[]:I,A=a.prefetchSegments,p=void 0===A?[]:A,d=a.lowLatencyCompatibility,S=a.partTargetDuration,N=a.renditionReports,y=void 0===N?[]:N,X=a.skip,v=void 0===X?0:X,m=a.hash;return t.targetDuration=r,t.mediaSequenceBase=o,t.discontinuitySequenceBase=c,t.endlist=T,t.playlistType=E,t.isIFrame=f,t.segments=h,t.prefetchSegments=p,t.lowLatencyCompatibility=d,t.partTargetDuration=S,t.renditionReports=y,t.skip=v,t.hash=m,t}return n}(E),h=function(t){r(n,t);var e=o(n);function n(t){var a,r=t.uri,i=t.mimeType,o=t.data,s=t.duration,c=t.title,l=t.byterange,T=t.discontinuity,E=t.mediaSequenceNumber,f=void 0===E?0:E,I=t.discontinuitySequence,h=void 0===I?0:I,A=t.key,p=t.map,d=t.programDateTime,S=t.dateRange,N=t.markers,y=void 0===N?[]:N,X=t.parts,v=void 0===X?[]:X;return u(this,n),(a=e.call(this,"segment")).uri=r,a.mimeType=i,a.data=o,a.duration=s,a.title=c,a.byterange=l,a.discontinuity=T,a.mediaSequenceNumber=f,a.discontinuitySequence=h,a.key=A,a.map=p,a.programDateTime=d,a.dateRange=S,a.markers=y,a.parts=v,a}return n}(T),A=function(t){r(n,t);var e=o(n);function n(t){var a,r=t.hint,i=void 0!==r&&r,o=t.uri,s=t.duration,c=t.independent,T=t.byterange,E=t.gap;return u(this,n),a=e.call(this,"part"),l.PARAMCHECK(o),a.hint=i,a.uri=o,a.duration=s,a.independent=c,a.duration=s,a.byterange=T,a.gap=E,a}return n}(T),p=function(t){r(n,t);var e=o(n);function n(t){var a,r=t.uri,i=t.discontinuity,o=t.mediaSequenceNumber,s=void 0===o?0:o,c=t.discontinuitySequence,T=void 0===c?0:c,E=t.key;return u(this,n),a=e.call(this,"prefetch"),l.PARAMCHECK(r),a.uri=r,a.discontinuity=i,a.mediaSequenceNumber=s,a.discontinuitySequence=T,a.key=E,a}return n}(T);t.exports={Rendition:function t(e){var n=e.type,a=e.uri,r=e.groupId,i=e.language,o=e.assocLanguage,s=e.name,c=e.isDefault,T=e.autoselect,E=e.forced,f=e.instreamId,I=e.characteristics,h=e.channels;u(this,t),l.PARAMCHECK(n,r,s),l.CONDITIONALASSERT(["SUBTITLES"===n,a],["CLOSED-CAPTIONS"===n,f],["CLOSED-CAPTIONS"===n,!a],[E,"SUBTITLES"===n]),this.type=n,this.uri=a,this.groupId=r,this.language=i,this.assocLanguage=o,this.name=s,this.isDefault=c,this.autoselect=T,this.forced=E,this.instreamId=f,this.characteristics=I,this.channels=h},Variant:function t(e){var n=e.uri,a=e.isIFrameOnly,r=void 0!==a&&a,i=e.bandwidth,o=e.averageBandwidth,s=e.score,c=e.codecs,T=e.resolution,E=e.frameRate,f=e.hdcpLevel,I=e.allowedCpc,h=e.videoRange,A=e.stableVariantId,p=e.audio,d=void 0===p?[]:p,S=e.video,N=void 0===S?[]:S,y=e.subtitles,X=void 0===y?[]:y,v=e.closedCaptions,m=void 0===v?[]:v,R=e.currentRenditions,L=void 0===R?{audio:0,video:0,subtitles:0,closedCaptions:0}:R;u(this,t),l.PARAMCHECK(n,i),this.uri=n,this.isIFrameOnly=r,this.bandwidth=i,this.averageBandwidth=o,this.score=s,this.codecs=c,this.resolution=T,this.frameRate=E,this.hdcpLevel=f,this.allowedCpc=I,this.videoRange=h,this.stableVariantId=A,this.audio=d,this.video=N,this.subtitles=X,this.closedCaptions=m,this.currentRenditions=L},SessionData:function t(e){var n=e.id,a=e.value,r=e.uri,i=e.language;u(this,t),l.PARAMCHECK(n,a||r),l.ASSERT("SessionData cannot have both value and uri, shoud be either.",!(a&&r)),this.id=n,this.value=a,this.uri=r,this.language=i},Key:function t(e){var n=e.method,a=e.uri,r=e.iv,i=e.format,o=e.formatVersion;u(this,t),l.PARAMCHECK(n),l.CONDITIONALPARAMCHECK(["NONE"!==n,a]),l.CONDITIONALASSERT(["NONE"===n,!(a||r||i||o)]),this.method=n,this.uri=a,this.iv=r,this.format=i,this.formatVersion=o},MediaInitializationSection:function t(e){var n=e.hint,a=void 0!==n&&n,r=e.uri,i=e.mimeType,o=e.byterange;u(this,t),l.PARAMCHECK(r),this.hint=a,this.uri=r,this.mimeType=i,this.byterange=o},DateRange:function t(e){var n=e.id,a=e.classId,r=e.start,i=e.end,o=e.duration,s=e.plannedDuration,c=e.endOnNext,T=e.attributes,E=void 0===T?{}:T;u(this,t),l.PARAMCHECK(n),l.CONDITIONALPARAMCHECK([!0===c,a]),l.CONDITIONALASSERT([i,r],[i,r<=i],[o,o>=0],[s,s>=0]),this.id=n,this.classId=a,this.start=r,this.end=i,this.duration=o,this.plannedDuration=s,this.endOnNext=c,this.attributes=E},SpliceInfo:function t(e){var n=e.type,a=e.duration,r=e.tagName,i=e.value;u(this,t),l.PARAMCHECK(n),l.CONDITIONALPARAMCHECK(["OUT"===n,a]),l.CONDITIONALPARAMCHECK(["RAW"===n,r]),this.type=n,this.duration=a,this.tagName=r,this.value=i},Playlist:E,MasterPlaylist:f,MediaPlaylist:I,Segment:h,PartialSegment:A,PrefetchSegment:p,RenditionReport:function t(e){var n=e.uri,a=e.lastMSN,r=e.lastPart;u(this,t),l.PARAMCHECK(n),this.uri=n,this.lastMSN=a,this.lastPart=r}}},771:t=>{function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],a=!0,r=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done)&&(n.push(o.value),!e||n.length!==e);a=!0);}catch(t){r=!0,i=t}finally{try{a||null==s.return||s.return()}finally{if(r)throw i}}return n}}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=a(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){c=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw o}}}}function a(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n<e;n++)a[n]=t[n];return a}var i={};function o(t){if(i.strictMode)throw t;i.silent||console.error(t.message)}function s(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if("number"==typeof t)return t;var n=10===e?Number.parseFloat(t,e):Number.parseInt(t,e);return Number.isNaN(n)?0:n}t.exports={THROW:o,ASSERT:function(t){for(var a=arguments.length,r=new Array(a>1?a-1:0),i=1;i<a;i++)r[i-1]=arguments[i];var s,c=n(r.entries());try{for(c.s();!(s=c.n()).done;){var u=e(s.value,2),l=u[0],T=u[1];T||o(new Error("".concat(t," : Failed at [").concat(l,"]")))}}catch(t){c.e(t)}finally{c.f()}},CONDITIONALASSERT:function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];var i,s=n(a.entries());try{for(s.s();!(i=s.n()).done;){var c=e(i.value,2),u=c[0],l=e(c[1],2),T=l[0],E=l[1];T&&(E||o(new Error("Conditional Assert : Failed at [".concat(u,"]"))))}}catch(t){s.e(t)}finally{s.f()}},PARAMCHECK:function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];var i,s=n(a.entries());try{for(s.s();!(i=s.n()).done;){var c=e(i.value,2),u=c[0],l=c[1];void 0===l&&o(new Error("Param Check : Failed at [".concat(u,"]")))}}catch(t){s.e(t)}finally{s.f()}},CONDITIONALPARAMCHECK:function(){for(var t=arguments.length,a=new Array(t),r=0;r<t;r++)a[r]=arguments[r];var i,s=n(a.entries());try{for(s.s();!(i=s.n()).done;){var c=e(i.value,2),u=c[0],l=e(c[1],2),T=l[0],E=l[1];T&&void 0===E&&o(new Error("Conditional Param Check : Failed at [".concat(u,"]")))}}catch(t){s.e(t)}finally{s.f()}},INVALIDPLAYLIST:function(t){o(new Error("Invalid Playlist : ".concat(t)))},toNumber:s,hexToByteSequence:function(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var e=[],n=0;n<t.length;n+=2)e.push(s(t.slice(n,n+2),16));return Buffer.from(e)},byteSequenceToHex:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length;n<=e&&o(new Error("end must be larger than start : start=".concat(e,", end=").concat(n)));for(var a=[],r=e;r<n;r++)a.push("0".concat((255&t[r]).toString(16).toUpperCase()).slice(-2));return"0x".concat(a.join(""))},tryCatch:function(t,e){try{return t()}catch(t){return e(t)}},splitAt:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=-1,r=0,i=0;r<t.length;r++)if(t[r]===e){if(i++===n)return[t.slice(0,r),t.slice(r+1)];a=r}return-1!==a?[t.slice(0,a),t.slice(a+1)]:[t]},trim:function(t){var e=arguments.length>1&&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):t},splitByCommaWithPreservingQuotes:function(t){for(var e=[],n=!0,a=0,r=[],i=0;i<t.length;i++){var o=t[i];n&&","===o?(e.push(t.slice(a,i).trim()),a=i+1):'"'!==o&&"'"!==o||(n?(r.push(o),n=!1):o===r[r.length-1]?(r.pop(),n=!0):r.push(o))}return e.push(t.slice(a).trim()),e},camelify:function(t){var e,a=[],r=!1,i=n(t);try{for(i.s();!(e=i.n()).done;){var o=e.value;"-"!==o&&"_"!==o?r?(a.push(o.toUpperCase()),r=!1):a.push(o.toLowerCase()):r=!0}}catch(t){i.e(t)}finally{i.f()}return a.join("")},formatDate:function(t){var e=t.getUTCFullYear(),n=("0"+(t.getUTCMonth()+1)).slice(-2),a=("0"+t.getUTCDate()).slice(-2),r=("0"+t.getUTCHours()).slice(-2),i=("0"+t.getUTCMinutes()).slice(-2),o=("0"+t.getUTCSeconds()).slice(-2),s=("00"+t.getUTCMilliseconds()).slice(-3);return"".concat(e,"-").concat(n,"-").concat(a,"T").concat(r,":").concat(i,":").concat(o,".").concat(s,"Z")},hasOwnProp:function(t,e){return Object.hasOwnProperty.call(t,e)},setOptions:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i=Object.assign(i,t)},getOptions:function(){return Object.assign({},i)}}}},e={},function n(a){var r=e[a];if(void 0!==r)return r.exports;var i=e[a]={exports:{}};return t[a](i,i.exports,n),i.exports}(851);var t,e}));
//# sourceMappingURL=hls-parser.min.js.map
{
"name": "hls-parser",
"version": "0.10.2",
"version": "0.10.3",
"description": "A simple library to read/write HLS playlists",

@@ -32,4 +32,4 @@ "main": "index.js",

"devDependencies": {
"@babel/core": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/core": "^7.13.13",
"@babel/preset-env": "^7.13.12",
"ava": "^3.15.0",

@@ -41,3 +41,3 @@ "babel-loader": "^8.2.2",

"terser-webpack-plugin": "^5.1.1",
"webpack": "^5.27.0",
"webpack": "^5.28.0",
"webpack-cli": "^4.5.0",

@@ -44,0 +44,0 @@ "xo": "0.38.2"

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

type: 'OUT',
duration: value
duration: attributes?.DURATION || value
}));

@@ -550,0 +550,0 @@ } else if (name === 'EXT-X-CUE-IN') {

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc