@castlabs/prestoplay 6.28.0 → 6.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +128 -116
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +619 -614
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +92 -89
  10. package/cjs/cl.externs.js +154 -60
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +77 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +25 -23
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +350 -349
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -4
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +57 -58
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +60 -60
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +38 -38
  33. package/cjs/polyfill.min.js +2 -2
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +6 -6
  37. package/cl.cast.js +101 -92
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +500 -496
  40. package/cl.crypto.js +9 -9
  41. package/cl.dash.js +84 -83
  42. package/cl.externs.js +150 -60
  43. package/cl.freewheel.js +19 -19
  44. package/cl.hls.js +82 -80
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +19 -17
  48. package/cl.mediatailor.js +2 -2
  49. package/cl.mse.js +304 -305
  50. package/cl.muxdata.js +13 -13
  51. package/cl.onboard.js +4 -4
  52. package/cl.persistent.js +11 -11
  53. package/cl.playlist.js +5 -5
  54. package/cl.simid.js +14 -14
  55. package/cl.smooth.js +60 -60
  56. package/cl.thumbnails.js +19 -19
  57. package/cl.tizen.js +56 -56
  58. package/cl.ttml.js +22 -22
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +14 -14
  62. package/cl.vtt.js +12 -12
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +31 -31
  65. package/package.json +1 -1
  66. package/typings.d.ts +198 -88
package/cl.dash.js CHANGED
@@ -1,83 +1,84 @@
1
- import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var $L="\x3cms:pro/\x3e lacks content",aM="BaseURL",bM="Channel parsing failure! Ignoring scheme and value",cM="ContentProtection",dM="EssentialProperty",eM="Failed to parse UTCTiming tags.",fM="Location",gM="Missing \x3cms:pro/\x3e node in ContentProtection element",hM="No UTCTiming elements found.",iM="SegmentBase does not contain sufficient segment information:",jM="SegmentList does not contain sufficient segment information:",kM="SegmentTemplate does not contain sufficient segment information:",
2
- lM="SegmentTimeline",mM='The last "S" element cannot have a negative repeat',nM="application",oM="duration",pM="http://dashif.org/guidelines/trickmode",qM="http://www.w3.org/1999/xlink",rM='ignoring the last "S" element.',sM='ignoring the remaining "S" elements.',tM="parse.xml",uM="presentationTimeOffset",vM="schemeIdUri",wM="static",xM="timescale",yM="urn:microsoft:playready",zM="urn:mpeg:cenc:2013",AM="urn:mpeg:dash:utc:http-head:2014",BM="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",CM="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
3
- DM=function(a,b){return _.Sg[a]=b},EM=function(a,b,c){try{const d=a(b);if(d&&d.U&&d.abort)return c.resolve(d.U),()=>d.abort();c.resolve(d);return()=>Promise.resolve(d).then(()=>{}).catch(()=>{})}catch(d){return c.reject(d),()=>Promise.resolve()}},FM=function(a,b,c){const d=new _.Tl;let e=()=>{d.reject(new _.H(_.C,7,7001));return a.abort()};a.U.then(f=>{a.a?d.reject(new _.H(_.C,7,7001)):b?e=EM(b,f,d):d.resolve(f)},f=>{c?e=EM(c,f,d):d.reject(f)});return new _.As(d,()=>e())},GM=function(a,b){a.G=Math.max(a.G,
4
- b);a.g.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+a.G)},HM=function(a){return new _.As(Promise.reject(a),()=>Promise.resolve())},IM=function(a){return new _.As(Promise.all(a.map(b=>b.U)),()=>Promise.all(a.map(b=>b.abort())))},JM=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},KM=function(a){return a===_.q||a===_.t},LM=function(a){var b=void 0===b?1024:b;if(!(a instanceof Uint8Array))return"";if(typeof b!==_.r||0>=b)b=1024;return(a.byteLength>
5
- b?a.subarray(0,b):a).toString()},MM=function(a){return 1>=a?0:Math.floor(Math.random()*a)},NM=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)},OM=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 _.B("Invalid duration string:",a),null;a=31536E3*Number(b[1]||null)+2592E3*Number(b[2]||null)+86400*Number(b[3]||
6
- null)+3600*Number(b[4]||null)+60*Number(b[5]||null)+Number(b[6]||null);return isFinite(a)?a:null},PM=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},QM=function(a){a=Number(a);return 0===a%1?a:null},RM=function(a){a=Number(a);return 0===a%1&&0<a?a:null},SM=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},TM=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?Number(b[1])/Number(b[2]):
7
- Number(a);return isNaN(a)?null:a},UM=function(a){return a?"true"===a.toLowerCase():!1},VM=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 _.B("URL template does not have an available substitution ","for identifier",'"'+h+'":',a),g;"RepresentationID"===h&&k&&(_.B("URL template should not contain a width specifier for identifier",
8
- '"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})},YM=function(a,b){var c=WM(a,b,xM);let d=1;c&&(d=RM(c)||1);c=WM(a,b,oM);(c=RM(c||""))&&(c/=d);let e=Number(WM(a,b,uM))||0,f=e/d||0;a.Wh&&null!=a.sd&&a.sd!==
9
- f&&(_.B("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.Fa.id}, `+`Representation ID: ${a.O.id})`),e=a.sd*d,f=a.sd);var g=WM(a,b,"startNumber");let h=SM(g||"");if(null==g||null==h)h=1;g=WM(a,b,"endNumber");g=null!==g?SM(g||""):null;var k=XM(a,b,lM),l=null;if(k){{l=d;var m=e,n=a.Aa.duration||Infinity;const A=_.N;k=A.a(k,"S");
10
- const D=[];var p=0;for(let E=0;E<k.length;++E){var u=k[E],v=A.Z(u,"t",SM);const fa=A.Z(u,"d",SM);var y=A.Z(u,"r",QM);null!=v&&(v-=m);if(!fa){_.B('"S" element must have a duration:',sM,u);break}v=null!=v?v:p;y=y||0;if(0>y)if(E+1<k.length){y=A.Z(k[E+1],"t",SM);if(null==y){_.B('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:',sM,u);break}else if(v>=y){_.B('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',
11
- sM,u);break}y=Math.ceil((y-v)/fa)-1}else{if(Infinity===n){_.B(mM,"if the Period has an infinite duration:",rM,u);break}else if(v/l>=n){_.B(mM,"if its start time exceeds the Period's duration:",rM,u);break}y=Math.ceil((n*l-v)/fa)-1}0<D.length&&v!==p&&(Math.abs((v-p)/l)>=_.Yt&&_.B("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)p=v+fa,D.push({start:v/l,end:p/l,Si:v}),v=p}l=D}}a=WM(a,b,"availabilityTimeOffset");b=Number(a||
12
- "");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,Ga:c,Ac:h,Ee:g,Kb:f,pf:e,timeline:l,we:b}},WM=function(a,b,c){return[b(a.O),b(a.va),b(a.Fa)].filter(_.Fm).map(d=>d.getAttribute(c)).reduce((d,e)=>d||e)},XM=function(a,b,c){return[b(a.O),b(a.va),b(a.Fa)].filter(_.Fm).map(d=>_.N.h(d,c)).reduce((d,e)=>d||e)},$M=function(a,b,c,d,e,f){const g=_.N,h=g.getAttributeNS(a,qM,"href"),k=g.getAttributeNS(a,qM,"actuate")||"onRequest";g.ke(a,qM);if(5<=f)return HM(new _.H(_.C,4,4028));if("onLoad"!==
13
- k)return HM(new _.H(_.C,4,4027));const l=_.hB([d],[h]);d=_.nk(l,b);d.type=1;return FM(e.fetch(d),m=>{m=_.oi(m.data);m=g.j(m,a.tagName);if(!m)return HM(new _.H(_.C,4,4001,{uri:h}));g.je(a);g.Zd(m,a);g.Yd(m,a);return ZM(a,b,c,l[0],e,f+1)})},ZM=function(a,b,c,d,e,f){f=void 0===f?0:f;var g=_.N;if(g.getAttributeNS(a,qM,"href"))return g=$M(a,b,c,d,e,f),c&&(g=FM(g,void 0,()=>ZM(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,qM,"href")?g.removeChild(a,
14
- l):l.tagName!==lM&&h.push(ZM(l,b,c,d,e,f));return FM(IM(h),()=>a)},aN=function(a,b,c){const d=a.Aa.duration;var e=a.Aa.kg;if(!a.De)return e=new _.qI(b),_.MB(e,d),e;{var f=a.Fa;const g=a.O;f=f&&f.id&&g&&g.id?`${f.id},${g.id}`:null}if(!a.lg||null==c[f])return a=new _.qI(b),e||_.MB(a,d),c[f]=a;c=c[f];e||_.MB(new _.qI(b),d);_.qC(c,b);_.rC(c,_.fC(a.presentationTimeline)-a.Aa.start);return c},bN=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-
15
- 1].endTime+a.Aa.start)));a.lg||_.cC(a.presentationTimeline,[...b.a],a.Aa.start)},cN=function(a){return""===a.id?`${a.schemeIdUri}:${a.startTime}:${a.endTime}`:a.id},dN=function(a,b,c,d,e){return _.w(function*(){const f=_.QB(a,b,c,e);f.type=2;return(yield _.lm(d,f,{objectType:"i"}).U).data})},fN=function(a,b,c,d){let e;var f=(new _.dp).ea("sidx",g=>{e=eN(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=c[0];a=_.F(a);_.xh('Invalid box type. Expected "sidx", but received:',
16
- a,"from:",g,"byte range:",f);throw new _.H(_.C,3,3004,{url:g,dj:f,size:a.byteLength,tj:LM(a)});}},eN=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.M(d.reader);if(0===f)throw _.xh("Invalid timescale."),new _.H(_.C,3,3005);if(0===d.version){var g=_.M(d.reader);var h=_.M(d.reader)}else g=_.So(d.reader),h=_.So(d.reader);d.reader.skip(2);const k=_.Qo(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.M(d.reader);const m=(l&2147483648)>>>31;l&=2147483647;const n=_.M(d.reader);d.reader.skip(4);if(1===
17
- m)throw _.xh("Hierarchical SIDXs are not supported."),new _.H(_.C,3,3006);e.push(new _.pC(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},gN=function(a){var b=_.Po(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.H(_.C,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Po(a.a);return d},jN=function(a){var b=gN(a);if(7<b.length)throw new _.H(_.C,3,3002);var c=0;for(var d=0;d<b.length;d++)c=256*c+b[d];b=c;c=gN(a);a:{for(e of hN)if(_.$l(c,new Uint8Array(e))){var e=
18
- !0;break a}e=!1}if(e)c=a.f.byteLength-a.a.getPosition();else{if(8===c.length&&c[1]&224)throw new _.H(_.C,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 iN(b,e)},kN=function(a){if(8<a.a.byteLength)throw new _.H(_.C,3,3002);if(8===a.a.byteLength&&a.a.getUint8(0)&224)throw new _.H(_.C,3,3001);let b=0;for(let c=0;c<a.a.byteLength;c++){const d=
19
- a.a.getUint8(c);b=256*b+d}return b},nN=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new lN(a.a);let k=null,l=null;for(;_.No(a.a);){var m=jN(a);if(187===m.id){var n=mN(m);n&&(m=c*n.Ti,n=b+n.vi,null!=k&&g.push(new _.pC(g.length,k-f,m-f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.pC(g.length,k-f,d-f,h,l,null,f));return g},mN=function(a){var b=new lN(a.a);a=jN(b);if(179!==a.id)throw _.B("Not a CueTime element."),new _.H(_.C,3,3013);a=kN(a);b=jN(b);if(183!==b.id)throw _.B("Not a CueTrackPositions element."),
20
- new _.H(_.C,3,3012);b=new lN(b.a);let c=0;for(;_.No(b.a);){const d=jN(b);if(241===d.id){c=kN(d);break}}return{Ti:a,vi:c}},oN=function(a,b){var c=XM(a,b,"Initialization");if(!c)return null;let d=a.O.na;b=()=>"";const e=c.getAttribute("sourceURL")||void 0;e&&(d=_.hB(a.O.na,[e]),b=()=>e);let f=0,g=null;if(c=_.N.Z(c,"range",PM))f=c.start,g=c.end;return new _.mI(()=>d,f,g,null,null,b,a.O.Ia)},pN=function(a){return a.xd},rN=function(a,b,c,d,e,f,g){const h=a.presentationTimeline,k=!a.De||!a.Aa.kg,l=a.Aa.start,
21
- m=a.Aa.duration;let n=null;return{createSegmentIndex:function(p,u){return _.w(function*(){var v=[dN(c,d,e,p,u),"webm"===f?dN(b.Da(),b.ma,b.ja,p,u):null];v=yield Promise.all(v);var y=v[0];const A=v[1]||null;y="mp4"===f?fN(y,d,c,g):(new qN).parse(y,A,c,g);KM(a.O.contentType)&&_.cC(h,y,l);n=new _.qI(y);k&&_.MB(n,m);return v})},findSegmentPosition:function(p){return n.f(p)},getSegmentReference:function(p){return n.get(p)},adjustSegmentDurations:function(p,u){return n.h(p,u)},getDuration:function(){return null!=
22
- m?m:n.getDuration()},getLastSegmentEndTime:()=>m}},yN=function(a,b,c){const d=sN(a),e=tN(a);uN(a,e);const f=KM(a.O.contentType);let g=null;if(e.nd)f&&(a.presentationTimeline.B=null),g=vN(a,d,e);else if(e.Ga)!c&&f&&(a.presentationTimeline.B=null,GM(a.presentationTimeline,e.we),_.dC(a.presentationTimeline,e.Ga),_.aC(a.presentationTimeline,a.Aa.start)),g=wN(a,e);else{c=xN(a,e);const h=aN(a,c,b);f&&bN(a,h);g={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:h.f.bind(h),getSegmentReference:h.get.bind(h),
23
- adjustSegmentDurations:h.h.bind(h),getDuration:h.getDuration.bind(h),getLastSegmentEndTime:()=>_.oC(h)}}return{createSegmentIndex:g.createSegmentIndex,findSegmentPosition:g.findSegmentPosition,getSegmentReference:g.getSegmentReference,adjustSegmentDurations:g.adjustSegmentDurations,getDuration:g.getDuration,initSegmentReference:d,getLastSegmentEndTime:g.getLastSegmentEndTime,Ba:e.Kb}},sN=function(a){const b=WM(a,zN,"initialization");if(!b)return null;const c=a.O.id,d=a.bandwidth||null,e=a.O.na,f=
24
- ()=>VM(b,c,null,d,null);return new _.mI(function(){const g=f();return _.hB(e,[g])},0,null,null,null,f,a.O.Ia)},tN=function(a){const b=YM(a,zN),c=WM(a,zN,"media");a=WM(a,zN,"index");return{Ga:b.Ga,timescale:b.timescale,Ac:b.Ac,Ee:b.Ee,Kb:b.Kb,pf:b.pf,timeline:b.timeline,Le:c,nd:a,we:b.we}},uN=function(a,b){let c;c=b.nd?1:0;c+=b.timeline?1:0;c+=b.Ga?1:0;if(0===c)throw _.xh("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template","a SegmentTimeline, or a segment duration.",
25
- a.O),new _.H(_.C,4,4002);1!==c&&(_.B("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",a.O),b.nd?(_.vh("Using the index URL template by default."),b.timeline=null):_.vh("Using the SegmentTimeline by default."),b.Ga=null);if(!b.nd&&!b.Le)throw _.xh(kM,"the SegmentTemplate's media URL template is missing.",a.O),new _.H(_.C,4,4002);},vN=function(a,b,c){const d=a.O.mimeType.split("/")[1];
26
- if("mp4"!==d&&"webm"!==d)throw _.xh("SegmentTemplate specifies an unsupported container type.",a.O),new _.H(_.C,4,4006);if("webm"===d&&!b)throw _.xh(kM,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",a.O),new _.H(_.C,4,4005);var e=VM(c.nd,a.O.id,null,a.bandwidth||null,null);e=_.hB(a.O.na,[e]);return rN(a,b,e,0,null,d,c.Kb)},wN=function(a,b){const c=b.Le,d=a.Aa.duration,e=b.Ga,f=b.Ac,g=b.Ee,h=b.timescale,k=a.bandwidth||null,l=a.O.id,m=a.O.na,n=a.O.Ia;
27
- return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(p){return 0>p||d&&p>=d?null:Math.floor(p/e)},getSegmentReference:function(p){const u=p+f;if(null!==g&&u>g)return null;const v=p*e;let y=v+e;d&&(y=Math.min(y,d));if(0>y||d&&v>=d)return null;const A=()=>VM(c,l,u,k,v*h);return new _.pC(p,v,y,function(){const D=A();return _.hB(m,[D])},0,null,b.Kb,null,null,null,null,null,null,null,null,A,n)},adjustSegmentDurations:()=>{},getDuration:()=>d,getLastSegmentEndTime:()=>d}},
28
- xN=function(a,b){const c=b.Le,d=b.timeline;if(0===d.length)return[];const e=[],f=a.O.id,g=a.bandwidth||null,h=a.O.na;a=a.O.Ia;for(let k=0;k<d.length;k++){const l=k+b.Ac,m=d[k].Si+b.pf,n=()=>VM(c,f,l,g,m);e.push(new _.pC(l,d[k].start,d[k].end,()=>{const p=n();return _.hB(h,[p])},0,null,b.Kb,null,null,null,null,null,null,null,null,n,a))}return e},zN=function(a){return a.fc},EN=function(a,b){const c=oN(a,AN),d=BN(a);CN(a,d);const e=DN(a.Aa.duration,d.Ac,a.O.na,a.O.Ia,d),f=aN(a,e,b);KM(a.O.contentType)&&
29
- bN(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:()=>_.oC(f),Ba:d.Kb}},AN=function(a){return a.ec},BN=function(a){const b=FN(a);a=YM(a,AN);let c=a.Ac;0===c&&(_.B("SegmentList@startNumber must be \x3e 0"),c=1);let d=0;a.Ga?d=a.Ga*(c-1):a.timeline&&0<a.timeline.length&&(d=a.timeline[0].start);return{Ga:a.Ga,
30
- startTime:d,Ac:c,Kb:a.Kb,timeline:a.timeline,yc:b}},CN=function(a,b){if(!b.Ga&&!b.timeline&&1<b.yc.length)throw _.B(jM,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",a.O),new _.H(_.C,4,4002);if(!b.Ga&&!a.Aa.duration&&!b.timeline&&1===b.yc.length)throw _.B(jM,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",a.O),new _.H(_.C,4,4002);if(b.timeline&&0===b.timeline.length)throw _.B(jM,
31
- "the SegmentList has an empty timeline.",a.O),new _.H(_.C,4,4002);},DN=function(a,b,c,d,e){let f=e.yc.length;e.timeline&&e.timeline.length!==e.yc.length&&(f=Math.min(e.timeline.length,e.yc.length),_.B("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",e.yc.length,"to",f));const g=[];var h=e.startTime;for(let k=0;k<f;k++){const l=e.yc[k],m=_.hB(c,[l.ng]);let n;n=null!=e.Ga?h+e.Ga:e.timeline?e.timeline[k].end:h+a;g.push(new _.pC(k+b,h,n,()=>m,l.start,
32
- l.end,e.Kb,null,null,null,null,null,null,null,null,()=>l.ng,d));h=n}return g},FN=function(a){return[a.O.ec,a.va.ec,a.Fa.ec].filter(_.Fm).map(b=>_.N.a(b,"SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Ie&&(a.Ie=!0,_.B("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=_.N.Z(b,"mediaRange",PM,{start:0,end:null});return{ng:c,
33
- start:b.start,end:b.end}})},HN=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(vM),value:e.getAttribute(_.tg)}));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:AM,value:d}));return 0===c.length?(a.g.warn(hM),Promise.reject(Error(hM))):JM(c,e=>{const f=e.scheme;e=e.value;switch(f){case AM:case "urn:mpeg:dash:utc:http-head:2012":return GN(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 GN(a,
34
- 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(()=>
35
- {a.g.warn(eM);return Promise.reject(Error(eM))})},IN=function(a,b,c,d){return _.w(function*(){const e=_.N.a(b,"UTCTiming");try{const f=yield HN(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})},GN=function(a,b,c,d){return _.w(function*(){var e=_.hB(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",
36
- "expected date header"),Error("Date HTTP header missing.");e=e.headers.date}else e=_.oi(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()})},KN=function(a,b){return a.find(c=>JN.get(c.Ub)===b)},MN=function(a){const b=_.N;var c=b.Mb(a.node,yM,"pro");if(!c)return LN.warn(gM,a),null;c=b.f(c);if(!c)return LN.warn($L,a),null;a=_.Xl(c);a=_.cq(a);a=_.Vp(a.a);return{keyId:null,Ub:CM,node:b.Ec(),init:[{initData:_.VA(a),
37
- initDataType:_.Tc,keyId:null}]}},NN=function(a,b){b=void 0===b?"4.0.0.0":b;const c=_.N;a=c.Mb(a.node,zM,"pssh");if(!a)return null;a=c.f(a);if(!a)return null;a=_.Xl(a);a=_.Xp(a);return a?(b=_.WA(b,a.a))?{keyId:null,Ub:BM,node:c.Ec(),init:[{initData:_.VA(b),initDataType:_.Tc,keyId:null}]}:null:(_.B("Unable to parse WV PSSH data. Can not create PR data!"),null)},ON=function(a,b){const c=_.N;var d=c.Mb(a.node,yM,"pro");if(!d)return _.B(gM,a),null;d=c.f(d);if(!d)return _.B($L,a),null;a=_.Xl(d);a=_.cq(a);
38
- return a.version!==b&&(_.wh(`Parsing from ${a.version} to ${b}.`),a=_.XA(a,b))?{keyId:null,Ub:BM,node:c.Ec(),init:[{initData:_.VA(a),initDataType:_.Tc,keyId:null}]}:null},RN=function(a,b,c,d){const e=PN(a);let f=null;a=[];let g=[];const h=KN(e,_.ud),k=KN(e,_.sd);if(k&&d){var l=ON(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=MN(k))&&e.push(l);h&&!k&&(d=NN(h,d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.H(_.C,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"===
39
- m.Ub?(f=m.init||f,!1):!0),g.length&&(a=QN(f,g,c),0===a.length&&(a=[_.iB(_.Fe,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of JN.values())m!==_.Pe&&a.push(_.iB(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{Xc:b,gj:f,drmInfos:a,Wf:!0}},PN=function(a){const b=[];for(const c of a)(a=SN(c))&&b.push(a);return b},QN=function(a,b,c){const d=[];for(const f of b){var e=JN.get(f.Ub);if(e){b=_.iB(e,f.init||a,c);if(e=TN.get(e))(e=e(f))?(b.licenseServerUri=
40
- e.licenseUrl,b.licenseServerUriOrigin=e.origin):b.licenseServerUri="";d.push(b)}}return d},UN=function(a,b,c,d,e){const f=RN(a,c,d,e);if(b.Wf){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.Xc=f.Xc||b.Xc;b.Wf=!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 _.H(_.C,4,4008);return f.Xc||b.Xc},VN=function(a){const b=_.N;a=
41
- b.rc(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[MM(a.length)]},SN=function(a){const b=_.N;let c=a.getAttribute(vM),d=b.getAttributeNS(a,zM,"default_KID");const e=b.rc(a,zM,"pssh").map(b.f),f=b.Mb(a,yM,"pro");if(!c)return _.xh("Missing required schemeIdUri attribute on","ContentProtection element",a),null;c=c.toLowerCase();if(d&&(d=d.replace(/-/g,"").toLowerCase(),d.includes(" ")))throw new _.H(_.C,4,4009);let g=[];try{if(g=
42
- e.map(h=>({initDataType:_.Tc,initData:_.Xl(h),keyId:null})),0===g.length&&f&&b.f(f))try{const h=b.f(f),k=_.Xl(h),l=_.cq(k);g.push({initDataType:_.Tc,initData:_.VA(l),keyId:null})}catch(h){_.B("Unable to parse ms:pro payload",h),g=[]}}catch(h){throw new _.H(_.C,4,4007);}return{node:a,Ub:c,keyId:d,init:0<g.length?g:null}},WN=function(a,b,c){if(a.length){c=c||`${"__clpp_baseUriCollection_"}
43
- ${b.length}`;const d=[];a.forEach(e=>{const f=e.getAttribute("serviceLocation");e=_.N.f(e);f&&e&&d.push({serviceLocationId:f,uri:e,params:{}})});if(d.length)return a=new _.uI(c,d),b.push(a),a}return null},YN=function(a,b){a=XN(a).filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime());0<a.length&&(a=Math.min(...a),_.bC(b.presentationTimeline,a+b.Aa.start))},ZN=function(a,b){return _.RB(_.Pm(a,b))?_.J:a.split("/")[0]},XN=function(a){const b=new Set;a.forEach(c=>{c.variants.forEach(d=>
44
- {d.audio&&b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},aO=function(a){return _.w(function*(){var b=a.w?a.w.getBaseUriCollectionById(fM):null;var c=[];b&&(c=_.QC(b,""));0===c.length&&(c=a.o);var d=_.nk(c,a.a.attemptParameters);d.type=1;c=Date.now();d=a.D.networkingEngine.fetch(d);_.xl(a.A,d);var e=yield d.U;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 $N(a,e.data,e.uri);f.manifest.contentSteering&&(a.w=yield a.D.onContentSteeringInfoFound(f.manifest.contentSteering));
45
- if(a.w&&b){0!==e.request.uriIndex&&a.w.banLocation(b.na[0].serviceLocationId);var g=e.request,h=e.timeMs;e=e.data.byteLength;h&&e&&a.w.notifyThroughput(b.na[g.uriIndex].serviceLocationId,h,e)}b=(Date.now()-c)/1E3;_.OB(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.Ri){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.G(_.De))}return b})},bO=function(a,b){0>a.l||a.B.la(Math.max(3,a.l-b,_.PB(a.I)))},$N=function(a,b,c){return _.w(function*(){var d=_.oi(b);_.rm(tM);d=_.N.j(d,"MPD");
46
- _.rm("parse.xml.end");_.tm(tM,tM,"parse.xml.end");if(!d)throw new _.H(_.C,4,4001,c);d=ZM(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.xl(a.A,d);d=yield d.U;return cO(a,d,c)})},cO=function(a,b,c){return _.w(function*(){var d=_.N;const e=[];var f=[c],g=d.a(b,fM),h=g.map(d.f).filter(_.Fm);0<h.length&&(f=_.hB(f,h),a.o=f,WN(g,e,fM));g=d.a(b,aM);h=g.map(d.f);var k=_.hB(f,h);WN(g,e,aM);f=b.getAttribute("type")||wM;a.l=d.Z(b,"minimumUpdatePeriod",OM,-1);f===wM&&0<=a.l&&(a.g.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),
47
- a.l=-1,a.B.stop());g=d.Z(b,"maxSegmentDuration",OM);if(d=f===wM&&"dynamic"===a.C)a.g.info("MPD dynamic to static transition."),f="dynamic";h=f===wM;var l="dynamic"===f;if(a.f)var m=a.f.presentationTimeline;else{var n=_.N;m=a.a.timeline||{};var p=n.Z(b,"suggestedPresentationDelay",OM),u=n.Z(b,"minBufferTime",OM,0);p=null!=a.a.suggestedPresentationDelay?a.a.suggestedPresentationDelay:a.a.lowLatencyMode?0:null!=p?p:3*u;n=n.Z(b,"availabilityStartTime",NM);m=new _.pI(m,n,p,h,!!a.a.autoCorrectDrift,!!a.a.lowLatencyMode);
48
- m=h?m:IN(a.J,b,k,m)}m=yield m;n=_.N.Z(b,"timeShiftBufferDepth",OM);n=l&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)?a.a.availabilityWindowOverride:null===n?Infinity:n;m.A=n;if(!a.D)throw new _.H(_.C,7,7001);n={De:l,lg:null!=a.f,presentationTimeline:m,Fa:null,Aa:null,va:null,O:null,bandwidth:0,Ie:!1,Wh:d,gc:null,sd:null};k=dO(a,n,k,e,b);p=k.duration;l=k.periods;d&&(YN(l,n),m.C=!0);if(h||!d&&!k.Tf)m.f=p||Infinity;if(2===a.a.timeline.version){h=p;n=l[0].startTime;if(null==
49
- h||Infinity===h)h=eO(l);p=m.a;_.VB(p,n,n+h);d&&(p.f=!0)}_.dC(m,g||1);m.isLive()||Infinity!==m.f&&!m.l||2===m.h.version&&m.a.getDuration();if(!a.f){a.f={presentationTimeline:m,periods:l,minBufferTime:0,cues:[]};a:{l=_.N;if(m=l.h(b,"ContentSteering"))if(g=m.getAttribute("defaultServiceLocation")||"",h=l.f(m)){l=l.Z(m,"queryBeforeStart",UM,!1);g={manifestType:_.vc,contentSteeringServerUri:h,defaultServiceLocation:g,queryBeforeStart:l||!1,baseUriCollections:[]};break a}g=null}g&&(a.f.contentSteering=
50
- g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,Ri:d}})},dO=function(a,b,c,d,e){const f=_.N,g=f.Z(e,"mediaPresentationDuration",OM),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.Z(n,_.Of,OM,m);var p=f.Z(n,oM,OM);let y=null;if(v!==e.length-1){var u=f.Z(e[v+1],_.Of,OM);null!=u&&(y=u-m)}else null!=g&&(y=g-m);u=_.Yt;y&&p&&Math.abs(y-p)>u&&a.g.warn("There is a gap/overlap between Periods",
51
- n);null==y&&(y=p);n=fO(a,b,c,d,{start:m,duration:y,node:n,kg:null==y||v===e.length-1});p=n.Fa;l.push(p);k=k.concat(n.cues);a.G.includes(p.id)||(a.G.push(p.id),a.f&&(a.D.filterNewPeriod(p),a.f.periods.push(p)));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=gO(a,k);return null!=g?(m!==g&&a.g.warn("@mediaPresentationDuration does not match the total duration of ",
52
- "all Periods."),{periods:l,duration:g,Tf:!1,cues:k}):{periods:l,duration:m,Tf:!0,cues:k}},eO=function(a){return a.map(b=>b.variants[0].video||b.variants[0].audio).reduce((b,c)=>c?c.getDuration():0+b,0)},fO=function(a,b,c,d,e){var f=_.N;b.Fa=hO(a,e.node,null,c,d);b.Aa=e;c=b.Fa.id||`__clpp_period_${e.start}`;b.Fa.id||(a.g.info("No Period ID given for Period with start time "+e.start+`, Assigning a default: ${c}.`),b.Fa.id=c);d=f.a(e.node,"EventStream").flatMap(A=>iO(a,e.start,e.duration,A));f=f.a(e.node,
53
- _.ha).map(A=>jO(a,b,A)).filter(_.Fm);if(b.De){var g=[];for(var h of f)for(var k of h.yi)g.push(k);if(g.length!==(new Set(g)).size)throw new _.H(_.C,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=kO(f,_.t);n=kO(h,_.q);if(!m.length&&!n.length)throw new _.H(_.C,4,4004);n.length||(n=[null]);m.length||(m=[null]);l=[];for(var p of n)for(var u of m)lO(a,
54
- p,u,l);u=[...kO(h,_.J),...kO(h,_.MA)];p=[];for(var v of u)p.push.apply(p,v.streams);u=kO(h,_.fe);v=[];for(var y of u)v.push.apply(v,y.streams);y=mO(e,h);return{Fa:{id:c,configurationId:a.D.configurationId,startTime:e.start,endTime:y,textStreams:p,thumbStreams:v,variants:l},cues:d}},gO=function(a,b){const c=new Set(b.map(cN));a.j.forEach((d,e)=>{c.has(e)||a.j.delete(e)});b.forEach(d=>{const e=cN(d);a.j.has(e)||a.j.set(e,d)});return Array.from(a.j.values())},hO=function(a,b,c,d,e){const f=_.N;c=c||
55
- {contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,Me:null,Ia:e?e.find(u=>u.id===aM)||null:null};d=d||c.na;var g=f.a(b,aM);const h=g.map(f.f);e=e?WN(g,e,b.getAttribute("id")||void 0):null;g=b.getAttribute("contentType")||c.contentType;const k=b.getAttribute(_.Ae)||c.mimeType,l=b.getAttribute(_.nd)||c.codecs,m=f.Z(b,"frameRate",TM)||c.frameRate,n=nO(f.a(b,"InbandEventStream"),c.emsgSchemeIdUris),p=f.a(b,"AudioChannelConfiguration");a=oO(a,p)||c.Me;g||(g=ZN(k,l));return{na:_.hB(d,
56
- h),Ia:e||c.Ia,xd:f.h(b,"SegmentBase")||c.xd,ec:f.h(b,"SegmentList")||c.ec,fc:f.h(b,"SegmentTemplate")||c.fc,width:f.Z(b,_.Lg,SM)||c.width,height:f.Z(b,_.ae,SM)||c.height,contentType:g,mimeType:k,codecs:l,frameRate:m,emsgSchemeIdUris:n,id:b.getAttribute("id")||"",Me:a}},iO=function(a,b,c,d){const e=_.N,f=d.getAttribute(vM)||"",g=d.getAttribute(_.tg)||"",h=e.Z(d,xM,SM)||1,k=e.Z(d,uM,SM)||0,l=[];for(const n of e.a(d,"Event")){d=e.Z(n,"presentationTime",SM)||0;var m=e.Z(n,oM,SM)||0;d=b+d/h-k/h;m=d+m/
57
- h;null!=c&&(d=Math.min(d,b+c),m=Math.min(m,b+c));let p=_.ng;f.startsWith(_.pg)?p=_.Ff:"urn:mpeg:dash:event:callback:2015"===f&&(p=_.Ee);const u={configurationId:a.D.configurationId,schemeIdUri:f,value:g,startTime:d,endTime:m,id:n.getAttribute("id")||"",type:p,eventElement:e.zd(n)};u.type===_.Ee&&(u.ce=()=>{if(u.eventElement){var v=u.eventElement.getAttribute("messageData")||"";v&&v.startsWith("http")&&(v=_.nk(v),v.type=_.mk,a.D.networkingEngine.fetch(v))}});l.push(u)}return l},jO=function(a,b,c){var d=
58
- _.N;b.va=hO(a,c,b.Fa,null,null);var e=b.va.contentType===_.J;const f=pO(c),{kind:g,ud:h,roles:k}=qO(c,e);let l=null;try{l=rO(c)}catch(y){return null}const m=d.a(c,"Accessibility"),n=sO(m);var p=d.a(c,cM);const u=RN(p,a.a.ignoreDrmInfo,b.Fa.id,a.a.playreadyVersion||null),v=c.getAttribute("lang")||_.jg;p=_.Cn(v);d=d.a(c,_.lb);c=d.map(y=>tO(a,b,u,g,v,f||"",h,k,n,y)).filter(_.Fm);if(0===c.length){if(e)return null;throw new _.H(_.C,4,4003);}if(!b.va.contentType||b.va.contentType===nM){b.va.contentType=
59
- ZN(c[0].mimeType,c[0].codecs);for(const y of c)y.type=b.va.contentType}for(const y of c)for(const A of u.drmInfos)y.keyId&&!A.keyIds.includes(y.keyId)&&A.keyIds.push(y.keyId);c=uO(c,b.va.contentType,m);e=d.map(y=>y.getAttribute("id")).filter(_.Fm);return{id:b.va.id||"__fake__"+a.h++,contentType:b.va.contentType,language:p,originalLanguage:v,ud:h,streams:c,drmInfos:u.drmInfos,mf:l,yi:e}},kO=function(a,b){return a.filter(c=>c.contentType===b)},lO=function(a,b,c,d){if(b||c)if(b&&c){if(_.BB(b.drmInfos,
60
- c.drmInfos)){var e=_.AB(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.ud||c.ud,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||_.jg,primary:f.ud,audio:b?e:null,video:c?e:null,bandwidth:g,drmInfos:f.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(g)}},
61
- mO=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},pO=function(a){let b=null;const c=_.N.a(a,"Label").map(_.N.f).filter(_.Fm);c&&0<c.length&&(b=c[c.length-1]);null==b&&(b=a.getAttribute("label"));return b},qO=function(a,b){let c=!1;const d=_.N.a(a,"Role");a=d.map(f=>f.getAttribute(_.tg)).filter(_.Fm);let e=
62
- void 0;b&&(e=_.MA);for(const f of d)if(b=f.getAttribute(vM),null==b||"urn:mpeg:dash:role:2011"===b||"urn:mpeg:dash:role"===b)switch(b=f.getAttribute(_.tg),b){case _.ve:c=!0;break;case _.xA:case _.MA:e=b;break;case "forced-subtitle":case "forced_subtitle":case _.Yd:e=_.Yd}return{ud:c,roles:a,kind:e}},rO=function(a){var b=_.N.a(a,dM);a=null;for(const c of b){b=c.getAttribute(vM)||"";const d=c.getAttribute(_.tg);if(b!==pM&&!vO.includes(b)||void 0===d)throw new _.kl("Unrecognized essential property");
63
- b===pM&&(a=d.split(" "))}return a},sO=function(a){const b=new Map;for(const e of a)if(a=e.getAttribute(vM),"urn:scte:dash:cc:cea-608:2015"===a||"urn:scte:dash:cc:cea-708:2015"===a){a=1;var c=e.getAttribute(_.tg);if(null!=c)for(const f of c.split(";")){if(f.includes("\x3d")){var d=f.split("\x3d");c=d[0].startsWith("CC")?d[0]:"CC"+d[0];d=d[1].split(",")[0].split(":").pop()}else c="CC"+a,a+=2,d=f;b.set(c,_.Cn(d))}else b.set("CC1",_.jg)}return b},tO=function(a,b,c,d,e,f,g,h,k,l){const m=_.N,n=_.Cn(e);
64
- b.O=hO(a,l,b.va,null,null);if(!wO(a,b.O))return a.g.warn("Skipping Representation",b.O),null;b.gc=`${b.Fa.id} ${b.O.id}`;b.sd=a.F.get(b.gc);b.bandwidth=m.Z(l,"bandwidth",RM)||0;const p=xO(a,b);if(!p)return null;a.F.set(b.gc,p.Ba);var u=m.a(l,cM);a=UN(u,c,a.a.ignoreDrmInfo,b.Fa.id,a.a.playreadyVersion||null);u=!1;m.a(l,"SupplementalProperty").some(v=>"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===v.getAttribute(vM)&&"JOC"===v.getAttribute(_.tg))&&(b.O.mimeType="audio/eac3-joc",u=!0);l=yO(b,l);
65
- return{id:_.lI++,originalId:b.O.id,createSegmentIndex:p.createSegmentIndex,findSegmentPosition:p.findSegmentPosition,getSegmentReference:p.getSegmentReference,initSegmentReference:p.initSegmentReference,adjustSegmentDurations:p.adjustSegmentDurations,getLastSegmentEndTime:p.getLastSegmentEndTime,getDuration:p.getDuration,segmentLookupStrategy:_.CA,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,
66
- keyId:a,language:n,originalLanguage:e,label:f,type:b.va.contentType,primary:g,trickModeVideo:null,emsgSchemeIdUris:b.O.emsgSchemeIdUris,roles:h,channelsCount:b.O.Me,spatialAudio:u,closedCaptions:k,horizontalTiles:l.horizontalTiles,verticalTiles:l.verticalTiles,durationPerTile:l.durationPerTile}},uO=function(a,b,c){const d=b===_.MA?_.J:b;b=c.map(e=>({scheme:e.getAttribute(vM)||"",id:e.getAttribute("id")||void 0,value:e.getAttribute(_.tg)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=
67
- b;return a},wO=function(a,b){let c;c=b.xd?1:0;c+=b.ec?1:0;c+=b.fc?1:0;if(0===c){if(b.contentType===_.J||b.contentType===nM)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.",
68
- b),b.xd?(a.g.info("Using SegmentBase by default."),b.ec=null):a.g.info("Using SegmentList by default."),b.fc=null);return!0},xO=function(a,b){var c=b.O.contentType;c=c===_.J||c===nM;try{if(b.O.xd){{var d=Number(WM(b,pN,uM))||0,e=WM(b,pN,xM),f=1;e&&(f=RM(e)||1);f=d/f||0;const k=oN(b,pN);{d=k;e=f;const l=b.O.mimeType.split("/")[1];if(b.O.contentType!==_.J&&"mp4"!==l&&"webm"!==l)throw _.xh("SegmentBase specifies an unsupported container type.",b.O),new _.H(_.C,4,4006);if("webm"===l&&!d)throw _.xh(iM,
69
- "the SegmentBase uses a WebM container,","but does not contain an Initialization element.",b.O),new _.H(_.C,4,4005);const m=XM(b,pN,"RepresentationIndex"),n=WM(b,pN,"indexRange");let p=b.O.na,u=PM(n||"");if(m){const v=m.getAttribute("sourceURL");v&&(p=_.hB(b.O.na,[v]));u=_.N.Z(m,"range",PM,u)}if(!u)throw _.xh(iM,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",b.O),new _.H(_.C,4,4002);KM(b.O.contentType)&&(b.presentationTimeline.B=null);var g=rN(b,d,p,u.start,u.end,
70
- l,e)}var h={createSegmentIndex:g.createSegmentIndex,findSegmentPosition:g.findSegmentPosition,getSegmentReference:g.getSegmentReference,adjustSegmentDurations:g.adjustSegmentDurations,getDuration:g.getDuration,initSegmentReference:k,getLastSegmentEndTime:g.getLastSegmentEndTime,Ba:f}}}else h=b.O.ec?EN(b,a.H):b.O.fc?yN(b,a.H,!!a.f):zO(b);return h}catch(k){if(c&&4002===k.code)return a.g.debug("Ignoring DASH_NO_SEGMENT_INFO error in a text stream",k),null;throw k;}},yO=function(a,b){const c={};if(a.O.contentType===
71
- _.fe){var d=(b=_.N.h(b,dM))&&b.getAttribute(vM);d=d||"";AO.includes(d)&&(b=_.uB(b.getAttribute(_.tg)||""))&&(c.horizontalTiles=b.hd,c.verticalTiles=b.Cd,a.va.fc&&(d=_.N.Z(a.va.fc,oM,SM)||0,a=_.N.Z(a.va.fc,xM,SM)||1,a=d/a))&&(c.durationPerTile=a/b.Oi)}return c},zO=function(a){const b=a.O.na,c=a.Aa.duration||0,d=()=>c;return{createSegmentIndex:()=>Promise.resolve(),findSegmentPosition:e=>0<=e&&e<c?1:null,getSegmentReference:e=>1!==e?null:new _.pC(1,0,c,()=>b,0,null,0,null,null,null,null,null,null,null,
72
- null,()=>"",a.O.Ia),adjustSegmentDurations:()=>{},getDuration:d,getLastSegmentEndTime:d,verticalTiles:void 0,horizontalTiles:void 0,initSegmentReference:null,Ba:0}},nO=function(a,b){b=b.slice();for(const c of a)(a=c.getAttribute(vM))&&!b.includes(a)&&b.push(a);return b},oO=function(a,b){for(const d of b){b=d.getAttribute(vM);if(!b)continue;const e=d.getAttribute(_.tg);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=
73
- parseInt(e,10);if(!c){a.g.warn(bM,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(bM,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};_.Xu.prototype.zd=DM(19,function(a){return a});
74
- _.yB.prototype.zd=DM(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}/>`,_.Zf).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.zd(d))});return c});
75
- _.Xu.prototype.ke=DM(17,function(a,b){Array.from(a.attributes).forEach(c=>{c.namespaceURI===b&&a.removeAttributeNS(c.namespaceURI,c.localName)})});_.yB.prototype.ke=DM(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]})}});_.Xu.prototype.Yd=DM(15,function(a,b){for(const c of a.attributes)b.setAttributeNS(c.namespaceURI,c.nodeName,c.value)});
76
- _.yB.prototype.Yd=DM(14,function(a,b){Object.keys(a.attributes).forEach(c=>{b.attributes[c]=a.attributes[c]})});_.Xu.prototype.Zd=DM(13,function(a,b){Array.from(a.childNodes).forEach(c=>{a.removeChild(c);b.appendChild(c)})});_.yB.prototype.Zd=DM(12,function(a,b){b.childNodes.push(...a.childNodes);a.childNodes=[]});_.Xu.prototype.je=DM(11,function(a){Array.from(a.childNodes).forEach(b=>{a.removeChild(b)})});_.yB.prototype.je=DM(10,function(a){a.childNodes=[]});_.Xu.prototype.Ec=DM(9,function(){return document.createElement("null")});
77
- _.yB.prototype.Ec=DM(8,function(){return new _.wB("NULL",null,{},[],null,null,new Map)});_.Xu.prototype.Qd=DM(7,function(a){return Array.from(a.childNodes).filter(b=>b instanceof Element)});_.yB.prototype.Qd=DM(6,function(a){return a.childNodes});_.Xu.prototype.Z=DM(5,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});_.yB.prototype.Z=DM(4,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});
78
- _.Xu.prototype.rc=DM(3,function(a,b,c){return Array.from(a.childNodes).filter(d=>d instanceof Element&&d.localName===c&&d.namespaceURI===b)});_.yB.prototype.rc=DM(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)});_.Xu.prototype.Mb=DM(1,function(a,b,c){a=this.rc(a,b,c);return 1!==a.length?null:a[0]});_.yB.prototype.Mb=DM(0,function(a,b,c){a=this.rc(a,b,c);return 1!==a.length?null:a[0]});
79
- var AO=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],vO=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var lN=class{constructor(a){this.f=a;this.a=new _.Wp(a,!1)}},hN=[[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]],iN=class{constructor(a,b){this.id=a;this.a=b}};var qN=class{parse(a,b,c,d){var e;b=new lN(new DataView(b));if(440786851!==jN(b).id)throw _.xh("Not an EBML element."),new _.H(_.C,3,3008);var f=jN(b);if(408125543!==f.id)throw _.xh("Not a Segment element."),new _.H(_.C,3,3009);b=f.a.byteOffset;f=new lN(f.a);for(e=null;_.No(f.a);){var g=jN(f);if(357149030===g.id){e=g;break}}if(!e)throw _.xh("Not an Info element."),new _.H(_.C,3,3010);f=new lN(e.a);g=1E6;for(e=null;_.No(f.a);){const h=jN(f);if(2807729===h.id)g=kN(h);else if(17545===h.id)if(e=h,4===
80
- e.a.byteLength)e=e.a.getFloat32(0);else if(8===e.a.byteLength)e=e.a.getFloat64(0);else throw new _.H(_.C,3,3003);}if(null==e)throw new _.H(_.C,3,3011);f=g/=1E9;e*=g;a=jN(new lN(new DataView(a)));if(475249515!==a.id)throw _.xh("Not a Cues element."),new _.H(_.C,3,3007);return nN(a,b,f,e,c,d)}};var BO=class{constructor(a,b){this.g=a;this.f=b;this.a={clockSyncUri:void 0}}};var JN=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Pe).set(CM,_.ud).set(BM,_.sd).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.sd).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.qd).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.pd),TN=(new Map).set(_.ud,function(a){const b=VN(a);if(b)return{licenseUrl:b,origin:_.AA};if(a=_.N.Mb(a.node,"urn:microsoft","laurl"))if(a=a.getAttribute("licenseUrl"))return{licenseUrl:a,origin:"ms:laurl"};return null}).set(_.sd,
81
- function(a){var b=_.N;const c=VN(a);if(c)return{licenseUrl:c,origin:_.AA};a=b.Mb(a.node,yM,"pro");if(!a)return null;b=b.f(a);if(!b)return null;b=_.Xl(b);return(b=_.cq(b).h)?{licenseUrl:b,origin:"mspr:pro"}:null}),LN=new _.S("clpp.dash.ContentProtection");var CO=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 _.nI(5);this.B=new _.Mi(()=>{this.Sb()});this.A=new _.Tt;this.j=new Map;this.g=new _.S("clpp.dash.DashParser");this.C=null;this.J=new BO(this.g,(a,b)=>{a=_.nk(a,this.a.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.xl(this.A,b);return b.U});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=
82
- this;return _.w(function*(){c.o=[a];c.D=b;const d=yield aO(c);c.D&&bO(c,d);if(!c.D)throw new _.H(_.C,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(){aO(this).catch(a=>{if(this.D&&a)this.D.onError(a)})}setCurrentVariant(){}Sb(){const a=this;return _.w(function*(){a.g.debug(_.sA);let b=0;try{b=yield aO(a)}catch(c){if(a.D&&c.a&&(a.D.onError(c),
83
- c.severity===_.C))return}a.D&&(a.K?yield a.stop():bO(a,b))})}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(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 _.kl(`Could not load text stream with id: ${a}`);return d})}};_.x("clpp.dash.DashComponent",class extends _.rv{install(){_.yt.mpd=CO;_.xt[_.vc]=CO}uninstall(){_.NC("mpd");_.OC(_.vc)}id(){return"dash"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var dM="\x3cms:pro/\x3e lacks content",eM="BaseURL",fM="Channel parsing failure! Ignoring scheme and value",gM="ContentProtection",hM="EssentialProperty",iM="Failed to parse UTCTiming tags.",jM="Location",kM="Missing \x3cms:pro/\x3e node in ContentProtection element",lM="No UTCTiming elements found.",mM="SegmentBase does not contain sufficient segment information:",nM="SegmentList does not contain sufficient segment information:",oM="SegmentTemplate does not contain sufficient segment information:",
2
+ pM="SegmentTimeline",qM='The last "S" element cannot have a negative repeat',rM="application",sM="duration",tM="http://dashif.org/guidelines/trickmode",uM="http://www.w3.org/1999/xlink",vM='ignoring the last "S" element.',wM='ignoring the remaining "S" elements.',xM="parse.xml",yM="presentationTimeOffset",zM="schemeIdUri",AM="static",BM="timescale",CM="urn:microsoft:playready",DM="urn:mpeg:cenc:2013",EM="urn:mpeg:dash:utc:http-head:2014",FM="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",GM="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
3
+ HM=function(a,b){return _.Tg[a]=b},IM=function(a,b,c){try{const d=a(b);if(d&&d.U&&d.abort)return c.resolve(d.U),()=>d.abort();c.resolve(d);return()=>Promise.resolve(d).then(()=>{}).catch(()=>{})}catch(d){return c.reject(d),()=>Promise.resolve()}},JM=function(a,b,c){const d=new _.Hl;let e=()=>{d.reject(new _.I(_.D,7,7001));return a.abort()};a.U.then(f=>{a.a?d.reject(new _.I(_.D,7,7001)):b?e=IM(b,f,d):d.resolve(f)},f=>{c?e=IM(c,f,d):d.reject(f)});return new _.Gs(d,()=>e())},KM=function(a){return new _.Gs(Promise.reject(a),
4
+ ()=>Promise.resolve())},LM=function(a){return new _.Gs(Promise.all(a.map(b=>b.U)),()=>Promise.all(a.map(b=>b.abort())))},MM=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},NM=function(a){return a===_.q||a===_.t},OM=function(a){return 1>=a?0:Math.floor(Math.random()*a)},PM=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)},QM=function(a){if(!a)return null;const b=
5
+ /^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},RM=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},SM=function(a){a=
6
+ Number(a);return 0===a%1?a:null},TM=function(a){a=Number(a);return 0===a%1&&0<a?a:null},UM=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},VM=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},WM=function(a){return a?"true"===a.toLowerCase():!1},XM=function(a){var b=void 0===b?1024:b;if(!(a instanceof Uint8Array))return"";if(typeof b!==_.r||0>=b)b=1024;return(a.byteLength>b?a.subarray(0,b):a).toString()},YM=function(a,b){if(0>b||b>=a.a)throw new _.ql(`SegmentTimelineIndex: out of bounds: ${b}/${a.a}`);
7
+ a:{var c=0;let d=a.f.length-1;for(;c<=d;){const e=Math.floor((c+d)/2),f=a.f[e],g=f.Oe+f.count-1;if(b<f.Oe)d=e-1;else if(b>g)c=e+1;else{c=e;break a}}c=-1}if(0>c)throw new _.ql(`SegmentTimelineIndex: index not found: ${b}/${a.a}`);a=a.f[c];return{mf:a,Re:b-a.Oe}},ZM=function(a,b){a=YM(a,b);b=a.mf;return b.startTime+a.Re*b.duration},$M=function(a,b){b=YM(a,b);a=b.mf;b=b.Re;return b===a.count-1&&null!=a.Ne?a.Ne:a.startTime+b*a.duration+a.duration},aN=function(a,b){a=YM(a,b);b=a.mf;return b.ej+a.Re*b.dj},
8
+ bN=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=
9
+ 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})},fN=function(a,b){var c=cN(a,b,BM);let d=1;c&&(d=TM(c)||1);c=cN(a,b,sM);(c=TM(c||""))&&(c/=d);let e=Number(cN(a,b,yM))||0,f=e/d||0;a.ii&&null!=a.zd&&a.zd!==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 "+
10
+ `value will be ignored. (Period ID: ${a.Ga.id}, `+`Representation ID: ${a.O.id})`),e=a.zd*d,f=a.zd);var g=cN(a,b,"startNumber");let h=UM(g||"");if(null==g||null==h)h=1;g=cN(a,b,"endNumber");g=null!==g?UM(g||""):null;var k=dN(a,b,pM),l=null;if(k){{l=d;var m=e,n=a.Ha.duration||Infinity;const y=_.O;k=y.a(k,"S");const A=[];var p=0;let E=0;for(let B=0;B<k.length;++B){const F=k[B];var u=y.$(F,"t",UM);const ia=y.$(F,"d",UM);var v=y.$(F,"r",SM);null!=u&&(u-=m);if(!ia){_.C('"S" element must have a duration:',
11
+ wM,F);break}u=null!=u?u:p;v=v||0;if(0>v)if(B+1<k.length){v=y.$(k[B+1],"t",UM);if(null==v){_.C('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:',wM,F);break}else if(u>=v){_.C('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',wM,F);break}v=Math.ceil((v-u)/ia)-1}else{if(Infinity===n){_.C(qM,"if the Period has an infinite duration:",vM,F);break}else if(u/l>=n){_.C(qM,"if its start time exceeds the Period's duration:",
12
+ vM,F);break}v=Math.ceil((n*l-u)/ia)-1}0<A.length&&u!==p&&(Math.abs((u-p)/l)>=_.du&&_.C("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",F),A[A.length-1].Ne=u/l);p=v+1;A.push({Oe:E,count:p,startTime:u/l,duration:ia/l,ej:u,dj:ia,Ne:null});E+=p;p=u+p*ia}l=new eN(A)}}a=cN(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,Ia:c,Fc:h,Me:g,Lb:f,Cf:e,ua:l,Fe:b}},cN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ga)].filter(_.Km).map(d=>
13
+ d.getAttribute(c)).reduce((d,e)=>d||e)},dN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ga)].filter(_.Km).map(d=>_.O.h(d,c)).reduce((d,e)=>d||e)},hN=function(a,b,c,d,e,f){const g=_.O,h=g.getAttributeNS(a,uM,"href"),k=g.getAttributeNS(a,uM,"actuate")||"onRequest";g.ve(a,uM);if(5<=f)return KM(new _.I(_.D,4,4028));if("onLoad"!==k)return KM(new _.I(_.D,4,4027));const l=_.mB([d],[h]);d=_.wk(l,b);d.type=1;return JM(e.fetch(d),m=>{m=_.ni(m.data);m=g.j(m,a.tagName);if(!m)return KM(new _.I(_.D,4,4001,{uri:h}));
14
+ g.ue(a);g.ke(m,a);g.je(m,a);return gN(a,b,c,l[0],e,f+1)})},gN=function(a,b,c,d,e,f){f=void 0===f?0:f;var g=_.O;if(g.getAttributeNS(a,uM,"href"))return g=hN(a,b,c,d,e,f),c&&(g=JM(g,void 0,()=>gN(a,b,c,d,e,f))),g;const h=[],k=g.$d(a);for(const l of k)"urn:mpeg:dash:resolve-to-zero:2013"===g.getAttributeNS(l,uM,"href")?g.removeChild(a,l):l.tagName!==pM&&h.push(gN(l,b,c,d,e,f));return JM(LM(h),()=>a)},iN=function(a,b){const c=a.Ha.start;var d=a.presentationTimeline;d.o||(d.I=Math.floor(Math.max(d.I||
15
+ 0,b.Dd+c)));a.xg||_.gC(a.presentationTimeline,{he:b.he+c,Dd:b.Dd+c,ge:b.ge},"notifySegmentSummary")},jN=function(a){return""===a.id?`${a.schemeIdUri}:${a.startTime}:${a.endTime}`:a.id},kN=function(a,b,c,d,e){return _.w(function*(){const f=_.VB(a,b,c,e);f.type=2;return(yield _.qm(d,f,{objectType:"i"}).U).data})},mN=function(a,b,c,d){let e;var f=(new _.ip).ea("sidx",g=>{e=lN(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=c[0];a=_.G(a);_.yh('Invalid box type. Expected "sidx", but received:',
16
+ a,"from:",g,"byte range:",f);throw new _.I(_.D,3,3004,{url:g,qj:f,size:a.byteLength,Gj:XM(a)});}},lN=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.N(d.reader);if(0===f)throw _.yh("Invalid timescale."),new _.I(_.D,3,3005);if(0===d.version){var g=_.N(d.reader);var h=_.N(d.reader)}else g=_.Xo(d.reader),h=_.Xo(d.reader);d.reader.skip(2);const k=_.Vo(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.N(d.reader);const m=(l&2147483648)>>>31;l&=2147483647;const n=_.N(d.reader);d.reader.skip(4);if(1===
17
+ m)throw _.yh("Hierarchical SIDXs are not supported."),new _.I(_.D,3,3006);e.push(new _.uC(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},nN=function(a){var b=_.Uo(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.I(_.D,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Uo(a.a);return d},qN=function(a){var b=nN(a);if(7<b.length)throw new _.I(_.D,3,3002);var c=0;for(var d=0;d<b.length;d++)c=256*c+b[d];b=c;c=nN(a);a:{for(e of oN)if(_.em(c,new Uint8Array(e))){var e=
18
+ !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(_.D,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 pN(b,e)},rN=function(a){if(8<a.a.byteLength)throw new _.I(_.D,3,3002);if(8===a.a.byteLength&&a.a.getUint8(0)&224)throw new _.I(_.D,3,3001);let b=0;for(let c=0;c<a.a.byteLength;c++){const d=
19
+ a.a.getUint8(c);b=256*b+d}return b},uN=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new sN(a.a);let k=null,l=null;for(;_.So(a.a);){var m=qN(a);if(187===m.id){var n=tN(m);n&&(m=c*n.fj,n=b+n.Hi,null!=k&&g.push(new _.uC(g.length,k-f,m-f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.uC(g.length,k-f,d-f,h,l,null,f));return g},tN=function(a){var b=new sN(a.a);a=qN(b);if(179!==a.id)throw _.C("Not a CueTime element."),new _.I(_.D,3,3013);a=rN(a);b=qN(b);if(183!==b.id)throw _.C("Not a CueTrackPositions element."),
20
+ new _.I(_.D,3,3012);b=new sN(b.a);let c=0;for(;_.So(b.a);){const d=qN(b);if(241===d.id){c=rN(d);break}}return{fj:a,Hi:c}},vN=function(a,b){var c=dN(a,b,"Initialization");if(!c)return null;let d=a.O.oa;b=()=>"";const e=c.getAttribute("sourceURL")||void 0;e&&(d=_.mB(a.O.oa,[e]),b=()=>e);let f=0,g=null;if(c=_.O.$(c,"range",RM))f=c.start,g=c.end;return new _.pI(()=>d,f,g,null,null,b,a.O.Ka)},wN=function(a){return a.Hd},yN=function(a,b,c,d,e,f,g){const h=a.presentationTimeline,k=!a.Le||!a.Ha.wg,l=a.Ha.start,
21
+ m=a.Ha.duration;let n=null;return{createSegmentIndex:function(p,u){return _.w(function*(){var v=[kN(c,d,e,p,u),"webm"===f?kN(b.Ea(),b.ma,b.ja,p,u):null];v=yield Promise.all(v);var y=v[0];const A=v[1]||null;y="mp4"===f?mN(y,d,c,g):(new xN).parse(y,A,c,g);NM(a.O.contentType)&&_.hC(h,y,l);n=new _.tI(y);k&&_.RB(n,m);return v})},findSegmentPosition:function(p){return n.f(p)},getSegmentReference:function(p){return n.get(p)},adjustSegmentDurations:function(p,u){return n.h(p,u)},getDuration:function(){return null!=
22
+ m?m:n.getDuration()},getLastSegmentEndTime:()=>m}},zN=function(a){const b=[...a.a.a];if(b.length){a=b[0].startTime;var c=b[b.length-1].endTime;{let e=0;for(d of b)e=Math.max(e,d.endTime-d.startTime);var d=e}a={he:a,Dd:c,ge:d}}else a=null;return a},BN=function(a,b,c){const d=b.a();b=a.Ha.duration;const e=a.Ha.wg;if(!a.Le)return a=new _.tI(d),_.RB(a,b),new AN(a);{var f=a.Ga;const g=a.O;f=f&&f.id&&g&&g.id?`${f.id},${g.id}`:null}if(!a.xg||null==c[f])return a=new _.tI(d),e||_.RB(a,b),c[f]=a,new AN(a);
23
+ c=c[f];e||_.RB(new _.tI(d),b);_.vC(c,d);_.wC(c,_.kC(a.presentationTimeline)-a.Ha.start);return new AN(c)},DN=function(a){const b=cN(a,CN,"initialization");if(!b)return null;const c=a.O.id,d=a.bandwidth||null,e=a.O.oa,f=()=>bN(b,c,null,d,null);return new _.pI(function(){const g=f();return _.mB(e,[g])},0,null,null,null,f,a.O.Ka)},EN=function(a,b){const c=b.Ve,d=a.Ha.duration,e=b.Ia,f=b.Fc,g=b.Me,h=b.timescale,k=a.bandwidth||null,l=a.O.id,m=a.O.oa,n=a.O.Ka;return{createSegmentIndex:Promise.resolve.bind(Promise),
24
+ findSegmentPosition:function(p){return 0>p||d&&p>=d?null:Math.floor(p/e)},getSegmentReference:function(p){const u=p+f;if(null!==g&&u>g)return null;const v=p*e;let y=v+e;d&&(y=Math.min(y,d));if(0>y||d&&v>=d)return null;const A=()=>bN(c,l,u,k,v*h);return new _.uC(p,v,y,function(){const E=A();return _.mB(m,[E])},0,null,b.Lb,null,null,null,null,null,null,null,null,A,n)},adjustSegmentDurations:()=>{},getDuration:()=>d,getLastSegmentEndTime:()=>d}},FN=function(a,b){const c=b.Ve,d=b.ua;if(0===d.a)return[];
25
+ const e=[],f=a.O.id,g=a.bandwidth||null,h=a.O.oa;a=a.O.Ka;for(let k=0;k<d.a;k++){const l=k+b.Fc,m=aN(d,k)+b.Cf,n=()=>bN(c,f,l,g,m),p=ZM(d,k),u=$M(d,k);e.push(new _.uC(l,p,u,()=>{const v=n();return _.mB(h,[v])},0,null,b.Lb,null,null,null,null,null,null,null,null,n,a))}return e},CN=function(a){return a.kc},GN=function(a){return a.jc},HN=function(a,b,c,d,e){let f=e.Dc.length;e.ua&&e.ua.a!==e.Dc.length&&(f=Math.min(e.ua.a,e.Dc.length),_.C("The number of items in the segment timeline and the number of",
26
+ "segment URLs do not match, truncating",e.Dc.length,"to",f));const g=[];var h=e.startTime;for(let k=0;k<f;k++){const l=e.Dc[k],m=_.mB(c,[l.zg]);let n;n=null!=e.Ia?h+e.Ia:e.ua?$M(e.ua,k):h+a;g.push(new _.uC(k+b,h,n,()=>m,l.start,l.end,e.Lb,null,null,null,null,null,null,null,null,()=>l.zg,d));h=n}return g},IN=function(a){return[a.O.jc,a.xa.jc,a.Ga.jc].filter(_.Km).map(b=>_.O.a(b,"SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Se&&(a.Se=!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."));
27
+ const c=b.getAttribute("media");b=_.O.$(b,"mediaRange",RM,{start:0,end:null});return{zg:c,start:b.start,end:b.end}})},KN=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(zM),value:e.getAttribute(_.ug)}));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:EM,value:d}));return 0===c.length?(a.g.warn(lM),Promise.reject(Error(lM))):MM(c,e=>{const f=e.scheme;e=e.value;switch(f){case EM:case "urn:mpeg:dash:utc:http-head:2012":return JN(a,
28
+ 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 JN(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"),
29
+ Promise.reject();default:return a.g.warn("Unrecognized scheme in UTCTiming element",f),Promise.reject()}}).catch(()=>{a.g.warn(iM);return Promise.reject(Error(iM))})},LN=function(a,b,c,d){return _.w(function*(){const e=_.O.a(b,"UTCTiming");try{const f=yield KN(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})},JN=function(a,b,
30
+ c,d){return _.w(function*(){var e=_.mB(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=_.ni(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()})},NN=function(a,b){return a.find(c=>MN.get(c.Yb)===b)},PN=function(a){const b=_.O;var c=b.Pb(a.node,CM,"pro");
31
+ if(!c)return ON.warn(kM,a),null;c=b.f(c);if(!c)return ON.warn(dM,a),null;a=_.bm(c);a=_.hq(a);a=_.$p(a.a);return{keyId:null,Yb:GM,node:b.Kc(),init:[{initData:_.$A(a),initDataType:_.Wc,keyId:null}]}},QN=function(a,b){b=void 0===b?"4.0.0.0":b;const c=_.O;a=c.Pb(a.node,DM,"pssh");if(!a)return null;a=c.f(a);if(!a)return null;a=_.bm(a);a=_.bq(a);return a?(b=_.aB(b,a.a))?{keyId:null,Yb:FM,node:c.Kc(),init:[{initData:_.$A(b),initDataType:_.Wc,keyId:null}]}:null:(_.C("Unable to parse WV PSSH data. Can not create PR data!"),
32
+ null)},RN=function(a,b){const c=_.O;var d=c.Pb(a.node,CM,"pro");if(!d)return _.C(kM,a),null;d=c.f(d);if(!d)return _.C(dM,a),null;a=_.bm(d);a=_.hq(a);return a.version!==b&&(_.xh(`Parsing from ${a.version} to ${b}.`),a=_.bB(a,b))?{keyId:null,Yb:FM,node:c.Kc(),init:[{initData:_.$A(a),initDataType:_.Wc,keyId:null}]}:null},UN=function(a,b,c,d){const e=SN(a);let f=null;a=[];let g=[];const h=NN(e,_.wd),k=NN(e,_.ud);if(k&&d){var l=RN(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=PN(k))&&e.push(l);h&&!k&&(d=QN(h,
33
+ d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.I(_.D,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"===m.Yb?(f=m.init||f,!1):!0),g.length&&(a=TN(f,g,c),0===a.length&&(a=[_.nB(_.Ge,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of MN.values())m!==_.Qe&&a.push(_.nB(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{fd:b,tj:f,drmInfos:a,gg:!0}},SN=function(a){const b=[];for(const c of a)(a=VN(c))&&
34
+ b.push(a);return b},TN=function(a,b,c){const d=[];for(const f of b){var e=MN.get(f.Yb);if(e){b=_.nB(e,f.init||a,c);if(e=WN.get(e))(e=e(f))?(b.licenseServerUri=e.licenseUrl,b.licenseServerUriOrigin=e.origin):b.licenseServerUri="";d.push(b)}}return d},XN=function(a,b,c,d,e){const f=UN(a,c,d,e);if(b.gg){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.fd=f.fd||b.fd;b.gg=!1}else if(0<f.drmInfos.length&&(b.drmInfos=b.drmInfos.filter(g=>
35
+ f.drmInfos.some(h=>h.keySystem===g.keySystem)),0===b.drmInfos.length))throw new _.I(_.D,4,4008);return f.fd||b.fd},YN=function(a){const b=_.O;a=b.vc(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[OM(a.length)]},VN=function(a){const b=_.O;let c=a.getAttribute(zM),d=b.getAttributeNS(a,DM,"default_KID");const e=b.vc(a,DM,"pssh").map(b.f),f=b.Pb(a,CM,"pro");if(!c)return _.yh("Missing required schemeIdUri attribute on","ContentProtection element",
36
+ a),null;c=c.toLowerCase();if(d&&(d=d.replace(/-/g,"").toLowerCase(),d.includes(" ")))throw new _.I(_.D,4,4009);let g=[];try{if(g=e.map(h=>({initDataType:_.Wc,initData:_.bm(h),keyId:null})),0===g.length&&f&&b.f(f))try{const h=b.f(f),k=_.bm(h),l=_.hq(k);g.push({initDataType:_.Wc,initData:_.$A(l),keyId:null})}catch(h){_.C("Unable to parse ms:pro payload",h),g=[]}}catch(h){throw new _.I(_.D,4,4007);}return{node:a,Yb:c,keyId:d,init:0<g.length?g:null}},ZN=function(a,b,c){if(a.length){c=c||`${"__clpp_baseUriCollection_"}
37
+ ${b.length}`;const d=[];a.forEach(e=>{const f=e.getAttribute("serviceLocation");e=_.O.f(e);f&&e&&d.push({serviceLocationId:f,uri:e,params:{}})});if(d.length)return a=new _.xI(c,d),b.push(a),a}return null},aO=function(a,b){a=$N(a).filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime());0<a.length&&(a=Math.min(...a),_.fC(b.presentationTimeline,a+b.Ha.start))},bO=function(a,b){return _.WB(_.Um(a,b))?_.K:a.split("/")[0]},$N=function(a){const b=new Set;a.forEach(c=>{c.variants.forEach(d=>
38
+ {d.audio&&b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},dO=function(a){return _.w(function*(){var b=a.w?a.w.getBaseUriCollectionById(jM):null;var c=[];b&&(c=_.TC(b,""));0===c.length&&(c=a.o);var d=_.wk(c,a.a.attemptParameters);d.type=1;c=Date.now();d=a.D.networkingEngine.fetch(d);_.Gl(a.A,d);var e=yield d.U;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 cO(a,e.data,e.uri);f.manifest.contentSteering&&(a.w=yield a.D.onContentSteeringInfoFound(f.manifest.contentSteering));
39
+ if(a.w&&b){0!==e.request.uriIndex&&a.w.banLocation(b.oa[0].serviceLocationId);var g=e.request,h=e.timeMs;e=e.data.byteLength;h&&e&&a.w.notifyThroughput(b.oa[g.uriIndex].serviceLocationId,h,e)}b=(Date.now()-c)/1E3;_.TB(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.cj){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.H(_.Ee))}return b})},eO=function(a,b){0>a.l||a.B.la(Math.max(3,a.l-b,_.UB(a.I)))},cO=function(a,b,c){return _.w(function*(){var d=_.ni(b);_.wm(xM);d=_.O.j(d,"MPD");
40
+ _.wm("parse.xml.end");_.ym(xM,xM,"parse.xml.end");if(!d)throw new _.I(_.D,4,4001,c);d=gN(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.Gl(a.A,d);d=yield d.U;return fO(a,d,c)})},fO=function(a,b,c){return _.w(function*(){var d=_.O;const e=[];var f=[c],g=d.a(b,jM),h=g.map(d.f).filter(_.Km);0<h.length&&(f=_.mB(f,h),a.o=f,ZN(g,e,jM));g=d.a(b,eM);h=g.map(d.f);var k=_.mB(f,h);ZN(g,e,eM);f=b.getAttribute("type")||AM;a.l=d.$(b,"minimumUpdatePeriod",QM,-1);f===AM&&0<=a.l&&(a.g.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),
41
+ a.l=-1,a.B.stop());g=d.$(b,"maxSegmentDuration",QM);if(d=f===AM&&"dynamic"===a.C)a.g.info("MPD dynamic to static transition."),f="dynamic";h=f===AM;var l="dynamic"===f;if(a.f)var m=a.f.presentationTimeline;else{var n=_.O;m=a.a.timeline||{};var p=n.$(b,"suggestedPresentationDelay",QM),u=n.$(b,"minBufferTime",QM,0);p=null!=a.a.suggestedPresentationDelay?a.a.suggestedPresentationDelay:a.a.lowLatencyMode?0:null!=p?p:3*u;n=n.$(b,"availabilityStartTime",PM);m=new _.sI(m,n,p,h,!!a.a.autoCorrectDrift,!!a.a.lowLatencyMode);
42
+ m=h?m:LN(a.J,b,k,m)}m=yield m;n=_.O.$(b,"timeShiftBufferDepth",QM);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(_.D,7,7001);n={Le:l,xg:null!=a.f,presentationTimeline:m,Ga:null,Ha:null,xa:null,O:null,bandwidth:0,Se:!1,ii:d,lc:null,zd:null};k=gO(a,n,k,e,b);p=k.duration;l=k.periods;d&&(aO(l,n),m.C=!0);if(h||!d&&!k.dg)m.f=p||Infinity;if(2===a.a.timeline.version){h=p;n=l[0].startTime;if(null==
43
+ h||Infinity===h)h=hO(l);p=m.a;_.$B(p,n,n+h);d&&(p.f=!0)}_.iC(m,g||1);m.isLive()||Infinity!==m.f&&!m.o||2===m.j.version&&m.a.getDuration();if(!a.f){a.f={presentationTimeline:m,periods:l,minBufferTime:0,cues:[]};a:{l=_.O;if(m=l.h(b,"ContentSteering"))if(g=m.getAttribute("defaultServiceLocation")||"",h=l.f(m)){l=l.$(m,"queryBeforeStart",WM,!1);g={manifestType:_.xc,contentSteeringServerUri:h,defaultServiceLocation:g,queryBeforeStart:l||!1,baseUriCollections:[]};break a}g=null}g&&(a.f.contentSteering=
44
+ g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,cj:d}})},gO=function(a,b,c,d,e){const f=_.O,g=f.$(e,"mediaPresentationDuration",QM),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,_.Pf,QM,m);var p=f.$(n,sM,QM);let y=null;if(v!==e.length-1){var u=f.$(e[v+1],_.Pf,QM);null!=u&&(y=u-m)}else null!=g&&(y=g-m);u=_.du;y&&p&&Math.abs(y-p)>u&&a.g.warn("There is a gap/overlap between Periods",
45
+ n);null==y&&(y=p);n=iO(a,b,c,d,{start:m,duration:y,node:n,wg:null==y||v===e.length-1});p=n.Ga;l.push(p);k=k.concat(n.cues);a.G.includes(p.id)||(a.G.push(p.id),a.f&&(a.D.filterNewPeriod(p),a.f.periods.push(p)));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=jO(a,k);return null!=g?(m!==g&&a.g.warn("@mediaPresentationDuration does not match the total duration of ",
46
+ "all Periods."),{periods:l,duration:g,dg:!1,cues:k}):{periods:l,duration:m,dg:!0,cues:k}},hO=function(a){return a.map(b=>b.variants[0].video||b.variants[0].audio).reduce((b,c)=>c?c.getDuration():0+b,0)},iO=function(a,b,c,d,e){var f=_.O;b.Ga=kO(a,e.node,null,c,d);b.Ha=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=>lO(a,e.start,e.duration,A));f=f.a(e.node,
47
+ _.fa).map(A=>mO(a,b,A)).filter(_.Km);if(b.Le){var g=[];for(var h of f)for(var k of h.Ji)g.push(k);if(g.length!==(new Set(g)).size)throw new _.I(_.D,4,4018);}h=f.filter(A=>!A.Af);k=f.filter(A=>A.Af);for(var l of k){l.streams.forEach(A=>{A.trickPlay=!0});k=l.streams[0];g=l.Af;for(var m of h)if(g.includes(m.id))for(var n of m.streams)n.trickModeVideo=k}m=nO(f,_.t);n=nO(h,_.q);if(!m.length&&!n.length)throw new _.I(_.D,4,4004);n.length||(n=[null]);m.length||(m=[null]);l=[];for(var p of n)for(var u of m)oO(a,
48
+ p,u,l);u=[...nO(h,_.K),...nO(h,_.RA)];p=[];for(var v of u)p.push.apply(p,v.streams);u=nO(h,_.ge);v=[];for(var y of u)v.push.apply(v,y.streams);y=pO(e,h);return{Ga:{id:c,configurationId:a.D.configurationId,startTime:e.start,endTime:y,textStreams:p,thumbStreams:v,variants:l},cues:d}},jO=function(a,b){const c=new Set(b.map(jN));a.j.forEach((d,e)=>{c.has(e)||a.j.delete(e)});b.forEach(d=>{const e=jN(d);a.j.has(e)||a.j.set(e,d)});return Array.from(a.j.values())},kO=function(a,b,c,d,e){const f=_.O;c=c||
49
+ {contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,We:null,Ka:e?e.find(u=>u.id===eM)||null:null};d=d||c.oa;var g=f.a(b,eM);const h=g.map(f.f);e=e?ZN(g,e,b.getAttribute("id")||void 0):null;g=b.getAttribute("contentType")||c.contentType;const k=b.getAttribute(_.Be)||c.mimeType,l=b.getAttribute(_.pd)||c.codecs,m=f.$(b,"frameRate",VM)||c.frameRate,n=qO(f.a(b,"InbandEventStream"),c.emsgSchemeIdUris),p=f.a(b,"AudioChannelConfiguration");a=rO(a,p)||c.We;g||(g=bO(k,l));return{oa:_.mB(d,
50
+ h),Ka:e||c.Ka,Hd:f.h(b,"SegmentBase")||c.Hd,jc:f.h(b,"SegmentList")||c.jc,kc:f.h(b,"SegmentTemplate")||c.kc,width:f.$(b,_.Mg,UM)||c.width,height:f.$(b,_.be,UM)||c.height,contentType:g,mimeType:k,codecs:l,frameRate:m,emsgSchemeIdUris:n,id:b.getAttribute("id")||"",We:a}},lO=function(a,b,c,d){const e=_.O,f=d.getAttribute(zM)||"",g=d.getAttribute(_.ug)||"",h=e.$(d,BM,UM)||1,k=e.$(d,yM,UM)||0,l=[];for(const n of e.a(d,"Event")){d=e.$(n,"presentationTime",UM)||0;var m=e.$(n,sM,UM)||0;d=b+d/h-k/h;m=d+m/
51
+ h;null!=c&&(d=Math.min(d,b+c),m=Math.min(m,b+c));let p=_.lg;f.startsWith(_.qg)?p=_.Gf:"urn:mpeg:dash:event:callback:2015"===f&&(p=_.Fe);const u={configurationId:a.D.configurationId,schemeIdUri:f,value:g,startTime:d,endTime:m,id:n.getAttribute("id")||"",type:p,eventElement:e.Ld(n)};u.type===_.Fe&&(u.oe=()=>{if(u.eventElement){var v=u.eventElement.getAttribute("messageData")||"";v&&v.startsWith("http")&&(v=_.wk(v),v.type=_.vk,a.D.networkingEngine.fetch(v))}});l.push(u)}return l},mO=function(a,b,c){var d=
52
+ _.O;b.xa=kO(a,c,b.Ga,null,null);var e=b.xa.contentType===_.K;const f=sO(c),{kind:g,Cd:h,roles:k}=tO(c,e);let l=null;try{l=uO(c)}catch(y){return null}const m=d.a(c,"Accessibility"),n=vO(m);var p=d.a(c,gM);const u=UN(p,a.a.ignoreDrmInfo,b.Ga.id,a.a.playreadyVersion||null),v=c.getAttribute("lang")||_.kg;p=_.Hn(v);d=d.a(c,_.nb);c=d.map(y=>wO(a,b,u,g,v,f||"",h,k,n,y)).filter(_.Km);if(0===c.length){if(e)return null;throw new _.I(_.D,4,4003);}if(!b.xa.contentType||b.xa.contentType===rM){b.xa.contentType=
53
+ bO(c[0].mimeType,c[0].codecs);for(const y of c)y.type=b.xa.contentType}for(const y of c)for(const A of u.drmInfos)y.keyId&&!A.keyIds.includes(y.keyId)&&A.keyIds.push(y.keyId);c=xO(c,b.xa.contentType,m);e=d.map(y=>y.getAttribute("id")).filter(_.Km);return{id:b.xa.id||"__fake__"+a.h++,contentType:b.xa.contentType,language:p,originalLanguage:v,Cd:h,streams:c,drmInfos:u.drmInfos,Af:l,Ji:e}},nO=function(a,b){return a.filter(c=>c.contentType===b)},oO=function(a,b,c,d){if(b||c)if(b&&c){if(_.GB(b.drmInfos,
54
+ c.drmInfos)){var e=_.FB(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.Cd||c.Cd,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||_.kg,primary:f.Cd,audio:b?e:null,video:c?e:null,bandwidth:g,drmInfos:f.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(g)}},
55
+ pO=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},sO=function(a){let b=null;const c=_.O.a(a,"Label").map(_.O.f).filter(_.Km);c&&0<c.length&&(b=c[c.length-1]);null==b&&(b=a.getAttribute("label"));return b},tO=function(a,b){let c=!1;const d=_.O.a(a,"Role");a=d.map(f=>f.getAttribute(_.ug)).filter(_.Km);let e=
56
+ void 0;b&&(e=_.RA);for(const f of d)if(b=f.getAttribute(zM),null==b||"urn:mpeg:dash:role:2011"===b||"urn:mpeg:dash:role"===b)switch(b=f.getAttribute(_.ug),b){case _.we:c=!0;break;case _.CA:case _.RA:e=b;break;case "forced-subtitle":case "forced_subtitle":case _.Zd:e=_.Zd}return{Cd:c,roles:a,kind:e}},uO=function(a){var b=_.O.a(a,hM);a=null;for(const c of b){b=c.getAttribute(zM)||"";const d=c.getAttribute(_.ug);if(b!==tM&&!yO.includes(b)||void 0===d)throw new _.ql("Unrecognized essential property");
57
+ b===tM&&(a=d.split(" "))}return a},vO=function(a){const b=new Map;for(const e of a)if(a=e.getAttribute(zM),"urn:scte:dash:cc:cea-608:2015"===a||"urn:scte:dash:cc:cea-708:2015"===a){a=1;var c=e.getAttribute(_.ug);if(null!=c)for(const f of c.split(";")){if(f.includes("\x3d")){var d=f.split("\x3d");c=d[0].startsWith("CC")?d[0]:"CC"+d[0];d=d[1].split(",")[0].split(":").pop()}else c="CC"+a,a+=2,d=f;b.set(c,_.Hn(d))}else b.set("CC1",_.kg)}return b},wO=function(a,b,c,d,e,f,g,h,k,l){const m=_.O,n=_.Hn(e);
58
+ b.O=kO(a,l,b.xa,null,null);if(!zO(a,b.O))return a.g.warn("Skipping Representation",b.O),null;b.lc=`${b.Ga.id} ${b.O.id}`;b.zd=a.F.get(b.lc);b.bandwidth=m.$(l,"bandwidth",TM)||0;const p=AO(a,b);if(!p)return null;a.F.set(b.lc,p.Ca);var u=m.a(l,gM);a=XN(u,c,a.a.ignoreDrmInfo,b.Ga.id,a.a.playreadyVersion||null);u=!1;m.a(l,"SupplementalProperty").some(v=>"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===v.getAttribute(zM)&&"JOC"===v.getAttribute(_.ug))&&(b.O.mimeType="audio/eac3-joc",u=!0);l=BO(b,l);
59
+ return{id:_.oI++,originalId:b.O.id,createSegmentIndex:p.createSegmentIndex,findSegmentPosition:p.findSegmentPosition,getSegmentReference:p.getSegmentReference,initSegmentReference:p.initSegmentReference,adjustSegmentDurations:p.adjustSegmentDurations,getLastSegmentEndTime:p.getLastSegmentEndTime,getDuration:p.getDuration,segmentLookupStrategy:_.HA,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,
60
+ keyId:a,language:n,originalLanguage:e,label:f,type:b.xa.contentType,primary:g,trickModeVideo:null,emsgSchemeIdUris:b.O.emsgSchemeIdUris,roles:h,channelsCount:b.O.We,spatialAudio:u,closedCaptions:k,horizontalTiles:l.horizontalTiles,verticalTiles:l.verticalTiles,durationPerTile:l.durationPerTile}},xO=function(a,b,c){const d=b===_.RA?_.K:b;b=c.map(e=>({scheme:e.getAttribute(zM)||"",id:e.getAttribute("id")||void 0,value:e.getAttribute(_.ug)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=
61
+ b;return a},zO=function(a,b){let c;c=b.Hd?1:0;c+=b.jc?1:0;c+=b.kc?1:0;if(0===c){if(b.contentType===_.K||b.contentType===rM)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.",
62
+ b),b.Hd?(a.g.info("Using SegmentBase by default."),b.jc=null):a.g.info("Using SegmentList by default."),b.kc=null);return!0},AO=function(a,b){var c=b.O.contentType;c=c===_.K||c===rM;try{if(b.O.Hd){{const A=Number(cN(b,wN,yM))||0,E=cN(b,wN,BM);var d=1;E&&(d=TM(E)||1);var e=A/d||0,f=vN(b,wN);{d=f;var g=e;const B=b.O.mimeType.split("/")[1];if(b.O.contentType!==_.K&&"mp4"!==B&&"webm"!==B)throw _.yh("SegmentBase specifies an unsupported container type.",b.O),new _.I(_.D,4,4006);if("webm"===B&&!d)throw _.yh(mM,
63
+ "the SegmentBase uses a WebM container,","but does not contain an Initialization element.",b.O),new _.I(_.D,4,4005);const F=dN(b,wN,"RepresentationIndex"),ia=cN(b,wN,"indexRange");let Xa=b.O.oa,cb=RM(ia||"");if(F){const rc=F.getAttribute("sourceURL");rc&&(Xa=_.mB(b.O.oa,[rc]));cb=_.O.$(F,"range",RM,cb)}if(!cb)throw _.yh(mM,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",b.O),new _.I(_.D,4,4002);NM(b.O.contentType)&&(b.presentationTimeline.B=null);var h=yN(b,d,Xa,
64
+ cb.start,cb.end,B,g)}var k={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:f,getLastSegmentEndTime:h.getLastSegmentEndTime,Ca:e}}}else{if(b.O.jc){{var l=a.H;const A=vN(b,GN);{const F=IN(b),ia=fN(b,GN);let Xa=ia.Fc;0===Xa&&(_.C("SegmentList@startNumber must be \x3e 0"),Xa=1);h=0;ia.Ia?h=ia.Ia*(Xa-1):ia.ua&&0<ia.ua.a&&(h=ia.ua.h);
65
+ var m={Ia:ia.Ia,startTime:h,Fc:Xa,Lb:ia.Lb,ua:ia.ua,Dc:F}}if(!m.Ia&&!m.ua&&1<m.Dc.length)throw _.C(nM,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",b.O),new _.I(_.D,4,4002);if(!m.Ia&&!b.Ha.duration&&!m.ua&&1===m.Dc.length)throw _.C(nM,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",b.O),new _.I(_.D,4,4002);if(m.ua&&0===m.ua.a)throw _.C(nM,"the SegmentList has an empty timeline.",
66
+ b.O),new _.I(_.D,4,4002);const E=HN(b.Ha.duration,m.Fc,b.O.oa,b.O.Ka,m),B=BN(b,new CO(E),l);if(NM(b.O.contentType)){const F=zN(B);F&&iN(b,F)}d={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:B.findSegmentPosition.bind(B),getSegmentReference:B.getSegmentReference.bind(B),adjustSegmentDurations:B.adjustSegmentDurations.bind(B),getDuration:B.getDuration.bind(B),initSegmentReference:A,getLastSegmentEndTime:B.getLastSegmentEndTime.bind(B),Ca:m.Lb}}}else{if(b.O.kc){{var n=a.H,p=!!a.f;
67
+ const A=DN(b);{const B=fN(b,CN),F=cN(b,CN,"media"),ia=cN(b,CN,"index");e={Ia:B.Ia,timescale:B.timescale,Fc:B.Fc,Me:B.Me,Lb:B.Lb,Cf:B.Cf,ua:B.ua,Ve:F,vd:ia,Fe:B.Fe}}{let B;B=e.vd?1:0;B+=e.ua?1:0;B+=e.Ia?1:0;if(0===B)throw _.yh("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template","a SegmentTimeline, or a segment duration.",b.O),new _.I(_.D,4,4002);1!==B&&(_.C("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,",
68
+ "a SegmentTimeline or a segment duration.",b.O),e.vd?(_.wh("Using the index URL template by default."),e.ua=null):_.wh("Using the SegmentTimeline by default."),e.Ia=null);if(!e.vd&&!e.Ve)throw _.yh(oM,"the SegmentTemplate's media URL template is missing.",b.O),new _.I(_.D,4,4002);}const E=NM(b.O.contentType);h=null;if(e.vd){E&&(b.presentationTimeline.B=null);{f=A;const B=b.O.mimeType.split("/")[1];if("mp4"!==B&&"webm"!==B)throw _.yh("SegmentTemplate specifies an unsupported container type.",b.O),
69
+ new _.I(_.D,4,4006);if("webm"===B&&!f)throw _.yh(oM,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",b.O),new _.I(_.D,4,4005);const F=bN(e.vd,b.O.id,null,b.bandwidth||null,null),ia=_.mB(b.O.oa,[F]);h=yN(b,f,ia,0,null,B,e.Lb)}}else if(e.Ia){if(!p&&E){b.presentationTimeline.B=null;var u=b.presentationTimeline;u.G=Math.max(u.G,e.Fe);u.g.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+u.G);_.iC(b.presentationTimeline,e.Ia);var v=b.presentationTimeline,
70
+ y=b.Ha.start;v.l=null==v.l?y:Math.min(v.l,y)}h=EN(b,e)}else{const B=FN(b,e),F=BN(b,new DO(B),n);if(E){const ia=zN(F);ia&&iN(b,ia)}h={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:F.findSegmentPosition.bind(F),getSegmentReference:F.getSegmentReference.bind(F),adjustSegmentDurations:F.adjustSegmentDurations.bind(F),getDuration:F.getDuration.bind(F),getLastSegmentEndTime:F.getLastSegmentEndTime.bind(F)}}g={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,
71
+ getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:A,getLastSegmentEndTime:h.getLastSegmentEndTime,Ca:e.Lb}}}else g=EO(b);d=g}k=d}return k}catch(A){if(c&&4002===A.code)return a.g.debug("Ignoring DASH_NO_SEGMENT_INFO error in a text stream",A),null;throw A;}},BO=function(a,b){const c={};if(a.O.contentType===_.ge){var d=(b=_.O.h(b,hM))&&b.getAttribute(zM);d=d||"";FO.includes(d)&&(b=_.zB(b.getAttribute(_.ug)||""))&&
72
+ (c.horizontalTiles=b.sd,c.verticalTiles=b.Nd,a.xa.kc&&(d=_.O.$(a.xa.kc,sM,UM)||0,a=_.O.$(a.xa.kc,BM,UM)||1,a=d/a))&&(c.durationPerTile=a/b.Zi)}return c},EO=function(a){const b=a.O.oa,c=a.Ha.duration||0,d=()=>c;return{createSegmentIndex:()=>Promise.resolve(),findSegmentPosition:e=>0<=e&&e<c?1:null,getSegmentReference:e=>1!==e?null:new _.uC(1,0,c,()=>b,0,null,0,null,null,null,null,null,null,null,null,()=>"",a.O.Ka),adjustSegmentDurations:()=>{},getDuration:d,getLastSegmentEndTime:d,verticalTiles:void 0,
73
+ horizontalTiles:void 0,initSegmentReference:null,Ca:0}},qO=function(a,b){b=b.slice();for(const c of a)(a=c.getAttribute(zM))&&!b.includes(a)&&b.push(a);return b},rO=function(a,b){for(const d of b){b=d.getAttribute(zM);if(!b)continue;const e=d.getAttribute(_.ug);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(fM,
74
+ 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(fM,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};_.bv.prototype.Ld=HM(19,function(a){return a});
75
+ _.DB.prototype.Ld=HM(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}/>`,_.$f).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.Ld(d))});return c});
76
+ _.bv.prototype.ve=HM(17,function(a,b){Array.from(a.attributes).forEach(c=>{c.namespaceURI===b&&a.removeAttributeNS(c.namespaceURI,c.localName)})});_.DB.prototype.ve=HM(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]})}});_.bv.prototype.je=HM(15,function(a,b){for(const c of a.attributes)b.setAttributeNS(c.namespaceURI,c.nodeName,c.value)});
77
+ _.DB.prototype.je=HM(14,function(a,b){Object.keys(a.attributes).forEach(c=>{b.attributes[c]=a.attributes[c]})});_.bv.prototype.ke=HM(13,function(a,b){Array.from(a.childNodes).forEach(c=>{a.removeChild(c);b.appendChild(c)})});_.DB.prototype.ke=HM(12,function(a,b){b.childNodes.push(...a.childNodes);a.childNodes=[]});_.bv.prototype.ue=HM(11,function(a){Array.from(a.childNodes).forEach(b=>{a.removeChild(b)})});_.DB.prototype.ue=HM(10,function(a){a.childNodes=[]});_.bv.prototype.Kc=HM(9,function(){return document.createElement("null")});
78
+ _.DB.prototype.Kc=HM(8,function(){return new _.BB("NULL",null,{},[],null,null,new Map)});_.bv.prototype.$d=HM(7,function(a){return Array.from(a.childNodes).filter(b=>b instanceof Element)});_.DB.prototype.$d=HM(6,function(a){return a.childNodes});_.bv.prototype.$=HM(5,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});_.DB.prototype.$=HM(4,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});
79
+ _.bv.prototype.vc=HM(3,function(a,b,c){return Array.from(a.childNodes).filter(d=>d instanceof Element&&d.localName===c&&d.namespaceURI===b)});_.DB.prototype.vc=HM(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)});_.bv.prototype.Pb=HM(1,function(a,b,c){a=this.vc(a,b,c);return 1!==a.length?null:a[0]});_.DB.prototype.Pb=HM(0,function(a,b,c){a=this.vc(a,b,c);return 1!==a.length?null:a[0]});
80
+ var eN=class{constructor(a){this.f=a;this.a=a.reduce((b,c)=>b+c.count,0);this.h=0<this.a?a[0].startTime:0}};var FO=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],yO=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var DO=class{constructor(a){this.f=a}a(){return this.f}},CO=class{constructor(a){this.f=a}a(){return this.f}};var sN=class{constructor(a){this.f=a;this.a=new _.aq(a,!1)}},oN=[[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]],pN=class{constructor(a,b){this.id=a;this.a=b}};var xN=class{parse(a,b,c,d){var e;b=new sN(new DataView(b));if(440786851!==qN(b).id)throw _.yh("Not an EBML element."),new _.I(_.D,3,3008);var f=qN(b);if(408125543!==f.id)throw _.yh("Not a Segment element."),new _.I(_.D,3,3009);b=f.a.byteOffset;f=new sN(f.a);for(e=null;_.So(f.a);){var g=qN(f);if(357149030===g.id){e=g;break}}if(!e)throw _.yh("Not an Info element."),new _.I(_.D,3,3010);f=new sN(e.a);g=1E6;for(e=null;_.So(f.a);){const h=qN(f);if(2807729===h.id)g=rN(h);else if(17545===h.id)if(e=h,4===
81
+ e.a.byteLength)e=e.a.getFloat32(0);else if(8===e.a.byteLength)e=e.a.getFloat64(0);else throw new _.I(_.D,3,3003);}if(null==e)throw new _.I(_.D,3,3011);f=g/=1E9;e*=g;a=qN(new sN(new DataView(a)));if(475249515!==a.id)throw _.yh("Not a Cues element."),new _.I(_.D,3,3007);return uN(a,b,f,e,c,d)}};var AN=class{constructor(a){this.a=a}findSegmentPosition(a){return this.a.f(a)}getSegmentReference(a){return this.a.get(a)}adjustSegmentDurations(a,b){this.a.h(a,b)}getDuration(){return this.a.getDuration()}getLastSegmentEndTime(){return _.tC(this.a)}};var GO=class{constructor(a,b){this.g=a;this.f=b;this.a={clockSyncUri:void 0}}};var MN=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Qe).set(GM,_.wd).set(FM,_.ud).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.ud).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.sd).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.rd),WN=(new Map).set(_.wd,function(a){const b=YN(a);if(b)return{licenseUrl:b,origin:_.FA};if(a=_.O.Pb(a.node,"urn:microsoft","laurl"))if(a=a.getAttribute("licenseUrl"))return{licenseUrl:a,origin:"ms:laurl"};return null}).set(_.ud,
82
+ function(a){var b=_.O;const c=YN(a);if(c)return{licenseUrl:c,origin:_.FA};a=b.Pb(a.node,CM,"pro");if(!a)return null;b=b.f(a);if(!b)return null;b=_.bm(b);return(b=_.hq(b).h)?{licenseUrl:b,origin:"mspr:pro"}:null}),ON=new _.T("clpp.dash.ContentProtection");var HO=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 _.qI(5);this.B=new _.Li(()=>{this.Wb()});this.A=new _.Zt;this.j=new Map;this.g=new _.T("clpp.dash.DashParser");this.C=null;this.J=new GO(this.g,(a,b)=>{a=_.wk(a,this.a.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.Gl(this.A,b);return b.U});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=
83
+ this;return _.w(function*(){c.o=[a];c.D=b;const d=yield dO(c);c.D&&eO(c,d);if(!c.D)throw new _.I(_.D,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(){dO(this).catch(a=>{if(this.D&&a)this.D.onError(a)})}setCurrentVariant(){}Wb(){const a=this;return _.w(function*(){a.g.debug(_.xA);let b=0;try{b=yield dO(a)}catch(c){if(a.D&&c.a&&(a.D.onError(c),
84
+ c.severity===_.D))return}a.D&&(a.K?yield a.stop():eO(a,b))})}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(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 _.ql(`Could not load text stream with id: ${a}`);return d})}};_.x("clpp.dash.DashComponent",class extends _.yv{install(){_.Et.mpd=HO;_.Dt[_.xc]=HO}uninstall(){_.QC("mpd");_.RC(_.xc)}id(){return"dash"}});};f.call(g, window);