@castlabs/prestoplay 1.1.1-beta.2

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 (64) hide show
  1. package/CHANGELOG.md +768 -0
  2. package/README.md +52 -0
  3. package/cjs/cl.adobe.js +8 -0
  4. package/cjs/cl.airplay.js +8 -0
  5. package/cjs/cl.broadpeak.js +11 -0
  6. package/cjs/cl.cast.js +117 -0
  7. package/cjs/cl.conviva.js +38 -0
  8. package/cjs/cl.core.js +565 -0
  9. package/cjs/cl.crypto.js +15 -0
  10. package/cjs/cl.dash.js +78 -0
  11. package/cjs/cl.externs.js +4112 -0
  12. package/cjs/cl.freewheel.js +29 -0
  13. package/cjs/cl.hls.js +72 -0
  14. package/cjs/cl.hlssmpte.js +11 -0
  15. package/cjs/cl.htmlcue.js +35 -0
  16. package/cjs/cl.ima.js +29 -0
  17. package/cjs/cl.mse.js +279 -0
  18. package/cjs/cl.muxdata.js +19 -0
  19. package/cjs/cl.onboard.js +8 -0
  20. package/cjs/cl.persistent.js +19 -0
  21. package/cjs/cl.playlist.js +11 -0
  22. package/cjs/cl.simid.js +21 -0
  23. package/cjs/cl.smooth.js +76 -0
  24. package/cjs/cl.thumbnails.js +29 -0
  25. package/cjs/cl.tizen.js +76 -0
  26. package/cjs/cl.ttml.js +33 -0
  27. package/cjs/cl.verimatrix.js +10 -0
  28. package/cjs/cl.vimond.js +18 -0
  29. package/cjs/cl.vr.js +25 -0
  30. package/cjs/cl.vtt.js +19 -0
  31. package/cjs/cl.youbora.js +25 -0
  32. package/cjs/polyfill.min.js +47 -0
  33. package/cl.adobe.js +3 -0
  34. package/cl.airplay.js +3 -0
  35. package/cl.broadpeak.js +5 -0
  36. package/cl.cast.js +88 -0
  37. package/cl.conviva.js +27 -0
  38. package/cl.core.js +466 -0
  39. package/cl.crypto.js +9 -0
  40. package/cl.dash.js +68 -0
  41. package/cl.externs.js +4028 -0
  42. package/cl.freewheel.js +19 -0
  43. package/cl.hls.js +69 -0
  44. package/cl.hlssmpte.js +5 -0
  45. package/cl.htmlcue.js +26 -0
  46. package/cl.ima.js +17 -0
  47. package/cl.mse.js +241 -0
  48. package/cl.muxdata.js +12 -0
  49. package/cl.onboard.js +4 -0
  50. package/cl.persistent.js +11 -0
  51. package/cl.playlist.js +5 -0
  52. package/cl.simid.js +13 -0
  53. package/cl.smooth.js +59 -0
  54. package/cl.thumbnails.js +17 -0
  55. package/cl.tizen.js +57 -0
  56. package/cl.ttml.js +22 -0
  57. package/cl.verimatrix.js +4 -0
  58. package/cl.vimond.js +8 -0
  59. package/cl.vr.js +15 -0
  60. package/cl.vtt.js +12 -0
  61. package/cl.youbora.js +15 -0
  62. package/clpp.styles.css +166 -0
  63. package/package.json +63 -0
  64. package/typings.d.ts +8255 -0
package/cl.crypto.js ADDED
@@ -0,0 +1,9 @@
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var fO=function(a){a=_.Mh(a);const b=new Uint32Array(4);for(let c=0;4>c;c++)b[c]=a.getUint32(4*c);return b},hO=function(a,b){return c=>_.x(function*(){const d=c.request||null;if(d&&2===d.type&&d.keyInfo&&c.data){const e=d.uris[0];a.h.debug("Decrypting AES-128-encrypted video segment",e);c.data=yield gO(a,b,c.data,d.keyInfo,e)}return c})},gO=function(a,b,c,d,e){return _.x(function*(){let f=new ArrayBuffer(0);try{f=yield iO(a,b,d.url)}catch(g){return a.h.warn("Could not fetch AES key",
2
+ g),b.onError(new _.H(1,7,7104,null,g)),c}try{const g=a.l?new jO:new kO;yield g.importKey(f);return yield g.decrypt(c,d.iv)}catch(g){return a.h.warn("Could not decrypt segment data!",e,g),b.onError(new _.H(1,3,3103,null,g)),c}})},iO=function(a,b,c){return _.x(function*(){const d=_.si(c),e=(new _.qh(c)).Ha.endsWith(".drmtoday.com");if(e){var f=b.getConfiguration();_.pl(d,f)}f=c+JSON.stringify(d.headers);if(a.j[f])return a.j[f];try{const g=yield b.getNetworkEngine().fetch(d).P;return a.j[f]=g.data}catch(g){throw e&&
3
+ 1001===g.code&&412===g.data.status&&a.h.warn("Wrong DRMtoday credentials, server responded with 412."),g;}})},kO=class{constructor(){this.B=[0,1,2,4,8,16,32,64,128,27,54];this.C=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.l=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.A=new Uint32Array(256);this.o=new Uint32Array(256);this.w=new Uint32Array(0);this.g=this.a=this.j=this.f=null;{const c=this.A,d=this.o;var a=
4
+ this.C;const e=a[0],f=a[1],g=a[2];a=a[3];var b=this.l;const h=b[0],k=b[1],l=b[2];b=b[3];const m=new Uint32Array(256);let n=0,q=0,u;for(u=0;256>u;u++)m[u]=128>u?u<<1:u<<1^283;for(u=0;256>u;u++){let v=q^q<<1^q<<2^q<<3^q<<4;v=v>>>8^v&255^99;c[n]=v;d[v]=n;const y=m[n],A=m[y],D=m[A];let E=257*m[v]^16843008*v;e[n]=E<<24|E>>>8;f[n]=E<<16|E>>>16;g[n]=E<<8|E>>>24;a[n]=E;E=16843009*D^65537*A^257*y^16843008*n;h[v]=E<<24|E>>>8;k[v]=E<<16|E>>>16;l[v]=E<<8|E>>>24;b[v]=E;n?(n=y^m[m[m[D^y]]],q^=m[m[q]]):n=q=1}}}importKey(a){a=
5
+ fO(a);for(var b=!0,c=0;c<a.length&&b;)b=a[c]===this.w[c],c++;if(b)return new Promise(m=>m());this.w=a;this.a=a.length;if(4!==this.a&&6!==this.a&&8!==this.a)throw Error("Invalid aes key size\x3d"+this.a);this.g=4*(this.a+7);this.f=new Uint32Array(this.g);this.j=new Uint32Array(this.g);b=this.A;const d=this.B;var e=this.l;c=e[0];const f=e[1],g=e[2],h=e[3];let k=0,l=0;for(e=0;e<this.g;e++)e<this.a?k=this.f[e]=a[e]:(l=k,0===e%this.a?(l=l<<8|l>>>24,l=b[l>>>24]<<24|b[l>>>16&255]<<16|b[l>>>8&255]<<8|b[l&
6
+ 255],l^=d[e/this.a|0]<<24):6<this.a&&4===e%this.a&&(l=b[l>>>24]<<24|b[l>>>16&255]<<16|b[l>>>8&255]<<8|b[l&255]),k=(this.f[e-this.a]^l)>>>0,this.f[e]=k);for(a=0;a<this.g;a++)e=this.g-a,l=a&3?this.f[e]:this.f[e-4],this.j[a]=4>a||4>=e?l:c[b[l>>>24]]^f[b[l>>>16&255]]^g[b[l>>>8&255]]^h[b[l&255]],this.j[a]>>>=0;return new Promise(m=>m())}decrypt(a,b){let c=0;const d=this.a+6,e=this.j,f=this.o;var g=this.l;const h=g[0],k=g[1],l=g[2];g=g[3];var m=fO(b);b=m[0];let n=m[1],q=m[2];m=m[3];a=_.Lh(a);const u=new Int32Array(a.length);
7
+ let v,y,A;let D,E,O,tb,Nb,Yc,Pf,Va,Xd;const tc=this.F.bind(this);for(;c<a.length;){tb=tc(a[c]);Nb=tc(a[c+1]);Yc=tc(a[c+2]);Pf=tc(a[c+3]);D=tb^e[0];E=Pf^e[1];O=Yc^e[2];var ea=Nb^e[3];Va=4;for(Xd=1;Xd<d;Xd++)v=h[D>>>24]^k[E>>16&255]^l[O>>8&255]^g[ea&255]^e[Va],y=h[E>>>24]^k[O>>16&255]^l[ea>>8&255]^g[D&255]^e[Va+1],A=h[O>>>24]^k[ea>>16&255]^l[D>>8&255]^g[E&255]^e[Va+2],ea=h[ea>>>24]^k[D>>16&255]^l[E>>8&255]^g[O&255]^e[Va+3],D=v,E=y,O=A,Va+=4;v=f[D>>>24]<<24^f[E>>16&255]<<16^f[O>>8&255]<<8^f[ea&255]^
8
+ e[Va];y=f[E>>>24]<<24^f[O>>16&255]<<16^f[ea>>8&255]<<8^f[D&255]^e[Va+1];A=f[O>>>24]<<24^f[ea>>16&255]<<16^f[D>>8&255]<<8^f[E&255]^e[Va+2];ea=f[ea>>>24]<<24^f[D>>16&255]<<16^f[E>>8&255]<<8^f[O&255]^e[Va+3];Va+=3;u[c]=tc(v^b);u[c+1]=tc(ea^n);u[c+2]=tc(A^q);u[c+3]=tc(y^m);b=tb;n=Nb;q=Yc;m=Pf;c+=4}return new Promise(bb=>{{var Oa=u.buffer;const gb=Oa.byteLength,wc=gb&&(new DataView(Oa)).getUint8(gb-1);Oa=wc?Oa.slice(0,gb-wc):Oa}bb(Oa)})}destroy(){this.B=this.j=this.f=this.l=this.C=this.o=this.A=this.g=
9
+ this.a=this.w=null;return new Promise(a=>a())}F(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24}};var jO=class{constructor(){this.a=null}importKey(a){const b=this;return _.x(function*(){b.a=yield crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"])})}decrypt(a,b){const c=this;return _.x(function*(){return yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a)})}destroy(){this.a=null;return new Promise(a=>a())}};_.z("clpp.crypto.CryptoComponent",class extends _.xs{constructor(){super();this.j={};this.l=!1;this.h=new _.R("clpp.crypto")}f(){if(window.crypto&&crypto.subtle){var a=crypto.subtle.decrypt;a=typeof crypto.subtle.importKey===_.Od&&typeof a===_.Od}else a=!1;(this.l=a)||this.h.warn("No WebCrypto APIs found. Will fallback to software AES")}o(a){const b=hO(this,a);a.getNetworkEngine().Ic(b)}a(){this.j={}}id(){return"crypto"}});};f.call(g, window);
package/cl.dash.js ADDED
@@ -0,0 +1,68 @@
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var qG="Channel parsing failure! Ignoring scheme and value",rG="ContentProtection",sG="EssentialProperty",tG="Failed to parse UTCTiming tags.",uG="Missing \x3cms:pro/\x3e node in ContentProtection element",vG="No UTCTiming elements found.",wG="SegmentBase does not contain sufficient segment information:",xG="SegmentList does not contain sufficient segment information:",yG="SegmentTemplate does not contain sufficient segment information:",zG="SegmentTimeline",AG='The last "S" element cannot have a negative repeat',
2
+ BG="application",CG="duration",DG="http://dashif.org/guidelines/trickmode",EG="http://www.w3.org/1999/xlink",FG='ignoring the last "S" element.',GG='ignoring the remaining "S" elements.',HG="presentationTimeOffset",IG="schemeIdUri",JG="static",KG="timescale",LG="urn:microsoft:playready",MG="urn:mpeg:cenc:2013",NG="urn:mpeg:dash:utc:http-head:2014",OG="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",PG="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",QG=function(a,b){a.B=Math.max(a.B,b);a.h.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+
3
+ a.B)},RG=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},SG=function(a){return new _.zn(Promise.reject(a),()=>Promise.resolve())},TG=function(a){return new _.zn(Promise.all(a.map(b=>b.P)),()=>Promise.all(a.map(b=>b.abort())))},UG=function(a,b,c){return Array.prototype.filter.call(a.childNodes,d=>d instanceof Element&&d.localName==c&&d.namespaceURI==b)},VG=function(a,b,c){a=UG(a,b,c);return 1!=a.length?null:a[0]},WG=function(a,b,c){return a.hasAttributeNS(b,
4
+ c)?a.getAttributeNS(b,c):null},XG=function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e},YG=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)},ZG=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*
5
+ 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},$G=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},aH=function(a){a=Number(a);return 0===a%1?a:null},bH=function(a){a=Number(a);return 0===a%1&&0<a?a:null},cH=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},dH=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?
6
+ Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},eH=function(a,b){try{const c=_.Ph(a);return _.Ml(c,b)}catch(c){return null}},fH=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()},gH=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"$";
7
+ 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,
8
+ 10)||1;return Array(Math.max(0,k-g.length)+1).join("0")+g})},jH=function(a,b){var c=hH(a,b,KG);let d=1;c&&(d=bH(c)||1);c=hH(a,b,CG);(c=bH(c||""))&&(c/=d);let e=Number(hH(a,b,HG))||0,f=e/d||0;a.Ag&&null!=a.Vc&&a.Vc!==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.va.id}, `+`Representation ID: ${a.N.id})`),e=a.Vc*
9
+ d,f=a.Vc);var g=hH(a,b,"startNumber");let h=cH(g||"");if(null==g||null==h)h=1;g=hH(a,b,"endNumber");g=null!==g?cH(g||""):null;var k=iH(a,b,zG),l=null;if(k){{l=d;var m=e,n=a.ga.duration||Infinity;k=_.Jl(k,"S");const A=[];var q=0;for(let D=0;D<k.length;++D){var u=k[D],v=XG(u,"t",cH);const E=XG(u,"d",cH);var y=XG(u,"r",aH);null!=v&&(v-=m);if(!E){_.C('"S" element must have a duration:',GG,u);break}v=null!=v?v:q;y=y||0;if(0>y)if(D+1<k.length){y=XG(k[D+1],"t",cH);if(null==y){_.C('An "S" element cannot have a negative repeat',
10
+ 'if the next "S" element does not have a valid start time:',GG,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:',GG,u);break}y=Math.ceil((y-v)/E)-1}else{if(Infinity==n){_.C(AG,"if the Period has an infinite duration:",FG,u);break}else if(v/l>=n){_.C(AG,"if its start time exceeds the Period's duration:",FG,u);break}y=Math.ceil((n*l-v)/E)-1}0<A.length&&v!=q&&(Math.abs((v-q)/l)>=_.pr&&_.C("SegmentTimeline contains a large gap/overlap:",
11
+ "the content may have errors in it.",u),A[A.length-1].end=v/l);for(u=0;u<=y;++u)q=v+E,A.push({start:v/l,end:q/l,hh:v}),v=q}l=A}}a=hH(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,za:c,mc:h,Sd:g,lb:f,De:e,timeline:l,Jd:b}},hH=function(a,b,c){return[b(a.N),b(a.ua),b(a.va)].filter(_.kh).map(d=>d.getAttribute(c)).reduce((d,e)=>d||e)},iH=function(a,b,c){return[b(a.N),b(a.ua),b(a.va)].filter(_.kh).map(d=>_.Kl(d,c)).reduce((d,e)=>d||e)},lH=function(a,
12
+ b,c,d,e,f){const g=WG(a,EG,"href"),h=WG(a,EG,"actuate")||"onRequest";for(let l=0;l<a.attributes.length;l++){const m=a.attributes[l];m.namespaceURI==EG&&(a.removeAttributeNS(m.namespaceURI,m.localName),--l)}if(5<=f)return SG(new _.H(_.G,4,4028));if("onLoad"!=h)return SG(new _.H(_.G,4,4027));const k=_.Px([d],[g]);d=_.si(k,b);d.type=1;return e.fetch(d).kd(l=>{l=eH(l.data,a.tagName);if(!l)return SG(new _.H(_.G,4,4001,{uri:g}));for(;a.childNodes.length;)a.removeChild(a.childNodes[0]);for(;l.childNodes.length;){var m=
13
+ l.childNodes[0];l.removeChild(m);a.appendChild(m)}for(m=0;m<l.attributes.length;m++){const n=l.attributes[m].nodeName,q=l.getAttribute(n);a.setAttribute(n,q)}return kH(a,b,c,k[0],e,f+1)})},kH=function(a,b,c,d,e,f=0){if(WG(a,EG,"href")){var g=lH(a,b,c,d,e,f);c&&(g=g.kd(void 0,()=>kH(a,b,c,d,e,f)));return g}g=[];for(let h=0;h<a.childNodes.length;h++){const k=a.childNodes[h];k instanceof Element&&("urn:mpeg:dash:resolve-to-zero:2013"==WG(k,EG,"href")?(a.removeChild(k),--h):k.tagName!=zG&&g.push(kH(k,
14
+ b,c,d,e,f)))}return TG(g).kd(()=>a)},nH=function(a,b,c,d){let e;var f=(new _.dl).$("sidx",g=>{e=mH(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=c[0];a=_.J(a);_.Ng('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.H(_.G,3,3004,{url:g,th:f,size:a.byteLength,Oh:fH(a)});}},mH=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.P(d.reader);if(0==f)throw _.Ng("Invalid timescale."),new _.H(_.G,3,3005);if(0==d.version){var g=_.P(d.reader);
15
+ var h=_.P(d.reader)}else g=_.Rk(d.reader),h=_.Rk(d.reader);d.reader.skip(2);const k=_.Pk(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 _.Ng("Hierarchical SIDXs are not supported."),new _.H(_.G,3,3006);e.push(new _.Fy(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},oH=function(a){var b=_.Ok(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.H(_.G,3,3002);
16
+ const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Ok(a.a);return d},rH=function(a){var b=oH(a);if(7<b.length)throw new _.H(_.G,3,3002);var c=0;for(var d=0;d<b.length;d++)c=256*c+b[d];b=c;c=oH(a);a:{for(e of pH)if(_.hi(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 _.H(_.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();
17
+ e=new DataView(a.f.buffer,a.f.byteOffset+a.a.getPosition(),c);a.a.skip(c);return new qH(b,e)},sH=function(a){if(8<a.a.byteLength)throw new _.H(_.G,3,3002);if(8==a.a.byteLength&&a.a.getUint8(0)&224)throw new _.H(_.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},vH=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new tH(a.a);let k=null,l=null;for(;_.Mk(a.a);){var m=rH(a);if(187==m.id){var n=uH(m);n&&(m=c*n.ih,n=b+n.Sg,null!=k&&g.push(new _.Fy(g.length,k-f,m-
18
+ f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.Fy(g.length,k-f,d-f,h,l,null,f));return g},uH=function(a){var b=new tH(a.a);a=rH(b);if(179!=a.id)throw _.C("Not a CueTime element."),new _.H(_.G,3,3013);a=sH(a);b=rH(b);if(183!=b.id)throw _.C("Not a CueTrackPositions element."),new _.H(_.G,3,3012);b=new tH(b.a);let c=0;for(;_.Mk(b.a);){const d=rH(b);if(241==d.id){c=sH(d);break}}return{ih:a,Sg:c}},wH=function(a,b){b=iH(a,b,"Initialization");if(!b)return null;let c=a.N.Ta;var d=b.getAttribute("sourceURL");
19
+ d&&(c=_.Px(a.N.Ta,[d]));a=0;d=null;if(b=XG(b,"range",$G))a=b.start,d=b.end;return new _.cD(()=>c,a,d)},zH=function(a,b){var c=Number(hH(a,xH,HG))||0,d=hH(a,xH,KG),e=1;d&&(e=bH(d)||1);c=c/e||0;d=wH(a,xH);{e=a.N.mimeType.split("/")[1];if(a.N.contentType!=_.t&&e!=_.pe&&"webm"!=e)throw _.Ng("SegmentBase specifies an unsupported container type.",a.N),new _.H(_.G,4,4006);if("webm"==e&&!d)throw _.Ng(wG,"the SegmentBase uses a WebM container,","but does not contain an Initialization element.",a.N),new _.H(_.G,
20
+ 4,4005);const g=iH(a,xH,"RepresentationIndex");var f=hH(a,xH,"indexRange");let h=a.N.Ta;f=$G(f||"");if(g){const k=g.getAttribute("sourceURL");k&&(h=_.Px(a.N.Ta,[k]));f=XG(g,"range",$G,f)}if(!f)throw _.Ng(wG,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",a.N),new _.H(_.G,4,4002);a=yH(a,b,d,h,f.start,f.end,e,c)}return{createSegmentIndex:a.createSegmentIndex,findSegmentPosition:a.findSegmentPosition,getSegmentReference:a.getSegmentReference,adjustSegmentDurations:a.adjustSegmentDurations,
21
+ getDuration:a.getDuration,initSegmentReference:d,getLastSegmentEndTime:a.getLastSegmentEndTime,ya:c}},xH=function(a){return a.bd},yH=function(a,b,c,d,e,f,g,h){const k=a.presentationTimeline,l=!a.uc||!a.ga.$d,m=a.ga.start,n=a.ga.duration;let q=b,u=null;return{createSegmentIndex:function(){return _.x(function*(){var v=[q(d,e,f),"webm"==g?q(c.Ka(),c.ta,c.ha):null];q=null;v=yield Promise.all(v);var y=v[0];const A=v[1]||null;y=g==_.pe?nH(y,e,d,h):(new AH).parse(y,A,d,h);_.vy(k,y,m);u=new _.gD(y);l&&_.oy(u,
22
+ n);return v})},findSegmentPosition:function(v){return u.f(v)},getSegmentReference:function(v){return u.get(v)},adjustSegmentDurations:function(v,y){return u.g(v,y)},getDuration:function(){return u.getDuration()},getLastSegmentEndTime:()=>n}},HH=function(a,b,c,d){const e=BH(a),f=CH(a);DH(a,f);var g=null;if(f.Sc)g=EH(a,b,e,f);else if(f.za)d||(QG(a.presentationTimeline,f.Jd),_.wy(a.presentationTimeline,f.za),_.uy(a.presentationTimeline,a.ga.start)),g=FH(a,f);else{let h=null;b=null;a.va.id&&a.N.id&&(b=
23
+ a.va.id+","+a.N.id,h=c[b]);d=GH(a,f);g=!a.uc||!a.ga.$d;h?(g&&_.oy(new _.gD(d),a.ga.duration),_.Gy(h,d),_.Hy(h,_.yy(a.presentationTimeline)-a.ga.start)):(_.vy(a.presentationTimeline,d,a.ga.start),h=new _.gD(d),b&&a.uc&&(c[b]=h));g&&_.oy(h,a.ga.duration);g={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:h.f.bind(h),getSegmentReference:h.get.bind(h),adjustSegmentDurations:h.g.bind(h),getDuration:h.getDuration.bind(h),getLastSegmentEndTime:()=>_.Ey(h)}}return{createSegmentIndex:g.createSegmentIndex,
24
+ findSegmentPosition:g.findSegmentPosition,getSegmentReference:g.getSegmentReference,adjustSegmentDurations:g.adjustSegmentDurations,getDuration:g.getDuration,initSegmentReference:e,getLastSegmentEndTime:g.getLastSegmentEndTime,ya:f.lb}},BH=function(a){const b=hH(a,IH,"initialization");if(!b)return null;const c=a.N.id,d=a.bandwidth||null,e=a.N.Ta;return new _.cD(function(){const f=gH(b,c,null,d,null);return _.Px(e,[f])},0,null)},CH=function(a){const b=jH(a,IH),c=hH(a,IH,"media");a=hH(a,IH,"index");
25
+ return{za:b.za,timescale:b.timescale,mc:b.mc,Sd:b.Sd,lb:b.lb,De:b.De,timeline:b.timeline,fe:c,Sc:a,Jd:b.Jd}},DH=function(a,b){let c;c=b.Sc?1:0;c+=b.timeline?1:0;c+=b.za?1:0;if(0==c)throw _.Ng("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template","a SegmentTimeline, or a segment duration.",a.N),new _.H(_.G,4,4002);1!=c&&(_.C("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,",
26
+ "a SegmentTimeline or a segment duration.",a.N),b.Sc?(_.Lg("Using the index URL template by default."),b.timeline=null):_.Lg("Using the SegmentTimeline by default."),b.za=null);if(!b.Sc&&!b.fe)throw _.Ng(yG,"the SegmentTemplate's media URL template is missing.",a.N),new _.H(_.G,4,4002);},EH=function(a,b,c,d){const e=a.N.mimeType.split("/")[1];if(e!=_.pe&&"webm"!=e)throw _.Ng("SegmentTemplate specifies an unsupported container type.",a.N),new _.H(_.G,4,4006);if("webm"==e&&!c)throw _.Ng(yG,"the SegmentTemplate uses a WebM container,",
27
+ "but does not contain an initialization URL template.",a.N),new _.H(_.G,4,4005);var f=gH(d.Sc,a.N.id,null,a.bandwidth||null,null);f=_.Px(a.N.Ta,[f]);return yH(a,b,c,f,0,null,e,d.lb)},FH=function(a,b){const c=a.ga.duration,d=b.za,e=b.mc,f=b.Sd,g=b.timescale,h=b.fe,k=a.bandwidth||null,l=a.N.id,m=a.N.Ta;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(n){return 0>n||c&&n>=c?null:Math.floor(n/d)},getSegmentReference:function(n){const q=n+e;if(null!==f&&q>f)return null;
28
+ const u=n*d;let v=u+d;c&&(v=Math.min(v,c));return 0>v||c&&u>=c?null:new _.Fy(n,u,v,function(){const y=gH(h,l,q,k,u*g);return _.Px(m,[y])},0,null,b.lb)},adjustSegmentDurations:function(){},getDuration:function(){return c},getLastSegmentEndTime:()=>c}},GH=function(a,b){const c=[];for(let d=0;d<b.timeline.length;d++){const e=d+b.mc;c.push(new _.Fy(e,b.timeline[d].start,b.timeline[d].end,function(f,g,h,k,l,m){f=gH(f,g,l,h,m);return _.Px(k,[f]).map(n=>n.toString())}.bind(null,b.fe,a.N.id,a.bandwidth||
29
+ null,a.N.Ta,e,b.timeline[d].hh+b.De),0,null,b.lb))}return c},IH=function(a){return a.kc},NH=function(a,b){const c=wH(a,JH),d=KH(a);LH(a,d);let e=null,f=null;a.va.id&&a.N.id&&(f=a.va.id+","+a.N.id,e=b[f]);const g=MH(a.ga.duration,d.mc,a.N.Ta,d);e?(_.Gy(e,g),_.Hy(e,_.yy(a.presentationTimeline)-a.ga.start)):(_.vy(a.presentationTimeline,g,a.ga.start),e=new _.gD(g),f&&a.uc&&(b[f]=e));a.uc&&a.ga.$d||_.oy(e,a.ga.duration);return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.f.bind(e),
30
+ getSegmentReference:e.get.bind(e),adjustSegmentDurations:e.g.bind(e),getDuration:e.getDuration.bind(e),initSegmentReference:c,getLastSegmentEndTime:()=>_.Ey(e),ya:d.lb}},JH=function(a){return a.Ub},KH=function(a){const b=OH(a);a=jH(a,JH);let c=a.mc;0==c&&(_.C("SegmentList@startNumber must be \x3e 0"),c=1);let d=0;a.za?d=a.za*(c-1):a.timeline&&0<a.timeline.length&&(d=a.timeline[0].start);return{za:a.za,startTime:d,mc:c,lb:a.lb,timeline:a.timeline,hc:b}},LH=function(a,b){if(!b.za&&!b.timeline&&1<b.hc.length)throw _.C(xG,
31
+ "the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",a.N),new _.H(_.G,4,4002);if(!b.za&&!a.ga.duration&&!b.timeline&&1==b.hc.length)throw _.C(xG,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",a.N),new _.H(_.G,4,4002);if(b.timeline&&0==b.timeline.length)throw _.C(xG,"the SegmentList has an empty timeline.",a.N),new _.H(_.G,4,4002);},MH=function(a,b,c,d){let e=d.hc.length;d.timeline&&
32
+ d.timeline.length!=d.hc.length&&(e=Math.min(d.timeline.length,d.hc.length),_.C("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",d.hc.length,"to",e));const f=[];var g=d.startTime;for(let h=0;h<e;h++){const k=d.hc[h],l=_.Px(c,[k.Hg]);let m;m=null!=d.za?g+d.za:d.timeline?d.timeline[h].end:g+a;f.push(new _.Fy(h+b,g,m,()=>l,k.start,k.end,d.lb));g=m}return f},OH=function(a){return[a.N.Ub,a.ua.Ub,a.va.Ub].filter(_.kh).map(b=>_.Jl(b,"SegmentURL")).reduce((b,
33
+ c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Zd&&(a.Zd=!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=XG(b,"mediaRange",$G,{start:0,end:null});return{Hg:c,start:b.start,end:b.end}})},QH=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(IG),value:e.getAttribute(_.Kf)}));const d=a.a.clockSyncUri;!c.length&&d&&(a.h.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),
34
+ c.push({scheme:NG,value:d}));return 0===c.length?(a.h.warn(vG),Promise.reject(Error(vG))):RG(c,e=>{const f=e.scheme;e=e.value;switch(f){case NG:case "urn:mpeg:dash:utc:http-head:2012":return PH(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 PH(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)?
35
+ (a.h.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.h.warn("NTP UTCTiming scheme is not supported"),Promise.reject();default:return a.h.warn("Unrecognized scheme in UTCTiming element",f),Promise.reject()}}).catch(()=>{a.h.warn(tG);return Promise.reject(Error(tG))})},RH=function(a,b,c,d){return _.x(function*(){const e=_.Jl(b,"UTCTiming");
36
+ try{const f=yield QH(a,c,e);d.C=f;a.h.info("Clock synchronized. The difference between server and "+`client clock was ${f} ms.`)}catch(f){a.h.warn("Failed to synchronize clocks. This content may not play on clients with bad clocks!")}return d})},PH=function(a,b,c,d){return _.x(function*(){var e=_.Px(b,[c]);e=yield a.f(e,d);if("HEAD"==d){if(!e.headers||!e.headers.date)throw a.h.warn("UTC timing response is missing","expected date header"),Error("Date HTTP header missing.");e=e.headers.date}else e=
37
+ _.Ph(e.data);e=Date.parse(e);if(isNaN(e))throw a.h.warn("Unable to parse date from UTC timing response"),Error("Date value invalid.");return e-Date.now()})},TH=function(a,b){return a.find(c=>SH.get(c.Eb)===b)},VH=function(a){const b=VG(a.node,LG,"pro");if(!b)return UH.warn(uG,a),null;a=_.ei(b.textContent);a=_.Xl(a);a=_.Pl(a.a);return{keyId:null,Eb:PG,node:document.createElement("null"),init:[{initData:_.Fx(a),initDataType:_.Sc,keyId:null}]}},WH=function(a,b){b=void 0===b?"4.0.0.0":b;const c=VG(a.node,
38
+ MG,"pssh");if(!c)return _.C("Missing \x3ccenc:pssh/\x3e node in ContentProtection element",a),null;a=_.ei(c.textContent);a=_.Rl(a);return a?(b=_.Gx(b,a.a))?{keyId:null,Eb:OG,node:document.createElement("null"),init:[{initData:_.Fx(b),initDataType:_.Sc,keyId:null}]}:null:(_.C("Unable to parse WV PSSH data. Can not create PR data!"),null)},XH=function(a,b){const c=VG(a.node,LG,"pro");if(!c)return _.C(uG,a),null;a=_.ei(c.textContent);a=_.Xl(a);return a.version!==b&&(_.Mg(`Parsing from ${a.version} to ${b}.`),
39
+ a=_.Hx(a,b))?{keyId:null,Eb:OG,node:document.createElement("null"),init:[{initData:_.Fx(a),initDataType:_.Sc,keyId:null}]}:null},$H=function(a,b,c,d){const e=YH(a);let f=null;a=[];let g=[];const h=TH(e,_.sd),k=TH(e,_.pd);if(k&&d){var l=XH(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=VH(k))&&e.push(l);h&&!k&&(d=WH(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(_.G,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"==m.Eb?(f=m.init||f,!1):!0),g.length&&
40
+ (a=ZH(f,g,c),0==a.length&&(a=[_.Qx(_.se,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of SH.values())m!=_.Be&&a.push(_.Qx(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{Lc:b,Ah:f,drmInfos:a,We:!0}},YH=function(a){const b=[];for(const c of a)(a=aI(c))&&b.push(a);return b},ZH=function(a,b,c){const d=[];for(const f of b){var e=SH.get(f.Eb);if(e){b=_.Qx(e,f.init||a,c);if(e=bI.get(e))b.licenseServerUri=e(f);d.push(b)}}return d},cI=function(a,b,
41
+ c,d,e){const f=$H(a,c,d,e);if(b.We){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.Lc=f.Lc||b.Lc;b.We=!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(_.G,4,4008);return f.Lc||b.Lc},aI=function(a){let b=a.getAttribute(IG),c=WG(a,MG,"default_KID");const d=UG(a,MG,"pssh").map(_.Ll),e=VG(a,LG,"pro");if(!b)return _.Ng("Missing required schemeIdUri attribute on",
42
+ "ContentProtection element",a),null;b=b.toLowerCase();if(c&&(c=c.replace(/-/g,"").toLowerCase(),c.includes(" ")))throw new _.H(_.G,4,4009);let f=[];try{if(f=d.map(g=>({initDataType:_.Sc,initData:_.ei(g),keyId:null})),0===f.length&&e)try{const g=_.ei(e.textContent),h=_.Xl(g);f.push({initDataType:_.Sc,initData:_.Fx(h),keyId:null})}catch(g){_.C("Unable to parse ms:pro payload",g),f=[]}}catch(g){throw new _.H(_.G,4,4007);}return{node:a,Eb:b,keyId:c,init:0<f.length?f:null}},eI=function(a,b){dI(a).forEach(c=>
43
+ {c=c.getLastSegmentEndTime?c.getLastSegmentEndTime():0;if(0<c){var d=b.presentationTimeline;d.g=Math.max(d.g||0,c+b.ga.start)}})},fI=function(a,b){return _.Oy(_.gj(a,b))?_.t:a.split("/")[0]},dI=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)},hI=function(a){return _.x(function*(){var b=_.si(a.j,a.a.attemptParameters);b.type=1;var c=Date.now();b=a.D.networkingEngine.fetch(b);_.zi(a.l,b);b=yield b.P;if(!a.D)return 0;
44
+ b.uri&&!a.j.includes(b.uri)&&a.j.unshift(b.uri);yield gI(a,b.data,b.uri);c=(Date.now()-c)/1E3;_.qy(a.G,1,c);return c})},iI=function(a,b){0>a.g||a.w.ca(Math.max(3,a.g-b,_.ry(a.G)))},gI=function(a,b,c){return _.x(function*(){var d=eH(b,"MPD");if(!d)throw new _.H(_.G,4,4001,c);d=kH(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.zi(a.l,d);d=yield d.P;return jI(a,d,c)})},jI=function(a,b,c){return _.x(function*(){var d=[c],e=_.Jl(b,"Location").map(_.Ll).filter(_.kh);0<e.length&&
45
+ (d=_.Px(d,e),a.j=d);e=_.Jl(b,"BaseURL").map(_.Ll);var f=_.Px(d,e),g=XG(b,"minBufferTime",ZG,0);d=b.getAttribute("type")||JG;a.g=XG(b,"minimumUpdatePeriod",ZG,-1);d===JG&&0<=a.g&&(a.h.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),a.g=-1,a.w.stop());var h=XG(b,"availabilityStartTime",YG);e=XG(b,"timeShiftBufferDepth",ZG);var k=XG(b,"suggestedPresentationDelay",ZG);const l=XG(b,"maxSegmentDuration",ZG),m=d===JG&&"dynamic"===
46
+ a.A;m&&(a.h.info("MPD dynamic to static transition."),d="dynamic");const n=d===JG;var q="dynamic"===d;if(a.f)g=a.f.presentationTimeline;else if(g=new _.fD(h,null!=k?k:3*g,d===JG,!!a.a.autoCorrectDrift),q&&(g=yield RH(a.H,b,f,g),!a.D))return;q={uc:q,presentationTimeline:g,va:null,ga:null,ua:null,N:null,bandwidth:0,Zd:!1,Ag:m,ye:null,Vc:null};{h=XG(b,"mediaPresentationDuration",ZG);k=[];var u=0;const D=_.Jl(b,"Period");for(let E=0;E<D.length;E++){var v=D[E];u=XG(v,_.pf,ZG,u);var y=XG(v,CG,ZG);let O=
47
+ null;if(E!=D.length-1){var A=XG(D[E+1],_.pf,ZG);null!=A&&(O=A-u)}else null!=h&&(O=h-u);A=_.pr;O&&y&&Math.abs(O-y)>A&&a.h.warn("There is a gap/overlap between Periods",v);null==O&&(O=y);v=kI(a,q,f,{start:u,duration:O,node:v,$d:null==O||E==D.length-1});k.push(v);y=q.va.id;a.C.includes(y)||(a.C.push(y),a.f&&(a.D.filterNewPeriod(v),a.f.periods.push(v)));if(null==O){E!=D.length-1&&a.h.warn("Skipping Period",E+1,"and any subsequent Periods:","Period",E+1,"does not have a valid start time.",k[E+1]);u=null;
48
+ break}u+=O}null==a.f&&a.D.filterAllPeriods(k);null!=h?(u!=h&&a.h.warn("@mediaPresentationDuration does not match the total duration of ","all Periods."),f={periods:k,duration:h,Te:!1}):f={periods:k,duration:u,Te:!0}}h=f.duration;k=f.periods;m&&(eI(k,q),g.l=!0,a.D.onEvent(new _.F(_.qe)));if(n||!m&&!f.Te)g.f=h||Infinity;g.isLive()&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)&&(e=a.a.availabilityWindowOverride);null==e&&(e=Infinity);g.w=e;_.wy(g,l||1);g.isLive();a.f||(a.f=
49
+ {presentationTimeline:g,periods:k,offlineSessionIds:[],minBufferTime:0});a.A=d})},kI=function(a,b,c,d){b.va=lI(a,d.node,null,c);b.ga=d;b.va.id||(a.h.info("No Period ID given for Period with start time "+d.start+", Assigning a default"),b.va.id="__clpp_period_"+d.start);c=_.Jl(d.node,"EventStream");for(var e of c)mI(a,d.start,d.duration,e);e=_.Jl(d.node,_.fa).map(u=>nI(a,b,u)).filter(_.kh);if(b.uc){c=[];for(var f of e)for(var g of f.Ug)c.push(g);if(c.length!=(new Set(c)).size)throw new _.H(_.G,4,
50
+ 4018);}f=e.filter(u=>!u.Ce);g=e.filter(u=>u.Ce);for(var h of g){g=h.streams[0];e=h.Ce;for(var k of f)if(k.id==e)for(var l of k.streams)l.trickModeVideo=g}k=oI(f,_.w);l=oI(f,_.p);if(!k.length&&!l.length)throw new _.H(_.G,4,4004);l.length||(l=[null]);k.length||(k=[null]);h=[];for(var m of l)for(var n of k)pI(a,m,n,h);n=[...oI(f,_.t),...oI(f,_.Ax)];m=[];for(var q of n)m.push.apply(m,q.streams);q=oI(f,_.Sd);n=[];for(const u of q)n.push.apply(n,u.streams);return{startTime:d.start,textStreams:m,thumbStreams:n,
51
+ variants:h}},lI=function(a,b,c,d){c=c||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,he:null};d=d||c.Ta;const e=_.Jl(b,"BaseURL").map(_.Ll);let f=b.getAttribute("contentType")||c.contentType;const g=b.getAttribute(_.me)||c.mimeType,h=b.getAttribute(_.kd)||c.codecs,k=XG(b,"frameRate",dH)||c.frameRate;var l=_.Jl(b,"InbandEventStream");var m=c.emsgSchemeIdUris.slice();for(var n of l)l=n.getAttribute(IG),m.includes(l)||m.push(l);n=_.Jl(b,"AudioChannelConfiguration");a=qI(a,
52
+ n)||c.he;f||(f=fI(g,h));return{Ta:_.Px(d,e),bd:_.Kl(b,"SegmentBase")||c.bd,Ub:_.Kl(b,"SegmentList")||c.Ub,kc:_.Kl(b,"SegmentTemplate")||c.kc,width:XG(b,_.fg,cH)||c.width,height:XG(b,_.Pd,cH)||c.height,contentType:f,mimeType:g,codecs:h,frameRate:k,emsgSchemeIdUris:m,id:b.getAttribute("id"),he:a}},mI=function(a,b,c,d){const e=d.getAttribute(IG)||"",f=d.getAttribute(_.Kf)||"",g=XG(d,KG,cH)||1;for(const k of _.Jl(d,"Event")){d=XG(k,"presentationTime",cH)||0;var h=XG(k,CG,cH)||0;d=d/g+b;h=d+h/g;null!=
53
+ c&&(d=Math.min(d,b+c),h=Math.min(h,b+c));let l=_.Ug;e.startsWith(_.Gf)?l=_.Wg:"urn:mpeg:dash:event:callback:2015"===e&&(l=_.re);const m={schemeIdUri:e,value:f,startTime:d,endTime:h,id:k.getAttribute("id")||"",type:l,eventElement:k};m.type===_.re&&(m.zd=()=>{if(m.eventElement){var n=m.eventElement.getAttribute("messageData")||"";n&&n.startsWith("http")&&(n=_.si(n),n.type=_.ri,a.D.networkingEngine.fetch(n))}});a.D.onTimelineCueAdded(m)}},nI=function(a,b,c){b.ua=lI(a,c,b.va,null);let d=!1;var e=_.Jl(c,
54
+ "Role");const f=e.map(O=>O.getAttribute(_.Kf)).filter(_.kh);let g=null;var h=_.Jl(c,"Label").map(O=>O.textContent).filter(_.kh);h&&0<h.length&&(g=h[h.length-1]);let k=void 0;(h=b.ua.contentType==_.t)&&(k=_.Ax);for(var l of e)if(e=l.getAttribute(IG),null==e||"urn:mpeg:dash:role:2011"===e||"urn:mpeg:dash:role"===e)switch(e=l.getAttribute(_.Kf),e){case _.he:d=!0;break;case _.nx:case _.Ax:k=e;break;case "forced-subtitle":case "forced_subtitle":case "forced":k="forced"}e=_.Jl(c,sG);l=null;for(var m of e){e=
55
+ m.getAttribute(IG);var n=m.getAttribute(_.Kf);if(e!==DG&&!rI.includes(e)||void 0===n)return null;e===DG&&(l=n)}m=_.Jl(c,"Accessibility");const q=new Map;for(var u of m)if(e=u.getAttribute(IG),"urn:scte:dash:cc:cea-608:2015"==e||"urn:scte:dash:cc:cea-708:2015"==e)if(e=1,n=u.getAttribute(_.Kf),null!=n)for(var v of n.split(";")){if(v.includes("\x3d")){var y=v.split("\x3d");n=y[0].startsWith("CC")?y[0]:"CC"+y[0];y=y[1].split(",")[0].split(":").pop()}else n="CC"+e,e+=2,y=v;q.set(n,_.Ch(y))}else q.set("CC1",
56
+ _.Df);u=_.Jl(c,rG);const A=$H(u,a.a.ignoreDrmInfo,b.va.id,a.a.playreadyVersion||null),D=c.getAttribute("lang")||_.Df;u=_.Ch(D);null==g&&(g=c.getAttribute("label"));v=_.Jl(c,_.wb);c=v.map(O=>sI(a,b,A,k,D,g,d,f,q,O)).filter(O=>!!O);if(0==c.length){if(h)return null;throw new _.H(_.G,4,4003);}if(!b.ua.contentType||b.ua.contentType==BG){b.ua.contentType=fI(c[0].mimeType,c[0].codecs);for(var E of c)E.type=b.ua.contentType}for(const O of c)for(const tb of A.drmInfos)O.keyId&&!tb.keyIds.includes(O.keyId)&&
57
+ tb.keyIds.push(O.keyId);c=tI(c,b.ua.contentType,m);E=v.map(O=>O.getAttribute("id")).filter(_.kh);return{id:b.ua.id||"__fake__"+a.o++,contentType:b.ua.contentType,language:u,originalLanguage:D,de:d,streams:c,drmInfos:A.drmInfos,Ce:l,Ug:E}},oI=function(a,b){return a.filter(c=>c.contentType==b)},pI=function(a,b,c,d){if(b||c)if(b&&c){if(_.Xx(b.drmInfos,c.drmInfos)){var e=_.Wx(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.o++,language:b.language,
58
+ primary:b.de||c.de,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.o++,language:f.language||_.Df,primary:f.de,audio:b?e:null,video:c?e:null,bandwidth:g,drmInfos:f.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(g)}},sI=function(a,b,c,d,e,f,g,h,k,l){const m=_.Ch(e);b.N=lI(a,l,b.ua,null);if(!uI(a,b.N))return a.h.warn("Skipping Representation",b.N),null;b.ye=`${b.va.id} ${b.N.id}`;
59
+ b.Vc=a.B.get(b.ye);b.bandwidth=XG(l,"bandwidth",bH)||0;let n;var q=b.N.contentType,u=q==_.t||q==BG,v=q==_.Sd;try{if(q=(A,D,E)=>vI(a,A,D,E),b.N.bd)n=zH(b,q);else if(b.N.Ub)n=NH(b,a.F);else if(b.N.kc)n=HH(b,q,a.F,!!a.f);else{const A=b.N.Ta,D=b.ga.duration||0;n={createSegmentIndex:()=>Promise.resolve(),findSegmentPosition:E=>0<=E&&E<D?1:null,getSegmentReference:E=>1!=E?null:new _.Fy(1,0,D,()=>A,0,null,0),adjustSegmentDurations:()=>{},getLastSegmentEndTime:()=>D,getDuration:()=>D,initSegmentReference:null,
60
+ ya:0}}}catch(A){if(u&&4002==A.code)return null;throw A;}a.B.set(b.ye,n.ya);u=_.Jl(l,rG);u=cI(u,c,a.a.ignoreDrmInfo,b.va.id,a.a.playreadyVersion||null);q=!1;_.Jl(l,"SupplementalProperty").some(A=>"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"==A.getAttribute(IG)&&"JOC"==A.getAttribute(_.Kf))&&(b.N.mimeType="audio/eac3-joc",q=!0);var y=void 0;v&&(v=(v=(l=_.Kl(l,sG))&&l.getAttribute(IG))||"",wI.includes(v)&&(l=(l=l.getAttribute(_.Kf))&&l.split("x").map(A=>parseInt(A,10)))&&2==l.length&&(n.horizontalTiles=
61
+ l[0],n.verticalTiles=l[1],b.ua.kc&&(l=n.horizontalTiles*n.verticalTiles,y=(y=XG(b.ua.kc,CG,cH)||0)?y/l:void 0)));return{id:a.o++,originalId:b.N.id,createSegmentIndex:n.createSegmentIndex,findSegmentPosition:n.findSegmentPosition,getSegmentReference:n.getSegmentReference,initSegmentReference:n.initSegmentReference,adjustSegmentDurations:n.adjustSegmentDurations,getLastSegmentEndTime:n.getLastSegmentEndTime,getDuration:n.getDuration,segmentLookupStrategy:_.qx,mimeType:b.N.mimeType,codecs:b.N.codecs,
62
+ frameRate:b.N.frameRate,bandwidth:b.bandwidth,width:b.N.width,height:b.N.height,kind:d,encrypted:0<c.drmInfos.length,keyId:u,language:m,originalLanguage:e,label:f,type:b.ua.contentType,primary:g,trickModeVideo:null,emsgSchemeIdUris:b.N.emsgSchemeIdUris,roles:h,channelsCount:b.N.he,spatialAudio:q,closedCaptions:k,horizontalTiles:n.horizontalTiles,verticalTiles:n.verticalTiles,durationPerTile:y}},tI=function(a,b,c){const d=b===_.Ax?_.t:b;b=c.map(e=>({scheme:e.getAttribute(IG)||"",id:e.getAttribute("id")||
63
+ void 0,value:e.getAttribute(_.Kf)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=b;return a},uI=function(a,b){let c;c=b.bd?1:0;c+=b.Ub?1:0;c+=b.kc?1:0;if(0==c){if(b.contentType==_.t||b.contentType==BG)return!0;a.h.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.h.warn("Representation contains multiple segment information sources:",
64
+ "the Representation should only contain one of SegmentBase,","SegmentList, or SegmentTemplate.",b),b.bd?(a.h.info("Using SegmentBase by default."),b.Ub=null):a.h.info("Using SegmentList by default."),b.kc=null);return!0},vI=function(a,b,c,d){return _.x(function*(){var e=_.sy(b,c,d,a.a.attemptParameters);e.type=2;e=a.D.networkingEngine.fetch(e);_.zi(a.l,e);return(yield e.P).data})},qI=function(a,b){for(const d of b){b=d.getAttribute(IG);if(!b)continue;const e=d.getAttribute(_.Kf);if(e)switch(b){case "urn:mpeg:dash:outputChannelPositionList:2012":return e.trim().split(/ +/).length;
65
+ 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.h.warn(qG,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.h.warn(qG,b,e);continue}for(a=0;c;)c&1&&++a,c>>=1;return a;default:a.h.warn("Unrecognized audio channel scheme:",b,e)}}return null},wI=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],
66
+ rI=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var tH=class{constructor(a){this.f=a;this.a=new _.Ql(a,!1)}},pH=[[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]],qH=class{constructor(a,b){this.id=a;this.a=b}};var AH=class{parse(a,b,c,d){var e;b=new tH(new DataView(b));if(440786851!=rH(b).id)throw _.Ng("Not an EBML element."),new _.H(_.G,3,3008);var f=rH(b);if(408125543!=f.id)throw _.Ng("Not a Segment element."),new _.H(_.G,3,3009);b=f.a.byteOffset;f=new tH(f.a);for(e=null;_.Mk(f.a);){var g=rH(f);if(357149030==g.id){e=g;break}}if(!e)throw _.Ng("Not an Info element."),new _.H(_.G,3,3010);e=new tH(e.a);g=1E6;for(f=null;_.Mk(e.a);){const h=rH(e);if(2807729==h.id)g=sH(h);else if(17545==h.id)if(f=h,4==f.a.byteLength)f=
67
+ f.a.getFloat32(0);else if(8==f.a.byteLength)f=f.a.getFloat64(0);else throw new _.H(_.G,3,3003);}if(null==f)throw new _.H(_.G,3,3011);e=g/=1E9;f*=g;a=rH(new tH(new DataView(a)));if(475249515!=a.id)throw _.Ng("Not a Cues element."),new _.H(_.G,3,3007);return vH(a,b,e,f,c,d)}};var xI=class{constructor(a,b){this.h=a;this.f=b;this.a={clockSyncUri:void 0}}};var SH=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Be).set(PG,_.sd).set(OG,_.pd).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.pd).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.nd).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.md),bI=(new Map).set(_.sd,function(a){return(a=VG(a.node,"urn:microsoft","laurl"))?a.getAttribute("licenseUrl")||"":""}).set(_.pd,function(a){a=VG(a.node,LG,"pro");if(!a)return"";a=_.ei(a.textContent);return _.Xl(a).g||""}),UH=new _.R("clpp.dash.ContentProtection");var yI=class{constructor(){this.D=this.a=null;this.j=[];this.f=null;this.C=[];this.o=1;this.F={};this.g=0;this.G=new _.eD(5);this.w=new _.kj(()=>{this.Cb()});this.l=new _.Ar;this.h=new _.R("clpp.dash.DashParser");this.A=null;this.H=new xI(this.h,(a,b)=>{a=_.si(a,this.a.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.zi(this.l,b);return b.P});this.B=new Map}configure(a){this.a=a;this.H.a={clockSyncUri:a.clockSyncUri}}start(a,b){const c=this;return _.x(function*(){c.j=[a];
68
+ c.D=b;const d=yield hI(c);c.D&&iI(c,d);if(!c.D)throw new _.H(_.G,7,7001);return c.f})}stop(){this.a=this.D=null;this.j=[];this.f=null;this.C=[];this.F={};this.A=null;this.g=-1;this.w.stop();this.B.clear();return this.l.destroy()}update(){hI(this).catch(a=>{if(this.D&&a)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}Cb(){const a=this;return _.x(function*(){a.h.debug(_.hx);let b=0;try{b=yield hI(a)}catch(c){if(a.D&&c.a&&(a.D.onError(c),c.severity===_.G))return}a.D&&iI(a,b)})}};_.z("clpp.dash.DashComponent",class extends _.xs{f(){_.kq.mpd=yI;_.iq[_.sc]=yI}a(){_.My("mpd");_.Ny(_.sc)}id(){return"dash"}});};f.call(g, window);