import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var CO="\x3cms:pro/\x3e lacks content",DO="BaseURL",EO="Channel parsing failure! Ignoring scheme and value",FO="ContentProtection",GO="EssentialProperty",HO="Failed to parse UTCTiming tags.",IO="Location",JO="Missing \x3cms:pro/\x3e node in ContentProtection element",KO="No UTCTiming elements found.",LO="SegmentBase does not contain sufficient segment information:",MO="SegmentList does not contain sufficient segment information:",NO="SegmentTemplate does not contain sufficient segment information:",
OO="SegmentTimeline",PO='The last "S" element cannot have a negative repeat',QO="application",RO="duration",SO="http://dashif.org/guidelines/trickmode",TO="http://www.w3.org/1999/xlink",UO='ignoring the last "S" element.',VO='ignoring the remaining "S" elements.',WO="parse.xml",XO="presentationTimeOffset",YO="schemeIdUri",ZO="static",$O="timescale",aP="urn:microsoft:playready",bP="urn:mpeg:cenc:2013",cP="urn:mpeg:dash:utc:http-head:2014",dP="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",eP="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
fP=function(a,b){return _.Mg[a]=b},gP=function(a,b,c){try{const d=a(b);if(d&&d.T&&d.abort)return c.resolve(d.T),()=>d.abort();c.resolve(d);return()=>Promise.resolve(d).then(()=>{}).catch(()=>{})}catch(d){return c.reject(d),()=>Promise.resolve()}},hP=function(a,b,c){const d=new _.bn;let e=()=>{d.reject(new _.I(_.G,7,7001));return a.abort()};a.T.then(f=>{a.a?d.reject(new _.I(_.G,7,7001)):b?e=gP(b,f,d):d.resolve(f)},f=>{c?e=gP(c,f,d):d.reject(f)});return new _.gp(d,()=>e())},iP=function(a,b){a.G=Math.max(a.G,
b);a.g.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+a.G)},jP=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},kP=function(a){return new _.gp(Promise.reject(a),()=>Promise.resolve())},lP=function(a){return new _.gp(Promise.all(a.map(b=>b.T)),()=>Promise.all(a.map(b=>b.abort())))},mP=function(a){var b=void 0===b?1024:b;if(!(a instanceof Uint8Array))return"";if(typeof b!==_.t||0>=b)b=1024;return(a.byteLength>b?a.subarray(0,b):a).toString()},
nP=function(a){return 1>=a?0:Math.floor(Math.random()*a)},oP=function(a){if(!a)return null;/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(a)&&(a+="Z");a=Date.parse(a);return isNaN(a)?null:Math.floor(a/1E3)},pP=function(a){if(!a)return null;const b=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(a);if(!b)return _.C("Invalid duration string:",a),null;a=31536E3*Number(b[1]||null)+2592E3*Number(b[2]||null)+86400*Number(b[3]||null)+3600*Number(b[4]||null)+
60*Number(b[5]||null)+Number(b[6]||null);return isFinite(a)?a:null},qP=function(a){var b=/([0-9]+)-([0-9]+)/.exec(a);if(!b)return null;a=Number(b[1]);if(!isFinite(a))return null;b=Number(b[2]);return isFinite(b)?{start:a,end:b}:null},rP=function(a){a=Number(a);return 0===a%1?a:null},sP=function(a){a=Number(a);return 0===a%1&&0<a?a:null},tP=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},uP=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:
a},vP=function(a){return a?"true"===a.toLowerCase():!1},wP=function(a,b,c,d,e){const f={RepresentationID:b,Number:c,Bandwidth:d,Time:e};return a.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g,(g,h,k,l)=>{if("$$"===g)return"$";let m=f[h];if(null==m)return _.C("URL template does not have an available substitution ","for identifier",'"'+h+'":',a),g;"RepresentationID"===h&&k&&(_.C("URL template should not contain a width specifier for identifier",'"RepresentationID":',
a),k=void 0);"Time"===h&&(m=Math.round(m));switch(l){case void 0:case "d":case "i":case "u":g=m.toString();break;case "o":g=m.toString(8);break;case "x":g=m.toString(16);break;case "X":g=m.toString(16).toUpperCase();break;default:g=m.toString()}k=window.parseInt(k,10)||1;return Array(Math.max(0,k-g.length)+1).join("0")+g})},zP=function(a,b){var c=xP(a,b,$O);let d=1;c&&(d=sP(c)||1);c=xP(a,b,RO);(c=sP(c||""))&&(c/=d);let e=Number(xP(a,b,XO))||0,f=e/d||0;a.Sh&&null!=a.td&&a.td!==f&&(_.C("The stream is non-compliant with the DASH spec. The value of `presentationTimeOffset` has changed during the transition from dynamic to static manifest, which is not allowed. The last "+
`value will be ignored. (Period ID: ${a.Ga.id}, `+`Representation ID: ${a.O.id})`),e=a.td*d,f=a.td);var g=xP(a,b,"startNumber");let h=tP(g||"");if(null==g||null==h)h=1;g=xP(a,b,"endNumber");g=null!==g?tP(g||""):null;var k=yP(a,b,OO),l=null;if(k){{l=d;var m=e,n=a.Ba.duration||Infinity;const A=_.on;k=A.a(k,"S");const D=[];var r=0;for(let E=0;E<k.length;++E){var u=k[E],v=A.$(u,"t",tP);const X=A.$(u,"d",tP);var y=A.$(u,"r",rP);null!=v&&(v-=m);if(!X){_.C('"S" element must have a duration:',VO,u);break}v=
null!=v?v:r;y=y||0;if(0>y)if(E+1<k.length){y=A.$(k[E+1],"t",tP);if(null==y){_.C('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:',VO,u);break}else if(v>=y){_.C('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',VO,u);break}y=Math.ceil((y-v)/X)-1}else{if(Infinity===n){_.C(PO,"if the Period has an infinite duration:",UO,u);break}else if(v/l>=n){_.C(PO,"if its start time exceeds the Period's duration:",
UO,u);break}y=Math.ceil((n*l-v)/X)-1}0<D.length&&v!==r&&(Math.abs((v-r)/l)>=_.fu&&_.C("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",u),D[D.length-1].end=v/l);for(u=0;u<=y;++u)r=v+X,D.push({start:v/l,end:r/l,Ki:v}),v=r}l=D}}a=xP(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,Ha:c,Cc:h,Ce:g,Nb:f,pf:e,timeline:l,te:b}},xP=function(a,b,c){return[b(a.O),b(a.ua),b(a.Ga)].filter(_.ii).map(d=>d.getAttribute(c)).reduce((d,
e)=>d||e)},yP=function(a,b,c){return[b(a.O),b(a.ua),b(a.Ga)].filter(_.ii).map(d=>_.on.h(d,c)).reduce((d,e)=>d||e)},BP=function(a,b,c,d,e,f){const g=_.on,h=g.getAttributeNS(a,TO,"href"),k=g.getAttributeNS(a,TO,"actuate")||"onRequest";g.le(a,TO);if(5<=f)return kP(new _.I(_.G,4,4028));if("onLoad"!==k)return kP(new _.I(_.G,4,4027));const l=_.pC([d],[h]);d=_.mj(l,b);d.type=1;return hP(e.fetch(d),m=>{m=_.Ui(m.data);m=g.j(m,a.tagName);if(!m)return kP(new _.I(_.G,4,4001,{uri:h}));g.ke(a);g.ae(m,a);g.$d(m,
a);return AP(a,b,c,l[0],e,f+1)})},AP=function(a,b,c,d,e,f=0){var g=_.on;if(g.getAttributeNS(a,TO,"href"))return g=BP(a,b,c,d,e,f),c&&(g=hP(g,void 0,()=>AP(a,b,c,d,e,f))),g;const h=[],k=g.Qd(a);for(const l of k)"urn:mpeg:dash:resolve-to-zero:2013"===g.getAttributeNS(l,TO,"href")?g.removeChild(a,l):l.tagName!==OO&&h.push(AP(l,b,c,d,e,f));return hP(lP(h),()=>a)},CP=function(a,b,c){const d=a.Ba.duration;var e=a.Ba.ig;if(!a.Be)return e=new _.sJ(b),_.UC(e,d),e;{var f=a.Ga;const g=a.O;f=f&&f.id&&g&&g.id?
`${f.id},${g.id}`:null}if(!a.jg||null==c[f])return a=new _.sJ(b),e||_.UC(a,d),c[f]=a;c=c[f];e||_.UC(new _.sJ(b),d);_.tD(c,b);_.uD(c,_.jD(a.presentationTimeline)-a.Ba.start);return c},DP=function(a,b){var c=a.presentationTimeline,d=[...b.a];c.l||0===d.length||(c.I=Math.floor(Math.max(c.I||0,d[d.length-1].endTime+a.Ba.start)));a.jg||_.gD(a.presentationTimeline,[...b.a],a.Ba.start)},EP=function(a){return""===a.id?`${a.schemeIdUri}:${a.startTime}:${a.endTime}`:a.id},GP=function(a,b,c,d){let e;var f=(new _.om).ea("sidx",
g=>{e=FP(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=c[0];a=_.K(a);_.rh('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.I(_.G,3,3004,{url:g,Wi:f,size:a.byteLength,lj:mP(a)});}},FP=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.P(d.reader);if(0===f)throw _.rh("Invalid timescale."),new _.I(_.G,3,3005);if(0===d.version){var g=_.P(d.reader);var h=_.P(d.reader)}else g=_.cm(d.reader),h=_.cm(d.reader);d.reader.skip(2);
const k=_.am(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.P(d.reader);const m=(l&2147483648)>>>31;l&=2147483647;const n=_.P(d.reader);d.reader.skip(4);if(1===m)throw _.rh("Hierarchical SIDXs are not supported."),new _.I(_.G,3,3006);e.push(new _.sD(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},HP=function(a){var b=_.$l(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.I(_.G,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.$l(a.a);return d},
KP=function(a){var b=HP(a);if(7<b.length)throw new _.I(_.G,3,3002);var c=0;for(var d=0;d<b.length;d++)c=256*c+b[d];b=c;c=HP(a);a:{for(e of IP)if(_.Ml(c,new Uint8Array(e))){var e=!0;break a}e=!1}if(e)c=a.f.byteLength-a.a.getPosition();else{if(8===c.length&&c[1]&224)throw new _.I(_.G,3,3001);e=c[0]&(1<<8-c.length)-1;for(d=1;d<c.length;d++)e=256*e+c[d];c=e}c=a.a.getPosition()+c<=a.f.byteLength?c:a.f.byteLength-a.a.getPosition();e=new DataView(a.f.buffer,a.f.byteOffset+a.a.getPosition(),c);a.a.skip(c);
return new JP(b,e)},LP=function(a){if(8<a.a.byteLength)throw new _.I(_.G,3,3002);if(8===a.a.byteLength&&a.a.getUint8(0)&224)throw new _.I(_.G,3,3001);let b=0;for(let c=0;c<a.a.byteLength;c++){const d=a.a.getUint8(c);b=256*b+d}return b},OP=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new MP(a.a);let k=null,l=null;for(;_.Yl(a.a);){var m=KP(a);if(187===m.id){var n=NP(m);n&&(m=c*n.Li,n=b+n.li,null!=k&&g.push(new _.sD(g.length,k-f,m-f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.sD(g.length,k-f,d-f,h,l,null,
f));return g},NP=function(a){var b=new MP(a.a);a=KP(b);if(179!==a.id)throw _.C("Not a CueTime element."),new _.I(_.G,3,3013);a=LP(a);b=KP(b);if(183!==b.id)throw _.C("Not a CueTrackPositions element."),new _.I(_.G,3,3012);b=new MP(b.a);let c=0;for(;_.Yl(b.a);){const d=KP(b);if(241===d.id){c=LP(d);break}}return{Li:a,li:c}},PP=function(a,b){var c=yP(a,b,"Initialization");if(!c)return null;let d=a.O.la;(b=c.getAttribute("sourceURL")||void 0)&&(d=_.pC(a.O.la,[b]));let e=0,f=null;if(c=_.on.$(c,"range",
qP))e=c.start,f=c.end;return new _.nJ(()=>d,e,f,null,null,b,a.O.Ka)},SP=function(a,b){var c=Number(xP(a,QP,XO))||0,d=xP(a,QP,$O),e=1;d&&(e=sP(d)||1);c=c/e||0;d=PP(a,QP);{e=a.O.mimeType.split("/")[1];if(a.O.contentType!==_.H&&"mp4"!==e&&"webm"!==e)throw _.rh("SegmentBase specifies an unsupported container type.",a.O),new _.I(_.G,4,4006);if("webm"===e&&!d)throw _.rh(LO,"the SegmentBase uses a WebM container,","but does not contain an Initialization element.",a.O),new _.I(_.G,4,4005);const g=yP(a,QP,
"RepresentationIndex");var f=xP(a,QP,"indexRange");let h=a.O.la;f=qP(f||"");if(g){const k=g.getAttribute("sourceURL");k&&(h=_.pC(a.O.la,[k]));f=_.on.$(g,"range",qP,f)}if(!f)throw _.rh(LO,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",a.O),new _.I(_.G,4,4002);a.presentationTimeline.B=null;a=RP(a,b,d,h,f.start,f.end,e,c)}return{createSegmentIndex:a.createSegmentIndex,findSegmentPosition:a.findSegmentPosition,getSegmentReference:a.getSegmentReference,adjustSegmentDurations:a.adjustSegmentDurations,
getDuration:a.getDuration,initSegmentReference:d,getLastSegmentEndTime:a.getLastSegmentEndTime,Ca:c}},QP=function(a){return a.Bd},RP=function(a,b,c,d,e,f,g,h){const k=a.presentationTimeline,l=!a.Be||!a.Ba.ig,m=a.Ba.start,n=a.Ba.duration;let r=b,u=null;return{createSegmentIndex:function(v){return _.x(function*(){var y=[r(d,e,f,v),"webm"===g?r(c.Ya(),c.ya,c.pa,v):null];r=null;y=yield Promise.all(y);var A=y[0];const D=y[1]||null;A="mp4"===g?GP(A,e,d,h):(new TP).parse(A,D,d,h);_.gD(k,A,m);u=new _.sJ(A);
l&&_.UC(u,n);return y})},findSegmentPosition:function(v){return u.f(v)},getSegmentReference:function(v){return u.get(v)},adjustSegmentDurations:function(v,y){return u.h(v,y)},getDuration:function(){return null!=n?n:u.getDuration()},getLastSegmentEndTime:()=>n}},$P=function(a,b,c,d){const e=UP(a),f=VP(a);WP(a,f);let g=null;if(f.pd)a.presentationTimeline.B=null,g=XP(a,b,e,f);else if(f.Ha)d||(a.presentationTimeline.B=null,iP(a.presentationTimeline,f.te),_.hD(a.presentationTimeline,f.Ha),_.eD(a.presentationTimeline,
a.Ba.start)),g=YP(a,f);else{b=ZP(a,f);const h=CP(a,b,c);DP(a,h);g={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:h.f.bind(h),getSegmentReference:h.get.bind(h),adjustSegmentDurations:h.h.bind(h),getDuration:h.getDuration.bind(h),getLastSegmentEndTime:()=>_.rD(h)}}return{createSegmentIndex:g.createSegmentIndex,findSegmentPosition:g.findSegmentPosition,getSegmentReference:g.getSegmentReference,adjustSegmentDurations:g.adjustSegmentDurations,getDuration:g.getDuration,initSegmentReference:e,
getLastSegmentEndTime:g.getLastSegmentEndTime,Ca:f.Nb}},UP=function(a){const b=xP(a,aQ,"initialization");if(!b)return null;const c=a.O.la,d=wP(b,a.O.id,null,a.bandwidth||null,null);return new _.nJ(function(){return _.pC(c,[d])},0,null,null,null,d,a.O.Ka)},VP=function(a){const b=zP(a,aQ),c=xP(a,aQ,"media");a=xP(a,aQ,"index");return{Ha:b.Ha,timescale:b.timescale,Cc:b.Cc,Ce:b.Ce,Nb:b.Nb,pf:b.pf,timeline:b.timeline,Le:c,pd:a,te:b.te}},WP=function(a,b){let c;c=b.pd?1:0;c+=b.timeline?1:0;c+=b.Ha?1:0;if(0===
c)throw _.rh("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template","a SegmentTimeline, or a segment duration.",a.O),new _.I(_.G,4,4002);1!==c&&(_.C("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",a.O),b.pd?(_.ph("Using the index URL template by default."),b.timeline=null):_.ph("Using the SegmentTimeline by default."),
b.Ha=null);if(!b.pd&&!b.Le)throw _.rh(NO,"the SegmentTemplate's media URL template is missing.",a.O),new _.I(_.G,4,4002);},XP=function(a,b,c,d){const e=a.O.mimeType.split("/")[1];if("mp4"!==e&&"webm"!==e)throw _.rh("SegmentTemplate specifies an unsupported container type.",a.O),new _.I(_.G,4,4006);if("webm"===e&&!c)throw _.rh(NO,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",a.O),new _.I(_.G,4,4005);var f=wP(d.pd,a.O.id,null,a.bandwidth||null,null);
f=_.pC(a.O.la,[f]);return RP(a,b,c,f,0,null,e,d.Nb)},YP=function(a,b){const c=b.Le,d=a.Ba.duration,e=b.Ha,f=b.Cc,g=b.Ce,h=b.timescale,k=a.bandwidth||null,l=a.O.id,m=a.O.la,n=a.O.Ka;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(r){return 0>r||d&&r>=d?null:Math.floor(r/e)},getSegmentReference:function(r){const u=r+f;if(null!==g&&u>g)return null;const v=r*e;let y=v+e;d&&(y=Math.min(y,d));if(0>y||d&&v>=d)return null;const A=wP(c,l,u,k,v*h);return new _.sD(r,v,y,
function(){return _.pC(m,[A])},0,null,b.Nb,null,null,null,null,null,null,null,null,A,n)},adjustSegmentDurations:()=>{},getDuration:()=>d,getLastSegmentEndTime:()=>d}},ZP=function(a,b){const c=b.Le,d=b.timeline;if(0===d.length)return[];const e=[];for(let f=0;f<d.length;f++){const g=f+b.Cc,h=a.O.la,k=wP(c,a.O.id,g,a.bandwidth||null,d[f].Ki+b.pf);e.push(new _.sD(g,d[f].start,d[f].end,()=>_.pC(h,[k]),0,null,b.Nb,null,null,null,null,null,null,null,null,k,a.O.Ka))}return e},aQ=function(a){return a.gc},
fQ=function(a,b){const c=PP(a,bQ),d=cQ(a);dQ(a,d);const e=eQ(a.Ba.duration,d.Cc,a.O.la,a.O.Ka,d),f=CP(a,e,b);DP(a,f);return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:f.f.bind(f),getSegmentReference:f.get.bind(f),adjustSegmentDurations:f.h.bind(f),getDuration:f.getDuration.bind(f),initSegmentReference:c,getLastSegmentEndTime:()=>_.rD(f),Ca:d.Nb}},bQ=function(a){return a.fc},cQ=function(a){const b=gQ(a);a=zP(a,bQ);let c=a.Cc;0===c&&(_.C("SegmentList@startNumber must be \x3e 0"),
c=1);let d=0;a.Ha?d=a.Ha*(c-1):a.timeline&&0<a.timeline.length&&(d=a.timeline[0].start);return{Ha:a.Ha,startTime:d,Cc:c,Nb:a.Nb,timeline:a.timeline,Ac:b}},dQ=function(a,b){if(!b.Ha&&!b.timeline&&1<b.Ac.length)throw _.C(MO,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",a.O),new _.I(_.G,4,4002);if(!b.Ha&&!a.Ba.duration&&!b.timeline&&1===b.Ac.length)throw _.C(MO,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,",
"or timeline.",a.O),new _.I(_.G,4,4002);if(b.timeline&&0===b.timeline.length)throw _.C(MO,"the SegmentList has an empty timeline.",a.O),new _.I(_.G,4,4002);},eQ=function(a,b,c,d,e){let f=e.Ac.length;e.timeline&&e.timeline.length!==e.Ac.length&&(f=Math.min(e.timeline.length,e.Ac.length),_.C("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",e.Ac.length,"to",f));const g=[];var h=e.startTime;for(let k=0;k<f;k++){const l=e.Ac[k],m=_.pC(c,[l.lg]);let n;
n=null!=e.Ha?h+e.Ha:e.timeline?e.timeline[k].end:h+a;g.push(new _.sD(k+b,h,n,()=>m,l.start,l.end,e.Nb,null,null,null,null,null,null,null,null,l.lg,d));h=n}return g},gQ=function(a){return[a.O.fc,a.ua.fc,a.Ga.fc].filter(_.ii).map(b=>_.on.a(b,"SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Ge&&(a.Ge=!0,_.C("We do not support the SegmentURL@indexRange attribute on SegmentList.  We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate."));
const c=b.getAttribute("media");b=_.on.$(b,"mediaRange",qP,{start:0,end:null});return{lg:c,start:b.start,end:b.end}})},iQ=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(YO),value:e.getAttribute(_.kg)}));const d=a.a.clockSyncUri;!c.length&&d&&(a.g.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),c.push({scheme:cP,value:d}));return 0===c.length?(a.g.warn(KO),Promise.reject(Error(KO))):jP(c,e=>{const f=e.scheme;e=e.value;switch(f){case cP:case "urn:mpeg:dash:utc:http-head:2012":return hQ(a,
b,e,"HEAD");case "urn:mpeg:dash:utc:http-xsdate:2014":case "urn:mpeg:dash:utc:http-iso:2014":case "urn:mpeg:dash:utc:http-xsdate:2012":case "urn:mpeg:dash:utc:http-iso:2012":return hQ(a,b,e,"GET");case "urn:mpeg:dash:utc:direct:2014":case "urn:mpeg:dash:utc:direct:2012":{const g=Date.parse(e);return isNaN(g)?(a.g.warn(`Invalid date for scheme ${f}, `+`value: ${e}`),Promise.reject()):Promise.resolve(g-Date.now())}case "urn:mpeg:dash:utc:http-ntp:2014":case "urn:mpeg:dash:utc:ntp:2014":case "urn:mpeg:dash:utc:sntp:2014":return a.g.warn("NTP UTCTiming scheme is not supported"),
Promise.reject();default:return a.g.warn("Unrecognized scheme in UTCTiming element",f),Promise.reject()}}).catch(()=>{a.g.warn(HO);return Promise.reject(Error(HO))})},jQ=function(a,b,c,d){return _.x(function*(){const e=_.on.a(b,"UTCTiming");try{const f=yield iQ(a,c,e);d.H=f;a.g.info("Clock synchronized. The difference between server and "+`client clock was ${f} ms.`)}catch(f){a.g.warn("Failed to synchronize clocks. This content may not play on clients with bad clocks!")}return d})},hQ=function(a,
b,c,d){return _.x(function*(){var e=_.pC(b,[c]);e=yield a.f(e,d);if("HEAD"===d){if(!e.headers||!e.headers.date)throw a.g.warn("UTC timing response is missing","expected date header"),Error("Date HTTP header missing.");e=e.headers.date}else e=_.Ui(e.data);e=Date.parse(e);if(isNaN(e))throw a.g.warn("Unable to parse date from UTC timing response"),Error("Date value invalid.");return e-Date.now()})},lQ=function(a,b){return a.find(c=>kQ.get(c.Xb)===b)},nQ=function(a){const b=_.on;var c=b.Pb(a.node,aP,
"pro");if(!c)return mQ.warn(JO,a),null;c=b.f(c);if(!c)return mQ.warn(CO,a),null;a=_.Jl(c);a=_.tn(a);a=_.kn(a.a);return{keyId:null,Xb:eP,node:b.Jc(),init:[{initData:_.cC(a),initDataType:_.Tc,keyId:null}]}},oQ=function(a,b){b=void 0===b?"4.0.0.0":b;const c=_.on;a=c.Pb(a.node,bP,"pssh");if(!a)return null;a=c.f(a);if(!a)return null;a=_.Jl(a);a=_.mn(a);return a?(b=_.dC(b,a.a))?{keyId:null,Xb:dP,node:c.Jc(),init:[{initData:_.cC(b),initDataType:_.Tc,keyId:null}]}:null:(_.C("Unable to parse WV PSSH data. Can not create PR data!"),
null)},pQ=function(a,b){const c=_.on;var d=c.Pb(a.node,aP,"pro");if(!d)return _.C(JO,a),null;d=c.f(d);if(!d)return _.C(CO,a),null;a=_.Jl(d);a=_.tn(a);return a.version!==b&&(_.qh(`Parsing from ${a.version} to ${b}.`),a=_.eC(a,b))?{keyId:null,Xb:dP,node:c.Jc(),init:[{initData:_.cC(a),initDataType:_.Tc,keyId:null}]}:null},sQ=function(a,b,c,d){const e=qQ(a);let f=null;a=[];let g=[];const h=lQ(e,_.td),k=lQ(e,_.rd);if(k&&d){var l=pQ(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=nQ(k))&&e.push(l);h&&!k&&(d=oQ(h,
d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.I(_.G,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"===m.Xb?(f=m.init||f,!1):!0),g.length&&(a=rQ(f,g,c),0===a.length&&(a=[_.qC(_.Be,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of kQ.values())m!==_.Le&&a.push(_.qC(m,f,c))}if(b=Array.from(d)[0]||null)for(const m of a)for(const n of m.initData)n.keyId=b;return{cd:b,Zi:f,drmInfos:a,Uf:!0}},qQ=function(a){const b=[];for(const c of a)(a=tQ(c))&&
b.push(a);return b},rQ=function(a,b,c){const d=[];for(const f of b){var e=kQ.get(f.Xb);if(e){b=_.qC(e,f.init||a,c);if(e=uQ.get(e))(e=e(f))?(b.licenseServerUri=e.licenseUrl,b.licenseServerUriOrigin=e.origin):b.licenseServerUri="";d.push(b)}}return d},vQ=function(a,b,c,d,e){const f=sQ(a,c,d,e);if(b.Uf){a=1===b.drmInfos.length&&!b.drmInfos[0].keySystem;c=0===f.drmInfos.length;if(0===b.drmInfos.length||a&&!c)b.drmInfos=f.drmInfos;b.cd=f.cd||b.cd;b.Uf=!1}else if(0<f.drmInfos.length&&(b.drmInfos=b.drmInfos.filter(g=>
f.drmInfos.some(h=>h.keySystem===g.keySystem)),0===b.drmInfos.length))throw new _.I(_.G,4,4008);return f.cd||b.cd},wQ=function(a){const b=_.on;a=b.sc(a.node,"https://dashif.org/CPS","Laurl").map(c=>b.f(c)).filter(Boolean);return 0===a.length?null:1===a.length?a[0]:a[nP(a.length)]},tQ=function(a){const b=_.on;let c=a.getAttribute(YO),d=b.getAttributeNS(a,bP,"default_KID");const e=b.sc(a,bP,"pssh").map(b.f),f=b.Pb(a,aP,"pro");if(!c)return _.rh("Missing required schemeIdUri attribute on","ContentProtection element",
a),null;c=c.toLowerCase();if(d&&(d=d.replace(/-/g,"").toLowerCase(),d.includes(" ")))throw new _.I(_.G,4,4009);let g=[];try{if(g=e.map(h=>({initDataType:_.Tc,initData:_.Jl(h),keyId:null})),0===g.length&&f&&b.f(f))try{const h=b.f(f),k=_.Jl(h),l=_.tn(k);g.push({initDataType:_.Tc,initData:_.cC(l),keyId:null})}catch(h){_.C("Unable to parse ms:pro payload",h),g=[]}}catch(h){throw new _.I(_.G,4,4007);}return{node:a,Xb:c,keyId:d,init:0<g.length?g:null}},xQ=function(a,b,c){if(a.length){c=c||`${"__clpp_baseUriCollection_"}
        ${b.length}`;const d=[];a.forEach(e=>{const f=e.getAttribute("serviceLocation");e=_.on.f(e);f&&e&&d.push({serviceLocationId:f,uri:e,params:{}})});if(d.length)return a=new _.cE(c,d),b.push(a),a}return null},zQ=function(a,b){a=yQ(a).filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime());0<a.length&&(a=Math.min(...a),_.fD(b.presentationTimeline,a+b.Ba.start))},AQ=function(a,b){return _.hE(_.mk(a,b))?_.H:a.split("/")[0]},yQ=function(a){const b=new Set;a.forEach(c=>{c.variants.forEach(d=>
{d.audio&&b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},CQ=function(a){return _.x(function*(){var b=a.w?_.dE(a.w,IO):null;var c=[];b&&(c=_.VD(b,""));0===c.length&&(c=a.o);var d=_.mj(c,a.a.attemptParameters);d.type=1;c=Date.now();d=a.D.networkingEngine.fetch(d);_.vj(a.A,d);var e=yield d.T;if(!a.D)return 0;b||e.uri&&!a.o.includes(e.uri)&&a.o.unshift(e.uri);d=null!=a.f;const f=yield BQ(a,e.data,e.uri);f.manifest.contentSteering&&(a.w=yield a.D.onContentSteeringInfoFound(f.manifest.contentSteering));
if(a.w&&b){0!==e.request.uriIndex&&_.eE(a.w,b.la[0].serviceLocationId);var g=e.request,h=e.timeMs;e=e.data.byteLength;h&&e&&(b=_.bE(a.w,b.la[g.uriIndex].serviceLocationId),_.TD(b.ue,h,e),b.yd=!0)}b=(Date.now()-c)/1E3;_.WC(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.Ji){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.F(_.ze))}return b})},DQ=function(a,b){0>a.l||a.B.ka(Math.max(3,a.l-b,_.XC(a.I)))},BQ=function(a,b,c){return _.x(function*(){var d=_.Ui(b);_.vn(WO);d=_.on.j(d,
"MPD");_.vn("parse.xml.end");_.xn(WO,WO,"parse.xml.end");if(!d)throw new _.I(_.G,4,4001,c);d=AP(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.vj(a.A,d);d=yield d.T;return EQ(a,d,c)})},EQ=function(a,b,c){return _.x(function*(){var d=_.on;const e=[];var f=[c],g=d.a(b,IO),h=g.map(d.f).filter(_.ii);0<h.length&&(f=_.pC(f,h),a.o=f,xQ(g,e,IO));g=d.a(b,DO);h=g.map(d.f);var k=_.pC(f,h);xQ(g,e,DO);f=b.getAttribute("type")||ZO;a.l=d.$(b,"minimumUpdatePeriod",pP,-1);f===ZO&&0<=a.l&&
(a.g.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),a.l=-1,a.B.stop());g=d.$(b,"maxSegmentDuration",pP);if(d=f===ZO&&"dynamic"===a.C)a.g.info("MPD dynamic to static transition."),f="dynamic";h=f===ZO;var l="dynamic"===f;if(a.f)var m=a.f.presentationTimeline;else{var n=_.on;m=a.a.timeline||{};var r=n.$(b,"suggestedPresentationDelay",pP),u=n.$(b,"minBufferTime",pP,0);r=null!=a.a.suggestedPresentationDelay?a.a.suggestedPresentationDelay:
a.a.lowLatencyMode?0:null!=r?r:3*u;n=n.$(b,"availabilityStartTime",oP);m=new _.rJ(m,n,r,h,!!a.a.autoCorrectDrift,!!a.a.lowLatencyMode);m=h?m:jQ(a.J,b,k,m)}m=yield m;n=_.on.$(b,"timeShiftBufferDepth",pP);n=l&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)?a.a.availabilityWindowOverride:null===n?Infinity:n;m.A=n;if(!a.D)throw new _.I(_.G,7,7001);n={Be:l,jg:null!=a.f,presentationTimeline:m,Ga:null,Ba:null,ua:null,O:null,bandwidth:0,Ge:!1,Sh:d,hc:null,td:null};k=FQ(a,n,k,e,b);
r=k.duration;l=k.periods;d&&(zQ(l,n),m.C=!0);if(h||!d&&!k.Rf)m.f=r||Infinity;if(2===a.a.timeline.version){h=r;n=l[0].startTime;if(null==h||Infinity===h)h=GQ(l);_.ZC(m.a,n,n+h)}_.hD(m,g||1);m.isLive();if(!a.f){a.f={presentationTimeline:m,periods:l,minBufferTime:0,cues:[]};a:{l=_.on;if(m=l.h(b,"ContentSteering"))if(g=m.getAttribute("defaultServiceLocation")||"",h=l.f(m)){l=l.$(m,"queryBeforeStart",vP,!1);g={manifestType:_.tc,contentSteeringServerUri:h,defaultServiceLocation:g,queryBeforeStart:l||!1,
baseUriCollections:[]};break a}g=null}g&&(a.f.contentSteering=g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,Ji:d}})},FQ=function(a,b,c,d,e){const f=_.on,g=f.$(e,"mediaPresentationDuration",pP),h=a.f?a.f.periods[a.f.periods.length-1]||null:null;var k=[];const l=[];var m=0;e=f.a(e,"Period");for(let v=0;v<e.length;v++){var n=e[v];m=f.$(n,_.Jf,pP,m);var r=f.$(n,RO,pP);let y=null;if(v!==e.length-1){var u=f.$(e[v+1],_.Jf,pP);null!=u&&(y=u-m)}else null!=g&&(y=g-m);
u=_.fu;y&&r&&Math.abs(y-r)>u&&a.g.warn("There is a gap/overlap between Periods",n);null==y&&(y=r);n=HQ(a,b,c,d,{start:m,duration:y,node:n,ig:null==y||v===e.length-1});r=n.Ga;l.push(r);k=k.concat(n.cues);a.G.includes(r.id)||(a.G.push(r.id),a.f&&(a.D.filterNewPeriod(r),a.f.periods.push(r)));if(null==y){v!==e.length-1&&a.g.warn("Skipping Period",v+1,"and any subsequent Periods:","Period",v+1,"does not have a valid start time.",l[v+1]);m=null;break}m+=y}null==a.f&&a.D.filterAllPeriods(l);h&&(b=l.find(v=>
v.id===h.id))&&(h.endTime=b.endTime);k=IQ(a,k);return null!=g?(m!==g&&a.g.warn("@mediaPresentationDuration does not match the total duration of ","all Periods."),{periods:l,duration:g,Rf:!1,cues:k}):{periods:l,duration:m,Rf:!0,cues:k}},GQ=function(a){return a.map(b=>b.variants[0].video||b.variants[0].audio).reduce((b,c)=>c?c.getDuration():0+b,0)},HQ=function(a,b,c,d,e){var f=_.on;b.Ga=JQ(a,e.node,null,c,d);b.Ba=e;c=b.Ga.id||`__clpp_period_${e.start}`;b.Ga.id||(a.g.info("No Period ID given for Period with start time "+
e.start+`,  Assigning a default: ${c}.`),b.Ga.id=c);d=f.a(e.node,"EventStream").flatMap(A=>KQ(a,e.start,e.duration,A));f=f.a(e.node,_.fa).map(A=>LQ(a,b,A)).filter(_.ii);if(b.Be){var g=[];for(var h of f)for(var k of h.oi)g.push(k);if(g.length!==(new Set(g)).size)throw new _.I(_.G,4,4018);}h=f.filter(A=>!A.mf);k=f.filter(A=>A.mf);for(var l of k){l.streams.forEach(A=>{A.trickPlay=!0});k=l.streams[0];g=l.mf;for(var m of h)if(g.includes(m.id))for(var n of m.streams)n.trickModeVideo=k}m=MQ(f,_.w);n=MQ(h,
_.p);if(!m.length&&!n.length)throw new _.I(_.G,4,4004);n.length||(n=[null]);m.length||(m=[null]);l=[];for(var r of n)for(var u of m)NQ(a,r,u,l);u=[...MQ(h,_.H),...MQ(h,_.XB)];r=[];for(var v of u)r.push.apply(r,v.streams);u=MQ(h,_.be);v=[];for(var y of u)v.push.apply(v,y.streams);y=OQ(e,h);return{Ga:{id:c,configurationId:a.D.configurationId,startTime:e.start,endTime:y,textStreams:r,thumbStreams:v,variants:l},cues:d}},IQ=function(a,b){const c=new Set(b.map(EP));a.j.forEach((d,e)=>{c.has(e)||a.j.delete(e)});
b.forEach(d=>{const e=EP(d);a.j.has(e)||a.j.set(e,d)});return Array.from(a.j.values())},JQ=function(a,b,c,d,e){const f=_.on;c=c||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,Me:null,Ka:e?e.find(u=>u.id===DO)||null:null};d=d||c.la;var g=f.a(b,DO);const h=g.map(f.f);e=e?xQ(g,e,b.getAttribute("id")||void 0):null;g=b.getAttribute("contentType")||c.contentType;const k=b.getAttribute(_.te)||c.mimeType,l=b.getAttribute(_.md)||c.codecs,m=f.$(b,"frameRate",uP)||c.frameRate,n=
PQ(f.a(b,"InbandEventStream"),c.emsgSchemeIdUris),r=f.a(b,"AudioChannelConfiguration");a=QQ(a,r)||c.Me;g||(g=AQ(k,l));return{la:_.pC(d,h),Ka:e||c.Ka,Bd:f.h(b,"SegmentBase")||c.Bd,fc:f.h(b,"SegmentList")||c.fc,gc:f.h(b,"SegmentTemplate")||c.gc,width:f.$(b,_.Fg,tP)||c.width,height:f.$(b,_.Zd,tP)||c.height,contentType:g,mimeType:k,codecs:l,frameRate:m,emsgSchemeIdUris:n,id:b.getAttribute("id")||"",Me:a}},KQ=function(a,b,c,d){const e=_.on,f=d.getAttribute(YO)||"",g=d.getAttribute(_.kg)||"",h=e.$(d,$O,
tP)||1,k=e.$(d,XO,tP)||0,l=[];for(const n of e.a(d,"Event")){d=e.$(n,"presentationTime",tP)||0;var m=e.$(n,RO,tP)||0;d=b+d/h-k/h;m=d+m/h;null!=c&&(d=Math.min(d,b+c),m=Math.min(m,b+c));let r=_.eg;f.startsWith(_.gg)?r=_.Ph:"urn:mpeg:dash:event:callback:2015"===f&&(r=_.Ae);const u={configurationId:a.D.configurationId,schemeIdUri:f,value:g,startTime:d,endTime:m,id:n.getAttribute("id")||"",type:r,eventElement:e.Dd(n)};u.type===_.Ae&&(u.ee=()=>{if(u.eventElement){var v=u.eventElement.getAttribute("messageData")||
"";v&&v.startsWith("http")&&(v=_.mj(v),v.type=_.lj,a.D.networkingEngine.fetch(v))}});l.push(u)}return l},LQ=function(a,b,c){var d=_.on;b.ua=JQ(a,c,b.Ga,null,null);let e=!1;var f=d.a(c,"Role");const g=f.map(X=>X.getAttribute(_.kg)).filter(_.ii);let h=null;var k=d.a(c,"Label").map(d.f).filter(_.ii);k&&0<k.length&&(h=k[k.length-1]);let l=void 0;(k=b.ua.contentType===_.H)&&(l=_.XB);for(var m of f)if(f=m.getAttribute(YO),null==f||"urn:mpeg:dash:role:2011"===f||"urn:mpeg:dash:role"===f)switch(f=m.getAttribute(_.kg),
f){case _.oe:e=!0;break;case _.JB:case _.XB:l=f;break;case "forced-subtitle":case "forced_subtitle":case _.Ud:l=_.Ud}f=d.a(c,GO);m=null;for(var n of f){f=n.getAttribute(YO)||"";var r=n.getAttribute(_.kg);if(f!==SO&&!RQ.includes(f)||void 0===r)return null;f===SO&&(0===r.length&&(m=null),m=r.split(" "))}n=d.a(c,"Accessibility");const u=new Map;for(var v of n)if(f=v.getAttribute(YO),"urn:scte:dash:cc:cea-608:2015"===f||"urn:scte:dash:cc:cea-708:2015"===f)if(f=1,r=v.getAttribute(_.kg),null!=r)for(const X of r.split(";")){if(X.includes("\x3d")){var y=
X.split("\x3d");r=y[0].startsWith("CC")?y[0]:"CC"+y[0];y=y[1].split(",")[0].split(":").pop()}else r="CC"+f,f+=2,y=X;u.set(r,_.Bi(y))}else u.set("CC1",_.dg);v=d.a(c,FO);const A=sQ(v,a.a.ignoreDrmInfo,b.Ga.id,a.a.playreadyVersion||null),D=c.getAttribute("lang")||_.dg;v=_.Bi(D);null==h&&(h=c.getAttribute("label"));d=d.a(c,_.lb);c=d.map(X=>SQ(a,b,A,l,D,h||"",e,g,u,X)).filter(_.ii);if(0===c.length){if(k)return null;throw new _.I(_.G,4,4003);}if(!b.ua.contentType||b.ua.contentType===QO){b.ua.contentType=
AQ(c[0].mimeType,c[0].codecs);for(var E of c)E.type=b.ua.contentType}for(const X of c)for(const cd of A.drmInfos)X.keyId&&!cd.keyIds.includes(X.keyId)&&cd.keyIds.push(X.keyId);c=TQ(c,b.ua.contentType,n);E=d.map(X=>X.getAttribute("id")).filter(_.ii);return{id:b.ua.id||"__fake__"+a.h++,contentType:b.ua.contentType,language:v,originalLanguage:D,Je:e,streams:c,drmInfos:A.drmInfos,mf:m,oi:E}},MQ=function(a,b){return a.filter(c=>c.contentType===b)},NQ=function(a,b,c,d){if(b||c)if(b&&c){if(_.wC(b.drmInfos,
c.drmInfos)){var e=_.vC(b.drmInfos,c.drmInfos);for(var f of b.streams)for(const h of c.streams){var g=(h.bandwidth||0)+(f.bandwidth||0);g={id:a.h++,language:b.language,primary:b.Je||c.Je,audio:f,video:h,bandwidth:g,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0};d.push(g)}}}else{f=b||c;for(e of f.streams)g=e.bandwidth||0,g={id:a.h++,language:f.language||_.dg,primary:f.Je,audio:b?e:null,video:c?e:null,bandwidth:g,drmInfos:f.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(g)}},
OQ=function(a,b){return null!==a.duration?a.start+a.duration:0<b.length?(b=b.filter(c=>0<c.streams.length).map(c=>c.streams).flat().filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime()),0<b.length?a.start+Math.min(...b):null):null},SQ=function(a,b,c,d,e,f,g,h,k,l){var m=_.on;const n=_.Bi(e);b.O=JQ(a,l,b.ua,null,null);if(!UQ(a,b.O))return a.g.warn("Skipping Representation",b.O),null;b.hc=`${b.Ga.id} ${b.O.id}`;b.td=a.F.get(b.hc);b.bandwidth=m.$(l,"bandwidth",sP)||0;const r=VQ(a,b);if(!r)return null;
a.F.set(b.hc,r.Ca);var u=m.a(l,FO);a=vQ(u,c,a.a.ignoreDrmInfo,b.Ga.id,a.a.playreadyVersion||null);u=!1;m.a(l,"SupplementalProperty").some(A=>"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===A.getAttribute(YO)&&"JOC"===A.getAttribute(_.kg))&&(b.O.mimeType="audio/eac3-joc",u=!0);let v=void 0;if(b.O.contentType===_.be){var y=(l=m.h(l,GO))&&l.getAttribute(YO);y=y||"";WQ.includes(y)&&(l=_.uC(l.getAttribute(_.kg)||""))&&(r.horizontalTiles=l.ld,r.verticalTiles=l.Fd,b.ua.gc&&(y=m.$(b.ua.gc,RO,tP)||0,m=
m.$(b.ua.gc,$O,tP)||1,(m=y/m)&&(v=m/l.Gi)))}return{id:_.oJ++,originalId:b.O.id,createSegmentIndex:r.createSegmentIndex,findSegmentPosition:r.findSegmentPosition,getSegmentReference:r.getSegmentReference,initSegmentReference:r.initSegmentReference,adjustSegmentDurations:r.adjustSegmentDurations,getLastSegmentEndTime:r.getLastSegmentEndTime,getDuration:r.getDuration,segmentLookupStrategy:_.NB,mimeType:b.O.mimeType,codecs:b.O.codecs,frameRate:b.O.frameRate,bandwidth:b.bandwidth,width:b.O.width,height:b.O.height,
kind:d,encrypted:0<c.drmInfos.length,keyId:a,language:n,originalLanguage:e,label:f,type:b.ua.contentType,primary:g,trickModeVideo:null,emsgSchemeIdUris:b.O.emsgSchemeIdUris,roles:h,channelsCount:b.O.Me,spatialAudio:u,closedCaptions:k,horizontalTiles:r.horizontalTiles,verticalTiles:r.verticalTiles,durationPerTile:v}},TQ=function(a,b,c){const d=b===_.XB?_.H:b;b=c.map(e=>({scheme:e.getAttribute(YO)||"",id:e.getAttribute("id")||void 0,value:e.getAttribute(_.kg)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=
b;return a},UQ=function(a,b){let c;c=b.Bd?1:0;c+=b.fc?1:0;c+=b.gc?1:0;if(0===c){if(b.contentType===_.H||b.contentType===QO)return!0;a.g.warn("Representation does not contain a segment information source:","the Representation must contain one of SegmentBase, SegmentList,",'SegmentTemplate, or explicitly indicate that it is "text".',b);return!1}1!==c&&(a.g.warn("Representation contains multiple segment information sources:","the Representation should only contain one of SegmentBase,","SegmentList, or SegmentTemplate.",
b),b.Bd?(a.g.info("Using SegmentBase by default."),b.fc=null):a.g.info("Using SegmentList by default."),b.gc=null);return!0},VQ=function(a,b){const c=a.a.attemptParameters;var d=b.O.contentType;d=d===_.H||d===QO;try{const e=(f,g,h,k)=>_.x(function*(){const l=_.YC(f,g,h,c);l.type=2;return(yield k.fetch(l)).data});if(b.O.Bd)return SP(b,e);if(b.O.fc)return fQ(b,a.H);if(b.O.gc)return $P(b,e,a.H,!!a.f);{const f=b.O.la,g=b.Ba.duration||0;a=()=>g;return{createSegmentIndex:()=>Promise.resolve(),findSegmentPosition:h=>
0<=h&&h<g?1:null,getSegmentReference:h=>1!==h?null:new _.sD(1,0,g,()=>f,0,null,0,null,null,null,null,null,null,null,null,"",b.O.Ka),adjustSegmentDurations:()=>{},getDuration:a,getLastSegmentEndTime:a,verticalTiles:void 0,horizontalTiles:void 0,initSegmentReference:null,Ca:0}}}catch(e){if(d&&4002===e.code)return a.g.debug("Ignoring DASH_NO_SEGMENT_INFO error in a text stream",e),null;throw e;}},PQ=function(a,b){b=b.slice();for(const c of a)(a=c.getAttribute(YO))&&!b.includes(a)&&b.push(a);return b},
QQ=function(a,b){for(const d of b){b=d.getAttribute(YO);if(!b)continue;const e=d.getAttribute(_.kg);if(e)switch(b){case "urn:mpeg:dash:outputChannelPositionList:2012":return e.trim().split(/ +/).length;case "urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case "urn:dts:dash:audio_channel_configuration:2012":var c=parseInt(e,10);if(!c){a.g.warn(EO,b,e);continue}return c;case "tag:dolby.com,2014:dash:audio_channel_configuration:2011":case "urn:dolby:dash:audio_channel_configuration:2011":c=
parseInt(e,16);if(!c){a.g.warn(EO,b,e);continue}for(a=0;c;)c&1&&++a,c>>=1;return a;default:a.g.warn("Unrecognized audio channel scheme:",b,e)}}return null};_.av.prototype.Dd=fP(19,function(a){return a});
_.IC.prototype.Dd=fP(18,function(a){const b=Array.from(a.a.entries()).map(([d,e])=>`xmlns:${e}="${d}"`).join(" "),c=(new DOMParser).parseFromString(`<?xml version="1.0"?><${a.tagName} `+`${b}/>`,_.Tf).childNodes[0];Object.keys(a.attributes).forEach(d=>{c.setAttribute(d,a.attributes[d])});a.childNodes.forEach(d=>{d.tagName===_.da?c.textContent+=d.textContent:c.appendChild(this.Dd(d))});return c});
_.av.prototype.le=fP(17,function(a,b){Array.from(a.attributes).forEach(c=>{c.namespaceURI===b&&a.removeAttributeNS(c.namespaceURI,c.localName)})});_.IC.prototype.le=fP(16,function(a,b){if(b=a.a.get(b)){var c=`${b}:`;Object.keys(a.attributes).forEach(d=>{d.startsWith(c)&&delete a.attributes[d]})}});_.av.prototype.$d=fP(15,function(a,b){for(const c of a.attributes)b.setAttributeNS(c.namespaceURI,c.nodeName,c.value)});
_.IC.prototype.$d=fP(14,function(a,b){Object.keys(a.attributes).forEach(c=>{b.attributes[c]=a.attributes[c]})});_.av.prototype.ae=fP(13,function(a,b){Array.from(a.childNodes).forEach(c=>{a.removeChild(c);b.appendChild(c)})});_.IC.prototype.ae=fP(12,function(a,b){b.childNodes.push(...a.childNodes);a.childNodes=[]});_.av.prototype.ke=fP(11,function(a){Array.from(a.childNodes).forEach(b=>{a.removeChild(b)})});_.IC.prototype.ke=fP(10,function(a){a.childNodes=[]});_.av.prototype.Jc=fP(9,function(){return document.createElement("null")});
_.IC.prototype.Jc=fP(8,function(){return new _.GC("NULL",null,{},[],null,null,new Map)});_.av.prototype.Qd=fP(7,function(a){return Array.from(a.childNodes).filter(b=>b instanceof Element)});_.IC.prototype.Qd=fP(6,function(a){return a.childNodes});_.av.prototype.$=fP(5,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});_.IC.prototype.$=fP(4,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});
_.av.prototype.sc=fP(3,function(a,b,c){return Array.from(a.childNodes).filter(d=>d instanceof Element&&d.localName===c&&d.namespaceURI===b)});_.IC.prototype.sc=fP(2,function(a,b,c){b=a.a.get(b);if(!b)return[];const d=`${b}:${c}`;return a.childNodes.filter(e=>e.tagName===d)});_.av.prototype.Pb=fP(1,function(a,b,c){a=this.sc(a,b,c);return 1!==a.length?null:a[0]});_.IC.prototype.Pb=fP(0,function(a,b,c){a=this.sc(a,b,c);return 1!==a.length?null:a[0]});
var WQ=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],RQ=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var MP=class{constructor(a){this.f=a;this.a=new _.ln(a,!1)}},IP=[[255],[127,255],[63,255,255],[31,255,255,255],[15,255,255,255,255],[7,255,255,255,255,255],[3,255,255,255,255,255,255],[1,255,255,255,255,255,255,255]],JP=class{constructor(a,b){this.id=a;this.a=b}};var TP=class{parse(a,b,c,d){var e;b=new MP(new DataView(b));if(440786851!==KP(b).id)throw _.rh("Not an EBML element."),new _.I(_.G,3,3008);var f=KP(b);if(408125543!==f.id)throw _.rh("Not a Segment element."),new _.I(_.G,3,3009);b=f.a.byteOffset;f=new MP(f.a);for(e=null;_.Yl(f.a);){var g=KP(f);if(357149030===g.id){e=g;break}}if(!e)throw _.rh("Not an Info element."),new _.I(_.G,3,3010);f=new MP(e.a);g=1E6;for(e=null;_.Yl(f.a);){const h=KP(f);if(2807729===h.id)g=LP(h);else if(17545===h.id)if(e=h,4===
e.a.byteLength)e=e.a.getFloat32(0);else if(8===e.a.byteLength)e=e.a.getFloat64(0);else throw new _.I(_.G,3,3003);}if(null==e)throw new _.I(_.G,3,3011);f=g/=1E9;e*=g;a=KP(new MP(new DataView(a)));if(475249515!==a.id)throw _.rh("Not a Cues element."),new _.I(_.G,3,3007);return OP(a,b,f,e,c,d)}};var XQ=class{constructor(a,b){this.g=a;this.f=b;this.a={clockSyncUri:void 0}}};var kQ=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Le).set(eP,_.td).set(dP,_.rd).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.rd).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.pd).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.od),uQ=(new Map).set(_.td,function(a){const b=wQ(a);if(b)return{licenseUrl:b,origin:_.MB};if(a=_.on.Pb(a.node,"urn:microsoft","laurl"))if(a=a.getAttribute("licenseUrl"))return{licenseUrl:a,origin:"ms:laurl"};return null}).set(_.rd,
function(a){var b=_.on;const c=wQ(a);if(c)return{licenseUrl:c,origin:_.MB};a=b.Pb(a.node,aP,"pro");if(!a)return null;b=b.f(a);if(!b)return null;b=_.Jl(b);return(b=_.tn(b).h)?{licenseUrl:b,origin:"mspr:pro"}:null}),mQ=new _.S("clpp.dash.ContentProtection");var YQ=class{constructor(){this.D=this.a=null;this.o=[];this.f=null;this.G=[];this.h=1;this.H={};this.l=0;this.I=new _.pJ(5);this.B=new _.rk(()=>{this.Vb()});this.A=new _.lu;this.j=new Map;this.g=new _.S("clpp.dash.DashParser");this.C=null;this.J=new XQ(this.g,(a,b)=>{a=_.mj(a,this.a.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.vj(this.A,b);return b.T});this.F=new Map;this.K=!1;this.w=null}configure(a){this.a=a;this.J.a={clockSyncUri:a.clockSyncUri}}start(a,b){const c=
this;return _.x(function*(){c.o=[a];c.D=b;const d=yield CQ(c);c.D&&DQ(c,d);if(!c.D)throw new _.I(_.G,7,7001);return c.f})}requestStop(){this.K=!0}stop(){this.a=this.D=null;this.o=[];this.f=null;this.G=[];this.H={};this.C=null;this.l=-1;this.B.stop();this.F.clear();this.j.clear();return this.A.destroy()}update(){CQ(this).catch(a=>{if(this.D&&a)this.D.onError(a)})}setCurrentVariant(){}Vb(){const a=this;return _.x(function*(){a.g.debug(_.DB);let b=0;try{b=yield CQ(a)}catch(c){if(a.D&&c.a&&(a.D.onError(c),
c.severity===_.G))return}a.D&&(a.K?yield a.stop():DQ(a,b))})}loadVariant(a){return _.x(function*(){return a})}loadTextStream(a,b){const c=this;return _.x(function*(){let d;const e=c.f.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.ji(`Could not load text stream with id: ${a}`);return d})}};_.z("clpp.dash.DashComponent",class extends _.Av{f(){_.$s.mpd=YQ;_.Ys[_.tc]=YQ}a(){_.RD("mpd");_.SD(_.tc)}id(){return"dash"}});};f.call(g, window);