You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
))this.trigger("data",this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)}}const W=String.fromCharCode(9),U=function(g){const a=/([0-9.]*)?@?([0-9.]*)?/.exec(g||""),e={};return a[1]&&(e.length=parseInt(a[1],10)),a[2]&&(e.offset=parseInt(a[2],10)),e},k=function(){const g="[^=]*",a='"[^"]*"|[^,]*',e="(?:"+g+")=(?:"+a+")";return new RegExp("(?:^|,)("+e+")")},l=function(g){const a={};if(!g)return a;const e=g.split(k());let t=e.length,n;for(;t--;)e[t]!==""&&(n=/([^=]*)=(.*)/.exec(e[t]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),a[n[0]]=n[1]);return a};class z extends G{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(a){let e,t;if(a=a.trim(),a.length===0)return;if(a[0]!=="#"){this.trigger("data",{type:"uri",uri:a});return}this.tagMappers.reduce((s,r)=>{const o=r(a);return o===a?s:s.concat([o])},[a]).forEach(s=>{for(let r=0;r<this.customParsers.length;r++)if(this.customParsers[r].call(this,s))return;if(s.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:s.slice(1)});return}if(s=s.replace("\r",""),e=/^#EXTM3U/.exec(s),e){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(e=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(s),e){t={type:"tag",tagType:"inf"},e[1]&&(t.duration=parseFloat(e[1])),e[2]&&(t.title=e[2]),this.trigger("data",t);return}if(e=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(s),e){t={type:"tag",tagType:"targetduration"},e[1]&&(t.duration=parseInt(e[1],10)),this.trigger("data",t);return}if(e=/^#EXT-X-VERSION:([0-9.]*)?/.exec(s),e){t={type:"tag",tagType:"version"},e[1]&&(t.version=parseInt(e[1],10)),this.trigger("data",t);return}if(e=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(s),e){t={type:"tag",tagType:"media-sequence"},e[1]&&(t.number=parseInt(e[1],10)),this.trigger("data",t);return}if(e=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(s),e){t={type:"tag",tagType:"discontinuity-sequence"},e[1]&&(t.number=parseInt(e[1],10)),this.trigger("data",t);return}if(e=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(s),e){t={type:"tag",tagType:"playlist-type"},e[1]&&(t.playlistType=e[1]),this.trigger("data",t);return}if(e=/^#EXT-X-BYTERANGE:(.*)?$/.exec(s),e){t=I(U(e[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",t);return}if(e=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(s),e){t={type:"tag",tagType:"allow-cache"},e[1]&&(t.allowed=!/NO/.test(e[1])),this.trigger("data",t);return}if(e=/^#EXT-X-MAP:(.*)$/.exec(s),e){if(t={type:"tag",tagType:"map"},e[1]){const r=l(e[1]);r.URI&&(t.uri=r.URI),r.BYTERANGE&&(t.byterange=U(r.BYTERANGE))}this.trigger("data",t);return}if(e=/^#EXT-X-STREAM-INF:(.*)$/.exec(s),e){if(t={type:"tag",tagType:"stream-inf"},e[1]){if(t.attributes=l(e[1]),t.attributes.RESOLUTION){const r=t.attributes.RESOLUTION.split("x"),o={};r[0]&&(o.width=parseInt(r[0],10)),r[1]&&(o.height=parseInt(r[1],10)),t.attributes.RESOLUTION=o}t.attributes.BANDWIDTH&&(t.attributes.BANDWIDTH=parseInt(t.attributes.BANDWIDTH,10)),t.attributes["FRAME-RATE"]&&(t.attributes["FRAME-RATE"]=parseFloat(t.attributes["FRAME-RATE"])),t.attributes["PROGRAM-ID"]&&(t.attributes["PROGRAM-ID"]=parseInt(t.attributes["PROGRAM-ID"],10))}this.trigger("data",t);return}if(e=/^#EXT-X-MEDIA:(.*)$/.exec(s),e){t={type:"tag",tagType:"media"},e[1]&&(t.attributes=l(e[1])),this.trigger("data",t);return}if(e=/^#EXT-X-ENDLIST/.exec(s),e){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(e=/^#EXT-X-DISCONTINUITY/.exec(s),e){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(e=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(s),e){t={type:"tag",tagType:"program-date-time"},e[1]&&(t.dateTimeString=e[1],t.dateTimeObject=new Date(e[1])),this.trigger("data",t);return}if(e=/^#EXT-X-KEY:(.*)$/.exec(s),e){t={type:"tag",tagType:"key"},e[1]&&(t.attributes=l(e[1]),t.attributes.IV&&(t.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(t.attributes.IV=t.attributes.IV.substring(2)),t.attributes.IV=t.attributes.IV.match(/.{8}/g),t.attributes.IV[0]=parseInt(t.attributes.IV[0],16),t.attributes.IV[1]=parseInt(t.attributes.IV[1],16),t.attributes.IV[2]=parseInt(t.attributes.IV[2],16),t.attributes.IV[3]=parseInt(t.attributes.IV[3],16),t.attributes.IV=new Uint32Array(t.attributes.IV))),this.trigger("data",t);return}if(e=/^#EXT-X-START:(.*)$/.exec(s),e){t={type:"tag",tagType:"start"},e[1]&&(t.attributes=l(e[1]),t.attributes["TIME-OFFSET"]=parseFloat(t.attributes["TIME-OFFSET"]),t.attributes.PRECISE=/YES/.test(t.attributes.PRECISE)),this.trigger("data",t);return}if(e=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(s),e){t={type:"tag",tagType:"cue-out-cont"},e[1]?t.data=e[1]:t.data="",this.trigger("data",t);return}if(e=/^#EXT-X-CUE-OUT:(.*)?$/.exec(s),e){t={type:"tag",tagType:"cue-out"},e[1]?t.data=e[1]:t.data="",this.trigger("data",t);return}if(e=/^#EXT-X-CUE-IN:(.*)?$/.exec(s),e){t={type:"tag",tagType:"cue-in"},e[1]?t.data=e[1]:t.data="",this.trigger("data",t);return}if(e=/^#EXT-X-SKIP:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"skip"},t.attributes=l(e[1]),t.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(t.attributes["SKIPPED-SEGMENTS"]=parseInt(t.attributes["SKIPPED-SEGMENTS"],10)),t.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(t.attributes["RECENTLY-REMOVED-DATERANGES"]=t.attributes["RECENTLY-REMOVED-DATERANGES"].split(W)),this.trigger("data",t);return}if(e=/^#EXT-X-PART:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"part"},t.attributes=l(e[1]),["DURATION"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=parseFloat(t.attributes[r]))}),["INDEPENDENT","GAP"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=/YES/.test(t.attributes[r]))}),t.attributes.hasOwnProperty("BYTERANGE")&&(t.attributes.byterange=U(t.attributes.BYTERANGE)),this.trigger("data",t);return}if(e=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"server-control"},t.attributes=l(e[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=parseFloat(t.attributes[r]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=/YES/.test(t.attributes[r]))}),this.trigger("data",t);return}if(e=/^#EXT-X-PART-INF:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"part-inf"},t.attributes=l(e[1]),["PART-TARGET"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=parseFloat(t.attributes[r]))}),this.trigger("data",t);return}if(e=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"preload-hint"},t.attributes=l(e[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(r){if(t.attributes.hasOwnProperty(r)){t.attributes[r]=parseInt(t.attributes[r],10);const o=r==="BYTERANGE-LENGTH"?"length":"offset";t.attributes.byterange=t.attributes.byterange||{},t.attributes.byterange[o]=t.attributes[r],delete t.attributes[r]}}),this.trigger("data",t);return}if(e=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"rendition-report"},t.attributes=l(e[1]),["LAST-MSN","LAST-PART"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=parseInt(t.attributes[r],10))}),this.trigger("data",t);return}if(e=/^#EXT-X-DATERANGE:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"daterange"},t.attributes=l(e[1]),["ID","CLASS"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=String(t.attributes[o]))}),["START-DATE","END-DATE"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=new Date(t.attributes[o]))}),["DURATION","PLANNED-DURATION"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=parseFloat(t.attributes[o]))}),["END-ON-NEXT"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=/YES/i.test(t.attributes[o]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=t.attributes[o].toString(16))});const r=/^X-([A-Z]+-)+[A-Z]+$/;for(const o in t.attributes){if(!r.test(o))continue;const c=/[0-9A-Fa-f]{6}/g.test(t.attributes[o]),d=/^\d+(\.\d+)?$/.test(t.attributes[o]);t.attributes[o]=c?t.attributes[o].toString(16):d?parseFloat(t.attributes[o]):String(t.attributes[o])}this.trigger("data",t);return}if(e=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(s),e){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(e=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(s),e){t={type:"tag",tagType:"content-steering"},t.attributes=l(e[1]),this.trigger("data",t);return}this.trigger("data",{type:"tag",data:s.slice(4)})})}addParser({expression:a,customType:e,dataParser:t,segment:n}){typeof t!="function"&&(t=s=>s),this.customParsers.push(s=>{if(a.exec(s))return this.trigger("data",{type:"custom",data:t(s),customType:e,segment:n}),!0})}addTagMapper({expression:a,map:e}){const t=n=>a.test(n)?e(n):n;this.tagMappers.push(t)}}const J=g=>g.toLowerCase().replace(/-(\w)/g,a=>a[1].toUpperCase()),R=function(g){const a={};return Object.keys(g).forEach(function(e){a[J(e)]=g[e]}),a},C=function(g){const{serverControl:a,targetDuration:e,partTargetDuration:t}=g;if(!a)return;const n="#EXT-X-SERVER-CONTROL",s="holdBack",r="partHoldBack",o=e&&e*3,c=t&&t*2;e&&!a.hasOwnProperty(s)&&(a[s]=o,this.trigger("info",{message:${n} defaulting HOLD-BACK to targetDuration * 3 (${o}).})),o&&a[s]<o&&(this.trigger("warn",{message:${n} clamping HOLD-BACK (${a[s]}) to targetDuration * 3 (${o})}),a[s]=o),t&&!a.hasOwnProperty(r)&&(a[r]=t*3,this.trigger("info",{message:${n} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${a[r]}).})),t&&a[r]<c&&(this.trigger("warn",{message:${n} clamping PART-HOLD-BACK (${a[r]}) to partTargetDuration * 2 (${c}).}),a[r]=c)};class Q extends G{constructor(){super(),this.lineStream=new _,this.parseStream=new z,this.lineStream.pipe(this.parseStream),this.lastProgramDateTime=null;const a=this,e=[];let t={},n,s,r=!1;const o=function(){},c={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},d="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let m=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],segments:[]};let O=0,b=0;const E={};this.on("end",()=>{t.uri||!t.parts&&!t.preloadHints||(!t.map&&n&&(t.map=n),!t.key&&s&&(t.key=s),!t.timeline&&typeof m=="number"&&(t.timeline=m),this.manifest.preloadSegment=t)}),this.parseStream.on("data",function(i){let D,T;({tag(){({version(){i.version&&(this.manifest.version=i.version)},"allow-cache"(){this.manifest.allowCache=i.allowed,"allowed"in i||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const f={};"length"in i&&(t.byterange=f,f.length=i.length,"offset"in i||(i.offset=O)),"offset"in i&&(t.byterange=f,f.offset=i.offset),O=f.offset+f.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),i.title&&(t.title=i.title),i.duration>0&&(t.duration=i.duration),i.duration===0&&(t.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=e},key(){if(!i.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(i.attributes.METHOD==="NONE"){s=null;return}if(!i.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(i.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:i.attributes};return}if(i.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:i.attributes.URI};return}if(i.attributes.KEYFORMAT===d){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(i.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(i.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),i.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(i.attributes.KEYID&&i.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:i.attributes.KEYFORMAT,keyId:i.attributes.KEYID.substring(2)},pssh:q(i.attributes.URI.split(",")[1])};return}i.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),s={method:i.attributes.METHOD||"AES-128",uri:i.attributes.URI},typeof i.attributes.IV<"u"&&(s.iv=i.attributes.IV)},"media-sequence"(){if(!isFinite(i.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+i.number});return}this.manifest.mediaSequence=i.number},"discontinuity-sequence"(){if(!isFinite(i.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+i.number});return}this.manifest.discontinuitySequence=i.number,m=i.number},"playlist-type"(){if(!/VOD|EVENT/.test(i.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+i.playlist});return}this.manifest.playlistType=i.playlistType},map(){n={},i.uri&&(n.uri=i.uri),i.byterange&&(n.byterange=i.byterange),s&&(n.key=s)},"stream-inf"(){if(this.manifest.playlists=e,this.manifest.mediaGroups=this.manifest.mediaGroups||c,!i.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}t.attributes||(t.attributes={}),I(t.attributes,i.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||c,!(i.attributes&&i.attributes.TYPE&&i.attributes["GROUP-ID"]&&i.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const f=this.manifest.mediaGroups[i.attributes.TYPE];f[i.attributes["GROUP-ID"]]=f[i.attributes["GROUP-ID"]]||{},D=f[i.attributes["GROUP-ID"]],T={default:/yes/i.test(i.attributes.DEFAULT)},T.default?T.autoselect=!0:T.autoselect=/yes/i.test(i.attributes.AUTOSELECT),i.attributes.LANGUAGE&&(T.language=i.attributes.LANGUAGE),i.attributes.URI&&(T.uri=i.attributes.URI),i.attributes["INSTREAM-ID"]&&(T.instreamId=i.attributes["INSTREAM-ID"]),i.attributes.CHARACTERISTICS&&(T.characteristics=i.attributes.CHARACTERISTICS),i.attributes.FORCED&&(T.forced=/yes/i.test(i.attributes.FORCED)),D[i.attributes.NAME]=T},discontinuity(){m+=1,t.discontinuity=!0,this.manifest.discontinuityStarts.push(e.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=i.dateTimeString,this.manifest.dateTimeObject=i.dateTimeObject),t.dateTimeString=i.dateTimeString,t.dateTimeObject=i.dateTimeObject;const{lastProgramDateTime:f}=this;this.lastProgramDateTime=new Date(i.dateTimeString).getTime(),f===null&&this.manifest.segments.reduceRight((u,h)=>(h.programDateTime=u-h.duration*1e3,h.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(i.duration)||i.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+i.duration});return}this.manifest.targetDuration=i.duration,C.call(this,this.manifest)},start(){if(!i.attributes||isNaN(i.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:i.attributes["TIME-OFFSET"],precise:i.attributes.PRECISE}},"cue-out"(){t.cueOut=i.data},"cue-out-cont"(){t.cueOutCont=i.data},"cue-in"(){t.cueIn=i.data},skip(){this.manifest.skip=R(i.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",i.attributes,["SKIPPED-SEGMENTS"])},part(){r=!0;const f=this.manifest.segments.length,u=R(i.attributes);t.parts=t.parts||[],t.parts.push(u),u.byterange&&(u.byterange.hasOwnProperty("offset")||(u.byterange.offset=b),b=u.byterange.offset+u.byterange.length);const h=t.parts.length-1;this.warnOnMissingAttributes_(#EXT-X-PART #${h} for segment #${f},i.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((A,p)=>{A.hasOwnProperty("lastPart")||this.trigger("warn",{message:#EXT-X-RENDITION-REPORT #${p} lacks required attribute(s): LAST-PART})})},"server-control"(){const f=this.manifest.serverControl=R(i.attributes);f.hasOwnProperty("canBlockReload")||(f.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),C.call(this,this.manifest),f.canSkipDateranges&&!f.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const f=this.manifest.segments.length,u=R(i.attributes),h=u.type&&u.type==="PART";t.preloadHints=t.preloadHints||[],t.preloadHints.push(u),u.byterange&&(u.byterange.hasOwnProperty("offset")||(u.byterange.offset=h?b:0,h&&(b=u.byterange.offset+u.byterange.length)));const A=t.preloadHints.length-1;if(this.warnOnMissingAttributes_(#EXT-X-PRELOAD-HINT #${A} for segment #${f},i.attributes,["TYPE","URI"]),!!u.type)for(let p=0;p<t.preloadHints.length-1;p++){const L=t.preloadHints[p];L.type&&L.type===u.type&&this.trigger("warn",{message:#EXT-X-PRELOAD-HINT #${A} for segment #${f} has the same TYPE ${u.type} as preload hint #${p}})}},"rendition-report"(){const f=R(i.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(f);const u=this.manifest.renditionReports.length-1,h=["LAST-MSN","URI"];r&&h.push("LAST-PART"),this.warnOnMissingAttributes_(#EXT-X-RENDITION-REPORT #${u},i.attributes,h)},"part-inf"(){this.manifest.partInf=R(i.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",i.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),C.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(R(i.attributes));const f=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(#EXT-X-DATERANGE #${f},i.attributes,["ID","START-DATE"]);const u=this.manifest.dateRanges[f];u.endDate&&u.startDate&&new Date(u.endDate)<new Date(u.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),u.duration&&u.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),u.plannedDuration&&u.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const h=!!u.endOnNext;if(h&&!u.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),h&&(u.duration||u.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),u.duration&&u.endDate){const p=u.startDate.getTime()+u.duration*1e3;this.manifest.dateRanges[f].endDate=new Date(p)}if(!E[u.id])E[u.id]=u;else{for(const p in E[u.id])if(u[p]&&JSON.stringify(E[u.id][p])!==JSON.stringify(u[p])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const A=this.manifest.dateRanges.findIndex(p=>p.id===u.id);this.manifest.dateRanges[A]=I(this.manifest.dateRanges[A],u),E[u.id]=I(E[u.id],u),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"content-steering"(){this.manifest.contentSteering=R(i.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",i.attributes,["SERVER-URI"])}}[i.tagType]||o).call(a)},uri(){t.uri=i.uri,e.push(t),this.manifest.targetDuration&&!("duration"in t)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),t.duration=this.manifest.targetDuration),s&&(t.key=s),t.timeline=m,n&&(t.map=n),b=0,this.lastProgramDateTime!==null&&(t.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=t.duration*1e3),t={}},comment(){},custom(){i.segment?(t.custom=t.custom||{},t.custom[i.customType]=i.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[i.customType]=i.data)}})[i.type].call(a)})}warnOnMissingAttributes_(a,e,t){const n=[];t.forEach(function(s){e.hasOwnProperty(s)||n.push(s)}),n.length&&this.trigger("warn",{message:${a} lacks required attribute(s): ${n.join(", ")}})}push(a){this.lineStream.push(a)}end(){this.lineStream.push(
`
The text was updated successfully, but these errors were encountered:
hi
Stack Trace
assets/js/handleMessage.w3iQtjVY.js:4 (anonymous function)
=====================
import{g as V,c as $}from"./_commonjsHelpers.5-cIlDoe.js";var G=function(){function g(){this.listeners={}}var a=g.prototype;return a.on=function(t,n){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n)},a.off=function(t,n){if(!this.listeners[t])return!1;var s=this.listeners[t].indexOf(n);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(s,1),s>-1},a.trigger=function(t){var n=this.listeners[t];if(n)if(arguments.length===2)for(var s=n.length,r=0;r<s;++r)n[r].call(this,arguments[1]);else for(var o=Array.prototype.slice.call(arguments,1),c=n.length,d=0;d<c;++d)n[d].apply(this,o)},a.dispose=function(){this.listeners={}},a.pipe=function(t){this.on("data",function(n){t.push(n)})},g}();function I(){return I=Object.assign?Object.assign.bind():function(g){for(var a=1;a<arguments.length;a++){var e=arguments[a];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(g[t]=e[t])}return g},I.apply(this,arguments)}var S;typeof window<"u"?S=window:typeof $<"u"?S=$:typeof self<"u"?S=self:S={};var j=S;const H=V(j);var K=function(a){return H.atob?H.atob(a):Buffer.from(a,"base64").toString("binary")};function q(g){for(var a=K(g),e=new Uint8Array(a.length),t=0;t<a.length;t++)e[t]=a.charCodeAt(t);return e}/*! @name m3u8-parser @version 7.1.0 @license Apache-2.0 */class _ extends G{constructor(){super(),this.buffer=""}push(a){let e;for(this.buffer+=a,e=this.buffer.indexOf(
);e>-1;e=this.buffer.indexOf(
))this.trigger("data",this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)}}const W=String.fromCharCode(9),U=function(g){const a=/([0-9.]*)?@?([0-9.]*)?/.exec(g||""),e={};return a[1]&&(e.length=parseInt(a[1],10)),a[2]&&(e.offset=parseInt(a[2],10)),e},k=function(){const g="[^=]*",a='"[^"]*"|[^,]*',e="(?:"+g+")=(?:"+a+")";return new RegExp("(?:^|,)("+e+")")},l=function(g){const a={};if(!g)return a;const e=g.split(k());let t=e.length,n;for(;t--;)e[t]!==""&&(n=/([^=]*)=(.*)/.exec(e[t]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),a[n[0]]=n[1]);return a};class z extends G{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(a){let e,t;if(a=a.trim(),a.length===0)return;if(a[0]!=="#"){this.trigger("data",{type:"uri",uri:a});return}this.tagMappers.reduce((s,r)=>{const o=r(a);return o===a?s:s.concat([o])},[a]).forEach(s=>{for(let r=0;r<this.customParsers.length;r++)if(this.customParsers[r].call(this,s))return;if(s.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:s.slice(1)});return}if(s=s.replace("\r",""),e=/^#EXTM3U/.exec(s),e){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(e=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(s),e){t={type:"tag",tagType:"inf"},e[1]&&(t.duration=parseFloat(e[1])),e[2]&&(t.title=e[2]),this.trigger("data",t);return}if(e=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(s),e){t={type:"tag",tagType:"targetduration"},e[1]&&(t.duration=parseInt(e[1],10)),this.trigger("data",t);return}if(e=/^#EXT-X-VERSION:([0-9.]*)?/.exec(s),e){t={type:"tag",tagType:"version"},e[1]&&(t.version=parseInt(e[1],10)),this.trigger("data",t);return}if(e=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(s),e){t={type:"tag",tagType:"media-sequence"},e[1]&&(t.number=parseInt(e[1],10)),this.trigger("data",t);return}if(e=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(s),e){t={type:"tag",tagType:"discontinuity-sequence"},e[1]&&(t.number=parseInt(e[1],10)),this.trigger("data",t);return}if(e=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(s),e){t={type:"tag",tagType:"playlist-type"},e[1]&&(t.playlistType=e[1]),this.trigger("data",t);return}if(e=/^#EXT-X-BYTERANGE:(.*)?$/.exec(s),e){t=I(U(e[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",t);return}if(e=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(s),e){t={type:"tag",tagType:"allow-cache"},e[1]&&(t.allowed=!/NO/.test(e[1])),this.trigger("data",t);return}if(e=/^#EXT-X-MAP:(.*)$/.exec(s),e){if(t={type:"tag",tagType:"map"},e[1]){const r=l(e[1]);r.URI&&(t.uri=r.URI),r.BYTERANGE&&(t.byterange=U(r.BYTERANGE))}this.trigger("data",t);return}if(e=/^#EXT-X-STREAM-INF:(.*)$/.exec(s),e){if(t={type:"tag",tagType:"stream-inf"},e[1]){if(t.attributes=l(e[1]),t.attributes.RESOLUTION){const r=t.attributes.RESOLUTION.split("x"),o={};r[0]&&(o.width=parseInt(r[0],10)),r[1]&&(o.height=parseInt(r[1],10)),t.attributes.RESOLUTION=o}t.attributes.BANDWIDTH&&(t.attributes.BANDWIDTH=parseInt(t.attributes.BANDWIDTH,10)),t.attributes["FRAME-RATE"]&&(t.attributes["FRAME-RATE"]=parseFloat(t.attributes["FRAME-RATE"])),t.attributes["PROGRAM-ID"]&&(t.attributes["PROGRAM-ID"]=parseInt(t.attributes["PROGRAM-ID"],10))}this.trigger("data",t);return}if(e=/^#EXT-X-MEDIA:(.*)$/.exec(s),e){t={type:"tag",tagType:"media"},e[1]&&(t.attributes=l(e[1])),this.trigger("data",t);return}if(e=/^#EXT-X-ENDLIST/.exec(s),e){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(e=/^#EXT-X-DISCONTINUITY/.exec(s),e){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(e=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(s),e){t={type:"tag",tagType:"program-date-time"},e[1]&&(t.dateTimeString=e[1],t.dateTimeObject=new Date(e[1])),this.trigger("data",t);return}if(e=/^#EXT-X-KEY:(.*)$/.exec(s),e){t={type:"tag",tagType:"key"},e[1]&&(t.attributes=l(e[1]),t.attributes.IV&&(t.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(t.attributes.IV=t.attributes.IV.substring(2)),t.attributes.IV=t.attributes.IV.match(/.{8}/g),t.attributes.IV[0]=parseInt(t.attributes.IV[0],16),t.attributes.IV[1]=parseInt(t.attributes.IV[1],16),t.attributes.IV[2]=parseInt(t.attributes.IV[2],16),t.attributes.IV[3]=parseInt(t.attributes.IV[3],16),t.attributes.IV=new Uint32Array(t.attributes.IV))),this.trigger("data",t);return}if(e=/^#EXT-X-START:(.*)$/.exec(s),e){t={type:"tag",tagType:"start"},e[1]&&(t.attributes=l(e[1]),t.attributes["TIME-OFFSET"]=parseFloat(t.attributes["TIME-OFFSET"]),t.attributes.PRECISE=/YES/.test(t.attributes.PRECISE)),this.trigger("data",t);return}if(e=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(s),e){t={type:"tag",tagType:"cue-out-cont"},e[1]?t.data=e[1]:t.data="",this.trigger("data",t);return}if(e=/^#EXT-X-CUE-OUT:(.*)?$/.exec(s),e){t={type:"tag",tagType:"cue-out"},e[1]?t.data=e[1]:t.data="",this.trigger("data",t);return}if(e=/^#EXT-X-CUE-IN:(.*)?$/.exec(s),e){t={type:"tag",tagType:"cue-in"},e[1]?t.data=e[1]:t.data="",this.trigger("data",t);return}if(e=/^#EXT-X-SKIP:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"skip"},t.attributes=l(e[1]),t.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(t.attributes["SKIPPED-SEGMENTS"]=parseInt(t.attributes["SKIPPED-SEGMENTS"],10)),t.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(t.attributes["RECENTLY-REMOVED-DATERANGES"]=t.attributes["RECENTLY-REMOVED-DATERANGES"].split(W)),this.trigger("data",t);return}if(e=/^#EXT-X-PART:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"part"},t.attributes=l(e[1]),["DURATION"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=parseFloat(t.attributes[r]))}),["INDEPENDENT","GAP"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=/YES/.test(t.attributes[r]))}),t.attributes.hasOwnProperty("BYTERANGE")&&(t.attributes.byterange=U(t.attributes.BYTERANGE)),this.trigger("data",t);return}if(e=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"server-control"},t.attributes=l(e[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=parseFloat(t.attributes[r]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=/YES/.test(t.attributes[r]))}),this.trigger("data",t);return}if(e=/^#EXT-X-PART-INF:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"part-inf"},t.attributes=l(e[1]),["PART-TARGET"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=parseFloat(t.attributes[r]))}),this.trigger("data",t);return}if(e=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"preload-hint"},t.attributes=l(e[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(r){if(t.attributes.hasOwnProperty(r)){t.attributes[r]=parseInt(t.attributes[r],10);const o=r==="BYTERANGE-LENGTH"?"length":"offset";t.attributes.byterange=t.attributes.byterange||{},t.attributes.byterange[o]=t.attributes[r],delete t.attributes[r]}}),this.trigger("data",t);return}if(e=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"rendition-report"},t.attributes=l(e[1]),["LAST-MSN","LAST-PART"].forEach(function(r){t.attributes.hasOwnProperty(r)&&(t.attributes[r]=parseInt(t.attributes[r],10))}),this.trigger("data",t);return}if(e=/^#EXT-X-DATERANGE:(.*)$/.exec(s),e&&e[1]){t={type:"tag",tagType:"daterange"},t.attributes=l(e[1]),["ID","CLASS"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=String(t.attributes[o]))}),["START-DATE","END-DATE"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=new Date(t.attributes[o]))}),["DURATION","PLANNED-DURATION"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=parseFloat(t.attributes[o]))}),["END-ON-NEXT"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=/YES/i.test(t.attributes[o]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(o){t.attributes.hasOwnProperty(o)&&(t.attributes[o]=t.attributes[o].toString(16))});const r=/^X-([A-Z]+-)+[A-Z]+$/;for(const o in t.attributes){if(!r.test(o))continue;const c=/[0-9A-Fa-f]{6}/g.test(t.attributes[o]),d=/^\d+(\.\d+)?$/.test(t.attributes[o]);t.attributes[o]=c?t.attributes[o].toString(16):d?parseFloat(t.attributes[o]):String(t.attributes[o])}this.trigger("data",t);return}if(e=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(s),e){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(e=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(s),e){t={type:"tag",tagType:"content-steering"},t.attributes=l(e[1]),this.trigger("data",t);return}this.trigger("data",{type:"tag",data:s.slice(4)})})}addParser({expression:a,customType:e,dataParser:t,segment:n}){typeof t!="function"&&(t=s=>s),this.customParsers.push(s=>{if(a.exec(s))return this.trigger("data",{type:"custom",data:t(s),customType:e,segment:n}),!0})}addTagMapper({expression:a,map:e}){const t=n=>a.test(n)?e(n):n;this.tagMappers.push(t)}}const J=g=>g.toLowerCase().replace(/-(\w)/g,a=>a[1].toUpperCase()),R=function(g){const a={};return Object.keys(g).forEach(function(e){a[J(e)]=g[e]}),a},C=function(g){const{serverControl:a,targetDuration:e,partTargetDuration:t}=g;if(!a)return;const n="#EXT-X-SERVER-CONTROL",s="holdBack",r="partHoldBack",o=e&&e*3,c=t&&t*2;e&&!a.hasOwnProperty(s)&&(a[s]=o,this.trigger("info",{message:
${n} defaulting HOLD-BACK to targetDuration * 3 (${o}).})),o&&a[s]<o&&(this.trigger("warn",{message:
${n} clamping HOLD-BACK (${a[s]}) to targetDuration * 3 (${o})}),a[s]=o),t&&!a.hasOwnProperty(r)&&(a[r]=t*3,this.trigger("info",{message:
${n} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${a[r]}).})),t&&a[r]<c&&(this.trigger("warn",{message:
${n} clamping PART-HOLD-BACK (${a[r]}) to partTargetDuration * 2 (${c}).}),a[r]=c)};class Q extends G{constructor(){super(),this.lineStream=new _,this.parseStream=new z,this.lineStream.pipe(this.parseStream),this.lastProgramDateTime=null;const a=this,e=[];let t={},n,s,r=!1;const o=function(){},c={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},d="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let m=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],segments:[]};let O=0,b=0;const E={};this.on("end",()=>{t.uri||!t.parts&&!t.preloadHints||(!t.map&&n&&(t.map=n),!t.key&&s&&(t.key=s),!t.timeline&&typeof m=="number"&&(t.timeline=m),this.manifest.preloadSegment=t)}),this.parseStream.on("data",function(i){let D,T;({tag(){({version(){i.version&&(this.manifest.version=i.version)},"allow-cache"(){this.manifest.allowCache=i.allowed,"allowed"in i||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const f={};"length"in i&&(t.byterange=f,f.length=i.length,"offset"in i||(i.offset=O)),"offset"in i&&(t.byterange=f,f.offset=i.offset),O=f.offset+f.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),i.title&&(t.title=i.title),i.duration>0&&(t.duration=i.duration),i.duration===0&&(t.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=e},key(){if(!i.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(i.attributes.METHOD==="NONE"){s=null;return}if(!i.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(i.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:i.attributes};return}if(i.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:i.attributes.URI};return}if(i.attributes.KEYFORMAT===d){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(i.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(i.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),i.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(i.attributes.KEYID&&i.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:i.attributes.KEYFORMAT,keyId:i.attributes.KEYID.substring(2)},pssh:q(i.attributes.URI.split(",")[1])};return}i.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),s={method:i.attributes.METHOD||"AES-128",uri:i.attributes.URI},typeof i.attributes.IV<"u"&&(s.iv=i.attributes.IV)},"media-sequence"(){if(!isFinite(i.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+i.number});return}this.manifest.mediaSequence=i.number},"discontinuity-sequence"(){if(!isFinite(i.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+i.number});return}this.manifest.discontinuitySequence=i.number,m=i.number},"playlist-type"(){if(!/VOD|EVENT/.test(i.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+i.playlist});return}this.manifest.playlistType=i.playlistType},map(){n={},i.uri&&(n.uri=i.uri),i.byterange&&(n.byterange=i.byterange),s&&(n.key=s)},"stream-inf"(){if(this.manifest.playlists=e,this.manifest.mediaGroups=this.manifest.mediaGroups||c,!i.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}t.attributes||(t.attributes={}),I(t.attributes,i.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||c,!(i.attributes&&i.attributes.TYPE&&i.attributes["GROUP-ID"]&&i.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const f=this.manifest.mediaGroups[i.attributes.TYPE];f[i.attributes["GROUP-ID"]]=f[i.attributes["GROUP-ID"]]||{},D=f[i.attributes["GROUP-ID"]],T={default:/yes/i.test(i.attributes.DEFAULT)},T.default?T.autoselect=!0:T.autoselect=/yes/i.test(i.attributes.AUTOSELECT),i.attributes.LANGUAGE&&(T.language=i.attributes.LANGUAGE),i.attributes.URI&&(T.uri=i.attributes.URI),i.attributes["INSTREAM-ID"]&&(T.instreamId=i.attributes["INSTREAM-ID"]),i.attributes.CHARACTERISTICS&&(T.characteristics=i.attributes.CHARACTERISTICS),i.attributes.FORCED&&(T.forced=/yes/i.test(i.attributes.FORCED)),D[i.attributes.NAME]=T},discontinuity(){m+=1,t.discontinuity=!0,this.manifest.discontinuityStarts.push(e.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=i.dateTimeString,this.manifest.dateTimeObject=i.dateTimeObject),t.dateTimeString=i.dateTimeString,t.dateTimeObject=i.dateTimeObject;const{lastProgramDateTime:f}=this;this.lastProgramDateTime=new Date(i.dateTimeString).getTime(),f===null&&this.manifest.segments.reduceRight((u,h)=>(h.programDateTime=u-h.duration*1e3,h.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(i.duration)||i.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+i.duration});return}this.manifest.targetDuration=i.duration,C.call(this,this.manifest)},start(){if(!i.attributes||isNaN(i.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:i.attributes["TIME-OFFSET"],precise:i.attributes.PRECISE}},"cue-out"(){t.cueOut=i.data},"cue-out-cont"(){t.cueOutCont=i.data},"cue-in"(){t.cueIn=i.data},skip(){this.manifest.skip=R(i.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",i.attributes,["SKIPPED-SEGMENTS"])},part(){r=!0;const f=this.manifest.segments.length,u=R(i.attributes);t.parts=t.parts||[],t.parts.push(u),u.byterange&&(u.byterange.hasOwnProperty("offset")||(u.byterange.offset=b),b=u.byterange.offset+u.byterange.length);const h=t.parts.length-1;this.warnOnMissingAttributes_(
#EXT-X-PART #${h} for segment #${f},i.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((A,p)=>{A.hasOwnProperty("lastPart")||this.trigger("warn",{message:
#EXT-X-RENDITION-REPORT #${p} lacks required attribute(s): LAST-PART})})},"server-control"(){const f=this.manifest.serverControl=R(i.attributes);f.hasOwnProperty("canBlockReload")||(f.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),C.call(this,this.manifest),f.canSkipDateranges&&!f.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const f=this.manifest.segments.length,u=R(i.attributes),h=u.type&&u.type==="PART";t.preloadHints=t.preloadHints||[],t.preloadHints.push(u),u.byterange&&(u.byterange.hasOwnProperty("offset")||(u.byterange.offset=h?b:0,h&&(b=u.byterange.offset+u.byterange.length)));const A=t.preloadHints.length-1;if(this.warnOnMissingAttributes_(
#EXT-X-PRELOAD-HINT #${A} for segment #${f},i.attributes,["TYPE","URI"]),!!u.type)for(let p=0;p<t.preloadHints.length-1;p++){const L=t.preloadHints[p];L.type&&L.type===u.type&&this.trigger("warn",{message:
#EXT-X-PRELOAD-HINT #${A} for segment #${f} has the same TYPE ${u.type} as preload hint #${p}})}},"rendition-report"(){const f=R(i.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(f);const u=this.manifest.renditionReports.length-1,h=["LAST-MSN","URI"];r&&h.push("LAST-PART"),this.warnOnMissingAttributes_(
#EXT-X-RENDITION-REPORT #${u},i.attributes,h)},"part-inf"(){this.manifest.partInf=R(i.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",i.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),C.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(R(i.attributes));const f=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(
#EXT-X-DATERANGE #${f},i.attributes,["ID","START-DATE"]);const u=this.manifest.dateRanges[f];u.endDate&&u.startDate&&new Date(u.endDate)<new Date(u.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),u.duration&&u.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),u.plannedDuration&&u.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const h=!!u.endOnNext;if(h&&!u.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),h&&(u.duration||u.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),u.duration&&u.endDate){const p=u.startDate.getTime()+u.duration*1e3;this.manifest.dateRanges[f].endDate=new Date(p)}if(!E[u.id])E[u.id]=u;else{for(const p in E[u.id])if(u[p]&&JSON.stringify(E[u.id][p])!==JSON.stringify(u[p])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const A=this.manifest.dateRanges.findIndex(p=>p.id===u.id);this.manifest.dateRanges[A]=I(this.manifest.dateRanges[A],u),E[u.id]=I(E[u.id],u),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"content-steering"(){this.manifest.contentSteering=R(i.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",i.attributes,["SERVER-URI"])}}[i.tagType]||o).call(a)},uri(){t.uri=i.uri,e.push(t),this.manifest.targetDuration&&!("duration"in t)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),t.duration=this.manifest.targetDuration),s&&(t.key=s),t.timeline=m,n&&(t.map=n),b=0,this.lastProgramDateTime!==null&&(t.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=t.duration*1e3),t={}},comment(){},custom(){i.segment?(t.custom=t.custom||{},t.custom[i.customType]=i.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[i.customType]=i.data)}})[i.type].call(a)})}warnOnMissingAttributes_(a,e,t){const n=[];t.forEach(function(s){e.hasOwnProperty(s)||n.push(s)}),n.length&&this.trigger("warn",{message:
${a} lacks required attribute(s): ${n.join(", ")}})}push(a){this.lineStream.push(a)}end(){this.lineStream.push(
`
The text was updated successfully, but these errors were encountered: