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

hls-parser

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

@@ -34,8 +34,8 @@ "main": "index.js",

"devDependencies": {
"@ava/typescript": "^4.1.0",
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.24.1",
"@babel/preset-env": "^7.24.4",
"@ava/typescript": "^5.0.0",
"@babel/core": "^7.24.7",
"@babel/eslint-parser": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@tsconfig/node18": "^18.2.4",
"ava": "^6.1.2",
"ava": "^6.1.3",
"babel-loader": "^9.1.3",

@@ -47,3 +47,3 @@ "eslint-plugin-unicorn": "^52.0.0",

"typescript": "^5.4.5",
"webpack": "^5.91.0",
"webpack": "^5.92.1",
"webpack-cli": "^5.1.4",

@@ -50,0 +50,0 @@ "xo": "^0.58.0"

@@ -393,3 +393,4 @@ "use strict";

let variantIsScored = false;
for (const [index, { name, value, attributes }] of lines.entries()) {
for (const [index, line] of lines.entries()) {
const { name, value, attributes } = mapTo(line);
if (name === 'EXT-X-VERSION') {

@@ -486,3 +487,3 @@ playlist.version = value;

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

@@ -670,3 +671,3 @@ if (!Number.isInteger(value.duration) && params.compatibleVersion < 3) {

for (const [index, line] of lines.entries()) {
const { name, value, attributes, category } = line;
const { name, value, attributes, category } = mapTo(line);
if (category === 'Segment') {

@@ -1052,2 +1053,5 @@ if (segmentStart === -1) {

}
function mapTo(value) {
return typeof value === 'string' ? {} : value;
}
exports.default = parse;

@@ -213,2 +213,3 @@ [![HLS parser tests](https://github.com/kuu/hls-parser/actions/workflows/tests.yml/badge.svg)](https://github.com/kuu/hls-parser/actions/workflows/tests.yml)

| `parts` | [`PartialSegment`] | No | [] | Partial Segments that constitute this segment |
| `gap` | boolean | No | undefined | See [EXT-X-GAP](https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.4.7) |

@@ -215,0 +216,0 @@ ### `PartialSegment` (extends `Data`)

@@ -331,2 +331,5 @@ "use strict";

}
if (segment.gap) {
lines.push(`#EXT-X-GAP`);
}
if (segment.key) {

@@ -333,0 +336,0 @@ const line = buildKey(segment.key);

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